@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  --bg-1: #0a1631;
  --bg-2: #112a5c;
  --bg-3: #1d4f9c;
  --ink: #1b1036;
  --ink-soft: #5b5470;
  --paper: #ffffff;
  --paper-2: #f4f1fb;
  --line: #e4def3;
  --accent: #ffcc00;
  --accent-ink: #3a2a00;
  --primary: #2f6bff;
  --primary-dark: #1c4fd0;
  --coral: #f05a4f;
  --teal: #0b9f9a;
  --amber: #e08e00;
  --violet: #7a55f0;
  --ok: #2fb344;
  --bad: #e5384f;
  --radius: 14px;
  --shadow: 0 6px 0 rgba(0, 0, 0, .18);
  --shadow-soft: 0 10px 30px rgba(20, 0, 60, .18);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-1);
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .08) 0 8%, transparent 8.2%),
    radial-gradient(circle at 85% 75%, rgba(255, 255, 255, .06) 0 12%, transparent 12.2%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ───── 공통 컴포넌트 ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 12px 20px;
  font-weight: 800; font-size: 16px; line-height: 1;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
  transition: transform .08s, box-shadow .08s, filter .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .2); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn-accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 #b88f00; }
.btn-dark { background: #1b1036; color: #fff; box-shadow: 0 4px 0 #000; }
.btn-ghost { background: var(--paper-2); box-shadow: none; }
.btn-ghost:active { transform: none; }
.btn-ghost.danger { color: var(--bad); }
.btn-lg { padding: 16px 28px; font-size: 20px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px 12px; }

.card {
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 900; letter-spacing: -.02em; color: #fff; text-decoration: none;
}
.logo-mark {
  display: inline-grid; place-items: center;
  width: 1.6em; height: 1.6em; border-radius: .45em;
  background: var(--accent); color: var(--accent-ink);
  transform: rotate(-8deg); box-shadow: 0 3px 0 #b88f00;
}

#toasts {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  display: grid; gap: 8px; z-index: 1000; width: min(92vw, 420px);
}
.toast {
  padding: 12px 16px; border-radius: 10px; background: #1b1036; color: #fff;
  font-weight: 700; box-shadow: var(--shadow-soft); text-align: center;
  animation: toast-in .25s ease-out; transition: opacity .3s, transform .3s;
}
.toast-error { background: var(--bad); }
.toast-ok { background: var(--ok); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

.shape { width: 1em; height: 1em; flex: none; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .2)); }
.ans-coral { --c: var(--coral); }
.ans-teal { --c: var(--teal); }
.ans-amber { --c: var(--amber); }
.ans-violet { --c: var(--violet); }

/* 보기 번호 (색을 구분하기 어려운 사람도 "2번"으로 말할 수 있게) */
.answer-tile[data-n], .p-answer[data-n] { position: relative; }
.answer-tile[data-n]::after, .p-answer[data-n]::after {
  content: attr(data-n); position: absolute; top: 8px; right: 10px;
  width: 1.7em; height: 1.7em; display: grid; place-items: center; border-radius: 999px;
  background: rgba(0, 0, 0, .2); color: #fff; font-size: 14px; font-weight: 900;
}

/* ───── 랜딩 ───── */
.landing {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
}
.landing-inner { width: min(100%, 980px); display: grid; gap: 28px; text-align: center; color: #fff; }
.landing .logo { font-size: clamp(40px, 8vw, 72px); justify-content: center; }
.landing-sub { font-size: clamp(16px, 2.4vw, 20px); opacity: .85; margin: -8px 0 0; }
.landing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; text-align: left; }
.landing-card { padding: 28px; color: var(--ink); display: grid; gap: 14px; align-content: start; }
.landing-card h2 { margin: 0; font-size: 24px; }
.landing-card p { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.landing-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; font-weight: 700; opacity: .85; }

/* ───── 입력 ───── */
.field {
  width: 100%; padding: 14px 16px; border-radius: 10px;
  border: 2px solid var(--line); background: #fff; font-size: 18px; font-weight: 700;
  outline: none; transition: border-color .15s;
}
.field:focus { border-color: var(--primary); }
.field-center { text-align: center; }

/* ───── 진행자: 상단바 ───── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 3vw, 32px); color: #fff;
}
.topbar .logo { font-size: 24px; }
.topbar .spacer { flex: 1; }
.topbar-title { font-weight: 700; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-chip {
  background: #fff; color: var(--ink); border-radius: 999px; padding: 6px 14px;
  font-weight: 900; font-size: 15px; white-space: nowrap;
}
.pin-chip small { font-weight: 700; color: var(--ink-soft); margin-right: 4px; }
.icon-btn {
  border: 0; background: rgba(255, 255, 255, .15); color: #fff; border-radius: 10px;
  padding: 8px 12px; font-weight: 700; white-space: nowrap;
}
.icon-btn:hover { background: rgba(255, 255, 255, .25); }

.host-main { padding: 0 clamp(16px, 3vw, 32px) 32px; }

/* ───── 라이브러리 ───── */
.library-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; color: #fff; margin: 12px 0 24px; }
.library-head h1 { margin: 0; font-size: clamp(26px, 4vw, 36px); }
.library-head p { margin: 6px 0 0; opacity: .8; }
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.quiz-card { overflow: hidden; display: flex; flex-direction: column; }
.quiz-card-cover {
  height: 110px; padding: 14px; display: flex; align-items: start; justify-content: space-between;
  background: linear-gradient(135deg, var(--c1, #2f6bff), var(--c2, #0b9f9a));
  color: #fff; font-size: 42px;
}
.quiz-card-cover .badge {
  font-size: 13px; font-weight: 800; background: rgba(0, 0, 0, .3); padding: 5px 10px; border-radius: 999px;
}
.quiz-card-body { padding: 16px 18px 18px; display: grid; gap: 6px; flex: 1; }
.quiz-card-body h3 { margin: 0; font-size: 19px; }
.quiz-card-body p { margin: 0; color: var(--ink-soft); font-size: 14px; min-height: 1.4em; }
.quiz-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.quiz-card-actions .btn-primary { flex: 1; }
.empty { color: #fff; opacity: .85; padding: 40px; text-align: center; grid-column: 1 / -1; font-size: 18px; }

/* ───── 에디터 ───── */
.editor { display: grid; gap: 16px; }
.editor-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.editor-head .field { flex: 1 1 300px; }
.editor-body { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.q-sidebar { padding: 12px; display: grid; gap: 10px; position: sticky; top: 12px; }
.q-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.q-item {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px;
  background: var(--paper-2); cursor: pointer; border: 2px solid transparent;
}
.q-item.active { border-color: var(--primary); background: #e8efff; }
.q-num {
  flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 14px;
}
.q-item-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.q-item-text em { color: var(--ink-soft); font-weight: 500; }
.q-item-type { font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.q-panel { padding: 20px; display: grid; gap: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-tools { display: flex; gap: 6px; }
.panel-tools button { border: 0; background: var(--paper-2); border-radius: 8px; padding: 8px 10px; font-weight: 700; }
.panel-tools button:hover { background: var(--line); }
.panel-tools .danger { color: var(--bad); }
.q-text {
  width: 100%; min-height: 96px; resize: vertical; padding: 16px; border-radius: 12px;
  border: 2px solid var(--line); font-size: 22px; font-weight: 700; text-align: center; outline: none;
}
.q-text:focus { border-color: var(--primary); }
.opt-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.seg { display: inline-flex; background: var(--paper-2); border-radius: 10px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 800; color: var(--ink-soft); }
.seg button.on { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.opt-row label { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-soft); }
.opt-row select { padding: 8px 10px; border-radius: 8px; border: 2px solid var(--line); font-weight: 700; background: #fff; }
.image-box {
  border: 2px dashed var(--line); border-radius: 12px; padding: 14px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
}
.image-box img { max-height: 200px; max-width: 100%; border-radius: 8px; }
.image-box .field { flex: 1 1 240px; font-size: 14px; padding: 10px 12px; }
.choice-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-edit {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--c); color: #fff; min-height: 64px;
}
.choice-edit .shape { font-size: 26px; }
.choice-edit input {
  flex: 1; min-width: 0; border: 0; background: rgba(255, 255, 255, .18); color: #fff;
  border-radius: 8px; padding: 10px; font-weight: 700; font-size: 16px; outline: none;
}
.choice-edit input::placeholder { color: rgba(255, 255, 255, .7); }
.choice-edit input:focus { background: rgba(255, 255, 255, .28); }
.correct-toggle {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff;
  background: transparent; color: transparent; font-weight: 900; font-size: 18px;
}
.correct-toggle.on { background: #fff; color: var(--ok); }
.choice-edit.ox { justify-content: center; font-size: 22px; font-weight: 900; cursor: pointer; min-height: 120px; flex-direction: column; }
.choice-edit.ox .shape { font-size: 56px; }
.choice-edit.ox.off { opacity: .45; }
.hint { margin: 0; color: var(--ink-soft); font-size: 14px; }

/* ───── 진행자: 게임 공통 ───── */
.stage {
  min-height: calc(100vh - 70px); display: flex; flex-direction: column;
  padding: 0 clamp(16px, 3vw, 40px) clamp(16px, 3vh, 32px); gap: clamp(12px, 2vh, 24px);
  color: #fff;
}
.stage-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* 로비 */
.lobby-join {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center;
  padding: clamp(16px, 2.5vw, 28px); color: var(--ink);
}
.lobby-join-text { display: grid; gap: 10px; }
.lobby-join-step { font-size: clamp(16px, 1.8vw, 22px); font-weight: 700; color: var(--ink-soft); }
.lobby-join-step b { color: var(--ink); }
.lobby-url { font-size: clamp(20px, 2.6vw, 34px); font-weight: 900; color: var(--primary); }
.lobby-pin-label { font-size: clamp(16px, 1.6vw, 20px); font-weight: 800; color: var(--ink-soft); margin-top: 8px; }
.lobby-pin { font-size: clamp(56px, 9vw, 120px); font-weight: 900; letter-spacing: .04em; line-height: 1; }
.lobby-qr { width: clamp(150px, 18vw, 260px); aspect-ratio: 1; border-radius: 12px; }
.lobby-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lobby-count {
  display: inline-flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .3);
  padding: 10px 18px; border-radius: 12px; font-size: 22px; font-weight: 900;
}
.lobby-bar .spacer { flex: 1; }
.player-cloud { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-content: flex-start; flex: 1; padding: 8px 0; }
.player-chip {
  display: inline-flex; align-items: center; gap: 8px; background: #fff; color: var(--ink);
  padding: 8px 16px 8px 10px; border-radius: 999px; font-weight: 800; font-size: clamp(16px, 1.6vw, 22px);
  border: 0; animation: chip-in .35s cubic-bezier(.3, 1.6, .5, 1); box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}
.player-chip .av { font-size: 1.3em; }
.player-chip.off { opacity: .45; }
.player-chip:hover { text-decoration: line-through; }
.waiting-text { text-align: center; font-size: 22px; font-weight: 700; opacity: .8; margin: auto; }
.waiting-text .dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
@keyframes chip-in { from { transform: scale(.3); opacity: 0; } }

/* 문제 소개 */
.intro { flex: 1; display: grid; place-items: center; text-align: center; align-content: center; gap: 28px; }
.intro-num { font-size: clamp(22px, 2.4vw, 32px); font-weight: 900; background: rgba(0, 0, 0, .25); padding: 8px 22px; border-radius: 999px; }
.intro-text {
  background: #fff; color: var(--ink); padding: clamp(24px, 4vw, 48px); border-radius: 18px;
  font-size: clamp(30px, 4.4vw, 64px); font-weight: 900; line-height: 1.25; max-width: 1400px;
  box-shadow: var(--shadow); animation: pop-in .5s cubic-bezier(.3, 1.5, .5, 1);
}
.intro-meta { display: flex; gap: 10px; }
.tag { background: rgba(255, 255, 255, .2); padding: 6px 14px; border-radius: 999px; font-weight: 800; }
.tag-hot { background: var(--accent); color: var(--accent-ink); }
.progress { width: min(600px, 80%); height: 12px; border-radius: 99px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: #fff; border-radius: inherit; transform-origin: left; }
@keyframes pop-in { from { transform: scale(.8); opacity: 0; } }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* 문제 진행 */
.q-head {
  background: #fff; color: var(--ink); border-radius: 14px; padding: clamp(14px, 2vw, 24px);
  font-size: clamp(24px, 3vw, 44px); font-weight: 900; text-align: center; line-height: 1.25; box-shadow: var(--shadow);
}
.q-middle { flex: 1; display: grid; grid-template-columns: 1fr minmax(0, 3fr) 1fr; align-items: center; gap: 16px; min-height: 0; }
.q-media { display: grid; place-items: center; height: 100%; min-height: 0; }
.q-media img { max-width: 100%; max-height: 38vh; border-radius: 12px; box-shadow: var(--shadow-soft); background: #fff; }
.q-media .q-progress-text { font-size: clamp(20px, 2vw, 28px); font-weight: 900; opacity: .7; }
.timer { position: relative; width: clamp(100px, 11vw, 160px); aspect-ratio: 1; justify-self: center; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 10; }
.timer .track { stroke: rgba(255, 255, 255, .2); }
.timer .bar { stroke: #fff; stroke-linecap: round; transition: stroke .3s; }
.timer.hurry .bar { stroke: var(--accent); }
.timer-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(36px, 4.4vw, 64px); font-weight: 900;
}
.timer.hurry .timer-num { color: var(--accent); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.answer-count { justify-self: center; text-align: center; font-weight: 900; }
.answer-count b { display: block; font-size: clamp(40px, 4.4vw, 64px); line-height: 1; }
.answer-count span { opacity: .8; font-size: clamp(14px, 1.4vw, 20px); }

.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 1vw, 14px); }
.answer-tile {
  display: flex; align-items: center; gap: clamp(12px, 1.4vw, 20px);
  background: var(--c); color: #fff; border-radius: 12px; padding: clamp(14px, 1.8vw, 24px);
  font-size: clamp(20px, 2.4vw, 34px); font-weight: 800; min-height: clamp(70px, 11vh, 120px);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .25); transition: opacity .3s, transform .3s;
}
.answer-tile .shape { font-size: clamp(30px, 3vw, 48px); }
.answer-tile .label { flex: 1; text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.answer-tile .mark { font-size: 1.2em; }
.answer-grid.ox .answer-tile { justify-content: center; min-height: clamp(110px, 20vh, 220px); }
.answer-grid.ox .answer-tile .shape { font-size: clamp(60px, 8vw, 120px); }
.answer-grid.ox .answer-tile .label { display: none; }
.answer-grid.revealed .answer-tile.wrong { opacity: .3; }
.answer-grid.revealed .answer-tile.right { transform: scale(1.02); }

/* 결과 차트 */
.chart { flex: none; height: clamp(200px, 38vh, 420px); display: flex; justify-content: center; align-items: stretch; gap: clamp(16px, 3vw, 48px); padding-top: 12px; margin-top: auto; }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 8px; width: clamp(80px, 12vw, 170px); height: 100%; justify-content: flex-end; }
.chart-track { flex: 1; width: 100%; display: flex; align-items: flex-end; min-height: 0; }
.chart-count { font-size: clamp(22px, 2.4vw, 34px); font-weight: 900; display: flex; align-items: center; gap: 6px; }
.chart-bar {
  width: 100%; background: var(--c); border-radius: 10px 10px 0 0; min-height: 10px;
  transform-origin: bottom; animation: grow-up .7s cubic-bezier(.2, .9, .3, 1.1) both;
}
.chart-col.wrong .chart-bar, .chart-col.wrong .chart-foot { opacity: .35; }
.chart-foot {
  width: 100%; display: grid; place-items: center; background: var(--c); border-radius: 0 0 10px 10px;
  padding: 8px; font-size: clamp(22px, 2.2vw, 32px);
}
@keyframes grow-up { from { transform: scaleY(0); } }

/* 순위표 */
.board-title { text-align: center; font-size: clamp(32px, 4vw, 56px); font-weight: 900; margin: 0; }
.board { display: grid; gap: 12px; width: min(960px, 100%); margin: 0 auto; }
.board-row {
  display: grid; grid-template-columns: 60px auto 1fr auto auto; align-items: center; gap: 16px;
  background: #fff; color: var(--ink); border-radius: 12px; padding: 14px 22px;
  font-size: clamp(20px, 2.2vw, 30px); font-weight: 900; box-shadow: var(--shadow);
  animation: slide-in .5s cubic-bezier(.2, .9, .3, 1.2) both;
}
.board-row:nth-child(1) { background: var(--accent); }
.board-row .rank { font-size: 1.1em; text-align: center; }
.board-row .av { font-size: 1.3em; }
.board-row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .move { font-size: .65em; min-width: 3em; text-align: right; }
.move.up { color: var(--ok); }
.move.down { color: var(--bad); }
@keyframes slide-in { from { transform: translateX(-40px); opacity: 0; } }

/* 시상대 */
.podium-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 24px; min-height: 0; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 1.5vw, 20px); padding-top: 20px; }
.podium-col { display: flex; flex-direction: column; align-items: center; width: clamp(110px, 14vw, 220px); }
.podium-player { text-align: center; margin-bottom: 10px; animation: pop-in .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.podium-player .av { font-size: clamp(48px, 5vw, 80px); display: block; }
.podium-player .name { font-weight: 900; font-size: clamp(18px, 1.8vw, 28px); display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-player .pts { font-weight: 700; opacity: .85; }
.podium-block {
  width: 100%; border-radius: 12px 12px 0 0; display: grid; place-items: start center; padding-top: 14px;
  font-size: clamp(40px, 5vw, 80px); font-weight: 900; color: rgba(0, 0, 0, .35);
  transform-origin: bottom; animation: grow-up .8s cubic-bezier(.2, .9, .3, 1.1) both;
}
.podium-col.p1 .podium-block { height: 42vh; background: linear-gradient(#ffe066, #ffcc00); }
.podium-col.p2 .podium-block { height: 30vh; background: linear-gradient(#f1f1f5, #c9c9d6); }
.podium-col.p3 .podium-block { height: 22vh; background: linear-gradient(#f2b27c, #d98a4a); }
.podium-col.p2 .podium-player, .podium-col.p2 .podium-block { animation-delay: .9s; }
.podium-col.p3 .podium-player, .podium-col.p3 .podium-block { animation-delay: .3s; }
.podium-col.p1 .podium-player, .podium-col.p1 .podium-block { animation-delay: 1.6s; }
.podium-col.p1 .crown { font-size: clamp(32px, 3vw, 48px); display: block; animation: bob 1s infinite alternate; }
@keyframes bob { to { transform: translateY(-6px); } }
.final-list { align-self: start; padding: 16px; color: var(--ink); display: flex; flex-direction: column; gap: 10px; min-height: 0; max-height: 70vh; }
.final-list h3 { margin: 0; }
.final-list ol { list-style: none; margin: 0; padding: 0; overflow: auto; display: grid; gap: 4px; }
.final-list li { display: grid; grid-template-columns: 40px auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--paper-2); font-weight: 700; }
.final-list li .r { font-weight: 900; color: var(--primary); text-align: center; }
.final-list li .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final-list li .s { font-variant-numeric: tabular-nums; }
.final-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ───── 참가자 (휴대폰) ───── */
.player-app { min-height: 100%; display: flex; flex-direction: column; color: #fff; }
.p-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-weight: 800; gap: 12px; }
.p-top .logo { font-size: 20px; }
.p-top .p-qnum { background: rgba(0, 0, 0, .25); padding: 6px 12px; border-radius: 999px; font-size: 14px; }
.p-main { flex: 1; display: flex; flex-direction: column; padding: 0 16px 16px; min-height: 0; }
.p-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; }
.p-bottom {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #fff; color: var(--ink); font-weight: 800;
}
.p-bottom .av { font-size: 24px; }
.p-bottom .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-bottom .score { background: var(--ink); color: #fff; padding: 6px 12px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.join-card { width: min(100%, 380px); padding: 20px; display: grid; gap: 12px; color: var(--ink); }
.join-card h2 { margin: 0; font-size: 18px; color: var(--ink-soft); font-weight: 700; }
.join-card .quiz-name { font-size: 22px; font-weight: 900; color: var(--ink); }
.join-logo { font-size: 44px; }
.big-emoji { font-size: 84px; line-height: 1; animation: bob 1s infinite alternate; }
.p-title { font-size: 26px; font-weight: 900; margin: 0; line-height: 1.3; }
.p-sub { font-size: 17px; opacity: .85; margin: 0; line-height: 1.5; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.p-question-text {
  background: #fff; color: var(--ink); border-radius: 12px; padding: 14px; text-align: center;
  font-weight: 800; font-size: 17px; line-height: 1.35; margin-bottom: 12px;
}
.p-timer-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .2); overflow: hidden; margin-bottom: 12px; }
.p-timer-bar > i { display: block; height: 100%; background: #fff; transform-origin: left; }
.p-answers { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 0; }
.p-answers.ox { grid-template-columns: 1fr; }
.p-answers.n2:not(.ox) { grid-template-columns: 1fr; }
.p-answer {
  border: 0; border-radius: 14px; background: var(--c); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; font-weight: 800; font-size: 17px; min-height: 110px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .25); transition: transform .08s, box-shadow .08s, opacity .2s;
}
.p-answer .shape { font-size: 52px; }
.p-answers.ox .p-answer .shape { font-size: 96px; }
.p-answers.ox .p-answer .label { display: none; }
.p-answer:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.p-answer:disabled { opacity: .35; }
.p-answer.picked { opacity: 1; outline: 5px solid #fff; }

.p-result { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 16px; }
.result-good { background: linear-gradient(160deg, #3ccf5b, #1c8a33); }
.result-bad { background: linear-gradient(160deg, #f0566a, #b3192f); }
.result-none { background: linear-gradient(160deg, #6a6385, #3a3352); }
.result-icon {
  width: 110px; height: 110px; border-radius: 50%; background: #fff; display: grid; place-items: center;
  font-size: 64px; font-weight: 900; animation: pop-in .5s cubic-bezier(.3, 1.6, .5, 1);
}
.result-good .result-icon { color: var(--ok); }
.result-bad .result-icon { color: var(--bad); }
.result-none .result-icon { color: #6a6385; }
.result-points { background: rgba(0, 0, 0, .25); padding: 10px 22px; border-radius: 12px; font-size: 26px; font-weight: 900; }
.result-streak { font-weight: 800; font-size: 18px; }
.result-rank { font-size: 20px; font-weight: 800; }
.result-rank b { font-size: 34px; }
.result-ahead { font-size: 16px; opacity: .9; background: rgba(255, 255, 255, .15); padding: 10px 16px; border-radius: 10px; }
.result-answer { font-size: 15px; opacity: .9; }

.end-rank { font-size: 64px; font-weight: 900; line-height: 1; }
.end-medal { font-size: 96px; line-height: 1; }
.end-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.end-stats div { background: rgba(0, 0, 0, .25); padding: 12px 16px; border-radius: 12px; font-weight: 700; }
.end-stats b { display: block; font-size: 24px; }


/* ───── 문제 유형 확장 ───── */
.library-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.notice {
  background: #fff8db; color: #5a4500; border-radius: 12px; padding: 14px 18px; font-weight: 600; line-height: 1.5;
}
.notice ul { margin: 8px 0 0; padding-left: 20px; font-weight: 500; font-size: 14px; }
.field-row { display: grid; gap: 6px; font-weight: 700; color: var(--ink-soft); }
.field-row .field { font-size: 16px; padding: 12px 14px; }
.field-row select { justify-self: start; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--line); font-weight: 700; background: #fff; }
.tag-muted { font-weight: 700; color: var(--ink-soft); background: var(--paper-2); padding: 6px 12px; border-radius: 999px; font-size: 14px; }

.answer-area { display: grid; gap: 14px; min-height: 0; }
.area-callout {
  text-align: center; font-size: clamp(18px, 2vw, 28px); font-weight: 800;
  background: rgba(0, 0, 0, .22); border-radius: 14px; padding: 14px 18px;
}
.area-callout.big { font-size: clamp(24px, 3vw, 44px); padding: clamp(24px, 4vh, 48px); }
.initial-hint { display: flex; justify-content: center; gap: clamp(8px, 1.2vw, 18px); }
.initial-hint span {
  display: grid; place-items: center; width: clamp(64px, 8vw, 120px); aspect-ratio: 1;
  background: #fff; color: var(--primary); border-radius: 18px; box-shadow: var(--shadow);
  font-size: clamp(40px, 5.4vw, 84px); font-weight: 900;
}
.live-board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; align-content: start;
  max-height: 34vh; overflow: auto; padding: 2px;
}
.live-board.tall { max-height: 56vh; }
.opinion { background: #fff; color: var(--ink); border-radius: 12px; padding: 12px 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, .15); animation: chip-in .3s ease-out; }
.opinion-who { font-size: 13px; font-weight: 800; color: var(--ink-soft); margin-bottom: 4px; }
.opinion p { margin: 0; font-weight: 700; font-size: clamp(15px, 1.4vw, 20px); line-height: 1.4; }
.word-cloud {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; align-content: center;
  gap: 6px 22px; min-height: 30vh; padding: 12px; background: rgba(0, 0, 0, .18); border-radius: 18px;
}
.word-cloud.tall { min-height: 52vh; }
.cloud-word { font-weight: 900; line-height: 1.1; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); animation: chip-in .35s ease-out; }
.live-empty { opacity: .7; font-weight: 700; font-size: 20px; text-align: center; grid-column: 1 / -1; padding: 20px; }

.reveal { flex: 1; display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.answer-reveal {
  align-self: center; display: grid; justify-items: center; gap: 8px; text-align: center;
  background: #fff; color: var(--ink); border-radius: 18px; padding: 20px 36px; box-shadow: var(--shadow);
  animation: pop-in .5s cubic-bezier(.3, 1.5, .5, 1);
}
.answer-reveal small { font-weight: 800; color: var(--ok); font-size: 18px; }
.answer-reveal b { font-size: clamp(30px, 4vw, 60px); line-height: 1.2; }
.reveal-stat { font-weight: 700; color: var(--ink-soft); font-size: clamp(15px, 1.4vw, 20px); }
.top-answers { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.answer-chip { padding: 10px 16px; border-radius: 999px; font-weight: 800; font-size: clamp(16px, 1.6vw, 22px); background: rgba(255, 255, 255, .15); }
.answer-chip.ok { background: var(--ok); }
.answer-chip b { margin-left: 6px; background: rgba(0, 0, 0, .25); padding: 2px 10px; border-radius: 999px; }
.order-reveal { display: grid; gap: 10px; width: min(900px, 100%); margin: 0 auto; }
.order-reveal .answer-tile { min-height: 64px; animation: slide-in .5s both; }
.order-num {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: #fff; color: var(--ink); font-weight: 900; flex: none;
}

.slide { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; text-align: center; }
.slide-text {
  background: #fff; color: var(--ink); border-radius: 18px; padding: clamp(24px, 3.4vw, 44px);
  font-size: clamp(26px, 3.4vw, 52px); font-weight: 800; line-height: 1.35; max-width: 1400px;
  white-space: pre-line; box-shadow: var(--shadow);
}
.slide-media { width: min(1100px, 100%); display: grid; place-items: center; }
.slide-media iframe, .slide-media video { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; background: #000; }
.slide-media img { max-width: 100%; max-height: 50vh; border-radius: 14px; }
.q-head, .intro-text, .p-question-text, .p-sub { white-space: pre-line; }

/* 참가자 입력형 */
.p-form { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.p-input-card { padding: 16px; display: grid; gap: 10px; color: var(--ink); }
.p-input-card textarea { resize: none; font-size: 17px; }
.p-initial { text-align: center; font-size: 48px; font-weight: 900; letter-spacing: .2em; color: var(--primary); }
.p-input-help { margin: 0; font-weight: 700; color: var(--ink-soft); text-align: center; }
.p-order { grid-template-rows: 1fr 1fr auto; }
.p-order .p-answer { position: relative; }
.order-badge {
  position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--ink); font-weight: 900; font-size: 18px;
}
.order-badge:empty { display: none; }
.p-order-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; background: #fff; color: var(--ink); border-radius: 12px; padding: 8px 8px 8px 14px; font-weight: 800; }
.p-order-bar span { flex: 1; min-width: 0; }
.locked-summary { display: inline-block; background: #fff; color: var(--ink); border-radius: 16px; padding: 14px 20px; font-size: 22px; font-weight: 800; max-width: 90vw; word-break: break-all; }


/* ───── 사이트 공통 (랜딩 · 로그인 · 요금제 · 계정 · 약관) ───── */
body.site { display: flex; flex-direction: column; min-height: 100%; }
body.site > main { flex: 1; }
.site-header {
  display: flex; align-items: center; gap: 16px; padding: 14px clamp(16px, 4vw, 40px); color: #fff;
}
.site-header .logo { font-size: 24px; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px clamp(8px, 2vw, 20px); flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { color: #fff; text-decoration: none; font-weight: 700; opacity: .9; }
.site-nav a:hover { opacity: 1; text-decoration: underline; }
.site-nav .nav-login { padding: 9px 16px; font-size: 15px; opacity: 1; color: var(--accent-ink); }
.site-nav .nav-login:hover { text-decoration: none; }
.nav-account { background: rgba(255, 255, 255, .14); padding: 7px 12px; border-radius: 999px; }
.plan-badge { display: inline-block; font-size: 11px; font-weight: 900; padding: 2px 7px; border-radius: 6px; vertical-align: middle; }
.plan-badge.pro { background: var(--accent); color: var(--accent-ink); }
.plan-badge.admin { background: var(--coral); color: #fff; }
.site-footer { padding: 24px clamp(16px, 4vw, 40px) 32px; color: rgba(255, 255, 255, .7); font-size: 13px; text-align: center; }
.site-footer nav { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer p { margin: 4px 0; }

.page { width: min(100% - 32px, 980px); margin: 0 auto; padding-bottom: 24px; display: grid; gap: 18px; align-content: start; }
.page.wide { width: min(100% - 32px, 1200px); }
.page-center { display: grid; place-items: center; padding: 24px 16px; }
.page-hero { color: #fff; text-align: center; padding: 12px 0 4px; }
.page-hero h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 40px); }
.page-hero p { margin: 0; opacity: .85; line-height: 1.5; }
.text-card { padding: clamp(18px, 3vw, 30px); line-height: 1.65; }
.text-card h2 { margin: 0 0 10px; font-size: 20px; }
.text-card ul, .text-card ol { padding-left: 20px; margin: 8px 0; }
.text-card li { margin: 4px 0; }
.legal h1 { margin: 0 0 4px; }
.legal h2 { margin-top: 26px; font-size: 17px; }
.muted { color: var(--ink-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.row-actions .field { flex: 1 1 220px; font-size: 15px; padding: 11px 14px; }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.info-list dt { color: var(--ink-soft); font-weight: 700; }
.info-list dd { margin: 0; font-weight: 600; }
.danger-zone { border: 2px solid #fbd2d0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--ink-soft); font-weight: 800; white-space: nowrap; background: var(--paper-2); }
.grant { display: flex; gap: 6px; }
.grant .field { width: 80px; padding: 6px 8px; font-size: 14px; }
.grant .btn { padding: 6px 10px; font-size: 14px; }

/* 로그인 */
.auth-card { width: min(100%, 420px); padding: 24px; display: grid; gap: 16px; }
.tabs { display: flex; background: var(--paper-2); border-radius: 12px; padding: 4px; }
.tab { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 9px; font-weight: 800; color: var(--ink-soft); }
.tab.on { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.tabs.big { background: rgba(255, 255, 255, .12); }
.tabs.big .tab { color: #fff; font-size: 17px; padding: 10px 18px; flex: none; }
.tabs.big .tab.on { color: var(--primary); }
.auth-form { display: grid; gap: 10px; }
.auth-form .field { font-size: 16px; }
.agree-box { display: grid; gap: 8px; font-size: 14px; color: var(--ink-soft); padding: 4px 2px; }
.agree-box label { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.agree-box input { margin-top: 2px; width: 17px; height: 17px; flex: none; }
.auth-help { margin: 0; font-size: 14px; color: var(--ink-soft); text-align: center; line-height: 1.5; }
.google-button { display: flex; justify-content: center; min-height: 44px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; margin-top: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* 요금제 */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.plan-card { padding: 26px; display: grid; gap: 12px; align-content: start; position: relative; }
.plan-card h2 { margin: 0; font-size: 22px; }
.plan-card ul { margin: 0; padding-left: 20px; line-height: 1.6; }
.plan-card.featured { outline: 3px solid var(--primary); }
.plan-price { font-size: 32px; font-weight: 900; color: var(--ink); }
.plan-price small { font-size: 16px; color: var(--ink-soft); font-weight: 700; }
.plan-sub { color: var(--ink-soft); margin-top: -6px; }
.plan-tag { position: absolute; top: 16px; right: 16px; background: var(--primary); color: #fff; font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 999px; }
.plan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plan-note { margin: 0; color: var(--ink-soft); font-size: 14px; min-height: 1em; }

/* 랜딩 */
.landing-title { margin: 0; font-size: clamp(34px, 6vw, 60px); line-height: 1.15; letter-spacing: -.02em; }
.landing-title span { color: var(--accent); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; text-align: left; }
.feature { background: rgba(255, 255, 255, .1); border-radius: 14px; padding: 16px 18px; display: grid; gap: 6px; line-height: 1.5; }
.feature b { font-size: 17px; }
.feature span { opacity: .85; font-size: 14px; }
.feature a { color: var(--accent); }

/* 진행자: 목록 */
.cover-badges { display: flex; gap: 6px; }
.quiz-card-meta { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.visibility-select { flex: 0 0 auto !important; width: auto; font-size: 16px; }
#explore-bar .field { width: auto; font-size: 15px; padding: 10px 12px; }
#explore-q { min-width: 240px; }
.preview-dialog { border: 0; width: min(92vw, 720px); max-height: 85vh; padding: 22px; color: var(--ink); }
.preview-dialog::backdrop { background: rgba(5, 12, 30, .6); }
.preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.preview-head h2 { margin: 0; }
.preview-head p { margin: 4px 0 0; }
.preview-list { max-height: 45vh; overflow: auto; padding-left: 22px; line-height: 1.5; }
.preview-list li { margin: 6px 0; white-space: pre-line; }
.preview-list .tag-muted { font-size: 12px; padding: 2px 8px; margin-right: 4px; }


/* ───── 게임 설정 대화상자 ───── */
.setup-dialog { border: 0; width: min(94vw, 860px); max-height: 92vh; padding: 24px; color: var(--ink); }
.setup-dialog::backdrop { background: rgba(5, 12, 30, .65); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.mode-card {
  display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: 14px; cursor: pointer;
  border: 3px solid var(--line); background: var(--paper-2); transition: border-color .15s, background .15s;
}
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card:has(input:checked) { border-color: var(--primary); background: #e8efff; }
.mode-card:has(input:focus-visible) { outline: 3px solid var(--accent); }
.mode-emoji { font-size: 44px; line-height: 1; }
.mode-card b { display: block; font-size: 19px; margin-bottom: 4px; }
.mode-card small { color: var(--ink-soft); line-height: 1.45; display: block; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.option-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px;
  border: 2px solid var(--line); cursor: pointer; background: #fff;
}
.option-card.locked { opacity: .7; cursor: default; }
.opt-text { flex: 1; display: grid; gap: 4px; }
.opt-text b { font-size: 16px; }
.opt-text small { color: var(--ink-soft); line-height: 1.45; }
.switch {
  appearance: none; flex: none; width: 52px; height: 30px; border-radius: 999px; background: #c9d0dc;
  position: relative; cursor: pointer; transition: background .2s; margin: 0;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(22px); }
.switch:disabled { cursor: default; }
.setup-actions { justify-content: space-between; margin-top: 18px; }
.option-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.option-chips .tag { font-size: 13px; }

/* ───── 시상식: 꽃가루 대포 · 불꽃 ───── */
.confetti i.cannon { top: auto; bottom: -10px; animation-name: cannon; animation-timing-function: cubic-bezier(.15, .7, .3, 1); }
.confetti i.cannon.left { left: 2%; }
.confetti i.cannon.right { left: auto; right: 2%; }
@keyframes cannon {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  55% { transform: translate(var(--dx), var(--dy)) rotate(420deg); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.25), calc(var(--dy) + 70vh)) rotate(900deg); opacity: 0; }
}
.firework { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 60; }
.firework i {
  position: absolute; width: 7px; height: 7px; border-radius: 50%; left: -3px; top: -3px;
  box-shadow: 0 0 10px currentColor; animation: spark 1.6s cubic-bezier(.1, .8, .3, 1) forwards;
}
@keyframes spark {
  0% { transform: translate(0, 0) scale(1.4); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 60px)) scale(.4); opacity: 0; }
}

/* ───── 참가자: 옵션별 화면 ───── */
.p-answers.no-label .p-answer .label { display: none; }
.p-answers.no-label .p-answer .shape { font-size: 64px; }
.p-answers.with-submit { grid-template-rows: 1fr 1fr auto; }
.p-answers.with-submit.n2 { grid-template-rows: 1fr auto; }
.p-answers.ox.with-submit { grid-template-rows: 1fr 1fr auto; }
.p-question-image { margin: -4px 0 12px; text-align: center; }
.p-question-image img { max-width: 100%; max-height: 28vh; border-radius: 12px; background: #fff; }
body.remote .p-question-text { font-size: 19px; padding: 16px; }
.p-board { list-style: none; margin: 0; padding: 0; width: min(100%, 380px); display: grid; gap: 8px; }
.p-board li {
  display: grid; grid-template-columns: 34px auto 1fr auto; gap: 10px; align-items: center;
  background: #fff; color: var(--ink); border-radius: 12px; padding: 12px 14px; font-weight: 800; text-align: left;
}
.p-board li.me { background: var(--accent); color: var(--accent-ink); }
.p-board li.gap { margin-top: 10px; }
.p-board .r { text-align: center; }
.p-board .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end-podium { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; width: min(100%, 340px); }
.end-podium li { background: rgba(0, 0, 0, .22); border-radius: 10px; padding: 8px 12px; text-align: left; }
.end-podium li span { float: right; opacity: .85; }

@media (max-width: 640px) {
  .mode-grid { grid-template-columns: 1fr; }
}

/* 순위표 방식 선택 */
.board-choice-box { border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; display: grid; gap: 10px; }
.board-choice-head { display: grid; gap: 4px; }
.board-choice-head b { font-size: 16px; }
.board-choice-head small { color: var(--ink-soft); line-height: 1.45; min-height: 1.45em; }
.board-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.board-choice { cursor: pointer; }
.board-choice input { position: absolute; opacity: 0; pointer-events: none; }
.board-choice span {
  display: block; text-align: center; padding: 10px 6px; border-radius: 10px; font-weight: 800; font-size: 15px;
  background: var(--paper-2); border: 2px solid transparent; transition: background .15s, border-color .15s;
}
.board-choice input:checked + span { background: #e8efff; border-color: var(--primary); color: var(--primary); }
.board-choice input:focus-visible + span { outline: 3px solid var(--accent); }
.board-sub { text-align: center; margin: -6px 0 0; opacity: .8; font-weight: 700; min-height: 1em; }
@media (max-width: 640px) { .board-choices { grid-template-columns: 1fr 1fr; } }

/* 참가자: 캐릭터 고르기 */
.avatar-pick { display: grid; gap: 6px; justify-items: center; }
.avatar-current { font-size: 56px; line-height: 1; min-height: 56px; animation: pop-in .3s ease-out; }
.avatar-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; width: 100%;
  max-height: 168px; overflow-y: auto; padding: 4px; background: var(--paper-2); border-radius: 12px;
}
.avatar-opt {
  aspect-ratio: 1; border: 2px solid transparent; border-radius: 10px; background: #fff;
  font-size: 22px; line-height: 1; padding: 0; display: grid; place-items: center; transition: transform .1s;
}
.avatar-opt.on { border-color: var(--primary); background: #e8efff; transform: scale(1.08); }
.avatar-opt:disabled { opacity: .25; filter: grayscale(1); cursor: not-allowed; }
@media (max-width: 360px) { .avatar-grid { grid-template-columns: repeat(6, 1fr); } }

/* 참가자: 보기 번호를 왼쪽 위에 크게 (1 왼쪽 위 · 2 오른쪽 위 · 3 왼쪽 아래 · 4 오른쪽 아래) */
.p-answer { position: relative; }
.p-answer[data-n]::after { display: none; }
.p-answer .ans-num {
  position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--c);
  font-size: 19px; font-weight: 900; box-shadow: 0 2px 0 rgba(0, 0, 0, .2);
}
.p-order .order-badge { left: auto; right: 8px; background: var(--ink); color: #fff; }

/* ───── AI로 만들기 ───── */
.ai-head { display: flex; gap: 16px; align-items: flex-start; color: #fff; margin: 12px 0 20px; }
.ai-head h1 { margin: 0; font-size: clamp(24px, 3.4vw, 34px); }
.ai-head p { margin: 6px 0 0; opacity: .85; }
.ai-panel { padding: clamp(18px, 3vw, 28px); position: relative; max-width: 980px; }
.ai-form { border: 0; padding: 0; margin: 0; display: grid; gap: 18px; min-width: 0; }
.ai-form:disabled { opacity: .45; }
.ai-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.ai-field { display: grid; gap: 8px; }
.ai-label { font-weight: 800; }
.ai-label small { font-weight: 600; color: var(--ink-soft); margin-left: 6px; }
.ai-field .field { font-size: 16px; }
.ai-field textarea { resize: vertical; line-height: 1.5; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 0; background: var(--paper-2); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.chip:hover { background: #e8efff; color: var(--primary); }
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: block; padding: 9px 14px; border-radius: 10px; background: var(--paper-2); border: 2px solid transparent; font-weight: 800; font-size: 14px; }
.pill input:checked + span { background: #e8efff; border-color: var(--primary); color: var(--primary); }
.pill input:focus-visible + span { outline: 3px solid var(--accent); }
.pill.locked { cursor: not-allowed; }
.pill.locked span { opacity: .5; }
.ai-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ai-quota { background: var(--paper-2); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; display: grid; gap: 8px; font-size: 14px; }
.ai-quota-bar { height: 8px; background: #dfe5f1; border-radius: 99px; overflow: hidden; }
.ai-quota-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--violet)); }
.ai-upsell { text-align: center; padding: 18px 12px 24px; margin-bottom: 14px; border-bottom: 2px dashed var(--line); }
.ai-upsell-emoji { font-size: 44px; }
.ai-upsell h3 { margin: 6px 0; font-size: 20px; }
.ai-upsell p { color: var(--ink-soft); margin: 0 0 14px; }
.ai-loading {
  position: absolute; inset: 0; border-radius: inherit; background: rgba(255, 255, 255, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
}
.ai-loading p { margin: 4px 0; }
.spinner.dark { border-color: rgba(47, 107, 255, .2); border-top-color: var(--primary); margin-bottom: 8px; }
.plan-badge.plus { background: linear-gradient(90deg, var(--primary), var(--violet)); color: #fff; }
@media (max-width: 760px) { .ai-row { grid-template-columns: 1fr; } }

.plan-grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.plan-actions.single { grid-template-columns: 1fr; }
.grant select.field { width: auto; padding: 6px 8px; font-size: 13px; }

/* ───── 베타 ───── */
.beta-bar {
  display: block; text-align: center; padding: 9px 16px; font-size: 14px; color: var(--accent-ink); text-decoration: none;
  background: linear-gradient(90deg, #ffd84d, #ffcc00 50%, #ffd84d);
}
.beta-bar span { font-weight: 900; margin-left: 6px; text-decoration: underline; }
.plan-badge.beta { background: var(--teal); color: #fff; }
.beta-hero-badge {
  display: inline-block; background: var(--accent); color: var(--accent-ink); font-weight: 900; letter-spacing: .1em;
  padding: 4px 12px; border-radius: 999px; font-size: 13px; margin-bottom: 8px;
}
.beta-period { background: #fff8db; color: #5a4500; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; }
.beta-perks { list-style: none; padding: 0 !important; display: grid; gap: 12px; }
.beta-perks li { display: flex; gap: 14px; align-items: flex-start; }
.beta-perks li > span { font-size: 28px; line-height: 1; }
.beta-perks small { display: block; color: var(--ink-soft); }
.beta-apply { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.beta-agree { flex-basis: 100%; display: flex; gap: 8px; align-items: flex-start; font-weight: 700; }
.beta-agree input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.beta-done { flex-basis: 100%; font-size: 18px; color: var(--ok); }
.beta-banner { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 22px 26px; flex-wrap: wrap; }
.beta-banner-text { flex: 1 1 420px; }
.beta-banner h2 { margin: 4px 0 6px; font-size: 20px; }
.beta-banner p { margin: 0; color: var(--ink-soft); line-height: 1.55; }
.btn.soon { background: var(--paper-2); color: var(--ink-soft); box-shadow: none; }
.beta-notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-top: 4px; }

/* ───── 반응형 ───── */
@media (max-width: 900px) {
  .editor-body { grid-template-columns: 1fr; }
  .q-sidebar { position: static; }
  .q-list { max-height: none; grid-auto-flow: column; grid-auto-columns: 200px; overflow-x: auto; }
  .lobby-join { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .q-middle { grid-template-columns: 1fr 1fr; }
  .q-media { grid-column: 1 / -1; order: -1; }
  .podium-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .choice-edit-grid { grid-template-columns: 1fr; }
  .answer-grid { grid-template-columns: 1fr; }
  .board-row { grid-template-columns: 36px auto 1fr auto; padding: 12px 14px; gap: 10px; }
  .board-row .move { display: none; }
  .topbar-title { display: none; }
}
@media (max-height: 640px) {
  .p-answer { min-height: 80px; }
  .p-answer .shape { font-size: 38px; }
}

body.site .landing { min-height: auto; padding-top: 8px; }

/* 링크 버튼 밑줄 제거 · 카드 버튼 줄바꿈 · 검색바 글자색 */
a.btn, a.icon-btn { text-decoration: none; }
.quiz-card-actions { flex-wrap: wrap; }
.quiz-card-actions .btn { padding: 10px 12px; }
.quiz-card-actions .btn-primary { flex: 1 1 auto; min-width: 0; }
#explore-bar .field { color: var(--ink); background: #fff; }

.plan-actions:has(.soon) { grid-template-columns: 1fr; }
.plan-actions .soon ~ .soon { display: none; }

/* 공유 버튼 */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.landing-share { display: flex; justify-content: center; margin: 4px 0 8px; }
.lobby-share { display: flex; flex-wrap: wrap; gap: 8px; }
.end-share { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
@media (max-width: 720px) { .lobby-share { justify-content: center; } }

/* 결제 전 동의 */
.pay-agree { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; margin-bottom: 16px; cursor: pointer; line-height: 1.6; }
.pay-agree input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--primary); }
