:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #646b78;
  --line: #dde1e7;
  --accent: #3b5bdb;
  --accent-soft: #dbe4ff;
  --mine: #2f9e44;
  --mine-soft: #d3f9d8;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #1a1d23;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2c313a;
    --accent: #7c95f5;
    --accent-soft: #26305a;
    --mine: #51cf66;
    --mine-soft: #1d3a24;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Pretendard Variable", Pretendard, system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:visited { color: var(--accent); }
a:not([class]):hover, a.muted:hover { text-decoration: underline; }
a.muted, a.muted:visited { color: var(--muted); }
a.muted:hover { color: var(--accent); }

main { max-width: 640px; margin: 0 auto; padding: 24px 16px 48px; }

h1 { font-size: 1.25rem; margin: 0 0 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.muted { color: var(--muted); font-size: 0.9rem; }

.code { font-size: 2.5rem; font-weight: 800; letter-spacing: 0.15em; font-variant-numeric: tabular-nums; }

button, input {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
}

button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button:disabled { opacity: 0.5; cursor: default; }

input { width: 100%; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack { display: grid; gap: 8px; }

.choice { width: 100%; text-align: left; padding: 14px 16px; font-size: 1.05rem; }
.choice.selected { border-color: var(--mine); background: var(--mine-soft); font-weight: 600; }

.bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(to right, var(--accent-soft) var(--share), transparent var(--share));
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.bar.mine { border-color: var(--mine); background: linear-gradient(to right, var(--mine-soft) var(--share), transparent var(--share)); }

.status { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); font-size: 0.85rem; }

.error { color: #e03131; min-height: 1.5em; margin: 0; }
.error:empty { display: none; }

select { font: inherit; border-radius: 8px; border: 1px solid var(--line); padding: 6px 10px; background: var(--surface); color: var(--text); }
label.row { gap: 6px; }
label.row input { width: auto; }
button.next { padding: 16px; font-size: 1.1rem; }

input.narrow { width: 5em; }

.bar.correct { border: 2px solid var(--mine); }
.bar.wrong { border-color: #e03131; background: linear-gradient(to right, rgba(224, 49, 49, 0.15) var(--share), transparent var(--share)); }
.bar.wrong span::after { content: " (내 선택)"; color: #e03131; }
.bar.correct span::after { content: " ✓ 정답"; color: var(--mine); font-weight: 700; }

.countdown { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.countdown.urgent { color: #e03131; }
body.screen .countdown { font-size: clamp(2.5rem, 6vw, 4.5rem); }

.verdict { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px; }
.verdict.correct { color: var(--mine); }

.options-preview { display: grid; gap: 8px; margin-bottom: 16px; }
body.screen .options-preview { font-size: clamp(1.3rem, 2.6vw, 2.2rem); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.leaderboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.leaderboard li { display: grid; grid-template-columns: 4em 1fr auto; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.leaderboard li.mine { border-color: var(--mine); background: var(--mine-soft); }
.leaderboard .rank { font-weight: 800; }
body.screen .leaderboard li { font-size: clamp(1.2rem, 2.4vw, 2rem); padding: 14px 24px; }

textarea { font: inherit; width: 100%; border-radius: 8px; border: 1px solid var(--line); padding: 10px 12px; background: var(--surface); color: var(--text); resize: vertical; }
button.small { padding: 4px 10px; font-size: 0.85rem; }

.messages { display: grid; gap: 8px; margin: 8px 0 12px; }
.message { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.message-text { white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.message-meta { display: flex; gap: 10px; align-items: center; margin-top: 6px; font-size: 0.9rem; }
.message-meta .muted { margin-right: auto; }
.hidden-message { opacity: 0.45; border-style: dashed; }
button.like { padding: 4px 10px; font-size: 0.9rem; border-radius: 999px; }
button.like.liked { border-color: #e64980; color: #e64980; font-weight: 700; }
.like-count { color: #e64980; font-weight: 700; }
body.screen .messages.wall { grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(320px, 28vw, 560px)), 1fr)); gap: 1.6vw; align-items: start; }
body.screen .message { font-size: clamp(1.3rem, 2vw, 2.4rem); line-height: 1.35; padding: 0.8em 1em; border-radius: 16px; }
body.screen .message-meta { font-size: 0.7em; margin-top: 0.6em; }
body.screen .like-count { font-size: 1.1em; }
body.screen .pin-badge { font-size: 0.6em; }
body.screen .screen-empty { font-size: clamp(1.4rem, 2.4vw, 2.6rem); color: var(--muted); text-align: center; padding: 10vh 0; }

button.enter { width: 100%; padding: 20px; font-size: 1.3rem; }
.big-verdict { font-size: 1.4rem; }
.winners { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.winners li { padding: 12px 16px; border-radius: 10px; border: 2px solid #f59f00; background: rgba(245, 159, 0, 0.12); font-weight: 700; }
.winners li.mine { border-color: var(--mine); background: var(--mine-soft); }
body.screen .winners li { font-size: clamp(1.8rem, 4vw, 3.2rem); padding: 18px 28px; text-align: center; }
.roller { text-align: center; }

.remote-qr { width: 220px; max-width: 100%; background: #fff; border-radius: 12px; padding: 10px; }

body.remote main { padding-bottom: 140px; }
.remote-header { margin-bottom: 12px; flex-wrap: wrap; }
.connection { color: #e03131; font-weight: 700; }
.next-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line);
}
.next-bar .error { min-height: 0; margin-bottom: 6px; }
.next-bar button.next { width: 100%; max-width: 640px; display: block; margin: 0 auto; padding: 20px; font-size: 1.2rem; border-radius: 14px; }

.runsheet { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }
.runsheet li > * { margin-right: 8px; }
.runsheet li.used { color: var(--muted); }
.runsheet button { padding: 4px 10px; font-size: 0.85rem; }

body.screen { font-size: clamp(16px, 1.4vw, 26px); min-height: 100vh; }
body.screen main { max-width: min(92vw, 1800px); padding: 3vh 0 4vh; }
body.screen .question { font-size: clamp(1.8rem, 3.6vw, 4rem); font-weight: 800; line-height: 1.25; margin: 0 0 3vh; word-break: keep-all; }
body.screen .bar { font-size: clamp(1.2rem, 2.2vw, 2.4rem); padding: 0.7em 1em; }
body.screen .big { font-size: clamp(4rem, 11vw, 10rem); font-weight: 800; line-height: 1; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
body.screen .muted { font-size: 1em; }

.screen-head { display: flex; align-items: center; gap: 2vw; padding: 1.6vh 4vw; border-bottom: 1px solid var(--line); background: var(--surface); }
.screen-event { flex: 1; min-width: 0; font-size: clamp(1rem, 1.6vw, 1.8rem); font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.join-chip { display: flex; align-items: center; gap: 1vw; }
.join-chip img { width: clamp(56px, 6vw, 110px); height: auto; background: #fff; border-radius: 8px; padding: 4px; }
.chip-label { font-size: 0.8em; color: var(--muted); }
.chip-code { font-size: clamp(1.6rem, 3vw, 3.2rem); font-weight: 800; line-height: 1; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.chip-count { padding-left: 1vw; border-left: 1px solid var(--line); color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.6rem); }
.chip-count strong { color: var(--text); font-size: 1.3em; }

.waiting { display: grid; gap: 4vh; justify-items: center; text-align: center; padding-top: 4vh; }
.waiting-title { margin: 0; font-size: clamp(2rem, 4.4vw, 5rem); font-weight: 800; line-height: 1.2; word-break: keep-all; }
.waiting-body { display: grid; grid-template-columns: auto auto; justify-content: center; gap: 5vw; align-items: center; padding-top: 2vh; }
.waiting img, .waiting-body img { width: clamp(220px, 28vw, 520px); background: #fff; border-radius: 16px; padding: 16px; }
.waiting-info { display: grid; gap: 2vh; text-align: left; }
.waiting-hint { margin: 0; font-size: clamp(1.2rem, 2vw, 2.4rem); color: var(--muted); line-height: 1.4; }
.waiting-count { margin: 0; font-size: clamp(1.2rem, 2vw, 2.4rem); }
.waiting-count strong { font-size: 1.4em; color: var(--accent); }
@media (max-width: 700px) { .waiting-body { grid-template-columns: 1fr; justify-items: center; } .waiting-info { text-align: center; } }
.screen-ended { display: grid; gap: 4vh; place-items: center; text-align: center; min-height: 70vh; }
.screen-message { font-size: clamp(1.2rem, 2.2vw, 2.4rem); text-align: center; color: var(--muted); margin-top: 20vh; }
.screen-message:empty { display: none; }

.admin-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.admin-bar .brand { font-weight: 800; color: var(--text); text-decoration: none; margin-right: auto; }
.narrow-page { max-width: 420px; padding-top: 72px; }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.event-list a { font-weight: 700; }
a.button-link { display: inline-block; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); text-decoration: none; background: var(--surface); }

.row.tight { gap: 4px; }
.small-text { font-size: 0.85rem; }
button.small.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.pin-badge { display: inline-block; font-size: 0.75rem; font-weight: 700; color: var(--accent); margin-right: 8px; }
.message.spotlit { border-color: #f59f00; box-shadow: 0 0 0 2px rgba(245, 159, 0, 0.35); }
.message.mine-message { border-color: var(--mine); }
.message.status-pending .message-meta .muted { color: #f08c00; font-weight: 700; }
.message.status-hidden { opacity: 0.6; }

.board-participant { display: grid; gap: 10px; padding-bottom: 150px; }
.board-tabs { display: flex; gap: 4px; position: sticky; top: 0; background: var(--surface); padding: 6px 0; z-index: 2; }
.board-tabs button { flex: 1; padding: 8px; border-radius: 999px; }
.board-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.new-banner { position: sticky; top: 52px; z-index: 3; justify-self: center; border-radius: 999px; background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; padding: 6px 16px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(16, 24, 40, 0.08); }
.composer > * { max-width: 608px; margin: 0 auto; width: 100%; }
.composer-row { display: flex; gap: 8px; align-items: stretch; }
.composer-row textarea { flex: 1; min-height: 52px; max-height: 120px; resize: none; border-radius: 14px; padding: 12px 14px; }
.composer-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-row button.send { flex: none; border-radius: 14px; padding: 0 16px; }
.composer-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; padding: 0 4px; font-size: 0.82rem; }
.composer-meta .remaining { color: var(--muted); }
.composer-meta .counter { margin-left: auto; font-variant-numeric: tabular-nums; }
.top-list { list-style: none; padding: 0; }

body.screen .wall .message.enter { animation: message-enter 0.6s ease-out; }
@keyframes message-enter { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
body.screen .wall-top { display: grid; gap: 1.2vh; }
body.screen .wall-top li { display: grid; grid-template-columns: 2.5em 1fr; align-items: center; gap: 1vw; }
body.screen .wall-top li:first-child .message { border: 3px solid #f59f00; }
body.screen .rank-number { font-size: clamp(1.6rem, 3vw, 2.6rem); font-weight: 800; text-align: center; color: var(--accent); }
body.screen .spotlight { display: grid; gap: 24px; place-items: center; text-align: center; padding: 6vh 4vw; border-radius: 24px; background: var(--surface); border: 3px solid #f59f00; }
body.screen .spotlight-text { font-size: clamp(2rem, 5vw, 4.2rem); font-weight: 800; line-height: 1.3; white-space: pre-wrap; word-break: break-word; }
body.screen .spotlight-meta { font-size: clamp(1.1rem, 2.2vw, 1.8rem); color: var(--muted); }

body.join main { padding-top: 16px; }
.join-head { position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; }
.join-event { max-width: 608px; margin: 0 auto; font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.join-meta { max-width: 608px; margin: 4px auto 0; display: flex; gap: 10px; align-items: center; font-size: 0.85rem; color: var(--muted); }
.join-meta strong { color: var(--text); }
.me-chip { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); font-weight: 600; }
.score-chip { margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--mine-soft); color: var(--text); font-weight: 700; }

.entry { display: grid; gap: 14px; text-align: center; padding-top: 10vh; }
.entry h1 { font-size: 1.5rem; margin: 0; }
.entry .muted { margin: 0; }
.brand-mark { font-weight: 800; color: var(--accent); letter-spacing: 0.04em; }
.entry input.code { text-align: center; font-size: 3rem; padding: 14px; letter-spacing: 0.3em; border-width: 2px; border-radius: 14px; }
.entry input.code:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
button.big-button { padding: 16px; font-size: 1.15rem; border-radius: 14px; }

.idle { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 18vh 16px 0; }
.idle-text { margin: 0; font-size: 1.4rem; font-weight: 800; }
.idle .muted { margin: 0; max-width: 22em; }
.idle-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: idle-pulse 1.6s ease-in-out infinite; }
.idle.ended .idle-dot { background: var(--mine); animation: none; }
@keyframes idle-pulse { 0%, 100% { opacity: 0.35; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.2); } }

.activity-card h1 { font-size: 1.3rem; line-height: 1.35; margin-bottom: 6px; word-break: keep-all; }
.activity-note { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }

.toast { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 20; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: #222831; color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); text-align: center; }

body.join .board-tabs { top: 64px; }
body.join .board-tabs button { padding: 10px; }
body.join .new-banner { top: 120px; }
body.join .message { padding: 12px 14px; border-radius: 12px; }
body.join button.like { min-width: 56px; min-height: 36px; padding: 6px 12px; }
body.join .choice { min-height: 52px; }

@property --share { syntax: "<percentage>"; inherits: true; initial-value: 0%; }
.bar.leader { border: 2px solid var(--accent); font-weight: 800; background: linear-gradient(to right, color-mix(in srgb, var(--accent) 30%, transparent) var(--share), transparent var(--share)); }
.total-line { color: var(--muted); text-align: right; margin: 4px 0 0; }

.choice { display: flex; align-items: center; gap: 12px; min-height: 56px; border-width: 2px; border-radius: 12px; }
.choice-no { flex: none; display: inline-grid; place-items: center; width: 1.9em; height: 1.9em; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 0.9em; }
.choice.selected .choice-no { background: var(--mine); color: #fff; }
.choice-label { flex: 1; }
.choices.answered .choice:not(.selected) { opacity: 0.45; }
.choices .choice.selected::after { content: "✓"; font-weight: 800; color: var(--mine); }
.choices .choice:disabled { cursor: default; opacity: 1; }
.choices.answered .choice:disabled:not(.selected) { opacity: 0.45; }

.option-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.option-card { display: flex; align-items: center; gap: 16px; padding: 0.7em 1em; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); font-size: clamp(1.3rem, 2.4vw, 2.6rem); font-weight: 700; }
.option-no { flex: none; display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.85em; }

.response-progress { margin-top: 4vh; display: grid; gap: 10px; }
.progress-text { font-size: clamp(1.1rem, 2vw, 2.2rem); color: var(--muted); display: flex; align-items: baseline; gap: 0.3em; }
.progress-text strong { font-size: 1.6em; color: var(--text); }
.progress-closed { margin-left: 0.6em; padding: 0.1em 0.7em; border-radius: 999px; background: var(--line); font-size: 0.7em; color: var(--text); }
.progress-track { height: clamp(10px, 1.2vh, 20px); border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: var(--share); background: var(--accent); border-radius: 999px; transition: width 0.6s ease-out; }

.quiz-stage { display: grid; grid-template-columns: auto 1fr; gap: 3vw; align-items: center; }
body.screen .quiz-stage .countdown { display: grid; place-items: center; width: clamp(120px, 14vw, 260px); aspect-ratio: 1; border-radius: 50%; border: clamp(6px, 0.7vw, 14px) solid var(--accent); font-size: clamp(2.4rem, 5vw, 5.5rem); margin: 0; }
body.screen .quiz-stage .countdown.urgent { border-color: #e03131; animation: urgent-pulse 1s ease-in-out infinite; }
@keyframes urgent-pulse { 50% { transform: scale(1.05); } }
@media (max-width: 700px) { .quiz-stage { grid-template-columns: 1fr; justify-items: center; } }

body.screen .bar { border-radius: 14px; animation: bar-fill 0.9s ease-out; }
body.screen .bar.correct { border-width: 3px; }
@keyframes bar-fill { from { --share: 0%; } }
body.screen .total-line { font-size: clamp(1rem, 1.6vw, 1.8rem); }

:root { --accent-2: #7048e8; --accent-grad: linear-gradient(135deg, #4263eb 0%, #7048e8 100%); --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05); --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 16px rgba(16, 24, 40, 0.06); }
@media (prefers-color-scheme: dark) { :root { --accent-grad: linear-gradient(135deg, #5c7cfa 0%, #9775fa 100%); --shadow-sm: none; --shadow: 0 1px 0 rgba(255, 255, 255, 0.03); } }

.icon { flex: none; vertical-align: -0.18em; }
[data-icon] > .icon { margin-right: 0.4em; }
[data-icon][aria-label] > .icon, .stat-icon > .icon, .type-icon > .icon, .hint-icon > .icon, .idle-badge > .icon { margin-right: 0; }
button[data-icon], a.button[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

.card { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--line) 70%, transparent); }
button.primary, a.button.primary { background: var(--accent-grad); border-color: transparent; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent); }
button.primary:hover:not(:disabled), a.button.primary:hover { filter: brightness(1.06); }
button:not(.primary):not(.danger):hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
button, a.button { transition: filter 0.15s, border-color 0.15s, background-color 0.15s; }

.brand-mark { justify-self: center; display: inline-flex; align-items: center; gap: 0.5em; font-size: 1.05rem; line-height: 1; }
.brand-mark > .icon { margin: 0; vertical-align: middle; }
.brand-mark .icon, .brand .icon { width: 1.9em; height: 1.9em; padding: 0.35em; border-radius: 0.6em; background: var(--accent-grad); color: #fff; stroke-width: 2.4; }

body.join { background: radial-gradient(1200px 380px at 50% -120px, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg); background-attachment: fixed; }
.join-head { backdrop-filter: saturate(1.4) blur(8px); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.join-meta [data-icon] .icon { width: 1em; height: 1em; }
.me-chip, .score-chip { display: inline-flex; align-items: center; }
.entry input.code { box-shadow: var(--shadow); }
.idle-badge { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); animation: idle-pulse 2s ease-in-out infinite; }
.idle-badge .icon { width: 30px; height: 30px; }
.idle.ended .idle-badge { background: var(--mine-soft); color: var(--mine); animation: none; }
.activity-card { border: 0; border-radius: 16px; box-shadow: var(--shadow); position: relative; }
.activity-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; border-radius: 16px 16px 0 0; background: var(--accent-grad); }

body.screen { background: radial-gradient(1600px 600px at 80% -200px, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%), var(--bg); }
.screen-head { box-shadow: var(--shadow-sm); }
.chip-count .icon { width: 1.1em; height: 1.1em; }
.waiting-title { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; padding-bottom: 0.08em; }
.waiting-hint { display: block; }
.hint-icon { display: inline-grid; place-items: center; width: 1.8em; height: 1.8em; margin-right: 0.4em; border-radius: 50%; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.waiting-count .icon { color: var(--accent); }
.waiting img, .waiting-body img, .join-chip img { box-shadow: var(--shadow); }
body.screen .message, .option-card { box-shadow: var(--shadow); border-color: transparent; }
.option-no, .choice-no { background: var(--accent-grad); color: #fff; }
.choice.selected .choice-no { background: var(--mine); }
.progress-fill { background: var(--accent-grad); }
.bar.leader { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
body.screen .spotlight { box-shadow: 0 20px 60px rgba(245, 159, 0, 0.25); }

.remote-header { display: grid; gap: 6px; margin-bottom: 12px; }
.remote-title { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; min-width: 0; }
.remote-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.remote-logo .icon { margin: 0; width: 1.7em; height: 1.7em; padding: 0.3em; border-radius: 0.5em; background: var(--accent-grad); color: #fff; }

.choices.closed:not(.answered) .choice:disabled { opacity: 0.5; background: var(--bg); }

.leaderboard li.medal { font-weight: 700; }
.leaderboard li.medal-1 { border-color: #f59f00; background: rgba(245, 159, 0, 0.12); }
.leaderboard li.medal-2 { border-color: #adb5bd; background: rgba(173, 181, 189, 0.15); }
.leaderboard li.medal-3 { border-color: #d9480f; background: rgba(217, 72, 15, 0.08); }
.leaderboard li.medal .rank { white-space: nowrap; }
.leaderboard li.medal-1 .rank .icon { color: #f59f00; }
.leaderboard li.medal-2 .rank .icon { color: #868e96; }
.leaderboard li.medal-3 .rank .icon { color: #d9480f; }
.leaderboard li.mine { border-color: var(--mine); background: var(--mine-soft); }
.leaderboard li { grid-template-columns: 4.5em 1fr auto; align-items: center; }
.my-rank { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px; margin-bottom: 12px; border-radius: 12px; background: var(--mine-soft); }
.my-rank strong { font-size: 1.6rem; }
.my-rank span:last-child { margin-left: auto; font-weight: 700; }
body.screen .leaderboard li.medal-1 { font-size: clamp(1.5rem, 3vw, 2.6rem); }

.lottery-stage { display: grid; justify-items: center; gap: 2.5vh; text-align: center; padding-top: 2vh; }
.gift-badge { display: grid; place-items: center; width: clamp(110px, 12vw, 200px); aspect-ratio: 1; border-radius: 50%; background: linear-gradient(135deg, #2b8a3e, #40c057); color: #fff; box-shadow: 0 16px 40px rgba(43, 138, 62, 0.3); animation: gift-bob 2.4s ease-in-out infinite; }
.gift-badge .icon { width: 50%; height: 50%; margin: 0; }
@keyframes gift-bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
.lottery-hint { margin: 0; font-size: clamp(1.4rem, 2.6vw, 3rem); font-weight: 700; }
.lottery-count { font-size: clamp(1.2rem, 2vw, 2.4rem); color: var(--muted); }
.lottery-count strong { font-size: 2.2em; color: var(--text); margin-right: 0.15em; }
.draw-result { display: grid; gap: 3vh; }
.celebrate { margin: 0; text-align: center; font-size: clamp(2rem, 4.5vw, 4.6rem); font-weight: 800; animation: celebrate-pop 0.6s ease-out; }
.celebrate span { background: linear-gradient(135deg, #f59f00, #e8590c); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes celebrate-pop { from { transform: scale(0.7); opacity: 0; } }
.join .celebrate { font-size: 1.4rem; }

body.screen main { display: flex; flex-direction: column; justify-content: center; min-height: calc(100vh - clamp(80px, 9vh, 140px)); }
body.screen main > #activity { width: 100%; }
body.screen .screen-head[hidden] + main { min-height: 100vh; }

.similar { margin-top: 6px; font-size: 0.88rem; }
.similar summary { display: inline-block; cursor: pointer; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; list-style: none; }
.similar summary::-webkit-details-marker { display: none; }
.similar ul { margin: 8px 0 0; padding-left: 1.1em; display: grid; gap: 4px; color: var(--text); }
.similar-badge { display: inline-flex; align-items: center; margin-top: 6px; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.8em; font-weight: 700; }
body.screen .similar-badge { font-size: 0.72em; padding: 0.15em 0.7em; }

.segmented { display: inline-flex; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.segmented button { flex: none; border: 0; border-radius: 0; padding: 8px 14px; font-weight: 600; white-space: nowrap; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.active { background: var(--accent); color: #fff; }
.segmented button:disabled { opacity: 0.4; }
.bar:last-child { margin-bottom: 0; }
.board-host { display: grid; gap: 12px; }
.board-host > .row { gap: 10px; }
.login-card { gap: 14px; padding: 28px 24px; }
.login-card h1 { margin: 0 0 4px; text-align: center; }
.login-card label.stack { gap: 6px; font-weight: 600; font-size: 0.92rem; }
.entry-admin { margin-top: 24px; font-size: 0.85rem; }
