:root {
  color-scheme: dark;
  --bg: #061725;
  --panel: rgba(13, 39, 58, 0.88);
  --panel-strong: #102f46;
  --line: rgba(159, 210, 228, 0.18);
  --text: #f7fbff;
  --muted: #a6bdca;
  --sky: #59d9f1;
  --mint: #7af0bf;
  --yellow: #ffd56a;
  --wrong: #ff8e9e;
  --correct: #77edb7;
  --shadow: 0 28px 80px rgba(0, 6, 12, 0.42);
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(49, 157, 184, 0.28), transparent 42%),
    linear-gradient(160deg, #04121f 0%, #082339 52%, #071826 100%);
}

button, select, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible + span {
  outline: 3px solid rgba(89, 217, 241, 0.58);
  outline-offset: 3px;
}

.ambient { position: fixed; border-radius: 50%; filter: blur(4px); pointer-events: none; opacity: .45; }
.ambient-one { width: 280px; height: 280px; top: 20%; left: -190px; background: rgba(75, 225, 198, .18); }
.ambient-two { width: 330px; height: 330px; right: -230px; bottom: 5%; background: rgba(83, 119, 255, .17); }

.app-shell { position: relative; width: min(100%, 760px); min-height: 100svh; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 20px max(36px, env(safe-area-inset-bottom)); }
.view { animation: view-in .32s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

.hero { padding: 24px 4px 10px; text-align: center; }
.brand-mark { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 18px; border: 1px solid rgba(122, 240, 191, .35); border-radius: 24px; background: linear-gradient(145deg, rgba(89, 217, 241, .18), rgba(122, 240, 191, .06)); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 16px 40px rgba(0,0,0,.25); font-size: 36px; }
.eyebrow { margin: 0 0 9px; color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(42px, 10vw, 68px); line-height: .98; letter-spacing: -.07em; }
.hero h1 span { color: transparent; background: linear-gradient(100deg, var(--sky), var(--mint)); background-clip: text; -webkit-background-clip: text; }
.hero-copy { margin: 24px 0 12px; color: var(--muted); font-size: 15px; line-height: 1.75; }

.overview-grid, .result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 20px 0; }
.overview-grid article, .result-stats article { padding: 15px 8px; border: 1px solid var(--line); border-radius: 16px; background: rgba(8, 29, 44, .64); text-align: center; }
.overview-grid strong, .result-stats strong { display: block; color: var(--yellow); font-size: 21px; }
.overview-grid span, .result-stats span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.setup-card, .question-card { border: 1px solid var(--line); border-radius: 26px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.setup-card { padding: 22px; }
.field-group { margin: 0 0 22px; padding: 0; border: 0; }
.field-group label, .field-group legend { display: block; margin-bottom: 9px; color: #dcecf3; font-size: 13px; font-weight: 750; }
.field-help { margin: 8px 1px 0; color: var(--muted); font-size: 11px; }
.select-wrap { position: relative; }
.select-wrap::after { position: absolute; top: 50%; right: 16px; content: "⌄"; color: var(--sky); transform: translateY(-55%); pointer-events: none; }
select { width: 100%; min-height: 48px; appearance: none; padding: 0 42px 0 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: #0a263a; }

.segment-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 15px; background: rgba(1, 13, 22, .45); }
.segment-control label { margin: 0; }
.segment-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segment-control span { display: grid; min-height: 40px; place-items: center; padding: 4px; border-radius: 10px; color: var(--muted); font-size: 11px; text-align: center; cursor: pointer; }
.segment-control input:checked + span { color: #062231; background: linear-gradient(120deg, var(--sky), var(--mint)); box-shadow: 0 8px 20px rgba(89, 217, 241, .18); font-weight: 850; }

.primary-button, .secondary-button, .text-button, .icon-button { border: 0; color: var(--text); cursor: pointer; }
.primary-button { display: flex; width: 100%; min-height: 52px; align-items: center; justify-content: space-between; padding: 0 19px; border-radius: 15px; color: #06202c; background: linear-gradient(105deg, var(--sky), var(--mint)); box-shadow: 0 14px 30px rgba(63, 209, 208, .19); font-weight: 900; }
.primary-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.primary-button.compact { min-height: 46px; margin-top: 14px; }
.secondary-button { width: 100%; min-height: 48px; margin-top: 10px; border: 1px solid rgba(89, 217, 241, .32); border-radius: 14px; background: rgba(8, 42, 61, .78); font-weight: 800; }
.text-button { padding: 10px; background: transparent; color: var(--muted); }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 13px; background: rgba(8, 31, 47, .82); font-size: 20px; }
.data-note, .shortcut-note { margin: 16px 0 0; color: rgba(166, 189, 202, .72); font-size: 10px; text-align: center; }

.quiz-header { display: flex; align-items: center; justify-content: space-between; }
.score-cluster { display: flex; gap: 8px; }
.score-cluster span { padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: rgba(7, 29, 44, .72); font-size: 11px; }
.score-cluster strong { margin-left: 3px; color: var(--yellow); font-size: 14px; }
.progress-block { margin: 26px 2px 20px; }
.progress-copy { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.progress-copy strong { color: var(--text); }
.progress-track { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--mint)); transition: width .3s ease; }

.question-card { padding: clamp(20px, 5vw, 34px); text-align: center; }
.question-flag { font-size: clamp(52px, 14vw, 78px); filter: drop-shadow(0 12px 16px rgba(0,0,0,.22)); }
.question-kicker { margin: 10px 0 7px; color: var(--mint); font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.question-card h2 { min-height: 2.6em; margin: 0 auto 24px; font-size: clamp(23px, 6vw, 34px); line-height: 1.3; letter-spacing: -.045em; text-wrap: balance; }
.answer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.answer-button { position: relative; min-height: 68px; padding: 12px 10px 12px 38px; border: 1px solid var(--line); border-radius: 15px; color: var(--text); background: rgba(5, 26, 41, .72); line-height: 1.35; cursor: pointer; overflow-wrap: anywhere; transition: border-color .15s, background .15s, transform .15s; }
.answer-button:hover:not(:disabled) { border-color: var(--sky); background: rgba(18, 67, 87, .78); transform: translateY(-2px); }
.answer-button::before { position: absolute; top: 50%; left: 12px; display: grid; width: 21px; height: 21px; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); content: attr(data-number); font-size: 10px; transform: translateY(-50%); }
.answer-button:disabled { cursor: default; opacity: .63; }
.answer-button.correct { border-color: var(--correct); background: rgba(47, 144, 104, .27); opacity: 1; }
.answer-button.wrong { border-color: var(--wrong); background: rgba(151, 55, 72, .25); opacity: 1; }
.feedback-panel { margin-top: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: rgba(2, 20, 32, .66); text-align: left; }
.feedback-title { margin: 0; color: var(--correct); font-size: 14px; font-weight: 900; }
.feedback-panel.is-wrong .feedback-title { color: var(--wrong); }
.feedback-answer { margin: 5px 0 0; font-size: 18px; font-weight: 850; }
.feedback-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.location-card { margin-top: 14px; padding: 12px; border: 1px solid rgba(89, 217, 241, .18); border-radius: 15px; background: rgba(5, 34, 50, .72); }
.location-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.location-header div { display: flex; align-items: center; gap: 7px; }
.location-header strong { font-size: 12px; }
.location-region { padding: 4px 7px; border-radius: 99px; color: var(--mint); background: rgba(122, 240, 191, .1); font-size: 9px; font-weight: 800; }
.location-map { display: block; width: 100%; height: auto; overflow: hidden; border: 1px solid rgba(159, 210, 228, .15); border-radius: 11px; background: #071f31; }
.map-ocean { fill: #08283d; }
.country-shape { fill: #255067; stroke: #0b2d42; stroke-width: .5; vector-effect: non-scaling-stroke; transition: fill .2s; }
.country-shape.active { fill: #66d9af; stroke: #c9ffe8; stroke-width: 1; }
.country-marker { fill: rgba(255, 213, 106, .18); stroke: var(--yellow); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.country-marker-center { fill: var(--yellow); stroke: #08283d; stroke-width: .7; vector-effect: non-scaling-stroke; }
.capital-pin-line { stroke: #ff758e; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.capital-pin-dot { fill: #ff758e; stroke: #fff; stroke-width: .8; vector-effect: non-scaling-stroke; }
.map-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 2px 0; color: var(--muted); font-size: 9px; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { display: inline-block; width: 9px; height: 9px; }
.country-key { border: 2px solid var(--yellow); border-radius: 50%; }
.capital-key { border: 1px solid #fff; border-radius: 50% 50% 50% 0; background: #ff758e; transform: rotate(-45deg); }
.location-copy { margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(159, 210, 228, .12); }
.location-copy p, .location-copy li { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.location-copy p { color: #d8e9f0; font-weight: 750; }
.location-copy ul { display: grid; gap: 2px; margin: 4px 0 0; padding: 0; list-style: none; }
.location-copy li::before { margin-right: 5px; color: #ff8ca0; content: "●"; font-size: 7px; }

.result-view { padding-top: clamp(40px, 12vh, 100px); text-align: center; }
.result-orbit { display: grid; width: 112px; height: 112px; margin: 0 auto 24px; place-items: center; border: 1px solid rgba(89, 217, 241, .28); border-radius: 50%; background: radial-gradient(circle, rgba(89,217,241,.18), transparent 68%); font-size: 62px; box-shadow: 0 0 70px rgba(89,217,241,.13); }
.result-view h2 { margin: 0; font-size: clamp(34px, 9vw, 56px); letter-spacing: -.06em; }
.result-message { color: var(--muted); }
.result-score { margin: 28px 0 18px; }
.result-score strong { display: block; color: var(--mint); font-size: clamp(64px, 18vw, 96px); line-height: 1; letter-spacing: -.07em; }
.result-score span { display: block; margin-top: 6px; color: var(--muted); }
.result-stats { grid-template-columns: repeat(2, 1fr); }
.result-actions { max-width: 420px; margin: 24px auto 0; }

.review-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.review-header .eyebrow { margin-bottom: 3px; }
.review-header h2 { margin: 0; font-size: 22px; }
.review-list { display: grid; gap: 10px; }
.review-item { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--panel); }
.review-item .flag { font-size: 34px; }
.review-item h3 { margin: 0 0 5px; font-size: 15px; }
.review-item p { margin: 3px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.review-item strong { color: var(--mint); }
.empty-review { padding: 50px 20px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); text-align: center; }

@media (max-width: 520px) {
  .app-shell { padding-inline: 14px; }
  .hero { padding-top: 14px; }
  .setup-card { padding: 18px; }
  .answer-grid { grid-template-columns: 1fr; }
  .answer-button { min-height: 56px; }
  .question-card h2 { min-height: auto; }
  .shortcut-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
