/* Bible Trivia Party (BBG#167): TV host screen (/party/) and phone controller (/join/). Emerald Arcade palette. */
:root {
  --bg: #071f14;
  --panel: #0e3b26;
  --panel-2: #114530;
  --text: #fdf6e3;
  --muted: #c4dccb;
  --gold: #f5c451;
  --gold-2: #ffd76a;
  --line: rgba(245, 196, 81, 0.35);
  --red: #e2483d;
  --blue: #2f7fe0;
  --amber: #e9a521;
  --good: #3fbf6f;
  --bad: #d9534f;
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 0%, #0f4a2f 0%, var(--bg) 70%);
  color: var(--text);
  font-family: var(--body);
}
[hidden] { display: none !important; }
h1, h2, h3, .display { font-family: var(--display); font-weight: 400; letter-spacing: 0.02em; margin: 0; }
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 14px;
}
.btn {
  font-family: var(--display);
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 55%, #d8a64c 100%);
  color: #3a2508;
  border: 2px solid #a06b1c;
  box-shadow: 0 4px 0 #7a4c12, 0 8px 16px rgba(0, 0, 0, 0.35);
  padding: 0.55em 1.4em;
}
.btn:disabled { filter: grayscale(0.8); opacity: 0.55; cursor: default; }
.btn:focus-visible, .seg button:focus-visible, .chip button:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.btn-ghost {
  font-family: var(--display);
  background: transparent;
  color: var(--gold-2);
  border: 2px solid var(--line);
  padding: 0.45em 1.1em;
}
.brand { display: flex; align-items: center; gap: 0.5em; color: var(--gold-2); font-family: var(--display); }
.brand img { width: 1.6em; height: 1.6em; border-radius: 50%; }

/* Answer colors and shapes (same order everywhere) */
.ans-0 { background: var(--red); }
.ans-1 { background: var(--blue); }
.ans-2 { background: var(--amber); }
.shape { font-size: 0.9em; margin-right: 0.45em; }

/* ---------------- TV host ---------------- */
.tv { font-size: clamp(14px, 1.6vw, 34px); min-height: 100vh; display: flex; flex-direction: column; }
.tv header { display: flex; justify-content: space-between; align-items: center; padding: 1.2vh 2.5vw; }
.tv .net { font-size: 0.7em; color: var(--muted); }
.tv main { flex: 1; display: flex; flex-direction: column; padding: 0 3vw 3vh; min-height: 0; }

.tv-start { margin: auto; text-align: center; max-width: 60em; }
.tv-start h1 { font-size: 3.6em; color: var(--gold-2); text-shadow: 0 6px 0 #6b3a10; }
.tv-start p { color: var(--muted); font-size: 1.1em; line-height: 1.5; }
.tv-start .btn { font-size: 1.6em; margin-top: 1em; }
.tv-start .how { display: flex; gap: 2em; justify-content: center; margin-top: 2em; font-size: 0.95em; }
.tv-start .how div { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1em 1.2em; width: 13em; }
.tv-start .how b { display: block; font-family: var(--display); color: var(--gold-2); font-size: 1.3em; margin-bottom: 0.3em; }

.lobby { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 3vw; align-items: stretch; }
.join-card { background: var(--panel); border: 2px solid var(--line); border-radius: 24px; padding: 1.5em; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.join-card .qr { background: #fff; border-radius: 16px; padding: 0.4em; width: min(30vw, 52vh); aspect-ratio: 1; }
.join-card .qr svg { width: 100%; height: 100%; display: block; }
.join-card .scan { font-family: var(--display); font-size: 1.4em; margin: 0.6em 0 0.1em; }
.join-card .url { color: var(--muted); font-size: 1em; }
.join-card .code { font-family: var(--display); font-size: 3.4em; letter-spacing: 0.18em; color: var(--gold-2); line-height: 1.1; }
.lobby-side { display: flex; flex-direction: column; gap: 1.2em; min-height: 0; }
.settings { display: grid; gap: 0.6em; }
.setting { display: flex; align-items: center; gap: 1em; }
.setting > span { width: 6.5em; color: var(--muted); font-size: 0.9em; }
.seg { display: flex; gap: 0.4em; }
.seg button { background: var(--panel); color: var(--text); border: 2px solid var(--line); padding: 0.3em 0.9em; font-family: var(--display); }
.seg button[aria-pressed="true"] { background: var(--gold); color: #3a2508; border-color: #a06b1c; }
.players-head { display: flex; justify-content: space-between; align-items: baseline; }
.players-head h2 { font-size: 1.5em; }
.players-head span { color: var(--muted); }
.players { flex: 1; min-height: 6em; overflow: auto; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0.5em; padding: 0.8em; background: rgba(0, 0, 0, 0.18); border-radius: 18px; border: 1px dashed var(--line); }
.players .empty { color: var(--muted); margin: auto; }
.chip { display: inline-flex; align-items: center; gap: 0.3em; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 0.25em 0.4em 0.25em 0.9em; font-weight: 600; animation: pop 0.35s cubic-bezier(.2, 1.4, .4, 1); }
.chip.offline { opacity: 0.45; }
.chip button { background: transparent; color: var(--muted); width: 1.6em; height: 1.6em; border-radius: 50%; line-height: 1; }
.chip button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
.lobby-actions { display: flex; gap: 1em; align-items: center; }
.lobby-actions .btn, .lobby-actions .lock-btn { white-space: nowrap; flex-shrink: 0; }
.lobby-actions .btn { font-size: 1.5em; }
.lobby-actions .lock-btn { font-size: 1em; }
.lobby-actions .hint { color: var(--muted); font-size: 0.85em; }

.q-screen { flex: 1; display: flex; flex-direction: column; gap: 2vh; min-height: 0; }
.q-top { display: flex; align-items: center; gap: 1.5em; }
.q-top .count { font-family: var(--display); color: var(--gold-2); font-size: 1.2em; white-space: nowrap; }
.q-top .bar { flex: 1; height: 0.7em; border-radius: 999px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.q-top .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transform-origin: left; }
.q-top .bar.hurry i { background: linear-gradient(90deg, var(--bad), #f0a35e); }
.q-top .secs { font-family: var(--display); font-size: 1.8em; min-width: 1.6em; text-align: right; }
.q-top .answered { color: var(--muted); white-space: nowrap; }
.q-text { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; font-family: var(--display); font-size: 2.6em; line-height: 1.2; padding: 0 1em; background: var(--panel); border: 2px solid var(--line); border-radius: 24px; text-wrap: balance; }
.q-answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2vw; }
.q-answers .tile { position: relative; border-radius: 18px; padding: 1.1em 1em; min-height: 5.5em; display: flex; align-items: center; font-size: 1.45em; font-weight: 700; color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3); transition: opacity 0.3s, transform 0.3s; }
.q-answers .tile .n { position: absolute; right: 0.6em; top: 0.4em; font-family: var(--display); font-size: 0.9em; }
.q-answers.revealed .tile { opacity: 0.35; transform: scale(0.97); }
.q-answers.revealed .tile.right { opacity: 1; transform: scale(1.03); outline: 5px solid #fff; }
.verse { text-align: center; color: var(--muted); font-size: 1em; font-style: italic; min-height: 2.6em; }
.verse b { color: var(--gold-2); font-style: normal; }

.board { margin: auto; width: min(70em, 92vw); }
.board h2 { text-align: center; font-size: 2.4em; color: var(--gold-2); margin-bottom: 0.6em; }
.board ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5em; }
.board li { display: grid; grid-template-columns: 2.5em 1fr auto; align-items: center; gap: 0.8em; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 0.55em 1em; font-size: 1.35em; animation: slide 0.45s ease-out both; }
.board li .place { font-family: var(--display); color: var(--gold-2); }
.board li .pts { font-family: var(--display); }
.board li .plus { color: var(--good); font-size: 0.75em; margin-left: 0.5em; }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }

.podium { margin: auto; text-align: center; width: min(80em, 94vw); }
.podium h2 { font-size: 3em; color: var(--gold-2); margin-bottom: 0.4em; }
.steps { display: flex; justify-content: center; align-items: flex-end; gap: 1.5vw; }
.step { width: 15em; display: flex; flex-direction: column; align-items: center; gap: 0.3em; }
.step .who { font-family: var(--display); font-size: 1.6em; overflow-wrap: anywhere; }
.step .pts { color: var(--muted); }
.step .block { width: 100%; border-radius: 16px 16px 0 0; background: linear-gradient(180deg, var(--gold-2), #b8862f); color: #3a2508; font-family: var(--display); font-size: 3em; display: flex; align-items: flex-start; justify-content: center; padding-top: 0.2em; }
.step.p1 .block { height: 32vh; }
.step.p2 .block { height: 22vh; background: linear-gradient(180deg, #e8eef2, #9aa7b0); }
.step.p3 .block { height: 15vh; background: linear-gradient(180deg, #e6a66a, #9b5a2a); }
.podium .rest { margin-top: 1em; color: var(--muted); }
.podium .again { margin-top: 1.4em; display: flex; gap: 1em; justify-content: center; }
.podium .again .btn { font-size: 1.4em; }

.tv-controls { display: flex; gap: 0.8em; justify-content: flex-end; margin-top: 1.5vh; }
.tv-controls button { font-size: 0.85em; }
.toast { position: fixed; left: 50%; top: 3vh; z-index: 10; transform: translateX(-50%); background: rgba(0, 0, 0, 0.75); padding: 0.6em 1.2em; border-radius: 12px; font-size: 0.9em; }

/* ---------------- Phone ---------------- */
.phone { font-size: 18px; min-height: 100dvh; display: flex; flex-direction: column; }
.phone header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; font-size: 15px; }
.phone header .who { color: var(--muted); font-weight: 600; }
.phone main { flex: 1; display: flex; flex-direction: column; padding: 8px 16px 24px; }
.phone .card { background: var(--panel); border: 2px solid var(--line); border-radius: 20px; padding: 20px; }
.phone .center { margin: auto 0; text-align: center; }
.phone h1 { font-size: 30px; color: var(--gold-2); }
.phone h2 { font-size: 26px; }
.phone p { color: var(--muted); line-height: 1.45; }
.phone label { display: block; font-weight: 700; margin: 14px 0 6px; }
.phone input {
  width: 100%; font-size: 22px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: #06170f; color: var(--text);
}
.phone input.code { font-family: var(--display); letter-spacing: 0.3em; text-transform: uppercase; text-align: center; font-size: 30px; }
.phone .btn { width: 100%; font-size: 24px; margin-top: 18px; padding: 14px; }
.phone .err { color: #ffb0a0; min-height: 1.4em; margin-top: 10px; }
.phone .q-small { font-weight: 700; font-size: 19px; line-height: 1.35; text-align: center; margin: 6px 0 14px; }
.phone .q-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; }
.phone .choices { flex: 1; display: grid; gap: 12px; grid-auto-rows: minmax(84px, 1fr); }
.phone .choice { width: 100%; min-height: 84px; color: #fff; font-size: 21px; font-weight: 700; text-align: left; padding: 14px 18px; display: flex; align-items: center; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.phone .choice:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.phone .choice .shape { font-size: 26px; }
.phone .big-mark { font-size: 84px; line-height: 1; margin-bottom: 8px; }
.phone .result.good h2 { color: var(--good); }
.phone .result.bad h2 { color: var(--bad); }
.phone .pts { font-family: var(--display); font-size: 34px; color: var(--gold-2); }
.phone .place { font-size: 20px; margin-top: 6px; }
.phone .wait-dots::after { content: "…"; animation: dots 1.2s steps(4) infinite; display: inline-block; width: 1em; text-align: left; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
