:root {
  color-scheme: dark;
  --ink: #fff9ee;
  --gold: #ffda83;
  --teal: #99eed5;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #082a42; }
body { margin: 0; color: var(--ink); font-size: 24px; font-weight: 500; line-height: 1.5; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 4px solid var(--gold); outline-offset: 5px; }
h1, h2, p { margin: 0; }
h1, h2, strong, button { font-family: "Outfit", sans-serif; }
h1:focus { outline: none; }
[hidden] { display: none !important; }
.ocean-background { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(150deg, #16475c, #082a42 65%); }
#quiz-app { width: min(920px, calc(100% - 40px)); margin: 28px auto 40px; }
.panel { background: #10364d; border: 2px solid #608495; border-radius: 22px; }
.welcome { text-align: center; padding: 36px; }
.welcome h1, .final-panel h1 { font-size: clamp(38px, 6vw, 54px); line-height: 1.2; font-weight: 700; }
.welcome-description { margin-top: 16px; font-size: 26px; }
.ship-scene { width: min(100%, 430px); margin: 8px auto; }
.nautical-art { display: block; width: 100%; height: auto; }
.welcome-instruction { font-size: 26px; margin-bottom: 24px; }
.primary, .secondary { min-height: 72px; border: 3px solid transparent; border-radius: 12px; padding: 16px 24px; font-size: 26px; font-weight: 700; line-height: 1.3; }
.primary { background: var(--gold); color: #082a42; border-color: #ffe6ae; box-shadow: 0 4px 0 #b7832b; }
.primary:hover:not(:disabled) { background: #ffe6aa; }
.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #b7832b; }
.primary:disabled { background: #315267; color: #d5e1e8; border-color: #638092; box-shadow: none; }
.welcome .primary { width: min(100%, 370px); }
.gentle-note { margin-top: 24px; font-size: 24px; }
.game-top { position: sticky; top: 6px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 22px; margin-bottom: 12px; background: linear-gradient(115deg, #204c62, #12364c); border: 2px solid #608495; border-radius: 20px; box-shadow: 0 5px 16px #041d3026; }
.step-label { font-size: 22px; font-weight: 500; }
.step-caption { display: block; color: #d6e5ec; line-height: 1.2; }
.step-count { display: block; white-space: nowrap; line-height: 1.15; }
.step-count strong { font-size: 40px; font-weight: 700; margin-right: 4px; }
.bank { min-width: 180px; padding: 0 0 0 22px; text-align: center; border-left: 2px solid #608495; }
.bank-label { display: block; font-size: 22px; color: #d6e5ec; line-height: 1.2; }
.bank strong { display: block; font-size: 40px; line-height: 1.15; color: var(--gold); font-variant-numeric: tabular-nums; }
.ring-balance { display: flex; align-items: center; justify-content: center; gap: 12px; }
.ring-icon { display: block; width: 100%; height: 100%; }
.ring-balance > .ring-icon { width: 40px; height: 40px; flex-shrink: 0; }
.question-content { padding: 30px; }
.question-stakes { text-align: center; font-size: 24px; margin-bottom: 16px; }
.question-stakes strong { display: block; color: var(--gold); font-size: 26px; }
.question-content h1 { text-align: center; font-size: clamp(28px, 4vw, 36px); line-height: 1.35; font-weight: 600; margin-bottom: 28px; text-wrap: balance; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.answers.resolved { grid-template-columns: minmax(0, 1fr); }
.answer { display: flex; align-items: center; gap: 14px; min-height: 88px; padding: 16px; border: 3px solid #90aebd; border-radius: 12px; background: #082a42; color: var(--ink); text-align: left; font-size: 26px; font-weight: 600; line-height: 1.35; }
.answer > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.answer-letter { flex: 0 0 38px; display: grid; place-items: center; width: 38px; height: 42px; color: var(--gold); font-size: 26px; font-weight: 700; }
.answer-state { margin-left: auto; flex-shrink: 0; font-size: 30px; font-weight: 700; }
.answer-state:empty { display: none; }
.answer:hover:not(:disabled) { border-color: var(--gold); background: #20495e; }
.answer.selected { background: var(--gold); color: #082a42; border-color: #fff3cf; }
.answer.selected .answer-letter { color: #082a42; }
.answer.correct { background: #155747; color: #fff; border-color: #99eed5; }
.answer.correct .answer-letter { color: #99eed5; }
.answer.incorrect { background: #643b40; color: #fff; border-color: #ffc0b6; }
.answer.incorrect .answer-letter { color: #ffc0b6; }
.feedback { text-align: center; font-size: 24px; font-weight: 600; margin: 24px 0; }
.feedback:empty { margin: 0; }
.feedback.success { color: var(--teal); }
.feedback.try-again { color: #ffd0b6; }
.fact { padding: 20px; margin: 0 0 24px; background: #082a42; border-radius: 12px; }
.fact p { font-size: 24px; line-height: 1.55; }
.check-answer { display: block; width: min(100%, 390px); margin: 24px auto 0; }
#effects { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 100; }
.flying-ring { position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; filter: drop-shadow(0 3px 4px #0005); }
.flying-coin { position: absolute; left: -21px; top: -21px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--gold) !important; color: #765015; font-size: 28px; line-height: 1; font-weight: 700; border: 4px solid #d9a741; }
.reward-pop { position: absolute; display: flex; align-items: center; gap: 8px; color: var(--gold); font-family: "Outfit", sans-serif; font-size: 34px; font-weight: 700; text-shadow: 0 2px 8px #061d31; white-space: nowrap; animation: reward 1.6s ease-out both; }
.reward-pop .ring-icon { width: 36px; height: 36px; }
.bank-celebrate .ring-balance { animation: bank-pulse 1.3s ease; }
.confetti-piece { position: absolute; left: 0; top: 0; width: 12px; height: 20px; border-radius: 2px; }
.final-panel { text-align: center; padding: 36px; }
.ring-reveal { position: relative; width: min(100%, 320px); height: 290px; margin: 20px auto 0; }
.gift-hatch { position: absolute; width: 180px; height: 180px; top: 50%; left: 50%; transform: translate(-50%, -50%); perspective: 650px; }
.hatch-light { position: absolute; inset: 5px; border-radius: 50%; background: radial-gradient(circle, #fffde4, #ffdc80 60%, #c28a30); box-shadow: 0 0 0 8px #8ba9b2; }
.hatch-door { position: absolute; inset: 0; transform-origin: 5% 50%; backface-visibility: hidden; }
.hatch-door svg { display: block; width: 100%; height: 100%; }
.hatch-wheel { transform-origin: 100px 100px; }
.ring-vortex { position: absolute; inset: 0; }
.reveal-rays { position: absolute; inset: 0; opacity: 0; border-radius: 50%; background: repeating-conic-gradient(from 15deg, #ffda8300 0deg 15deg, #ffda8355 15deg 30deg); mask-image: radial-gradient(circle, #000, transparent 72%); }
.reveal-countdown { position: absolute; inset: 0; margin: auto; width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; background: #082a42; color: var(--gold); border: 4px solid var(--gold); font: 700 64px/1 "Outfit", sans-serif; }
.countdown-pop { animation: countdown-pop .65s ease-out both; }
.orbit-ring { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; transform: translate(var(--x), var(--y)) rotate(var(--turn)); }
.gathering .ring-vortex { animation: ring-whirlpool 2s cubic-bezier(.45, 0, .7, 1) both; }
.gathering .hatch-wheel { animation: unlock-wheel 2s ease-in-out both; }
.hatch-open .hatch-door { animation: open-hatch .9s ease-in-out both; }
.hatch-open .reveal-rays { animation: hatch-rays 1s ease-out both; }
.hatch-open .hatch-light { box-shadow: 0 0 70px 20px #ffda8388; transition: box-shadow .7s; }
.reveal-total { font-size: 28px; line-height: 1.4; }
.reveal-total strong { display: block; font-size: 56px; color: var(--gold); }
.reveal-caption { font-size: 24px; margin: 18px 0; }
.gift-ticket { position: relative; width: min(100%, 490px); margin: 24px auto; padding: 22px 24px; background: linear-gradient(120deg, #dcae4e 0%, #ffe5a0 24%, #fff0bd 43%, #f6d174 62%, #dfad46 100%); color: #082a42; border-radius: 18px; box-shadow: inset 0 0 0 2px #ffedb2, inset 0 0 0 7px #a774211a, 0 12px 30px #041b2b55; animation: enter .5s ease both; }
.ticket-heading { display: flex; align-items: center; justify-content: center; gap: 16px; font: 600 24px/1.3 "Outfit", sans-serif; color: #604211; margin-bottom: 8px; }
.ticket-heading span { font-size: 24px; }
.final-amount { display: block; font-size: clamp(76px, 16vw, 112px); font-weight: 700; line-height: 1.15; }
.final-amount span { font-size: .65em; }
.final-amount #final-number { font-size: 1em; font-variant-numeric: tabular-nums; }
.gift-revealed { animation: gift-unfold .8s cubic-bezier(.18,.8,.3,1) both; }
.ticket-label { display: block; font-size: 30px; font-weight: 700; }
.gift-ticket p { font-size: 24px; margin-top: 20px; }
.ticket-perforation { position: relative; margin: 22px -24px 18px; border-top: 2px dashed #84602799; }
.ticket-perforation::before, .ticket-perforation::after { content: ""; position: absolute; width: 28px; height: 28px; top: -15px; border-radius: 50%; background: #10364d; }
.ticket-perforation::before { left: -14px; }
.ticket-perforation::after { right: -14px; }
.gift-ticket .ticket-sender { margin: 0; font-size: 22px; line-height: 1.35; }
.ticket-sender strong { display: block; font-size: 24px; }
.final-restart { margin-top: 22px; }
.final-panel h2 { font-size: 30px; line-height: 1.35; color: var(--gold); }
.secondary { background: #10364d; border-color: #90aebd; color: var(--ink); }
.secondary:hover { background: #20495e; border-color: var(--gold); }
.noscript { margin: 30px; font-size: 24px; }
.screen-enter { animation: enter .3s ease-out both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bank-pulse { 35% { transform: scale(1.08); filter: drop-shadow(0 0 8px #fbd17888); } }
@keyframes ring-whirlpool { 0% { transform: rotate(0) scale(1); opacity: 1; } 45% { transform: rotate(160deg) scale(1); opacity: 1; } 85% { opacity: 1; } 100% { transform: rotate(640deg) scale(.05); opacity: 0; } }
@keyframes unlock-wheel { 0%, 15% { transform: rotate(0); } 80%, 100% { transform: rotate(270deg); } }
@keyframes countdown-pop { from { transform: scale(.65); opacity: .4; } 35% { transform: scale(1.08); opacity: 1; } to { transform: scale(1); opacity: 1; } }
@keyframes open-hatch { from { transform: rotateY(0); } to { transform: rotateY(-110deg); } }
@keyframes hatch-rays { from { opacity: 0; transform: scale(.6) rotate(0); } to { opacity: 1; transform: scale(1.4) rotate(30deg); } }
@keyframes gift-unfold { from { opacity: 0; transform: perspective(700px) rotateX(-25deg) scale(.7); } to { opacity: 1; transform: perspective(700px) rotateX(0) scale(1); } }
@keyframes reward { 0% { opacity: 0; transform: translate(-50%, 12px); } 25%, 65% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -25px); } }
@media (max-width: 700px) {
  #quiz-app { width: calc(100% - 20px); margin: 6px auto max(12px, env(safe-area-inset-bottom)); }
  .answers { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .welcome, .final-panel { padding: 28px 18px; }
  .welcome-description { font-size: 24px; }
  .question-content { padding: 16px 16px 18px; }
  .answer { min-height: 60px; font-size: 22px; padding: 9px 10px; gap: 8px; line-height: 1.25; }
  .answer-letter { flex-basis: 28px; width: 28px; height: 32px; font-size: 22px; }
  .answer-state { font-size: 26px; }
  .gentle-note, .gift-ticket p { font-size: 22px; }
  .question-stakes { font-size: 20px; line-height: 1.25; margin-bottom: 12px; }
  .question-stakes strong { font-size: 22px; }
  .question-content h1 { font-size: 26px; line-height: 1.25; margin-bottom: 16px; }
  .primary, .secondary { font-size: 22px; min-height: 56px; padding: 10px 14px; }
  .step-label { font-size: 20px; }
  .step-count strong { font-size: 30px; }
  .bank { min-width: 0; padding: 0 0 0 12px; }
  .bank-label { font-size: 20px; line-height: 1.2; }
  .bank strong { font-size: 30px; }
  .ring-balance { gap: 8px; }
  .ring-balance > .ring-icon { width: 30px; height: 30px; }
  .game-top { gap: 12px; padding: 8px 14px; margin-bottom: 10px; border-radius: 18px; }
  .feedback { font-size: 20px; line-height: 1.3; margin: 12px 0; }
  .fact { padding: 12px; margin-bottom: 12px; }
  .fact p { font-size: 20px; line-height: 1.4; }
  .check-answer { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
