:root {
  color-scheme: light;
  --bg: #FAFAF6; --paper: #FFFFFF; --ink: #14161A; --muted: #4C515C; --line: #D9DAD2; --strong-line: #14161A;
  --grid: #ECECE4; --hi: #FFD21F; --on-hi: #14161A; --hi-soft: #FFF6CC; --link: #1C46C9; --good: #1C46C9; --bad: #B83F0B;
  --track: #ECECE4; --invert-bg: #14161A; --invert-ink: #FFFFFF; --cta-bg: #14161A; --cta-ink: #FFFFFF; --cell-gap: #FFFFFF;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111318; --paper: #1A1D24; --ink: #F3F3EE; --muted: #B4B8C1; --line: #343842; --strong-line: #F3F3EE;
    --grid: #1A1D24; --hi-soft: #3A3414; --link: #8FB0FF; --good: #8FB0FF; --bad: #FF9E66;
    --track: #343842; --invert-bg: #262A33; --invert-ink: #F3F3EE; --cta-bg: #FFD21F; --cta-ink: #14161A; --cell-gap: #1A1D24;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318; --paper: #1A1D24; --ink: #F3F3EE; --muted: #B4B8C1; --line: #343842; --strong-line: #F3F3EE;
  --grid: #1A1D24; --hi-soft: #3A3414; --link: #8FB0FF; --good: #8FB0FF; --bad: #FF9E66;
  --track: #343842; --invert-bg: #262A33; --invert-ink: #F3F3EE; --cta-bg: #FFD21F; --cta-ink: #14161A; --cell-gap: #1A1D24;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background-color: var(--bg); font: 17px/1.5 var(--font);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; overflow-wrap: anywhere;
}
:lang(ja) body, body:lang(ja) { font-family: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans JP", sans-serif; line-break: strict; }
a { color: var(--link); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--paper); padding: 10px 14px; border: 2px solid var(--strong-line); border-radius: 8px; }
.skip:focus { left: 8px; }

/* Header */
.site-header .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.logo { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; font-size: 22px; letter-spacing: -.02em; }
.logo b { font-weight: 800; }
.logo svg { width: 30px; height: 30px; flex: none; }
.logo .m { fill: currentColor; }
.logo .h { fill: #FFD21F; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.site-nav > a { color: var(--ink); min-height: 44px; display: inline-flex; align-items: center; }
.tool { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 12px; background: var(--paper); color: var(--ink); border: 1px solid var(--strong-line); border-radius: 8px; font: inherit; cursor: pointer; }
.tool svg { width: 18px; height: 18px; }
.lang { position: relative; }
.lang summary { list-style: none; }
.lang summary::-webkit-details-marker { display: none; }
.lang ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; min-width: 190px; list-style: none; background: var(--paper); border: 1px solid var(--strong-line); border-radius: 8px; }
.lang li a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 6px; color: var(--ink); text-decoration: none; }
.lang li a:hover, .lang li a[aria-current] { background: var(--hi-soft); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 8px 24px; border-radius: 10px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 2px solid var(--strong-line); background: var(--paper); color: var(--ink); }
.btn:hover { color: var(--ink); background: var(--hi-soft); }
.btn.primary { background: var(--cta-bg); color: var(--cta-ink); border-color: var(--cta-bg); }
.btn.primary:hover { color: var(--cta-ink); filter: brightness(1.15); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Home */
.hero { display: flex; flex-wrap: wrap; gap: 40px 48px; align-items: center; padding: 40px 0 52px; }
.hero-copy { flex: 999 1 520px; min-width: 0; }
.hero h1 { margin: 0 0 20px; font-size: clamp(38px, 6vw, 68px); line-height: 1.12; font-weight: 800; letter-spacing: -.03em; }
:lang(ja) .hero h1, :lang(ja) h1, :lang(ja) h2 { letter-spacing: 0; line-height: 1.2; }
.mark { background: linear-gradient(transparent 13%, var(--hi) 13%, var(--hi) 91%, transparent 91%); color: var(--on-hi); padding: 0 .14em; white-space: nowrap; }
.lead { margin: 0 0 26px; font-size: clamp(18px, 2.2vw, 21px); line-height: 1.45; color: var(--muted); max-width: 620px; }
.hero-art { flex: 1 1 300px; display: flex; justify-content: center; }
.hero-art svg { width: min(100%, 380px); height: auto; aspect-ratio: 1; background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; }
.perks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; margin: 0; padding: 0; list-style: none; }
.perks li { padding: 20px 22px; }
.perks b { display: block; font-size: 18px; }
.perks span { color: var(--muted); }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
h2 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: -.02em; margin: 0 0 18px; }
.block { margin-top: 48px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; align-items: flex-start; }
.card h3 { margin: 0 0 8px; font-size: 22px; }
.card p { margin: 0 0 14px; color: var(--muted); flex-grow: 1; }
.card .btn { width: 100%; min-height: 48px; }
.honest { padding: 28px; background: var(--invert-bg); color: var(--invert-ink); border-radius: 12px; }
.honest h2 { font-size: 28px; margin-bottom: 10px; }
.honest p { margin: 0; font-size: 18px; max-width: 820px; }
.honest a { color: inherit; font-weight: 700; }
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 0 18px; }
.faq summary { min-height: 52px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.faq p { margin: 0 0 16px; color: var(--muted); }
.ad-slot { display: flex; align-items: center; justify-content: center; min-height: 110px; margin: 36px 0; padding: 12px; text-align: center; border: 1px dashed var(--muted); border-radius: 8px; color: var(--muted); font-size: 14px; background: var(--bg); }

/* Articles */
.article { max-width: 760px; padding: 24px 0 8px; }
.article h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.08; font-weight: 800; letter-spacing: -.025em; margin: 0 0 16px; }
.article h2 { font-size: 24px; margin: 30px 0 8px; letter-spacing: -.01em; }
.article p { margin: 0 0 12px; }
.article .lead { margin-bottom: 22px; }
.article .btn { margin-top: 18px; }
.article .body-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 4px 24px 22px; }

.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); min-height: 24px; display: inline-block; }
.related { margin-top: 28px; }
.related h2 { font-size: 20px; margin: 0 0 8px; letter-spacing: 0; }
.related ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.related a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }
.table-box { overflow-x: auto; margin: 14px 0; }
.table-box table { width: 100%; border-collapse: collapse; }
.table-box th, .table-box td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table-box td:last-child, .table-box th:last-child { font-variant-numeric: tabular-nums; }
.sample { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; --cell-gap: var(--paper); }
.article .sample h2 { margin: 0 0 4px; }
.sample-stem { display: flex; margin: 10px 0 12px; }
.sample-stem .stem-svg { width: min(100%, 300px); }
.sample .opts { max-width: 560px; }
.sample .opt { cursor: default; }
.sample details { margin-top: 10px; }
.sample summary { min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; color: var(--link); cursor: pointer; }
.sample details[open] summary { display: flex; }

.article-list { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.article-list a { display: block; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.article-list a:hover { border-color: var(--strong-line); background: var(--hi-soft); }
.article-list b { display: block; font-size: 19px; margin-bottom: 2px; }
.article-list span { color: var(--muted); }
.sources { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--line); font-size: 15px; }
.article .sources h2 { font-size: 18px; margin-top: 14px; }
.sources ol { margin: 0 0 12px; padding-left: 20px; }
.sources li { margin-bottom: 6px; }
.sources p { color: var(--muted); margin-bottom: 6px; }

/* Test start */
.start { max-width: 760px; padding: 24px 0 8px; }
.start h1 { font-size: clamp(36px, 5.4vw, 56px); line-height: 1.05; font-weight: 800; letter-spacing: -.025em; margin: 0 0 14px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 22px; padding: 0; }
.facts li { padding: 6px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; font-size: 15px; }
.panel { background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; padding: 22px; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.panel .btn { min-width: 200px; flex: 0 1 auto; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; margin-bottom: 16px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }

/* Test running */
body.running .site-header, body.running .site-footer, body.running .ad-slot, body.running .after-run, body.running .consent { display: none; }
body.running { background-image: none; }
.run-bar { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 2px solid var(--strong-line); }
.run-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding-top: 10px; padding-bottom: 10px; }
.run-count { font-weight: 700; white-space: nowrap; }
.run-timer { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; margin-left: auto; }
.run-timer.low { color: var(--bad); }
.progress { order: 5; flex: 1 0 100%; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); width: 0; transition: width .2s; }
.run-main { display: grid; gap: 14px 48px; padding-top: 18px; padding-bottom: 28px; align-items: start; grid-template-columns: minmax(0, 1fr); }
.q-title { margin: 0 0 12px; font-size: clamp(19px, 2.3vw, 24px); line-height: 1.25; font-weight: 800; letter-spacing: -.01em; }
.q-title:focus { outline: none; }
.stem-box { display: flex; justify-content: center; }
.stem-svg { width: min(100%, 44vh, 480px); height: auto; aspect-ratio: 1; background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; }
.grid-line { stroke: var(--line); }
.q-cell { fill: var(--hi); }
.q-mark { fill: var(--on-hi); font-family: var(--font); }
.series { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; list-style: none; margin: 0; padding: 18px; width: 100%; background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; font-size: clamp(22px, 3.4vw, 34px); font-weight: 800; font-variant-numeric: tabular-nums; }
.series li { padding: 4px 12px; }
.series li.q { background: var(--hi); color: var(--on-hi); border-radius: 8px; padding: 4px 18px; }
.analogy { display: flex; align-items: center; justify-content: space-around; flex-wrap: wrap; gap: 10px 24px; width: 100%; background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; padding: 16px; }
.ana-pair { display: flex; align-items: center; gap: 8px; }
.ana-svg { width: clamp(84px, 22vw, 104px); height: auto; aspect-ratio: 1; }
.ana-sep { font-size: 26px; font-weight: 800; }
.figure-box { display: flex; justify-content: center; width: 100%; background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; padding: 12px; }
.stem-figure { width: min(60vw, 34vh, 260px); height: auto; aspect-ratio: 1; }
.opts { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.opts.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opts.n5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.opt { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; min-height: 44px; padding: 4px; background: var(--paper); color: var(--ink); border: 1px solid var(--muted); border-radius: 10px; font: inherit; cursor: pointer; --cell-gap: var(--paper); }
.opts.nums .opt { aspect-ratio: auto; min-height: 64px; }
.opt:hover { border-color: var(--strong-line); background: var(--hi-soft); --cell-gap: var(--hi-soft); }
.opt[aria-pressed="true"] { background: var(--hi-soft); border: 3px solid var(--strong-line); --cell-gap: var(--hi-soft); }
.opt .tag { position: absolute; left: 6px; top: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.opt-svg { width: 100%; height: 100%; }
.num-option { font-size: clamp(20px, 2.8vw, 26px); font-weight: 800; font-variant-numeric: tabular-nums; }
.opt.is-right { border: 3px solid var(--good); }
.opt.is-wrong { border: 3px solid var(--bad); }
.opts-title { margin: 0 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.run-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.key-hint { display: none; color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.feedback { margin: 12px 0 0; padding: 12px 14px; background: var(--hi-soft); border-radius: 8px; }
.feedback b { display: block; }
.exit-link { background: none; border: 0; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }
dialog { border: 2px solid var(--strong-line); border-radius: 12px; background: var(--paper); color: var(--ink); padding: 22px; max-width: min(92vw, 460px); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h2 { font-size: 22px; margin: 0 0 8px; }
dialog p { margin: 0 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (max-width: 479px) {
  /* The method page stays one tap away in the footer. */
  .site-nav > a:nth-of-type(4) { display: none; }
  .site-nav { gap: 6px 14px; }
  .panel .btn, .hero .btn, .block > .btn-row .btn { flex: 1 1 100%; }
}
@media (min-width: 900px) {
  .run-main.split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-main.split .q-title { grid-column: 1 / -1; margin-bottom: 0; }
  .stem-svg { width: min(100%, 62vh, 480px); }
  .key-hint { display: block; }
  .progress { order: 0; flex: 1 1 200px; width: auto; }
  .run-timer { margin-left: 0; }
  .opts.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .run-nav { display: flex; justify-content: space-between; }
  .run-nav .btn { min-width: 150px; }
}

/* Result */
.score-card { display: flex; flex-wrap: wrap; gap: 28px 40px; background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; padding: clamp(20px, 3vw, 36px); margin-top: 20px; }
.score-main { flex: 1 1 260px; }
.score-side { flex: 999 1 420px; min-width: 0; }
.score-label { font-weight: 600; color: var(--muted); }
.score-value { font-size: clamp(88px, 12vw, 120px); line-height: 1; font-weight: 800; letter-spacing: -.04em; margin: 6px 0; font-variant-numeric: tabular-nums; }
.score-correct { font-size: 20px; font-weight: 700; }
.score-meta { color: var(--muted); }
.score-side h1 { margin: 0 0 12px; font-size: clamp(22px, 2.8vw, 28px); line-height: 1.2; font-weight: 800; }
.scale { position: relative; height: 14px; background: var(--track); border-radius: 7px; margin: 22px 0 6px; }
.scale i { position: absolute; top: -6px; width: 6px; margin-left: -3px; height: 26px; background: var(--ink); border-radius: 3px; }
.scale-labels { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.scale-labels span:nth-child(2) { text-align: center; }
.scale-labels span:nth-child(3) { text-align: right; }
.honest-note { margin: 18px 0 0; padding: 12px 14px; background: var(--hi-soft); border-radius: 8px; line-height: 1.45; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.result-actions .btn { min-height: 48px; padding: 6px 18px; flex: 1 1 150px; }
.bars { display: grid; gap: 12px; margin: 0; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 200px) minmax(0, 1fr) 64px; gap: 16px; align-items: center; }
.bars dt, .bars dd { margin: 0; }
.bar { display: block; height: 14px; background: var(--track); border-radius: 7px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 7px; }
.bar-count { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
@media (max-width: 599px) {
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}
.review details { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 0 16px; }
.review summary { min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; cursor: pointer; font-weight: 700; padding: 6px 0; }
.review .mark-right { color: var(--good); }
.review .mark-wrong { color: var(--bad); }
.review-body { padding-bottom: 16px; }
.review-body .stem-svg { width: min(100%, 280px); }
.review-body .opts { max-width: 560px; margin-top: 12px; }
.review-body .opt { cursor: default; }
.review-body p { margin: 8px 0; }
.shared-note { padding: 12px 14px; background: var(--hi-soft); border-radius: 8px; margin: 16px 0 0; }

/* Footer, consent */
.site-footer { margin-top: 56px; border-top: 2px solid var(--strong-line); background: var(--paper); }
.foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 24px; padding-top: 28px; padding-bottom: 28px; }
.foot h2 { font-size: 15px; letter-spacing: 0; margin: 0 0 6px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li a, .foot li button { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink); background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
.foot p { margin: 0; color: var(--muted); font-size: 15px; }
.consent { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; max-width: 620px; margin-left: auto; background: var(--paper); border: 2px solid var(--strong-line); border-radius: 12px; padding: 16px; }
.consent h2 { font-size: 18px; margin: 0 0 4px; letter-spacing: 0; }
.consent p { margin: 0 0 12px; font-size: 15px; }
.consent .btn { min-height: 44px; padding: 4px 16px; flex: 1 1 160px; font-size: 15px; }
.langs-root { max-width: 520px; margin: 12vh auto; padding: 0 24px; }
.langs-root ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.langs-root a { display: flex; align-items: center; min-height: 52px; padding: 0 18px; background: var(--paper); border: 1px solid var(--strong-line); border-radius: 10px; font-weight: 700; color: var(--ink); text-decoration: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (forced-colors: active) { .q-cell { fill: Highlight; } .opt[aria-pressed="true"] { border-color: Highlight; } }
