/* Hallmark · game screens (host projector + player phone) · shares tokens with site.css */
@import url("./site.css");

body.game { min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }
.screen--brand { background: var(--gradient-hero); color: var(--color-on-accent); }
.screen--night { background: linear-gradient(160deg, var(--color-night), var(--color-night-2)); color: var(--color-on-accent); }
.screen--plain { background: var(--color-paper-2); }

.game-bar {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg); min-height: 60px;
}
.game-bar .brand__word { color: inherit; }
.screen--brand .brand__mark { background: var(--color-paper); color: var(--color-accent-deep); }
.game-bar__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.game-bar__right { margin-left: auto; display: flex; align-items: center; gap: var(--space-sm); }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-md); border-radius: var(--radius-pill);
  background: var(--color-paper-a14); font-weight: 500; font-size: var(--text-sm); white-space: nowrap;
}
.screen--plain .chip { background: var(--color-paper); box-shadow: inset 0 0 0 1px var(--color-rule); }
.center { flex: 1; display: grid; place-items: center; padding: var(--space-xl) var(--space-md); text-align: center; }
.stack { display: grid; gap: var(--space-lg); justify-items: center; width: min(100%, 460px); }

/* ---------- join (player) ---------- */
.join-card {
  width: min(100%, 380px); display: grid; gap: var(--space-sm);
  padding: var(--space-xl); border-radius: var(--radius-lg); background: var(--color-paper); color: var(--color-ink);
  box-shadow: 0 20px 50px var(--color-shadow);
}
.join-card h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-xl); margin-bottom: var(--space-xs); }
.join-card .input { min-height: 60px; text-align: center; font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); }
.join-card .input--pin { letter-spacing: 0.25em; }
.join-card .btn { min-height: 56px; font-size: var(--text-lg); }
.join-card .form-error { min-height: 1.4em; }

/* ---------- lobby (host) ---------- */
.lobby-pin { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-xl); align-items: center; width: min(100% - 2rem, 1000px); margin: var(--space-lg) auto 0; padding: var(--space-lg) var(--space-xl); border-radius: var(--radius-lg); background: var(--color-paper); color: var(--color-ink); box-shadow: 0 20px 50px var(--color-shadow); }
.lobby-pin__join { font-size: var(--text-lg); }
.lobby-pin__join b { font-family: var(--font-display); font-weight: 700; color: var(--color-purple); overflow-wrap: anywhere; }
.lobby-pin__label { font-family: var(--font-display); font-weight: 600; color: var(--color-ink-2); text-align: right; }
.lobby-pin__code { font-family: var(--font-display); font-weight: 800; font-size: var(--text-pin); line-height: 1; letter-spacing: 0.06em; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.lobby-body { flex: 1; width: min(100% - 2rem, 1000px); margin: 0 auto; padding: var(--space-xl) 0; display: flex; flex-direction: column; gap: var(--space-lg); }
.lobby-head { display: flex; align-items: center; gap: var(--space-md); flex-wrap: wrap; }
.lobby-head .count { font-family: var(--font-display); font-weight: 700; font-size: var(--text-2xl); }
.lobby-head .btn { margin-left: auto; }
.players { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-content: flex-start; margin: 0; padding: 0; list-style: none; }
.players li { animation: pop var(--dur-slow) var(--ease-out); }
.players button {
  border: 0; border-radius: var(--radius-pill); padding: var(--space-xs) var(--space-lg);
  background: var(--color-paper); color: var(--color-ink); font-weight: 500; font-size: var(--text-lg);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.players button:hover { background: var(--color-accent-wash); text-decoration: line-through; }
.players button.is-away { background: var(--color-paper-a14); color: var(--color-on-accent); box-shadow: inset 0 0 0 1px var(--color-paper-a55); }
/* 40+ players: tighter chips in a scrolling well so the PIN stays on screen */
.players--dense { gap: var(--space-xs); max-height: 52vh; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-2xs); }
.players--dense li { animation: none; }
.players--dense button { padding: var(--space-2xs) var(--space-md); font-size: var(--text-sm); }
.lobby-empty { opacity: 0.85; }
@keyframes pop { from { opacity: 0; transform: scale(0.9); } }

/* ---------- question (host) ---------- */
.q-stage { flex: 1; display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-lg); width: min(100% - 2rem, 1200px); margin: 0 auto; padding: var(--space-lg) 0 var(--space-xl); }
.q-text { background: var(--color-paper); border-radius: var(--radius-lg); padding: var(--space-xl); text-align: center; box-shadow: var(--shadow-card); font-weight: 500; font-size: clamp(1.4rem, 3.2vw, 2.4rem); line-height: 1.35; color: var(--color-ink); overflow-wrap: anywhere; }
.q-mid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-xl); }
.timer { position: relative; width: 120px; height: 120px; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 10; }
.timer .track { stroke: var(--color-rule); }
.timer .bar { stroke: var(--color-accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer.is-low .bar { stroke: var(--color-wrong); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.answered { text-align: center; }
.answered b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; line-height: 1; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.answered span { color: var(--color-ink-2); font-size: var(--text-sm); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); }
.tile {
  position: relative; display: flex; align-items: center; gap: var(--space-md);
  min-height: 96px; padding: var(--space-md) var(--space-lg); border: 0; border-radius: var(--radius-md);
  background: var(--tile); color: var(--color-on-accent); text-align: left;
  font-weight: 500; font-size: clamp(1.05rem, 2vw, 1.5rem); line-height: 1.3; overflow-wrap: anywhere;
  transition: opacity var(--dur-mid) var(--ease-out), transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
}
.tile svg { flex: none; width: 34px; height: 34px; }
.tile > span { min-width: 0; }
.tile[data-i="0"] { --tile: var(--color-tile-1); }
.tile[data-i="1"] { --tile: var(--color-tile-2); }
.tile[data-i="2"] { --tile: var(--color-tile-3); }
.tile[data-i="3"] { --tile: var(--color-tile-4); }
.tile.is-dim { opacity: 0.4; }
.tile.is-correct { box-shadow: 0 0 0 4px var(--color-paper), 0 0 0 8px var(--color-correct); }
.tile__count { margin-left: auto; padding-left: var(--space-md); font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.tile__check { position: absolute; top: var(--space-xs); right: var(--space-xs); width: 28px; height: 28px; border-radius: 50%; background: var(--color-paper); color: var(--color-correct); display: grid; place-items: center; }
.tile__check svg { width: 18px; height: 18px; }
.tiles--ox .tile { justify-content: center; min-height: 140px; }
.tiles--ox .tile svg { width: 72px; height: 72px; }

.reveal-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
.board { color: var(--color-ink); background: var(--color-paper); border-radius: var(--radius-lg); padding: var(--space-lg); box-shadow: var(--shadow-card); }
.board h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); color: var(--color-purple); margin-bottom: var(--space-md); }
.board ol { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--space-xs); }
.board li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--space-sm); align-items: center; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm); background: var(--color-paper-2); animation: rise var(--dur-slow) var(--ease-out) both; }
.board li:nth-child(2) { animation-delay: 60ms; } .board li:nth-child(3) { animation-delay: 120ms; } .board li:nth-child(4) { animation-delay: 180ms; } .board li:nth-child(5) { animation-delay: 240ms; }
.board li:first-child { background: var(--color-accent-wash); }
.board .rank { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--color-purple); color: var(--color-on-accent); font-family: var(--font-display); font-weight: 700; }
.board li:first-child .rank { background: var(--color-accent-deep); }
.board .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .score { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.host-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); }

/* ---------- podium ---------- */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: var(--space-md); width: min(100%, 720px); margin: 0 auto; }
.podium__col { display: grid; gap: var(--space-xs); text-align: center; }
.podium__name { font-weight: 700; font-size: var(--text-xl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium__score { font-family: var(--font-display); font-weight: 600; opacity: 0.9; font-variant-numeric: tabular-nums; }
.podium__block { border-radius: var(--radius-md) var(--radius-md) 0 0; background: var(--color-paper); color: var(--color-purple); display: grid; place-items: start center; padding-top: var(--space-md); font-family: var(--font-display); font-weight: 800; font-size: 3rem; transform-origin: bottom; animation: grow 700ms var(--ease-out) both; }
.podium__col:nth-child(1) .podium__block { height: 150px; animation-delay: 300ms; }
.podium__col:nth-child(2) .podium__block { height: 210px; color: var(--color-accent-deep); animation-delay: 900ms; }
.podium__col:nth-child(3) .podium__block { height: 110px; animation-delay: 0ms; }
@keyframes grow { from { transform: scaleY(0); } }
.rest { width: min(100%, 720px); margin: var(--space-xl) auto 0; }

/* ---------- player ---------- */
.p-tiles { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); padding: var(--space-sm); }
.p-tiles .tile { min-height: 0; flex-direction: column; justify-content: center; text-align: center; gap: var(--space-xs); font-size: var(--text-lg); }
.p-tiles .tile svg { width: 44px; height: 44px; }
.p-tiles .tile:hover { filter: brightness(1.06); }
.p-tiles .tile:active { transform: scale(0.97); }
.p-tiles .tile:disabled { cursor: default; }
.p-tiles.is-locked .tile:not(.is-picked) { opacity: 0.3; }
.p-tiles--ox { grid-template-columns: minmax(0, 1fr); }
.p-tiles--ox .tile svg { width: 72px; height: 72px; }
.p-question { padding: var(--space-md) var(--space-lg) 0; font-weight: 500; font-size: var(--text-lg); line-height: 1.4; color: var(--color-ink); overflow-wrap: anywhere; }
.p-timer { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; }

.big-icon { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--color-paper-a14); }
.big-icon svg { width: 52px; height: 52px; }
.result-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(2.2rem, 9vw, 3.4rem); line-height: 1.1; }
.result-gain { font-family: var(--font-display); font-weight: 700; font-size: var(--text-2xl); padding: var(--space-xs) var(--space-lg); border-radius: var(--radius-pill); background: var(--color-paper-a14); }
.screen--correct { background: var(--color-correct); color: var(--color-on-accent); }
.screen--wrong { background: var(--color-wrong); color: var(--color-on-accent); }
.player-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--space-lg); background: var(--color-paper); color: var(--color-ink); font-weight: 500; }
.player-foot b { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: blink 1.2s var(--ease-in-out) infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; } .dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.25; } }

@media (max-width: 760px) {
  .lobby-pin { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .lobby-pin__label { text-align: center; }
  .q-mid { grid-template-columns: auto minmax(0, 1fr); }
  .q-mid > :nth-child(2) { display: none; }
  .timer { width: 84px; height: 84px; }
  .timer span, .answered b { font-size: 1.8rem; }
  .tiles, .reveal-grid { grid-template-columns: minmax(0, 1fr); }
  .tile { min-height: 64px; }
  .podium__block { font-size: 2rem; }
  .podium__col:nth-child(1) .podium__block { height: 100px; }
  .podium__col:nth-child(2) .podium__block { height: 140px; }
  .podium__col:nth-child(3) .podium__block { height: 76px; }
  .podium__name { font-size: var(--text-md); }
}
