:root {
  --ink: #17263c;
  --ink-soft: #4b5667;
  --paper: #f5f0e5;
  --paper-deep: #e8e0d1;
  --white: #fffdf8;
  --green: #1f624d;
  --green-dark: #163c35;
  --amber: #d4812c;
  --red: #a13b31;
  --blue: #3c6680;
  --line: #cfc6b6;
  --shadow: 0 18px 48px rgba(23, 38, 60, .13);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 16px/1.58 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -.025em; }
h1 { font-size: clamp(2.25rem, 4.6vw, 4.9rem); line-height: 1.02; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 3vw, 2.6rem); line-height: 1.15; }
h3 { line-height: 1.25; }
[hidden] { display: none !important; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 50; transform: translateY(-150%); background: var(--ink); color: white; padding: .65rem 1rem; }
.skip-link:focus { transform: none; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(420px, .8fr); background: var(--white); }
.login-photo { background: linear-gradient(90deg, transparent 70%, rgba(255,253,248,.2)), url('/assets/learning-hero.png') center/cover; min-height: 520px; }
.login-panel { align-self: center; padding: clamp(2.2rem, 6vw, 6.5rem); max-width: 720px; }
.seal, .brand-mark { display: grid; place-items: center; background: var(--green); color: white; font-family: Georgia, serif; font-weight: 700; }
.seal { width: 66px; height: 66px; border: 3px double rgba(255,255,255,.75); border-radius: 50%; margin-bottom: 2.2rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .13em; font-size: .76rem; font-weight: 800; color: var(--green); }
.eyebrow.light { color: #dce8df; }
.login-panel h1 { font-size: clamp(2.7rem, 5vw, 5.2rem); }
.login-lead { color: var(--ink-soft); font-size: 1.12rem; max-width: 52ch; }
.login-form { display: grid; gap: .55rem; max-width: 460px; margin-top: 2rem; }
.login-form label { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
input { width: 100%; border: 1px solid var(--line); background: var(--white); min-height: 48px; padding: .7rem .85rem; border-radius: 4px; margin-bottom: .5rem; }
.form-error { color: var(--red); min-height: 1.6em; margin: 0; }
.privacy-note { max-width: 55ch; margin-top: 1.2rem; color: var(--ink-soft); font-size: .82rem; }

.button { border: 1px solid transparent; border-radius: 4px; min-height: 46px; padding: .72rem 1.15rem; font-weight: 800; cursor: pointer; transition: transform 150ms ease, background 150ms ease, border 150ms ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .58; cursor: wait; transform: none; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.paper { background: var(--paper); color: var(--green-dark); }
.button.ghost-light { background: transparent; color: white; border-color: rgba(255,255,255,.5); }
.text-button { border: 0; background: transparent; padding: .35rem; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }

.site-header { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; min-height: 76px; padding: .65rem clamp(1rem, 3vw, 3rem); background: rgba(255,253,248,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.brand { display: inline-flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; width: fit-content; }
.brand-mark { width: 42px; height: 42px; border-radius: 50%; border: 2px double #d9e7df; }
.brand span:last-child { display: grid; line-height: 1.15; }
.brand small { color: var(--ink-soft); font-size: .7rem; }
.main-nav { display: flex; gap: .25rem; }
.nav-button { border: 0; border-bottom: 3px solid transparent; background: transparent; padding: .75rem 1rem; font-weight: 700; cursor: pointer; }
.nav-button.active { color: var(--green); border-color: var(--green); }
.account { justify-self: end; display: flex; align-items: center; gap: .7rem; }
.account > span { font-weight: 800; }

.page-shell { width: min(1240px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 5vw, 5rem) 0; }
.dashboard-hero { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 520px; background: var(--green-dark); color: white; box-shadow: var(--shadow); }
.hero-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 5vw, 5rem); }
.hero-copy h1 { font-size: clamp(2.6rem, 5vw, 5rem); }
.hero-copy > p:not(.eyebrow) { color: #d6e0dc; max-width: 55ch; font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.hero-image { position: relative; margin: 0; min-height: 360px; overflow: hidden; }
.hero-image img { width: 100%; height: 100%; display: block; object-fit: cover; }
.hero-image figcaption { position: absolute; right: 1rem; bottom: 1rem; max-width: 250px; background: rgba(23,38,60,.85); padding: .55rem .75rem; font-size: .78rem; }

.status-strip { display: grid; grid-template-columns: repeat(3, 1fr) 1.35fr; background: var(--white); border: 1px solid var(--line); border-top: 0; }
.status-strip > div { padding: 1.2rem 1.4rem; border-right: 1px solid var(--line); }
.status-strip > div:last-child { border: 0; }
.status-strip span:not(.model-status span) { display: block; font: 700 1.9rem/1 Georgia, serif; }
.status-strip small { color: var(--ink-soft); }
.model-status { display: flex; align-items: center; justify-content: center; gap: .55rem; font-size: .84rem; font-weight: 800; }
.model-status i { width: 9px; height: 9px; border-radius: 50%; background: #3c9a62; box-shadow: 0 0 0 4px #ddf0e4; }

.dashboard-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 6vw, 6rem); padding: 5rem 0 2rem; }
.section-number { color: var(--green); font-weight: 800; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: .55rem; }
.recommendation { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; background: var(--white); border: 1px solid var(--line); padding: 1.2rem; }
.recommendation h3, .recommendation p { margin-bottom: .2rem; }
.recommendation p { color: var(--ink-soft); }
.road-sign { display: grid; place-items: center; width: 62px; height: 62px; background: var(--green); color: white; font-family: Georgia, serif; font-size: 1.4rem; border-radius: 50% 50% 8px 8px; }
.arrow-button { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 1.4rem; }
.skill-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
.skill-columns h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.skill-columns ul { margin: 0; padding-left: 1.15rem; color: var(--ink-soft); }

.page-heading { display: grid; grid-template-columns: 1.2fr .8fr; gap: 4rem; align-items: end; border-bottom: 2px solid var(--ink); padding-bottom: 2rem; margin-bottom: 1.5rem; }
.page-heading h1 { font-size: clamp(2.4rem, 5vw, 4.8rem); margin-bottom: 0; }
.page-heading > p { color: var(--ink-soft); max-width: 48ch; }
.legend { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: 1rem 0 2.4rem; color: var(--ink-soft); font-size: .82rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; }
.dot.unknown { border: 1px solid #858585; }
.dot.review { background: var(--red); }.dot.learning { background: var(--amber); }.dot.solid { background: var(--green); }
.curriculum-levels { display: grid; gap: 1rem; }
.level-block { background: var(--white); border: 1px solid var(--line); }
.level-heading { width: 100%; display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 1rem; border: 0; background: transparent; text-align: left; padding: 1.2rem; cursor: pointer; }
.level-code { font: 700 1.5rem Georgia, serif; color: var(--green); }
.level-heading strong { display: block; font-size: 1.05rem; }
.level-heading small { color: var(--ink-soft); }
.topic-list { border-top: 1px solid var(--line); }
.topic-row { width: 100%; display: grid; grid-template-columns: 24px minmax(160px, .75fr) 1.25fr 110px; gap: 1rem; align-items: center; text-align: left; background: transparent; border: 0; border-bottom: 1px solid #e7e0d5; padding: 1rem 1.2rem; cursor: pointer; }
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: #f7f3eb; }
.topic-row strong { display: block; }
.topic-row .category { color: var(--green); font-size: .74rem; font-weight: 800; text-transform: uppercase; }
.topic-row .objective { color: var(--ink-soft); }
.topic-row .score { text-align: right; font-weight: 800; font-size: .8rem; }

.focus-view { min-height: calc(100vh - 76px); background: var(--white); }
.focus-topbar { display: grid; grid-template-columns: 180px 1fr 90px; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 4rem); border-bottom: 1px solid var(--line); }
.progress-track { height: 7px; background: var(--paper-deep); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--green); transition: width 250ms ease; }
.question-shell { width: min(760px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2.5rem, 8vw, 7rem) 0; }
.question-shell h2 { font-size: clamp(1.8rem, 4vw, 3.2rem); }
.question-context { border-left: 4px solid var(--amber); padding: .8rem 1rem; background: var(--paper); color: var(--ink-soft); }
.options { display: grid; gap: .75rem; margin: 1.6rem 0; }
.option { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: .8rem; width: 100%; text-align: left; border: 1px solid var(--line); background: white; padding: .9rem; min-height: 58px; cursor: pointer; }
.option:hover:not(:disabled) { border-color: var(--green); background: #f5faf7; }
.option span:first-child { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; font-weight: 800; }
.option.correct { border-color: var(--green); background: #e8f4ed; }
.option.incorrect { border-color: var(--red); background: #f8e9e5; }
.feedback { padding: 1rem 1.2rem; border-left: 4px solid var(--green); background: #e8f4ed; }
.feedback.error { border-color: var(--red); background: #f8e9e5; }
.feedback strong { display: block; margin-bottom: .3rem; }
.next-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: clamp(2rem, 6vw, 6rem); padding-top: 2rem; }
.lesson-meta { display: flex; gap: .7rem; color: var(--green); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.lesson-guide > h1 { font-size: clamp(2.6rem, 5vw, 5rem); }
.objective-box { padding: 1.2rem; border: 1px solid var(--line); border-left: 5px solid var(--green); background: var(--white); margin: 2rem 0; }
.lesson-summary { font: 1.25rem/1.55 Georgia, serif; color: var(--ink-soft); }
.lesson-section { margin-top: 2.4rem; }
.lesson-section .section-number { margin-bottom: 1rem; }
.example-list { display: grid; gap: .55rem; list-style: none; padding: 0; }
.example-list li { border-left: 3px solid var(--green); background: var(--white); padding: .7rem .9rem; font-weight: 700; }
.pitfall-box, .practice-tip { margin: 1.5rem 0; padding: 1rem 1.15rem; }
.pitfall-box { border-left: 4px solid var(--red); background: #f8e9e5; }
.practice-tip { border-left: 4px solid var(--amber); background: #fbf0dc; }
.pitfall-box p, .practice-tip p { margin: .3rem 0 0; }
.control-points { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1rem 0; margin-top: 2rem; }
.control-points summary { cursor: pointer; font-weight: 800; }
.handbook-points { counter-reset: point; padding: 0; list-style: none; }
.handbook-points li { counter-increment: point; display: grid; grid-template-columns: 42px 1fr; gap: .8rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.handbook-points li::before { content: counter(point, decimal-leading-zero); font: 700 1.25rem Georgia, serif; color: var(--green); }
.lesson-photo { margin: 2rem 0 0; height: 250px; overflow: hidden; }
.lesson-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 65%; }
.quiz-panel { align-self: start; position: sticky; top: 100px; background: var(--white); border: 1px solid var(--line); padding: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--shadow); }
.quiz-panel h2 { font-size: 1.8rem; }

.practice-toolbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; border: 1px solid var(--line); background: var(--white); padding: 1.1rem 1.3rem; }
.practice-toolbar div { display: grid; }
.practice-toolbar span { color: var(--ink-soft); font-size: .82rem; }
.inline-status { min-height: 2rem; padding: 1rem 0; color: var(--ink-soft); }
.task-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.task-card { background: var(--white); border: 1px solid var(--line); padding: 1.2rem; }
.task-card .reason { color: var(--ink-soft); font-size: .84rem; min-height: 4em; }
.task-card button { margin-top: .7rem; }

.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 80; max-width: min(400px, calc(100% - 2rem)); background: var(--ink); color: white; box-shadow: var(--shadow); padding: .85rem 1rem; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(120%); transition: transform 200ms ease, opacity 160ms ease; }
.toast.show { opacity: 1; visibility: visible; transform: none; }

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-photo { min-height: 38vh; }
  .login-panel { margin-top: -1rem; background: var(--white); position: relative; }
  .site-header { grid-template-columns: 1fr auto; }
  .main-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; justify-content: space-around; background: var(--white); border-top: 1px solid var(--line); }
  .account { grid-column: 2; grid-row: 1; }
  body { padding-bottom: 64px; }
  .dashboard-hero, .dashboard-grid, .page-heading, .lesson-layout { grid-template-columns: 1fr; }
  .hero-image { min-height: 320px; }
  .status-strip { grid-template-columns: repeat(3, 1fr); }
  .model-status { grid-column: 1 / -1; border-top: 1px solid var(--line) !important; }
  .task-list { grid-template-columns: 1fr; }
  .quiz-panel { position: static; }
}

@media (max-width: 620px) {
  .login-photo { min-height: 30vh; }
  .login-panel { padding: 1.5rem; }
  .seal { width: 52px; height: 52px; margin-bottom: 1rem; }
  .brand small, .account > span { display: none; }
  .page-shell { width: min(100% - 1.2rem, 1240px); padding-top: 1.2rem; }
  .hero-copy { padding: 1.5rem; }
  .hero-image { min-height: 240px; }
  .status-strip > div { padding: .8rem; }
  .status-strip small { font-size: .68rem; }
  .status-strip span:not(.model-status span) { font-size: 1.45rem; }
  .dashboard-grid { padding-top: 2.5rem; }
  .recommendation { grid-template-columns: auto 1fr; }
  .arrow-button { grid-column: 2; }
  .skill-columns { grid-template-columns: 1fr; }
  .page-heading { gap: 1rem; }
  .topic-row { grid-template-columns: 16px 1fr auto; gap: .7rem; }
  .topic-row .objective { grid-column: 2 / -1; }
  .topic-row .score { grid-column: 2 / -1; text-align: left; }
  .topic-row .category { display: none; }
  .level-heading { grid-template-columns: 56px 1fr auto; }
  .focus-topbar { grid-template-columns: auto 1fr; }
  .focus-topbar .progress-track { grid-column: 1 / -1; grid-row: 2; }
  .focus-topbar > span { justify-self: end; }
  .practice-toolbar { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
