/* Turing Room — a 1950s/60s panel game show.
   Studio-teal stage under warm spotlights; brass, curtain red, cream card
   stock. The chat stays dark for legibility — it's the studio floor; the
   question cards and nameplates carry the period. */

:root {
  --studio: #0e1c1e;        /* dark teal studio floor */
  --studio-2: #143034;      /* raised panel */
  --studio-3: #1b3d42;      /* hover / borders */
  --curtain: #a8322a;       /* stage-curtain red */
  --curtain-dark: #7c241e;
  --brass: #d9a441;         /* brass / mustard gold */
  --brass-bright: #f0c766;
  --cream: #f4e9d0;         /* card stock */
  --cream-dim: #e4d6b8;
  --ink: #2a2118;           /* ink on card stock */
  --text: #f2ecdd;          /* warm studio white */
  --dim: #9fb0a6;
  --win: #4fae6d;
  --lose: #d4553f;
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    /* warm spotlight from the rig */
    radial-gradient(900px 480px at 50% -12%, rgba(240, 199, 102, 0.14) 0%, transparent 60%),
    radial-gradient(700px 500px at 12% 110%, rgba(168, 50, 42, 0.10) 0%, transparent 55%),
    var(--studio);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* faint CRT scanlines over everything — it's television, after all */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.07) 3px,
    rgba(0, 0, 0, 0.07) 4px
  );
  z-index: 90;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
}

.view { display: flex; flex-direction: column; gap: 16px; flex: 1; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.center { text-align: center; }

/* ---------- show lettering ---------- */

.display, .logo, .stage-title, h2 {
  font-family: "Rockwell", "Roboto Slab", "Georgia", serif;
}

/* ---------- home: the title card ---------- */

#view-home { justify-content: center; text-align: center; gap: 20px; }

.logo {
  font-size: clamp(1.9rem, 8vw, 2.9rem);
  margin: 0 auto;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass-bright);
  text-shadow:
    2px 2px 0 var(--curtain-dark),
    4px 4px 0 rgba(0, 0, 0, 0.45);
  padding: 18px 26px;
  border: 3px solid var(--brass);
  border-radius: 6px;
  position: relative;
  background:
    radial-gradient(circle at 50% 0%, rgba(240, 199, 102, 0.12), transparent 70%),
    var(--studio-2);
  /* marquee bulbs */
  box-shadow:
    0 0 0 6px var(--studio-2),
    0 0 0 7px var(--brass),
    0 6px 30px rgba(0, 0, 0, 0.5);
}
.logo::before, .logo::after {
  content: "✳";
  color: var(--curtain);
  font-size: 0.6em;
  vertical-align: 0.35em;
  margin: 0 0.4em;
  text-shadow: none;
}
.logo .ai { color: var(--cream); }

.tagline {
  color: var(--dim);
  margin: 0;
  font-style: italic;
  letter-spacing: 0.02em;
}

.join-row { display: flex; gap: 8px; justify-content: center; }
.join-row input {
  width: 7.5ch;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 1.2rem;
}

.home-alt { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.beta {
  font-size: 0.65rem;
  background: var(--curtain);
  color: var(--cream);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  letter-spacing: 0.08em;
}

/* ---------- shared bits ---------- */

button {
  font: inherit;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 16px;
  background: var(--studio-3);
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  font-weight: 700;
}
button:active { transform: translateY(1px); }

.primary {
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
  color: var(--ink);
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 2px 0 var(--curtain-dark),
    0 4px 12px rgba(0, 0, 0, 0.4);
}
.primary.big { padding: 14px 22px; font-size: 1rem; }
.ghost {
  background: transparent;
  color: var(--dim);
  text-decoration: underline;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

input {
  font: inherit;
  color: var(--text);
  background: var(--studio-2);
  border: 1px solid var(--studio-3);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 0;
}
input:focus { outline: 2px solid var(--brass); border-color: transparent; }

.error { color: var(--lose); }
.hint { color: var(--dim); font-size: 0.9rem; line-height: 1.45; margin: 0; }

.pill {
  background: var(--studio-2);
  border: 1px solid var(--brass);
  color: var(--brass-bright);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sound-btn {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  z-index: 95;
  background: rgba(20, 48, 52, 0.85);
  border: 1px solid var(--brass);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.95rem;
}

/* ---------- lobby: the green room ---------- */

.room-header { display: flex; align-items: baseline; gap: 10px; }
.code {
  font-family: "Rockwell", "Roboto Slab", "Georgia", serif;
  font-size: 1.6rem;
  letter-spacing: 0.2em;
  color: var(--brass-bright);
}

.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-list li {
  background: var(--studio-2);
  border: 1px solid var(--studio-3);
  border-bottom: 3px solid var(--brass);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.player-list .who { font-weight: 700; letter-spacing: 0.03em; }
.player-list .tag { margin-left: auto; color: var(--dim); font-size: 0.8rem; }
.player-list .pts {
  margin-left: auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--brass-bright);
}

/* ---------- game: on the air ---------- */

.game { gap: 10px; }

.game-header { display: flex; align-items: center; gap: 10px; }
.onair {
  background: var(--curtain);
  color: var(--cream);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  border-radius: 4px;
  padding: 3px 8px;
  box-shadow: 0 0 10px rgba(168, 50, 42, 0.7);
  animation: onair-glow 2.4s ease-in-out infinite;
}
@keyframes onair-glow {
  50% { box-shadow: 0 0 18px rgba(168, 50, 42, 1); }
}
.phase { color: var(--dim); font-size: 0.9rem; }
.timer {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--brass-bright);
}
.timer.low { color: var(--lose); }

/* contestants at their podiums */
.seats { display: flex; flex-wrap: wrap; gap: 6px; }
.seat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, var(--studio-3), var(--studio-2));
  border: 1px solid var(--brass);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 5px 12px 5px 8px;
  font-size: 0.88rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
}
.seat .check { color: var(--win); }
.seat.me { outline: 2px dashed rgba(217, 164, 65, 0.5); outline-offset: 1px; }
.seat.gone { opacity: 0.45; }
.seat.votable { border-color: var(--brass-bright); cursor: pointer; box-shadow: 0 0 12px rgba(240, 199, 102, 0.25); }
.seat.voted-for { background: var(--curtain); color: var(--cream); border-color: var(--curtain-dark); }

/* the question card — cream stock, typewriter text */
.prompt-card {
  background: linear-gradient(175deg, var(--cream), var(--cream-dim));
  color: var(--ink);
  border-radius: 6px;
  padding: 16px 16px 14px;
  font-family: ui-monospace, "Courier New", monospace;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  transform: rotate(-0.6deg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  position: relative;
}
.prompt-card::before {
  content: "TONIGHT'S QUESTION";
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--curtain);
  margin-bottom: 6px;
}

.answer-form { display: flex; gap: 8px; }
.answer-form input { flex: 1; }

/* contestants' written answers — more card stock */
.answers-grid { display: flex; flex-direction: column; gap: 6px; }
.answers-grid .ans {
  background: var(--cream);
  color: var(--ink);
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 0.95rem;
  line-height: 1.35;
  font-family: ui-monospace, "Courier New", monospace;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.answers-grid .ans b { margin-right: 6px; }

.vote-title {
  color: var(--brass-bright);
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.9rem;
}

.chat-feed {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  background: var(--studio-2);
  border: 1px solid var(--studio-3);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-feed .msg { line-height: 1.35; overflow-wrap: anywhere; }
.chat-feed .msg b { margin-right: 6px; }
.chat-feed .sys { color: var(--dim); font-style: italic; font-size: 0.85rem; text-align: center; }

.typing-line { color: var(--dim); font-size: 0.8rem; min-height: 1.1em; margin: 0; padding: 0 4px; font-style: italic; }

.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }

/* ---------- the reveal: main stage ---------- */

/* the curtain drops behind the lineup */
.reveal-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 22px 12px 18px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 30%),
    repeating-linear-gradient(
      90deg,
      var(--curtain) 0px,
      var(--curtain) 22px,
      var(--curtain-dark) 22px,
      var(--curtain-dark) 34px
    );
  box-shadow: inset 0 -14px 30px rgba(0, 0, 0, 0.45), 0 6px 24px rgba(0, 0, 0, 0.5);
}
.stage-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  text-align: center;
}
.stage-sub {
  color: var(--brass-bright);
  font-weight: 700;
  min-height: 1.3em;
  font-size: 0.95rem;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
}

.lineup { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.lineup-card {
  background: linear-gradient(180deg, var(--studio-3), var(--studio-2));
  border: 2px solid var(--brass);
  border-radius: 8px 8px 4px 4px;
  border-bottom-width: 6px;
  padding: 12px 10px 8px;
  width: 88px;
  text-align: center;
  transition: opacity 400ms ease, filter 400ms ease, border-color 250ms ease;
  perspective: 300px;
}
.lineup-card .lc-avatar { font-size: 1.9rem; line-height: 1.2; }
.lineup-card .lc-name {
  font-size: 0.72rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--cream);
  border-radius: 3px;
  padding: 2px 4px;
  margin-top: 4px;
}
.lineup-card .lc-votes { font-size: 0.7rem; min-height: 1.2em; letter-spacing: 1px; }
.lineup-card.bump { border-color: var(--brass-bright); }
.lineup-card.eliminated { opacity: 0.25; filter: grayscale(1); }
.lineup-card.the-one {
  border-color: var(--brass-bright);
  box-shadow: 0 0 28px rgba(240, 199, 102, 0.6);
}

/* the APPLAUSE sign */
.applause {
  font-family: "Rockwell", "Roboto Slab", "Georgia", serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass-bright);
  border: 2px solid var(--brass-bright);
  border-radius: 6px;
  padding: 6px 18px;
  background: rgba(0, 0, 0, 0.35);
  animation: applause-blink 640ms steps(2, start) infinite;
  text-shadow: 0 0 12px rgba(240, 199, 102, 0.8);
}
@keyframes applause-blink {
  50% { opacity: 0.35; }
}

.reveal-card {
  background: var(--studio-2);
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reveal-card .big-name {
  font-family: "Rockwell", "Roboto Slab", "Georgia", serif;
  font-size: 1.8rem;
  font-weight: 800;
}
.reveal-card .verdict { font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.reveal-card .verdict.win { color: var(--win); }
.reveal-card .verdict.lose { color: var(--lose); }
.reveal-card .votes { color: var(--dim); font-size: 0.9rem; line-height: 1.6; }

/* ---------- daily + replay share the set ---------- */

.daily-body { display: flex; flex-direction: column; gap: 12px; }
.daily-round { display: flex; flex-direction: column; gap: 6px; }
.daily-chat {
  background: var(--studio-2);
  border: 1px solid var(--studio-3);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.daily-seats { display: flex; flex-wrap: wrap; gap: 6px; }
.daily-seats .seat.votable { border-color: var(--brass-bright); }
.daily-seats .seat.was-bot { background: var(--curtain); color: var(--cream); }
.daily-seats .seat.wrong-pick { border-color: var(--lose); }
.tell { color: var(--dim); font-size: 0.9rem; line-height: 1.5; text-align: left; }

.replay-header { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.bot-line { outline: 2px solid var(--curtain); outline-offset: 1px; border-radius: 6px; }
.replay-cta { text-align: center; margin: 8px 0 24px; }
.replay-cta a { color: var(--brass-bright); }

/* ---------- sponsors ---------- */

.ad-slot {
  margin-top: 10px;
  background: var(--studio-2);
  border: 1px solid var(--studio-3);
  border-radius: var(--radius);
  padding: 8px;
  text-align: center;
}
.ad-label {
  display: block;
  color: var(--dim);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ---------- juice ---------- */

@keyframes shake-kf {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-6px, 2px, 0); }
  30% { transform: translate3d(5px, -2px, 0); }
  45% { transform: translate3d(-4px, 1px, 0); }
  60% { transform: translate3d(3px, -1px, 0); }
  75% { transform: translate3d(-2px, 1px, 0); }
}
.shake { animation: shake-kf 280ms ease-out; }

@keyframes deal-kf {
  from { opacity: 0; transform: translateY(12px) rotate(-1deg) scale(0.96); }
  to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
.answers-grid .ans.deal {
  animation: deal-kf 300ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

.timer.pulse { animation: timer-pulse 260ms ease-out; }
@keyframes timer-pulse {
  50% { transform: scale(1.18); }
}

@media (prefers-reduced-motion: reduce) {
  .shake { animation: none; }
  .answers-grid .ans.deal { animation-duration: 1ms; }
  .timer.pulse { animation: none; }
  .lineup-card { transition-duration: 1ms; }
  .applause { animation: none; }
  .onair { animation: none; }
}

/* ---------- larger screens ---------- */

@media (min-width: 720px) {
  :root { font-size: 17px; }
  #app { max-width: 640px; }
}
