@import url('willow-scrollbar.css');
:root {
    --wg-navy: #001A72;
    --wg-gold: #c9a24d;
    --wg-ink: #f8fafc;
    --wg-muted: #cbd5e1;
    --wg-faint: #94a3b8;
    --wg-red: #dc2626;
    --wg-page: #0b1230;
    --wg-host-page: #07101f;
    --wg-bar-bg: rgba(7, 16, 31, 0.94);
    --wg-panel-a: rgba(20, 42, 112, 0.96);
    --wg-panel-b: #101a42;
    --wg-line: rgba(255, 215, 0, 0.32);
    --wg-chip: #1a3a7a;
    --wg-chip-ink: #fff;
    --wg-name-bg: rgba(6, 14, 42, 0.55);
    --wg-name-ink: #e2e8f0;
    --wg-track: rgba(255, 255, 255, 0.14);
    --wg-soft: rgba(255, 255, 255, 0.05);
    --wg-seat: rgba(255, 255, 255, 0.05);
    --wg-meta: #93c5fd;
    --wg-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
html[data-wg-theme="light"] {
    color-scheme: light;
    --wg-gold: #a67c00;
    --wg-ink: #0b1220;
    --wg-muted: #334155;
    --wg-faint: #475569;
    --wg-page: #f6f1e4;
    --wg-host-page: #f7f4ec;
    --wg-bar-bg: #001A72;
    --wg-panel-a: #fffdf8;
    --wg-panel-b: #fffdf8;
    --wg-line: rgba(0, 26, 114, 0.28);
    --wg-chip: #ffffff;
    --wg-chip-ink: #0b1220;
    --wg-name-bg: #001A72;
    --wg-name-ink: #ffffff;
    --wg-track: #e4dcc8;
    --wg-soft: #fff8e6;
    --wg-seat: #ffffff;
    --wg-meta: #1e3a8a;
    --wg-shadow: 0 12px 28px rgba(0, 26, 114, 0.1);
}
:root, html[data-wg-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
.wg-play-page, .wg-host-page {
    margin: 0;
    min-height: 100dvh;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--wg-ink);
}
.wg-play-page {
    background: radial-gradient(ellipse at top, rgba(255, 215, 0, 0.16), transparent 42%), var(--wg-page);
}
.wg-host-page {
    background: radial-gradient(ellipse at top, rgba(255, 215, 0, 0.12), transparent 38%), var(--wg-host-page);
}
.wg-host-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--wg-bar-bg);
    color: #fff;
    border-bottom: 1px solid rgba(255, 215, 0, 0.28);
}
.wg-host-brand, .wg-kicker {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--wg-gold);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.75rem;
}
.wg-host-brand { text-decoration: none; }
.wg-host-brand img, .wg-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    object-fit: cover;
    box-shadow: 0 0 0 2px var(--wg-gold);
}
.wg-mark { width: 1.7rem; height: 1.7rem; }
.wg-host-title, .wg-host-bar h1 { margin: 0; font-size: 1.05rem; text-align: center; flex: 1; min-width: 0; }
.wg-host-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.wg-host-btn, .wg-join-form button, .wg-stop, .wg-rename-card button {
    border: 0;
    border-radius: 0.8rem;
    padding: 0.65rem 0.9rem;
    font-weight: 800;
    cursor: pointer;
}
.wg-host-btn { background: #132048; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.18); }
.wg-stop-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 13.5rem;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
}
.wg-stop-toggle input { width: 1.05rem; height: 1.05rem; accent-color: #FFD700; flex: 0 0 auto; }
.wg-rounds-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
}
.wg-rounds-edit input {
    width: 3.4rem;
    border: 0;
    border-radius: 0.55rem;
    padding: 0.35rem 0.3rem;
    font-weight: 800;
    text-align: center;
    background: #fff;
    color: #001A72;
}
.wg-host-btn-start { background: var(--wg-gold); color: var(--wg-navy); box-shadow: none; }
.wg-host-btn-end { background: transparent; color: #fecaca; box-shadow: inset 0 0 0 1px #7f1d1d; }
.wg-host-btn-standby.is-on { background: #f59e0b; color: #1c1403; box-shadow: none; }
.wg-board {
    display: grid;
    grid-template-columns: minmax(20rem, 34rem) minmax(0, 1fr);
    gap: 0.9rem;
    width: min(100% - 1rem, 92rem);
    margin: 0.8rem auto 1rem;
    min-height: calc(100dvh - 5.4rem);
    align-items: stretch;
}
.wg-rail, .wg-stage, .wg-sheet, .wg-join-card {
    background: linear-gradient(180deg, var(--wg-panel-a), var(--wg-panel-b));
    border: 1px solid var(--wg-line);
    border-radius: 1.25rem;
    box-shadow: var(--wg-shadow);
}
.wg-rail, .wg-stage { padding: 1.05rem 1.15rem 1.2rem; }
.wg-stage { display: flex; flex-direction: column; }
.wg-rail-kicker { margin: 0; color: var(--wg-gold); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.85rem; }
.wg-rail-hint { margin: 0.25rem 0 0.8rem; color: var(--wg-faint); font-size: 0.92rem; line-height: 1.35; }
.wg-seats, .wg-cats, .wg-rank, .wg-rest, .wg-podium, .wg-judge ul { list-style: none; padding: 0; margin: 0; }
.wg-seats { display: grid; gap: 0.75rem; align-content: start; }
.wg-host-page [data-player] { cursor: context-menu; }
.wg-seat {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.7rem;
    align-items: center;
    padding: 0.55rem 0.85rem;
    border-radius: 0.95rem;
    background: var(--wg-seat);
    border: 1px solid var(--wg-line);
    animation: wg-rise 0.35s ease both;
}
.wg-seat.is-empty { display: block; color: var(--wg-faint); animation: none; }
.wg-avatar {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--wg-navy);
    color: var(--wg-gold);
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.45);
}
.wg-seat-copy { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.05rem; }
.wg-rank strong, .wg-chip strong, .wg-vote strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-seat-name {
    display: block;
    font-size: 1.02rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.wg-seat-meta { display: block; margin: 0; color: var(--wg-meta); font-style: normal; font-size: 0.78rem; font-weight: 700; line-height: 1.15; }
.wg-seat-meta[hidden] { display: none; }
.wg-seat strong, .wg-rank em, .wg-rest em { color: var(--wg-gold); font-style: normal; font-weight: 800; }
.wg-seat strong { font-size: 1.2rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wg-board-head, .wg-lobby, .wg-top { text-align: center; }
.wg-round-row, .wg-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin: 0 auto 0.15rem;
}
.wg-brand { margin-bottom: 0.45rem; color: var(--wg-gold); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.72rem; }
.wg-round {
    display: inline-flex;
    margin: 0;
    padding: 0.28rem 0.75rem;
    border-radius: 999px;
    background: var(--wg-navy);
    color: var(--wg-gold);
    border: 1px solid rgba(255, 215, 0, 0.45);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 800;
}
.wg-letter {
    width: 6.4rem;
    height: 6.4rem;
    margin: 0.45rem auto 0.15rem;
    border-radius: 1.35rem;
    display: grid;
    place-items: center;
    background: var(--wg-navy);
    color: var(--wg-gold);
    font-size: 3.4rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 0 4px var(--wg-gold), 0 12px 28px rgba(255, 215, 0, 0.22);
}
.wg-letter.is-roulette { animation: wg-flicker 0.12s linear infinite; }
.wg-letter.is-set { animation: wg-slam 0.45s cubic-bezier(.2, 1.4, .4, 1); }
.wg-field, .wg-answer-card, .wg-rank li, .wg-podium li { animation: wg-rise 0.4s ease both; }
.wg-you.is-score { animation: wg-score-pop 0.55s ease; }
.wg-plus {
    display: inline-block;
    margin-left: 0.35rem;
    color: var(--wg-gold);
    font-weight: 900;
    animation: wg-float 0.7s ease both;
}
.wg-stop:active { transform: scale(0.96); }
@keyframes wg-score-pop { 40% { transform: scale(1.16); } }
@keyframes wg-float { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wg-phase, .wg-note, .wg-hint, .wg-you { color: var(--wg-muted); }
.wg-phase { text-align: center; font-weight: 800; letter-spacing: 0.04em; margin: 0.2rem 0 0.15rem; font-size: 1.15rem; }
.wg-note, .wg-hint { text-align: center; font-size: 0.9rem; }
.wg-url {
    color: var(--wg-ink, #f8fafc);
    text-align: center;
    font-weight: 800;
    margin: 0.45rem auto 0.35rem;
    max-width: 46rem;
    font-size: clamp(1.55rem, 3.6vw, 2.7rem);
    line-height: 1.25;
    overflow-wrap: break-word;
}
.wg-code {
    text-align: center;
    font-weight: 800;
    font-size: clamp(1.35rem, 3vw, 2.2rem);
    line-height: 1.2;
    margin: 0.15rem 0 0.85rem;
    color: var(--wg-gold);
    letter-spacing: 0.08em;
}
.wg-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; width: min(100%, 42rem); margin: 0.7rem auto 0.15rem; }
.wg-bar span { display: block; height: 0.95rem; border-radius: 999px; background: var(--wg-track); position: relative; overflow: hidden; }
.wg-bar span::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--p, 1) * 100%);
    background: var(--wg-gold);
    border-radius: inherit;
    transition: width 1s linear;
}
.wg-bar.is-warn span::before { background: #f59e0b; }
.wg-bar.is-hot span::before { background: var(--wg-red); }
.wg-bar em { font-style: normal; font-weight: 800; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; font-size: 1.55rem; line-height: 1; color: var(--wg-ink); }
.wg-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.55rem; }
.wg-cat-card, .wg-field {
    background: var(--wg-soft);
    border: 1px solid var(--wg-line);
    border-radius: 0.95rem;
    padding: 0.65rem 0.75rem 0.75rem;
    animation: wg-rise 0.4s ease both;
}
.wg-cat-card { display: grid; gap: 0.2rem; align-content: start; min-height: 5.2rem; }
.wg-cat-card strong { color: var(--wg-faint); font-weight: 700; font-size: 1.2rem; }
.wg-cat-card span, .wg-field span, .wg-judge h2 {
    display: inline-block;
    margin: 0 0 0.35rem;
    color: var(--wg-gold);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.wg-cats { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-top: 0.4rem; }
.wg-cats li {
    background: var(--wg-soft);
    border: 1px solid var(--wg-line);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    animation: wg-rise 0.4s ease both;
}
.wg-judge, .wg-rank, .wg-rest, .wg-cat-grid, .wg-board-head, .wg-top { width: min(100%, 56rem); margin-left: auto; margin-right: auto; }
.wg-judge { margin-top: 0.95rem; }
.wg-judge h2 { display: block; margin: 0 0 0.4rem 0.2rem; }
.wg-judge ul, .wg-rank, .wg-rest { display: grid; gap: 0.45rem; }
.wg-chip, .wg-vote, .wg-rank li, .wg-rest li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.95rem;
    padding: 0.65rem 1rem 0.65rem 0.7rem;
    background: var(--wg-chip);
    color: var(--wg-chip-ink);
    border: 1px solid var(--wg-line);
}
.wg-rank li, .wg-rest li { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0.8rem 1rem; border-radius: 999px; font-size: 1.12rem; }
.wg-vote { width: 100%; text-align: left; cursor: pointer; font: inherit; }
.wg-vote:disabled { cursor: default; }
.wg-chip span, .wg-vote span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.25rem;
    max-width: 11rem;
    padding: 0.38rem 0.75rem;
    border-radius: 999px;
    background: var(--wg-name-bg);
    color: var(--wg-name-ink);
    font-size: 0.82rem;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wg-chip strong, .wg-vote strong { text-align: right; font-size: 1.28rem; font-weight: 800; }
.wg-chip b { color: var(--wg-gold); font-variant-numeric: tabular-nums; }
.wg-chip.unique { border-color: var(--wg-gold); }
.wg-chip.shared { border-color: #93c5fd; }
.wg-chip.veto, .wg-chip.blank, .wg-chip.letter, .wg-chip.marked, .wg-vote.is-marked {
    background: #7f1d1d;
    border-color: var(--wg-red);
    color: #fff;
}
.wg-chip.veto strong, .wg-chip.blank strong, .wg-chip.letter strong, .wg-vote.is-marked strong { text-decoration: line-through; }
.wg-vote.is-mine { background: #1e293b; opacity: 0.85; }
.wg-rank li.is-me, .wg-rest li.is-me { box-shadow: inset 0 0 0 1px var(--wg-gold); }
.wg-place {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #0b1230;
    font-weight: 800;
    flex: 0 0 auto;
}
.wg-rank .place-1 .wg-place, .wg-podium .place-1 { background: linear-gradient(#FFD700, #b45309); color: #1c1403; }
.wg-rank .place-2 .wg-place { background: #e2e8f0; color: #1e293b; }
.wg-rank .place-3 .wg-place { background: #d97706; color: #fff; }
.wg-rank strong, .wg-rest strong { text-align: left; justify-self: start; }
.wg-chip strong, .wg-vote strong { text-align: right; justify-self: end; }
.wg-chip.veto span, .wg-chip.blank span, .wg-chip.letter span, .wg-chip.marked span, .wg-vote.is-marked span {
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
}
.wg-podium { display: flex; align-items: flex-end; justify-content: center; gap: 0.55rem; min-height: 12rem; margin: 0.6rem 0; }
.wg-podium li {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    width: 7rem;
    border: 0;
    border-radius: 1rem 1rem 0.4rem 0.4rem;
    background: var(--wg-navy);
    color: #fff;
    padding: 0.8rem 0.4rem;
    animation: wg-rise 0.45s ease both;
}
.wg-podium .place-1 { order: 2; min-height: 11rem; color: #1c1403; }
.wg-podium .place-2 { order: 1; min-height: 8.5rem; }
.wg-podium .place-3 { order: 3; min-height: 7rem; }
.wg-podium .place-1 em, .wg-podium .place-1 strong { color: #1c1403; }
.wg-podium em, .wg-podium strong { font-style: normal; }
.wg-sheet {
    width: min(100% - 1rem, 48rem);
    margin: 0.7rem auto 1.2rem;
    padding: 1.15rem;
}
.wg-sheet .wg-wait-card { background: transparent; border: 0; box-shadow: none; padding: 0.3rem 0.2rem; width: auto; }
.wg-top { display: grid; justify-items: center; gap: 0.15rem; width: 100%; }
.wg-id { width: 100%; justify-self: stretch; display: flex; justify-content: space-between; gap: 0.6rem; align-items: baseline; }
.wg-bar { justify-self: center; }
.wg-you { margin: 0; }
.wg-fields { display: grid; gap: 0.55rem; }
.wg-field { display: grid; }
.wg-field input, .wg-join-form input, .wg-rename-card input, .wg-retry-card input {
    width: 100%;
    border: 0;
    border-radius: 0.75rem;
    padding: 0.75rem 0.85rem;
    font-size: 1rem;
    background: #fff;
    color: #0f172a;
    caret-color: #0f172a;
    -webkit-text-fill-color: #0f172a;
    color-scheme: light;
}
.wg-join { display: grid; place-items: center; min-height: 100dvh; padding: 1rem; }
.wg-join-card, .wg-wait-card { width: min(100%, 42rem); padding: 2.2rem 2.3rem 2.4rem; }
.wg-join-card h1, .wg-wait-card h1, .wg-rename-card h2 { margin: 0.2rem 0 0.7rem; }
.wg-join-card h1, .wg-wait-card h1 { font-size: clamp(2.15rem, 4.5vw, 3.15rem); line-height: 1.05; }
.wg-join .wg-mark { width: 3.2rem; height: 3.2rem; }
.wg-join-card .wg-kicker, .wg-wait-card .wg-kicker { justify-content: center; font-size: 0.95rem; }
.wg-join-card h1, .wg-wait-card h1 { text-align: center; }
.wg-join-form { text-align: left; }
.wg-join-form { display: grid; gap: 0.55rem; }
.wg-join-form label { font-size: 1.08rem; font-weight: 800; }
.wg-join-form input { font-size: 1.45rem; padding: 1rem 1.05rem; }
.wg-join-form button, .wg-rename-card button { margin-top: 0.55rem; background: var(--wg-gold); color: var(--wg-navy); font-size: 1.3rem; padding: 1rem 1.1rem; }
.wg-join .wg-hint, .wg-join .wg-error { font-size: 1.05rem; }
.wg-stop-note {
    margin: 0.7rem 0 0;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--wg-muted);
}
.wg-play-page .wg-field span { font-size: 0.88rem; }
.wg-play-page .wg-field input { font-size: 1.28rem; padding: 0.95rem 1rem; color: #0f172a; -webkit-text-fill-color: #0f172a; }
.wg-field input::placeholder { color: #64748b; opacity: 1; -webkit-text-fill-color: #64748b; }
.wg-answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(16.5rem, 100%), 1fr));
    gap: 0.85rem;
    width: min(100%, 72rem);
    margin: 0.8rem auto 0;
}
.wg-answer-card {
    background: var(--wg-soft);
    border: 1px solid var(--wg-line);
    border-radius: 1.15rem;
    padding: 0.9rem;
}
.wg-answer-card h2 {
    display: block;
    margin: 0 0 0.65rem;
    color: var(--wg-gold);
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.wg-answer-list { display: grid; gap: 0.55rem; list-style: none; margin: 0; padding: 0; }
.wg-answer {
    display: grid;
    gap: 0.2rem;
    width: 100%;
    margin: 0;
    text-align: left;
    border-radius: 0.95rem;
    padding: 0.85rem 0.95rem;
    background: var(--wg-chip);
    color: var(--wg-chip-ink);
    border: 1px solid var(--wg-line);
    font: inherit;
}
.wg-answer strong {
    display: block;
    font-size: 1.55rem;
    line-height: 1.15;
    font-weight: 800;
    color: inherit;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}
.wg-answer-who {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--wg-meta);
}
.wg-answer em {
    font-style: normal;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--wg-muted);
}
.wg-answer em[hidden] { display: none; }
.wg-answer strong { overflow-wrap: anywhere; }
.wg-answer.is-bad, .wg-answer.invalid, .wg-answer.letter, .wg-answer.veto, .wg-answer.blank, .wg-answer.is-marked {
    box-shadow: inset 0 0 0 2px var(--wg-red);
}
.wg-answer.is-mine { box-shadow: inset 0 0 0 2px var(--wg-gold); }
.wg-host-btn[hidden] { display: none !important; }
.wg-retry {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    background: rgba(7, 16, 31, 0.72);
    padding: 1rem;
}
.wg-retry[hidden] { display: none; }
.wg-retry-card {
    width: min(100%, 26rem);
    background: var(--wg-panel-b);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 1.2rem;
    padding: 1.3rem;
}
.wg-retry-card h2 { margin: 0.2rem 0 0.8rem; }
.wg-retry-card label { font-weight: 800; }
.wg-retry-card input { font-size: 2rem; text-align: center; margin-top: 0.35rem; }
.wg-retry-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.9rem; }
.wg-retry-actions button { border: 0; border-radius: 0.8rem; padding: 0.7rem 0.95rem; font-weight: 800; cursor: pointer; }
#wg-retry-cancel { background: #e2e8f0; color: #0f172a; }
.wg-retry-actions button[type="submit"] { background: var(--wg-gold); color: var(--wg-navy); }
.wg-play-page .wg-you, .wg-play-page .wg-kicker { font-size: 1rem; }
.wg-standby {
    margin: 0 0 0.75rem;
    padding: 0.75rem 0.95rem;
    border-radius: 0.95rem;
    background: #f59e0b;
    color: #1c1403;
    font-weight: 800;
    text-align: center;
    font-size: 1.05rem;
}
.wg-sheet.is-standby .wg-fields,
.wg-sheet.is-standby .wg-stop,
.wg-sheet.is-standby .wg-vote { pointer-events: none; }
.wg-vote em {
    grid-column: 1 / -1;
    font-style: normal;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fecaca;
    padding: 0 0.2rem 0.15rem 0.35rem;
}
.wg-stop {
    position: sticky;
    bottom: 0.4rem;
    width: 100%;
    margin-top: 0.35rem;
    background: #3f3a16;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.12em;
    opacity: 1;
}
.wg-stop:disabled { cursor: default; }
.wg-stop.is-ready { background: var(--wg-red); color: #fff; animation: wg-pulse 1s ease infinite; }
.wg-error { color: #fecaca; }
.wg-host-note { width: min(100% - 1.4rem, 78rem); margin: 0 auto 1rem; color: #fecaca; font-weight: 700; }
.wg-host-note[hidden] { display: none; }
.wg-flash {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.92);
    color: var(--wg-navy);
    font-size: clamp(2rem, 8vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    z-index: 6;
    animation: wg-stamp 0.9s ease forwards;
    pointer-events: none;
}
.wg-confetti { pointer-events: none; height: 0; }
.wg-confetti::before {
    content: "";
    position: fixed;
    left: 50%;
    top: 18%;
    width: 0.45rem;
    height: 0.45rem;
    background: var(--wg-gold);
    box-shadow: 18px 8px 0 #fff, -22px 14px 0 var(--wg-gold), 30px 28px 0 #93c5fd, -36px 30px 0 #fff, 8px 40px 0 var(--wg-gold), -12px 46px 0 #93c5fd;
    animation: wg-pop 1.1s ease forwards;
}
.wg-rename {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(7, 16, 31, 0.72);
}
.wg-rename[hidden] { display: none; }
.wg-rename-card {
    width: min(100%, 24rem);
    background: var(--wg-panel-b);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 1.2rem;
    padding: 1.2rem;
}
.wg-ctx {
    position: fixed;
    z-index: 80;
    min-width: 14rem;
    background: #fff;
    color: #0f172a;
    border-radius: 0.9rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
    padding: 0.35rem;
}
.wg-ctx[hidden] { display: none; }
.wg-ctx-name { margin: 0; padding: 0.45rem 0.6rem 0.2rem; font-weight: 800; }
.wg-ctx button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 0.6rem;
    padding: 0.5rem 0.6rem;
    font-weight: 700;
    cursor: pointer;
    color: #0f172a;
}
.wg-ctx button:hover { background: #eef2ff; }
.wg-ctx button.wg-ctx-danger { color: #b91c1c; }
.willow-modal-backdrop { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.55); padding: 1rem; }
.willow-modal-backdrop.hidden { display: none !important; }
.willow-modal-panel { width: min(100%, 28rem); background: #fff; color: #0f172a; border-radius: 1rem; }
html[data-wg-theme="dark"] dialog,
html[data-wg-theme="dark"] .willow-modal-panel {
    box-shadow:
        0 0 0 1px rgba(230, 195, 106, 0.75),
        0 0 0 7px rgba(230, 195, 106, 0.16),
        0 0 36px 10px rgba(186, 210, 255, 0.35),
        0 24px 50px rgba(0, 0, 0, 0.55) !important;
}
.willow-modal-header { padding: 1.25rem 1.5rem 0.4rem; }
.willow-modal-header h3 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.willow-modal-body { padding: 0.4rem 1.5rem 1rem; }
.willow-modal-body p { margin: 0; color: #475569; line-height: 1.5; }
.willow-modal-footer { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.9rem 1.5rem 1.2rem; border-top: 1px solid #e5e7eb; }
.willow-modal-footer button { border: 0; border-radius: 0.7rem; padding: 0.65rem 1rem; font-weight: 800; cursor: pointer; }
#willow-confirm-cancel { background: #e2e8f0; color: #0f172a; }
#willow-confirm-ok { background: #001A72; color: #fff; }
#willow-confirm-ok.is-danger { background: #dc2626; }
.wg-pack-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: #001A72;
    color: #fff;
}
.wg-pack-bar p { margin: 0; font-weight: 800; }
.wg-pack-note { flex: 1 1 100%; background: #FFF6CC; color: #001A72; border-radius: 0.6rem; padding: 0.55rem 0.75rem; }
.wg-pack-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.wg-student-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    padding: 0.55rem 0.15rem 0;
}
.wg-pack-bar .wg-student-tools { margin: 0; padding: 0; }
.wg-student-tools .wg-theme-btn { margin: 0; width: auto; flex: 0 0 auto; align-self: center; }
.wg-theme-btn[hidden] { display: none !important; }
.wg-seat .assess-teacher-retry { display: none !important; }
.wg-pack-bar .wg-theme-btn { margin: 0; background: #fff; color: #001A72; }
a.wg-pack-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0.85rem auto 0;
    background: #FFD700;
    color: #001A72;
    font-weight: 800;
    border-radius: 0.85rem;
    padding: 0.7rem 1.15rem;
    text-decoration: none;
}
.wg-pack-bar a.wg-pack-next { margin: 0; }
.wg-theme-btn {
    position: static;
    display: inline-flex;
    margin: 0.7rem 0 0 0.7rem;
    z-index: 2;
    border: 0;
    border-radius: 999px;
    padding: 0.42rem 0.8rem;
    font-weight: 800;
    cursor: pointer;
    background: var(--wg-navy);
    color: #fff;
    box-shadow: 0 8px 18px rgba(0, 26, 114, 0.2);
}
.wg-play-page .wg-sheet { padding-top: 0.95rem; margin-top: 0.45rem; }
.wg-join { min-height: calc(100dvh - 3.4rem); }
html[data-wg-theme="light"] .wg-play-page {
    background: radial-gradient(ellipse at top, rgba(255, 215, 0, 0.34), transparent 46%), var(--wg-page);
}
html[data-wg-theme="light"] .wg-host-page {
    background: radial-gradient(ellipse at top, rgba(255, 215, 0, 0.28), transparent 42%), var(--wg-host-page);
}
html[data-wg-theme="light"] .wg-join-card,
html[data-wg-theme="light"] .wg-sheet,
html[data-wg-theme="light"] .wg-rail,
html[data-wg-theme="light"] .wg-stage {
    border-top: 4px solid var(--wg-gold);
}
html[data-wg-theme="light"] .wg-answer,
html[data-wg-theme="light"] .wg-answer strong,
html[data-wg-theme="light"] .wg-cat-card strong { color: var(--wg-ink); }
html[data-wg-theme="light"] .wg-code {
    display: block;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    padding: 0.1rem 0.75rem 0.2rem;
    border-radius: 0.85rem;
    background: var(--wg-navy);
    color: var(--wg-gold);
    text-shadow: none;
}
html[data-wg-theme="light"] .wg-letter {
    background: var(--wg-gold);
    color: var(--wg-navy);
    box-shadow: 0 0 0 4px var(--wg-navy), 0 10px 24px rgba(0, 26, 114, 0.14);
}
html[data-wg-theme="light"] .wg-kicker,
html[data-wg-theme="light"] .wg-brand,
html[data-wg-theme="light"] .wg-rail-kicker,
html[data-wg-theme="light"] .wg-judge h2,
html[data-wg-theme="light"] .wg-field span,
html[data-wg-theme="light"] .wg-cat-card span,
html[data-wg-theme="light"] .wg-answer-card h2,
html[data-wg-theme="light"] .wg-chip b { color: var(--wg-navy); }
html[data-wg-theme="light"] .wg-answer-card h2 {
    border-bottom: 3px solid var(--wg-gold);
    padding-bottom: 0.35rem;
}
html[data-wg-theme="light"] .wg-seat strong,
html[data-wg-theme="light"] .wg-rank em,
html[data-wg-theme="light"] .wg-rest em {
    color: var(--wg-navy);
    background: var(--wg-gold);
    border-radius: 999px;
    padding: 0.12rem 0.55rem;
}
html[data-wg-theme="light"] .wg-field input,
html[data-wg-theme="light"] .wg-join-form input,
html[data-wg-theme="light"] .wg-rename-card input,
html[data-wg-theme="light"] .wg-retry-card input { box-shadow: inset 0 0 0 2px #64748b; background: #fff; }
html[data-wg-theme="light"] .wg-vote.is-mine { background: #fff6cc; color: var(--wg-navy); opacity: 1; }
html[data-wg-theme="light"] .wg-answer.is-mine:not(.is-bad):not(.invalid):not(.letter):not(.veto):not(.blank):not(.is-marked),
html[data-wg-theme="light"] .wg-rank li.is-me,
html[data-wg-theme="light"] .wg-rest li.is-me,
html[data-wg-theme="light"] .wg-chip.unique,
html[data-wg-theme="light"] .wg-answer.unique {
    border-color: var(--wg-navy);
    box-shadow: inset 0 0 0 2px var(--wg-navy);
}
html[data-wg-theme="light"] .wg-chip.shared,
html[data-wg-theme="light"] .wg-answer.shared { border-color: #1d4ed8; box-shadow: inset 0 0 0 2px #1d4ed8; }
html[data-wg-theme="light"] .wg-theme-btn { background: #fff; color: var(--wg-navy); box-shadow: inset 0 0 0 2px var(--wg-navy); }
html[data-wg-theme="light"] .wg-host-btn { box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.75); }
html[data-wg-theme="light"] .wg-vote em { color: var(--wg-muted); }
html[data-wg-theme="light"] .wg-error,
html[data-wg-theme="light"] .wg-host-note,
html[data-wg-theme="light"] .wg-answer.is-bad em,
html[data-wg-theme="light"] .wg-answer.invalid em,
html[data-wg-theme="light"] .wg-answer.letter em,
html[data-wg-theme="light"] .wg-answer.veto em,
html[data-wg-theme="light"] .wg-answer.blank em { color: #9f1239; }
html[data-wg-theme="light"] .wg-host-note {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
}
html[data-wg-theme="light"] .wg-vote.is-marked,
html[data-wg-theme="light"] .wg-vote.is-marked em,
html[data-wg-theme="light"] .wg-chip.veto,
html[data-wg-theme="light"] .wg-chip.blank,
html[data-wg-theme="light"] .wg-chip.letter,
html[data-wg-theme="light"] .wg-chip.marked { color: #fff; }
html[data-wg-theme="light"] .wg-vote.is-marked em { color: #ffe4e6; }
html[data-wg-theme="light"] .wg-place { color: #fff; background: var(--wg-navy); }
html[data-wg-theme="light"] .wg-cats li { background: #fff; border-color: var(--wg-navy); color: var(--wg-navy); font-weight: 800; }
html[data-wg-theme="light"] .wg-stop { background: #e7e0d0; color: #334155; }
html[data-wg-theme="light"] .wg-stop.is-ready { background: var(--wg-red); color: #fff; }
@keyframes wg-slam { from { transform: scale(1.5); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes wg-flicker { 50% { opacity: 0.4; } }
@keyframes wg-pulse { 50% { transform: scale(1.03); } }
@keyframes wg-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wg-stamp { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
@keyframes wg-pop { to { transform: translate(-30px, 70px); opacity: 0; } }
@media (max-width: 640px) {
    .wg-letter { width: 4.6rem; height: 4.6rem; font-size: 2.4rem; }
    .wg-play-page { padding-left: 0.6rem; padding-right: 0.6rem; }
    .wg-field input, .wg-answer strong { font-size: 1rem; }
    .wg-answer-list { max-height: 16rem; overflow: auto; }
    .wg-play-page.is-review { height: auto; max-height: none; overflow: auto; }
    .wg-host-page .wg-stage { overflow: visible; }
}
@media (max-width: 1100px) and (min-width: 960px) {
    .wg-host-page .wg-board {
        grid-template-rows: minmax(9rem, 36%) minmax(0, 1fr);
    }
}
@media (max-width: 1100px) {
    .wg-host-bar { flex-wrap: wrap; row-gap: 0.35rem; }
    .wg-host-brand { order: 1; }
    .wg-host-actions { order: 2; margin-left: auto; }
    .wg-host-bar h1 { order: 3; flex: 1 0 100%; text-align: left; }
    .wg-board { grid-template-columns: 1fr; }
    .wg-rail { min-height: 0; }
    .wg-seats { grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); }
}
@media (max-width: 700px) {
    .wg-seats { grid-template-columns: 1fr; }
    .wg-host-actions { width: 100%; margin-left: 0; justify-content: flex-start; }
}
@media (max-width: 959px) {
    .wg-answer-list { max-height: 18rem; overflow: auto; }
    .wg-play-page.is-review,
    .wg-host-page { height: auto; max-height: none; overflow: auto; }
    .wg-host-page .wg-stage,
    .wg-play-page.is-review .wg-sheet { overflow: visible; display: block; height: auto; }
}
@media (min-width: 960px) {
    .wg-host-page {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .wg-host-page .wg-host-bar { flex: 0 0 auto; }
    .wg-host-page .wg-board {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        margin-bottom: 0.45rem;
        overflow: hidden;
    }
    .wg-host-page .wg-rail,
    .wg-host-page .wg-stage {
        min-height: 0;
        overflow: hidden;
    }
    .wg-host-page .wg-rail { display: flex; flex-direction: column; }
    .wg-host-page .wg-seats {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        align-content: start;
    }
    .wg-host-page .wg-stage { display: flex; flex-direction: column; min-height: 0; }
    .wg-host-page .wg-stage > .wg-board-head,
    .wg-host-page .wg-stage > .wg-standby,
    .wg-host-page .wg-stage > .wg-flash { flex: 0 0 auto; }
    .wg-host-page .wg-stage > .wg-answer-grid,
    .wg-host-page .wg-stage > .wg-cat-grid {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        overflow: hidden;
        align-content: stretch;
        grid-auto-rows: minmax(0, 1fr);
    }
    .wg-host-page .wg-stage > .wg-cat-grid { overflow: auto; }
    .wg-host-page .wg-answer-card {
        min-height: 0;
        max-height: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .wg-host-page .wg-answer-card h2 { flex: 0 0 auto; }
    .wg-host-page .wg-answer-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        align-content: start;
    }
    .wg-host-page .wg-stage > .wg-rank,
    .wg-host-page .wg-stage > .wg-rest,
    .wg-host-page .wg-stage > .wg-lobby,
    .wg-host-page .wg-stage > .wg-podium {
        min-height: 0;
        overflow: auto;
    }
    .wg-host-page .wg-stage > .wg-rank,
    .wg-host-page .wg-stage > .wg-rest { flex: 0 1 18rem; }
    .wg-host-page .wg-host-note {
        position: fixed;
        left: 0.8rem;
        right: 0.8rem;
        bottom: 0.45rem;
        z-index: 6;
        width: auto;
        margin: 0;
    }
    .wg-play-page.is-review {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .wg-play-page.is-review .wg-pack-bar,
    .wg-play-page.is-review .wg-student-tools,
    .wg-play-page.is-review .wg-theme-btn { flex: 0 0 auto; }
    .wg-play-page.is-review .wg-student-tools { align-self: flex-end; }
    .wg-play-page.is-review .wg-theme-btn { width: auto; align-self: center; }
    .wg-play-page.is-review .wg-sheet {
        width: min(100% - 1rem, 100rem);
        flex: 1 1 auto;
        min-height: 0;
        margin: 0.35rem auto 0.5rem;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .wg-play-page.is-review .wg-top,
    .wg-play-page.is-review .wg-phase,
    .wg-play-page.is-review .wg-hint,
    .wg-play-page.is-review .wg-standby,
    .wg-play-page.is-review .wg-flash { flex: 0 0 auto; }
    .wg-play-page.is-review .wg-letter {
        width: 4.1rem;
        height: 4.1rem;
        margin: 0.15rem auto;
        font-size: 2.15rem;
        border-radius: 0.95rem;
    }
    .wg-play-page.is-review .wg-hint { font-size: 0.82rem; }
    .wg-play-page.is-review .wg-answer-grid {
        flex: 1 1 auto;
        min-height: 0;
        width: 100%;
        margin-top: 0.45rem;
        overflow: hidden;
        grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
        align-content: stretch;
        grid-auto-rows: minmax(0, 1fr);
    }
    .wg-play-page.is-review .wg-answer-card {
        min-height: 0;
        max-height: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    .wg-play-page.is-review .wg-answer-card h2 { flex: 0 0 auto; }
    .wg-play-page.is-review .wg-answer-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        align-content: start;
    }
}
@media (min-width: 720px) {
    .wg-fields { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .wg-letter.is-roulette, .wg-letter.is-set, .wg-stop.is-ready, .wg-cats li, .wg-field, .wg-cat-card, .wg-seat, .wg-podium li, .wg-confetti::before, .wg-you.is-score, .wg-plus, .wg-rank li, .wg-answer-card {
        animation: none;
    }
    .wg-flash { display: none !important; }
    .wg-bar span::before { transition: none; }
}
.ah-dialog { width: min(96vw, 42rem); max-width: min(96vw, 42rem); max-height: 92dvh; margin: auto; border: 0; border-radius: 1.2rem; padding: 0; background: transparent; }
dialog.ah-dialog { width: min(96vw, 42rem); max-width: min(96vw, 42rem); max-height: 92dvh; margin: auto; overflow: hidden; }
dialog.ah-dialog[open] { display: block; }
.ah-dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
.ah-dialog:not([open]) { display: none; }
.ah-panel { background: #fff; color: #0f172a; border-radius: 1.2rem; padding: 1.1rem 1.2rem 1rem; max-height: 92dvh; overflow: auto; }
.ah-panel h3 { margin: 0; font-size: 1.25rem; }
.ah-lead, .ah-empty, .ah-meta { color: #64748b; font-size: 0.92rem; }
.ah-tools { display: flex; gap: 0.4rem; margin-top: 0.55rem; }
.ah-tools button, .ah-mini { border: 0; border-radius: 0.6rem; background: #e2e8f0; color: #0f172a; font-weight: 800; font-size: 0.78rem; padding: 0.35rem 0.55rem; cursor: pointer; }
.ah-tools button[disabled] { opacity: 0.45; }
.ah-item { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.45rem; }
.ah-row, .ah-score { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; width: 100%; text-align: left; border: 1px solid #e5e7eb; background: #fff; border-radius: 0.8rem; padding: 0.65rem 0.75rem; color: inherit; }
.ah-row { cursor: pointer; flex: 1; min-width: 0; }
.ah-score { margin-top: 0.45rem; }
.ah-score > span:first-child { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.ah-mark { flex: 0 0 auto; text-align: right; }
.ah-count { color: #001A72; font-weight: 800; white-space: nowrap; }
.ah-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.9rem; }
.ah-actions button { border-radius: 0.7rem; padding: 0.55rem 0.8rem; border: 1px solid #d1d5db; background: #fff; font-weight: 700; }
#ah-close { background: #001A72; color: #fff; border-color: #001A72; }
.ah-export { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-right: auto; }
.ah-export a { display: inline-flex; align-items: center; border-radius: 0.7rem; padding: 0.5rem 0.75rem; border: 1px solid #c7d2fe; background: #eef2ff; color: #001A72; font-weight: 800; font-size: 0.82rem; text-decoration: none; }
.ah-meta { display: block; }

.wg-room-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-bottom: 0.85rem; }
.wg-pick { position: relative; display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; user-select: none; }
.wg-pick input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.wg-pick-box { width: 1.7rem; height: 1.7rem; flex: 0 0 1.7rem; border-radius: 0.5rem; border: 2px solid #001A72; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 0 rgba(0, 26, 114, 0.08); }
.wg-pick-box::after { content: ""; width: 0.38rem; height: 0.7rem; border: solid transparent; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.wg-pick input:checked + .wg-pick-box { background: #001A72; border-color: #001A72; }
.wg-pick input:checked + .wg-pick-box::after { border-color: #FFD700; }
.wg-pick input:focus-visible + .wg-pick-box { outline: 3px solid #FFD700; outline-offset: 2px; }
.wg-pick-all { padding: 0.35rem 0.7rem 0.35rem 0.4rem; border-radius: 999px; border: 1px solid #dbe3f5; background: #f8fafc; font-size: 0.92rem; font-weight: 700; color: #001A72; }
html.dark .wg-pick-box { background: #0f172a; border-color: #FFD700; }
html.dark .wg-pick input:checked + .wg-pick-box { background: #001A72; border-color: #FFD700; }
html.dark .wg-pick-all { background: #0f172a; border-color: #334155; color: #f8fafc; }
.wg-room.is-picked { border-color: #001A72; box-shadow: inset 4px 0 0 #FFD700; }
html.dark .wg-room.is-picked { border-color: #FFD700; }
