/* ==========================================================================
   Samanvaya Engage — design system

   Deliberately one hand-written stylesheet with no build step. The app has to
   run on a stock XAMPP install and deploy to shared hosting by copying a
   folder; adding Node and Vite to that story would buy nothing a professor
   can see.

   Two surfaces, two moods:
     · the console  — dark, dense, built for a laptop at the lectern
     · the audience — light, huge tap targets, built for a phone held at arm's
                      length in a room where the lights are off
   ========================================================================== */

:root {
    --ink: #0b1020;
    --ink-2: #131a30;
    --ink-3: #1c2540;
    --line: #2a3454;
    --text: #eef2ff;
    --muted: #94a3c4;
    --dim: #64748b;

    --brand: #6d5efc;
    --brand-2: #8b7dff;
    --electric: #ffc53d;
    --good: #35d07f;
    --warn: #ff9f43;
    --bad: #ff5f6d;
    --info: #38bdf8;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
    --sans: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

body.console {
    background:
        radial-gradient(1100px 500px at 12% -8%, rgba(109, 94, 252, 0.20), transparent 60%),
        radial-gradient(900px 420px at 105% 5%, rgba(56, 189, 248, 0.12), transparent 55%),
        var(--ink);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ shell */

.topbar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.85rem 1.5rem;
    background: rgba(11, 16, 32, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand .spark { font-size: 1.2rem; }
.brand small {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.nav { display: flex; gap: 0.35rem; margin-left: 1rem; flex-wrap: wrap; }
.nav a {
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}
.nav a:hover { background: var(--ink-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }

.topbar .spacer { margin-left: auto; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--info));
    color: #fff; font-weight: 700; font-size: 0.85rem;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.wrap.wide { max-width: 1600px; }

/* ------------------------------------------------------------- typography */

h1 { font-size: 1.65rem; margin: 0 0 0.35rem; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.lede { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.95rem; }
.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head .spacer { margin-left: auto; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.tiny { font-size: 0.78rem; }
.mono { font-family: var(--mono); }
.center { text-align: center; }

/* ------------------------------------------------------------------ cards */

.card {
    background: linear-gradient(180deg, var(--ink-2), rgba(19, 26, 48, 0.7));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card h2 { display: flex; align-items: center; gap: 0.5rem; }
.card-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.card-head .spacer { margin-left: auto; }
.card-head h2 { margin: 0; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.console-split { grid-template-columns: minmax(0, 2.1fr) minmax(320px, 1fr); align-items: start; }

@media (max-width: 1100px) {
    .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.console-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
}

/* -------------------------------------------------------------- stat tiles */

.stat {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}
.stat .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--dim);
    font-weight: 600;
}
.stat .value {
    font-size: 1.9rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-top: 0.2rem;
    line-height: 1.1;
}
.stat .value small { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.stat .foot { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }

/* ----------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.05rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--ink-3);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
    text-decoration: none;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary { background: var(--brand); border-color: transparent; color: #fff; }
.btn.good { background: var(--good); border-color: transparent; color: #04220f; }
.btn.danger { background: transparent; border-color: rgba(255, 95, 109, 0.5); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn.lg { padding: 0.85rem 1.5rem; font-size: 1rem; }
.btn.block { width: 100%; }

/* The one button the whole product is named after. */
.btn.electrify {
    background: linear-gradient(135deg, var(--electric), #ff8a3d);
    border: none;
    color: #2a1a00;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 0 0 0 rgba(255, 197, 61, 0.6);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 197, 61, 0.55); }
    70%  { box-shadow: 0 0 0 16px rgba(255, 197, 61, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 197, 61, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .btn.electrify { animation: none; }
}

.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------------ forms */

label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.3rem; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], select, textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--ink);
    color: var(--text);
    font-size: 0.92rem;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: transparent;
}
textarea { resize: vertical; min-height: 80px; }
.field { margin-bottom: 0.9rem; }
.field-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 180px; }

.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--text); font-weight: 500; }
.check input { width: auto; }

.error { color: var(--bad); font-size: 0.8rem; margin-top: 0.25rem; }

/* ----------------------------------------------------------------- alerts */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}
.alert.ok { background: rgba(53, 208, 127, 0.12); border-color: rgba(53, 208, 127, 0.35); color: #9df0c4; }
.alert.bad { background: rgba(255, 95, 109, 0.12); border-color: rgba(255, 95, 109, 0.35); color: #ffb3ba; }
.alert.info { background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.3); color: #b3e6ff; }

/* ------------------------------------------------------------------ pills */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--ink-3);
    color: var(--muted);
    border: 1px solid var(--line);
}
.pill.live { background: rgba(53, 208, 127, 0.15); color: var(--good); border-color: rgba(53, 208, 127, 0.4); }
.pill.paused { background: rgba(255, 159, 67, 0.15); color: var(--warn); border-color: rgba(255, 159, 67, 0.4); }
.pill.ended { background: var(--ink-3); color: var(--dim); }
.pill.scheduled { background: rgba(56, 189, 248, 0.12); color: var(--info); border-color: rgba(56, 189, 248, 0.35); }
.pill.ai { background: rgba(109, 94, 252, 0.18); color: var(--brand-2); border-color: rgba(109, 94, 252, 0.4); }
.pill.electrify { background: rgba(255, 197, 61, 0.16); color: var(--electric); border-color: rgba(255, 197, 61, 0.4); }
.pill.easy { color: var(--good); }
.pill.medium { color: var(--warn); }
.pill.hard { color: var(--bad); }

.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--good);
    box-shadow: 0 0 0 0 rgba(53, 208, 127, 0.7);
    animation: pulse-dot 1.8s infinite;
}
@keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(53, 208, 127, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(53, 208, 127, 0); }
    100% { box-shadow: 0 0 0 0 rgba(53, 208, 127, 0); }
}

/* ------------------------------------------------------------------ table */

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--dim);
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}
td { padding: 0.65rem 0.6rem; border-bottom: 1px solid rgba(42, 52, 84, 0.5); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(28, 37, 64, 0.4); }

/* ------------------------------------------------------------------- bars */

.bar-row { margin-bottom: 0.7rem; }
.bar-label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.88rem; margin-bottom: 0.3rem;
}
.bar-label .spacer { margin-left: auto; }
.bar-label .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track {
    height: 26px;
    background: var(--ink);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid var(--line);
}
.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    border-radius: 6px 0 0 6px;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 2px;
}
.bar-fill.correct { background: linear-gradient(90deg, var(--good), #6ee7a8); }
.bar-fill.wrong { background: linear-gradient(90deg, #4b5675, #5c6788); }
.letter {
    display: inline-grid; place-items: center;
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--ink-3); color: var(--muted);
    font-size: 0.72rem; font-weight: 800;
    flex-shrink: 0;
}

/* -------------------------------------------------------------- word cloud */

.cloud { display: flex; flex-wrap: wrap; gap: 0.4rem 0.85rem; align-items: baseline; padding: 0.5rem 0; }
.cloud span { color: var(--brand-2); font-weight: 700; line-height: 1.25; }

/* -------------------------------------------------------------- responses */

.response-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 340px; overflow-y: auto; }
.response {
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-size: 0.88rem;
}
.response .who { font-size: 0.72rem; color: var(--dim); margin-bottom: 0.15rem; }

/* ------------------------------------------------------------ leaderboard */

.leader {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.leader + .leader { margin-top: 0.2rem; }
.leader.you { background: rgba(109, 94, 252, 0.16); outline: 1px solid rgba(109, 94, 252, 0.4); }
.leader .rank {
    width: 26px; height: 26px; border-radius: 8px;
    display: grid; place-items: center;
    background: var(--ink-3); font-weight: 800; font-size: 0.78rem; color: var(--muted);
    flex-shrink: 0;
}
.leader:nth-child(1) .rank { background: linear-gradient(135deg, #ffd76e, #f0a500); color: #3a2600; }
.leader:nth-child(2) .rank { background: linear-gradient(135deg, #dde3ee, #a9b4c7); color: #24303f; }
.leader:nth-child(3) .rank { background: linear-gradient(135deg, #e5a06a, #c07430); color: #33190a; }
.leader .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader .score { font-weight: 700; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- timeline */

.timeline { border-left: 2px solid var(--line); padding-left: 1rem; margin-left: 0.5rem; }
.timeline .moment { position: relative; padding-bottom: 0.9rem; font-size: 0.88rem; }
.timeline .moment::before {
    content: ''; position: absolute; left: -1.32rem; top: 0.4rem;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--brand); border: 2px solid var(--ink);
}
.timeline .at { font-family: var(--mono); font-size: 0.78rem; color: var(--dim); margin-right: 0.5rem; }

/* --------------------------------------------------------------- sparkline */

.spark-chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.spark-chart .col {
    flex: 1;
    background: linear-gradient(180deg, var(--brand-2), var(--brand));
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    position: relative;
}
.spark-chart .col:hover { filter: brightness(1.3); }

/* ------------------------------------------------------- activity queue */

.queue { display: flex; flex-direction: column; gap: 0.55rem; }
.queue-item {
    display: flex; align-items: center; gap: 0.75rem;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
}
.queue-item.is-live { border-color: rgba(53, 208, 127, 0.5); background: rgba(53, 208, 127, 0.07); }
.queue-item.is-closed { opacity: 0.62; }
.queue-item .icon { font-size: 1.25rem; flex-shrink: 0; }
.queue-item .body { flex: 1; min-width: 0; }
.queue-item .q { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.15rem; }
.queue-item .meta { font-size: 0.74rem; color: var(--dim); display: flex; gap: 0.6rem; flex-wrap: wrap; }

/* -------------------------------------------------------- recommendations */

.rec {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--ink-2);
}
.rec + .rec { margin-top: 0.75rem; }
.rec.rejected { opacity: 0.5; }
.rec.accepted { border-color: rgba(53, 208, 127, 0.4); }
.rec-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.rec-head .spacer { margin-left: auto; }
.rec .question { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.rec .why {
    font-size: 0.85rem;
    color: var(--muted);
    border-left: 3px solid var(--brand);
    padding-left: 0.75rem;
    margin: 0.6rem 0;
    line-height: 1.5;
}
.rec .options { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.rec .option {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    background: var(--ink);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
}
.rec .option.correct { border-color: rgba(53, 208, 127, 0.5); color: var(--good); }

details.editor { margin-top: 0.75rem; }
details.editor summary { cursor: pointer; font-size: 0.82rem; color: var(--muted); font-weight: 600; }
details.editor[open] summary { margin-bottom: 0.75rem; }

/* ------------------------------------------------------------- empty state */

.empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted);
}
.empty .glyph { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.7; }
.empty h3 { color: var(--text); font-size: 1.05rem; }

/* =========================================================================
   AUDIENCE — the phone
   ========================================================================= */

body.audience {
    background: linear-gradient(170deg, #f6f7fc 0%, #eef0f9 100%);
    color: #131a30;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.aud-bar {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e2e6f2;
    position: sticky; top: 0; z-index: 20;
}
.aud-bar .title { font-weight: 700; font-size: 0.95rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-bar .score {
    background: var(--brand); color: #fff;
    padding: 0.25rem 0.7rem; border-radius: 999px;
    font-size: 0.85rem; font-weight: 800; font-variant-numeric: tabular-nums;
}

.aud-main { flex: 1; padding: 1rem; max-width: 620px; margin: 0 auto; width: 100%; }

.aud-card {
    background: #fff;
    border: 1px solid #e2e6f2;
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 6px 24px rgba(20, 30, 70, 0.07);
}
.aud-card + .aud-card { margin-top: 0.9rem; }

.aud-question { font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin-bottom: 1rem; letter-spacing: -0.01em; }
.aud-kicker {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--brand); margin-bottom: 0.6rem;
}

/* Tap targets sized for a phone held at arm's length in a dark room. */
.choice {
    display: flex; align-items: center; gap: 0.85rem;
    width: 100%;
    padding: 1.05rem 1rem;
    margin-bottom: 0.65rem;
    border-radius: 14px;
    border: 2px solid #e2e6f2;
    background: #fff;
    color: #131a30;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}
.choice:active { transform: scale(0.985); }
.choice .key {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
    background: #eef0f9; color: #5b6480;
    font-weight: 800; font-size: 0.95rem; flex-shrink: 0;
}
.choice.selected { border-color: var(--brand); background: rgba(109, 94, 252, 0.07); }
.choice.selected .key { background: var(--brand); color: #fff; }
.choice.correct { border-color: var(--good); background: rgba(53, 208, 127, 0.1); }
.choice.correct .key { background: var(--good); color: #04220f; }
.choice.incorrect { border-color: var(--bad); background: rgba(255, 95, 109, 0.08); }
.choice:disabled { cursor: default; opacity: 0.95; }

.aud-input {
    width: 100%;
    padding: 1rem;
    border-radius: 14px;
    border: 2px solid #e2e6f2;
    font-size: 1.1rem;
    font-family: inherit;
    background: #fff;
    color: #131a30;
}
.aud-input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }

.aud-btn {
    width: 100%;
    padding: 1.05rem;
    border-radius: 14px;
    border: none;
    background: var(--brand);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
}
.aud-btn:disabled { background: #c3c8dc; cursor: not-allowed; }
.aud-btn.ghost { background: #eef0f9; color: #4a5474; }

.scale { display: flex; gap: 0.5rem; }
.scale button {
    flex: 1;
    aspect-ratio: 1;
    border-radius: 14px;
    border: 2px solid #e2e6f2;
    background: #fff;
    font-size: 1.25rem;
    font-weight: 800;
    font-family: inherit;
    color: #131a30;
    cursor: pointer;
}
.scale button.selected { border-color: var(--brand); background: var(--brand); color: #fff; }

.aud-bar-row { margin-bottom: 0.7rem; }
.aud-bar-track { height: 30px; background: #eef0f9; border-radius: 8px; overflow: hidden; }
.aud-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.aud-bar-fill.correct { background: linear-gradient(90deg, var(--good), #6ee7a8); }

.aud-waiting { text-align: center; padding: 3.5rem 1rem; }
.aud-waiting .glyph { font-size: 3rem; margin-bottom: 0.75rem; }
.aud-waiting h2 { font-size: 1.25rem; margin-bottom: 0.35rem; }
.aud-waiting p { color: #5b6480; margin: 0; }

.pulse-ring {
    width: 56px; height: 56px; border-radius: 50%;
    margin: 0 auto 1.25rem;
    background: var(--brand);
    opacity: 0.85;
    animation: ring 1.8s ease-out infinite;
}
@keyframes ring {
    0% { transform: scale(0.7); opacity: 0.85; }
    100% { transform: scale(1.5); opacity: 0; }
}

.aud-leader { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0.5rem; border-radius: 10px; font-size: 0.95rem; }
.aud-leader.you { background: rgba(109, 94, 252, 0.1); font-weight: 700; }
.aud-leader .rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #eef0f9; font-size: 0.78rem; font-weight: 800; color: #5b6480; }
.aud-leader .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-leader .score { font-variant-numeric: tabular-nums; font-weight: 700; }

.qna-item { padding: 0.75rem 0; border-bottom: 1px solid #eef0f9; display: flex; gap: 0.75rem; align-items: flex-start; }
.qna-item:last-child { border-bottom: none; }
.qna-item .vote {
    display: flex; flex-direction: column; align-items: center;
    min-width: 44px; padding: 0.3rem;
    border-radius: 10px; border: 1px solid #e2e6f2;
    background: #fff; cursor: pointer; font-family: inherit;
}
.qna-item .vote.voted { border-color: var(--brand); background: rgba(109, 94, 252, 0.08); color: var(--brand); }
.qna-item .vote .n { font-weight: 800; font-size: 0.9rem; }
.qna-item .text { flex: 1; font-size: 0.95rem; line-height: 1.45; }
.qna-item .who { font-size: 0.75rem; color: #7b849e; margin-top: 0.2rem; }

.toast {
    position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
    background: #131a30; color: #fff;
    padding: 0.8rem 1.4rem; border-radius: 999px;
    font-weight: 700; font-size: 0.95rem;
    box-shadow: 0 10px 30px rgba(10, 20, 50, 0.3);
    z-index: 100;
    animation: rise 0.3s ease;
}
@keyframes rise {
    from { transform: translate(-50%, 14px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.timer-bar { height: 5px; background: #eef0f9; border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.timer-fill { height: 100%; background: var(--brand); transition: width 1s linear; }
.timer-fill.urgent { background: var(--bad); }

/* =========================================================================
   PROJECTOR — read from the back row
   ========================================================================= */

body.projector {
    background: var(--ink);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.proj-head {
    display: flex; align-items: center; gap: 2rem;
    padding: 1.5rem 2.5rem;
    border-bottom: 1px solid var(--line);
}
.proj-head .spacer { margin-left: auto; }
.proj-code {
    font-family: var(--mono);
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    color: var(--electric);
    line-height: 1;
}
.proj-body { flex: 1; padding: 2rem 3rem; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.proj-question { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 2rem; }
.proj-bar-row { margin-bottom: 1.1rem; }
.proj-bar-label { display: flex; align-items: center; gap: 0.75rem; font-size: 1.4rem; font-weight: 600; margin-bottom: 0.4rem; }
.proj-bar-label .spacer { margin-left: auto; }
.proj-bar-track { height: 48px; background: var(--ink-2); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.proj-bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.proj-bar-fill.correct { background: linear-gradient(90deg, var(--good), #6ee7a8); }
.proj-qr { background: #fff; padding: 1rem; border-radius: 18px; line-height: 0; }
.proj-qr svg { display: block; }
.proj-join { display: flex; align-items: center; justify-content: center; gap: 4rem; flex: 1; }
.proj-cloud { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; align-items: baseline; justify-content: center; }
.proj-cloud span { color: var(--brand-2); font-weight: 800; }
.proj-count { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- utilities */

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.row .spacer { margin-left: auto; }
.hide { display: none !important; }
.scroll { max-height: 420px; overflow-y: auto; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.code-badge {
    font-family: var(--mono);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--electric);
}

.qr-frame { background: #fff; padding: 0.75rem; border-radius: 12px; line-height: 0; display: inline-block; }
.qr-frame svg { display: block; width: 100%; height: auto; }
