/* Bingo – Design angelehnt an RadioReport */
:root {
  --teal:        #4ba7b9;
  --teal-dark:   #3d94a7;
  --teal-mid:    #4faec0;
  --teal-deep:   #2c7d8f;
  --grey-head:   #808080;
  --grey-light:  #a8a8a8;
  --grey-tile:   #e2e2e2;
  --tile-muted:  #cfe3e8;
  --bg:          #f6f6f6;
  --ink:         #1b1b1b;
  --line:        #e0e0e0;
  --radius:      6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

/* ---------------------------------------------------------------- Header */

.header { background: var(--teal); padding: 0 0 34px; position: relative; }

.topbar { display: flex; align-items: center; gap: 18px; padding: 16px 36px; }

.burger {
  background: none; border: 0; padding: 4px; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; width: 34px;
}
.burger span { display: block; height: 3px; background: var(--ink); border-radius: 2px; }

.brand { font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.divider { width: 2px; height: 34px; background: rgba(0,0,0,.35); }
.version { font-size: 22px; font-weight: 400; letter-spacing: .01em; }
.topbar .spacer { flex: 1; }

.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px; letter-spacing: .04em;
}
.pill {
  background: var(--ink); color: #fff; border: 0; cursor: pointer;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  padding: 6px 12px; border-radius: 999px; text-transform: uppercase;
}
.pill:hover { background: #000; }

.page-title {
  font-size: clamp(34px, 5vw, 56px); font-weight: 300;
  letter-spacing: -.01em; margin: 10px 0 0; padding: 0 36px;
}
.page-sub { padding: 6px 36px 0; font-size: 14px; color: rgba(0,0,0,.55); }

/* ------------------------------------------------------------------ Menü */

.menu {
  position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40;
  background: #fff; box-shadow: 0 0 40px rgba(0,0,0,.25);
  transform: translateX(-100%); transition: transform .18s ease;
  display: flex; flex-direction: column; padding: 18px 0;
}
.menu.open { transform: none; }
.menu h3 { margin: 0 22px 12px; font-size: 11px; letter-spacing: .12em; color: var(--grey-head); text-transform: uppercase; }
.menu a, .menu button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 13px 22px; font-size: 15px; color: var(--ink); text-decoration: none; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: #f0f0f0; }
.menu a.current { font-weight: 700; box-shadow: inset 4px 0 0 var(--teal); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; display: none; }
.scrim.open { display: block; }

.helptab {
  position: fixed; right: 0; top: 46%; z-index: 20;
  background: var(--teal); color: #fff; border: 0; cursor: pointer;
  writing-mode: vertical-rl; padding: 14px 7px;
  border-radius: 6px 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em;
}

/* --------------------------------------------------------------- Layout */

.wrap { max-width: 1320px; margin: 0 auto; padding: 34px 36px 60px; }

.section-head {
  background: var(--grey-head); color: #fff; border-radius: var(--radius);
  text-align: center; font-size: clamp(18px, 2.2vw, 30px); font-weight: 400;
  padding: 12px 16px; margin-bottom: 8px;
}

/* ------------------------------------------------------------ Spielstand */

.scoreboard { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.score-card {
  background: var(--grey-head); color: #fff; border-radius: var(--radius);
  padding: 14px 20px; display: grid; grid-template-columns: 1fr auto; row-gap: 2px;
  transition: background .2s ease;
}
.score-card.light { background: var(--grey-light); }
.score-card.winner { background: var(--ink); }
.score-name { font-size: clamp(15px, 1.8vw, 22px); font-weight: 400; }
.score-value {
  grid-row: span 2; align-self: center; padding-left: 16px;
  font-size: clamp(26px, 3.2vw, 38px); font-weight: 700; line-height: 1;
}
.score-meta { font-size: 12px; opacity: .85; }
.dot-live { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.45); display: inline-block; margin-right: 7px; }
.dot-live.on { background: #7fe0a3; }

.board-actions { margin-top: 14px; display: flex; justify-content: flex-end; }
.board-actions .btn { width: auto; padding: 11px 22px; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; display: none; }
#confetti.on { display: block; }

/* --------------------------------------------------------------- Kacheln */

.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }

.cell {
  background: var(--teal-mid); color: #fff; border: 0; border-radius: var(--radius);
  min-height: 86px; padding: 10px 8px; cursor: pointer;
  font-size: clamp(11px, 1.05vw, 14px); font-weight: 700; line-height: 1.25;
  display: grid; place-items: center; text-align: center;
  position: relative; transition: background .12s ease, transform .08s ease;
  overflow: hidden; hyphens: auto;
}
.cell:nth-child(even) { background: var(--teal-dark); }
.cell:hover { background: var(--teal-deep); }
.cell:active { transform: scale(.985); }
.cell.marked { background: var(--ink); }
.cell.marked::after { content: "✓"; position: absolute; top: 4px; right: 8px; font-size: 13px; opacity: .8; }
.cell.line { background: var(--ink); box-shadow: inset 0 0 0 3px var(--teal-mid); }
.cell.free { background: var(--grey-light); cursor: default; letter-spacing: .12em; }
.cell.free.line { background: var(--ink); }

/* -------------------------------------------------------------- Warteraum */

.lobby {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px 28px;
}
.lobby-lead { margin: 0 0 18px; font-size: clamp(16px, 2vw, 20px); font-weight: 300; }
.lobby-status { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; }
.lobby-status li {
  display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px;
  background: var(--bg); border-radius: var(--radius); padding: 13px 16px; font-size: 14px;
}
.lobby-status li.ok { background: var(--tile-muted); }
.lobby-status .tick { font-size: 16px; color: var(--grey-light); text-align: center; }
.lobby-status li.ok .tick { color: var(--teal-deep); }
.lobby-status .who { font-weight: 700; }
.lobby-status .what { color: #6a6a6a; }
.lobby .btn { max-width: 320px; }

.grid.locked .cell { cursor: default; }
.grid.locked .cell:hover { background: var(--teal-mid); }
.grid.locked .cell:nth-child(even):hover { background: var(--teal-dark); }
.grid.locked .cell.marked:hover, .grid.locked .cell.line:hover { background: var(--ink); }
.grid.locked .cell.free:hover { background: var(--grey-light); }

.result-lead { margin: 0 0 16px; font-size: 15px; }
.winline { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.winline span {
  background: var(--ink); color: #fff; border-radius: 4px;
  padding: 6px 10px; font-size: 12px; font-weight: 700;
}

/* --------------------------------------------------------------- Banner */

.banner {
  background: var(--ink); color: #fff; border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 14px; font-weight: 700; letter-spacing: .02em;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.banner.win { background: var(--teal-deep); }
.banner.lose { background: var(--grey-head); }

/* -------------------------------------------------------------- Buttons */

.btn {
  display: block; width: 100%; background: var(--teal); color: #fff; border: 0;
  border-radius: var(--radius); padding: 13px 16px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--teal-deep); }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f0f0f0; }
.btn + .btn { margin-top: 8px; }

/* ------------------------------------------------------- Einstellungen */

.termlist { display: grid; gap: 8px; }
.term {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
  background: var(--teal-dark); color: #fff; border-radius: var(--radius); padding: 12px 14px;
  font-weight: 700; font-size: 14px;
}
.term.inactive { background: var(--tile-muted); color: #6c8a91; }
.term .text { cursor: text; outline: none; padding: 2px 4px; border-radius: 3px; }
.term .text:focus { background: rgba(255,255,255,.2); }
.term.inactive .text:focus { background: rgba(0,0,0,.06); }
.mini {
  background: rgba(0,0,0,.25); color: #fff; border: 0; border-radius: 4px; cursor: pointer;
  font-size: 10px; font-weight: 700; letter-spacing: .07em; padding: 6px 10px; text-transform: uppercase;
}
.mini:hover { background: rgba(0,0,0,.45); }
.term.inactive .mini { background: rgba(0,0,0,.18); }

.addrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 18px; }
.addrow input { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; font-size: 15px; background: #fff; }
.addrow input:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
.addrow .btn { width: auto; padding: 13px 26px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; font-size: 14px; }
.toolbar .spacer { flex: 1; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.scorebar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 20px; font-size: 14px;
}
.scorebar b { font-size: 22px; }
.scorebar .score-pair { display: inline-flex; align-items: baseline; gap: 8px; }
.scorebar .colon { color: var(--grey-light); font-size: 20px; }
.scorebar .spacer { flex: 1; }

.note { font-size: 13px; color: #6a6a6a; margin: 0 0 16px; }
.warn { background: #fff4d6; border: 1px solid #f0d488; border-radius: var(--radius); padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }

/* ----------------------------------------------------------------- Login */

.login-page { min-height: 100vh; background: var(--teal); display: grid; place-items: center; padding: 24px; }
.login-card { background: #fff; border-radius: 10px; padding: 34px; width: min(460px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.login-card h1 { font-size: 30px; font-weight: 300; margin: 18px 0 4px; }
.login-card p.lead { margin: 0 0 22px; color: #6a6a6a; font-size: 14px; }
.player-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.player-pick button {
  background: var(--tile-muted); color: #4e7d88; border: 0; border-radius: var(--radius);
  padding: 16px 10px; font-weight: 700; cursor: pointer;
}
.player-pick button.sel { background: var(--teal-dark); color: #fff; }
.login-card input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-size: 15px; margin-bottom: 12px; }
.login-card input:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
.error { color: #b3261e; font-size: 14px; min-height: 20px; margin: 4px 0 0; }

/* ---------------------------------------------------------------- Dialog */

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; place-items: center; z-index: 50; padding: 20px; }
.overlay.open { display: grid; }
.sheet { background: #fff; border-radius: 10px; padding: 28px; max-width: 540px; width: 100%; }
.sheet h3 { margin: 0 0 12px; font-weight: 300; font-size: 26px; }
.sheet ul { margin: 0 0 18px; padding-left: 20px; font-size: 14px; line-height: 1.7; }
.sheet .row { display: flex; gap: 8px; }
.sheet .row .btn { width: auto; flex: 1; }

@media (max-width: 640px) {
  .topbar { padding: 14px 18px; gap: 12px; }
  .version, .divider { display: none; }
  .page-title, .page-sub { padding-inline: 18px; }
  .wrap { padding: 22px 18px 50px; }
  .cell { min-height: 62px; font-size: 10px; padding: 6px 4px; }
  .score-card { padding: 10px 12px; }
  .score-meta { font-size: 11px; }
}
