:root {
  color-scheme: light;
  --bg: #f4f6ff;
  --white: #fff;
  --ink: #14183a;
  --muted: #445070;
  --line: #e1e7f1;
  --blue: #3a4fe0;
  --blue-dark: #2a3bb4;
  --blue-light: #edf1ff;
  --green: #176048;
  --green-light: #eaf7f0;
  --gold: #765214;
  --gold-light: #fff5de;
  --red: #9c3343;
  --red-light: #fff0f2;
  --radius: 17px;
  --shadow: 0 8px 22px rgb(32 53 109 / 5%);
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
svg { display: block; flex-shrink: 0; }
:focus-visible { outline: 3px solid #5772ed; outline-offset: 3px; }
.sr-only, .skip:not(:focus) {
  width: 1px; height: 1px; margin: -1px; overflow: hidden; position: absolute; clip-path: inset(50%); white-space: nowrap;
}
.skip:focus { position: fixed; z-index: 30; top: 8px; left: 8px; padding: 10px 14px; background: var(--white); border-radius: 8px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.rail {
  position: sticky; top: 0; height: 100dvh; min-height: 0; overflow: auto; z-index: 12;
  padding: 23px 16px 16px; display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; margin: 0 5px 29px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -.5px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.rail nav { display: grid; gap: 3px; }
.nav-link {
  display: flex; align-items: center; min-height: 42px; gap: 10px; padding: 8px 11px;
  color: var(--muted); border-radius: 9px; font-size: 13px; font-weight: 650;
}
.nav-link:hover, .nav-link[aria-current="page"] { background: var(--blue-light); color: var(--blue-dark); }
.nav-link span:first-of-type { flex: 1; }
.nav-count { min-width: 22px; padding: 0 5px; text-align: center; background: #f0f3f9; border-radius: 8px; font-size: 11px; }
.rail-course { margin-top: 20px; }
.rail-label {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-bottom: 10px; padding: 11px 12px; border-radius: 12px;
  background: #ffd84d; color: var(--ink); font-size: 15px; font-weight: 800;
}
.rail-label span { border: 1px solid currentColor; border-radius: 100px; padding: 3px 7px; font-size: 10px; }
#lesson-nav { gap: 6px; }
.side-lesson {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; align-items: start;
  padding: 9px 11px; min-height: 46px; font-size: 12px; font-weight: 600;
  color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 11px;
}
.side-lesson:not([aria-current]):hover { border-color: var(--blue); }
.side-lesson[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.side-lesson .side-name { grid-column: 1 / -1; line-height: 1.45; overflow-wrap: anywhere; }
.side-number { color: var(--blue-dark); font-size: 10px; font-weight: 800; }
.side-lesson.review .side-number { color: var(--gold); }
.side-lesson[aria-current="page"] .side-number { color: #ffd84d; }
.side-done { color: var(--green); }
.side-lesson .side-done { grid-column: 2; grid-row: 1; }
.side-lesson[aria-current="page"] .side-done { color: #a6e2cd; }
.rail-footer {
  margin-top: auto; padding: 19px 7px 1px; font-size: 11px; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.status-dot { height: 7px; width: 7px; border-radius: 50%; background: #2f886b; }
.workspace { min-width: 0; }
.topbar {
  height: 68px; background: rgb(255 255 255 / 95%); border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; gap: 14px; padding: 0 32px; position: relative; z-index: 6;
}
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb strong { color: var(--ink); }
.search { position: relative; width: min(313px, 46%); display: flex; align-items: center; }
.search > span { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 10px 12px 10px 36px; background: #f5f7fc; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; font-size: 13px; 
}
.search-results {
  position: absolute; top: calc(100% + 7px); right: 0; width: max(100%, min(330px, 88vw)); max-height: 54vh; overflow: auto;
  z-index: 8; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px #14234a26;
}
.search-results a { display: block; padding: 9px; border-radius: 6px; font-size: 13px; }
.search-results a:hover { background: var(--blue-light); }
.search-results p { font-size: 13px; padding: 10px; color: var(--muted); }
.search-results small { display: block; color: var(--muted); }
.mobile-menu { display: none !important; }
main { max-width: 1340px; margin: auto; padding: 29px 32px 48px; }
main:focus { outline: none; }
.page-heading { margin-bottom: 22px; }
.page-heading h1 { font-size: clamp(27px, 3vw, 36px); font-weight: 750; letter-spacing: -.035em; }
.page-heading p { color: var(--muted); margin-top: 6px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; min-height: 42px;
  padding: 9px 15px; color: var(--blue-dark); border: 1px solid #d9e1ff; background: var(--blue-light); font-weight: 720; font-size: 13px;
}
.button:hover { background: #e0e7ff; }
.button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.plain { background: var(--white); border-color: var(--line); color: var(--ink); }
.button.plain:hover { background: #f3f6ff; }
.button.done { background: var(--green-light); color: var(--green); border-color: #cee7da; }
.icon-button { display: inline-grid; place-items: center; width: 42px; height: 42px; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 9px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(224px, .36fr); gap: 21px; align-items: start; margin-top: 26px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.section-heading h2, .card h2 { font-size: 19px; letter-spacing: -.02em; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.filter {
  padding: 5px 10px; min-height: 34px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--white); color: var(--muted); font-size: 12px; font-weight: 650;
}
.filter[aria-pressed="true"] { background: var(--blue-light); border-color: #d6dfff; color: var(--blue-dark); }
.filter:hover { color: var(--blue-dark); border-color: #bdcbff; }
.lesson-list { display: grid; gap: 8px; }
.lesson-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto 18px; align-items: center; gap: 12px;
  min-height: 67px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--white);
}
.lesson-row:hover { border-color: #b8c7fa; box-shadow: var(--shadow); }
.lesson-book {
  --book-ink: var(--blue-dark);
  --book-pages: var(--blue-light);
  position: relative;
  width: 52px;
  height: 44px;
}
.lesson-book.vocab { --book-ink: var(--green); --book-pages: var(--green-light); }
.lesson-book.review { --book-ink: var(--gold); --book-pages: var(--gold-light); }
.lesson-book::before {
  content: "";
  position: absolute;
  inset: 3px 0 0 3px;
  border: 1px solid var(--book-ink);
  border-radius: 4px 7px 7px 4px;
  background: repeating-linear-gradient(to bottom, var(--white) 0 2px, var(--book-pages) 2px 3px);
}
.lesson-book-cover {
  position: absolute;
  inset: 0 3px 3px 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  padding-left: 5px;
  border-radius: 4px 7px 7px 4px;
  background: linear-gradient(to right, rgb(0 0 0 / 18%) 0 4px, rgb(255 255 255 / 34%) 4px 5px, transparent 5px), var(--book-ink);
  color: var(--white);
  font-weight: 800;
  line-height: 1;
}
.lesson-book-kind { font-size: 9px; letter-spacing: .035em; text-transform: uppercase; }
.lesson-book-number { font-size: 17px; font-variant-numeric: tabular-nums; }
.pill.vocab { color: var(--green); background: var(--green-light); }
.pill.review { color: var(--gold); background: var(--gold-light); }
.row-title { display: block; font-size: 14px; font-weight: 700; line-height: 1.35; }
.row-meta { color: var(--muted); font-size: 12px; margin-top: 2px; display: block; }
.pill { display: inline-flex; align-items: center; gap: 5px; justify-content: center; background: var(--blue-light); color: var(--blue-dark); border-radius: 7px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.pill.neutral { background: #eff2f7; color: #55657d; }
.row-arrow { color: #657394; }
.row-arrow.side-done { color: var(--green); }
.dashboard-side { display: grid; gap: 13px; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card-heading { display: flex; align-items: center; gap: 9px; }
.card-heading > svg { color: var(--blue); }
.meter-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 15px; }
.meter-heading strong { font-size: 26px; letter-spacing: -.04em; }
.meter-heading span, .card-note { color: var(--muted); font-size: 12px; }
progress { appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 99px; background: #edf1fa; overflow: hidden; margin: 6px 0 10px; color: var(--blue); }
progress::-webkit-progress-bar { background: #edf1fa; }
progress::-webkit-progress-value { background: var(--blue); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--blue); border-radius: 99px; }
.course-info { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.course-info:last-child { border-bottom: 0; padding-bottom: 0; }
.course-info strong { display: block; font-size: 13px; }
.course-info small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }
.card-link { display: inline-flex; align-items: center; gap: 5px; color: var(--blue-dark); font-size: 13px; font-weight: 700; margin-top: 11px; }
.card-link:hover { text-decoration: underline; }

.lesson-page { max-width: 920px; margin: auto; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--blue-dark); font-size: 13px; font-weight: 650; margin-bottom: 13px; }
.back-link:hover { text-decoration: underline; }
.lesson-head {
  padding: 25px 27px; border-radius: var(--radius); border: 1px solid #dce4fb; background: linear-gradient(135deg, #edf1ff, #fff 75%);
}
.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.lesson-head h1 { margin: 10px 0; font-size: clamp(25px, 4.4vw, 40px); max-width: 27ch; letter-spacing: -.035em; }
.lesson-head p { color: var(--muted); max-width: 64ch; }
.lesson-head .source-line { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 0 14px; border-bottom: 1px solid var(--line); margin: 16px 0; }
.tabs a { padding: 10px 7px; color: var(--muted); font-weight: 700; border-bottom: 2px solid transparent; font-size: 14px; }
.tabs a[aria-current="page"] { color: var(--blue-dark); border-color: var(--blue); }
.tabs a:hover { color: var(--blue-dark); }
.note { display: flex; gap: 8px; align-items: flex-start; padding: 11px 13px; background: #edf2ff; color: #354774; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.note svg { margin-top: 2px; }
.study-stack, .exercise-stack { display: grid; gap: 12px; }
.source-theory { display: grid; gap: 16px; min-width: 0; }
.source-theory summary { cursor: pointer; color: var(--blue-dark); font-weight: 600; }
.theory-section { min-width: 0; }
.theory-section h3 { font-size: 20px; line-height: 1.4; margin-bottom: 16px; }
.source-theory dl { margin: 8px 0 0; }
.source-theory dl > div { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 3fr); gap: 8px 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.source-theory dt { font-weight: 600; }
.source-theory dd { margin: 0; overflow-wrap: anywhere; }
.theory-lines p + p { margin-top: 8px; }
.grammar-theory dl { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 0; }
.grammar-theory dl > div { display: block; grid-column: span 3; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; }
.grammar-theory dt { margin-bottom: 10px; color: var(--blue-dark); font-size: 14px; }
.grammar-theory dd { font-size: 16px; line-height: 1.8; }
.grammar-theory .theory-form { grid-column: span 2; background: #eef2ff; border-color: #dae2ff; }
.grammar-theory .theory-wide { grid-column: 1 / -1; }
.grammar-theory .theory-wide .theory-lines { max-width: 68ch; }
@media (max-width: 1100px) { .grammar-theory .theory-form { grid-column: 1 / -1; } }
@media (max-width: 620px) {
  .grammar-theory dl { grid-template-columns: minmax(0, 1fr); }
  .grammar-theory dl > div { grid-column: 1 / -1; padding: 14px; }
  .theory-section h3 { font-size: 18px; }
}
.theory-example { margin-top: 3px; color: var(--muted); font-style: italic; }
@media (max-width: 520px) { .source-theory dl > div { grid-template-columns: 1fr; gap: 3px; } }
.study-card h2 { margin-bottom: 7px; }
.study-card p { color: var(--muted); }
.study-card .sentence-patterns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 20px 0; }
.sentence-patterns > div { padding: 16px; border: 1px solid #dae2ff; border-radius: 12px; background: #eef2ff; }
.sentence-patterns dt { color: var(--blue-dark); font-size: 14px; font-weight: 650; margin-bottom: 10px; }
.sentence-patterns dd { margin: 0; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.study-card:has(.sentence-patterns) .example { margin-top: 20px; padding: 12px 16px; background: #fafbff; }
.study-card:has(.sentence-patterns) .example > small { display: block; margin-top: 6px; font-size: 14px; }
.study-points { display: grid; gap: 6px; margin: 0; padding-inline-start: 1.25em; color: var(--muted); }
.study-points li::marker { color: var(--blue-dark); }
.formula { margin-top: 10px; padding: 8px 10px; border-radius: 7px; background: #f0f3fd; color: #263b81; font-size: 13px; font-weight: 650; }
.example { margin-top: 10px; padding-left: 11px; border-left: 3px solid #becbff; }
.example > span { display: block; color: var(--ink); font-weight: 620; }
.example > small { color: var(--muted); }
.exercise-example { padding: 0; border: 0; }
.exercise-example .number { display: inline-grid; place-items: center; height: 27px; background: var(--blue-light); color: var(--blue-dark); border-radius: 7px; }
.vocab-list { display: grid; margin: 13px 0 0; gap: 0; }
.vocab-entry { display: grid; grid-template-columns: minmax(120px, .55fr) 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.vocab-entry dd { margin: 0; color: var(--muted); font-size: 14px; }
.vocab-entry dt { color: var(--ink); font-weight: 680; }
.vocab-entry dt small { color: var(--muted); font-weight: 450; }
.vocab-entry em { display: block; color: var(--ink); font-size: 13px; margin-top: 3px; }
.lesson-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 15px; margin-top: 21px; }
.footer-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.exercise-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.exercise-heading h2 { font-size: 19px; }
.exercise-heading p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.question { margin: 0; min-width: 0; }
.question-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.question-line .number { flex: 0 0 27px; margin: 0; }
.question-line .prompt { flex: 1; min-width: 0; margin: 0; }
.question.answer-only { display: grid; grid-template-columns: 27px minmax(0, 1fr); align-items: center; gap: 8px; }
.answer-only .question-line { margin: 0; }
.answer-only > .answer { width: 100%; }
.answer-only > .feedback { grid-column: 1 / -1; }
.question legend { padding: 0; font-weight: 700; font-size: 13px; }
.question .number {
  display: inline-grid; place-items: center; width: 27px; height: 27px;
  background: var(--blue-light); color: var(--blue-dark); border-radius: 7px; margin-right: 6px;
}
.question-ref { color: var(--muted); font-size: 12px; font-weight: 520; }
.prompt { margin: 2px 0 10px; font-size: 16px; }
.prompt p + p { margin-top: 7px; }
.question .option { display: flex; align-items: center; gap: 7px; padding: 8px 10px; min-height: 39px; border: 1px solid var(--line); border-radius: 8px; }
.question .option + .option { margin-top: 5px; }
.question .option:has(input:checked) { background: var(--blue-light); border-color: #bfccfd; }
.question input[type="radio"] { accent-color: var(--blue); }
.answer {
  width: 100%; max-width: 520px; min-height: 42px; padding: 9px 11px;
  color: var(--ink); border: 1px solid #d3deee; background: #fff; border-radius: 8px;
}
textarea.answer { display: block; min-height: 72px; resize: vertical; }
.feedback { display: grid; gap: 3px; margin-top: 11px; padding: 9px 10px; background: #f0f3fa; color: var(--ink); border-radius: 8px; font-size: 13px; }
.feedback.correct { background: var(--green-light); color: var(--green); }
.feedback.incorrect { background: var(--red-light); color: var(--red); }
.exercise-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.result { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; border-color: #cdd8ff; background: #f2f5ff; }
.result h2 { font-size: 18px; }
.result p { color: var(--muted); }
.error-message { margin-top: 5px; color: var(--red); font-size: 13px; }
.mistakes-list { display: grid; gap: 10px; }
.mistakes-list .prompt { margin: 9px 0; }
.mistakes-list .button { margin-top: 12px; }
.empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty svg { margin: auto auto 10px; color: var(--blue); }
.empty h2 { color: var(--ink); margin-bottom: 5px; }
.empty .button { margin-top: 14px; }
.notice {
  position: fixed; z-index: 25; right: 16px; bottom: 16px; max-width: min(370px, calc(100vw - 32px));
  padding: 10px 15px; border-radius: 9px; background: #17275b; color: white; box-shadow: var(--shadow); font-size: 13px;
}
.noscript { padding: 15px; }

.dashboard-view .shell { display: block; }
.dashboard-view .workspace { position: relative; isolation: isolate; overflow: clip; }
.dashboard-view .workspace::before {
  content: ""; position: absolute; z-index: -1; width: 560px; height: 560px; border-radius: 50%;
  top: -152px; right: max(-140px, calc((100vw - 1520px) / 2)); background: #ffd84d; pointer-events: none;
}
.dashboard-view .topbar {
  max-width: 1264px; height: 84px; margin: auto; border-bottom: 0; background: transparent; gap: 20px;
}
.dashboard-view .breadcrumb { display: none; }
.dashboard-view main { max-width: 1264px; padding-top: 0; }
.home-brand { color: var(--ink); font-size: 21px; font-weight: 800; letter-spacing: -.035em; margin-right: auto; white-space: nowrap; }
.home-brand span { color: var(--blue-dark); }
.home-nav { display: flex; align-items: center; gap: clamp(13px, 2.1vw, 29px); font-size: 14px; font-weight: 600; }
.home-nav a { white-space: nowrap; }
.home-nav a:hover { color: var(--blue-dark); text-decoration: underline; text-underline-offset: 4px; }
.dashboard-view .search { width: min(21%, 242px); }
.dashboard-view .search input { background: #fff; border-color: #dce1f4; border-radius: 100px; }
.home-hero {
  min-height: 535px; display: grid; grid-template-columns: 1.04fr minmax(0, .96fr);
  align-items: center; gap: clamp(22px, 4.5vw, 72px); padding: 38px 0 48px;
}
.hero-tag {
  display: inline-block; width: fit-content; padding: 7px 14px; border-radius: 100px; background: var(--white);
  color: var(--blue-dark); font-size: 13px; font-weight: 600;
}
.hero-copy { min-width: 0; }
.hero-copy h1 { font-size: clamp(39px, 5.1vw, 70px); font-weight: 800; letter-spacing: -.055em; line-height: 1.06; margin-top: 20px; }
.hero-copy h1 span { color: var(--blue); }
.hero-copy > p { margin-top: 21px; color: var(--muted); max-width: 42ch; font-size: clamp(15px, 1.45vw, 19px); line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-actions .button { min-height: 52px; padding: 11px 20px; border-radius: 100px; font-size: 14px; }
.hero-copy .hero-active { margin-top: 16px; font-size: 12px; }
.hero-examples {
  position: relative; min-width: 0; display: grid; align-content: center; min-height: 440px;
}
.word-card, .quiz-card {
  border-radius: 24px; width: min(86%, 300px); padding: 22px; position: relative;
}
.word-card {
  background: var(--white); display: grid; gap: 4px; align-self: start; margin: 0 0 -9px 5px;
  box-shadow: 0 16px 42px #14183a17; transition: transform 160ms ease; z-index: 1;
}
.word-card:hover { transform: translateY(-3px); }
.word-card strong { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.045em; line-height: 1.1; padding-top: 5px; }
.word-card svg { position: absolute; right: 19px; bottom: 22px; color: var(--blue); }
.example-label { color: var(--blue-dark); font-size: 10px; text-transform: uppercase; font-weight: 800; letter-spacing: .12em; }
.quiz-card {
  color: #fff; background: #14183a; box-shadow: 0 18px 45px #14183a2b; margin: 0 0 0 auto; z-index: 2;
}
.quiz-card .example-label { color: #ffd84d; }
.quiz-card fieldset { padding: 0; margin: 9px 0 0; border: 0; min-width: 0; }
.quiz-card legend { padding: 0; margin-bottom: 10px; font-size: 17px; font-weight: 600; line-height: 1.45; }
.quiz-card label {
  display: flex; gap: 7px; align-items: center; cursor: pointer; padding: 6px 9px; min-height: 35px; margin-bottom: 6px;
  border-radius: 9px; background: #292e5b; font-size: 13px;
}
.quiz-card label:has(input:checked) { background: #3a4fe0; }
.quiz-card input { accent-color: #ffd84d; }
.quiz-card-footer { margin-top: 9px; display: flex; align-items: center; gap: 8px; min-height: 33px; }
.quiz-card-footer button {
  color: #14183a; background: #ffd84d; border: 0; flex: none; padding: 6px 10px; min-height: 31px;
  border-radius: 100px; font-weight: 800; font-size: 11px;
}
.quiz-card-footer button:hover { background: #ffea8f; }
.quiz-card-footer p { color: #f2f4ff; font-size: 10px; line-height: 1.35; }
.dashboard-grid { position: relative; scroll-margin-top: 22px; }
.dashboard-view .dashboard-grid { margin-top: 6px; }
.book-shelf-link {
  display: flex; align-items: center; gap: 12px; padding: 13px 0; margin-bottom: 1px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.book-shelf-link:hover > span:last-child { color: var(--blue-dark); }
.book-shelf-link small { display: block; font-size: 11px; color: var(--muted); }
.book-cover {
  width: 78px; aspect-ratio: 2/3; flex-shrink: 0; position: relative; isolation: isolate; display: flex; flex-direction: column;
  gap: 2px; overflow: hidden; align-items: flex-start; white-space: nowrap; padding: 8px 7px; border-radius: 6px;
  color: #fff; background: #0f0f14; box-shadow: 3px 4px 8px #12152029, inset 3px 0 #ffffff15;
}
.book-cover::before, .book-cover::after { content: ""; position: absolute; z-index: -1; }
.book-cover::before { left: 7px; right: 7px; top: 37px; height: 49px; background: #c8f03c; border-radius: 6px; }
.book-cover::after { top: 52px; left: 42px; width: 48px; height: 48px; border-radius: 100%; background: #0f0f14; }
.book-level { align-self: end; border: 1px solid #fff9; border-radius: 99px; font-size: 7px; line-height: 1; padding: 2px 4px; }
.book-cover strong { font-size: 14px; font-weight: 800; line-height: 1.1; letter-spacing: -.04em; }
.book-subtitle { padding-top: 12px; color: #0f0f14; font-size: 8px; font-weight: 800; }
.book-leaf { margin-top: auto; font-size: 4.5px; color: #fff; letter-spacing: .01em; }

.book-figure { margin: 0; scroll-margin-top: 14px; }
.saved-workbook-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.exercise-group small { color: var(--muted); font-weight: 500; }
.exercise-group > p { margin-top: 8px; }
.exercise-title { display: flex; align-items: baseline; gap: 12px; }
.exercise-title h3 { flex: none; }
.exercise-title p { flex: 1; min-width: 0; }
.exercise-group .formula { white-space: pre-line; }
.matching-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 10px 18px; list-style: none; padding: 14px; margin: 14px 0 0; border: 1px solid var(--line); border-radius: 10px; background: #f5f7ff; }
.exercise-passage { white-space: normal; }
.passage-title, .exercise-subheading { margin-top: 16px; font-size: 16px; }
.exercise-block { display: grid; gap: 20px; min-width: 0; }
.exercise-block > .card { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.exercise-block > .question { padding-top: 16px; border-top: 1px solid var(--line); }
.exercise-block > .question legend { padding-right: 8px; }
.exercise-passage { margin: 12px 0 0; padding: 10px 14px; border-inline-start: 3px solid var(--blue); background: #f5f7ff; }
.question .inline-blank { display: inline-block; width: min(11rem, 100%); min-height: 36px; margin: 2px 4px; padding: 4px 8px; }
.book-figure:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.book-figure figcaption { margin-bottom: 10px; }
.book-figure figcaption strong, .book-figure figcaption small { display: block; }
.book-figure figcaption small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.figure-preview {
  display: grid; justify-items: center; width: 100%; gap: 9px; padding: 9px;
  background: #f5f7ff; border: 1px solid var(--line); color: var(--blue-dark); border-radius: 10px;
  font-size: 12px; font-weight: 600;
}
.figure-preview:hover { background: #edf1ff; }
.figure-preview img { max-height: 355px; height: auto; width: auto; object-fit: contain; border-radius: 4px; }
.figure-preview span { display: inline-flex; align-items: center; gap: 6px; }
.figure-dialog {
  max-width: min(1060px, calc(100% - 24px)); width: max-content; padding: 0;
  max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: 13px; color: var(--ink);
}
.figure-dialog::backdrop { background: #0f1638b8; }
.figure-dialog header { display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.figure-dialog h2 { font-size: clamp(13px, 2vw, 17px); margin-right: auto; }
.figure-dialog .icon-button { width: 36px; height: 36px; }
.figure-dialog .button { min-height: 36px; padding: 5px 8px; font-size: 11px; flex: none; }
.figure-dialog-body { overflow: auto; max-height: calc(100dvh - 95px); padding: 9px; }
.figure-dialog-body img { margin: auto; width: auto; max-height: calc(100dvh - 118px); object-fit: contain; }
.figure-dialog-body.is-zoomed img { max-height: none; max-width: none; width: max(740px, 100%); margin: 0; }
body:has(dialog[open]) { overflow: hidden; }

@media (min-width: 721px) {
  .dashboard-view .rail { display: none; }
}
@media (max-width: 1090px) {
  .shell { grid-template-columns: 218px minmax(0, 1fr); }
  .topbar { padding-inline: 22px; }
  main { padding-inline: 22px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) minmax(205px, .4fr); gap: 13px; }
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { grid-row: 1; grid-template-columns: 1fr 1fr; }
  .dashboard-side .review-card { grid-column: 1 / -1; }
  .home-hero { min-height: 476px; gap: 19px; }
  .hero-examples { min-height: 400px; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .rail {
    position: fixed; top: 0; bottom: 0; left: 0; height: 100dvh; width: min(280px, 84vw);
    transform: translateX(-100%); visibility: hidden; transition: transform 160ms ease, visibility 160ms ease;
  }
  body.menu-open .rail { transform: translateX(0); visibility: visible; }
  body.menu-open { overflow: hidden; }
  #scrim { position: fixed; inset: 0; z-index: 11; border: 0; background: #101b3d69; }
  .mobile-menu { display: inline-grid !important; }
  .topbar { height: 61px; gap: 8px; padding-inline: 13px; }
  .breadcrumb { margin-right: auto; white-space: nowrap; font-size: 12px; }
  .breadcrumb a, .breadcrumb .crumb-arrow { display: none; }
  .search { width: min(39vw, 255px); }
  .search input { font-size: 12px; padding-left: 31px; }
  .search > span { left: 9px; }
  main { padding: 18px 13px 28px; }
  .page-heading { margin-bottom: 14px; }
  .page-heading p { font-size: 13px; }
  .dashboard-grid { margin-top: 15px; }
  .dashboard-side { gap: 8px; }
  .card { padding: 14px; }
  .card h2 { font-size: 16px; }
  .card-heading { gap: 5px; }
  .card-heading svg { width: 16px; }
  .course-info { gap: 6px; }
  .review-card { padding-block: 10px; }
  .review-card .card-link { margin-top: 4px; }
  .lesson-row { min-height: 63px; padding: 8px; gap: 8px; grid-template-columns: auto minmax(0, 1fr) auto 14px; }
  .row-title { font-size: 13px; }
  .row-meta { font-size: 11px; }
  .lesson-head { padding: 17px 15px; }
  .vocab-entry { grid-template-columns: 1fr; gap: 3px; }
  .dashboard-view .workspace::before { top: -134px; right: -145px; width: 320px; height: 320px; }
  .dashboard-view .topbar { gap: 8px; height: 64px; }
  .dashboard-view .home-nav { display: none; }
  .dashboard-view .search { width: min(37%, 225px); }
  .home-brand { font-size: clamp(13px, 4.1vw, 18px); }
  .home-hero { min-height: 0; display: grid; grid-template-columns: 1fr; padding: 29px 4px 25px; gap: 21px; }
  .hero-copy h1 { margin-top: 13px; font-size: clamp(34px, 10vw, 52px); }
  .hero-copy > p { font-size: 14px; margin-top: 13px; }
  .hero-copy .hero-active { margin-top: 12px; }
  .hero-actions { margin-top: 17px; }
  .hero-actions .button { min-height: 46px; padding: 8px 13px; font-size: 13px; }
  .hero-examples { min-height: 0; padding: 4px 0 7px; }
  .word-card, .quiz-card { padding: 16px; border-radius: 16px; width: min(85%, 285px); }
  .word-card { margin: 0 auto -2px 1px; }
  .quiz-card { margin-left: auto; }
  .quiz-card legend { font-size: 15px; }
  .figure-preview img { max-height: 313px; }
  .figure-dialog header { flex-wrap: wrap; }
  .figure-dialog h2 { flex: 1 1 125px; }
}
@media (max-width: 375px) {
  .dashboard-side { grid-template-columns: 1fr; }
  .lesson-row .pill { display: none; }
  .lesson-row { grid-template-columns: auto minmax(0, 1fr) 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.source-issues { margin-top: 1rem; padding: .75rem 1rem; border-left: 3px solid #b7791f; background: #fffbeb; border-radius: .5rem; font-size: .9rem; line-height: 1.65; }
.source-issues p { margin: .25rem 0; }
.source-issues svg { vertical-align: -.15em; flex-shrink: 0; }

.topbar { gap: 16px; }
.account-control { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
#account-button { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; font-size: 14px; }
#sync-status { max-width: 150px; font-size: 12px; color: #527162; line-height: 1.45; }
#sync-status[data-state="pending"] { color: #936019; }
.account-dialog { width: min(470px, calc(100vw - 28px)); max-height: calc(100dvh - 36px); overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; padding: 34px; color: var(--ink); background: white; box-shadow: 0 28px 100px #121b4b40; }
.account-dialog::backdrop { background: #111a3f80; backdrop-filter: blur(5px); }
.account-close { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border: 0; font-size: 25px; }
.account-logo { font-size: 15px; font-weight: 800; color: var(--blue); margin-bottom: 22px; }
.account-logo span { color: var(--ink); }
.account-dialog h2 { font-size: 26px; line-height: 1.25; margin-bottom: 12px; letter-spacing: -.025em; }
.account-help { font-size: 15px; color: var(--muted); line-height: 1.7; margin-bottom: 20px; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; background: #f0f3ff; border-radius: 12px; margin-bottom: 22px; }
.account-tabs button { padding: 10px; border: 0; background: transparent; border-radius: 9px; color: var(--muted); font-size: 15px; font-weight: 700; }
.account-tabs button[aria-selected="true"] { background: #fff; color: var(--blue); box-shadow: 0 2px 8px #1b36a513; }
#account-form { display: grid; gap: 15px; }
#account-form label { display: grid; gap: 8px; font-size: 15px; font-weight: 650; }
#account-form input { min-width: 0; width: 100%; min-height: 48px; font-size: 16px; border: 1px solid #cdd6ef; border-radius: 10px; padding: 10px 12px; color: var(--ink); background: #fff; }
#account-form input:focus { outline: 3px solid #5267ff30; border-color: var(--blue); }
.account-submit { width: 100%; font-size: 16px; min-height: 48px; margin: 4px 0 10px; }
.account-submit:disabled { opacity: .65; cursor: wait; }
.account-small { font-size: 13px; color: var(--muted); line-height: 1.65; margin: 0; }
.account-link { display: block; margin: 12px auto 18px; background: none; border: 0; color: var(--blue); font-size: 14px; text-decoration: underline; }
.account-email { overflow-wrap: anywhere; font-weight: 650; margin-bottom: 12px; }
.account-import { background: #f3f5ff; border: 1px solid #dfe5ff; border-radius: 14px; padding: 16px; margin: 18px 0; }
.account-import h3 { font-size: 17px; }
.account-import p { margin: 9px 0 16px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.account-options { display: grid; gap: 10px; }
.account-options .button { font-size: 15px; }
#account-error { margin-top: 16px; font-size: 14px; line-height: 1.6; }
@media (max-width: 1150px) {
  #sync-status { display: none; }
  .topbar .search { flex: 1; min-width: 100px; }
  .home-nav { display: none !important; }
  #account-button { max-width: 185px; }
}
@media (max-width: 720px) {
  .topbar, .dashboard-view .topbar { height: auto; min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 8px; }
  .topbar .search { min-width: 0; flex: 1; }
  .account-control { flex-basis: 100%; }
  #sync-status { display: block; max-width: none; margin-right: auto; }
  #account-button { max-width: 210px; min-height: 36px; padding: 6px 10px; font-size: 13px; }
  .account-dialog { padding: 28px 22px; }
  .account-dialog h2 { font-size: 24px; }
}
