/* Játék tab (round hero, lock card, standings, FAB, idle screen), the round-entry sheet,
   plus shared game pieces other modules use (chips, tags, rounds table, compact steppers).
   Prototype: docs/design/midnight-board.html (.hero .pcard .timer .trump .lockcard .fab .st .gapl). */

/* ---------- chips and tags (shared) ---------- */
.chip {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.chip-sm { width: 22px; height: 22px; font-size: 10px; }
.chip-lg { width: 40px; height: 40px; font: 700 15px var(--font-head); }
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font: 600 11.5px var(--font-mono); font-variant-numeric: tabular-nums;
  background: var(--accent-soft); color: var(--accent);
}
.tag.g { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.tag.b { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.tag.w { background: var(--warn-soft); color: var(--warn); }
.tag.n { background: var(--surface-alt); color: var(--muted); }
.tag.big { font-size: 16px; padding: 6px 12px; }
.eyebrow { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.idle-title { font-family: var(--font-head); font-size: 26px; font-weight: 700; letter-spacing: -0.025em; margin: 6px 0 8px; text-wrap: balance; }
.nm-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- brand row extras ---------- */
.watch-tag { margin-left: auto; max-width: 55%; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-body); }
.watch-tag + .live { margin-left: 0; }

/* ---------- round hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 18px;
  background: var(--hero); color: #FFFFFF; box-shadow: var(--glow);
}
.hero::after {
  content: attr(data-suit); position: absolute; right: -14px; top: -34px;
  font-size: 150px; line-height: 1.2; opacity: 0.1; pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { color: inherit; opacity: 0.8; }
.hero-row { display: flex; gap: 16px; align-items: center; }
.pcard {
  position: relative; flex-shrink: 0; width: 78px; height: 108px; border-radius: 13px;
  background: var(--cardface); color: var(--cardink); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.27);
  transform: rotate(-4deg); display: grid; place-items: center; font: 700 46px var(--font-head);
}
.pcard.red { color: var(--cardred); }
.pcard small { position: absolute; left: 7px; top: 6px; font: 700 11px var(--font-mono); line-height: 1.1; text-align: center; }
.pcard small + span + small { left: auto; top: auto; right: 7px; bottom: 6px; transform: rotate(180deg); }
.hero-info { flex: 1; min-width: 0; }
.hero-title { margin: 3px 0 8px; font: 700 21px var(--font-head); letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
.roles { display: flex; flex-direction: column; gap: 6px; }
.role { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; min-width: 0; }
.role-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-label { width: 36px; flex-shrink: 0; font: 600 10.5px var(--font-body); text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; }
.hero .role .chip { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); }

.htrump { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.htrump button {
  flex: 1; min-width: 0; height: 38px; border: 0; border-radius: 12px; cursor: pointer; touch-action: manipulation;
  background: rgba(255, 255, 255, 0.13); color: #FFFFFF; font-size: 20px; line-height: 1;
}
.htrump button.red { color: #FFC0D2; }
.htrump button.on { background: var(--cardface); color: var(--cardink); }
.htrump button.on.red { color: var(--cardred); }
.htrump button:disabled { cursor: default; }
.htrump button:disabled:not(.on) { opacity: 0.55; }

.hbars { display: flex; align-items: flex-end; gap: 4px; height: 38px; margin-top: 16px; }
.hbars i { flex: 1; min-width: 2px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); }
.hbars i.d { background: rgba(255, 255, 255, 0.4); }
.hbars i.n { background: #FFFFFF; box-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }

.gtimer {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 9px 10px 9px 14px;
  border-radius: 16px; background: rgba(0, 0, 0, 0.2); font-size: 12.5px;
}
.gtimer .tm { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.gtimer .tm-line { display: inline-flex; align-items: center; gap: 6px; }
.gtimer .tm-val { font: 700 15px var(--font-mono); font-variant-numeric: tabular-nums; }
.gtimer small { opacity: 0.8; font-size: 11.5px; }
.gtimer .tm-item { white-space: nowrap; }
.gtimer small .tm-val { font: 600 11.5px var(--font-mono); }
.gtimer.paused { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.gtimer.paused .tm { color: #FFE3A0; }
.tm-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; min-height: 36px;
  border: 0; border-radius: 12px; background: var(--cardface); color: var(--cardink);
  font: 700 12.5px var(--font-body); cursor: pointer; touch-action: manipulation;
}
@media (prefers-reduced-motion: no-preference) {
  .gtimer.paused .tm-line .ico { animation: tm-blink 1.6s ease-in-out infinite; }
}
@keyframes tm-blink { 50% { opacity: 0.25; } }

/* Victory (all rounds played, game not closed) and idle hero */
.hero.victory { text-align: center; }
.hero.victory .crown { display: block; font-size: 34px; line-height: 1; color: var(--gold); margin-bottom: 6px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25)); }
.hero.victory .hero-title { font-size: 26px; margin: 6px 0 2px; }
.victory-sub { margin: 0; opacity: 0.9; font: 600 15px var(--font-mono); }
.victory-help { margin: 12px 0 0; font-size: 13px; line-height: 1.45; opacity: 0.9; }
.victory-help b { font-weight: 700; }
.hero-btn {
  width: 100%; margin-top: 14px; padding: 15px; border: 0; border-radius: 16px; cursor: pointer; touch-action: manipulation;
  background: var(--cardface); color: var(--cardink); font: 700 15.5px var(--font-body);
}
.hero-btn:active { opacity: 0.85; }
.hero.idle { padding: 20px 18px 18px; }
.hero.idle .idle-title { font-size: 30px; margin: 6px 0 8px; }
.idle-text { margin: 0 0 2px; font-size: 14px; line-height: 1.45; opacity: 0.9; }
button.link.hero-link { color: #FFFFFF; display: block; margin: 8px auto 0; text-decoration: underline; text-underline-offset: 3px; }

.gsec { display: flex; flex-direction: column; gap: 10px; }
.gsec .sec-title { margin: 8px 2px 0; }
.gsec .podium { margin-bottom: 4px; }

/* ---------- old (pre-redesign) victory block, still used by the game detail sheet ---------- */
.victory:not(.hero) { text-align: center; padding: 6px 0 4px; }
.victory:not(.hero) .crown { font-size: 34px; color: var(--gold); display: block; line-height: 1; }
.victory:not(.hero) h3 { margin: 8px 0 2px; font-family: var(--font-head); font-size: 24px; font-weight: 600; text-wrap: balance; }
.victory:not(.hero) p { margin: 4px 0 0; }

/* ---------- lock card ---------- */
.lockcard {
  border-radius: 22px; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
}
.lockcard .lh { display: flex; align-items: center; gap: 8px; font: 700 14px var(--font-body); }
.lockcard .lh .tag { margin-left: auto; }
.slots { display: flex; gap: 5px; margin: 12px 0 10px; }
.slots i { flex: 1; min-width: 0; max-width: 34px; height: 30px; border-radius: 8px; border: 1.5px dashed var(--border); }
.slots i.f { border: 0; background: var(--div-under); }
.slots i.x { border: 0; background: var(--div-over); }
.lockcard p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.lockcard p b { color: var(--ink); font-family: var(--font-mono); }

/* ---------- standings ---------- */
.gstand { display: flex; flex-direction: column; }
.st-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 4px 2px 10px; }
.st-head-r { font-size: 12px; color: var(--muted); font-weight: 500; text-align: right; }
.stlist { display: flex; flex-direction: column; gap: 8px; }
.strow {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card);
}
.strow.lead { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.strow.out { opacity: 0.6; }
.strow .rk { width: 18px; flex-shrink: 0; text-align: right; font: 600 13px var(--font-mono); color: var(--muted); }
.st-mid { flex: 1; min-width: 0; }
.strow .nm { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15.5px; min-width: 0; }
.strow .od { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.strow .od b { font-weight: 600; }
.strow .od b.w { color: var(--good); }
.strow .od b.o { color: var(--bad); }
.st-end { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.strow .tt { font: 700 22px var(--font-head); letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.gapl {
  display: flex; align-items: center; gap: 8px; margin: -3px 14px;
  font: 500 11px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums;
}
.gapl::before, .gapl::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.gapl span { flex: 0 1 auto; text-align: center; }
.gapl.tie { color: var(--warn); }
.gapl.lock { color: var(--bad); }
.watch-note { margin: 0; }

/* ---------- floating entry button ---------- */
/* Tab bar ≈ 69 px + safe area; the button sits ~12 px above it. The page already pads 104 px for the
   tab bar; the spacer adds the button's height so the last row scrolls clear of it. */
.fabpad { height: 42px; flex-shrink: 0; }
.fabfade {
  position: fixed; left: 0; right: 0; z-index: 30; pointer-events: none;
  bottom: calc(66px + env(safe-area-inset-bottom)); height: 110px;
  background: linear-gradient(transparent, var(--bg) 65%);
}
.fab {
  position: fixed; z-index: 35; left: 0; right: 0; margin: 0 auto;
  width: calc(100% - 36px - env(safe-area-inset-left) - env(safe-area-inset-right)); max-width: 524px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: 16px; border: 0; border-radius: 20px; cursor: pointer; touch-action: manipulation;
  background: var(--accent); color: var(--accent-ink); font: 700 16px var(--font-body); box-shadow: var(--glow);
}
.fab:active { opacity: 0.9; }
body.sheet-open .fab, body.sheet-open .fabfade { visibility: hidden; }
/* Keep toasts above the button while it is shown. */
body:not(.sheet-open):has(.fab) .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

/* ---------- round-entry sheet ---------- */
.esteps { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.esteps li {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 12px;
  font: 600 12.5px var(--font-body); background: var(--surface-alt); color: var(--muted);
}
.esteps li.on { background: var(--accent); color: var(--accent-ink); }
.esteps li.d { background: var(--accent-soft); color: var(--accent); }
.esub { margin: -6px 0 -8px; font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.esub b { color: var(--ink); }
.esub-trump { font-size: 16px; }
.esub-trump.red { color: var(--cardred); }
.er-list { display: flex; flex-direction: column; }
.er { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.er:last-child { border-bottom: 0; }
.er-nm { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 600; font-size: 16px; }
.er-nm small { font-weight: 500; font-size: 11.5px; color: var(--warn); }
.er-nm small.muted { color: var(--muted); }
.stp { display: flex; align-items: center; gap: 4px; background: var(--surface-alt); border-radius: 16px; padding: 4px; flex-shrink: 0; }
.stp button {
  width: 44px; height: 44px; border: 0; border-radius: 12px; padding: 0; cursor: pointer; touch-action: manipulation;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card);
  display: grid; place-items: center;
}
.stp button:active { background: var(--accent-soft); }
.stp button:disabled { opacity: 0.3; cursor: default; }
.stp output { min-width: 32px; text-align: center; font: 700 20px var(--font-mono); font-variant-numeric: tabular-nums; }
.efoot { display: flex; align-items: center; gap: 12px; }
.efoot button.primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; }
.efoot button.ghost { flex: none; width: 54px; align-self: stretch; display: grid; place-items: center; padding: 0; }
.sum {
  flex-shrink: 0; padding: 7px 13px; border-radius: 14px; line-height: 1.15;
  background: var(--warn-soft); color: var(--warn);
}
.sum b { display: block; font: 700 17px var(--font-mono); font-variant-numeric: tabular-nums; }
.sum small { display: block; font: 600 11px var(--font-body); margin-top: 1px; white-space: nowrap; }
.sum.ok { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.sum.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
button.link.center { display: inline-flex; align-items: center; justify-content: center; gap: 6px; align-self: center; margin-top: -8px; }

/* ---------- compact entry rows (round-edit sheet) ---------- */
.col-labels, .sum-row { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.col-labels { padding-bottom: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.col-labels .spacer, .sum-label { flex: 1; min-width: 0; }
.colhead, .sum-cell { width: 86px; flex-shrink: 0; text-align: center; }
.colhead.locked { display: inline-flex; align-items: center; justify-content: center; gap: 3px; color: var(--accent); }
.entry-row { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.entry-row .chip { width: 26px; height: 26px; font-size: 11px; }
.name-cell { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.name-cell .nm { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.name-cell .tag { font-size: 10px; padding: 1px 6px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 3px; width: 86px; flex-shrink: 0; }
.stepper button {
  width: 30px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-alt); color: var(--ink);
  font-size: 17px; line-height: 1; cursor: pointer; touch-action: manipulation;
  display: flex; align-items: center; justify-content: center;
}
.stepper button:active { background: var(--accent-soft); }
.stepper button:disabled { opacity: 0.3; cursor: default; }
.stepper output { width: 20px; text-align: center; font: 600 16px var(--font-mono); font-variant-numeric: tabular-nums; }
.locked-bid {
  display: flex; align-items: center; justify-content: center; gap: 4px; width: 86px; height: 34px; flex-shrink: 0;
  border-radius: 8px; background: var(--accent-soft); color: var(--accent);
}
.locked-bid output { min-width: 20px; text-align: center; font: 700 16px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.locked-ico { line-height: 0; opacity: 0.85; }
.sum-row { padding-top: 10px; }
.sum-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.sum-cell { font: 700 18px var(--font-mono); font-variant-numeric: tabular-nums; }
.sum-cell small { font-size: 12px; font-weight: 500; color: var(--muted); }
.sum-cell.ok { color: var(--good); }
.sum-cell.over { color: var(--bad); }
.status-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 999px; font-size: 12.5px; background: var(--surface-alt); color: var(--ink); }
.pill.good { background: var(--accent-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- rounds table (game detail) and stat tables ---------- */
.table-scroll { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table.history { border-collapse: collapse; width: 100%; font-size: 13px; }
table.history th, table.history td { padding: 7px 6px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.history th { font-weight: 600; font-size: 12px; color: var(--muted); }
table.history th:first-child, table.history td:first-child { text-align: left; }
table.history td:first-child { font-family: var(--font-mono); color: var(--muted); }
table.history .rc { display: block; font-size: 10.5px; }
table.history .rc .rt { font-variant-numeric: tabular-nums; }
table.history td .bw { color: var(--muted); font-size: 11px; display: block; font-family: var(--font-mono); }
table.history td .sc { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
table.history td .sc.pos { color: var(--good); }
table.history td .sc.neg { color: var(--bad); }
table.history tfoot td { border-bottom: none; border-top: 2px solid var(--border); font-family: var(--font-mono); font-weight: 700; color: var(--ink); }
table.history tr.tap { cursor: pointer; }
table.history tr.tap:hover td, table.history tr.tap:focus-visible td { background: var(--surface-alt); }
.table-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.rc-trump.red { color: var(--cardred); }

table.stat-table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.stat-table th, table.stat-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
table.stat-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
table.stat-table th:first-child, table.stat-table td:first-child { text-align: left; }
table.stat-table td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.stat-table td:first-child { font-family: var(--font-body); font-weight: 500; }
