body.match-active { overflow:hidden; background:#050b14; }
body.match-active .topbar { display:none; }
body.match-active .views { min-height:100%; }
body.match-active #view-game,
body.match-active #view-game.is-active {
    height:100%;
    overflow:hidden;
    padding:0;
    background:radial-gradient(circle at 50% 26%,rgba(38,82,140,.18),transparent 46%),#060d18;
}

.match-screen {
    --rm-accent:#4d9bf7;
    --rm-glow:rgba(77,155,247,.45);
    --rm-line:rgba(110,150,196,.18);
    --rm-panel:linear-gradient(165deg,rgba(15,30,50,.92),rgba(8,18,31,.95));
    --rm-muted:#8397ad;
    --rm-timer:#b9f43f;
    --strip-w:68px;
    width:100%;
    height:100%;
    min-height:0;
    display:grid;
    grid-template-columns:minmax(0,1fr) var(--strip-w);
    grid-template-rows:auto auto minmax(0,1fr) auto minmax(200px,44%);
    color:var(--text);
}
.room-head,
.room-steps { grid-column:1 / -1; }
.room-stage,
.room-deck,
.room-chat { grid-column:1; }
.match-screen.phase-theme_vote { --rm-accent:#c04af0; --rm-glow:rgba(192,74,240,.5); }
.match-screen.phase-discussion { --rm-accent:#3fc0b2; --rm-glow:rgba(63,192,178,.45); }
.match-screen.phase-answer { --rm-accent:#f2c14e; --rm-glow:rgba(242,193,78,.45); }
.match-screen.phase-reveal { --rm-accent:#46c07a; --rm-glow:rgba(70,192,122,.45); }
.match-screen.phase-ended { --rm-accent:#8fa3ba; --rm-glow:rgba(143,163,186,.35); }
.match-screen button:focus-visible { outline:2px solid #77b8ee; outline-offset:2px; }

.room-head {
    grid-row:1;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);
    align-items:center;
    gap:10px;
    padding:max(10px,env(safe-area-inset-top)) 14px 0;
}
.room-clock { justify-self:end; display:flex; align-items:center; }

.room-role { min-width:0; display:flex; align-items:center; gap:9px; }
.role-face { width:34px; height:34px; flex:0 0 auto; object-fit:cover; object-position:center 18%; border:1px solid rgba(126,169,204,.28); border-radius:50%; }
.role-face.is-empty { background:rgba(30,46,66,.75); }
.room-role > span { min-width:0; display:flex; flex-direction:column; }
.room-role b { overflow:hidden; font-size:13.5px; font-weight:800; text-overflow:ellipsis; white-space:nowrap; }
.room-role small { overflow:hidden; color:var(--rm-muted); font-size:10.5px; text-overflow:ellipsis; white-space:nowrap; }
.room-role.is-mole b { color:#f5b568; }
.role-score { flex:0 0 auto; min-width:26px; padding:3px 8px; border-radius:999px; background:rgba(122,72,18,.4); color:#f5b568; font-size:11.5px; font-style:normal; font-weight:800; font-variant-numeric:tabular-nums; text-align:center; }

.room-score {
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:2px;
    padding:6px 14px 5px;
    border:1px solid var(--rm-line);
    border-radius:14px;
    background:var(--rm-panel);
}
.score-phase { color:var(--rm-accent); font-size:10.5px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.score-teams { display:flex; align-items:flex-start; gap:8px; }
.score-side { min-width:56px; display:flex; flex-direction:column; align-items:center; }
.score-side small { color:var(--rm-muted); font-size:9px; font-weight:750; }
.score-side b { font-size:21px; font-weight:850; font-variant-numeric:tabular-nums; line-height:1.1; }
.score-side.logic b { color:#8fc4fb; }
.score-side.intuition b { color:#c3a6f0; }
.score-split { align-self:center; color:#5b768c; font-size:16px; font-style:normal; font-weight:800; }
.score-bonus { margin-top:3px; padding:2px 7px; border:1px solid transparent; border-radius:999px; background:rgba(226,187,91,.16); color:#f0dca6; font-size:8.5px; font-style:normal; font-weight:800; white-space:nowrap; }
.score-bonus.is-empty { visibility:hidden; }
.score-bonus.is-pick {
    min-height:24px;
    display:inline-flex;
    align-items:center;
    padding:2px 10px;
    border-color:rgba(226,187,91,.55);
    font:inherit;
    font-size:9.5px;
    font-weight:800;
    line-height:1;
    cursor:pointer;
    animation:score-bonus-call 1.9s ease-in-out infinite;
}
.score-bonus.is-pick:hover { border-color:var(--gold); background:rgba(226,187,91,.28); }
@keyframes score-bonus-call {
    0%, 100% { box-shadow:0 0 0 0 rgba(226,187,91,0); }
    50% { box-shadow:0 0 0 4px rgba(226,187,91,.14); }
}
.score-round { color:#7f93aa; font-size:10px; font-weight:800; font-variant-numeric:tabular-nums; }

.clock-ring { position:relative; width:52px; height:52px; display:grid; place-items:center; }
.clock-ring::before {
    content:'';
    position:absolute;
    inset:0;
    border-radius:50%;
    background:conic-gradient(var(--rm-timer) var(--p,100%), rgba(122,150,180,.18) 0);
    -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 5px),#000 calc(100% - 4px));
    mask:radial-gradient(farthest-side,transparent calc(100% - 5px),#000 calc(100% - 4px));
}
.clock-ring b { color:var(--rm-timer); font-size:15.5px; font-weight:800; font-variant-numeric:tabular-nums; }
.clock-final { display:block; color:#b9c7d6; font-size:21px; font-weight:800; }

.room-steps { grid-row:2; display:flex; align-items:center; justify-content:center; gap:16px; min-height:14px; padding:8px 14px 2px; }
.phase-dot { width:6px; height:6px; border-radius:50%; background:rgba(120,155,196,.26); transition:background .2s; }
.phase-dot.is-done { background:rgba(146,180,218,.5); }
.phase-dot.is-now { width:9px; height:9px; background:var(--rm-accent); box-shadow:0 0 12px 1px var(--rm-glow); }

.room-stage {
    grid-row:3;
    min-height:0;
    display:flex;
    flex-direction:column;
    justify-content:center;
    justify-content:safe center;
    gap:12px;
    overflow-y:auto;
    padding:2px 0 6px;
    scrollbar-width:none;
    overscroll-behavior:contain;
}
.room-stage::-webkit-scrollbar { display:none; }
.room-stage > * { flex:0 0 auto; }
.stage-question,
.stage-caption,
.stage-idle,
.deck-event,
.room-stage .theme-grid,
.room-stage .quiz-options,
.match-screen .result { margin-inline:14px; }

.stage-question { text-align:center; }
.stage-theme { display:inline-block; margin-bottom:8px; padding:4px 12px; border:1px solid rgba(93,155,201,.28); border-radius:999px; color:#8fc4fb; font-size:11px; font-weight:750; }
.stage-question h2 { margin:0; font-size:clamp(17px,4.6vw,21px); font-weight:800; line-height:1.32; }
.stage-caption { display:flex; align-items:center; justify-content:center; gap:8px; }
.stage-caption b { font-size:14px; font-weight:800; }
.stage-caption i { padding:3px 9px; border-radius:999px; background:rgba(99,146,184,.16); color:var(--rm-muted); font-size:10px; font-style:normal; font-weight:700; }
.stage-idle { padding:20px 10px; color:var(--rm-muted); font-size:14px; text-align:center; }

.theme-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.theme-card {
    min-width:0;
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    align-items:center;
    gap:4px 10px;
    padding:10px 12px;
    border:1px solid rgba(110,150,196,.2);
    border-radius:16px;
    background:linear-gradient(168deg,rgba(16,32,52,.92),rgba(9,19,33,.95));
    color:var(--text);
    font:inherit;
    text-align:left;
    cursor:pointer;
    transition:border-color .2s, box-shadow .2s, background .2s;
}
.theme-card-icon { grid-row:1 / span 2; width:34px; height:34px; display:grid; place-items:center; border-radius:11px; background:rgba(126,96,214,.15); color:#a78bfa; transition:background .2s, color .2s; }
.theme-card-icon svg { width:19px; height:19px; }
.theme-card-title { min-width:0; overflow:hidden; font-size:13.5px; font-weight:800; text-overflow:ellipsis; white-space:nowrap; }
.theme-card-tally { grid-column:2; display:flex; align-items:center; gap:8px; }
.theme-card-tally em { color:#e8eef7; font-size:19px; font-style:normal; font-weight:850; font-variant-numeric:tabular-nums; line-height:1; }
.theme-card-faces { display:flex; min-height:20px; align-items:center; }
.theme-card-face {
    width:20px;
    height:20px;
    flex:0 0 auto;
    margin-left:-6px;
    object-fit:cover;
    object-position:center 18%;
    border:2px solid rgba(9,19,33,.95);
    border-radius:50%;
    background:#1b2c3f;
}
.theme-card-face:first-child { margin-left:0; }
.theme-card-face.is-more { display:grid; place-items:center; color:#9fb6cd; font-size:9px; font-style:normal; font-weight:800; }
.theme-card:hover:not(:disabled) { border-color:rgba(126,169,204,.4); }
.theme-card:disabled { cursor:default; }
.theme-grid:has(.theme-card.is-selected) .theme-card:not(.is-selected) { opacity:.62; }
.theme-card.is-selected {
    border-color:rgba(77,155,247,.8);
    background:linear-gradient(168deg,rgba(21,45,74,.95),rgba(10,23,40,.96));
    box-shadow:0 0 0 1px rgba(77,155,247,.3);
}
.theme-card.is-selected .theme-card-icon { background:rgba(59,130,246,.18); color:#60a5fa; }
.theme-card.is-selected .theme-card-tally em { color:#9ec3ff; }

.room-chat { grid-row:5; position:relative; min-height:0; }

.roster-strip {
    grid-column:2;
    grid-row:3 / 6;
    z-index:5;
    width:var(--strip-w);
    min-height:0;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:8px;
    padding:6px 0 max(12px,env(safe-area-inset-bottom));
    border-top:1px solid var(--rm-line);
    border-left:1px solid var(--rm-line);
    border-top-left-radius:16px;
    background:linear-gradient(180deg,rgba(10,22,38,.72),rgba(6,15,26,.88));
}
.roster-strip-toggle {
    width:48px;
    height:48px;
    flex:0 0 auto;
    display:grid;
    place-items:center;
    padding:0;
    border:1px solid rgba(110,150,196,.24);
    border-radius:12px;
    background:rgba(11,26,43,.94);
    color:#cfe0f2;
    font:inherit;
    cursor:pointer;
    transition:border-color .18s, background .18s;
}
.roster-strip-toggle svg { width:18px; height:18px; }
.roster-strip-toggle:hover { border-color:rgba(126,169,204,.5); background:rgba(16,36,58,.96); }

.roster-strip-list {
    min-height:0;
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    justify-content:safe center;
    gap:8px;
    overflow-y:auto;
    padding:2px 0;
    scrollbar-width:none;
    overscroll-behavior:contain;
}
.roster-strip-list::-webkit-scrollbar { display:none; }
.strip-group { align-self:stretch; display:flex; flex-direction:column; align-items:center; flex:0 0 auto; gap:6px; }
.strip-group + .strip-group { padding-top:9px; border-top:1px solid rgba(110,150,196,.22); }
.strip-seat {
    width:100%;
    min-width:0;
    flex:0 0 auto;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:3px;
    padding-inline:4px;
}
.strip-avatar { position:relative; flex:0 0 auto; padding:0; border:0; border-radius:50%; background:transparent; font:inherit; }
.strip-avatar.is-actionable { cursor:pointer; animation:strip-call 2.1s ease-in-out infinite; }
@keyframes strip-call {
    0%, 100% { box-shadow:0 0 0 0 rgba(226,112,122,0); }
    50% { box-shadow:0 0 0 5px rgba(226,112,122,.24); }
}
.strip-face {
    width:32px;
    height:32px;
    display:block;
    object-fit:cover;
    object-position:center 18%;
    border:1.5px solid rgba(126,169,204,.3);
    border-radius:50%;
    background:#16283c;
}
.strip-name {
    max-width:100%;
    overflow:hidden;
    color:#7d90a6;
    font-size:8.5px;
    font-weight:750;
    line-height:1.2;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.strip-seat.is-human .strip-name { color:#c6d5e6; }
.strip-group.logic .strip-face { border-color:rgba(85,165,245,.62); }
.strip-group.intuition .strip-face { border-color:rgba(176,139,232,.62); }
.strip-seat.is-mole .strip-face { border-color:#f2934e; }
.strip-seat.is-mole .strip-name { color:#f2a76b; }
.strip-seat.is-you .strip-face { box-shadow:0 0 0 2px rgba(226,187,91,.55); }
.strip-seat.is-you .strip-name { color:#f0dca6; }
.strip-seat.is-exiled { opacity:.42; }
.strip-seat.is-captain .strip-avatar::after {
    content:'★';
    position:absolute;
    top:-5px;
    left:-4px;
    color:var(--gold);
    font-size:11px;
    line-height:1;
    text-shadow:0 1px 2px rgba(3,9,16,.9);
}
.strip-mark {
    position:absolute;
    top:-4px;
    right:-5px;
    min-width:17px;
    height:17px;
    display:grid;
    place-items:center;
    padding:0 3px;
    border:1.5px solid #0a1a2b;
    border-radius:6px;
    background:#2a5f96;
    color:#d6ebff;
    font-size:9.5px;
    font-style:normal;
    font-weight:850;
    line-height:1;
}
.strip-mark.is-hidden { background:#1d564f; color:#7fd3c9; }

.rm-chat {
    height:100%;
    min-height:0;
    display:grid;
    grid-template-rows:auto minmax(0,1fr) auto;
    border:1px solid var(--rm-line);
    border-bottom:0;
    border-radius:20px 20px 0 0;
    background:linear-gradient(180deg,rgba(11,24,40,.96),rgba(6,15,26,.98));
    box-shadow:0 -14px 34px rgba(2,7,14,.5);
}
.rm-tabs { display:flex; border-bottom:1px solid rgba(103,148,197,.16); }
.rm-tab {
    position:relative;
    flex:1;
    min-height:48px;
    padding:13px 8px;
    border:0;
    background:transparent;
    color:#7f93aa;
    font:inherit;
    font-size:14px;
    font-weight:700;
    cursor:pointer;
}
.rm-tab.is-active { color:#eaf2fb; }
.rm-tab.is-active::after { content:''; position:absolute; right:26%; bottom:-1px; left:26%; height:2px; border-radius:2px; background:#4d9bf7; }
.rm-tab.team { color:#8f7cc9; }
.rm-tab.team.is-active { color:#c9b8ff; }
.rm-tab.team.is-active::after { background:#a78bfa; }

.rm-log {
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:15px;
    overflow-y:auto;
    padding:15px 14px 10px;
    scrollbar-width:none;
    overscroll-behavior:contain;
}
.rm-log::-webkit-scrollbar { display:none; }
.room-msg { display:grid; grid-template-columns:34px minmax(0,1fr); align-items:start; gap:10px; }
.room-msg-face { width:34px; height:34px; object-fit:cover; object-position:center 18%; border:1px solid rgba(126,169,204,.2); border-radius:50%; background:#16283c; }
.room-msg-face.is-empty { background:rgba(30,46,66,.75); }
.room-msg-head { display:flex; align-items:baseline; gap:8px; }
.room-msg-head b { min-width:0; overflow:hidden; font-size:13.5px; font-weight:750; text-overflow:ellipsis; white-space:nowrap; }
.room-msg-head b.tone-0 { color:#5aa9f0; }
.room-msg-head b.tone-1 { color:#e582ab; }
.room-msg-head b.tone-2 { color:#5fc48a; }
.room-msg-head b.tone-3 { color:#a78bfa; }
.room-msg-head time { flex:0 0 auto; color:#66798e; font-size:11.5px; font-variant-numeric:tabular-nums; }
.room-msg p { margin:3px 0 0; color:#d7e2ee; font-size:14.5px; line-height:1.35; overflow-wrap:anywhere; user-select:text; }
.room-msg.is-team p { color:#d8cff5; }

.rm-form { position:relative; display:flex; align-items:flex-end; gap:8px; padding:10px 12px max(12px,env(safe-area-inset-bottom)); border-top:1px solid rgba(103,148,197,.14); }
.rm-input {
    min-width:0;
    min-height:48px;
    max-height:104px;
    flex:1;
    overflow-y:auto;
    padding:13px 16px;
    border:1px solid rgba(110,150,196,.22);
    border-radius:14px;
    background:rgba(6,16,28,.85);
    color:var(--text);
    font:inherit;
    font-size:15px;
    line-height:1.35;
}
.rm-input:focus { border-color:rgba(77,155,247,.5); box-shadow:0 0 0 3px rgba(77,155,247,.12); }
.rm-emoji { width:48px; min-width:48px; height:48px; flex:0 0 auto; border-radius:14px; }
.rm-emoji-picker { right:10px; }
.rm-send {
    width:58px;
    min-width:58px;
    min-height:48px;
    display:grid;
    place-items:center;
    padding:0;
    border:1px solid rgba(110,150,196,.22);
    border-radius:14px;
    background:linear-gradient(160deg,rgba(29,54,84,.92),rgba(13,29,48,.94));
    cursor:pointer;
}
.rm-send img { width:20px; height:20px; opacity:.92; }

.quiz-option.is-readonly { cursor:default; }
.quiz-option.is-readonly:hover { border-color:var(--line-strong); background:rgba(6,20,34,.76); }

.room-deck { grid-row:4; display:flex; flex-direction:column; gap:7px; margin:8px 14px 10px; }
.deck-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 12px; border:1px solid var(--rm-line); border-radius:14px; background:rgba(9,22,37,.6); }
.deck-row-label { flex:0 0 auto; display:flex; flex-direction:column; gap:1px; color:var(--text); font-size:11.5px; font-weight:750; }
.deck-row-label small { color:var(--rm-muted); font-size:9.5px; font-weight:400; }
.deck-row.exile-row { border-color:rgba(242,156,78,.32); background:rgba(38,23,10,.5); }
.deck-chip {
    min-height:34px;
    flex:0 0 auto;
    padding:7px 14px;
    border:1px solid rgba(242,156,78,.55);
    border-radius:11px;
    background:rgba(92,58,20,.34);
    color:#f7c894;
    font:inherit;
    font-size:11.5px;
    font-weight:800;
    white-space:nowrap;
    cursor:pointer;
    transition:border-color .18s, background .18s;
}
.deck-chip:hover { border-color:#f2934e; background:rgba(120,74,24,.46); }
.deck-chip.is-done { border-color:rgba(126,169,204,.28); background:rgba(9,22,37,.7); color:var(--rm-muted); }
.deck-event { display:flex; align-items:center; gap:8px; padding:8px 12px; border-radius:12px; background:rgba(8,20,34,.7); color:var(--rm-muted); font-size:10.5px; line-height:1.4; }
.deck-event + .deck-event { margin-top:-6px; }
.deck-event-dot { width:5px; height:5px; flex:0 0 auto; border-radius:50%; background:var(--rm-accent); }

.roster-rail {
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    z-index:60;
    width:min(300px,86vw);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border-left:1px solid rgba(94,143,183,.22);
    background:linear-gradient(160deg,rgba(11,28,45,.98),rgba(5,15,26,.99));
    transform:translateX(102%);
    transition:transform .22s ease;
}
.is-roster-open .roster-rail { transform:translateX(0); box-shadow:-18px 0 50px rgba(0,0,0,.5); }
.roster-head { display:flex; align-items:center; gap:8px; padding:max(14px,env(safe-area-inset-top)) 14px 12px; border-bottom:1px solid var(--rm-line); }
.roster-head b { margin-right:auto; font-size:14px; }
.roster-head span { color:var(--rm-muted); font-size:11px; }
.roster { min-height:0; flex:1; display:flex; flex-direction:column; overflow-y:auto; }
.roster-group header { position:sticky; top:0; display:flex; align-items:center; gap:8px; padding:8px 14px; border-bottom:1px solid var(--rm-line); background:rgba(7,21,35,.96); font-size:10px; }
.roster-group header b { margin-right:auto; font-size:11px; }
.roster-group-count { color:var(--rm-muted); font-size:10px; font-style:normal; font-variant-numeric:tabular-nums; }
.roster-group-score { font-size:15px; font-weight:850; font-variant-numeric:tabular-nums; }
.roster-group.logic header { color:#8fc4fb; box-shadow:inset 3px 0 #55a5f5; }
.roster-group.intuition header { color:#c3a6f0; box-shadow:inset 3px 0 #b08be8; }
.roster-row { display:flex; align-items:center; gap:9px; padding:7px 14px; border-bottom:1px solid rgba(99,146,184,.08); }
.roster-row.is-you { background:rgba(42,102,154,.16); }
.roster-row.is-exiled { opacity:.5; }
.roster-row.is-mole { box-shadow:inset 2px 0 rgba(242,156,78,.7); }
.roster-portrait { width:28px; height:28px; display:block; flex:0 0 auto; object-fit:cover; object-position:center 18%; border:1px solid rgba(126,169,204,.22); border-radius:50%; }
.roster-portrait-act {
    flex:0 0 auto;
    display:block;
    padding:0;
    border:0;
    border-radius:50%;
    background:transparent;
    font:inherit;
    cursor:pointer;
    animation:strip-call 2.1s ease-in-out infinite;
}
.roster-name { min-width:0; flex:1; overflow:hidden; font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.roster-name em { color:#c98a5a; font-size:9px; font-style:normal; }
.roster-tags { display:flex; gap:3px; }
.roster-tag { font-size:10px; font-style:normal; }
.roster-tag.captain { color:var(--gold); }
.roster-tag.mole { color:#f5b568; }
.roster-tag.bot { color:var(--rm-muted); font-size:8px; font-weight:800; }
.roster-mark { min-width:20px; height:20px; display:grid; place-items:center; border-radius:6px; background:rgba(67,137,202,.2); color:#76b9f3; font-size:10px; font-weight:850; }
.roster-mark.is-hidden { background:rgba(76,185,173,.16); color:#69c7be; }
.roster-foot { display:flex; gap:10px; padding:12px 14px max(14px,env(safe-area-inset-bottom)); border-top:1px solid var(--rm-line); }
.roster-act {
    min-height:48px;
    flex:1;
    display:grid;
    place-items:center;
    padding:0;
    border:1px solid rgba(110,150,196,.24);
    border-radius:13px;
    background:rgba(9,22,37,.72);
    color:#cfe0f2;
    font:inherit;
    cursor:pointer;
    transition:border-color .18s, background .18s, color .18s;
}
.roster-act svg { width:20px; height:20px; }
.roster-act:hover { border-color:rgba(126,169,204,.5); background:rgba(16,36,58,.9); }
.roster-act.danger { border-color:rgba(212,112,120,.4); background:rgba(48,20,24,.44); color:#eda6ac; }
.roster-act.danger:hover { border-color:rgba(226,124,132,.75); background:rgba(90,34,40,.5); }

.roster-scrim {
    position:absolute;
    inset:0;
    z-index:55;
    display:block;
    padding:0;
    border:0;
    background:rgba(2,8,14,.62);
    opacity:0;
    pointer-events:none;
    transition:opacity .22s ease;
}
.is-roster-open .roster-scrim { opacity:1; pointer-events:auto; }

.match-screen .result { border-radius:16px; background:rgba(9,26,41,.9); }

.ctx-layer { position:absolute; inset:0; z-index:70; pointer-events:none; transition:opacity .18s ease; }
@media (max-width:899px) {
    .match-screen.is-roster-open .ctx-layer { opacity:0; visibility:hidden; }
}
.ctx-pop {
    --ctx-accent:#e2bb5b;
    --ctx-soft:rgba(226,187,91,.16);
    position:absolute;
    top:0;
    left:0;
    width:min(340px,calc(100% - 24px));
    max-height:var(--pop-max,70vh);
    display:flex;
    flex-direction:column;
    border:1px solid color-mix(in srgb, var(--ctx-accent) 42%, transparent);
    border-radius:18px;
    background:linear-gradient(168deg,rgba(17,33,53,.99),rgba(8,18,31,.99));
    box-shadow:0 18px 44px rgba(2,7,14,.62), 0 0 0 1px rgba(4,10,18,.6);
    opacity:0;
    pointer-events:auto;
}
.ctx-pop.is-placed { opacity:1; animation:ctx-pop-in .18s ease-out both; }
.ctx-pop--exile { --ctx-accent:#f2934e; --ctx-soft:rgba(242,147,78,.16); }
.ctx-pop--captain { --ctx-accent:#e2707a; --ctx-soft:rgba(226,112,122,.16); }
@keyframes ctx-pop-in {
    from { opacity:0; transform:translateY(-6px) scale(.97); }
    to { opacity:1; transform:none; }
}
.ctx-pop[data-place='above'] { animation-name:ctx-pop-in-up; }
@keyframes ctx-pop-in-up {
    from { opacity:0; transform:translateY(6px) scale(.97); }
    to { opacity:1; transform:none; }
}

.ctx-pop-arrow {
    position:absolute;
    left:var(--arrow-x,50%);
    width:12px;
    height:12px;
    margin-left:-6px;
    border:1px solid color-mix(in srgb, var(--ctx-accent) 42%, transparent);
    background:rgba(17,33,53,.99);
    transform:rotate(45deg);
}
.ctx-pop[data-place='below'] .ctx-pop-arrow { top:-7px; border-right:0; border-bottom:0; }
.ctx-pop[data-place='above'] .ctx-pop-arrow { bottom:-7px; border-top:0; border-left:0; }
.ctx-pop[data-place='sheet'] .ctx-pop-arrow { display:none; }

.ctx-pop-head { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:11px 12px 8px 14px; }
.ctx-pop-head b { flex:0 0 auto; color:var(--ctx-accent); font-size:12px; font-weight:850; letter-spacing:.03em; }
.ctx-pop-head small { min-width:0; overflow:hidden; color:var(--rm-muted); font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.ctx-pop-close {
    width:30px;
    height:30px;
    display:grid;
    place-items:center;
    flex:0 0 auto;
    margin-left:auto;
    padding:0;
    border:1px solid rgba(126,169,204,.22);
    border-radius:9px;
    background:rgba(6,18,31,.8);
    color:#a9bccf;
    font:inherit;
    font-size:17px;
    line-height:1;
    cursor:pointer;
}
.ctx-pop-close:hover { border-color:rgba(126,169,204,.5); color:#e6eefa; }

.ctx-pop-body {
    min-height:0;
    flex:0 1 auto;
    display:grid;
    align-content:start;
    gap:8px;
    overflow-y:auto;
    padding:0 12px 14px;
    scrollbar-width:thin;
    overscroll-behavior:contain;
}
.ctx-pop-empty { grid-column:1 / -1; margin:4px 2px 6px; color:var(--rm-muted); font-size:12px; }
.ctx-pop--exile .ctx-pop-body { grid-template-columns:repeat(auto-fill,minmax(138px,1fr)); }

.ctx-choice {
    min-height:50px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:2px;
    padding:9px 13px;
    border:1px solid rgba(110,150,196,.2);
    border-radius:13px;
    background:rgba(7,19,33,.72);
    color:var(--text);
    font:inherit;
    text-align:left;
    cursor:pointer;
    transition:border-color .16s, background .16s;
}
.ctx-choice b { font-size:13px; font-weight:820; }
.ctx-choice small { color:var(--rm-muted); font-size:10.5px; font-weight:400; line-height:1.32; }
.ctx-choice:hover { border-color:color-mix(in srgb, var(--ctx-accent) 55%, transparent); background:rgba(12,28,46,.8); }
.ctx-choice.is-selected { border-color:var(--ctx-accent); background:var(--ctx-soft); }
.ctx-choice.is-selected b { color:var(--ctx-accent); }

.ctx-person {
    min-width:0;
    min-height:50px;
    display:flex;
    align-items:center;
    gap:9px;
    padding:7px 11px;
    border:1px solid rgba(110,150,196,.2);
    border-radius:13px;
    background:rgba(7,19,33,.72);
    color:var(--text);
    font:inherit;
    text-align:left;
    cursor:pointer;
    transition:border-color .16s, background .16s;
}
.ctx-person-face { width:32px; height:32px; flex:0 0 auto; object-fit:cover; object-position:center 18%; border:1px solid rgba(126,169,204,.24); border-radius:50%; background:#16283c; }
.ctx-person-name { min-width:0; flex:1; overflow:hidden; font-size:13px; font-weight:750; text-overflow:ellipsis; white-space:nowrap; }
.ctx-person-tag { flex:0 0 auto; color:var(--gold); font-size:12px; font-style:normal; }
.ctx-person:hover { border-color:color-mix(in srgb, var(--ctx-accent) 55%, transparent); background:rgba(12,28,46,.8); }
.ctx-person.is-selected { border-color:var(--ctx-accent); background:var(--ctx-soft); }

.ctx-pop-timer {
    position:absolute;
    right:0;
    bottom:0;
    left:0;
    height:3px;
    border-radius:0 0 17px 17px;
    background:linear-gradient(90deg,color-mix(in srgb, var(--ctx-accent) 85%, transparent),color-mix(in srgb, var(--ctx-accent) 35%, transparent));
    transform-origin:left center;
    animation-name:ctx-pop-countdown;
    animation-timing-function:linear;
    animation-fill-mode:forwards;
}
@keyframes ctx-pop-countdown {
    from { transform:scaleX(1); }
    to { transform:scaleX(0); }
}

@media (max-width:599px) {
    .match-screen { grid-template-rows:auto auto minmax(0,1fr) auto minmax(150px,31%); }
    .theme-card { grid-template-columns:auto minmax(0,1fr); grid-template-areas:"icon tally" "title title"; gap:7px 8px; padding:10px 11px; }
    .theme-card-icon { grid-area:icon; width:30px; height:30px; border-radius:10px; }
    .theme-card-icon svg { width:17px; height:17px; }
    .theme-card-title { grid-area:title; font-size:13px; letter-spacing:-.01em; }
    .theme-card-tally { grid-area:tally; justify-content:flex-end; }    .room-head {
        grid-template-columns:minmax(0,1fr) auto;
        gap:7px 10px;
        padding:max(8px,env(safe-area-inset-top)) 14px 0;
    }
    .room-role { grid-column:1; grid-row:1; }
    .room-clock { grid-column:2; grid-row:1; }
    .room-role b { font-size:14px; }
    .room-role small { display:block; font-size:10.5px; }
    .role-face { width:32px; height:32px; }
    .clock-ring { width:46px; height:46px; }
    .clock-ring b { font-size:14px; }
    .room-steps { min-height:12px; padding:6px 14px 2px; }

    .room-score {
        grid-column:1 / -1;
        grid-row:2;
        display:grid;
        grid-template-columns:minmax(0,1fr) auto;
        align-items:center;
        gap:3px 8px;
        padding:6px 12px 7px;
        border-radius:15px;
    }
    .score-phase { grid-column:1; grid-row:1; justify-self:start; font-size:10.5px; }
    .score-round { grid-column:2; grid-row:1; justify-self:end; font-size:10.5px; }
    .score-teams { grid-column:1 / -1; grid-row:2; align-items:center; justify-content:center; gap:10px; }

    .score-side { min-width:0; flex:1 1 0; display:grid; align-items:center; gap:0 9px; }
    .score-side.logic { grid-template-columns:minmax(0,1fr) auto; justify-items:end; }
    .score-side.logic small { grid-column:1; grid-row:1; align-self:end; }
    .score-side.logic b { grid-column:2; grid-row:1 / span 2; }
    .score-side.logic .score-bonus { grid-column:1; grid-row:2; align-self:start; }
    .score-side.intuition { grid-template-columns:auto minmax(0,1fr); justify-items:start; }
    .score-side.intuition small { grid-column:2; grid-row:1; align-self:end; }
    .score-side.intuition b { grid-column:1; grid-row:1 / span 2; }
    .score-side.intuition .score-bonus { grid-column:2; grid-row:2; align-self:start; }
    .score-side small { font-size:10.5px; }
    .score-side b { font-size:26px; line-height:1; }
    .score-split { font-size:16px; }
    .score-bonus {
        max-width:100%;
        overflow:hidden;
        margin-top:2px;
        padding:2px 8px;
        font-size:9.5px;
        text-overflow:ellipsis;
    }
    .score-bonus.is-pick { min-height:24px; padding:2px 10px; font-size:10px; }
}

@media (max-width:599px) {
    .ctx-pop {
        top:auto;
        right:calc(12px + var(--strip-w,0px));
        bottom:calc(12px + env(safe-area-inset-bottom));
        left:12px;
        width:auto;
    }
    .ctx-pop.is-placed { animation-name:ctx-sheet-in; }
    @keyframes ctx-sheet-in {
        from { opacity:0; transform:translateY(14px); }
        to { opacity:1; transform:none; }
    }
}

@media (max-width:599px) and (max-height:720px) {
    .match-screen { grid-template-rows:auto auto minmax(0,1fr) auto minmax(124px,25%); }
    .room-stage { gap:9px; }
    .quiz-options { gap:6px; margin-top:8px; }
    .rm-log { padding:8px 12px 6px; }
    .rm-log > .empty.compact { padding:2px 6px; font-size:12px; line-height:1.4; }
}

@media (max-width:420px) {
    .room-head { gap:7px 9px; padding-inline:12px; }
    .room-steps { padding-inline:12px; }
    .room-role b { font-size:13.5px; }
    .role-face { width:30px; height:30px; }
    .room-score { padding-inline:11px; }
    .score-teams { gap:8px; }
    .score-side { gap:0 7px; }
    .score-side b { font-size:23px; }
    .quiz-options { grid-template-columns:minmax(0,1fr); }
    .clock-ring { width:44px; height:44px; }
    .clock-ring b { font-size:13.5px; }
    .room-deck { margin-inline:12px; }
}

@media (max-width:380px) {
    .match-screen { --strip-w:60px; }
    .strip-face { width:28px; height:28px; }
    .strip-name { font-size:8px; }
    .strip-mark { min-width:15px; height:15px; font-size:8.5px; }
    .roster-strip-toggle { width:48px; }
    .roster-strip-toggle svg { width:16px; height:16px; }
    .room-steps { gap:12px; }
    .theme-card { gap:6px 8px; padding:9px 10px; }
    .theme-card-title { font-size:12.5px; }
    .rm-send { width:52px; min-width:52px; }
    .rm-emoji { width:44px; min-width:44px; height:46px; }
    .deck-row { flex-wrap:wrap; gap:7px; }
}

@media (min-width:600px) {
    .ctx-pop--exile { width:min(420px,calc(100% - 24px)); }
    .room-stage {
        margin:6px 24px 0;
        padding:20px 0;
        border:1px solid var(--rm-line);
        border-radius:22px;
        background:
            radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--rm-accent) 8%, transparent), transparent 52%),
            linear-gradient(170deg, rgba(13,27,45,.55), rgba(7,16,28,.62));
    }
    .theme-grid { grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
    .theme-card {
        grid-template-columns:minmax(0,1fr);
        justify-items:center;
        align-content:center;
        gap:9px;
        min-height:148px;
        padding:16px 10px;
        border-radius:18px;
        text-align:center;
    }
    .theme-card-icon { grid-row:auto; width:42px; height:42px; border-radius:13px; }
    .theme-card-icon svg { width:23px; height:23px; }
    .theme-card-title { font-size:14.5px; white-space:normal; }
    .theme-card-tally { grid-column:auto; flex-direction:column; gap:7px; }
    .theme-card-tally em { font-size:26px; }
    .theme-card-face { width:22px; height:22px; }
}

@media (min-width:600px) and (max-width:899px) {
    .match-screen { --strip-w:92px; grid-template-rows:auto auto minmax(0,1fr) auto minmax(240px,42%); }
    .strip-face { width:40px; height:40px; }
    .strip-name { font-size:10.5px; }
    .strip-mark { min-width:20px; height:20px; border-radius:7px; font-size:11px; }
    .strip-seat.is-captain .strip-avatar::after { font-size:13px; }
    .roster-strip-list { gap:9px; }
    .strip-group { gap:9px; }
    .roster-strip-toggle { width:64px; }
    .roster-strip-toggle svg { width:20px; height:20px; }
    .room-head { padding-inline:24px; }
    .room-steps { padding-inline:24px; }
    .role-face { width:38px; height:38px; }
    .room-role b { font-size:14.5px; }
    .score-phase { font-size:11px; }
    .score-side { min-width:74px; }
    .score-side b { font-size:26px; }
    .score-round { font-size:11px; }
    .stage-question,
    .stage-caption,
    .stage-idle,
    .deck-event,
    .room-deck,
    .room-stage .theme-grid,
    .room-stage .quiz-options,
    .match-screen .result { width:min(calc(100% - 48px),640px); margin-inline:auto; }
    .stage-question h2 { font-size:22px; }
    .rm-log { padding:16px max(18px,calc((100% - 660px)/2)) 12px; }
    .rm-form { padding-inline:max(18px,calc((100% - 680px)/2)); }
    .rm-tab.is-active::after { right:32%; left:32%; }
}

@media (min-width:900px) {
    .match-screen {
        max-width:1440px;
        margin:0 auto;
        grid-template-columns:minmax(0,1fr) minmax(300px,340px);
        grid-template-rows:auto auto minmax(0,1fr) auto minmax(240px,31vh);
    }
    .room-head { grid-column:1; padding:18px 30px 0; }
    .role-face { width:40px; height:40px; }
    .room-role b { font-size:15px; }
    .room-role small { font-size:11px; }
    .room-score { padding:8px 20px 6px; }
    .score-phase { font-size:11.5px; }
    .score-teams { gap:12px; }
    .score-side { min-width:84px; }
    .score-side small { font-size:10.5px; }
    .score-side b { font-size:28px; }
    .score-split { font-size:20px; }
    .score-bonus { font-size:9px; }
    .score-round { font-size:11.5px; }
    .clock-ring { width:52px; height:52px; }
    .clock-ring b { font-size:15.5px; }
    .room-steps { grid-column:1; padding:10px 30px 4px; }
    .room-stage { grid-column:1; margin:6px 30px 0; }
    .room-deck { grid-column:1; margin-block:10px 12px; }
    .room-chat { grid-column:1; padding:0 30px 18px; }
    .ctx-pop { width:min(380px,calc(100% - 24px)); }
    .ctx-pop--exile { width:min(430px,calc(100% - 24px)); }

    .stage-question,
    .stage-caption,
    .stage-idle,
    .deck-event,
    .room-deck,
    .room-stage .theme-grid,
    .room-stage .quiz-options,
    .match-screen .result { width:min(calc(100% - 60px),700px); margin-inline:auto; }
    .stage-question h2 { font-size:23px; }

    .roster-strip { display:none; }
    .roster-scrim { display:none; }
    .roster-rail {
        position:static;
        grid-column:2;
        grid-row:1 / 6;
        z-index:auto;
        width:auto;
        transform:none;
        transition:none;
        box-shadow:none;
    }
    .is-roster-open .roster-rail { transform:none; box-shadow:none; }
    .roster-head { padding:22px 16px 12px; }
    .roster-act.collapse { display:none; }
    .roster { scrollbar-width:thin; scrollbar-color:rgba(145,171,194,.22) transparent; }

    .rm-chat { border:1px solid var(--rm-line); border-radius:18px; box-shadow:none; }
    .rm-tabs { justify-content:flex-start; padding-inline:max(22px,calc((100% - 760px)/2)); }
    .rm-tab { flex:0 1 170px; }
    .rm-tab.is-active::after { right:20%; left:20%; }
    .rm-log { padding:16px max(22px,calc((100% - 760px)/2)) 12px; }
    .rm-form { padding:10px max(22px,calc((100% - 760px)/2)) 14px; }
}

@media (prefers-reduced-motion:reduce) {
    .roster-rail, .roster-scrim, .theme-card, .phase-dot { transition:none; }
    .assembly-countdown { animation:none; }
    .score-bonus.is-pick { animation:none; }
    .strip-avatar.is-actionable, .roster-portrait-act { animation:none; }
    .ctx-pop.is-placed { animation:none; }
    .ctx-pop-timer { animation-name:none; transform:scaleX(1); opacity:.35; }
}
