:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #666b73;
  --line: #dedfd8;
  --accent: #117c6f;
  --accent-strong: #0f5f56;
  --warm: #fff8e8;
  --warm-line: #ebd9ac;
  --soft-green: #edf7f3;
  --blue: #2458a6;
  --red: #a63636;
  --yellow: #8b6f12;
  --green: #187047;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #fbfaf5 0, var(--bg) 340px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 10px 16px;
  background: rgba(247, 247, 244, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand,
.top-actions,
.action-row,
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
}

.brand span:last-child {
  letter-spacing: 0.01em;
}

.top-actions a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hero {
  display: flex;
  min-height: calc(100dvh - 120px);
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  font-size: clamp(34px, 9vw, 56px);
  line-height: 1.02;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.muted-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.break-all {
  word-break: break-word;
}

.action-stack,
.stack {
  display: grid;
  gap: 12px;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.button.secondary {
  border-color: #bad0ca;
  background: #e9f3ef;
  color: var(--accent-strong);
}

.button.ghost {
  background: transparent;
}

.button.danger,
button.button.danger {
  border-color: #c98989;
  background: #fbe4e4;
  color: #8f2424;
}

.button.full {
  width: 100%;
}

.notice {
  margin: 4px 0 0;
  padding: 12px;
  border: 1px solid #ead58a;
  border-radius: 8px;
  background: #fff8d7;
  color: #5f4c05;
  font-size: 14px;
  line-height: 1.45;
}

.success-notice {
  border-color: #b9d9c9;
  background: #e7f5ee;
  color: #155c3c;
}

.danger-notice {
  border-color: #e0abab;
  background: #fdeaea;
  color: #8f2424;
}

.auth-shell {
  display: grid;
  gap: 18px;
  min-height: calc(100dvh - 130px);
  align-items: center;
}

.auth-copy {
  display: grid;
  gap: 12px;
}

.auth-copy h1 {
  margin: 0;
  font-size: clamp(34px, 9vw, 56px);
  line-height: 1.04;
}

.login-panel,
.login-card,
.danger-zone {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.05);
}

.login-panel h2,
.login-card strong,
.danger-zone h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.login-panel p,
.login-card p,
.danger-zone p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.auth-notes {
  display: grid;
  gap: 10px;
  margin: 0;
}

.auth-notes div {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.auth-notes dt {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.auth-notes dd {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric,
.card,
.empty-state,
.form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.05);
}

.metric {
  display: grid;
  gap: 3px;
  padding: 14px;
}

.metric-value {
  font-size: 28px;
  font-weight: 900;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.card,
.empty-state,
.form-card {
  padding: 16px;
}

.card h2,
.empty-state h2 {
  margin: 6px 0;
  font-size: 18px;
  line-height: 1.25;
}

.card-description {
  margin: 8px 0 0;
  color: #30343a;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.48;
}

.card-meta,
.update-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f2f3ee;
  color: #30343a;
  font-size: 13px;
  line-height: 1.45;
}

.card-meta strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 12px;
}

.update-note {
  border: 1px solid #d9e7e1;
  background: #edf7f3;
}

.learning-hero,
.dashboard-section,
.lesson-hero {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.learning-hero h1,
.lesson-hero h1 {
  margin: 0;
  font-size: clamp(34px, 9vw, 52px);
  line-height: 1.04;
}

.welcome-copy {
  display: grid;
  gap: 10px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.summary-strip > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.04);
}

.compact-summary {
  margin: 12px 0;
}

.metric-hint {
  color: #7c7364;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
}

.account-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-profile h2 {
  margin: 4px 0;
  font-size: 22px;
}

.avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: #eef0eb;
}

.avatar.small {
  width: 44px;
  height: 44px;
}

.danger-zone {
  margin-top: 18px;
  border-color: #e3b8b8;
  background: #fffafa;
}

.delete-form {
  display: grid;
  gap: 10px;
}

.delete-form label {
  display: grid;
  gap: 7px;
}

.delete-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.progress-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--warm-line);
  border-radius: 8px;
  background: var(--warm);
}

.progress-card-copy {
  display: grid;
  gap: 4px;
}

.progress-card-copy span {
  color: #856c22;
  font-size: 12px;
  font-weight: 900;
}

.progress-card-copy strong {
  color: #2d2a22;
  font-size: 14px;
  line-height: 1.45;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfbd;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #117c6f, #5f8f58);
}

.subject-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
}

.subject-chip {
  display: grid;
  min-width: max-content;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.subject-chip span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.subject-chip small {
  font-size: 11px;
  font-weight: 850;
}

.subject-chip.active {
  border-color: var(--accent);
  background: #eaf5f1;
  color: var(--accent-strong);
}

.subject-chip.planned span {
  color: #555f69;
}

.section-heading,
.map-section-header,
.focus-card,
.lesson-nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2,
.map-section-header h3,
.focus-card h2 {
  margin: 0;
}

.section-count,
.read-done {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf0f1;
  color: #4d5560;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.sidebar-note {
  margin: -2px 0 2px;
  color: #6f6a60;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.section-stack,
.lesson-list {
  display: grid;
  gap: 10px;
}

.map-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

details.map-section {
  display: block;
}

details.map-section[open] {
  display: grid;
}

.map-section-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}

.map-section-header::-webkit-details-marker {
  display: none;
}

.map-section-header::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #edf0f1;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

details[open] > .map-section-header::after {
  content: "-";
}

.map-section-header > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.map-section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-align: right;
}

.section-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 900;
}

.lesson-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.priority-row {
  border-color: #c8ddd7;
  background: linear-gradient(180deg, #fbfffc, #f2faf6);
}

.lesson-main {
  min-width: 0;
}

.lesson-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.lesson-kicker span:not(.status) {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f2f3ee;
}

.lesson-title {
  display: block;
  margin-top: 9px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.lesson-situation,
.lesson-update {
  margin: 7px 0 0;
  color: #30343a;
  font-size: 14px;
  line-height: 1.48;
}

.lesson-update {
  padding: 9px 10px;
  border: 1px solid #d9e7e1;
  border-radius: 8px;
  background: #edf7f3;
  font-size: 13px;
}

.button.compact,
button.button.compact {
  min-height: 36px;
  padding-inline: 12px;
  font-size: 13px;
}

.compact-empty {
  padding: 14px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.breadcrumb a {
  color: var(--accent-strong);
}

.focus-card {
  margin-bottom: 14px;
}

.focus-card p:last-child {
  margin: 8px 0 0;
  color: #30343a;
  font-size: 15px;
  line-height: 1.5;
}

.lesson-nav {
  margin-bottom: 18px;
}

.nav-card {
  flex: 1;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.nav-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.nav-card strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.compact-hero {
  margin-bottom: 16px;
}

.compact-hero h1 {
  font-size: clamp(32px, 8vw, 46px);
}

.reader-shell {
  display: grid;
  gap: 14px;
}

.learning-sidebar,
.reader-pane {
  min-width: 0;
}

.learning-sidebar {
  display: grid;
  gap: 14px;
}

.sidebar-block {
  display: grid;
  gap: 10px;
}

.section-heading.compact h2 {
  font-size: 20px;
}

.compact-list,
.compact-map {
  gap: 8px;
}

.compact-map-section {
  padding: 12px;
}

.nav-row {
  padding: 11px;
}

.nav-row.selected {
  border-color: var(--accent);
  background: #eaf5f1;
  box-shadow: 0 0 0 1px rgba(17, 124, 111, 0.16);
}

.nav-row .lesson-title {
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.35;
}

.lesson-date-line {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.mark-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mark-strip.mini {
  gap: 5px;
  margin-top: 7px;
}

.mark-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.mark-chip.known {
  border-color: #b7dccd;
  background: #dff2eb;
  color: #116756;
}

.mark-chip.unknown {
  border-color: #dfe4e5;
  background: #f3f5f2;
  color: #5b626b;
}

.mark-chip.interested {
  border-color: #c9d9f1;
  background: #e9f1ff;
  color: #245c9d;
}

.mark-chip.not-interested {
  border-color: #e6d8cf;
  background: #f8eee8;
  color: #8a4f32;
}

.mark-chip.neutral {
  border-color: #dfe4e5;
  background: #f8f9f6;
  color: #68707a;
}

.reader-pane {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff 0, #fffefa 100%);
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.05);
}

.reader-heading {
  display: grid;
  gap: 10px;
}

.reader-mood {
  width: fit-content;
  margin: 0;
  padding: 7px 9px;
  border: 1px solid var(--warm-line);
  border-radius: 8px;
  background: var(--warm);
  color: #6b5518;
  font-size: 12px;
  font-weight: 900;
}

.reader-heading h2 {
  margin: 0;
  font-size: clamp(30px, 7vw, 48px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.reader-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.reader-timeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.reader-timeline div {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f9f6;
}

.reader-timeline dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.reader-timeline dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

.reader-update {
  padding: 13px;
  border: 1px solid #d9e7e1;
  border-radius: 8px;
  background: var(--soft-green);
}

.reader-update p:last-child {
  margin: 7px 0 0;
  color: #30343a;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.learning-mark-panel {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 13px;
  border: 1px solid #d7e4dc;
  border-radius: 8px;
  background: #f8fcfa;
}

.learning-mark-panel h2,
.learning-mark-panel h3 {
  margin: 3px 0 0;
  font-size: 18px;
}

.learning-mark-panel p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.mark-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mark-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.mark-button.active {
  box-shadow: inset 0 0 0 1px currentColor;
}

.mark-button.interested.active,
.mark-button.interested:hover {
  border-color: #97b9e8;
  background: #e9f1ff;
  color: #245c9d;
}

.mark-button.known.active,
.mark-button.known:hover {
  border-color: #9bcfbd;
  background: #dff2eb;
  color: #116756;
}

.mark-button.not-interested.active,
.mark-button.not-interested:hover {
  border-color: #d8b7a5;
  background: #f8eee8;
  color: #8a4f32;
}

.mark-button.neutral:hover {
  background: #f3f5f2;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.reader-article {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.snapshot-history {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.version-list {
  display: grid;
  gap: 8px;
}

.version-row {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbf8;
}

.version-row strong {
  display: block;
  font-size: 14px;
}

.version-row p {
  margin: 5px 0 0;
  color: #30343a;
  font-size: 13px;
  line-height: 1.45;
}

.card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-actions {
  flex-wrap: wrap;
  margin-top: 14px;
}

.status,
.version-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status.success {
  background: #e0f2e9;
  color: var(--green);
}

.status.warning {
  background: #fff2c6;
  color: var(--yellow);
}

.status.danger {
  background: #fbe4e4;
  color: var(--red);
}

.status.muted,
.version-pill {
  background: #edf0f1;
  color: #4d5560;
}

.section-title {
  margin: 10px 0 0;
  font-size: 16px;
}

.content-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.info-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.info-panel p:last-child {
  margin: 6px 0 0;
  color: #30343a;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
}

.article-card {
  margin-bottom: 18px;
}

.article-body {
  margin-top: 12px;
  color: #22262b;
  font-size: 15px;
  line-height: 1.68;
  white-space: pre-line;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-row,
.admin-lesson-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.04);
}

.user-row-main {
  display: flex;
  min-width: 0;
  gap: 12px;
}

.user-row h2,
.admin-lesson-row h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.3;
}

.admin-mark-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.list-item.vertical {
  align-items: stretch;
  flex-direction: column;
}

.details {
  display: grid;
  gap: 12px;
  margin: 0;
}

.details div {
  display: grid;
  gap: 4px;
}

.details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.diff,
.preview {
  width: 100%;
  max-height: 420px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.preview {
  background: #f2f3ee;
  color: var(--ink);
}

.form-card {
  display: grid;
  gap: 14px;
}

.form-card label {
  display: grid;
  gap: 7px;
}

.form-card label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.form-card label.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-card label.check-row input {
  width: 20px;
  min-height: 20px;
}

.subject-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 35, 40, 0.04);
}

.subject-row h2 {
  margin: 8px 0 6px;
  font-size: 20px;
  line-height: 1.25;
}

@media (min-width: 700px) {
  .button.primary,
  .button.secondary,
  .button.ghost {
    width: auto;
  }

  .action-stack {
    display: flex;
    align-items: center;
  }

  .content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-shell,
  .account-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  }

  .page {
    width: min(100%, 1180px);
  }

  .reader-shell {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    align-items: start;
  }

  .learning-sidebar {
    position: sticky;
    top: 78px;
    max-height: calc(100dvh - 96px);
    overflow: auto;
    padding-right: 2px;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding-inline: 12px;
  }

  .page {
    padding-inline: 12px;
  }

  .card-row,
  .action-row,
  .focus-card,
  .lesson-row,
  .lesson-nav,
  .map-section-header,
  .reader-actions,
  .version-row,
  .user-row,
  .admin-lesson-row,
  .subject-row,
  .account-profile {
    align-items: stretch;
    flex-direction: column;
  }

  .card-actions .button,
  .card-actions form,
  .card-actions button,
  .action-row .button,
  .action-row form,
  .action-row button,
  .lesson-row form,
  .lesson-row button,
  .focus-card form,
  .focus-card button {
    width: 100%;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-section-header p {
    text-align: left;
  }

  .reader-pane {
    padding: 14px;
  }

  .reader-timeline {
    grid-template-columns: 1fr;
  }

  .reader-actions .button,
  .reader-actions form,
  .reader-actions button,
  .mark-actions form,
  .mark-actions button,
  .admin-mark-actions form,
  .admin-mark-actions button,
  .user-row .button,
  .danger-zone .button {
    width: 100%;
  }

  .admin-mark-actions {
    justify-content: stretch;
  }
}
