/* Charades. AndrewNet chrome (Styling Guide) with the picture-palace theme inside it.
   Milestone 1: plain lobby styling. The full theme (curtains, title cards, Troupers) is milestone 7. */
:root {
  --bg: #0d1020;
  --bg2: #151a33;
  --surface: rgba(255,255,255,.05);
  --surface-hi: rgba(255,255,255,.09);
  --text: #f2f3fa;
  --muted: #9aa0bf;
  --accent: #8fb0ff;
  --border: rgba(255,255,255,.10);
  --glow: rgba(110,120,255,.45);
  --crimson: #9b1c31;
  --wine: #4a0d1a;
  --gold: #ffc94a;
  --cream: #f5ecd7;
  --ink: #1b1622;
  --green: #35c46a;
  --amber: #f0a030;
  --red: #ff4d5e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(47,111,228,.35), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(123,63,228,.30), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
button, input { font: inherit; color: inherit; }

.back {
  position: fixed; top: 10px; left: 12px; z-index: 50;
  color: var(--accent); text-decoration: none; font-size: .9rem; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; background: rgba(13,16,32,.6); border: 1px solid var(--border);
}
.back:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
html.party .back { display: none; }

.loading { display: grid; place-items: center; min-height: 60vh; font-size: 1.4rem; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--surface-hi); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, #8fd8ff, #a98bff); color: #0d1020; border: 0; }
.btn.big { min-height: 58px; font-size: 1.15rem; width: 100%; }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: .9rem; }
.btn.danger { border-color: rgba(255,77,94,.5); color: #ffb3bb; }
.btn[aria-disabled="true"] { opacity: .55; }
.link { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 4px; min-height: 44px; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---------- marquee title (simple for now) ---------- */
.marquee {
  display: inline-block; padding: 10px 26px; border-radius: 16px;
  background: linear-gradient(180deg, var(--crimson), var(--wine));
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 4px rgba(255,201,74,.18), 0 0 30px rgba(255,201,74,.25);
  background-image: radial-gradient(circle, rgba(255,231,160,.95) 0 3px, transparent 4px), linear-gradient(180deg, var(--crimson), var(--wine));
  background-size: 22px 22px, auto;
  background-position: 0 0, 0 0;
}
.marquee h1 {
  font-size: 2.4rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cream); text-shadow: 0 2px 0 var(--wine), 0 0 18px rgba(255,201,74,.55);
  background: rgba(74,13,26,.85); padding: 2px 14px; border-radius: 8px;
}
.marquee.small h1 { font-size: 1.4rem; }

/* ---------- cards and forms ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 18px; }
.card h2 { font-size: 1.05rem; margin-bottom: 10px; }
.note { color: var(--muted); font-size: .92rem; }
.problem, .why { color: #ffb3bb; }
.why { text-align: center; margin: 6px 0 0; font-size: .95rem; }
label { display: grid; gap: 6px; font-weight: 600; }
input {
  min-height: 52px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: rgba(0,0,0,.25); font-size: 1.2rem;
}
#jCode { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; }

/* ---------- home ---------- */
.home { max-width: 460px; margin: 0 auto; padding: 64px 16px 32px; display: grid; gap: 18px; text-align: center; }
.home .tag { font-size: 1.1rem; margin: 0; }
.home-btns { display: grid; gap: 12px; }
.join { display: grid; gap: 14px; text-align: left; }

/* ---------- phone lobby ---------- */
.lobby { max-width: 520px; margin: 0 auto; padding: 56px 14px 32px; display: grid; gap: 14px; }
.lob-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.roomcode { font-size: 1.1rem; color: var(--muted); }
.roomcode b { color: var(--gold); letter-spacing: .18em; font-size: 1.5rem; }
.qrcard { display: flex; gap: 14px; align-items: center; }
.qrcard .qr { width: 132px; height: 132px; border-radius: 12px; background: #fff; flex: none; }
.qrcard p { margin: 0; }
.me { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.me-name { font-size: 1.3rem; font-weight: 700; flex: 1; min-width: 0; }
.namef { display: flex; gap: 8px; flex: 1; min-width: 0; }
.namef input { flex: 1; min-width: 0; }
.count { color: var(--muted); font-weight: 500; font-size: .9rem; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.prow {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px;
  border-radius: 14px; border: 1px solid transparent; background: rgba(255,255,255,.03); text-align: left; cursor: pointer;
}
.prow.plain { cursor: default; }
.prow:not(.plain):hover { border-color: var(--border); }
.pmenu { display: flex; gap: 8px; padding: 6px 0 4px 52px; }
.crown { font-size: .75rem; font-weight: 800; color: var(--ink); background: var(--gold); border-radius: 999px; padding: 1px 8px; }
.you, .awaytag { font-size: .8rem; color: var(--muted); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode {
  display: grid; gap: 2px; text-align: left; min-height: 64px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--border); background: rgba(255,255,255,.03); cursor: pointer;
}
.mode span { font-size: .82rem; color: var(--muted); }
.mode.on { border-color: var(--gold); background: rgba(255,201,74,.12); box-shadow: inset 0 0 0 1px var(--gold); }
.wait { text-align: center; color: var(--muted); }
.foot { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* ---------- avatars (placeholder discs; the Troupers arrive in milestone 7) ---------- */
.av {
  --c: #888; display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, white), var(--c) 70%);
  color: var(--ink); font-weight: 900; box-shadow: 0 3px 10px rgba(0,0,0,.35);
}
.av-m { width: 36px; height: 36px; font-size: 1rem; }
.av-l { width: 56px; height: 56px; font-size: 1.5rem; }
.av-xl { width: 150px; height: 150px; font-size: 4.2rem; }
.av.away { filter: grayscale(.8) brightness(.6); }

/* ---------- toast and connection ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 16px; background: #222846; border: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(0,0,0,.45); transition: .2s; z-index: 100; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.conn { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 90; background: var(--amber); color: var(--ink); font-weight: 700; padding: 6px 14px; border-radius: 999px; }

/* ---------- TV / big screen: a 1920×1080 stage scaled to fit ---------- */
body.page-screen { overflow: hidden; height: 100vh; }
.stage-wrap { position: fixed; inset: 0; overflow: hidden; }
.stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: center; font-size: 34px; }
.stage .loading { min-height: 1080px; font-size: 48px; }
.stage .home { padding-top: 260px; max-width: 900px; }
.stage .card h2 { font-size: 48px; }
.stage .btn.big { min-height: 96px; font-size: 40px; }
.scr-lobby { position: absolute; inset: 54px 96px; }
.scr-top { position: absolute; left: 0; right: 0; top: 0; text-align: center; }
.marquee.big { padding: 18px 44px; border-width: 5px; border-radius: 26px; background-size: 34px 34px, auto; }
.marquee.big h1 { font-size: 110px; padding: 0 30px; }
.scr-join { position: absolute; left: 0; top: 230px; display: flex; gap: 36px; align-items: center; }
.scr-join .qr { width: 300px; height: 300px; background: #fff; border-radius: 22px; padding: 10px; }
.scr-join .lbl { font-size: 40px; color: var(--muted); margin: 0; }
.scr-join .url { font-size: 52px; font-weight: 800; color: var(--accent); margin: 4px 0; }
.scr-join .code { font-size: 48px; margin: 0; }
.scr-join .code b { color: var(--gold); letter-spacing: .25em; font-size: 96px; vertical-align: -10px; margin-left: 12px; }
.scr-join.party { top: 260px; right: 0; display: block; text-align: center; }
.scr-join.party .big { font-size: 52px; margin: 0 0 10px; }
.scr-join.party p { font-size: 36px; color: var(--muted); }
.scr-stage {
  position: absolute; left: 0; right: 0; top: 590px; height: 290px;
  border-radius: 26px; background: linear-gradient(180deg, rgba(155,28,49,.25), rgba(74,13,26,.55));
  border-bottom: 10px solid #6b4423;
}
.troupe { position: absolute; inset: 14px 30px 0; display: flex; justify-content: center; align-items: flex-end; gap: 22px; padding-bottom: 18px; }
.trouper { position: relative; display: grid; justify-items: center; gap: 6px; width: 132px; }
.trouper .av-xl { width: 116px; height: 116px; font-size: 56px; }
.trouper .tname { font-size: 32px; font-weight: 700; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trouper .crown { position: absolute; top: -20px; font-size: 24px; }
.trouper .zzz { position: absolute; top: -10px; right: -6px; font-size: 32px; color: var(--muted); font-weight: 800; }
.trouper.away .tname { color: var(--muted); }
.troupe .empty { font-size: 44px; color: var(--muted); align-self: center; margin: 0; }
.scr-bar { position: absolute; left: 0; right: 0; bottom: 30px; display: flex; justify-content: space-between; align-items: center; }
.scr-info { display: flex; gap: 46px; font-size: 38px; color: var(--muted); }
.scr-info b { color: var(--text); }
.scr-btns { display: flex; gap: 24px; }
.scr-btns .btn { min-height: 84px; padding: 0 44px; font-size: 38px; }
.scr-why { position: absolute; right: 0; bottom: -28px; margin: 0; font-size: 32px; color: var(--muted); }
.stage button:focus, .stage button:focus-visible { outline: 6px solid var(--gold); outline-offset: 6px; }

/* TV app: the phone-style pages (home, join) get bigger too */
html.tv body:not(.page-screen) { font-size: 26px; }
html.tv .back { font-size: 26px; padding: 10px 20px; top: 30px; left: 54px; }
html.tv .btn { min-height: 80px; font-size: 34px; }
html.tv button:focus, html.tv a:focus { outline: 6px solid var(--gold); outline-offset: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
