/* Games Night Hub — layouts for the TV (host) and phone screens.
   Uses the colours and components from base.css. */

/* ---------- TV ---------- */
.tv { min-height: 100vh; padding: 48px 64px; display: flex; flex-direction: column; gap: 28px; }
.tv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.tv-title { font-family: var(--display); font-size: 64px; letter-spacing: 2px; line-height: 1; }
.tv-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.logo-row { display: flex; align-items: center; gap: 14px; }

.lobby { display: flex; gap: 56px; flex: 1; }
.lobby-left { width: 440px; display: flex; flex-direction: column; gap: 28px; }
.lobby-right { flex: 1; display: flex; flex-direction: column; gap: 22px; }
.join-card { display: flex; flex-direction: column; gap: 20px; padding: 28px; }
.join-row { display: flex; align-items: center; gap: 24px; }
.qr { width: 150px; height: 150px; border-radius: 12px; background: var(--text); padding: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--bg); font-size: 13px; font-weight: 600; text-align: center; }
.qr img, .qr canvas { width: 130px !important; height: 130px !important; }
.room-code { font-family: var(--display); font-size: 104px; line-height: 0.9; letter-spacing: 8px; color: var(--gold); white-space: nowrap; }
.join-row > div:last-child { min-width: 0; overflow: hidden; }

.player-chip { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-width: 0; }
.player-chip .name { font-size: 17px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-chip.offline { opacity: 0.45; }
.player-chip.ready { border-color: var(--green); background: var(--green-soft); }
.waiting-chip { border: 1px dashed var(--line-2); border-radius: 14px; padding: 14px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }

.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mode-card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; color: var(--text); font-family: var(--body); cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.mode-card.selected { background: var(--red-soft); border: 2px solid var(--red); padding: 21px; }
.mode-card .title { font-family: var(--display); font-size: 34px; letter-spacing: 1px; }
.mode-card .desc { font-size: 15px; color: var(--muted); line-height: 1.4; }
.pill { padding: 12px 20px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font: 15px var(--body); cursor: pointer; }
.pill.selected { background: var(--gold); border-color: var(--gold); color: var(--bg); font-weight: 600; }

.host-menu-btn { position: fixed; bottom: 16px; left: 16px; z-index: 5; min-height: 40px; padding: 0 14px; font-size: 14px; background: var(--panel); }
.overlay { position: fixed; inset: 0; background: rgba(14, 12, 18, 0.85); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 24px; }
.menu { width: min(900px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 24px; padding: 32px; display: flex; gap: 32px; flex-wrap: wrap; }
.menu-actions { width: 280px; display: flex; flex-direction: column; gap: 12px; }
.menu-players { flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 10px; }
.menu-row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 12px; border-radius: 12px; background: var(--panel-2); }
.menu-row .name { flex: 1; font-weight: 600; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-danger { border-color: #7A2A2D; color: var(--pink-red); }

.big-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }

/* ---------- Phone ---------- */
.phone { min-height: 100vh; max-width: 480px; margin: 0 auto; padding: 32px 22px 28px; display: flex; flex-direction: column; gap: 22px; }
.phone-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.code-input { height: 72px; border-radius: 16px; border: 2px solid var(--gold); background: var(--panel); color: var(--gold); font-family: var(--display); font-size: 48px; letter-spacing: 16px; text-align: center; text-transform: uppercase; width: 100%; padding: 0 0 0 16px; }
.code-input.bad { border-color: var(--red); color: var(--pink-red); background: var(--red-soft); }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.swatch { width: 100%; max-width: 52px; aspect-ratio: 1 / 1; justify-self: center; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatch.selected { border-color: var(--text); }
.swatch:disabled { opacity: 0.15; cursor: not-allowed; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--red-soft); color: #FFD6D7; font-size: 15px; line-height: 1.45; }
.alert strong { color: var(--text); display: block; margin-bottom: 2px; }
.banner { padding: 10px 14px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); font-size: 14px; text-align: center; }
.stat-row { display: flex; gap: 12px; justify-content: center; }
.stat { padding: 14px 20px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; text-align: left; }
.stat.gold { background: var(--gold-soft); border-color: var(--gold); }
.stat .num { font-family: var(--display); font-size: 40px; line-height: 1; }
.stat .label { font-size: 13px; color: var(--muted); }
.avatar-xl { width: 112px; height: 112px; font-family: var(--display); font-size: 64px; font-weight: 400; }
.check-circle { width: 104px; height: 104px; border-radius: 50%; background: var(--green-soft); border: 3px solid var(--green); display: flex; align-items: center; justify-content: center; }
.mini-people { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mini-person { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: #C9C2D2; }
.claim-list { display: flex; flex-direction: column; gap: 8px; }
.claim-btn { justify-content: flex-start; gap: 12px; }
.spacer { flex: 1; }

/* ---------- Stage 2: night flow ---------- */
.toast { position: fixed; top: 16px; right: 16px; z-index: 6; padding: 12px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--gold); font-size: 16px; }
.game-card { text-align: left; min-height: 196px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-family: var(--body); padding: 20px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.game-card:hover { border-color: var(--gold); }
.setup-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-family: var(--body); cursor: pointer; }
.setup-row.off { opacity: 0.55; }
.check { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: var(--bg); font-weight: 800; flex-shrink: 0; }
.check.on { background: var(--gold); border-color: var(--gold); }
.switch { flex-shrink: 0; width: 52px; height: 30px; border-radius: 999px; border: none; background: var(--line-2); padding: 3px; display: flex; justify-content: flex-start; cursor: pointer; }
.switch.on { background: var(--green); justify-content: flex-end; }
.switch span { width: 24px; height: 24px; border-radius: 50%; background: var(--text); }
.step-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; min-height: 230px; }
.step-num { width: 48px; height: 48px; border-radius: 50%; background: var(--red-soft); border: 2px solid var(--red); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 28px; color: var(--pink-red); }
.score-bar { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 16px; padding: 16px 22px; font-size: 17px; color: #E8D6A6; }
.score-bar b { color: var(--gold); }
.standing-row { display: flex; align-items: center; gap: 18px; height: 52px; padding: 0 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.standing-row.first { background: var(--gold-soft); border-color: var(--gold); }
.bar { flex: 1; height: 12px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar > div { height: 100%; background: var(--gold); border-radius: 999px; }
.next-card { flex: 1; background: var(--red-soft); border: 2px solid var(--red); border-radius: 16px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.finalist { flex: 1; align-self: stretch; background: #1F1712; border: 2px solid #F29A6B; border-radius: 24px; padding: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.finalist.gold { background: var(--gold-soft); border-color: var(--gold); }
.finalist.winner { box-shadow: 0 0 60px rgba(242, 193, 78, 0.45); }
.podium-col { width: 170px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.podium-step { width: 100%; border-radius: 14px 14px 0 0; background: var(--panel); border: 2px solid; border-bottom: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.lucky-ball { width: 180px; height: 180px; border-radius: 50%; background: var(--panel); border: 3px solid var(--gold); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 110px; color: var(--gold); }

/* Phones */
.result-screen { margin: -32px -22px -28px; padding: 32px 22px 28px; min-height: 100vh; display: flex; flex-direction: column; gap: 24px; background: var(--bg); }
.result-screen.good { background: #15110A; }
.result-screen.bad { background: #150A0C; }
.offer-card { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.market-person { min-height: 76px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 600 14px var(--body); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; overflow: hidden; }
.market-person.selected { border: 2px solid var(--gold); }
.market-person span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.stepper .btn { width: 56px; height: 56px; padding: 0; font-size: 28px; background: var(--line); border: none; }
.finalist-btn { flex-direction: column; min-height: 140px; gap: 10px; font-size: 18px; }

/* ---------- Stage 3: games ---------- */
.clock-button { width: 280px; height: 280px; border-radius: 50%; border: 10px solid #7A1418; background: var(--red-btn); color: #fff; font-family: var(--display); font-size: 72px; letter-spacing: 3px; cursor: pointer; box-shadow: 0 20px 60px rgba(198, 42, 47, 0.35); }
.clock-button:active { transform: scale(0.97); }
.choice-on { background: var(--gold) !important; border-color: var(--gold) !important; color: var(--bg) !important; }
.flag-pick { padding: 3px; border-radius: 8px; border: 2px solid var(--line); background: var(--panel); cursor: pointer; position: relative; }
.flag-pick.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.flag-pick.on::after { content: "✓"; position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); color: var(--bg); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.hot-screen { margin: -32px -22px -28px; padding: 40px 22px 28px; min-height: 100vh; background: #5E0F14; color: #fff; display: flex; flex-direction: column; gap: 20px; box-sizing: border-box; }
.hot-option { min-height: 72px; background: #fff; color: #5E0F14; border: none; font-size: 17px; font-weight: 700; padding: 8px 10px; line-height: 1.25; }
.hot-target { min-height: 84px; background: #3D080C; border-color: #8A2A30; color: #fff; justify-content: flex-start; gap: 12px; font-size: 17px; font-weight: 700; }
.bomb { width: 240px; height: 240px; border-radius: 50%; background: #3D080C; border: 4px solid #FF5A5E; display: flex; align-items: center; justify-content: center; animation: pulse var(--pulse, 1s) ease-in-out infinite; }
.bomb.boom { animation: none; background: #E5383B; box-shadow: 0 0 120px #FF5A5E; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 30px rgba(255, 90, 94, 0.3); transform: scale(1); } 50% { box-shadow: 0 0 90px rgba(255, 90, 94, 0.7); transform: scale(1.04); } }

/* ---------- Stage 4: Treasure Map ---------- */
.tm-cell { position: relative; border-radius: 10px; display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 0; color: var(--text); }
.tm-grid.tm-phone { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.tm-grid.tm-phone .tm-cell { aspect-ratio: 1 / 1; border-radius: 8px; cursor: pointer; }
.tm-badge { position: absolute; top: 6px; right: 6px; min-width: 26px; height: 26px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--bg); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tm-dig { position: absolute; bottom: 2px; left: 2px; right: 2px; border-radius: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.tm-dig.hot { background: #FF5A5E; color: #fff; }
.tm-dig.cold { background: #7FB7FF; color: var(--bg); }
.tm-sel { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 6px; background: var(--gold); color: var(--bg); font-size: 11px; font-weight: 700; }
.role-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.role-card.pirate { background: var(--red-soft); border: 2px solid var(--red); }
.tm-cell svg { display: block; width: 60%; height: auto; max-height: 70%; }
.tm-grid.tm-phone { align-items: start; }
.tm-grid.tm-phone .tm-cell { height: auto; min-height: 0; overflow: visible; }

/* ---------- Stage 4: Blind Builder ---------- */
.bb-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 8px; background: #15121B; border: 1px solid var(--line); border-radius: 14px; }
.bb-cell { aspect-ratio: 1 / 1; border-radius: 8px; background: #1F1B26; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 0; min-width: 0; }
button.bb-cell { cursor: pointer; }
.bb-color { height: 46px; border-radius: 12px; border: 3px solid transparent; cursor: pointer; }
.bb-color.on { border-color: var(--text); }

/* ---------- Stage 4: Bomb Squad ---------- */
.bs-team { background: var(--panel); border: 2px solid var(--line); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.bs-team.ok { background: var(--green-soft); border-color: var(--green); }
.bs-team.boom { background: #3D080C; border-color: #FF5A5E; }
.bs-mod { padding: 12px; border-radius: 12px; background: #1F1B26; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.bs-mod.done { background: var(--green-soft); color: var(--green); }
.bs-mod.now { border-color: var(--gold); color: var(--gold); }
.bs-mod span:first-child { color: var(--text); }
.bs-strike { width: 34px; height: 34px; border-radius: 8px; background: var(--panel-2); color: #4A4352; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.bs-strike.on { background: var(--red-btn); color: #fff; }
.bs-bomb { background: var(--panel); border: 2px solid var(--line-2); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.bs-timer { font-size: 48px; color: #FF5A5E; letter-spacing: 3px; background: #050407; border: 1px solid var(--line-2); border-radius: 10px; padding: 4px 12px; }
.bs-serial { font-family: ui-monospace, Menlo, monospace; font-size: 16px; font-weight: 700; padding: 3px 8px; background: var(--text); color: var(--bg); border-radius: 4px; }
.bs-chip { flex: 1; padding: 7px 4px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
.bs-chip.done { background: var(--green-soft); color: var(--green); }
.bs-chip.now { background: var(--gold-soft); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.bs-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bs-wire { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: #15121B; color: var(--text); font: 600 14px var(--body); cursor: pointer; }
.bs-button { width: 150px; height: 150px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 800 22px var(--body); text-transform: uppercase; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.bs-strip { width: 100%; padding: 10px; border-radius: 10px; text-align: center; color: #111; font-weight: 700; }
.bs-sym { min-height: 96px; border-radius: 14px; border: 2px solid var(--line-2); background: #15121B; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.bs-sym.done { border-color: var(--green); background: var(--green-soft); opacity: 0.7; }
.bs-manual { margin: -32px -22px -28px; padding: 32px 20px 28px; min-height: 100vh; box-sizing: border-box; background: #ECE6D8; color: #1C1812; display: flex; flex-direction: column; gap: 14px; }
.bs-h { margin: 0; font-family: var(--display); font-size: 38px; font-weight: 400; line-height: 1; }
.bs-p { margin: 0; font-size: 15px; line-height: 1.5; color: #3D362B; }
.bs-rules { background: #F8F4EA; border: 1px solid #CFC5B1; border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.45; }
.bs-rules ol { margin: 6px 0 0; padding-left: 20px; }
.bs-rules li { margin-bottom: 4px; }
.bs-col { background: #F8F4EA; border: 1px solid #CFC5B1; border-radius: 12px; padding: 8px 5px; display: flex; flex-direction: column; gap: 5px; }
.bs-col-item { display: flex; align-items: center; gap: 5px; padding: 5px 4px; border-radius: 7px; background: #ECE6D8; font-size: 13px; font-weight: 600; }
.bs-tab { flex: 1; min-height: 42px; border-radius: 10px; border: 1px solid #B9AF9C; background: transparent; color: #3D362B; font: 600 15px var(--body); cursor: pointer; }
.bs-tab.on { background: #1C1812; color: #ECE6D8; border-color: #1C1812; }

/* Zoom mode: bigger room code and QR on the shared screen */
.lobby.zoom .room-code { font-size: 140px; }
.lobby.zoom .qr { width: 210px; height: 210px; }
.lobby.zoom .qr img, .lobby.zoom .qr canvas { width: 190px !important; height: 190px !important; }
.lobby.zoom .join-row { flex-wrap: wrap; }

/* iPhone stand-in for vibration: a quick screen flash */
body.flash::after { content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; animation: flash 0.9s ease-out; }
@keyframes flash { 0%, 30% { background: rgba(255, 90, 94, 0.55); } 15%, 45% { background: rgba(255, 255, 255, 0.25); } 100% { background: transparent; } }

/* ---------- TV stage: designed at 1280×720, scaled to fit any screen ----------
   Everything on the TV lives inside #stage. js/stage.js scales it to the window and
   centres it, so the layout looks the same on a laptop, a big TV or a small window.
   (A transformed parent also becomes the "frame" for position:fixed children, so the
   host menu button, toasts and overlays stay inside the stage.) */
body.host { overflow: hidden; }
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; transform-origin: 0 0; overflow: hidden; }
#stage #app { height: 100%; }
#stage .tv { min-height: 0; height: 100%; box-sizing: border-box; overflow: auto; }

/* Pit Stop Race animations */
@keyframes gnh-vanish { to { visibility: hidden; opacity: 0; } }
@keyframes gnh-flash { 0% { opacity: 0; } 20%, 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes gnh-slide { from { left: 0%; } to { left: 100%; } }
@keyframes gnh-spin { to { transform: rotate(360deg); } }
