:root {
    --ink: #08080a;
    --panel: #131319;
    --panel-2: #1b1b23;
    --line: rgba(255, 255, 255, .11);
    --text: #f7f7f2;
    --muted: #a5a5b2;
    --gold: #ffd329;
    --gold-2: #ff9d00;
    --red: #ff4057;
    --green: #39db96;
    --blue: #5ba7ff;
    --radius: 20px;
    --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); color-scheme: dark; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 82% -10%, rgba(255, 211, 41, .13), transparent 34rem),
        radial-gradient(circle at -10% 70%, rgba(99, 57, 255, .12), transparent 34rem),
        var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 4vw, 4rem); line-height: .98; letter-spacing: -.045em; }
h2 { margin-bottom: .65rem; line-height: 1.1; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.eyebrow {
    margin: 0 0 .65rem;
    color: var(--gold);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.app-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    min-height: 68px;
    align-items: center;
    gap: 2rem;
    padding: 0 clamp(1rem, 3vw, 3rem);
    border-bottom: 1px solid var(--line);
    background: rgba(8, 8, 10, .88);
    backdrop-filter: blur(18px);
}
.header-brand { color: var(--gold); font-size: 1.35rem; font-weight: 950; letter-spacing: -.06em; }
.header-brand span { margin-left: .22em; color: #fff; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.app-header nav { display: flex; flex: 1; align-items: center; gap: .25rem; overflow-x: auto; }
.app-header nav a, .logout {
    padding: .55rem .7rem;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: .84rem;
    font-weight: 720;
    white-space: nowrap;
}
.app-header nav a:hover, .app-header nav a.active { color: #fff; background: rgba(255, 255, 255, .07); }
.logout:hover { color: var(--red); }

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(28, 28, 36, .94), rgba(16, 16, 21, .96));
    box-shadow: var(--shadow);
}
.page-shell { width: min(1500px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.4rem, 4vw, 4rem) 0 5rem; }
.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}
.page-heading h1 { margin-bottom: .3rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.button, button.button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    padding: .7rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #fff;
    background: #252530;
    cursor: pointer;
    font-weight: 800;
}
.button:hover { border-color: rgba(255,255,255,.25); transform: translateY(-1px); }
.button.primary { border-color: var(--gold); color: #17130a; background: var(--gold); }
.button.wide { width: 100%; }
.text-link { color: var(--gold); font-weight: 760; }
.text-button {
    padding: 0;
    border: 0;
    color: var(--gold);
    background: transparent;
    cursor: pointer;
    font-weight: 750;
}
.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #fff;
    background: #252530;
    cursor: pointer;
    font-size: 1.35rem;
}

.stack { display: grid; gap: 1rem; }
label { display: grid; gap: .4rem; color: #d8d8df; font-size: .84rem; font-weight: 700; }
input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: .7rem .8rem;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 10px;
    outline: none;
    color: #fff;
    background: #0d0d12;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,211,41,.12); }
.toggle { display: flex; align-items: center; gap: .7rem; }
.toggle input { width: 18px; min-height: 18px; accent-color: var(--gold); }
.alert, .toast { padding: .8rem 1rem; border: 1px solid rgba(255,64,87,.45); border-radius: 12px; background: rgba(255,64,87,.12); }
.toast {
    position: fixed;
    z-index: 50;
    top: 80px;
    right: 20px;
    width: min(420px, calc(100% - 40px));
    border-color: rgba(57,219,150,.45);
    background: #17352b;
    box-shadow: var(--shadow);
    animation: toast-out .4s 5s forwards;
}
.toast.error { border-color: rgba(255,64,87,.45); background: #3c1920; }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); pointer-events: none; } }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.login-card {
    width: min(470px, 100%);
    padding: clamp(2rem, 6vw, 4rem);
    border: 1px solid var(--line);
    border-radius: 30px;
    background: rgba(18,18,24,.92);
    box-shadow: 0 40px 120px rgba(0,0,0,.5);
}
.login-card h1 { margin: 0; color: #fff; font-size: clamp(3.3rem, 12vw, 5.7rem); font-weight: 950; }
.login-card h1 span { color: var(--gold); }
.login-copy { margin: 1.4rem 0 2rem; color: var(--muted); }
.secure-note { margin: 1.3rem 0 0; color: #747480; font-size: .72rem; text-align: center; text-transform: uppercase; letter-spacing: .12em; }

.host-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(340px, .85fr);
    gap: 1rem;
    width: min(1800px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0 4rem;
}
.host-stage { position: sticky; top: 84px; height: calc(100vh - 100px); min-height: 630px; padding: 1rem; }
.stage-toolbar { display: flex; min-height: 34px; align-items: center; gap: 1rem; color: var(--muted); font-size: .8rem; }
.stage-toolbar .text-link { margin-left: auto; }
.live-pill { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .78rem; font-weight: 760; }
.live-pill i { width: 8px; height: 8px; border-radius: 99px; background: #777; box-shadow: 0 0 0 4px rgba(255,255,255,.05); }
.live-pill.connected i { background: var(--green); box-shadow: 0 0 0 4px rgba(57,219,150,.12); }
.live-pill.reconnecting i { background: var(--gold-2); }
.mini-stage {
    display: grid;
    height: calc(100% - 162px);
    min-height: 410px;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #08080b;
}
.mini-stage .public-stage { min-height: 100%; }
.command-deck { display: grid; grid-template-columns: 1.4fr 1.4fr repeat(3, .7fr); gap: .6rem; margin-top: .8rem; }
.command {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    font-weight: 900;
}
.command kbd { font-size: 1.8rem; }
.command.advance { color: #101009; background: var(--gold); }
.command.reveal { color: #fff; background: #5534e8; }
.soft-button {
    border: 1px solid var(--line);
    border-radius: 13px;
    color: #ddd;
    background: #202029;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 760;
}
.next-action { margin: .55rem 0 0; color: var(--muted); font-size: .78rem; text-align: center; }
.host-sidebar { display: grid; gap: 1rem; align-content: start; }
.host-sidebar .panel { padding: 1.2rem; }
.answer-card { border-color: rgba(255,211,41,.32); }
.answer-card h2 { color: var(--gold); font-size: clamp(1.4rem, 2.5vw, 2.2rem); }
.answer-options { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin-top: 1rem; }
.answer-options span { padding: .55rem; border-radius: 8px; background: #0d0d12; font-size: .82rem; }
.answer-options .correct { color: #07180f; background: var(--green); font-weight: 800; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; }
.team-score-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: .42rem;
    align-items: center;
    padding: .62rem 0;
    border-top: 1px solid var(--line);
}
.team-score-row:first-child { border-top: 0; }
.team-name { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.team-name small { display: block; color: var(--muted); font-weight: 600; }
.team-name input {
    min-height: 30px;
    padding: .15rem .35rem;
    border-color: transparent;
    background: transparent;
    font-weight: 800;
}
.team-name input:focus { border-color: var(--gold); background: #0d0d12; }
.score-button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-weight: 950;
}
.score-button.correct { color: #06170f; background: var(--green); }
.score-button.incorrect { color: #fff; background: rgba(255,64,87,.78); }
.manual-score { width: 70px; min-height: 38px; padding: .35rem; text-align: center; }
.event-list { display: grid; gap: .45rem; }
.event {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .6rem;
    color: var(--muted);
    font-size: .76rem;
}
.event .tag { align-self: start; }
.sound-buttons { display: flex; flex-wrap: wrap; gap: .45rem; }
.sound-buttons button { padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 8px; color: #ddd; background: #24242e; cursor: pointer; }

.display-stage { position: relative; width: 100vw; min-height: 100vh; overflow: hidden; background: #070709; }
.display-status { position: fixed; z-index: 10; top: 1.2rem; right: 1.2rem; opacity: .75; }
.public-stage {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 6rem);
    text-align: center;
}
.public-stage::before {
    position: absolute;
    width: min(70vw, 900px);
    aspect-ratio: 1;
    border: 1px solid rgba(255,211,41,.08);
    border-radius: 50%;
    box-shadow: 0 0 160px rgba(255,211,41,.05), inset 0 0 160px rgba(255,211,41,.04);
    content: "";
}
.stage-content { position: relative; z-index: 1; width: min(1500px, 94vw); }
.brand-lockup { position: relative; z-index: 1; }
.brand-lockup h1 {
    margin: 0;
    color: white;
    font-size: clamp(5rem, 15vw, 14rem);
    font-weight: 950;
    letter-spacing: -.085em;
}
.brand-lockup h1 span { color: var(--gold); }
.brand-lockup > p:last-child { color: var(--muted); font-size: clamp(1.2rem, 2.6vw, 2.6rem); letter-spacing: .15em; text-transform: uppercase; }
.stage-kicker { color: var(--gold); font-size: clamp(.85rem, 1.4vw, 1.25rem); font-weight: 850; letter-spacing: .18em; text-transform: uppercase; }
.stage-title { margin: .2em auto; font-size: clamp(3.4rem, 8.7vw, 8.8rem); font-weight: 950; line-height: .98; text-wrap: balance; }
.question-text { margin: 0 auto 1em; font-size: clamp(2.1rem, 4.7vw, 5.2rem); font-weight: 820; line-height: 1.08; text-wrap: balance; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(.65rem, 1.5vw, 1.4rem); width: min(1450px, 94vw); margin: 2rem auto 0; text-align: left; }
.choice {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .8em;
    align-items: center;
    min-height: clamp(72px, 9vh, 116px);
    padding: .65em .8em;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255,255,255,.055);
    font-size: clamp(1.4rem, 2.5vw, 2.8rem);
    font-weight: 720;
    transition: .35s ease;
}
.choice b { color: var(--gold); }
.choice.eliminated { opacity: .18; transform: scale(.97); filter: grayscale(1); }
.choice.correct { border-color: var(--green); color: #fff; background: rgba(57,219,150,.19); box-shadow: 0 0 60px rgba(57,219,150,.12); }
.choice.correct b { color: var(--green); }
.timer {
    position: fixed;
    z-index: 4;
    top: clamp(1rem, 3vw, 3rem);
    left: clamp(1rem, 3vw, 3rem);
    display: grid;
    width: clamp(76px, 9vw, 138px);
    aspect-ratio: 1;
    place-items: center;
    border: 2px solid var(--gold);
    border-radius: 50%;
    color: var(--gold);
    background: #0b0b0e;
    box-shadow: 0 0 50px rgba(255,211,41,.12);
    font-size: clamp(2.2rem, 5vw, 5.2rem);
    font-weight: 950;
}
.timer.urgent { border-color: var(--red); color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); box-shadow: 0 0 60px rgba(255,64,87,.28); } }
.phones-icon { margin-bottom: .25em; color: var(--red); font-size: clamp(4rem, 10vw, 10rem); }
.no-phones .stage-title { color: var(--gold); }
.standby-line { color: var(--muted); font-size: clamp(1.2rem, 2vw, 2rem); }
.category-board { display: grid; gap: 1rem; width: min(1200px, 90vw); margin: 2rem auto 0; }
.category-row { display: grid; grid-template-columns: 160px 1fr 180px; align-items: center; padding: .7rem 1rem; border-bottom: 1px solid var(--line); text-align: left; }
.category-row b { color: #777; font-size: clamp(1.8rem, 4vw, 4rem); }
.category-row strong { color: white; font-size: clamp(1.8rem, 4vw, 4rem); }
.category-row span { color: var(--gold); font-size: clamp(1rem, 1.7vw, 1.6rem); text-align: right; }
.leaderboard { display: grid; gap: .45rem; width: min(1200px, 92vw); margin: 1.5rem auto 0; }
.leaderboard-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; padding: .5rem 1rem; border-bottom: 1px solid var(--line); font-size: clamp(1.35rem, 2.5vw, 2.7rem); }
.leaderboard-row b { color: var(--gold); text-align: left; }
.leaderboard-row strong { overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-row span { font-variant-numeric: tabular-nums; font-weight: 900; }
.leaderboard-row.tied { background: rgba(255,211,41,.07); }
.answer-banner { margin-top: 1rem; color: var(--green); font-size: clamp(2.2rem, 5vw, 5.5rem); font-weight: 950; }
.bonus-media { display: block; width: auto; max-width: min(90vw, 1500px); max-height: 55vh; margin: 1.3rem auto; border-radius: 18px; box-shadow: var(--shadow); }
.big-bitch .stage-title { color: var(--red); text-transform: uppercase; }
.big-bitch .wager { color: #fff; font-size: clamp(2rem, 4vw, 4rem); }
.winner-name { color: var(--gold); font-size: clamp(4rem, 11vw, 11rem); font-weight: 950; line-height: .9; }
.paused-screen { opacity: .82; }

.setup-grid, .split-admin, .settings-grid, .history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.setup-grid > .panel, .split-admin > .panel, .settings-grid > .panel, .hero-panel { padding: clamp(1.2rem, 3vw, 2.5rem); }
.team-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.team-inputs label { grid-template-columns: 68px 1fr; align-items: center; }
.category-picker { display: grid; gap: .5rem; margin: 1rem 0 1.5rem; }
.category-option {
    display: block;
    cursor: pointer;
}
.category-option input { position: absolute; opacity: 0; pointer-events: none; }
.category-option > span {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: .8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #0e0e13;
}
.category-option small { grid-column: 1; color: var(--muted); font-weight: 500; }
.category-option input:checked + span { border-color: var(--gold); background: rgba(255,211,41,.09); }
.category-overrides { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.category-override { display: grid; grid-template-columns: 45px minmax(180px, 1fr) auto auto; gap: .65rem; align-items: center; margin-top: .55rem; }
.category-override .toggle { min-width: 145px; }
.table-panel { overflow: auto; padding: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; }
td { font-size: .85rem; }
td small { display: block; margin-top: .25rem; color: var(--muted); }
.tag { display: inline-block; padding: .2rem .42rem; border-radius: 6px; color: #bbb; background: #2b2b35; font-size: .62rem; font-weight: 850; text-transform: uppercase; }
.tag.active { color: #072317; background: var(--green); }
.tag.cooldown, .tag.warning { color: #211500; background: var(--gold); }
.tag.disabled { color: #fff; background: #73313b; }
.search { display: flex; gap: .4rem; }
.search input { width: min(340px, 55vw); }
.search button { border: 1px solid var(--line); border-radius: 10px; color: #fff; background: #252530; }
.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.history-card { padding: 1.25rem; transition: .2s ease; }
.history-card:hover { border-color: rgba(255,211,41,.45); transform: translateY(-2px); }
.history-card h2 { margin: 1rem 0 .25rem; }
.history-card p { margin: 0; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.metrics div { padding: 1rem; border-radius: 11px; background: #0d0d12; }
.metrics dt { color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.metrics dd { margin: .2rem 0 0; color: var(--gold); font-size: 2rem; font-weight: 900; }
.health-ok { color: var(--green); }
.import-report { grid-column: 1 / -1; }
.import-report pre { max-height: 520px; overflow: auto; padding: 1rem; border-radius: 10px; background: #09090d; color: #b8d7c9; font-size: .76rem; }
.empty-state { display: grid; min-height: 45vh; place-items: center; align-content: center; padding: 2rem; text-align: center; }

.chit { width: min(850px, calc(100% - 2rem)); margin: 2rem auto; padding: 2rem; color: #111; background: #fff; font-family: Arial, sans-serif; }
.chit header { border-bottom: 3px solid #111; }
.chit header p { font-weight: 800; letter-spacing: .1em; }
.chit h1 { font-size: 2.4rem; }
.chit-question { font-size: 1.6rem; font-weight: 700; }
.chit-choices { font-size: 1.25rem; line-height: 1.8; }
.private-chit { margin-top: 2rem; padding: 1.3rem; border: 5px solid #111; text-align: center; }
.private-chit p:first-child, .private-chit p:last-child { font-weight: 950; letter-spacing: .08em; }
.print-actions { display: flex; gap: 1rem; margin-top: 1rem; }
.print-actions button, .print-actions a { padding: .6rem 1rem; border: 1px solid #111; color: #111; background: white; }

@media (max-width: 1050px) {
    .host-grid { grid-template-columns: 1fr; }
    .host-stage { position: relative; top: 0; height: 720px; }
    .host-sidebar { grid-template-columns: 1fr 1fr; }
    .answer-card { grid-column: 1 / -1; }
    .split-admin { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .app-header { gap: .5rem; padding: 0 .7rem; }
    .header-brand span { display: none; }
    .app-header form { display: none; }
    .page-shell { width: min(100% - 1rem, 1500px); }
    .setup-grid, .settings-grid, .history-grid { grid-template-columns: 1fr; }
    .team-inputs, .host-sidebar { grid-template-columns: 1fr; }
    .command-deck { grid-template-columns: 1fr 1fr 1fr; }
    .command { grid-row: 1; }
    .soft-button { min-height: 44px; }
    .choices { grid-template-columns: 1fr; }
    .category-row { grid-template-columns: 65px 1fr; }
    .category-row span { display: none; }
    .host-stage { min-height: 580px; height: calc(100vh - 85px); }
}
@media print {
    body { min-height: auto; background: white; }
    .print-actions { display: none; }
    .chit { width: 100%; margin: 0; padding: .25in; }
}
