*, *::before, *::after { box-sizing: border-box; }

:root {
	--red: #d9363e;
	--red-dark: #a92531;
	--coral: #f26b5e;
	--yellow: #ffd166;
	--cream: #fff8ee;
	--paper: #fffdf9;
	--ink: #2b2526;
	--muted: #786d6c;
	--line: #eadbd2;
	--shadow: 0 14px 35px rgba(105, 38, 35, .12);
}

body { margin: 0; min-width: 320px; background: var(--cream); color: var(--ink); font-family: 'DM Sans', sans-serif; font-size: 16px; }
a { color: inherit; text-decoration: none; }
button { border: 0; cursor: pointer; font: inherit; }

.header { background: var(--red); color: white; position: relative; overflow: hidden; }
.header::after { background: var(--yellow); border-radius: 50%; content: ''; height: 180px; opacity: .28; position: absolute; right: -50px; top: -90px; width: 180px; }
.header-title { font-family: Fraunces, Georgia, serif; font-size: clamp(2.5rem, 8vw, 5.5rem); letter-spacing: 0; margin: auto; padding: 28px 20px 12px; text-align: center; }
.header-title a { color: white; }
nav { margin: auto; max-width: 900px; position: relative; z-index: 1; }
nav ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 0 12px 18px; }
nav li { border-bottom: 3px solid transparent; font-size: .9rem; font-weight: 700; letter-spacing: .05em; padding: 10px 18px; text-transform: uppercase; }
nav a:hover li, nav a.active li { border-color: var(--yellow); color: var(--yellow); }

.core { background: radial-gradient(circle at 85% 5%, #ffe4b2 0, transparent 25rem), var(--cream); min-height: 72vh; padding: 28px 18px 70px; }
.content { margin: auto; max-width: 1040px; }
.eyebrow { color: var(--red); font-size: .78rem; font-weight: 700; letter-spacing: .14em; margin: 0 0 8px; text-transform: uppercase; }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; letter-spacing: 0; }
h1 { font-size: clamp(2.15rem, 6vw, 4rem); line-height: 1; margin: 0 0 14px; }
h2 { font-size: 1.8rem; margin: 0; }
.muted { color: var(--muted); }
.topline, .section-heading, .lesson-top { align-items: center; display: flex; gap: 16px; justify-content: space-between; }
.hero { margin: 18px 0 30px; max-width: 700px; }
.hero p { color: var(--muted); font-size: 1.08rem; line-height: 1.6; margin: 0; }
.stats-strip { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 34px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 145px; padding: 16px 18px; }
.stat strong { display: block; font-family: Fraunces, Georgia, serif; font-size: 1.65rem; }
.stat span { color: var(--muted); font-size: .83rem; }
.category-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.category-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 180px; padding: 22px; transition: transform .18s, box-shadow .18s; }
.category-card:hover { box-shadow: 0 18px 40px rgba(105, 38, 35, .18); transform: translateY(-3px); }
.category-card h3 { font-size: 1.35rem; margin: 0 0 8px; }
.category-card p { color: var(--muted); line-height: 1.4; margin: 0 0 18px; }
.progress-line { background: #f0e5dd; border-radius: 99px; height: 8px; margin-top: auto; overflow: hidden; }
.progress-line span { background: var(--coral); display: block; height: 100%; }
.card-footer { align-items: center; display: flex; justify-content: space-between; margin-top: 10px; }
.card-footer small { color: var(--muted); }
.arrow { color: var(--red); font-size: 1.3rem; font-weight: 700; }
.button { background: var(--red); border-radius: 6px; color: white; display: inline-block; font-weight: 700; padding: 12px 18px; }
.button:hover { background: var(--red-dark); }
.button.secondary { background: white; border: 1px solid var(--line); color: var(--red-dark); }
.button.yellow { background: var(--yellow); color: var(--ink); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.empty-state, .lesson-card, .review-card, .progress-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: clamp(22px, 5vw, 44px); }
.lesson-wrap { margin: auto; max-width: 700px; }
.lesson-top { margin-bottom: 22px; }
.lesson-top .muted { font-size: .9rem; }
.lesson-card { min-height: 390px; text-align: center; }
.mode-label { color: var(--coral); font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.lesson-card h2 { font-size: clamp(2rem, 8vw, 3.5rem); margin: 22px 0 8px; }
.romaji { color: var(--red-dark); font-family: Fraunces, Georgia, serif; font-size: clamp(1.6rem, 5vw, 2.45rem); }
.note { color: var(--muted); line-height: 1.5; margin: 20px auto; max-width: 450px; }
.audio-button { background: #ffe2d5; border-radius: 50%; color: var(--red-dark); font-size: 1.5rem; height: 58px; margin: 18px auto; width: 58px; }
.audio-button:hover { background: var(--yellow); }
.silent-toggle { align-items: center; color: var(--muted); display: flex; font-size: .9rem; gap: 8px; justify-content: center; margin: 4px auto 18px; }
.silent-toggle input { accent-color: var(--red); height: 17px; width: 17px; }
.silent-note { color: var(--muted); font-size: .9rem; margin: 30px 0 29px; }
.answer-hidden { color: var(--muted); font-size: 1.1rem; margin: 55px auto 20px; }
.lesson-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 24px; }
.grade-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.review-card { margin: 22px auto; max-width: 700px; text-align: center; }
.review-card h2 { font-size: 2.3rem; margin: 24px 0 8px; }
.review-list { display: grid; gap: 10px; margin-top: 20px; }
.review-row { align-items: center; background: white; border: 1px solid var(--line); border-radius: 6px; display: flex; justify-content: space-between; padding: 14px 16px; text-align: left; }
.review-row strong { display: block; }
.review-row span { color: var(--muted); font-size: .9rem; }
.progress-panel { display: grid; gap: 18px; margin-top: 24px; }
.progress-row { align-items: center; display: grid; gap: 10px; grid-template-columns: minmax(130px, 1fr) 2fr auto; }
.progress-row .progress-line { margin: 0; }
.toast { background: var(--ink); border-radius: 6px; bottom: 22px; color: white; left: 50%; opacity: 0; padding: 12px 18px; pointer-events: none; position: fixed; transform: translate(-50%, 20px); transition: opacity .2s, transform .2s; z-index: 5; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.footer { background: var(--ink); color: #fff8ee; font-size: .85rem; padding: 28px 10%; }
@media (max-width: 560px) { nav li { padding-left: 9px; padding-right: 9px; } .progress-row { grid-template-columns: 1fr auto; } .progress-row .progress-line { grid-column: 1 / -1; grid-row: 2; } .topline { align-items: flex-start; flex-direction: column; } }