:root {
  --paper: #f7f4ea;
  --ink: #243e35;
  --green: #164c45;
  --muted: #5f6c60;
  --line: #d6d9c8;
  --rust: #995330;
  --sand: #eae6d5;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a, input { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--rust); outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.035em; }
h1 { font-size: clamp(44px, 5.6vw, 76px); line-height: 1.08; }
h1 em { color: var(--green); font-weight: 400; }
h2 { font-size: 32px; line-height: 1.2; }
h3 { font-size: 15px; }
.site-header, main, .site-footer { max-width: 1240px; margin: 0 auto; padding-left: 48px; padding-right: 48px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 28px; padding-bottom: 25px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--serif); font-size: 26px; letter-spacing: -.6px; white-space: nowrap; }
.brand em { color: var(--green); }
.header-note { color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 16px; }
.button { border: 1px solid transparent; border-radius: 6px; padding: 12px 19px; min-height: 46px; font-weight: 600; display: inline-flex; justify-content: center; align-items: center; gap: 12px; transition: background .15s, transform .15s; text-decoration: none; }
.button-primary { background: var(--green); color: #fff9ec; border-color: var(--green); }
.button-primary:hover:not(:disabled) { background: #0d3832; transform: translateY(-1px); }
.button-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.button-outline:hover { background: var(--sand); }
.button:disabled { opacity: .6; }
.button-wide { width: 100%; justify-content: space-between; }
.button-wide span { font-size: 24px; line-height: 1; }
.count { background: #e4e7d8; border-radius: 20px; padding: 1px 8px; font-size: 12px; }
.eyebrow, .label, .caption-tag, .direction-label { font-size: 10px; font-weight: 700; letter-spacing: 1.8px; }
.eyebrow { color: var(--muted); }
.label { color: var(--muted); display: block; margin-bottom: 5px; font-size: 9px; letter-spacing: 1.4px; }
.tiny-compass { font-size: 19px; color: var(--rust); margin-right: 8px; vertical-align: -2px; }
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding-top: 55px; padding-bottom: 52px; }
.hero-copy h1 { margin: 22px 0; }
.hero-description { color: var(--muted); font-size: 16px; line-height: 1.8; }
.language-switch { display: flex; margin: 27px 0 22px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #efeee2; gap: 4px; }
.language-switch button { flex: 1; border: 1px solid transparent; color: var(--muted); background: none; border-radius: 5px; text-align: left; padding: 10px 16px; font-size: 15px; font-weight: 600; min-height: 48px; }
.language-switch button span { display: block; font-size: 11px; font-weight: 400; margin-top: 2px; }
.language-switch button[aria-pressed="true"] { background: #fffdf6; color: var(--green); border-color: #d2d6c5; box-shadow: 0 2px 5px #243e3508; }
.language-switch button:hover { color: var(--green); }
.boarding-pass { border: 1px solid #cfd3be; background: #fffdf5; padding: 19px 22px 15px; border-radius: 9px; position: relative; box-shadow: 0 4px 12px #243e3505; }
.pass-top { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--line); padding-bottom: 12px; margin-bottom: 17px; }
.ticket-icon { font-size: 26px; color: var(--rust); line-height: 1; }
.pass-info { display: flex; justify-content: space-between; gap: 20px; }
.pass-info strong { font-size: 17px; font-weight: 600; }
.pass-detail { font-size: 12px; color: var(--muted); margin: 13px 0 17px; }
.difficulty-label { color: var(--muted); font-size: 9px; letter-spacing: 1.2px; margin-bottom: 6px; }
.difficulty-select { width: 100%; min-width: 0; padding: 10px; min-height: 44px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); font-size: 12px; margin-bottom: 16px; }
.pass-footnote { font-size: 11px; color: var(--muted); text-align: center; margin-top: 11px; }
.map-panel { margin-top: 16px; min-width: 0; position: relative; border-radius: 130px 130px 10px 10px; overflow: hidden; background: #e9eddf; border: 1px solid #cdd6c0; align-self: stretch; }
.voyage-map { width: 100%; height: 100%; min-height: 465px; object-fit: cover; display: block; }
.map-caption { position: absolute; bottom: 28px; left: 28px; padding: 16px 22px; background: #fffaf0ee; box-shadow: 3px 4px 0 #bac4ab66; transform: rotate(-3deg); border: 1px solid #e0dccb; }
.caption-tag { font-size: 8px; color: var(--muted); }
.map-caption p { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.4; margin-top: 6px; }
.journey-details { display: grid; grid-template-columns: 1.25fr 1fr; gap: 64px; padding: 36px 0 42px; border-top: 1px solid var(--line); }
.route-panel h2 { margin: 9px 0 22px; }
.route-stops { list-style: none; padding: 0; margin: 0; }
.route-stops li { position: relative; display: flex; align-items: center; gap: 16px; padding: 13px 0; }
.route-stops li:not(:last-child)::after { content: ""; position: absolute; width: 1px; height: 28px; background: var(--line); left: 18px; top: 48px; }
.stop-number { display: grid; place-items: center; flex: 0 0 37px; height: 37px; border: 1px solid var(--line); border-radius: 50%; font-size: 11px; color: var(--muted); }
.current .stop-number { background: var(--green); color: white; border-color: var(--green); }
.visited .stop-number { background: #e0e6d6; color: var(--green); }
.route-stops strong { display: block; font-size: 14px; font-weight: 600; }
.route-stops div > span { color: var(--muted); font-size: 11px; }
.here { margin-left: auto; color: var(--green); font-size: 8px; letter-spacing: 1px; white-space: nowrap; border: 1px solid #c9d3c0; padding: 4px 8px; border-radius: 3px; }
.route-note { font-size: 12px; color: var(--muted); margin-top: 18px; }
.field-card { border: 1px solid var(--line); border-radius: 7px; background: #edeedf; padding: 26px 30px; position: relative; }
.field-symbol { position: absolute; right: 25px; top: 25px; font-size: 35px; color: #849478; transform: rotate(-10deg); }
.field-card h2 { margin: 13px 0 16px; }
.field-card > p:not(.eyebrow) { font-size: 14px; color: var(--muted); max-width: 290px; }
.text-button { border: 0; background: none; color: var(--green); padding: 8px 0; min-height: 44px; font-size: 13px; font-weight: 600; text-align: left; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--rust); }
.field-card .text-button { margin-top: 13px; }
.log-strip { display: flex; align-items: center; gap: 24px; border-top: 1px solid var(--line); padding: 22px 0; }
.log-strip strong { font-size: 13px; font-weight: 600; }
.log-strip p { font-size: 12px; color: var(--muted); margin-left: auto; }
.log-strip .text-button { font-size: 11px; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-top: 22px; padding-bottom: 28px; font-size: 11px; color: var(--muted); }
.site-footer > span:first-child { font-family: var(--serif); font-style: italic; font-size: 14px; }
.two-way { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: #fffaf0; margin-bottom: 16px; font-family: var(--serif); font-size: clamp(18px, 5vw, 23px); }
.journey-details > * { min-width: 0; }
.two-way small { display: block; font: 11px var(--sans); color: var(--muted); margin-top: 4px; }
.route-panel .hint + .hint { margin-top: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.round-layout { max-width: 840px; margin: 0 auto; padding: 44px 0 50px; }
.round-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.round-heading h1 { font-size: 34px; margin-top: 7px; }
.round-heading .button { font-size: 12px; }
.round-dashboard { display: grid; grid-template-columns: 1.2fr 1fr 1fr; align-items: center; gap: 25px; margin-top: 30px; background: #e9edde; border: 1px solid var(--line); border-radius: 7px; padding: 18px 26px; }
.round-dashboard strong { display: block; font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2; }
.round-dashboard small { font-size: 12px; color: var(--muted); }
.timer-group { display: flex; align-items: center; gap: 12px; }
.timer-group > span { font-size: 32px; color: var(--green); }
.timer-low { color: var(--rust); }
.time-track { height: 3px; background: var(--line); margin: 14px 0 25px; border-radius: 3px; overflow: hidden; }
#time-fill { height: 100%; background: var(--green); transition: width .25s linear; }
.quiz-card { border: 1px solid var(--line); border-radius: 10px; padding: 28px 36px; background: #fffdf6; box-shadow: 0 8px 25px #243e3506; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.quiz-meta .eyebrow { font-size: 9px; }
.quiz-meta .eyebrow > span { padding: 0 8px; opacity: .4; }
.mode-tag { font-size: 10px; color: var(--rust); background: #f3eadd; padding: 4px 9px; border-radius: 3px; white-space: nowrap; }
.question-instruction { color: var(--muted); margin-top: 34px; font-size: 14px; }
.word-context { font-size: 11px; color: var(--muted); margin-top: 8px; }
.phrase-prompt { font-size: clamp(22px, 2.8vw, 30px); line-height: 1.4; }
.phrase-prompt mark { background: #f3e2b4; color: inherit; padding: 0 4px; border-radius: 3px; }
.question-hint { margin: -4px 0 14px; color: var(--muted); font-size: 13px; }
.entry-example { font-family: var(--serif); font-style: italic; margin-top: 8px; }
.entry-note { color: var(--muted); font-size: 12px; margin-top: 3px; }
.language-switch.three button { padding-left: 12px; padding-right: 12px; }
.deck-switch { margin-top: -8px; }
.notes-deck-label { margin-bottom: 18px; }
.notes-deck-label select { margin: 6px 0 0; }
.example-field { margin-top: 14px; }
.example-field input { margin-top: 7px; }
.note-example { font-family: var(--serif); font-style: italic; }
.sources-layout { max-width: 800px; padding-top: 40px; padding-bottom: 50px; }
.sources-layout h1 { font-size: 44px; margin-bottom: 24px; }
.sources-layout h2 { margin: 28px 0 12px; }
.sources-layout p + p { margin-top: 12px; }
.question-prompt { font-family: var(--serif); font-size: clamp(25px, 3.4vw, 37px); line-height: 1.3; letter-spacing: -.02em; margin: 12px 0 17px; overflow-wrap: anywhere; }
.romaji-prompt { font-size: 49px; font-style: italic; }
.direction-label { color: var(--rust); font-size: 9px; letter-spacing: 1.3px; margin-bottom: 29px; }
label { display: block; font-weight: 600; font-size: 12px; }
input { width: 100%; min-width: 0; border: 1px solid #bfc8b5; background: #fffef9; border-radius: 5px; padding: 13px 14px; color: var(--ink); min-height: 48px; }
input::placeholder { color: #758174; opacity: 1; font-size: 13px; }
input:disabled { background: #f1f1e7; opacity: .8; }
.answer-row { display: flex; gap: 10px; margin-top: 8px; }
.answer-row .button { flex: 0 0 auto; }
.quiz-bottom { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 13px; }
.quiz-bottom .text-button { white-space: nowrap; font-size: 12px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: flex; align-items: center; gap: 12px; border: 1px solid #c7cfbc; background: #fcfbf2; border-radius: 5px; padding: 14px; color: var(--ink); text-align: left; min-height: 65px; overflow-wrap: anywhere; }
.choice:hover:not(:disabled) { border-color: var(--green); background: #ecf0e1; }
.choice-letter { flex: 0 0 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; height: 26px; font-size: 11px; color: var(--muted); }
.choice-correct { background: #e5efdc; border-color: #567b4e; }
.choice-wrong { background: #f6e7dc; border-color: #a36548; }
.choice-check { margin-left: auto; }
.answer-feedback { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; margin-top: 22px; border-radius: 6px; border: 1px solid #c8d6ba; background: #eef2e4; }
.answer-feedback.incorrect { border-color: #e3cbbb; background: #faf0e5; }
.answer-feedback strong { font-size: 14px; }
.answer-feedback p { margin-top: 5px; font-size: 13px; overflow-wrap: anywhere; }
.answer-feedback .button { flex: 0 0 auto; font-size: 12px; }
.level-up { color: var(--green); font-weight: 600; }
.round-note { text-align: center; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 14px; margin-top: 23px; }
.round-note span { color: var(--rust); margin-right: 7px; }
.results-layout { max-width: 820px; margin: 0 auto; text-align: center; padding: 44px 0 55px; }
.result-emblem { margin-bottom: 17px; }
.result-emblem img { border-radius: 20px; box-shadow: 0 0 0 8px #e5e9d7; }
.results-layout h1 { font-size: 45px; margin: 16px 0; }
.results-intro { color: var(--muted); max-width: 540px; margin: 0 auto; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 32px 0 17px; border: 1px solid var(--line); background: #edeedf; border-radius: 8px; padding: 22px; }
.result-stats > div + div { border-left: 1px solid var(--line); }
.result-stats strong { display: block; font-family: var(--serif); font-size: 45px; font-weight: 400; }
.result-stats span { color: var(--muted); font-size: 12px; }
.results-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 26px 0 36px; }
.review-panel { text-align: left; padding: 25px 30px; background: #fffdf5; border: 1px solid var(--line); border-radius: 7px; }
.review-panel h2 { font-size: 28px; margin: 8px 0 18px; }
.review-list { list-style: none; margin: 0; padding: 0; }
.review-list li { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; border-top: 1px solid var(--line); padding: 13px 0; overflow-wrap: anywhere; }
.review-list strong { font-size: 15px; }
.review-list span { color: var(--muted); font-size: 13px; }
dialog { width: min(660px, calc(100% - 32px)); max-height: calc(100dvh - 40px); border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); padding: 28px; box-shadow: 0 20px 100px #102c3455; }
dialog::backdrop { background: #142f36a6; backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-header h2 { font-size: 36px; margin-top: 7px; }
.icon-button { border: 1px solid var(--line); background: none; color: var(--ink); border-radius: 50%; font-size: 27px; width: 44px; height: 44px; line-height: 1; }
.dialog-intro { font-size: 13px; color: var(--muted); margin: 15px 0; }
.small { margin: 16px 0 22px; }
.small button { font-size: 13px; }
.small button span { display: inline; font-size: 10px; margin-left: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label > span { display: block; margin-bottom: 7px; }
#glossary-help { margin-top: 10px; }
.form-error { color: #974423; font-size: 12px; margin: 12px 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions .button { font-size: 12px; }
.notes-heading { display: flex; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line); margin-top: 25px; padding-top: 20px; }
#notes-total { color: var(--muted); font-size: 11px; }
.glossary-list { list-style: none; margin: 12px 0; padding: 0; }
.glossary-list li { border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; }
.glossary-list li > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.glossary-list strong { display: block; font-size: 14px; }
.glossary-list li > div > span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.note-actions { display: flex; gap: 16px; flex-shrink: 0; }
.note-actions button { font-size: 11px; }
.remove-button { color: var(--rust); }
.glossary-list .empty-notes { display: block; text-align: center; padding: 25px; color: var(--muted); background: #edeedf; border: 1px dashed var(--line); border-radius: 5px; }
.empty-notes > span { font-size: 28px; color: var(--rust); }
.empty-notes p { font-size: 12px; margin-top: 5px; }
.local-note { font-size: 10px; color: var(--muted); margin-top: 16px; }
.storage-warning { background: #f6e4cb; color: #6f3f23; padding: 13px 24px; font-size: 13px; margin: 0; }
.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; }
.skip-link { position: absolute; top: 8px; left: 8px; z-index: 10; padding: 12px; background: white; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
@media (min-width: 1300px) { .hero { gap: 68px; } }
@media (max-width: 950px) {
  .site-header, main, .site-footer { padding-left: 28px; padding-right: 28px; }
  .header-note { display: none; }
  .hero { gap: 26px; padding-top: 38px; }
  .hero-description br { display: none; }
  .map-panel { border-radius: 90px 90px 8px 8px; }
  .voyage-map { min-height: 440px; }
  .map-caption { left: 16px; bottom: 25px; padding: 12px 16px; }
  .map-caption p { font-size: 18px; }
  .journey-details { gap: 30px; }
  .field-card { padding: 24px; }
  .here { font-size: 7px; padding: 3px 5px; }
  .log-strip { flex-wrap: wrap; gap: 8px 20px; }
}
@media (max-width: 650px) {
  .language-switch.three { gap: 2px; padding: 3px; }
  .language-switch.three button { padding: 8px 6px; font-size: 12px; min-height: 48px; }
  .language-switch.three button span { font-size: 9px; }
  .deck-switch { margin-top: -10px; }
  .site-header, main, .site-footer { padding-left: 20px; padding-right: 20px; }
  .site-header { padding-top: 18px; padding-bottom: 18px; gap: 10px; }
  .brand { font-size: 22px; gap: 8px; }
  .brand img { width: 34px; height: 34px; }
  #glossary-open { padding: 8px 10px; font-size: 11px; gap: 6px; min-height: 44px; }
  #glossary-open > span:first-child { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 32px; padding-bottom: 30px; gap: 30px; }
  .hero-copy h1 { font-size: clamp(43px, 9.4vw, 61px); margin-top: 18px; }
  .hero-description { font-size: 14px; }
  .eyebrow { font-size: 9px; letter-spacing: 1.4px; }
  .boarding-pass { padding: 16px 18px; }
  .pass-info strong { font-size: 15px; }
  .pass-detail { font-size: 11px; }
  .map-panel { margin-top: 0; border-radius: 90px 90px 8px 8px; max-height: 320px; }
  .voyage-map { min-height: 0; height: 320px; }
  .map-caption { bottom: 18px; left: 20px; }
  .map-caption p { font-size: 16px; }
  .journey-details { grid-template-columns: 1fr; gap: 26px; padding-top: 28px; }
  .here { font-size: 8px; padding: 4px 8px; }
  .field-card h2 br { display: none; }
  .field-card > p:not(.eyebrow) { max-width: none; }
  .log-strip { align-items: flex-start; flex-direction: column; }
  .log-strip p { margin-left: 0; }
  .site-footer { flex-direction: column; gap: 6px; }
  .round-layout { padding-top: 28px; }
  .round-heading { gap: 10px; align-items: flex-start; }
  .round-heading h1 { font-size: 28px; }
  .round-heading .button { padding: 8px 10px; min-height: 44px; font-size: 10px; white-space: nowrap; }
  .round-dashboard { padding: 15px 12px; gap: 10px; margin-top: 24px; position: sticky; top: 0; z-index: 2; box-shadow: 0 3px 8px #243e3508; }
  .round-dashboard strong { font-size: 24px; }
  .round-dashboard .label { font-size: 7px; letter-spacing: .7px; }
  .round-dashboard small { font-size: 10px; }
  .timer-group { gap: 7px; }
  .timer-group > span { display: none; }
  .quiz-card { padding: 22px 18px; }
  .quiz-meta .eyebrow { font-size: 8px; letter-spacing: 1px; }
  .mode-tag { font-size: 9px; }
  .question-instruction { margin-top: 25px; font-size: 12px; }
  .question-prompt { font-size: 23px; }
  .romaji-prompt { font-size: 40px; }
  .direction-label { font-size: 8px; letter-spacing: .8px; margin-bottom: 23px; }
  .answer-row { gap: 8px; }
  .answer-row .button { font-size: 12px; padding: 12px; gap: 7px; }
  .answer-row .button span { display: none; }
  .quiz-bottom { align-items: flex-start; gap: 10px; }
  .quiz-bottom .hint { margin-top: 10px; font-size: 10px; }
  .quiz-bottom .text-button { font-size: 10px; }
  .choice-grid { grid-template-columns: 1fr; gap: 9px; }
  .choice { min-height: 54px; padding: 12px; font-size: 14px; }
  .answer-feedback { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  .round-note { font-size: 12px; padding: 0 8px; }
  .results-layout h1 { font-size: 35px; }
  .results-intro { font-size: 14px; }
  .result-stats { padding: 16px 6px; }
  .result-stats strong { font-size: 34px; }
  .result-stats span { font-size: 10px; }
  .review-panel { padding: 20px; }
  .review-list li { grid-template-columns: 1fr; gap: 4px; }
  dialog { padding: 22px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .note-actions { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
