:root {
  color-scheme: light;
  --page: #f5f7f2;
  --paper: #fffefa;
  --rail: #eef2eb;
  --ink: #1e3028;
  --pine: #214b3d;
  --pine-dark: #16392e;
  --muted: #59685f;
  --faint: #e8ece3;
  --line: #d6dfd3;
  --lime: #dce9a8;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 16px;
  font-family: var(--sans);
  font-size: 16px;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--pine); text-underline-offset: .2em; }
p, h1, h2, h3, h4 { margin: 0; }
h1, h2, h3, h4 { text-wrap: balance; }
img, svg { max-width: 100%; }
svg.icon { height: 20px; width: 20px; flex: 0 0 auto; vertical-align: middle; }
:focus-visible { outline: 3px solid #437c58; outline-offset: 4px; }
::selection { background: #d8e9b7; color: var(--pine-dark); }

.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 0; padding: 29px 17px 20px; overflow-y: auto; background: var(--rail); border-right: 1px solid var(--line); }
.brand, .mobile-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--pine-dark); font-family: var(--serif); font-size: 30px; font-weight: 650; letter-spacing: -.055em; line-height: 1; text-decoration: none; }
.brand { margin: 0 8px 48px; align-self: flex-start; }
.brand-mark { display: inline-grid; width: 35px; height: 39px; flex: 0 0 auto; place-items: center; border-radius: 12px 12px 12px 3px; background: var(--pine); color: #e1edb8; }
.brand-mark svg.icon { width: 72%; height: 72%; }
.rail-label, .eyebrow, .section-label { font-size: 10px; font-weight: 720; letter-spacing: .145em; line-height: 1.45; text-transform: uppercase; color: var(--muted); }
.rail-label { margin: 0 13px 12px; }
.rail-nav { display: grid; gap: 5px; }
.rail-nav + .rail-label { margin-top: 26px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 43px; padding: 10px 13px; border: 1px solid transparent; border-radius: 9px; color: #42574b; background: transparent; font-weight: 540; font-size: 14px; line-height: 1.3; text-align: left; text-decoration: none; }
.nav-item:hover { background: #e3eadf; }
.nav-item.active, .nav-item[aria-current]:not([aria-current="false"]) { background: #d9e5d4; color: #1a4430; font-weight: 680; }
.nav-item .icon { width: 18px; height: 18px; }
.rail-footer { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 18px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.rail-footer .icon { width: 17px; height: 17px; }
.rail-footer strong { color: var(--ink); }
.workspace, .main, .layout-grid > *, .card, .stack, .field, .task-row > div, .skill-row > div { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 67px; padding: 10px clamp(24px, 3.4vw, 58px); border-bottom: 1px solid var(--line); }
.mobile-brand { display: none; }
.breadcrumbs { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.breadcrumbs strong, .breadcrumbs b { color: var(--ink); font-weight: 620; }
.breadcrumbs .icon { width: 13px; height: 13px; }
.profile-select { display: inline-flex; align-items: center; gap: 9px; max-width: 100%; font-size: 13px; font-weight: 600; }
select.profile-select, .profile-select select { max-width: min(100%, 230px); min-height: 35px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; background: var(--paper); }
.main { max-width: 1536px; margin: 0 auto; padding: clamp(24px, 3vw, 48px) clamp(24px, 3.4vw, 58px) 64px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 15px; margin-bottom: 22px; }
.page-header > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.page-header > :is(.btn, .inline) { flex-shrink: 0; }
.page-header h1 { color: var(--pine-dark); font-family: var(--serif); font-size: clamp(2.35rem, 4vw, 3.65rem); font-weight: 500; letter-spacing: -.055em; line-height: 1.06; }
.page-header .eyebrow { margin-bottom: 9px; color: #4a6952; }
.page-header .muted, .page-header > p:last-child:not(.eyebrow) { margin-top: 8px; }
.muted { color: var(--muted); }
.hero { position: relative; isolation: isolate; display: flex; align-items: center; overflow: hidden; min-height: 190px; padding: clamp(24px, 3vw, 42px); border: 1px solid #214637; border-radius: var(--radius); background: #224d3e; color: #f5f7e9; }
.hero-content { position: relative; z-index: 1; width: min(62%, 650px); }
.hero h1, .hero h2 { margin: 6px 0 8px; color: #fffef0; font-family: var(--serif); font-size: clamp(2rem, 3.35vw, 3.25rem); font-weight: 480; line-height: 1.06; letter-spacing: -.05em; }
.hero p, .hero .muted { max-width: 51ch; color: #dce9dc; font-size: 14px; line-height: 1.55; }
.hero .eyebrow, .hero-tag { display: inline-flex; align-items: center; gap: 7px; color: #d9e9a3; font-size: 10px; font-weight: 720; letter-spacing: .15em; line-height: 1.4; text-transform: uppercase; }
.hero .btn.primary { background: var(--lime); border-color: var(--lime); color: var(--pine-dark); }
.hero .btn.primary:hover { background: #e7f0bb; border-color: #e7f0bb; }
.hero-art { position: absolute; z-index: 0; inset: 0 0 0 auto; width: 46%; height: 100%; overflow: hidden; color: #c9dc93; pointer-events: none; }
.hero-art svg { display: block; width: 100%; height: 100%; }
.hero + *, .layout-grid + .card { margin-top: 22px; }

.layout-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(245px, 1fr); align-items: start; gap: 20px; }
.stack { display: grid; align-content: start; gap: 20px; }
.card, .lesson, .dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
.card { padding: clamp(19px, 2vw, 28px); overflow-wrap: anywhere; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.card-head > :is(.btn, .pill):last-child { margin-left: auto; }
.card-head > .card-icon:first-child { margin-right: -2px; }
.card-head > .card-icon:first-child + :not(:last-child) { flex: 1; }
.card h2, .session > h2, .dialog h2 { color: var(--pine-dark); font-family: var(--serif); font-size: clamp(1.5rem, 2.1vw, 1.95rem); line-height: 1.15; letter-spacing: -.045em; font-weight: 550; }
.card h3, .dialog h3 { font-weight: 650; font-size: 1rem; line-height: 1.35; }
.card-head .section-label { margin-bottom: 5px; }
.card-head p, .card > .muted, .card small { color: var(--muted); font-size: 13px; }
.card-icon { display: inline-grid; flex: 0 0 auto; place-items: center; width: 39px; height: 39px; border-radius: 11px; background: #e5eddb; color: #38593b; }
.card-icon.icon { padding: 9px; width: 39px; height: 39px; }
.task-list, .list, .status-list, .week-list { display: grid; list-style: none; margin: 0; padding: 0; }
.task-row, .skill-row { display: flex; align-items: center; gap: 13px; padding: 16px 0; border: 0; border-top: 1px solid var(--faint); background: transparent; color: var(--ink); text-decoration: none; }
.task-row:first-child, .skill-row:first-child { border-top: 0; padding-top: 5px; }
.task-row:last-child, .skill-row:last-child { padding-bottom: 2px; }
.task-list + .empty, .task-list + .task-list { margin-top: 15px; }
.task-row strong, .task-row h3, .skill-row strong { display: block; color: var(--ink); font-size: 15px; font-weight: 650; line-height: 1.35; }
.task-row .task-meta, .skill-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.task-row > :is(.btn, .pill):last-child, .skill-row > :is(.btn, .pill, .badge):last-child { margin-left: auto; }
.task-row:nth-child(3n + 2) .card-icon { color: #4c5e76; background: #e8edf0; }
.task-row:nth-child(3n + 3) .card-icon { color: #725936; background: #f1ebd9; }
button.task-row, a.task-row { width: 100%; text-align: left; }
button.task-row:hover strong, a.task-row:hover strong { text-decoration: underline; text-underline-offset: .18em; }
.list > li, .status-list > li, .week-list > li { padding-block: 11px; border-bottom: 1px solid var(--faint); }
.list > li:last-child, .status-list > li:last-child, .week-list > li:last-child { border-bottom: 0; }
.status-list > li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.week-list > li { display: flex; align-items: center; gap: 12px; }
.week-list .badge { flex: 0 0 auto; }
.section-label { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(105px, 100%), 1fr)); gap: 10px; }
.metric { min-width: 0; padding: 14px; border: 1px solid #e1e7db; border-radius: 10px; background: #f4f7ef; font-size: 12px; color: var(--muted); }
.metric > :is(b, strong), .metric-value { display: block; color: var(--pine-dark); font-family: var(--serif); font-size: 2rem; font-weight: 550; letter-spacing: -.055em; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; }
.metric > :is(small, span) { display: block; }
.metric + .progress-track, .metric-grid + .progress-track { margin-top: 16px; }
.card > :is(.metric-grid, p) + :is(.inline, .empty, .btn) { margin-top: 13px; }
.week-list > li > .pill { margin-left: auto; }
.progress-track { height: 7px; width: 100%; border-radius: 20px; background: #e5ebdf; overflow: hidden; }
.progress-fill { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: #729252; }
.pill, .badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; width: fit-content; padding: 4px 9px; border-radius: 999px; background: #eef1e9; color: #4c5e4e; font-size: 11px; line-height: 1.35; font-weight: 650; }
.pill .icon, .badge .icon { width: 13px; height: 13px; }
.pill.success, .badge.success { background: #e0ecd8; color: #315738; }
.pill.attention, .badge.attention { background: #f5e8cc; color: #705322; }
.btn { display: inline-flex; align-items: center; justify-content: center; width: fit-content; max-width: 100%; gap: 7px; min-height: 38px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--pine); font: 620 13px/1.35 var(--sans); text-align: center; text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { border-color: var(--pine); background: var(--pine); color: #fff; }
.btn.primary:hover { border-color: var(--pine-dark); background: var(--pine-dark); }
.btn.secondary:hover { border-color: #acbda9; background: #eef3e8; }
.btn.quiet { padding-inline: 6px; background: transparent; border-color: transparent; }
.btn.quiet:hover { text-decoration: underline; text-underline-offset: .2em; }
.btn.danger { color: #8b3a30; border-color: #dfc3bc; background: #fffaf6; }
.btn.danger:hover { background: #fae9e4; }
button:disabled, select:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: default; }
.empty { padding: 16px; border: 1px dashed #cbd7c8; border-radius: 10px; color: var(--muted); background: #f7f9f4; font-size: 14px; }
.inline, .session-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.divider { height: 1px; border: 0; background: var(--line); margin: 18px 0; }
.welcome-grid { display: grid; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 20px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; align-content: start; align-items: start; gap: 6px; }
.field label, label.field, .field legend { color: var(--ink); font-size: 13px; font-weight: 620; }
.field small, .field .muted { color: var(--muted); font-size: 12px; font-weight: 450; }
:is(.field, .lesson, .dialog) :is(input:not([type="radio"], [type="checkbox"], [type="range"], [type="hidden"], [type="button"], [type="submit"]), select, textarea) { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; border: 1px solid #bccbb9; border-radius: 7px; background: #fff; color: var(--ink); font-size: 15px; line-height: 1.4; }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--pine); }
.session { max-width: 850px; margin-inline: auto; }
.session > * + * { margin-top: 18px; }
.lesson { padding: 14px 17px; border-radius: 9px; background: #f3f6ed; overflow-wrap: anywhere; }
.lesson h2, .lesson h3 { font-family: var(--serif); font-size: clamp(1.55rem, 3vw, 2.2rem); line-height: 1.2; letter-spacing: -.035em; font-weight: 550; }
.lesson p, .lesson li { max-width: 70ch; }
.lesson > * + * { margin-top: 14px; }
.session h2 + fieldset.options { margin-top: 16px; }
.options { display: grid; gap: 9px; padding: 0; border: 0; }
.option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 9px; background: #fafbf7; color: var(--ink); text-align: left; line-height: 1.4; }
.option:hover { border-color: #8da78a; background: #f1f5ec; }
.option.selected, .option[aria-pressed="true"], .option:where(:has(input:checked)) { border-color: var(--pine); background: #eaf2e2; box-shadow: inset 0 0 0 1px var(--pine); }
.option.correct { border-color: #4f7b4d; background: #e4f0df; color: #204b2d; }
.option.incorrect { border-color: #b97768; background: #faece7; color: #7c382d; box-shadow: inset 0 0 0 1px #b97768; }
.session-actions { justify-content: flex-end; margin-top: 19px; }
.notice, .error { padding: 12px 15px; border: 1px solid #d5e1cf; border-radius: 9px; background: #edf4e8; color: #365a3e; font-size: 14px; }
.error { border-color: #e6c7be; background: #faeee9; color: #813f34; }
.dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 36px); overflow-y: auto; padding: clamp(20px, 3vw, 30px); box-shadow: 0 18px 80px #173a2a26; }
.dialog::backdrop { background: #172e26a1; }
.toast { position: fixed; z-index: 10; right: 22px; bottom: 20px; max-width: min(390px, calc(100vw - 40px)); padding: 12px 18px; border-radius: 10px; background: var(--pine-dark); color: #fff; font-size: 14px; box-shadow: 0 5px 20px #18392722; }
.toast:empty { display: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (min-width: 1500px) {
  .shell { grid-template-columns: 248px minmax(0, 1fr); }
  .rail { padding-inline: 23px; }
}
@media (max-width: 1150px) {
  .shell { grid-template-columns: 192px minmax(0, 1fr); }
  .rail { padding-inline: 12px; }
  .layout-grid { gap: 16px; grid-template-columns: minmax(0, 1.55fr) minmax(226px, 1fr); }
  .main { padding-inline: 24px; }
  .card { padding: 19px; }
}
@media (max-width: 930px) {
  .shell { grid-template-columns: 166px minmax(0, 1fr); }
  .nav-item { gap: 9px; padding-inline: 9px; }
  .layout-grid { grid-template-columns: 1fr; }
  .main, .topbar { padding-inline: 20px; }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .workspace { display: contents; }
  .topbar { grid-row: 1; }
  .rail { grid-row: 2; }
  .main { grid-row: 3; width: 100%; }
  .rail { position: static; height: auto; padding: 0; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail .brand, .rail-label, .rail-footer { display: none; }
  .rail-nav { display: flex; gap: 3px; padding: 7px 12px; overflow-x: auto; scrollbar-width: thin; }
  .nav-item { width: auto; flex: 0 0 auto; min-height: 40px; padding: 8px 10px; font-size: 13px; }
  .nav-item .icon { width: 16px; height: 16px; }
  .topbar { min-height: 54px; gap: 10px; padding-block: 8px; }
  .mobile-brand { display: inline-flex; gap: 7px; font-size: 23px; }
  .mobile-brand .brand-mark { width: 25px; height: 25px; }
  .breadcrumbs { display: none; }
  .profile-select { margin-left: auto; }
  .main { padding-top: 24px; padding-bottom: 36px; }
  .page-header { align-items: start; flex-direction: column; margin-bottom: 17px; }
  .hero + *, .layout-grid + .card { margin-top: 16px; }
  .stack, .welcome-grid { gap: 16px; }
  .hero { min-height: 170px; padding: 23px; }
}
@media (max-width: 480px) {
  .main, .topbar { padding-inline: 15px; }
  .page-header h1 { font-size: clamp(2.1rem, 10vw, 2.7rem); }
  .hero-content { width: 85%; }
  .hero-art { width: 40%; opacity: .52; mask-image: linear-gradient(to right, transparent, #000 50%); }
  .hero, .card, .lesson { border-radius: 13px; }
  .card { padding: 17px; }
  .task-row { flex-wrap: wrap; gap: 8px 10px; }
  .task-row > div:not(.card-icon) { flex: 1 1 125px; }
  .task-row > :is(.btn, .pill):last-child { margin-left: auto; }
  .skill-row { flex-wrap: wrap; gap: 6px 9px; }
  .skill-row > .task-meta { flex: 1 1 min(150px, 50%); }
  .skill-row > .compact { flex-basis: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .session-actions .btn { flex-grow: 1; }
  .profile-select select, select.profile-select { max-width: 150px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-item, .option { transition: background-color .15s ease, border-color .15s ease; }
  .progress-fill { transition: width .25s ease; }
}
