:root {
  --blue: #0071e3;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --soft: #f5f5f7;
  --line: #d2d2d7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--soft); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #5ac8fa; outline-offset: 3px; }

.topbar {
  min-height: 72px; padding: 0 clamp(24px, 5vw, 72px);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.82); border-bottom: 1px solid rgba(210,210,215,.7);
  position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 650; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--ink); color: white; font-family: serif; font-size: 20px; }
nav { display: flex; align-items: center; gap: 25px; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav-link.active { color: var(--ink); font-weight: 650; }
.language-button { border: 1px solid var(--line); border-radius: 999px; background: white; padding: 7px 13px; cursor: pointer; font-size: 12px; }

.hero { max-width: 1200px; margin: auto; padding: 96px clamp(24px, 7vw, 90px) 68px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, .8fr); gap: 56px; align-items: center; }
.hero-copy { max-width: 640px; }
.audience-badge, .eyebrow { color: #86868b; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { margin: 22px 0 22px; max-width: 650px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 7vw, 86px); line-height: .98; letter-spacing: -.055em; font-weight: 600; }
.hero h1 em { color: var(--blue); font-style: normal; }
.hero-text { max-width: 520px; color: var(--muted); font-size: 18px; line-height: 1.7; }
.hero-actions { display: flex; align-items: center; gap: 22px; margin-top: 32px; }
.primary, .next-button { border: 0; border-radius: 999px; background: var(--blue); color: white; padding: 16px 24px; cursor: pointer; font-weight: 650; box-shadow: 0 8px 22px rgba(0,113,227,.18); }
.primary:hover, .next-button:hover { background: #0066cc; transform: translateY(-1px); }
.text-link { color: var(--blue); text-decoration: none; font-weight: 600; }
.lesson-preview { background: white; border-radius: 28px; padding: 30px; box-shadow: 0 18px 50px rgba(0,0,0,.07); }
.preview-top, .card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-label, .lesson-pill { color: var(--blue); font-size: 11px; letter-spacing: .11em; font-weight: 700; text-transform: uppercase; }
.preview-sentence, .sentence { font-family: "YuKyokasho", "UD Digi Kyokasho", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", serif; }
.preview-sentence { margin: 34px 0 22px; text-align: center; font-size: clamp(28px, 4vw, 44px); line-height: 1.65; }
.preview-sentence strong, .sentence strong { color: var(--blue); font-weight: 500; }
.preview-translation, .translation { color: var(--muted); text-align: center; line-height: 1.6; }
.preview-divider { height: 1px; margin: 25px 0; background: #e8e8ed; }
.preview-question { font-weight: 650; }
.preview-options { display: flex; gap: 8px; margin-top: 15px; }
.preview-options span { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 11px; text-align: center; }
.preview-note { display: flex; gap: 8px; margin-top: 20px; color: var(--muted); font-size: 12px; }
.note-dot { color: var(--blue); }

.course-section, .how-section { padding: 86px clamp(24px, 7vw, 90px) 100px; background: #f5f5f7; }
.section-heading { max-width: 1060px; margin: 0 auto 28px; display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.section-heading h2 { margin: 10px 0 0; font-family: Georgia, serif; font-size: clamp(30px, 4vw, 48px); font-weight: 600; letter-spacing: -.04em; }
.support-copy { color: var(--muted); line-height: 1.6; max-width: 360px; margin: 0; }
.book-switcher { max-width: 1060px; margin: 0 auto 17px; display: flex; gap: 9px; }
.book-tab { flex: 1; border: 1px solid var(--line); background: white; border-radius: 15px; padding: 14px 17px; text-align: left; color: var(--muted); font: 600 15px inherit; cursor: pointer; }
.book-tab span { display: block; color: #86868b; font: 11px -apple-system, sans-serif; margin-top: 3px; }
.book-tab.active { border-color: var(--blue); background: #e8f3ff; color: var(--ink); }
.course-summary { max-width: 1060px; margin: 0 auto 14px; display: flex; justify-content: space-between; color: #86868b; font: 12px -apple-system, sans-serif; }
.unit-grid { max-width: 1060px; margin: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.unit-card { border: 1px solid #e2e2e5; border-radius: 16px; background: white; padding: 17px; text-align: left; min-height: 145px; cursor: pointer; font-family: inherit; position: relative; }
.unit-card:hover, .unit-card.selected { border-color: var(--blue); box-shadow: 0 4px 14px rgba(0,113,227,.1); }
.unit-card.selected::after { content: 'Current'; position: absolute; right: 12px; top: 14px; color: var(--blue); font: 10px -apple-system, sans-serif; }
.unit-number { display: block; color: #86868b; font: 10px -apple-system, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.unit-card strong { display: block; font-size: 14px; margin: 17px 0 5px; }
.unit-card small { display: block; color: var(--muted); font-size: 12px; }
.unit-card em { position: absolute; bottom: 14px; left: 17px; color: var(--blue); font: 11px -apple-system, sans-serif; font-style: normal; }
.unit-card em span { font-size: 15px; margin-left: 4px; }
.selected-unit-label { color: var(--blue); }

.lesson-section { padding: 90px clamp(24px, 7vw, 90px); background: white; }
.lesson-grid { max-width: 1060px; margin: auto; display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; }
.question-card, .clue-panel { border: 1px solid #e2e2e5; border-radius: 24px; background: white; padding: clamp(24px, 4vw, 48px); }
.question-card { background: #f5f5f7; }
.instruction { margin: 30px 0 24px; color: var(--muted); font-size: 15px; }
.sentence { margin: 0; text-align: center; font-size: clamp(30px, 5vw, 58px); line-height: 1.8; }
.translation { margin: 22px auto; max-width: 550px; display: flex; flex-direction: column; gap: 8px; }
.translation span:first-child { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.answer-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.answer { min-height: 58px; border: 1px solid var(--line); border-radius: 15px; background: white; cursor: pointer; font-family: "YuKyokasho", "UD Digi Kyokasho", "Hiragino Maru Gothic ProN", serif; font-size: 24px; }
.answer.kanji-choice { font-size: 32px; }
.answer:hover, .answer.selected { border-color: var(--blue); background: #e8f3ff; }
.answer.correct { border-color: #34c759; background: #e9f9ee; }
.answer.wrong { border-color: #ff3b30; background: #fff0ef; }
.feedback { min-height: 24px; margin: 18px 0; text-align: center; color: #248a3d; font-size: 13px; }
.feedback.is-wrong { color: #d70015; }
.next-button { display: block; min-width: 190px; margin: 8px auto 0; }
.clue-panel { background: #fbfbfd; }
.clue-header { display: flex; gap: 12px; align-items: center; }
.clue-icon { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: #e8f3ff; color: var(--blue); font-weight: 700; }
.clue-intro { color: var(--muted); font-size: 13px; line-height: 1.6; }
.clue { width: 100%; margin: 8px 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; background: white; text-align: left; cursor: pointer; display: grid; grid-template-columns: auto auto 1fr auto; align-items: baseline; column-gap: 8px; row-gap: 4px; }
.clue span { font-variant-numeric: tabular-nums; }
.clue small { color: var(--text); font-size: 15px; line-height: 1.5; }
.clue i { color: var(--blue); font-style: normal; }
.clue.used { opacity: .55; }
.clue-status { color: var(--muted); font-size: 12px; }

.how-section { background: var(--soft); }
.step-cards { max-width: 1060px; margin: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step-card { border-radius: 20px; background: white; padding: 25px; min-height: 180px; }
.step-card .step-number { color: var(--blue); font-size: 12px; font-weight: 700; }
.step-card h3 { margin: 28px 0 10px; font-size: 18px; }
.step-card p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.closing-section { padding: 110px 24px; background: #1d1d1f; color: white; text-align: center; }
.closing-section h2 { margin: 0 0 14px; font-family: Georgia, serif; font-size: clamp(34px, 5vw, 62px); font-weight: 500; }
.closing-section p { color: #a1a1a6; }
footer { padding: 28px clamp(24px, 7vw, 90px); display: flex; justify-content: space-between; color: #86868b; background: #1d1d1f; font-size: 12px; }

.sentence ruby, .preview-sentence ruby { ruby-position: over; }
.sentence rt, .preview-sentence rt { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: .38em; line-height: 1; color: #6e6e73; font-weight: 500; }
.sentence ruby strong { color: var(--blue); }

@media (max-width: 780px) {
  .topbar { min-height: 62px; padding: 0 18px; }
  nav { gap: 12px; }
  .nav-link { display: none; }
  .hero { padding: 64px 24px 48px; grid-template-columns: 1fr; gap: 36px; }
  .hero h1 { font-size: clamp(45px, 14vw, 70px); }
  .hero-text { font-size: 16px; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 17px; }
  .section-heading { display: block; }
  .support-copy { margin-top: 14px; }
  .unit-grid { grid-template-columns: repeat(2, 1fr); }
  .book-tab { font-size: 13px; }
  .course-summary { font-size: 11px; }
  .unit-card { min-height: 135px; padding: 14px; }
  .unit-card strong { margin-top: 14px; font-size: 13px; }
  .unit-card em { left: 14px; }
  .unit-card.selected::after { content: ''; }
  .lesson-grid, .step-cards { grid-template-columns: 1fr; }
  .lesson-section { padding-top: 60px; }
  footer { display: block; line-height: 1.8; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
