/* Components shared by all views – see DESIGN.md §4. Class names are stable (views and tests rely on them). */

/* ---------- page header */
.page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s-3) var(--s-5); margin: 0 0 var(--s-6); }
.page-head h1 { margin: 0; }
.page-head .eyebrow { margin-bottom: 10px; }
.page-head .eyebrow .icon { color: var(--lc, var(--ink-3)); width: 15px; height: 15px; }
.page-head .sub { margin: 10px 0 0; max-width: 68ch; font-size: 0.95rem; }
.page-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 767px) {
  .page-head { grid-template-columns: 1fr; margin-bottom: var(--s-5); }
  .page-head .actions { justify-content: flex-start; }
}

/* ---------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 24px; margin: 0 0 var(--s-4); box-shadow: var(--shadow-1); }
.card > h2:first-child, .card > h3:first-child, .card > header:first-child h2 { margin-top: 0; }
.card h3 { margin-top: 1.2em; }
.card > :last-child { margin-bottom: 0; }
a.card { display: block; color: inherit; text-decoration: none; transition: transform var(--t-mid) var(--ease-out), box-shadow var(--t-mid) var(--ease-out), border-color var(--t-fast); }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
a.card:active { transform: translateY(0); }
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 22px; font-size: 1.0625rem; line-height: 1.7; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin: var(--s-6) 0 var(--s-3); }
.section-title h2 { margin: 0; }
@media (max-width: 767px) { .card { padding: 18px 16px; border-radius: 14px; } }

/* ---------- grids & rows */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--s-4); margin-bottom: var(--s-4); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--s-4); margin-bottom: var(--s-4); }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
@media (max-width: 767px) { .two-col { grid-template-columns: 1fr; } }
.row { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; margin: var(--s-3) 0; }
.row.tight { gap: 6px; margin: 0 0 var(--s-2); }
.row.center { justify-content: center; }
.filters { align-items: flex-end; gap: var(--s-3); }
.filters .field { margin-bottom: 0; }

/* ---------- buttons */
.btn {
  --btn-h: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--btn-h); padding: 0 16px;
  font: inherit; font-size: 0.925rem; font-weight: 560; line-height: 1.2; letter-spacing: -0.005em;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-press), box-shadow var(--t-fast);
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn .icon { width: 17px; height: 17px; }
.btn.primary { background: var(--btn-primary); border-color: var(--btn-primary); color: var(--btn-primary-ink); }
.btn.primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 620; }
.btn.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.secondary { background: var(--surface-sunken); border-color: transparent; }
.btn.secondary:hover { background: var(--surface-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { --btn-h: 32px; padding: 0 12px; font-size: 0.84rem; border-radius: var(--r-sm); gap: 6px; }
.btn.small .icon { width: 15px; height: 15px; }
.btn.large { --btn-h: 48px; padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.btn.icon-only { padding: 0; width: var(--btn-h); }
.btn.block { width: 100%; }
@media (pointer: coarse) { .btn { --btn-h: 44px; } .btn.small { --btn-h: 38px; } }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 600; line-height: 1.5; padding: 1px 8px; border-radius: 999px; background: var(--surface-sunken); color: var(--ink-2); vertical-align: middle; white-space: nowrap; }
.badge .icon { width: 12px; height: 12px; }
.badge.info { background: var(--surface-sunken); color: var(--ink); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warm, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--ink); }

/* line badge – U-Bahn style skill sign */
.line-badge { --lc: var(--l-extra); display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: var(--r-xs); background: var(--lc); color: #fff; font-size: 0.7rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.line-badge .icon { width: 13px; height: 13px; stroke-width: 2.3; }
:root[data-theme="dark"] .line-badge { color: #111114; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .line-badge { color: #111114; } }
.lc-karten { --lc: var(--l-karten); }
.lc-grammatik { --lc: var(--l-grammatik); }
.lc-lesen { --lc: var(--l-lesen); }
.lc-schreiben { --lc: var(--l-schreiben); }
.lc-sprechen { --lc: var(--l-sprechen); }
.lc-hoeren { --lc: var(--l-hoeren); }
.lc-pruefung { --lc: var(--l-pruefung); }
.lc-fehler { --lc: var(--l-fehler); }
.lc-extra { --lc: var(--l-extra); }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-3); min-width: 0; }
.field > span:first-child { font-size: var(--fs-caption); font-weight: 600; color: var(--ink-2); }
.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; }
.inline-check label { cursor: pointer; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px 12px; margin: 0 0 var(--s-3); }
legend { font-size: var(--fs-caption); font-weight: 600; color: var(--ink-2); padding: 0 6px; }
input[type="text"], input[type="number"], input[type="search"], input[type="email"], input:not([type]), select, textarea {
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 0 12px; min-height: 44px; max-width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { width: 100%; padding: 12px 14px; resize: vertical; line-height: 1.6; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--r-md); }
::placeholder { color: var(--ink-3); opacity: 1; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--btn-primary); cursor: pointer; flex: none; }

/* ---------- segmented tabs */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin: 0 0 var(--s-5); background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 12px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 9px; color: var(--ink-2); font-size: 0.9rem; font-weight: 560; text-decoration: none; transition: background-color var(--t-fast), color var(--t-fast); }
.tabs a:hover { color: var(--ink); }
.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
:root[data-theme="dark"] .tabs a.active { background: var(--surface-hover); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs a.active { background: var(--surface-hover); } }

/* segmented control made of buttons (.tabs is the link version) – active via .active, aria-pressed or aria-checked */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; margin: 0; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 12px; }
.seg button, .tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; min-width: 38px; padding: 0 13px; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2); font: inherit; font-size: 0.88rem; font-weight: 560; cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease-press); }
.seg button:hover, .tabs button:hover { color: var(--ink); }
.seg button:active, .tabs button:active { transform: translateY(1px); }
.seg button.active, .seg button[aria-pressed="true"], .seg button[aria-checked="true"], .tabs button.active, .tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
:root[data-theme="dark"] :is(.seg button.active, .seg button[aria-pressed="true"], .seg button[aria-checked="true"], .tabs button.active, .tabs button[aria-selected="true"]) { background: var(--surface-hover); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.seg button.active, .seg button[aria-pressed="true"], .seg button[aria-checked="true"], .tabs button.active, .tabs button[aria-selected="true"]) { background: var(--surface-hover); } }
.seg-count { font-size: 0.74rem; color: var(--ink-3); }
@media (pointer: coarse) { .seg button, .tabs button { min-height: 40px; min-width: 44px; } }

/* exam task bits shared by Lesen, Schreiben, Sprechen and Probetest */
.situation { background: var(--surface-sunken); border-left: 3px solid var(--line-strong); padding: 12px 16px; border-radius: var(--r-sm); margin: 0 0 var(--s-4); }
.situation p:last-child { margin-bottom: 0; }
.item-meta { font-weight: 400; color: var(--ink-3); font-size: var(--fs-caption); }

/* ---------- callouts (icon via mask, so plain text callouts get one automatically) */
.callout { position: relative; display: block; padding: 12px 16px 12px 44px; margin: 0 0 var(--s-4); border-radius: 12px; background: var(--surface-sunken); border: 1px solid var(--line); color: var(--ink); font-size: 0.95rem; }
.callout::before { content: ""; position: absolute; left: 15px; top: 14px; width: 18px; height: 18px; background: var(--ink-2);
  -webkit-mask: var(--callout-icon) center / contain no-repeat; mask: var(--callout-icon) center / contain no-repeat;
  --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E"); }
.callout > :last-child { margin-bottom: 0; }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout.warn::before { background: var(--warn); --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E"); }
.callout.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.callout.good::before { background: var(--good); --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
.callout.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.callout.bad::before { background: var(--bad); --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9-6 6'/%3E%3Cpath d='m9 9 6 6'/%3E%3C/svg%3E"); }
.callout.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.callout.info::before { background: var(--accent-strong); --callout-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5'/%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 22h4'/%3E%3C/svg%3E"); }

/* ---------- empty state */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); padding: 44px 24px; margin: 0 0 var(--s-4); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--ink-2); }
.empty::before { content: ""; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-sunken) center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 7v14'/%3E%3Cpath d='M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z'/%3E%3C/svg%3E"); }
.empty p { margin: 0; max-width: 52ch; }
/* empty state with its own icon: U.h('div', { class: 'empty has-icon' }, h('span', { class: 'empty-icon' }, U.icon(name)), …) */
.empty.has-icon::before { display: none; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-sunken); color: var(--ink-3); }
.empty-icon .icon { width: 22px; height: 22px; }
.empty .row { justify-content: center; margin-bottom: 0; }

/* ---------- progress */
.progress { position: relative; height: 6px; min-width: 64px; margin: 8px 0; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.progress .bar { position: absolute; inset: 0; border-radius: inherit; background: var(--accent); transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform 700ms var(--ease-out); }
.progress.ink .bar { background: var(--ink); }

/* ---------- stats strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0 0 var(--s-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; color: inherit; text-decoration: none; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
a.stat { transition: background-color var(--t-fast); }
a.stat:hover { background: var(--surface-sunken); }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-eyebrow); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); }
.stat-label .icon { width: 14px; height: 14px; }
.stat-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.65rem; font-weight: 550; letter-spacing: -0.03em; line-height: 1.25; }
.stat .sub { font-size: var(--fs-caption); }
.stat .progress { margin-top: 6px; }
@media (max-width: 767px) { .stats { grid-template-columns: 1fr 1fr; } .stat:nth-child(odd) { border-left: 0; } .stat:nth-child(n + 3) { border-top: 1px solid var(--line); } }

/* ---------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: var(--fs-eyebrow); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); border-bottom-color: var(--line-strong); }
.table tbody tr { transition: background-color var(--t-fast); }
.table tbody tr:hover { background: var(--surface-sunken); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table tr.current { background: var(--accent-soft); }
.table tr.gate-row td { background: var(--surface-sunken); }
.bar-cell { width: 120px; }

/* ---------- disclosure */
details.reveal { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 10px; background: var(--surface); overflow: hidden; }
details.reveal > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; transition: background-color var(--t-fast); }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal > summary::after { content: ""; margin-left: auto; width: 16px; height: 16px; flex: none; background: var(--ink-3); transition: transform var(--t-mid) var(--ease-out);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat; }
details.reveal > summary:hover { background: var(--surface-sunken); }
details.reveal[open] > summary { border-bottom: 1px solid var(--line); }
details.reveal[open] > summary::after { transform: rotate(180deg); }
details.reveal[open] > .reveal-body { animation: fade-in var(--t-mid) var(--ease-out); }
.reveal-body { padding: 14px 16px; }
.reveal-body > :last-child { margin-bottom: 0; }

/* ---------- toast */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 400; display: flex; align-items: center; gap: 10px;
  max-width: min(92vw, 560px); padding: 12px 18px; border-radius: 14px; background: var(--btn-primary); color: var(--btn-primary-ink);
  font-size: 0.92rem; font-weight: 500; box-shadow: var(--shadow-3); opacity: 0; pointer-events: none;
  transform: translate(-50%, 16px); transition: opacity var(--t-mid) var(--ease-out), transform var(--t-slow) var(--ease-out); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1023px) { #toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); } }

/* ---------- timer */
.timer { display: inline-flex; align-items: center; gap: 10px; padding: 5px 6px 5px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-2); }
.timer-label { font-size: var(--fs-eyebrow); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); }
.timer-display { position: relative; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 600; min-width: 4.4ch; letter-spacing: -0.02em; }
.timer.running .timer-label::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--good); vertical-align: 1px; animation: blink-dot 1.6s ease-in-out infinite; }
.timer .btn { border-radius: 999px; }
.timer.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-soft); }
.timer.warn .timer-display { color: var(--warn); }
.timer.over { border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: var(--bad-soft); }
.timer.over .timer-display { color: var(--bad); }
.timer.flash { animation: timer-flash 0.9s var(--ease-out) 3; }
@keyframes timer-flash { 50% { background: var(--accent-soft); } }
.sticky-timer { position: sticky; top: 12px; z-index: 30; display: flex; justify-content: flex-end; margin-bottom: var(--s-3); pointer-events: none; }
.sticky-timer .timer { pointer-events: auto; }
@media (max-width: 1023px) { .sticky-timer { top: calc(var(--topbar-h) + 8px); } }

/* ---------- prose (guides, grammar explanations) */
.doc { font-size: 1rem; line-height: 1.7; max-width: 74ch; }
.doc > :first-child { margin-top: 0; }
.doc h1 { font-size: 1.6rem; margin: 0 0 0.6em; }
.doc h2 { font-size: 1.3rem; margin: 2em 0 0.6em; padding-top: 1em; border-top: 1px solid var(--line); }
.doc h3 { font-size: 1.08rem; margin: 1.6em 0 0.5em; }
.doc h4 { margin: 1.3em 0 0.4em; }
.doc p, .doc ul, .doc ol { margin: 0 0 1em; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: 0.25em 0; }
.doc li::marker { color: var(--ink-3); }
.doc table { border-collapse: collapse; margin: 1em 0 1.4em; width: 100%; display: block; overflow-x: auto; font-size: 0.93rem; line-height: 1.5; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.doc th { font-size: var(--fs-eyebrow); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); border-bottom-color: var(--line-strong); white-space: nowrap; }
.doc tbody tr:hover { background: var(--surface-sunken); }
.doc blockquote { margin: 1.2em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.doc pre { background: var(--surface-sunken); border: 1px solid var(--line); padding: 14px 16px; border-radius: 12px; overflow-x: auto; font-size: 0.88rem; line-height: 1.55; }
.doc pre code { background: none; border: 0; padding: 0; }
.doc img { max-width: 100%; border-radius: 12px; }
.doc hr { margin: 2em 0; }
.doc details { border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin: 1em 0; background: var(--surface-sunken); }
.doc details > summary { cursor: pointer; font-weight: 600; }
.doc details[open] > summary { margin-bottom: 8px; }
.doc .doc-ref { color: var(--ink-2); font-style: italic; }

/* ---------- shared exercise bits */
.model { background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; white-space: pre-line; line-height: 1.7; }
div.model { white-space: normal; }
.attempt-text { white-space: pre-wrap; font-family: var(--font); background: var(--surface-sunken); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; line-height: 1.7; }
.feedback { margin-top: var(--s-3); border-radius: 12px; animation: rise-in var(--t-mid) var(--ease-out); }
.feedback.ok, .feedback.bad { padding: 12px 16px; border: 1px solid transparent; }
.feedback.ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.feedback.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.verdict { font-weight: 650; }
.feedback.ok .verdict { color: var(--good); }
.feedback.bad .verdict { color: var(--bad); }
.checklist { list-style: none; padding: 0; margin: 6px 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.checklist li input { margin-top: 3px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kbd-hint { display: inline-flex; gap: 10px; flex-wrap: wrap; color: var(--ink-3); font-size: var(--fs-caption); }

@media print {
  .sidebar, .topbar, .tabbar, .sheet, .btn, .sticky-timer, #toast { display: none !important; }
  .layout { display: block; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}
