:root {
  --bg: #111018;
  --bg-deep: #09080e;
  --panel: #1b1924;
  --panel-2: #24212e;
  --panel-3: #2d2938;
  --text: #f7f4ee;
  --muted: #a8a2b3;
  --line: rgba(255,255,255,.11);
  --gold: #ffcf5a;
  --coral: #ff6f61;
  --green: #70d6a2;
  --red: #ff7b86;
  --shadow: 0 24px 70px rgba(0,0,0,.3);
  --radius: 22px;
  --radius-sm: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.home-body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,111,97,.16), transparent 32rem),
    radial-gradient(circle at 85% 75%, rgba(255,207,90,.12), transparent 36rem),
    var(--bg-deep);
}
.home-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 90px; }
.home-hero { text-align: center; max-width: 820px; margin: 0 auto 50px; }
.home-logo { width: 102px; filter: drop-shadow(0 18px 28px rgba(0,0,0,.35)); margin-bottom: 22px; }
.eyebrow { margin: 0 0 10px; color: var(--gold); font-size: .75rem; font-weight: 900; letter-spacing: .18em; }
.home-hero h1 { margin: 0; font-size: clamp(3rem, 8vw, 6.8rem); line-height: .9; letter-spacing: -.06em; }
.hero-copy { margin: 28px auto 0; max-width: 650px; color: var(--muted); font-size: 1.15rem; line-height: 1.65; }
.home-actions { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; align-items: stretch; }
.panel { background: linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.012)), var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.home-panel { padding: clamp(26px, 4vw, 46px); }
.home-panel h2 { margin: 0 0 28px; font-size: 2rem; letter-spacing: -.035em; }
.accent-panel { background: linear-gradient(145deg, rgba(255,207,90,.16), rgba(255,111,97,.05)), var(--panel); }
.stack-form { display: grid; gap: 18px; }
.stack-form.compact { gap: 12px; padding-top: 18px; }
label { display: grid; gap: 8px; color: #d9d4df; font-size: .82rem; font-weight: 800; letter-spacing: .02em; }
label small { color: var(--muted); font-weight: 600; }
input, select {
  width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(7,6,11,.5); color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,207,90,.14); }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.grades-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.button {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 900; transition: .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.large { min-height: 56px; font-size: 1rem; }
.button.primary { color: #18131a; background: linear-gradient(135deg, var(--gold), #ffb443); box-shadow: 0 12px 28px rgba(255,188,69,.18); }
.button.secondary { background: rgba(255,255,255,.07); border-color: var(--line); }
.button.secondary:hover, .button.ghost:hover { background: rgba(255,255,255,.11); }
.button.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.button.reveal { color: #1b1216; background: linear-gradient(135deg, var(--gold), var(--coral)); box-shadow: 0 16px 35px rgba(255,111,97,.18); }
.room-code-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin: 45px 0 20px; }
.room-code-form input { min-height: 64px; font-size: 1.7rem; font-weight: 950; letter-spacing: .2em; text-align: center; text-transform: uppercase; }
.muted { color: var(--muted); line-height: 1.6; }
.form-error { margin: 0; color: var(--red); font-weight: 700; }

.loading-screen, .center-screen, .display-loading, .display-center {
  min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; text-align: center; padding: 30px;
}
.spinner { width: 48px; height: 48px; border: 4px solid rgba(255,255,255,.12); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-logo, .join-logo { width: 84px; }
.center-screen h1, .display-center h1 { margin: 0; font-size: 2.3rem; }
.center-screen p, .display-center p { margin: 0 0 12px; color: var(--muted); max-width: 520px; }

.host-app { min-height: 100vh; display: grid; grid-template-columns: 285px 1fr; }
.host-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px; background: #0d0c13; border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.sidebar-brand img { width: 48px; height: 48px; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { font-size: .95rem; }
.sidebar-brand span { color: var(--muted); font-size: .62rem; font-weight: 900; letter-spacing: .12em; }
.room-code-card { display: grid; justify-items: center; padding: 18px; border-radius: 16px; background: linear-gradient(135deg, rgba(255,207,90,.15), rgba(255,111,97,.1)); border: 1px solid rgba(255,207,90,.25); }
.room-code-card span { font-size: .65rem; font-weight: 900; letter-spacing: .16em; color: var(--gold); }
.room-code-card strong { margin: 6px 0 4px; font-size: 2rem; letter-spacing: .18em; }
.text-button { padding: 5px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.text-button:hover { color: var(--text); }
.phase-pill { margin: 14px 0; padding: 9px 12px; text-align: center; border-radius: 999px; background: rgba(112,214,162,.1); color: var(--green); font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-actions { display: grid; gap: 9px; }
.sidebar-players { margin-top: 28px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.03em; }
.section-heading > span, .section-heading > b { color: var(--muted); font-size: .72rem; letter-spacing: .1em; }
.sidebar-player { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-player div { display: grid; min-width: 0; }
.sidebar-player strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; }
.sidebar-player span { color: var(--muted); font-size: .68rem; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(255,255,255,.07); cursor: pointer; }
.icon-button.danger:hover { background: rgba(255,123,134,.16); color: var(--red); }
.empty-note { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.avatar { flex: 0 0 auto; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, #3e374f, #251f31); border: 1px solid rgba(255,255,255,.14); font-weight: 950; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.tiny { width: 28px; height: 28px; font-size: .62rem; }
.avatar.small { width: 38px; height: 38px; font-size: .72rem; }
.avatar.medium { width: 58px; height: 58px; font-size: 1rem; }
.avatar.large { width: 76px; height: 76px; font-size: 1.2rem; }
.avatar.xlarge { width: 112px; height: 112px; font-size: 1.8rem; }
.host-main { min-width: 0; padding: 32px; }
.host-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 0 auto 28px; max-width: 1500px; }
.host-header h1 { margin: 0 0 7px; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.045em; }
.host-header p:not(.eyebrow) { margin: 0; color: var(--muted); }
.connection-status { display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 800; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(112,214,162,.1); }
.host-content-grid { max-width: 1500px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, .75fr); gap: 24px; align-items: start; }
.setup-panel, .lobby-panel, .live-stage, .queue-panel { padding: 28px; }
.save-note, .ready-count, .save-status { color: var(--muted); font-size: .75rem; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.check-card { display: flex; gap: 11px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(0,0,0,.15); cursor: pointer; }
.check-card input { width: 19px; min-height: 19px; margin-top: 2px; accent-color: var(--gold); }
.check-card span { display: grid; gap: 4px; }
.check-card small { line-height: 1.4; }
.grade-settings { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(0,0,0,.13); }
.join-link-box { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 15px; border-radius: 15px; background: rgba(255,255,255,.045); }
.join-link-box span { grid-column: 1 / -1; color: var(--muted); font-size: .65rem; font-weight: 900; letter-spacing: .15em; }
.join-link-box code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gold); }
.lobby-player-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.lobby-player { display: grid; justify-items: center; gap: 7px; padding: 18px 10px; border-radius: 16px; border: 1px solid var(--line); background: rgba(0,0,0,.12); text-align: center; }
.lobby-player span { color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .06em; }
.lobby-player.is-ready { border-color: rgba(112,214,162,.35); background: rgba(112,214,162,.07); }
.lobby-player.is-ready span { color: var(--green); }
.lobby-controls { display: grid; gap: 10px; }
.empty-state { min-height: 190px; display: grid; place-content: center; gap: 7px; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.empty-state strong { color: var(--text); font-size: 1.15rem; }

.live-layout { max-width: 1500px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 24px; align-items: start; }
.progress-badge { padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--gold) !important; font-weight: 900; }
.host-active-card { display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 25px; border-radius: 19px; background: linear-gradient(135deg, rgba(255,207,90,.13), rgba(255,111,97,.06)); border: 1px solid rgba(255,207,90,.2); }
.host-active-card.hidden { filter: saturate(.65); }
.active-owner { display: flex; align-items: center; gap: 16px; }
.active-owner div { display: grid; }
.active-owner span, .active-copy p, .active-grade-count span { color: var(--muted); font-size: .67rem; font-weight: 900; letter-spacing: .12em; }
.active-owner strong { font-size: 1.2rem; }
.active-copy { min-width: 0; }
.active-copy h3 { margin: 2px 0 6px; font-size: clamp(1.5rem, 3vw, 2.6rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.active-copy > span { color: var(--muted); }
.active-grade-count { display: grid; justify-items: center; padding-left: 20px; border-left: 1px solid var(--line); }
.active-grade-count strong { font-size: 2.3rem; color: var(--gold); }
.live-control-row { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; margin: 18px 0; }
.big-reveal-panel { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding: 22px; margin-top: 24px; border-radius: 18px; background: linear-gradient(120deg, rgba(255,207,90,.18), rgba(255,111,97,.15)); border: 1px solid rgba(255,207,90,.3); }
.big-reveal-panel h3 { margin: 0 0 4px; font-size: 1.4rem; }
.big-reveal-panel span { color: var(--muted); }
.big-reveal-panel.is-active { box-shadow: 0 0 0 3px rgba(255,207,90,.12); }
.host-standings { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.host-standing { display: grid; grid-template-columns: 26px auto 1fr auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.host-standing > b { color: var(--muted); }
.host-standing > strong { color: var(--gold); font-size: 1.2rem; }
.queue-panel { max-height: calc(100vh - 150px); position: sticky; top: 24px; display: flex; flex-direction: column; }
.queue-list { min-height: 180px; overflow-y: auto; display: grid; gap: 7px; padding-right: 4px; }
.queue-item { display: grid; grid-template-columns: 28px auto 1fr auto; align-items: center; gap: 9px; min-height: 55px; padding: 8px 10px; border-radius: 12px; border: 1px solid transparent; background: rgba(255,255,255,.035); text-align: left; cursor: pointer; }
.queue-item:hover { background: rgba(255,255,255,.07); }
.queue-item.active { border-color: var(--gold); background: rgba(255,207,90,.1); }
.queue-item.done { opacity: .7; }
.queue-item > span { color: var(--muted); font-size: .72rem; }
.queue-item div { min-width: 0; display: grid; }
.queue-item strong, .queue-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item small { color: var(--muted); }
.queue-item > b { color: var(--green); }
.danger-zone { padding-top: 18px; text-align: center; }
.danger-text { color: var(--red); }

.player-body { background: var(--bg-deep); }
.player-join-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, rgba(255,207,90,.12), transparent 28rem), var(--bg-deep); }
.player-join-card { width: min(520px, 100%); padding: 32px; text-align: center; }
.player-join-card h1 { margin: 8px 0; font-size: 2.25rem; }
.player-join-card > p:not(.eyebrow) { color: var(--muted); margin: 0 0 26px; }
.player-join-card form { text-align: left; }
.player-app { min-height: 100vh; }
.player-header { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 15px; min-height: 70px; padding: 10px max(16px, env(safe-area-inset-left)); background: rgba(13,12,19,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.player-brand, .player-me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-brand img { width: 43px; }
.player-brand div { display: grid; min-width: 0; }
.player-brand strong { max-width: 48vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-brand span { color: var(--gold); font-size: .62rem; font-weight: 900; letter-spacing: .12em; }
.player-me span { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 800; }
.player-main { width: min(760px, 100%); margin: 0 auto; padding: 24px 16px 120px; }
.mobile-title { margin-bottom: 22px; }
.mobile-title h1 { margin: 0 0 8px; font-size: 2.25rem; letter-spacing: -.04em; }
.mobile-title p:not(.eyebrow) { margin: 0; color: var(--muted); line-height: 1.5; }
.profile-panel { margin-bottom: 16px; padding: 0 18px 18px; }
.profile-panel summary { padding: 17px 0; cursor: pointer; font-weight: 900; }
.picks-panel { padding: 20px; margin-bottom: 18px; }
.private-pick-list { display: grid; gap: 11px; }
.private-pick-card { display: grid; grid-template-columns: 54px 1fr; align-items: stretch; gap: 10px; }
.private-rank { display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg, rgba(255,207,90,.16), rgba(255,111,97,.09)); color: var(--gold); font-weight: 950; }
.private-fields { display: grid; gap: 7px; }
.private-fields input { min-height: 45px; }
.private-fields input:first-child { font-weight: 850; }
.honorable-panel .private-rank { color: var(--coral); background: rgba(255,111,97,.1); }
.sticky-ready-bar { position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9; width: min(728px, calc(100% - 24px)); display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 14px 13px 18px; border-radius: 18px; background: rgba(27,25,36,.96); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.45); backdrop-filter: blur(18px); }
.sticky-ready-bar div { display: grid; }
.sticky-ready-bar span { color: var(--muted); font-size: .72rem; }
.locked-banner { text-align: center; color: var(--red); }
.phone-stage { padding: 24px; min-height: calc(100vh - 125px); display: flex; flex-direction: column; }
.phone-progress { display: flex; justify-content: space-between; color: var(--muted); font-size: .76rem; font-weight: 900; letter-spacing: .07em; }
.phone-progress b { color: var(--gold); }
.active-phone-owner { display: flex; align-items: center; gap: 15px; margin: 24px 0; }
.active-phone-owner div { display: grid; }
.active-phone-owner span { color: var(--gold); font-size: .68rem; font-weight: 900; letter-spacing: .13em; }
.active-phone-owner strong { font-size: 1.3rem; }
.phone-reveal-copy { flex: 1; display: grid; place-content: center; text-align: center; }
.phone-reveal-copy p { color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .15em; }
.phone-reveal-copy h1 { margin: 0; font-size: clamp(3rem, 15vw, 6rem); line-height: .9; letter-spacing: -.055em; }
.phone-reveal-copy span { margin-top: 14px; color: var(--muted); font-size: 1rem; }
.phone-stage:not(.is-revealed) .phone-reveal-copy h1 { color: var(--gold); letter-spacing: .1em; }
.phone-grading { padding-top: 24px; border-top: 1px solid var(--line); }
.grade-button-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.grade-button { min-height: 68px; display: grid; place-content: center; gap: 3px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.045); cursor: pointer; }
.grade-button strong { font-size: 1.35rem; }
.grade-button span { color: var(--muted); font-size: .65rem; }
.grade-button.selected { border-color: var(--gold); background: rgba(255,207,90,.13); color: var(--gold); }
.phone-grading > small { display: block; margin-top: 10px; color: var(--muted); text-align: center; }
.grade-wait, .honorable-note { padding: 18px; border-radius: 13px; background: rgba(255,255,255,.05); color: var(--muted); text-align: center; }
.phone-final { text-align: center; padding-top: 20px; }
.phone-final h1 { margin: 0 0 25px; font-size: 2.5rem; }
.phone-winner { display: grid; justify-items: center; gap: 6px; padding: 30px; border-radius: 24px; background: linear-gradient(135deg, rgba(255,207,90,.2), rgba(255,111,97,.12)); border: 1px solid rgba(255,207,90,.3); }
.phone-winner span { color: var(--gold); font-weight: 950; }
.phone-winner strong { font-size: 2rem; }
.phone-winner b { font-size: 1.25rem; color: var(--gold); }
.phone-standings { display: grid; gap: 8px; margin-top: 14px; }
.phone-standings > div { display: grid; grid-template-columns: 28px auto 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; text-align: left; }
.phone-standings > div > strong { color: var(--gold); }

.display-body { overflow: hidden; background: #08070c; }
.display-app { min-height: 100vh; height: 100vh; display: grid; grid-template-rows: 88px 1fr 48px; background: radial-gradient(circle at 80% 20%, rgba(255,111,97,.09), transparent 35rem), #08070c; }
.display-animate .tv-pick-card, .display-animate .tv-winner { animation: displayIn .45s ease both; }
@keyframes displayIn { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.tv-header, .tv-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 0 34px; border-bottom: 1px solid var(--line); }
.tv-footer { border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); font-size: .78rem; letter-spacing: .08em; }
.tv-footer b { color: var(--gold); }
.tv-brand { display: flex; align-items: center; gap: 14px; }
.tv-brand img { width: 55px; }
.tv-brand div { display: grid; }
.tv-brand span { color: var(--gold); font-size: .65rem; font-weight: 900; letter-spacing: .16em; }
.tv-brand strong { font-size: 1.15rem; }
.tv-meta { display: flex; align-items: center; gap: 20px; color: var(--muted); font-size: .75rem; font-weight: 900; letter-spacing: .13em; }
.fullscreen-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.05); cursor: pointer; font-size: 1.2rem; }
.tv-main { min-height: 0; }
.tv-lobby, .tv-waiting { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; }
.lobby-code { display: grid; justify-items: center; margin-bottom: 30px; }
.lobby-code span { color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .17em; }
.lobby-code strong { font-size: clamp(4rem, 9vw, 8rem); line-height: 1; letter-spacing: .18em; color: var(--gold); }
.tv-lobby h1 { margin: 0; font-size: clamp(2.5rem, 5vw, 5.5rem); letter-spacing: -.05em; }
.tv-lobby > p:not(.eyebrow) { color: var(--muted); font-size: 1.25rem; }
.tv-player-grid { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin-top: 25px; }
.tv-player-grid article { min-width: 150px; display: grid; justify-items: center; gap: 6px; padding: 18px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.tv-player-grid article span { color: var(--muted); font-size: .65rem; font-weight: 900; letter-spacing: .09em; }
.tv-player-grid article.ready { border-color: rgba(112,214,162,.35); }
.tv-player-grid article.ready span { color: var(--green); }
.waiting-rings { width: 160px; height: 160px; display: grid; place-items: center; border-radius: 50%; border: 3px solid rgba(255,207,90,.2); box-shadow: 0 0 0 25px rgba(255,207,90,.04), 0 0 0 50px rgba(255,207,90,.02); margin-bottom: 50px; }
.waiting-rings span { font-size: 5rem; color: var(--gold); }
.tv-waiting h1 { margin: 0; font-size: 4rem; }
.tv-waiting > p:not(.eyebrow) { color: var(--muted); font-size: 1.25rem; }
.tv-pick-stage { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 18px; padding: 22px 36px 18px; }
.tv-player-card { display: flex; align-items: center; gap: 16px; }
.tv-avatar { width: 78px; height: 78px; font-size: 1.2rem; }
.tv-player-card div { display: grid; }
.tv-player-card span { color: var(--gold); font-size: .67rem; font-weight: 900; letter-spacing: .14em; }
.tv-player-card strong { font-size: 1.55rem; }
.tv-player-card small { color: var(--muted); }
.tv-pick-card { min-height: 0; display: grid; grid-template-columns: 105px minmax(0, 1fr) 170px; align-items: stretch; overflow: hidden; border: 1px solid rgba(255,207,90,.22); border-radius: 28px; background: linear-gradient(135deg, rgba(255,207,90,.11), rgba(255,111,97,.045)), var(--panel); box-shadow: var(--shadow); }
.tv-pick-card:has(.tv-pick-image) { grid-template-columns: 105px minmax(240px, 34%) minmax(0, 1fr) 170px; }
.tv-rank { display: grid; place-items: center; font-size: clamp(2.5rem, 5vw, 5rem); font-weight: 950; color: var(--gold); background: rgba(0,0,0,.16); }
.tv-pick-image { min-height: 0; padding: 20px; }
.tv-pick-image img { width: 100%; height: 100%; max-height: 45vh; object-fit: contain; border-radius: 18px; background: rgba(0,0,0,.18); }
.tv-pick-copy { min-width: 0; display: grid; align-content: center; padding: 28px 35px; }
.tv-pick-copy p { margin: 0 0 8px; color: var(--muted); font-size: .75rem; font-weight: 900; letter-spacing: .16em; }
.tv-pick-copy h1 { margin: 0; font-size: clamp(3.2rem, 7vw, 7.4rem); line-height: .9; letter-spacing: -.06em; overflow-wrap: anywhere; }
.tv-pick-copy h2 { margin: 14px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.8rem); font-weight: 600; }
.tv-pick-stage.hidden .tv-pick-copy h1 { color: var(--gold); letter-spacing: .12em; }
.tv-entry-score { display: grid; align-content: center; justify-items: center; border-left: 1px solid var(--line); background: rgba(0,0,0,.12); }
.tv-entry-score span { color: var(--muted); font-size: .65rem; font-weight: 900; letter-spacing: .13em; }
.tv-entry-score strong { font-size: 4.8rem; color: var(--gold); }
.tv-grades { display: grid; grid-template-columns: repeat(var(--grade-count), minmax(0, 1fr)); gap: 10px; }
.tv-grades article { min-width: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 10px 13px; border-radius: 13px; background: var(--panel); border: 1px solid var(--line); }
.tv-grades span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .8rem; }
.tv-grades strong { font-size: 1.35rem; color: var(--gold); }
.tv-progress { position: relative; height: 7px; overflow: visible; border-radius: 999px; background: rgba(255,255,255,.08); }
.tv-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--coral)); transition: width .35s ease; }
.tv-progress b { position: absolute; right: 0; bottom: 10px; color: var(--muted); font-size: .7rem; }
.tv-final { height: 100%; display: grid; grid-template-columns: 1.05fr .95fr; grid-template-rows: auto auto 1fr; gap: 14px 40px; align-items: center; padding: 28px 6vw; }
.tv-final > .eyebrow, .tv-final > h1 { grid-column: 1 / -1; text-align: center; }
.tv-final > h1 { margin: 0; font-size: clamp(2.3rem, 4vw, 4rem); }
.tv-winner { grid-row: 3; display: grid; justify-items: center; gap: 4px; padding: 30px; border-radius: 30px; background: radial-gradient(circle at top, rgba(255,207,90,.22), transparent 60%), var(--panel); border: 2px solid rgba(255,207,90,.35); box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.winner-avatar { width: min(18vw, 210px); height: min(18vw, 210px); font-size: 3rem; box-shadow: 0 0 0 8px rgba(255,207,90,.1); }
.tv-winner > span { margin-top: 10px; color: var(--gold); font-size: 1.2rem; font-weight: 950; }
.tv-winner > strong { font-size: clamp(2.5rem, 4vw, 5rem); line-height: 1; text-align: center; }
.tv-winner > small { color: var(--muted); font-size: 1.1rem; }
.tv-winner > b { margin-top: 10px; color: var(--gold); font-size: 2rem; }
.tv-other-standings { grid-row: 3; display: grid; gap: 11px; align-content: center; }
.tv-other-standings article { display: grid; grid-template-columns: 44px auto 1fr auto; align-items: center; gap: 13px; padding: 14px 17px; border-radius: 17px; background: var(--panel); border: 1px solid var(--line); }
.tv-other-standings em { color: var(--muted); font-size: 1.4rem; font-style: normal; font-weight: 950; }
.tv-other-standings > article > span { display: grid; }
.tv-other-standings small { color: var(--muted); }
.tv-other-standings b { color: var(--gold); font-size: 1.8rem; }

.toast { position: fixed; left: 50%; bottom: 25px; z-index: 1000; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 999px; background: #272330; border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 800; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { color: #ffd5da; border-color: rgba(255,123,134,.35); }

@media (max-width: 1120px) {
  .host-app { grid-template-columns: 235px 1fr; }
  .host-sidebar { padding: 16px; }
  .host-content-grid, .live-layout { grid-template-columns: 1fr; }
  .queue-panel { position: static; max-height: none; }
  .queue-list { max-height: 520px; }
  .check-grid { grid-template-columns: 1fr; }
  .tv-pick-card, .tv-pick-card:has(.tv-pick-image) { grid-template-columns: 85px minmax(0, 1fr) 125px; }
  .tv-pick-image { display: none; }
}

@media (max-width: 760px) {
  .home-shell { width: min(100% - 24px, 600px); padding: 38px 0 55px; }
  .home-hero h1 { font-size: 3.6rem; }
  .home-actions { grid-template-columns: 1fr; }
  .form-grid.two, .form-grid.grades-four { grid-template-columns: 1fr 1fr; }
  .host-app { display: block; }
  .host-sidebar { position: static; width: 100%; height: auto; padding: 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand, .sidebar-players { display: none; }
  .room-code-card { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px; }
  .room-code-card strong { font-size: 1.35rem; }
  .phase-pill { margin: 9px 0; }
  .sidebar-actions { grid-template-columns: 1fr 1fr; }
  .sidebar-actions .button.ghost { display: none; }
  .host-main { padding: 18px 12px; }
  .host-header { align-items: flex-end; }
  .host-header h1 { font-size: 2rem; }
  .host-header p:not(.eyebrow) { display: none; }
  .setup-panel, .lobby-panel, .live-stage, .queue-panel { padding: 18px; }
  .host-active-card { grid-template-columns: 1fr; text-align: center; }
  .active-owner { justify-content: center; }
  .active-grade-count { border: 0; border-top: 1px solid var(--line); padding: 12px 0 0; }
  .active-copy h3 { white-space: normal; }
  .live-control-row { grid-template-columns: 1fr; }
  .big-reveal-panel { display: grid; }
  .lobby-player-grid { grid-template-columns: 1fr 1fr; }
  .sticky-ready-bar { align-items: stretch; }
  .sticky-ready-bar div { display: none; }
  .sticky-ready-bar .button { width: 100%; }
  .grade-button-grid { grid-template-columns: repeat(2, 1fr); }
  .display-app { grid-template-rows: 70px 1fr 38px; }
  .tv-header, .tv-footer { padding: 0 14px; }
  .tv-brand img { width: 42px; }
  .tv-brand span, .tv-footer span { display: none; }
  .tv-pick-stage { padding: 12px; gap: 10px; }
  .tv-pick-card, .tv-pick-card:has(.tv-pick-image) { grid-template-columns: 65px 1fr; grid-template-rows: 1fr auto; }
  .tv-rank { grid-row: 1 / 3; font-size: 2rem; }
  .tv-pick-copy { padding: 15px; }
  .tv-pick-copy h1 { font-size: 2.5rem; }
  .tv-entry-score { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); grid-template-columns: 1fr auto; padding: 8px 15px; justify-items: start; align-items: center; }
  .tv-entry-score strong { justify-self: end; font-size: 2rem; }
  .tv-grades { grid-template-columns: repeat(2, 1fr); }
  .tv-final { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; overflow-y: auto; }
  .tv-winner, .tv-other-standings { grid-row: auto; }
}

@media (max-height: 720px) and (min-width: 761px) {
  .display-app { grid-template-rows: 70px 1fr 36px; }
  .tv-pick-stage { padding-top: 12px; gap: 10px; }
  .tv-avatar { width: 55px; height: 55px; }
  .tv-player-card strong { font-size: 1.15rem; }
  .tv-pick-copy h1 { font-size: clamp(2.8rem, 6vw, 5.5rem); }
  .tv-pick-image img { max-height: 34vh; }
  .tv-grades article { padding: 7px 10px; }
}

/* Player avatar upload and presets */
.form-section-label { display: block; margin-bottom: 9px; color: #d9d4df; font-size: .82rem; font-weight: 800; letter-spacing: .02em; }
.avatar-chooser { display: grid; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(7,6,11,.28); }
.avatar-choice-top { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 16px; }
.avatar-preview { display: grid; place-items: center; }
.avatar-choice-actions { display: grid; gap: 8px; }
.avatar-choice-actions .button { width: 100%; }
.avatar-choice-actions small { color: var(--muted); line-height: 1.35; }
.avatar-preset-label { color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .05em; }
.avatar-preset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.avatar-preset { display: grid; justify-items: center; gap: 5px; padding: 7px 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); color: var(--muted); cursor: pointer; }
.avatar-preset:hover, .avatar-preset.selected { border-color: var(--gold); background: rgba(255,207,90,.11); color: var(--text); }
.avatar-preset img { width: 48px; height: 48px; border-radius: 50%; }
.avatar-preset span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: .62rem; font-weight: 800; }
.avatar-chooser.is-processing { opacity: .62; pointer-events: none; }

@media (max-width: 520px) {
  .avatar-choice-top { grid-template-columns: 1fr; justify-items: center; }
  .avatar-choice-actions { width: 100%; }
  .avatar-preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .avatar-preset img { width: 42px; height: 42px; }
}

/* Share-to-TV and host-player dialogs */
.rr-modal-backdrop { position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; padding: 20px; overflow-y: auto; background: rgba(5,4,8,.82); backdrop-filter: blur(10px); }
.rr-modal { position: relative; width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 28px; border: 1px solid var(--line); border-radius: 24px; background: #17141f; box-shadow: 0 35px 100px rgba(0,0,0,.55); }
.modal-close { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.05); color: var(--text); font-size: 1.45rem; cursor: pointer; }
.modal-close:hover { border-color: var(--gold); }
.rr-modal h2 { margin: 4px 42px 8px 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.rr-modal > p:not(.eyebrow), .share-tv-heading > p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.share-tv-grid { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr); gap: 22px; margin-top: 22px; }
.tv-qr-card { display: grid; align-content: start; justify-items: center; gap: 9px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.035); text-align: center; }
.tv-qr-card img { width: min(100%, 310px); aspect-ratio: 1; padding: 8px; border-radius: 12px; background: #fff; }
.tv-qr-card strong { font-size: 1.1rem; }
.tv-qr-card span { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.tv-share-actions { display: grid; align-content: start; gap: 10px; }
.tv-share-actions code { padding: 12px; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.22); color: #d9d4df; font-size: .72rem; line-height: 1.45; }
.tv-help { margin-top: 3px; padding: 14px 16px; border-radius: 14px; background: rgba(255,207,90,.08); border: 1px solid rgba(255,207,90,.18); }
.tv-help strong { display: block; margin-bottom: 7px; color: var(--gold); }
.tv-help ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: .84rem; line-height: 1.55; }
.host-player-modal { width: min(680px, 100%); }
.host-player-modal .stack-form { margin-top: 20px; }

@media (max-width: 760px) {
  .sidebar-actions { grid-template-columns: 1fr; }
  .share-tv-grid { grid-template-columns: 1fr; }
  .rr-modal-backdrop { padding: 10px; align-items: end; }
  .rr-modal { width: 100%; max-height: calc(100vh - 20px); padding: 22px 16px; border-radius: 22px 22px 12px 12px; }
  .tv-qr-card img { width: min(76vw, 280px); }
}


/* v0.3.1: always-visible TV sharing control */
.tv-share-banner { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 0 0 20px; padding: 18px 20px; border: 1px solid rgba(255,207,90,.36); border-radius: 20px; background: linear-gradient(135deg, rgba(255,207,90,.15), rgba(255,111,97,.07)), var(--panel); box-shadow: 0 16px 38px rgba(0,0,0,.22); }
.tv-share-banner-copy { min-width: 0; display: flex; align-items: center; gap: 14px; }
.tv-share-banner-copy > div { min-width: 0; display: grid; gap: 2px; }
.tv-share-banner-copy strong { font-size: 1.18rem; }
.tv-share-banner-copy small { color: var(--muted); line-height: 1.35; }
.tv-share-icon { flex: 0 0 auto; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: #111018; background: var(--gold); font-size: 1.55rem; font-weight: 950; }
.tv-share-main-button { flex: 0 0 auto; min-width: 170px; font-size: 1rem; }
.phase-pill small { margin-left: 6px; color: var(--muted); font-size: .62rem; font-weight: 800; }
@media (max-width: 760px) {
  .tv-share-banner { position: sticky; top: 0; z-index: 40; display: grid; grid-template-columns: 1fr; gap: 12px; margin: -4px 0 16px; padding: 14px; border-radius: 16px; }
  .tv-share-banner-copy small { display: none; }
  .tv-share-main-button { width: 100%; min-width: 0; min-height: 48px; }
  .tv-share-icon { width: 42px; height: 42px; }
}


/* v0.4.0 point breakdown controls */
.breakdown-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.point-breakdown { margin: 10px 0 18px; padding: 14px; border: 1px solid rgba(255,207,90,.28); border-radius: 16px; background: rgba(255,207,90,.06); }
.point-breakdown-heading { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 10px; color: var(--gold); font-size: .76rem; font-weight: 900; letter-spacing: .05em; }
.point-breakdown-list { display: grid; gap: 7px; }
.point-breakdown-list article { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 11px; background: rgba(255,255,255,.04); }
.point-breakdown-list article span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.point-breakdown-list article strong { color: var(--gold); font-size: 1.05rem; }
.point-breakdown-list article b { min-width: 72px; color: var(--muted); text-align: right; font-size: .75rem; }
.tv-point-breakdown { width: min(1320px, 94vw); margin: 0 auto; padding: 12px 16px; border: 1px solid rgba(255,207,90,.36); border-radius: 18px; background: rgba(12,10,18,.9); }
.tv-breakdown-title { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 10px; color: var(--gold); font-weight: 950; letter-spacing: .07em; }
.tv-breakdown-grid { display: grid; grid-template-columns: repeat(var(--breakdown-count), minmax(0,1fr)); gap: 8px; }
.tv-breakdown-grid article { display: grid; grid-template-columns: auto minmax(0,1fr) auto; grid-template-areas: 'avatar name grade' 'avatar points points'; align-items: center; gap: 2px 9px; padding: 9px; border-radius: 12px; background: rgba(255,255,255,.055); }
.tv-breakdown-grid .avatar { grid-area: avatar; }
.tv-breakdown-grid span { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.tv-breakdown-grid strong { grid-area: grade; color: var(--gold); font-size: 1.15rem; }
.tv-breakdown-grid b { grid-area: points; color: var(--muted); font-size: .72rem; }
@media (max-width: 760px) { .breakdown-controls { display: grid; } .point-breakdown-list article { grid-template-columns: auto minmax(0,1fr) auto; } .point-breakdown-list article b { grid-column: 2 / 4; text-align: left; } }
@media (max-height: 760px) and (min-width: 761px) { .tv-point-breakdown { padding: 8px 12px; } .tv-breakdown-grid article { padding: 6px 8px; } }
