:root {
  --bg: #eef8ff;
  --card: #ffffff;
  --ink: #14213d;
  --muted: #62748c;
  --brand: #0b78d0;
  --brand-dark: #07528f;
  --sun: #ffd166;
  --good: #1a936f;
  --bad: #e85d75;
  --line: #d6e8f7;
  --shadow: 0 18px 45px rgba(10, 74, 126, 0.14);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: radial-gradient(circle at top left, rgba(255, 209, 102, 0.35), transparent 28rem), radial-gradient(circle at bottom right, rgba(11, 120, 208, 0.12), transparent 26rem), linear-gradient(135deg, #eef8ff 0%, #f8fcff 45%, #eaf6ff 100%); }
button, input, select { font: inherit; }
.shell { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 48px; }
.card { background: rgba(255,255,255,0.92); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); padding: 24px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; overflow: hidden; }
h1, h2 { margin: 0 0 12px; line-height: 1.05; }
h1 { font-size: clamp(2rem, 7vw, 4.5rem); letter-spacing: -0.06em; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); }
p { margin: 0 0 14px; }
.lede { max-width: 760px; font-size: clamp(1.05rem, 2.4vw, 1.35rem); color: var(--muted); }
.eyebrow { color: var(--brand); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; font-size: 0.78rem; }
.muted { color: var(--muted); }
.badge { width: clamp(100px, 18vw, 170px); aspect-ratio: 1; flex: 0 0 auto; border-radius: 38px; display: grid; place-items: center; font-size: 3.6rem; background: linear-gradient(145deg, var(--sun), #fff3bf); border: 5px solid #fff; transform: rotate(4deg); position: relative; }
.badge span { position: absolute; bottom: 22px; right: 24px; background: var(--brand); color: white; font-weight: 900; font-size: 1rem; border-radius: 999px; padding: 5px 9px; }
.grid { display: grid; gap: 20px; margin: 20px 0; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-height: 260px; display: flex; flex-direction: column; justify-content: center; }
.center { text-align: center; }
.join-only { grid-template-columns: minmax(0, 560px); justify-content: center; }
.join-only .host-home-card { display: none; }
label { display: block; margin: 14px 0 6px; font-weight: 800; }
input, select { width: 100%; border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; background: #f7fbff; color: var(--ink); outline: none; font-size: 1.05rem; }
input:focus, select:focus { border-color: var(--brand); }
button { border: 0; border-radius: 18px; padding: 14px 18px; margin-top: 16px; cursor: pointer; font-weight: 900; transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.primary { background: var(--brand); color: white; box-shadow: 0 10px 18px rgba(11, 120, 208, 0.22); }
.secondary { background: #e4f2ff; color: var(--brand-dark); }
.icon-button { width: 54px; height: 54px; margin: 0; display: grid; place-items: center; background: #e4f2ff; color: var(--brand-dark); border-radius: 18px; font-size: 1.3rem; }
.host-card { overflow: hidden; }
.host-topline { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.room-code { font-size: clamp(3rem, 14vw, 8rem); font-weight: 1000; letter-spacing: 0.08em; color: var(--brand-dark); line-height: 1; }
.status-pill { display: inline-block; background: #eaf6ff; color: var(--brand-dark); padding: 10px 14px; border-radius: 999px; font-weight: 900; margin: 12px 0; }
.join-panel { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; text-align: left; margin: 10px 0 14px; padding: 16px; border: 2px dashed var(--line); border-radius: 24px; background: #f6fbff; }
.join-url { display: inline-block; word-break: break-all; background: white; border: 1px solid var(--line); padding: 10px 12px; border-radius: 14px; color: var(--brand-dark); font-weight: 800; }
.qr { width: 160px; height: 160px; border-radius: 18px; background: white; border: 8px solid white; box-shadow: 0 10px 22px rgba(10, 74, 126, 0.12); }
.options-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0; text-align: left; }
.player-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0 6px; }
.player-chip, .waiting-card { background: #f6fbff; border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 900; }
.player-chip span { font-size: 1.4rem; }
.waiting-card { color: var(--muted); grid-column: 1 / -1; }
.player-lobby-card h2 { font-size: clamp(1.8rem, 5vw, 3rem); }
.question-card { min-height: 430px; }
.round-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.timer-badge { min-width: 86px; text-align: center; background: var(--ink); color: white; font-weight: 1000; padding: 10px 12px; border-radius: 999px; }
.progress-wrap { height: 12px; background: #e8f3fd; border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--brand), var(--good)); transition: width 0.4s ease; }
.progress-fill.low { background: linear-gradient(90deg, var(--bad), var(--sun)); }
.choices { display: grid; gap: 10px; margin-top: 18px; }
.choice { width: 100%; text-align: left; background: #f3f9ff; color: var(--ink); border: 2px solid var(--line); }
.choice.correct { border-color: var(--good); background: #e9fff7; }
.choice.wrong { border-color: var(--bad); background: #fff1f4; }
.explain { margin-top: 18px; padding: 14px; border-radius: 18px; background: #fff8dc; color: #735c0f; font-weight: 700; }
.explain:empty { display: none; }
.mini-instruction { padding: 12px 14px; border-radius: 16px; background: #edf9ff; color: var(--brand-dark); font-weight: 1000; text-align: center; }
.mini-game button { margin-top: 0; }
.book-dash-track, .gate-grid, .puzzle-answers, .phrase-cards, .match-options { display: grid; gap: 12px; }
.book-dash-track { background: linear-gradient(90deg, #eaf6ff 0 25%, #ffffff 25% 50%, #eaf6ff 50% 75%, #ffffff 75%); padding: 14px; border-radius: 24px; border: 2px solid var(--line); }
.book-tile { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; text-align: left; background: white; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 8px 18px rgba(10, 74, 126, 0.08); }
.book-tile .runner { font-size: 1.8rem; grid-row: span 2; }
.book-tile em { color: var(--muted); font-style: normal; font-size: 0.86rem; }
.book-tile:not(:disabled):hover .runner { transform: translateX(6px); }
.match-board { display: grid; gap: 12px; }
.principle-card { padding: 18px; border-radius: 22px; background: linear-gradient(145deg, #eef8ff, #ffffff); border: 2px solid var(--line); text-align: center; }
.principle-card span { font-size: 2rem; display: block; margin-bottom: 8px; }
.principle-card p { color: var(--muted); margin: 8px 0 0; }
.match-card { text-align: left; background: #ffffff; border: 2px solid var(--line); color: var(--ink); display: flex; gap: 10px; align-items: center; }
.match-card span { font-size: 1.4rem; }
.gate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-gate { min-height: 135px; background: linear-gradient(180deg, #f6fbff, #ffffff); border: 3px solid var(--line); color: var(--ink); display: grid; place-items: center; text-align: center; }
.choice-gate .gate-arch { font-size: 2.2rem; }
.choice-gate em { font-style: normal; color: var(--muted); font-weight: 800; }
.puzzle-board { display: grid; gap: 14px; padding: 14px; border-radius: 24px; background: #fffaf0; border: 2px solid #ffe5a8; }
.clue-strip { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.clue-strip span { background: white; border: 2px dashed #f1c453; color: #735c0f; border-radius: 999px; padding: 8px 12px; font-weight: 1000; }
.puzzle-piece { background: white; border: 2px solid #ffe0a3; color: var(--ink); display: flex; align-items: center; gap: 10px; text-align: left; }
.puzzle-piece span { font-size: 1.5rem; }
.conversation-builder { display: grid; gap: 14px; }
.chat-scene { display: grid; gap: 10px; padding: 14px; border-radius: 24px; background: #f6fbff; border: 2px solid var(--line); }
.bubble { width: fit-content; max-width: 88%; padding: 12px 14px; border-radius: 20px; font-weight: 800; }
.bubble.person { background: white; border: 1px solid var(--line); }
.bubble.reply { justify-self: end; background: var(--brand); color: white; }
.phrase-card { background: #ffffff; border: 2px solid var(--line); color: var(--ink); text-align: left; display: flex; gap: 8px; align-items: flex-start; }
.phrase-card span { color: var(--brand); font-size: 1.4rem; line-height: 1; }
.book-tile.locked, .match-card.locked, .choice-gate.locked, .puzzle-piece.locked, .phrase-card.locked, .choice.locked { border-color: var(--brand); background: #f6fbff; box-shadow: 0 0 0 4px rgba(11, 120, 208, 0.08); }
.book-tile.correct, .match-card.correct, .choice-gate.correct, .puzzle-piece.correct, .phrase-card.correct { border-color: var(--good); background: #e9fff7; }
.book-tile.wrong, .match-card.wrong, .choice-gate.wrong, .puzzle-piece.wrong, .phrase-card.wrong { border-color: var(--bad); background: #fff1f4; }
.results-list { display: grid; gap: 8px; margin-top: 16px; }
.result-headline { padding: 12px; border-radius: 16px; background: #edf9ff; font-weight: 1000; color: var(--brand-dark); text-align: center; }
.result-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 12px; border-radius: 16px; background: #f6fbff; border: 1px solid var(--line); }
.result-row.yes { border-color: rgba(26, 147, 111, 0.45); background: #effff9; }
.result-row.no { border-color: rgba(232, 93, 117, 0.3); background: #fff7f9; }
.result-row em { color: var(--good); font-style: normal; font-weight: 800; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.podium-card { display: grid; gap: 6px; place-items: center; padding: 16px; border-radius: 22px; background: #f6fbff; border: 2px solid var(--line); min-height: 150px; }
.podium-card .avatar { font-size: 2.4rem; }
.podium-card .place { background: var(--brand); color: white; border-radius: 999px; padding: 4px 10px; font-weight: 1000; }
.podium-card em { color: var(--muted); font-style: normal; font-weight: 800; }
.place-1 { background: linear-gradient(160deg, #fff6cc, white); border-color: var(--sun); transform: translateY(-8px); }
.place-2 { background: linear-gradient(160deg, #f4f8ff, white); }
.place-3 { background: linear-gradient(160deg, #fff1e5, white); }
.wrap-up { margin-top: 18px; padding: 18px; border-radius: 22px; background: #e9fff7; border: 2px solid rgba(26, 147, 111, 0.25); font-weight: 900; color: #0b654d; }
.scoreboard { margin: 12px 0 0; padding-left: 22px; }
.scoreboard li { margin: 9px 0; padding: 9px 10px; background: #f6fbff; border-radius: 12px; font-weight: 800; }
.scoreboard span { color: var(--muted); font-weight: 700; }
.mini-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mini-list li { background: #f6fbff; border-radius: 16px; padding: 13px; }
.mini-list span { display: block; color: var(--muted); margin-top: 3px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: white; padding: 12px 16px; border-radius: 999px; box-shadow: var(--shadow); max-width: min(90vw, 560px); text-align: center; z-index: 20; }
.hidden { display: none !important; }
@media (max-width: 760px) {
  .hero { align-items: flex-start; }
  .badge { width: 96px; border-radius: 24px; font-size: 2.2rem; }
  .badge span { bottom: 12px; right: 12px; }
  .two { grid-template-columns: 1fr; }
  .card { border-radius: 22px; padding: 18px; }
  .join-panel { grid-template-columns: 1fr; text-align: center; }
  .qr { margin: 0 auto; }
  .options-grid { grid-template-columns: 1fr; }
  .podium { grid-template-columns: 1fr; }
  .place-1 { transform: none; }
  .result-row { grid-template-columns: 1fr auto; }
  .result-row em { grid-column: 1 / -1; }
  .gate-grid { grid-template-columns: 1fr; }
  .bubble { max-width: 100%; }
}
