:root { --ink: #27251f; --muted: #6f6b61; --paper: #fffdf8; --wash: #f4f0e7; --red: #b53a35; --red-dark: #8f2925; --green: #28745b; --border: #d9d2c3; --shadow: 0 16px 45px rgb(57 45 28 / 10%); }
* { box-sizing: border-box; }
html { overflow-x: hidden; -webkit-tap-highlight-color: rgb(181 58 53 / 18%); }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: radial-gradient(circle at 15% 0%, #fff 0, transparent 28rem), var(--wash); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
a { color: inherit; }
button, input { font: inherit; }
a, button, label, input[type="range"], input[type="submit"] { touch-action: manipulation; }
.skip-link { position: absolute; left: -9999px; top: 1rem; }
.skip-link:focus { left: 1rem; z-index: 10; padding: .75rem 1rem; background: white; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-header { border-bottom: 1px solid rgb(39 37 31 / 10%); background: rgb(255 253 248 / 88%); }
.site-header__inner { width: min(72rem, calc(100% - 2rem)); margin: auto; padding: 1rem 0; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; min-height: 2.75rem; align-items: center; color: var(--red-dark); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 700; text-decoration: none; }
.site-header__descriptor, .site-footer { color: var(--muted); }
.site-header__account { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .9rem; }
.site-header__account form { margin: 0; }
.header-action { display: inline-flex; min-height: 2.75rem; align-items: center; padding: 0 .8rem; border: 1px solid var(--border); border-radius: .6rem; color: var(--ink); background: white; cursor: pointer; font: inherit; font-weight: 700; text-decoration: none; }
.header-action:hover { border-color: var(--red); color: var(--red-dark); }
main { flex: 1; }
.site-footer { padding: 2rem; text-align: center; }
.landing-page, .quiz-page { width: min(72rem, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) 0; }
.landing-hero { max-width: 50rem; margin-bottom: 4rem; }
.eyebrow { color: var(--red); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif; line-height: 1.1; overflow-wrap: anywhere; text-wrap: balance; }
.landing-hero h1 { margin: .5rem 0 1rem; font-size: clamp(2.4rem, 7vw, 5rem); }
.landing-hero__lede { max-width: 42rem; color: var(--muted); font-size: 1.15rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.section-heading h2 { margin: .25rem 0; font-size: 2rem; }
.section-heading__note, .level-card__description, .level-card__availability { color: var(--muted); }
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.level-card { display: flex; flex-direction: column; min-height: 20rem; padding: 1.5rem; border: 1px solid var(--border); border-radius: 1rem; background: var(--paper); box-shadow: var(--shadow); }
.level-card__topline { display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; font-weight: 700; text-transform: uppercase; }
.level-card__number { color: var(--red); }
.level-card h3 { margin: 2.5rem 0 .75rem; font-size: 1.45rem; }
.level-card__title { color: var(--muted); font-size: 1rem; }
.level-card__form { margin-top: auto; padding-top: 1.5rem; }
.question-count-control__label { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-size: .9rem; font-weight: 750; }
.question-count-control output { color: var(--red-dark); font-size: 1.15rem; }
.question-count-control input[type="range"] { width: 100%; margin: .6rem 0 0; accent-color: var(--red); cursor: pointer; }
.setup-page { width: min(42rem, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) 0; }
.auth-page { width: min(32rem, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) 0; }
.auth-card { padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--border); border-radius: 1.25rem; background: var(--paper); box-shadow: var(--shadow); }
.auth-card__heading { margin-bottom: 2rem; }
.auth-card__heading h1 { margin: .4rem 0 .75rem; font-size: clamp(2.2rem, 7vw, 3.5rem); }
.auth-card__heading > p:last-child { color: var(--muted); }
.auth-form { display: grid; gap: 1rem; }
.form-field { display: grid; gap: .4rem; }
.form-field label { font-weight: 750; }
.form-field input { width: 100%; min-height: 3rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: .65rem; background: white; }
.form-field input:focus-visible { outline: 3px solid #1675a6; outline-offset: 2px; border-color: transparent; }
.back-link { display: inline-flex; min-height: 2.75rem; align-items: center; margin-bottom: 1.25rem; color: var(--muted); font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--red-dark); }
.setup-card { padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--border); border-radius: 1.25rem; background: var(--paper); box-shadow: var(--shadow); }
.setup-card__heading { margin-bottom: 2.5rem; }
.setup-card__heading h1 { margin: .4rem 0 .75rem; font-size: clamp(2.2rem, 7vw, 3.5rem); }
.setup-card__heading > p:last-child { color: var(--muted); }
.setup-option { padding: 1.25rem; border: 1px solid var(--border); border-radius: .8rem; background: white; }
.setup-option + .setup-option { margin-top: 1rem; }
.setup-option output { color: var(--red-dark); font-size: 1.6rem; }
.setup-option input[type="range"] { width: 100%; height: 2.75rem; margin: .25rem 0 0; accent-color: var(--red); cursor: pointer; }
.range-limits { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; }
.difficulty-option legend { margin-bottom: .8rem; font-weight: 750; }
.difficulty-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.difficulty-choice { display: flex; min-height: 5rem; align-items: flex-start; gap: .55rem; padding: .85rem; border: 1px solid var(--border); border-radius: .7rem; cursor: pointer; }
.difficulty-choice:has(input:checked) { border-color: var(--red); background: #fff4f1; }
.difficulty-choice input { margin-top: .25rem; accent-color: var(--red); }
.difficulty-choice strong, .difficulty-choice small { display: block; }
.difficulty-choice small { margin-top: .2rem; color: var(--muted); }
.flashcard-answer { margin-bottom: 1.25rem; padding: 1.5rem; border: 1px solid var(--border); border-radius: .8rem; background: white; text-align: center; }
.flashcard-answer > p:last-child { margin: .25rem 0 0; font-size: 1.8rem; font-weight: 750; }
.self-assessment legend { width: 100%; margin-bottom: .8rem; text-align: center; font-weight: 750; }
.self-assessment__actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.self-assessment__actions form, .self-assessment__actions .button { width: 100%; }
.brand:focus-visible, .back-link:focus-visible, .difficulty-choice:has(input:focus-visible), .setup-option:has(input[type="range"]:focus-visible) { outline: 3px solid #1675a6; outline-offset: 3px; }
.button { display: inline-flex; min-height: 3rem; align-items: center; justify-content: center; padding: .7rem 1.15rem; border: 1px solid transparent; border-radius: .65rem; appearance: none; -webkit-appearance: none; cursor: pointer; font-weight: 750; text-decoration: none; }
.button--primary { color: white; background: var(--red); }
.button--primary:hover { background: var(--red-dark); }
.button--primary:disabled { cursor: not-allowed; opacity: .45; }
.button--secondary { border-color: var(--border); color: var(--ink); background: white; }
.button--wide { width: 100%; margin-top: 1.25rem; }
.button:focus-visible, .answer-option:has(input:focus-visible) { outline: 3px solid #1675a6; outline-offset: 3px; }
.quiz-page { width: min(42rem, calc(100% - 2rem)); }
.quiz-card, .result-card { padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--border); border-radius: 1.25rem; background: var(--paper); box-shadow: var(--shadow); }
.quiz-progress { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; font-weight: 700; }
progress { width: 100%; height: .45rem; margin-top: .75rem; accent-color: var(--red); }
.quiz-instruction { margin: 2.5rem 0 .25rem; color: var(--muted); text-align: center; }
.kanji-prompt { margin: 0 0 2.5rem; font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif, serif; font-size: clamp(6rem, 25vw, 10rem); font-weight: 500; text-align: center; }
fieldset { margin: 0; padding: 0; border: 0; }
.answer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.answer-option { display: flex; min-height: 4rem; align-items: center; gap: .7rem; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: .75rem; background: white; cursor: pointer; }
.answer-option:hover, .answer-option:has(input:checked) { border-color: var(--red); background: #fff4f1; }
.answer-option input { accent-color: var(--red); }
.feedback { margin: 0 0 1rem; padding: 1.25rem; border-radius: .8rem; }
.feedback--correct { color: #164c3b; background: #e2f4ed; }
.feedback--incorrect { color: #702723; background: #fbe9e6; }
.feedback__result { margin-top: 0; font-size: 1.35rem; font-weight: 800; }
.result-card { text-align: center; }
.result-card h1 { font-size: clamp(2.5rem, 8vw, 4rem); }
.score { margin: 2rem 0 0; color: var(--red); font-size: 2rem; }
.score strong { font-size: clamp(5rem, 18vw, 8rem); line-height: 1; }
.score-percentage { color: var(--muted); font-weight: 700; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 2rem; }
.flash-region { width: min(42rem, calc(100% - 2rem)); margin: 1rem auto 0; }
.flash { padding: .85rem 1rem; border-radius: .65rem; background: white; }
.flash--alert, .flash--error { color: #702723; background: #fbe9e6; }
@media (max-width: 48rem) { .level-grid { grid-template-columns: repeat(2, 1fr); } .section-heading { display: block; } }
@media (max-width: 34rem) { .site-header__account span { display: none; } .level-grid, .answer-grid, .difficulty-grid, .self-assessment__actions { grid-template-columns: 1fr; } .level-card { min-height: 17rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
