:root {
  --navy: #0b2d5c;
  --blue: #075b9f;
  --sky: #38a7d8;
  --gold: #d49424;
  --ink: #18283a;
  --muted: #63778d;
  --line: #d7e2ec;
  --wash: #f1f6fa;
  --paper: #fff;
  --good: #087f72;
  --bad: #a74435;
  --shadow: 0 16px 40px rgba(11,45,92,.1);
  font-family: Inter, "Noto Sans", "Noto Sans Japanese", system-ui, sans-serif;
  color: var(--ink);
  background: #f7fafc;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 50% 0, #edf7fb 0, #fff 45%, #f7fafc 100%); }
button, select, input { font: inherit; }
button, a, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #74c7ee; outline-offset: 2px; }
.shell { width: min(1160px, calc(100% - 32px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 20; inset-block-start: 8px; inset-inline-start: 12px; padding: 8px 12px; color: var(--navy); background: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.game-header { display: grid; grid-template-columns: 1fr auto 1fr; min-height: 66px; align-items: center; border-block-end: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(10px); }
.mini-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); font-family: Georgia, "Noto Serif JP", serif; font-size: 13px; text-decoration: none; }
.mini-brand b { color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.game-name { color: var(--navy); font-size: 19px; font-weight: 900; letter-spacing: -.02em; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.header-actions select { min-height: 38px; padding: 5px 28px 5px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); background: #fff; font-weight: 800; }
.ja-switch { display: flex; align-items: center; gap: 6px; color: var(--navy); font-size: 12px; font-weight: 750; cursor: pointer; }
.ja-switch input { width: 17px; height: 17px; accent-color: var(--blue); }

.app-shell { width: min(920px, calc(100% - 32px)); margin-inline: auto; padding-block: clamp(34px, 6vw, 70px); }
.loading, .fatal { padding: 60px 20px; color: var(--muted); text-align: center; }
.fatal { border: 1px solid #efc9c1; border-radius: 16px; background: #fff7f5; }
.eyebrow, .mode-kicker, .source-label { margin: 0; color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
#home > h1 { max-width: 760px; margin: 10px auto 0; color: var(--navy); font-size: clamp(34px, 5vw, 58px); line-height: 1.12; letter-spacing: -.04em; text-align: center; }
#home > .eyebrow, #home > .lead { text-align: center; }
.lead { max-width: 700px; margin: 20px auto 0; color: #455a70; font-size: 17px; line-height: 1.65; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-block: 40px 22px; }
.mode-card { position: relative; display: grid; grid-template-columns: 66px 1fr; gap: 18px; align-items: start; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.mode-card::after { position: absolute; width: 150px; height: 150px; inset: -70px -60px auto auto; border-radius: 50%; background: rgba(56,167,216,.09); content: ""; }
.mode-icon { display: grid; width: 66px; aspect-ratio: 1; place-items: center; border-radius: 15px; color: #fff; background: var(--good); font-size: 24px; font-weight: 900; }
.test-card .mode-icon { background: var(--navy); }
.mode-card h2 { margin: 4px 0 7px; color: var(--navy); font-size: 28px; line-height: 1.15; }
.mode-card p:not(.mode-kicker,.mode-status) { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.mode-card .primary-button, .mode-status { grid-column: 1 / -1; }
.mode-status { min-height: 18px; margin: -8px 0 0; color: var(--good); font-size: 12px; font-weight: 750; }
.primary-button { min-height: 48px; padding: 10px 18px; border: 0; border-radius: 9px; color: #fff; background: var(--navy); font-weight: 850; cursor: pointer; }
.primary-button:hover { background: #123f79; }
.primary-button:disabled { color: #718093; background: #e4ebf1; cursor: not-allowed; }
.daily-card .primary-button { background: var(--good); }
.daily-card .primary-button:hover { background: #056a60; }
.trust-note { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.trust-note span:first-child { display: inline-grid; width: 20px; height: 20px; place-items: center; margin-inline-end: 4px; border-radius: 50%; color: #fff; background: var(--good); }

#quiz, .answer-panel, #result { max-width: 760px; margin-inline: auto; }
.quiz-topline { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 13px; font-weight: 750; }
.quiz-topline span:first-child { color: var(--blue); }
.timer { color: var(--navy); font-variant-numeric: tabular-nums; }
.timer.urgent { color: var(--bad); }
.progress-track { height: 5px; margin-block: 12px 20px; border-radius: 999px; background: #e0e9f0; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sky), var(--good)); transition: width .25s ease; }
.question-meta { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.question-meta #score { margin-inline-start: auto; color: var(--navy); font-size: 13px; font-weight: 850; }
.tag { padding: 5px 9px; border-radius: 999px; color: var(--blue); background: #e8f4fa; font-size: 11px; font-weight: 850; }
#question { margin: 20px 0 26px; color: var(--navy); font-size: clamp(24px, 3.5vw, 36px); line-height: 1.45; letter-spacing: -.02em; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { min-height: 68px; padding: 14px 17px; border: 1px solid #b8c8d6; border-radius: 12px; color: var(--ink); background: #fff; font-weight: 750; line-height: 1.4; text-align: start; cursor: pointer; box-shadow: 0 4px 12px rgba(11,45,92,.04); }
.choice:hover { border-color: var(--blue); background: var(--wash); transform: translateY(-1px); }

.answer-panel { padding: clamp(22px, 4vw, 36px); border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.answer-kicker { margin: 0 0 6px; color: var(--good); font-size: 12px; font-weight: 900; letter-spacing: .14em; }
.answer-kicker.incorrect { color: var(--bad); }
.answer-panel h2 { margin: 0; color: var(--navy); font-size: clamp(23px, 4vw, 33px); line-height: 1.35; }
.explanation { margin-block: 14px 20px; color: #3c5268; line-height: 1.7; }
.source-card { padding: 20px; border-inline-start: 5px solid var(--gold); border-radius: 7px 12px 12px 7px; background: #f8f5ed; }
.source-card a { display: inline-block; margin-block: 6px 8px; color: var(--blue); font-weight: 850; line-height: 1.45; }
.source-card blockquote { margin: 6px 0 10px; padding-inline-start: 14px; border-inline-start: 2px solid #d6c9a9; color: #4b5660; font-family: Georgia, "Noto Serif", serif; font-size: 15px; line-height: 1.65; }
.checked { margin: 0; color: var(--muted); font-size: 11px; }
.report-link { display: inline-block; margin-block: 16px; color: var(--muted); font-size: 12px; text-underline-offset: 3px; }
.next-button { display: block; width: 100%; }

.result-card { padding: clamp(24px, 5vw, 42px); border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.result-rank-mark { display: grid; width: 82px; aspect-ratio: 1; place-items: center; margin: 0 auto 18px; border: 5px double #e0b45e; border-radius: 50%; color: #fff; background: var(--navy); font-size: 30px; font-weight: 900; }
.result-card h1 { margin: 4px 0; color: var(--navy); font-size: clamp(30px, 5vw, 48px); }
.result-score { margin: 12px 0 2px; color: var(--good); font-size: 38px; font-weight: 950; }
.result-summary { margin: 0; color: var(--muted); }
.field-results { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 24px; margin-block: 28px; text-align: start; }
.field-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; color: #40566c; font-size: 12px; font-weight: 750; }
.field-row div { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: #e1e9f0; overflow: hidden; }
.field-row i { display: block; height: 100%; background: var(--sky); }
.share-tools { margin-block-start: 24px; padding-block-start: 20px; border-block-start: 1px solid var(--line); text-align: start; }
.share-tools > p { margin: 0 0 12px; color: var(--navy); font-weight: 850; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--blue); border-radius: 8px; color: var(--blue); background: #fff; font-size: 12px; font-weight: 800; cursor: pointer; text-decoration: none; }
.share-button.primary { color: #fff; background: var(--blue); }
.share-status { display: block; min-height: 18px; margin-block-start: 8px; color: var(--muted); font-size: 11px; }
.home-button { width: 100%; margin-block-start: 20px; }

[hidden] { display: none !important; }
@media (max-width: 700px) {
  .mode-grid { grid-template-columns: 1fr; }
  .header-actions { gap: 7px; }
  .ja-switch span { display: none; }
  .choices { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .shell, .app-shell { width: calc(100% - 24px); }
  .game-header { grid-template-columns: auto 1fr auto; min-height: 58px; padding-inline: 8px; }
  .mini-brand span:last-child { display: none; }
  .game-name { font-size: 16px; text-align: center; }
  .app-shell { padding-block: 30px; }
  #home > h1 { font-size: 34px; }
  .lead { font-size: 15px; }
  .mode-grid { margin-block-start: 28px; }
  .mode-card { grid-template-columns: 54px 1fr; padding: 20px; }
  .mode-icon { width: 54px; font-size: 20px; }
  .mode-card h2 { font-size: 24px; }
  #question { margin-block: 16px 20px; font-size: 24px; }
  .choice { min-height: 58px; }
  .answer-panel { padding: 19px; }
  .source-card { padding: 16px; }
  .field-results { grid-template-columns: 1fr; }
  .result-score { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
