/* The web app's stylesheet: the Sky theme, light and dark (the tokens
   below), following the design canvas (design/canvas/project/*.dc.html,
   drawn in Sky's light colours), written by hand. No build step: this
   file is compiled into the binary and served as it is (src/assets.rs).
   The pages' content security policy allows no inline style, so everything
   a page needs is a class here. */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Sky: a pale blue-grey ground, white cards, navy text, and one blue for
   what the student acts on and picks (buttons, a chosen option, the focus
   ring). The navy "chrome" carries the sidebar, the tab bar and the exam's
   bar; the grid of questions has a navy panel and tokens of its own (--grid*). Green and red stay only for right and wrong, so a
   picked answer never looks like a verdict. Analytics has a scale of its own
   for how well a topic is known (--level*: amber for weak through blue for
   strong, never green and red), shades of blue for how much was done on a
   day (--heat*) and the band around the forecast's line (--band). Every colour is a token here;
   the dark set below redefines the same tokens, nothing else. */
:root {
  color-scheme: light;
  --ground: #edf2f7;
  --surface: #ffffff;
  --ink: #1a2537;
  --muted: #4a586d;
  --placeholder: #66748a;
  --line: #d8e0ea;
  --control-line: #75869c;
  --wash: #f2f6fb;
  --accent: #2160c4;
  --accent-hover: #1a4ea3;
  --accent-wash: #e7effb;
  --on-accent: #ffffff;
  --chrome: #1d3557;
  --chrome-raised: #284670;
  --chrome-edge: #1d3557;
  --on-chrome: #ffffff;
  --on-chrome-muted: #b9c8dc;
  --on-chrome-success: #6ee7a0;
  --on-chrome-warning: #fde68a;
  --danger: #b42318;
  --danger-wash: #fbeceb;
  --success: #146b39;
  --success-wash: #e3f3e9;
  --warning: #8a5f00;
  --warning-wash: #f6eedb;
  --info: #1d5fbf;
  --info-wash: #e5eefa;
  --on-status: #ffffff;
  --progress: #6d4bd1;
  --tint: #ece8fb;
  --level-weak: #a85d00;
  --level-middling: #e9c176;
  --level-good: #9cbcf2;
  --level-strong: #2160c4;
  --heat-1: #cfe0f7;
  --heat-2: #8fb4ec;
  --heat-3: #4a84d8;
  --heat-4: #1a4ea3;
  --band: #cfe0f7;
  --formula-wash: rgb(33 96 196 / 0.09);
  --grid: #1d3557;
  --grid-cell: #284670;
  --grid-ink: #b9c8dc;
  --grid-line: rgb(255 255 255 / 0.32);
  --grid-current: #ffffff;
  --grid-answered: #8ab3ff;
  --grid-right: #6ee7a0;
  --grid-wrong: #ffa59c;
  --grid-flag: #fde68a;
  --on-grid-fill: #0c1630;
  --backdrop: rgb(10 22 40 / 0.5);
  --font: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --shadow-card: 0 1px 3px rgb(29 53 87 / 0.06);
  --shadow-button: 0 1px 2px rgb(29 53 87 / 0.24), 0 4px 12px rgb(29 53 87 / 0.16);
  --shadow-panel: 0 4px 16px rgb(29 53 87 / 0.14);
}

/* Sky at night, when the device asks for dark (unless the reader chose
   light) or the reader chose dark: charcoal with a blue cast,
   not black, and off-white text, not white, so letters do not glow. The
   chrome is darker than the ground and keeps an edge to stand apart. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ground: #121721;
    --surface: #1b2230;
    --ink: #e3e8f0;
    --muted: #a3aec0;
    --placeholder: #8692a7;
    --line: #2c3546;
    --control-line: #6a7790;
    --wash: #232b3b;
    --accent: #8ab3ff;
    --accent-hover: #a8c7ff;
    --accent-wash: #1f2f4d;
    --on-accent: #0c1630;
    --chrome: #0b1019;
    --chrome-raised: #1f2838;
    --chrome-edge: #2c3546;
    --on-chrome: #e3e8f0;
    --on-chrome-muted: #98a3b6;
    --on-chrome-success: #5fcf8a;
    --on-chrome-warning: #f6cd7d;
    --danger: #ff8a80;
    --danger-wash: #3b1f22;
    --success: #5fcf8a;
    --success-wash: #16302a;
    --warning: #f0b44c;
    --warning-wash: #3a2f1a;
    --info: #8ab3ff;
    --info-wash: #1f2f4d;
    --on-status: #0c1210;
    --progress: #a48cff;
    --tint: #2c2550;
    --level-weak: #f0b44c;
    --level-middling: #7a5c1e;
    --level-good: #34558f;
    --level-strong: #8ab3ff;
    --heat-1: #24385c;
    --heat-2: #2f5391;
    --heat-3: #4f7fd0;
    --heat-4: #8ab3ff;
    --band: #24385c;
    --formula-wash: rgb(138 179 255 / 0.14);
    --grid: #0b1019;
    --grid-cell: #1f2838;
    --grid-ink: #98a3b6;
    --grid-line: rgb(255 255 255 / 0.26);
    --grid-current: #e3e8f0;
    --grid-answered: #8ab3ff;
    --grid-right: #5fcf8a;
    --grid-wrong: #ff8a80;
    --grid-flag: #f6cd7d;
    --on-grid-fill: #0c1630;
    --backdrop: rgb(0 0 0 / 0.6);
    --shadow-card: none;
    --shadow-button: none;
    --shadow-panel: 0 4px 16px rgb(0 0 0 / 0.4);
  }
}

/* chosen on the profile (`data-theme`, src/theme.rs): the same values as
   the block above, which a test keeps equal */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #121721;
  --surface: #1b2230;
  --ink: #e3e8f0;
  --muted: #a3aec0;
  --placeholder: #8692a7;
  --line: #2c3546;
  --control-line: #6a7790;
  --wash: #232b3b;
  --accent: #8ab3ff;
  --accent-hover: #a8c7ff;
  --accent-wash: #1f2f4d;
  --on-accent: #0c1630;
  --chrome: #0b1019;
  --chrome-raised: #1f2838;
  --chrome-edge: #2c3546;
  --on-chrome: #e3e8f0;
  --on-chrome-muted: #98a3b6;
  --on-chrome-success: #5fcf8a;
  --on-chrome-warning: #f6cd7d;
  --danger: #ff8a80;
  --danger-wash: #3b1f22;
  --success: #5fcf8a;
  --success-wash: #16302a;
  --warning: #f0b44c;
  --warning-wash: #3a2f1a;
  --info: #8ab3ff;
  --info-wash: #1f2f4d;
  --on-status: #0c1210;
  --progress: #a48cff;
  --tint: #2c2550;
  --level-weak: #f0b44c;
  --level-middling: #7a5c1e;
  --level-good: #34558f;
  --level-strong: #8ab3ff;
  --heat-1: #24385c;
  --heat-2: #2f5391;
  --heat-3: #4f7fd0;
  --heat-4: #8ab3ff;
  --band: #24385c;
  --formula-wash: rgb(138 179 255 / 0.14);
  --grid: #0b1019;
  --grid-cell: #1f2838;
  --grid-ink: #98a3b6;
  --grid-line: rgb(255 255 255 / 0.26);
  --grid-current: #e3e8f0;
  --grid-answered: #8ab3ff;
  --grid-right: #5fcf8a;
  --grid-wrong: #ff8a80;
  --grid-flag: #f6cd7d;
  --on-grid-fill: #0c1630;
  --backdrop: rgb(0 0 0 / 0.6);
  --shadow-card: none;
  --shadow-button: none;
  --shadow-panel: 0 4px 16px rgb(0 0 0 / 0.4);
}

/* EXPERIMENT: Clay, to compare with Sky. Chosen on the profile only
   (`clay-light`, `clay-dark`); they come after the device's dark block and
   redefine every token, so they hold whatever the device says. Warm paper
   and charcoal grounds, near-black and off-white text, and a clay orange as
   the one accent; the sidebar is a shade of the ground, not navy. White on
   the orange is below WCAG AA for text (about 3.9:1 light, 3.1:1 dark). */
:root[data-theme="clay-light"] {
  color-scheme: light;
  --ground: #faf9f5;
  --surface: #ffffff;
  --ink: #141413;
  --muted: #5e5d59;
  --placeholder: #73726c;
  --line: #e3e1d9;
  --control-line: #8a8880;
  --wash: #f5f4ed;
  --accent: #c96442;
  --accent-hover: #b5573a;
  --accent-wash: #f7ebe5;
  --on-accent: #ffffff;
  --chrome: #f0eee6;
  --chrome-raised: #e6e3d8;
  --chrome-edge: #dedcd1;
  --on-chrome: #141413;
  --on-chrome-muted: #5e5d59;
  --on-chrome-success: #2a6b12;
  --on-chrome-warning: #7a5300;
  --danger: #a33a32;
  --danger-wash: #f8e9e6;
  --success: #2a6b12;
  --success-wash: #e8f1e0;
  --warning: #7a5300;
  --warning-wash: #f5eddb;
  --info: #1f6fbf;
  --info-wash: #e6eff9;
  --on-status: #ffffff;
  --progress: #c96442;
  --tint: #f3ece3;
  --formula-wash: rgb(201 100 66 / 0.08);
  --grid: #f0eee6;
  --grid-cell: #e3e0d4;
  --grid-ink: #5e5d59;
  --grid-line: #8a8880;
  --grid-current: #141413;
  --grid-answered: #e9a48a;
  --grid-right: #9fd08a;
  --grid-wrong: #f0a59e;
  --grid-flag: #7a5300;
  --on-grid-fill: #141413;
  --backdrop: rgb(20 20 19 / 0.4);
  --shadow-card: 0 1px 3px rgb(20 20 19 / 0.05);
  --shadow-button: 0 1px 2px rgb(20 20 19 / 0.15);
  --shadow-panel: 0 4px 20px rgb(20 20 19 / 0.08);
}

:root[data-theme="clay-dark"] {
  color-scheme: dark;
  --ground: #262624;
  --surface: #30302e;
  --ink: #faf9f5;
  --muted: #c2c0b6;
  --placeholder: #9c9a92;
  --line: #41403c;
  --control-line: #7a7870;
  --wash: #2b2b29;
  --accent: #d97757;
  --accent-hover: #e38b6e;
  --accent-wash: #3d2c25;
  --on-accent: #ffffff;
  --chrome: #1f1e1d;
  --chrome-raised: #30302e;
  --chrome-edge: #3a3936;
  --on-chrome: #faf9f5;
  --on-chrome-muted: #9c9a92;
  --on-chrome-success: #7ec46a;
  --on-chrome-warning: #e6b45a;
  --danger: #e5726b;
  --danger-wash: #3b2220;
  --success: #7ec46a;
  --success-wash: #23301d;
  --warning: #e6b45a;
  --warning-wash: #372d1b;
  --info: #7cb0ea;
  --info-wash: #1f2a37;
  --on-status: #141413;
  --progress: #d97757;
  --tint: #35302b;
  --formula-wash: rgb(217 119 87 / 0.12);
  --grid: #1f1e1d;
  --grid-cell: #3a3936;
  --grid-ink: #c2c0b6;
  --grid-line: #7a7870;
  --grid-current: #faf9f5;
  --grid-answered: #e38b6e;
  --grid-right: #7ec46a;
  --grid-wrong: #e5726b;
  --grid-flag: #e6b45a;
  --on-grid-fill: #141413;
  --backdrop: rgb(0 0 0 / 0.6);
  --shadow-card: none;
  --shadow-button: none;
  --shadow-panel: 0 4px 16px rgb(0 0 0 / 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
p,
ul,
dl,
dd,
figure {
  margin: 0;
}

/* read out, not drawn */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mono,
.number {
  font-family: var(--mono);
}

.number {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

/* an email address in a sentence: breaks anywhere rather than run off a phone */
.address {
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

/* the mark and the name, as in the sidebar */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--on-chrome);
  color: var(--chrome);
  font-size: 12px;
  font-weight: 700;
}

.brand-mark-dark {
  background: var(--chrome);
  color: var(--on-chrome);
  /* in dark mode the chrome is darker than the ground: an edge keeps the mark */
  box-shadow: inset 0 0 0 1px var(--chrome-edge);
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
}

/* a text link; also a button that reads as one */
.link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--control-line);
  cursor: pointer;
}

.link:hover {
  text-decoration-color: currentColor;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  box-shadow: var(--shadow-button);
  cursor: pointer;
}

.button:hover {
  background: var(--accent-hover);
}

.button-secondary {
  width: auto;
  min-height: 44px;
  padding: 0 18px;
  border-color: var(--control-line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  box-shadow: none;
}

.button-secondary:hover {
  background: var(--wash);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- forms ---- */

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 500;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.input-code {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.3em;
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

.field-error svg {
  flex: none;
  margin-top: 2px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: var(--danger-wash);
  color: var(--danger);
  font-size: 14px;
  font-weight: 500;
}

.notice svg {
  flex: none;
}

.notice .link {
  color: var(--danger);
  text-decoration-color: currentColor;
}

.form-line {
  color: var(--muted);
  font-size: 14px;
}

/* ---- the signed-out pages ---- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 8px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  padding: 32px 40px 40px;
  border-radius: 20px;
  background: var(--chrome);
  border: 1px solid var(--chrome-edge);
  color: var(--on-chrome);
  box-shadow: var(--shadow-panel);
}

.auth-pitch {
  display: grid;
  gap: 32px;
  max-width: 400px;
  margin-block: auto;
  padding-block: 48px;
}

.auth-pitch-title {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-features {
  display: grid;
  gap: 20px;
  padding: 0;
  list-style: none;
}

.auth-features li {
  display: flex;
  gap: 14px;
}

.auth-feature-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--chrome-raised);
}

.auth-feature-title {
  display: block;
  font-weight: 600;
}

.auth-feature-body {
  display: block;
  color: var(--on-chrome-muted);
  font-size: 14px;
}

.auth-main {
  display: flex;
  flex-direction: column;
  padding: 32px clamp(16px, 4vw, 48px) 40px;
}

.auth-phone-brand {
  display: none;
}

.auth-col {
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding-block: 32px;
}

.auth-heading {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-lede {
  margin-top: 8px;
  margin-bottom: 32px;
  color: var(--muted);
  font-size: 16px;
}

.auth-foot {
  display: grid;
  gap: 8px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 14px;
}

.reference {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .auth {
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
  }

  .auth-brand {
    display: none;
  }

  .auth-phone-brand {
    display: flex;
  }

  .auth-main {
    padding: 20px 16px 32px;
  }

  .auth-col {
    margin-top: 48px;
  }
}

/* the copyright line and the way to the terms, at the foot of the form column */
.auth-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- the terms of use (templates/terms.html) ---- */

.legal {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding: 24px 16px 40px;
}

.legal-brand {
  color: var(--ink);
  text-decoration: none;
}

.legal-doc {
  padding: clamp(20px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  overflow-wrap: break-word;
}

.legal-title {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.legal-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.legal-toc {
  margin-block: 24px 8px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--wash);
  font-size: 15px;
}

.legal-toc ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 22px;
}

.legal-toc a {
  color: var(--ink);
  text-underline-offset: 3px;
}

.legal-doc section {
  scroll-margin-top: 16px;
}

.legal-doc h2 {
  margin-top: 32px;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

.legal-doc p,
.legal-doc li {
  line-height: 1.6;
}

.legal-doc p + p {
  margin-top: 10px;
}

.legal-doc ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 22px;
}

.legal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* ---- the signed-in landing page ---- */

.landing {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  padding: 32px 16px;
}

.who {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* ==== components (src/components/, templates/components/) ==== */

.icon {
  flex: none;
}

/* ---- Button ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--shadow-button);
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn[data-size="sm"] {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
}

.btn[data-variant="secondary"] {
  border-color: var(--wash);
  background: var(--wash);
  color: var(--ink);
  box-shadow: none;
}

.btn[data-variant="secondary"]:hover {
  border-color: var(--line);
  background: var(--line);
}

.btn[data-variant="outline"] {
  border-color: var(--control-line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.btn[data-variant="outline"]:hover {
  background: var(--wash);
}

.btn[data-width="full"] {
  display: flex;
  width: 100%;
}

/* a link to a place that has no page yet */
.btn[aria-disabled="true"] {
  opacity: 0.5;
  box-shadow: none;
  cursor: not-allowed;
}

.btn[aria-disabled="true"]:hover {
  background: var(--accent);
}

.btn[data-variant="secondary"][aria-disabled="true"]:hover {
  border-color: var(--wash);
  background: var(--wash);
}

.btn[data-variant="outline"][aria-disabled="true"]:hover {
  background: var(--surface);
}

/* a button that waits for its form's request */
.btn:disabled {
  opacity: 0.5;
  box-shadow: none;
  cursor: progress;
}

.btn:disabled:hover {
  background: var(--accent);
}

/* ---- IconButton ---- */

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--wash);
}

/* ---- Avatar ---- */

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--wash);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.avatar[data-size="sm"] {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.avatar[data-tone="raised"] {
  background: var(--chrome-raised);
  color: var(--on-chrome);
}

.avatar[data-tone="tint"] {
  background: var(--tint);
}

/* ---- StatusChip: a fill, a border and a dot, never colour alone ---- */

.status-chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid var(--chip, var(--control-line));
  border-radius: 999px;
  background: var(--chip-wash, var(--wash));
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.status-chip::before {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--chip, var(--control-line));
  content: "";
}

.status-chip[data-status="active"] {
  --chip: var(--success);
  --chip-wash: var(--success-wash);
}

.status-chip[data-status="ending"] {
  --chip: var(--warning);
  --chip-wash: var(--warning-wash);
}

.status-chip[data-status="booked"] {
  --chip: var(--info);
  --chip-wash: var(--info-wash);
}

/* ---- Notice: the tones beside the error one above ---- */

.notice[data-tone="success"] {
  border-color: var(--success);
  background: var(--success-wash);
  color: var(--ink);
}

.notice[data-tone="info"] {
  border-color: var(--line);
  background: var(--wash);
  color: var(--muted);
}

.notice[data-tone="success"] .link,
.notice[data-tone="info"] .link {
  color: var(--ink);
}

/* ---- Card ---- */

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.card-lead {
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.card-note {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--wash);
  color: var(--muted);
  font-size: 14px;
}

.card-when {
  font-size: 14px;
}

/* a line of figures under a card's heading */
.card-figures {
  color: var(--muted);
  font-size: 13px;
}

/* a form that is the card's content */
.card-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* the foot of a card: what to do or what happened, and the way on */
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 500;
}

.card-result {
  color: var(--ink);
}

/* the buttons at a card's foot, side by side */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* something behind a subscription: an icon, what it is, and the way to it */
.offer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}

.offer-icon {
  display: grid;
  flex: none;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  background: var(--wash);
}

.offer-text {
  flex: 1 1 260px;
  min-width: 0;
}

/* rows in a card: a rule above each, the card's foot padding taken back */
.rows {
  margin-bottom: -12px;
  padding: 0;
  list-style: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.row-text {
  flex: 1 1 180px;
  min-width: 0;
}

/* a topic under a topic */
.row[data-depth="1"] .row-text {
  padding-left: 20px;
}

.row[data-depth="2"] .row-text {
  padding-left: 40px;
}

.row[data-depth="3"] .row-text {
  padding-left: 60px;
}

.row-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.row-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.row-progress {
  flex: 1 1 160px;
  min-width: 0;
}

.row-figures {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

/* a row's action: one width down the list whatever it says ("Başla",
   "Davam et", "Bax"), so the bars beside it start and end together */
.row > .btn {
  min-width: 104px;
}

.person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* ---- Progress: the one place purple is used ---- */

.progress {
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--wash);
  appearance: none;
}

.progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--wash);
}

.progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--progress);
}

.progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--progress);
}

/* ---- StatTiles ---- */

.stat-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 0;
  padding: 24px 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stat-tile:not(:last-child) {
  margin-right: 28px;
  padding-right: 28px;
  border-right: 1px solid var(--line);
}

.stat-tile dt {
  color: var(--muted);
  font-size: 14px;
}

.stat-tile dd {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.3;
}

/* ---- DetailRows ---- */

.detail-rows {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.detail-row dt {
  flex: none;
  color: var(--muted);
}

.detail-row dd {
  font-weight: 500;
  text-align: right;
}

.detail-row dd.mono {
  font-weight: 400;
}

/* ---- Attempts ---- */

.attempts {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-size: 14px;
  list-style: none;
}

.attempt {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* the attempt on the page */
.attempt[aria-current="true"] {
  border-color: var(--ink);
}

.attempt-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.attempt-name {
  font-weight: 600;
}

.attempt-note {
  color: var(--muted);
}

.attempt .link {
  padding: 4px 0;
}

/* ---- EmptyState ---- */

.empty-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* ---- PageHeader ---- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-header-text {
  min-width: 0;
}

.page-header-eyebrow {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.page-header h1 {
  margin: 2px 0 4px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.page-header-subline {
  color: var(--muted);
  font-size: 16px;
}

.page-header-progress {
  flex: 0 1 280px;
  min-width: 200px;
}

.page-header-caption {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

/* ---- SectionTabs: the views of one section, under the page's header ---- */

/* the rule under the row is the nav's own, so it runs the page's width
   while the row scrolls sideways on a narrow screen; however long the row,
   it asks no width of what holds it (a grid would grow to fit it) */
.section-tabs {
  contain: inline-size;
  overflow-x: auto;
  box-shadow: inset 0 -1px 0 var(--line);
}

.section-tabs-list {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.section-tab:hover {
  color: var(--ink);
}

/* inside the scrolling row, so the ring is not cut off */
.section-tab:focus-visible {
  outline-offset: -2px;
}

/* the view on the page: the line under it and its weight, not colour alone */
.section-tab[aria-current] {
  border-bottom-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.section-tab-count {
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  place-items: center;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.section-tab[aria-current] .section-tab-count {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---- NavItem, Sidebar ---- */

.sidebar {
  position: sticky;
  top: 12px;
  display: flex;
  flex: 0 0 272px;
  flex-direction: column;
  gap: 4px;
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  padding: 20px 14px;
  overflow-y: auto;
  border-radius: 20px;
  border: 1px solid var(--chrome-edge);
  background: var(--chrome);
  color: var(--on-chrome);
  box-shadow: var(--shadow-panel);
}

.sidebar :focus-visible,
.tab-bar :focus-visible,
[data-ground="dark"] :focus-visible {
  outline-color: var(--on-chrome);
}

.sidebar-brand {
  padding: 0 8px 16px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  color: var(--on-chrome-muted);
  font-weight: 500;
  text-decoration: none;
}

a.nav-item:hover {
  color: var(--on-chrome);
}

.nav-item[aria-current="page"] {
  background: var(--chrome-raised);
  color: var(--on-chrome);
  font-weight: 600;
}

.nav-item[aria-disabled="true"] {
  cursor: not-allowed;
}

.nav-label {
  min-width: 0;
}

.nav-count,
.nav-amount {
  margin-left: auto;
}

.nav-count[hidden] {
  display: none;
}

.nav-count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--on-chrome);
  color: var(--chrome);
  font-size: 12px;
  font-weight: 600;
}

.nav-amount {
  color: var(--on-chrome);
  font-size: 13px;
  white-space: nowrap;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 18px 0 6px 8px;
  border-top: 1px solid var(--chrome-raised);
}

/* who is signed in: the way to their own page */
.sidebar-profile {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 48px;
  margin: -6px 0 -6px -8px;
  padding: 6px 8px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.sidebar-profile:hover,
.sidebar-profile[aria-current="page"] {
  background: var(--chrome-raised);
}

.sidebar-who {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.sidebar-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-role {
  color: var(--on-chrome-muted);
  font-size: 13px;
}

.sidebar .icon-btn {
  color: var(--on-chrome-muted);
}

.sidebar .icon-btn:hover {
  background: var(--chrome-raised);
  color: var(--on-chrome);
}

/* ---- TopBar and TabBar: the phone's shell, hidden on a computer ---- */

.top-bar,
.tab-bar {
  display: none;
}

.top-bar {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

/* the brand's mark and the switcher give way to what is at the end */
.top-bar .brand {
  flex: 1 1 auto;
  gap: 10px;
  min-width: 0;
}

.top-bar-end {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar-balance {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--wash);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.top-bar-profile {
  display: grid;
  border-radius: 999px;
  text-decoration: none;
}

.top-bar-profile[aria-current="page"] {
  box-shadow: 0 0 0 2px var(--ground), 0 0 0 4px var(--accent);
}

.tab-bar {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 10;
  /* as many columns as places: six inside a program, one outside */
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  align-items: center;
  height: 64px;
  border-radius: 20px;
  border: 1px solid var(--chrome-edge);
  background: var(--chrome);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.18), 0 12px 32px rgb(0 0 0 / 0.18);
}

.tab-bar > * {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  color: var(--on-chrome-muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.tab-bar > [aria-current="page"] {
  color: var(--on-chrome);
  font-weight: 600;
}

/* ---- Choices: a question's answer options, to pick from and marked ---- */

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
}

.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  /* the border is 1px, or 2px once picked or marked: the padding makes up
     the difference, so nothing moves */
  padding: 9px 16px;
  border: 1px solid var(--control-line);
  border-radius: 12px;
  background: var(--surface);
}

label.choice {
  position: relative;
  cursor: pointer;
}

/* the radio button itself is the whole row: drawn as nothing, still the
   thing that takes the click and the keyboard */
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

label.choice:hover {
  background: var(--wash);
}

.choice:has(input:checked),
.choice[data-mark="right"],
.choice[data-mark="wrong"] {
  padding: 8px 15px;
  border-width: 2px;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice-badge {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--control-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.choice:has(input:checked) .choice-badge {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.choice .tex {
  flex: 1 1 auto;
  min-width: 0;
}

.choice[data-mark="right"] {
  border-color: var(--success);
  background: var(--success-wash);
}

.choice[data-mark="right"] .choice-badge {
  border-color: var(--success);
  background: var(--success);
  color: var(--on-status);
}

.choice[data-mark="wrong"] {
  border-color: var(--danger);
  background: var(--danger-wash);
}

.choice[data-mark="wrong"] .choice-badge {
  border-color: var(--danger);
  background: var(--danger);
  color: var(--on-status);
}

.choice[data-mark="other"] {
  border-color: var(--line);
  color: var(--muted);
}

.choice-tag {
  flex: none;
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
}

/* ---- Answer: a typed answer, and the grid that matches rows to letters ---- */

.typed-input {
  font-family: var(--mono);
}

/* what was typed, in a marked line like an option's */
.typed-value {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.match {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow-x: auto;
}

.match-grid {
  width: max-content;
  border-collapse: separate;
  border-spacing: 6px;
}

.match-grid th {
  min-width: 28px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.match-grid td {
  padding: 0;
}

.match-cell {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--surface);
}

/* the checkbox is the whole cell: drawn as nothing, still what takes the
   click and the keyboard (as an option's radio button) */
.match-pick {
  position: relative;
  cursor: pointer;
}

.match-pick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.match-pick:hover {
  background: var(--wash);
}

.match-pick:has(input:checked) {
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.match-pick:has(input:checked)::after {
  content: "✓";
  font-weight: 700;
}

.match-pick:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.match-cell[data-mark="right"] {
  border: 2px solid var(--success);
  background: var(--success);
  color: var(--on-status);
}

/* right, but not ticked: the same tick, outlined */
.match-cell[data-mark="missed"] {
  border: 2px dashed var(--success);
  background: var(--success-wash);
  color: var(--success);
}

.match-cell[data-mark="wrong"] {
  border: 2px solid var(--danger);
  background: var(--danger);
  color: var(--on-status);
}

.match-cell[data-mark="other"] {
  border-color: var(--line);
}

.match-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}

.match-key li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.match-key .match-cell {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

/* ---- QuestionMap: every question as a numbered link, by how it stands ---- */

/* The grid of questions (here and PaperMap below) sits on a panel of its
   own, with its own tokens (--grid*): quiet tiles for what is open, a solid
   fill with dark figures for what is answered, right or wrong. */
.question-map,
.paper-map {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: var(--grid);
  color: var(--grid-ink);
}

.question-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 10px;
  max-height: 320px;
  margin: 0;
  /* room for a cell's outline and corner mark inside the scrolling box */
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.question-cell {
  position: relative;
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--grid-cell);
  color: var(--grid-ink);
  font-family: var(--mono);
  font-size: 14px;
  text-decoration: none;
}

.question-cell:hover {
  border-color: var(--grid-ink);
}

.question-cell[data-state="right"] {
  background: var(--grid-right);
  color: var(--on-grid-fill);
}

.question-cell[data-state="wrong"] {
  background: var(--grid-wrong);
  color: var(--on-grid-fill);
}

/* left without an answer in a paper that is over */
.question-cell[data-state="skipped"] {
  border: 1.5px dashed var(--grid-line);
  background: none;
}

.question-cell[aria-current] {
  outline: 2px solid var(--grid-current);
  outline-offset: 2px;
  font-weight: 600;
}

/* the tick or cross on a cell's corner, and in the key */
.question-mark,
.question-key {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 999px;
  background: var(--on-grid-fill);
}

.question-mark {
  position: absolute;
  top: -5px;
  right: -5px;
  box-shadow: 0 0 0 2px var(--grid);
}

.question-mark svg,
.question-key svg {
  stroke-width: 3.2;
}

[data-state="right"] > .question-mark {
  color: var(--grid-right);
}

[data-state="wrong"] > .question-mark {
  color: var(--grid-wrong);
}

.question-key[data-state="right"] {
  background: var(--grid-right);
  color: var(--on-grid-fill);
}

.question-key[data-state="wrong"] {
  background: var(--grid-wrong);
  color: var(--on-grid-fill);
}

.question-key[data-state="open"] {
  background: var(--grid-cell);
  box-shadow: inset 0 0 0 1px var(--grid-ink);
}

.question-key[data-state="skipped"] {
  border: 1.5px dashed var(--grid-line);
  background: none;
}

.question-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 0 6px;
  color: var(--grid-ink);
  font-size: 13px;
  list-style: none;
}

.question-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- Filters: the form that narrows a long list ---- */

.filters {
  display: grid;
  gap: 14px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.filters-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.filters-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filters-field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  text-overflow: ellipsis;
}

.select:disabled {
  border-color: var(--line);
  background: var(--wash);
  color: var(--muted);
}

.filters-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
}

.filters-summary {
  color: var(--muted);
  font-size: 13px;
}

.filters-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

/* ---- Pagination: the pages of a long list ---- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 20px;
}

.pagination-summary {
  color: var(--muted);
  font-size: 13px;
}

.pagination-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination-page,
.pagination-gap {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  font-family: var(--mono);
  font-size: 14px;
}

.pagination-page {
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
}

.pagination-page:hover {
  background: var(--wash);
}

.pagination-page[aria-current] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.pagination-gap {
  min-width: 20px;
  color: var(--muted);
}

/* ---- PackagePicker: how long to subscribe for, each length a card ---- */

.packages {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.packages legend {
  margin-bottom: 8px;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
}

.package-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.package-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  /* the border is 1px, or 2px once picked: the padding makes up the
     difference, so nothing moves */
  padding: 17px;
  border: 1px solid var(--control-line);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
}

/* the radio button is the whole card, as in Choices */
.package-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.package-choice:hover {
  background: var(--wash);
}

.package-choice:has(input:checked) {
  padding: 16px;
  border-width: 2px;
  border-color: var(--accent);
  background: var(--accent-wash);
}

.package-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.package-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* the radio button as it is seen: a ring, filled once picked */
.package-mark {
  display: grid;
  flex: none;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid var(--control-line);
  border-radius: 999px;
  background: var(--surface);
}

.package-mark::after {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  content: "";
}

.package-choice:has(input:checked) .package-mark {
  border-color: var(--accent);
}

.package-choice:has(input:checked) .package-mark::after {
  background: var(--accent);
}

.package-length {
  font-size: 17px;
  font-weight: 600;
}

.package-badge {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--chrome);
  color: var(--on-chrome);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.package-cost {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}

.package-price {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

/* what the months cost one at a time */
.package-was {
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
}

.package-terms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.package-note {
  color: var(--muted);
  font-size: 14px;
}

/* what the longer length saves: said in words, the green only around them */
.package-saving {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--success-wash);
  color: var(--success);
  font-size: 13px;
  font-weight: 600;
}

.package-purpose {
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

/* a narrow card or a phone: the lengths one under another */
@media (max-width: 720px) {
  .package-choices {
    grid-template-columns: minmax(0, 1fr);
  }

  .package-price {
    font-size: 24px;
  }
}

/* ---- OrderForm: the button that goes on to pay, and what the pick gives ---- */

.order-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.order-says {
  display: flex;
  flex: 1 1 240px;
  flex-direction: column;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.order-until {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

/* said for one length: shown only while that length is the one picked */
.order-pick {
  display: none;
}

.card-form:has(input[name="months"][value="1"]:checked) .order-pick[data-for="1"],
.card-form:has(input[name="months"][value="6"]:checked) .order-pick[data-for="6"],
.card-form:has(input[name="months"][value="12"]:checked) .order-pick[data-for="12"] {
  display: inline;
}

/* ---- SubjectOffer: a subject's subscription, what it gives and its packages ---- */

.subject-offer {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.subject-offer-top {
  display: flex;
  flex-wrap: wrap;
}

.subject-offer-intro {
  display: flex;
  flex: 1 1 340px;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 28px;
}

.subject-offer-sample {
  flex: 1 1 340px;
  min-width: 0;
  padding: 28px;
  background: var(--wash);
}

.subject-offer-program {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--progress);
  font-size: 13px;
  font-weight: 600;
}

.subject-offer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.subject-offer-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.subject-offer-lead {
  color: var(--muted);
  font-size: 16px;
}

/* the student's time: until when, and what is left of it */
.subject-offer-term {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--wash);
  font-weight: 600;
}

.subject-offer-left {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.benefits {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.benefit {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.benefit-icon {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--success-wash);
  color: var(--success);
}

.benefit-title {
  display: block;
  font-weight: 600;
}

.benefit-text {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.subject-offer-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
}

/* the figure over what it counts, though the markup names it first */
.subject-offer-figure {
  display: flex;
  flex: 1 1 120px;
  flex-direction: column-reverse;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--wash);
}

.subject-offer-figure dt {
  color: var(--muted);
  font-size: 13px;
}

.subject-offer-figure dd {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.subject-offer-buy {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 28px 28px;
  border-top: 1px solid var(--line);
}

.subject-offer-buy-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.subject-offer-buy-title {
  font-size: 18px;
  font-weight: 600;
}

.subject-offer-buy-note {
  color: var(--muted);
  font-size: 14px;
}

/* the packages are named by the heading above them */
.subject-offer-buy .packages legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.assurances {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  list-style: none;
}

.assurance {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assurance .icon {
  flex: none;
}

@media (max-width: 520px) {
  .subject-offer-intro,
  .subject-offer-sample {
    padding: 20px;
  }

  .subject-offer-buy {
    padding: 20px;
  }

  .subject-offer-title {
    font-size: 22px;
  }
}

/* ---- SolutionSample: a question with its written solution, to look at ---- */

.sample {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sample-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sample-part {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.sample-part[data-part="solution"] {
  border-color: var(--accent);
}

.sample-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}

.sample-title {
  color: var(--accent);
  font-weight: 600;
}

.sample-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--info-wash);
  color: var(--info);
  font-size: 13px;
  font-weight: 600;
}

.sample-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  counter-reset: step;
  list-style: none;
}

.sample-steps li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  counter-increment: step;
}

.sample-steps li::before {
  display: grid;
  flex: none;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  content: counter(step);
}

.sample-steps .tex {
  min-width: 0;
}

.sample-aside {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
}

.sample-aside[data-tone="why"] {
  background: var(--danger-wash);
}

.sample-aside[data-tone="why"] strong {
  color: var(--danger);
}

.sample-aside[data-tone="rule"] {
  background: var(--tint);
}

.sample-aside[data-tone="rule"] strong {
  color: var(--progress);
}

.sample-note {
  color: var(--muted);
  font-size: 13px;
}

/* ---- Compare: what is free and what a subscription adds ---- */

.compare {
  width: 100%;
  border-collapse: collapse;
}

.compare th,
.compare td {
  padding: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.compare thead th,
.compare thead td {
  border-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.compare th[scope="row"] {
  padding-left: 0;
  font-weight: 500;
  text-align: left;
}

.compare .compare-paid {
  background: var(--accent-wash);
  color: var(--ink);
  font-weight: 600;
}

.compare-no {
  color: var(--muted);
}

/* ---- SoonList: subjects announced, not open yet ---- */

.soon-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.soon-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px dashed var(--control-line);
  border-radius: 14px;
  font-weight: 600;
}

/* ---- Faq: questions people ask ---- */

.faq {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 28px;
  margin: 0;
}

.faq dt {
  font-weight: 600;
}

.faq dd {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* what may be typed, under a field */
.field-hint {
  color: var(--muted);
  font-size: 13px;
}

.field-error[hidden] {
  display: none;
}

/* ---- CardFields: where the payment provider draws the card's inputs ---- */

.card-fields-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

/* the provider's frame sits inside; the box around it is ours, as .input */
.card-field {
  min-height: 48px;
  padding: 14px 14px 0;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--surface);
}

.card-field.StripeElement--focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-field.StripeElement--invalid {
  border-color: var(--danger);
}

/* ---- Statement: the student's payments ---- */

.statement {
  min-width: 0;
  font-size: 14px;
}

.statement-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.statement-head,
.statement-row {
  display: grid;
  grid-template-columns: minmax(9.5em, 1fr) minmax(0, 2fr) minmax(7.5em, auto) minmax(7.5em, auto);
  gap: 4px 16px;
  align-items: baseline;
}

.statement-head {
  padding-bottom: 8px;
  color: var(--muted);
  font-weight: 500;
}

.statement-head span:nth-child(n + 3),
.statement-amount,
.statement-state {
  text-align: right;
  white-space: nowrap;
}

.statement-row {
  padding-block: 14px;
  border-top: 1px solid var(--line);
}

.statement-when {
  white-space: nowrap;
}

.statement-what {
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* money that went back to the card: struck through, and said in words in
   the last column */
.statement-amount[data-returned] {
  color: var(--muted);
  text-decoration: line-through;
}

/* a phone: each payment on two lines, what and how much over when and how
   it stands */
@media (max-width: 620px) {
  .statement-head {
    display: none;
  }

  .statement-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .statement-what {
    grid-area: 1 / 1;
  }

  .statement-amount {
    grid-area: 1 / 2;
  }

  .statement-when {
    grid-area: 2 / 1;
  }

  .statement-state {
    grid-area: 2 / 2;
  }

  .statement-when,
  .statement-state {
    color: var(--muted);
    font-size: 13px;
  }
}

/* ---- Tex: question text drawn from its LaTeX (assets/tex.js) ---- */

.tex {
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* the question itself */
.tex[data-size="lead"] {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
}

/* until the script has drawn it, the source as written */
.tex[data-tex]:not(.tex-done) {
  white-space: pre-wrap;
}

.tex-shown {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--wash);
}

.tex p,
.tex ul,
.tex ol,
.tex .tex-display,
.tex .tex-table-wrap,
.tex .tex-quote {
  margin: 0 0 10px;
}

.tex > :last-child,
.tex li > :last-child,
.tex div > :last-child {
  margin-bottom: 0;
}

.tex ul,
.tex ol {
  padding-left: 24px;
}

.tex li + li {
  margin-top: 4px;
}

.tex .tex-described,
.tex .tex-labelled {
  list-style: none;
}

.tex .tex-label {
  font-weight: 600;
}

.tex .tex-display,
.tex .tex-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.tex .tex-display {
  padding: 2px 0;
}

.tex .katex-display {
  margin: 0;
}

/* a formula inside a sentence stands on a faint box of its own, as a
   tcolorbox does on paper, so it is told apart from the words around it.
   The wash is see-through: the same box serves a card, a picked option and
   a right or wrong one. A box of its own (not a run of text) so the wash
   reaches behind a fraction; a long formula still breaks inside it. */
.tex .tex-math {
  display: inline-block;
  max-width: 100%;
  margin: 0 2px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--formula-wash);
}

/* an answer option is often nothing but its formula, and already has a box
   of its own: no second one inside it */
.choice .tex .tex-math {
  display: inline;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
}

.tex .tex-center {
  text-align: center;
}

.tex .tex-left {
  text-align: left;
}

.tex .tex-right {
  text-align: right;
}

.tex .tex-quote {
  padding-left: 14px;
  border-left: 3px solid var(--line);
}

.tex .tex-bold {
  font-weight: 600;
}

.tex .tex-italic {
  font-style: italic;
}

.tex .tex-mono {
  font-family: var(--mono);
  font-size: 0.93em;
}

.tex .tex-sc {
  font-variant-caps: small-caps;
}

.tex .tex-underline {
  text-decoration: underline;
}

.tex .tex-nowrap {
  white-space: nowrap;
}

.tex .tex-small {
  font-size: 0.85em;
}

.tex .tex-large {
  font-size: 1.2em;
}

.tex .tex-larger {
  font-size: 1.45em;
}

.tex .tex-table {
  border-collapse: collapse;
}

.tex .tex-center > .tex-table-wrap > .tex-table {
  margin: 0 auto;
}

.tex .tex-table td {
  padding: 4px 12px;
}

.tex .tex-ruled td {
  border: 1px solid var(--control-line);
}

/* what could not be read, as written; the reason is its title */
.tex .tex-error {
  border-radius: 4px;
  background: var(--danger-wash);
  color: var(--danger);
  font-family: var(--mono);
  font-size: 0.9em;
}

.tex .tex-error-note {
  padding: 0 6px;
  font-family: var(--font);
}

.tex .tex-empty {
  color: var(--muted);
}

/* a figure (`figure.js`): the drawing at its own size, never wider than
   the text, with its labels laid over it; the padding is the labels' room
   at the edges */
.tex .tex-figure {
  display: flex;
  justify-content: center;
  margin: 0 0 10px;
  padding: 1.8em 2.2em 1.6em;
  overflow: hidden;
  font-size: 0.95em;
  line-height: 1.2;
}

.tex-figure-box {
  position: relative;
  max-width: 100%;
}

.tex-figure-box > svg {
  display: block;
  height: auto;
  overflow: visible;
}

.tex-figure-label {
  --gap: 4px;
  position: absolute;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.tex-figure-label.fig-at-above { transform: translate(-50%, calc(-100% - var(--gap))); }
.tex-figure-label.fig-at-below { transform: translate(-50%, var(--gap)); }
.tex-figure-label.fig-at-left { transform: translate(calc(-100% - var(--gap)), -50%); }
.tex-figure-label.fig-at-right { transform: translate(var(--gap), -50%); }
.tex-figure-label.fig-at-above-left { transform: translate(calc(-100% - var(--gap)), calc(-100% - var(--gap))); }
.tex-figure-label.fig-at-above-right { transform: translate(var(--gap), calc(-100% - var(--gap))); }
.tex-figure-label.fig-at-below-left { transform: translate(calc(-100% - var(--gap)), var(--gap)); }
.tex-figure-label.fig-at-below-right { transform: translate(var(--gap), var(--gap)); }

/* a label's formula needs no box of its own on a drawing */
.tex .tex-figure .tex-math {
  display: inline;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
}

.fig-s-ink { stroke: var(--ink); }
.fig-s-muted { stroke: var(--muted); }
.fig-s-accent { stroke: var(--accent); }
.fig-s-second { stroke: var(--progress); }
.fig-s-success { stroke: var(--success); }
.fig-s-ground { stroke: var(--surface); }
.fig-f-ink { fill: var(--ink); }
.fig-f-muted { fill: var(--muted); }
.fig-f-accent { fill: var(--accent); }
.fig-f-second { fill: var(--progress); }
.fig-f-success { fill: var(--success); }
.fig-f-ground { fill: var(--surface); }
/* "white" is whatever the figure stands on: a solution's box is washed */
.tex-shown .fig-f-ground { fill: var(--wash); }
.fig-t-ink { color: var(--ink); }
.fig-t-muted { color: var(--muted); }
.fig-t-accent { color: var(--accent); }
.fig-t-second { color: var(--progress); }
.fig-t-success { color: var(--success); }
.fig-t-ground { color: var(--surface); }

.answers {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
  counter-reset: answer;
}

.answer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.answer::before {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  content: counter(answer, upper-alpha);
  counter-increment: answer;
}

.answer-correct {
  border-color: var(--ok-line);
  background: var(--ok-wash);
}

.answer-text {
  flex: 1 1 200px;
  min-width: 0;
}

.history {
  display: grid;
  gap: 12px;
  padding: 0;
  list-style: none;
}

.history li {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.history li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

/* ==== the signed-in pages' frame (templates/app_shell.html) ==== */

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* The line across the top while htmx waits for a page: the shell names it
   its `hx-indicator`, so it has `htmx-request` for as long as a request
   runs. A quick answer shows nothing: the line starts after 150 ms, then
   creeps towards the end without reaching it. Also in the staff portal. */

.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  height: 3px;
  background: var(--progress);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

.page-loading.htmx-request {
  opacity: 1;
  animation: page-loading 10s cubic-bezier(0.1, 0.7, 0.2, 1) 150ms both;
}

@keyframes page-loading {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(0.92);
  }
}

/* no movement asked for: the whole line, still, after the same wait */
@media (prefers-reduced-motion: reduce) {
  .page-loading.htmx-request {
    animation: none;
    transform: none;
    transition: opacity 0s linear 150ms;
  }
}

.app-shell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px;
}

.page {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  max-width: 1180px;
  padding: 20px clamp(8px, 2vw, 24px) 40px;
}

.page:focus {
  outline: none;
}

/* a page's two columns: the lists, and the cards beside them */
.columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.column-main {
  flex: 3 1 480px;
}

.column-side {
  flex: 2 1 320px;
}

/* a column that is one form on a page of its own: not the page's width */
.column-form {
  max-width: 640px;
}

/* a side column of facts beside one long thing, as a question */
.column-narrow {
  flex: 1 1 260px;
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    padding: 0;
  }

  .sidebar {
    display: none;
  }

  .top-bar {
    display: flex;
  }

  .tab-bar {
    display: grid;
  }

  /* room for the floating tab bar under the last card */
  .page {
    gap: 16px;
    padding: 20px 16px 100px;
  }

  .columns,
  .column {
    gap: 16px;
  }

  .column-main,
  .column-side {
    flex-basis: 100%;
  }

  .page-header h1 {
    font-size: 28px;
  }

  .filters {
    padding: 16px;
  }

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

  .page-header-subline {
    font-size: 15px;
  }

  .page-header-progress {
    flex-basis: 100%;
  }

  .page-header-caption {
    text-align: left;
  }

  .choice {
    gap: 12px;
  }

  /* the words under the option, not squeezed beside it */
  .choice[data-mark] {
    flex-wrap: wrap;
  }

  .choice-tag {
    flex-basis: 100%;
    margin-left: 40px;
  }

  .card {
    padding: 16px 18px;
  }

  .card-title {
    font-size: 17px;
  }

  /* three figures side by side, the number above its name; the balance is
     in the top bar */
  .stat-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 18px;
  }

  .stat-tile {
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 2px;
  }

  .stat-tile:not(:last-child) {
    margin-right: 0;
    padding-right: 0;
    border-right: 0;
  }

  .stat-tile dt {
    font-size: 13px;
  }

  .stat-tile dd {
    font-size: 20px;
  }
}

/* ---- ExamBar: the dark bar of the timed exam, with the clock ---- */

.exam-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 14px 24px;
  border-radius: 20px;
  border: 1px solid var(--chrome-edge);
  background: var(--chrome);
  color: var(--on-chrome);
  box-shadow: var(--shadow-panel);
}

.exam-bar-text {
  flex: 1 1 240px;
  min-width: 0;
}

.exam-bar-eyebrow {
  color: var(--on-chrome-muted);
  font-size: 13px;
  font-weight: 500;
}

.exam-bar h1 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

/* the last save; while an answer is on its way; when it did not get through */
.exam-run {
  display: contents;
}

.exam-saved {
  color: var(--on-chrome-muted);
  font-size: 14px;
}

.exam-saved > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-saved-done .icon {
  color: var(--on-chrome-success);
  stroke-width: 2.4;
}

.exam-saved > .exam-saved-busy,
.exam-saved > .exam-saved-failed,
.exam-saved.htmx-request > .exam-saved-done,
.exam-saved[data-state="failed"] > .exam-saved-done,
.exam-saved[data-state="failed"] > .exam-saved-busy {
  display: none;
}

.exam-saved.htmx-request:not([data-state="failed"]) > .exam-saved-busy,
.exam-saved[data-state="failed"] > .exam-saved-failed {
  display: flex;
}

.exam-saved-failed {
  color: var(--on-chrome-warning);
  font-weight: 600;
}

.exam-clock {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 16px;
  border: 1px solid var(--chrome-raised);
  border-radius: 12px;
  background: var(--chrome-raised);
}

.exam-clock .mono {
  font-size: 26px;
  font-weight: 500;
}

.exam-clock-word {
  color: var(--on-chrome-muted);
  font-size: 13px;
}

/* the last five minutes: a border, not colour alone */
.exam-clock[data-ending] {
  border-color: var(--on-chrome-warning);
}

/* on the graphite the main action is the white one */
.exam-bar .btn {
  border-color: var(--on-chrome);
  background: var(--on-chrome);
  color: var(--chrome);
  box-shadow: none;
}

.exam-bar .btn:hover {
  border-color: var(--on-chrome-muted);
  background: var(--on-chrome-muted);
}

/* ---- PaperMap: an exam paper's questions, answered or not, marked or not ---- */

.paper-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
  max-height: 320px;
  margin: 0;
  /* room for the current cell's outline inside the scrolling box */
  padding: 4px;
  overflow-y: auto;
  list-style: none;
}

.paper-cell {
  position: relative;
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: var(--grid-cell);
  color: var(--grid-ink);
  font-family: var(--mono);
  font-size: 14px;
  text-decoration: none;
}

.paper-cell:hover {
  border-color: var(--grid-ink);
}

.paper-cell[data-state="answered"] {
  background: var(--grid-answered);
  color: var(--on-grid-fill);
}

/* marked "look at this again": an edge as well as the dot */
.paper-cell:has(> .paper-flag) {
  border-color: var(--grid-flag);
}

.paper-cell[aria-current] {
  outline: 2px solid var(--grid-current);
  outline-offset: 2px;
  font-weight: 600;
}

.paper-flag {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--grid-flag);
}

.paper-cell > .paper-flag {
  position: absolute;
  top: 4px;
  right: 4px;
}

/* on a filled cell the dot keeps a dark ring, so it does not rest on colour */
.paper-cell[data-state="answered"] > .paper-flag {
  box-shadow: 0 0 0 2px var(--on-grid-fill);
}

.paper-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0 4px;
  color: var(--grid-ink);
  font-size: 13px;
  list-style: none;
}

.paper-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.paper-key {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--grid-cell);
  box-shadow: inset 0 0 0 1px var(--grid-ink);
}

.paper-key[data-state="answered"] {
  background: var(--grid-answered);
  box-shadow: none;
}

/* ---- FlagButton: "look at this again", pressed while the mark is on ---- */

.flag-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--control-line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.flag-btn:hover {
  background: var(--wash);
}

.flag-btn[aria-pressed="true"] {
  border-color: var(--warning);
  background: var(--warning-wash);
}

.flag-btn[aria-pressed="true"] .icon {
  fill: var(--warning);
  stroke: var(--warning);
}

/* ---- Dialog: a question asked over the page ---- */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--backdrop);
}

.dialog {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  padding: 28px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 16px 48px rgb(0 0 0 / 0.18);
}

.dialog h2 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.dialog p {
  color: var(--muted);
}

.dialog p .mono {
  color: var(--ink);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.dialog-actions > * {
  flex: 1 1 140px;
}

.dialog-actions .btn {
  display: flex;
  width: 100%;
}

/* ==== the exams' pages (templates/exams.html, exam.html) ==== */

/* an amount at the end of a row */
.row-amount {
  font-size: 14px;
  white-space: nowrap;
}

/* a paragraph as it was written, line breaks kept */
.card-text {
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* ==== the timed exam's frame (templates/exam_paper.html) ==== */

.exam-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 12px 12px 0;
}

.exam-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px clamp(0px, 2vw, 20px) 40px;
}

.exam-page:focus {
  outline: none;
}

.exam-number {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

/* before and after, at the two ends */
.exam-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.exam-map {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exam-done {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  max-width: 640px;
  margin: 36px auto 0;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.exam-done h2 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.exam-done p {
  color: var(--muted);
  font-size: 16px;
}

.exam-done p .mono {
  color: var(--ink);
}

.exam-done-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 999px;
  background: var(--success-wash);
  color: var(--success);
}

.exam-done-icon .icon {
  stroke-width: 2.4;
}

@media (max-width: 860px) {
  .exam-shell {
    padding: 8px 8px 0;
  }

  /* the clock stays in sight while the questions scroll under it */
  .exam-bar {
    position: sticky;
    top: 8px;
    z-index: 10;
    gap: 8px 12px;
    padding: 12px 16px;
    border-radius: 16px;
  }

  .exam-bar-text {
    flex-basis: 100%;
  }

  .exam-saved {
    flex-basis: 100%;
    order: 3;
    font-size: 13px;
  }

  .exam-clock {
    flex: 1;
    justify-content: center;
  }

  .exam-clock .mono {
    font-size: 22px;
  }

  .exam-page {
    gap: 16px;
    padding: 16px 0 32px;
  }

  .exam-steps .btn {
    flex: 1 1 140px;
    padding: 0 12px;
  }

  .exam-done {
    margin-top: 8px;
    padding: 24px 20px;
  }

  .dialog {
    padding: 24px 20px;
  }
}

/* ==== the top-up's own frame (templates/topup.html) ==== */

.checkout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.checkout-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.checkout-bar .link {
  font-size: 14px;
  font-weight: 500;
}

.checkout-main {
  display: flex;
  flex: 1;
  justify-content: center;
  padding: 40px 16px 64px;
}

.checkout-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 440px;
  height: max-content;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.checkout-heading {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.checkout-note {
  color: var(--muted);
  font-size: 13px;
}

/* the payment is with the provider: a turning ring beside the words */
.checkout-wait {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--wash);
}

.checkout-spinner {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid var(--control-line);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: checkout-turn 0.9s linear infinite;
}

@keyframes checkout-turn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .checkout-spinner {
    animation: none;
  }
}

@media (max-width: 520px) {
  .checkout-bar {
    padding: 12px 16px;
  }

  .checkout-main {
    padding: 16px 16px 40px;
  }

  .checkout-col {
    padding: 20px 16px;
  }
}

/* ==== the frame of the pages outside the app (templates/open_frame.html):
   the free quiz and the step after the first program is chosen ==== */

.open {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.open-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.open-ways {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-size: 14px;
}

/* a text link in the bar is as tall as a finger needs */
.open-ways .link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.open-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

.open-legal {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  padding: 0 24px 24px;
  color: var(--muted);
  font-size: 13px;
}

/* the way on stays in view beside a long page of solutions */
@media (min-width: 861px) {
  .open-aside {
    position: sticky;
    top: 24px;
  }
}

/* a question's written solution, under its marked answer */
.solved {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: var(--wash);
}

@media (max-width: 520px) {
  .open-bar {
    padding: 8px 16px;
  }

  .open-main {
    padding: 20px 16px 40px;
  }
}

/* ==== the component gallery (/_ui) ==== */

.gallery {
  display: grid;
  gap: 32px;
  max-width: 960px;
  margin-inline: auto;
  padding: 32px 16px 64px;
}

.gallery-title {
  font-size: 28px;
  font-weight: 600;
}

.gallery-section {
  display: grid;
  gap: 16px;
}

.gallery-section h2 {
  font-size: 18px;
  font-weight: 600;
}

.gallery-case {
  display: grid;
  gap: 6px;
}

.gallery-case figcaption {
  color: var(--muted);
  font-size: 13px;
}

.gallery-cell {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.gallery-cell[data-ground="dark"] {
  max-width: 272px;
  border-color: var(--chrome);
  background: var(--chrome);
}

/* ---- Settings: the reader's own settings, the sections listed on the
   left and the chosen one beside them; a dialog over any page, or a panel
   on its own page ---- */

/* where the closed dialog waits in the app shell: no box of its own */
.settings-slot {
  display: contents;
}

/* the layout is on `.settings` inside: a closed dialog must stay unshown */
.settings-dialog {
  width: min(780px, calc(100vw - 32px));
  max-width: none;
  height: min(560px, calc(100dvh - 32px));
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-panel);
}

.settings-dialog::backdrop {
  background: var(--backdrop);
}

.settings {
  position: relative;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-width: 0;
}

.settings[data-frame="dialog"] {
  height: 100%;
}

.settings[data-frame="page"] {
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.settings-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 20px 12px;
  border-right: 1px solid var(--line);
  background: var(--wash);
}

.settings-title {
  padding: 0 12px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: auto;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.settings-legal .link {
  font-weight: 500;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.settings-tab:hover {
  color: var(--ink);
}

/* the chosen one: a raised surface and its border, not colour alone */
.settings-tab[aria-current] {
  border-color: var(--control-line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-card);
}

.settings-body {
  min-width: 0;
  padding: 24px 28px 28px;
  overflow-y: auto;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section[hidden] {
  display: none;
}

.settings-heading {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
}

/* room for the button that closes the dialog */
.settings[data-frame="dialog"] .settings-heading {
  padding-right: 44px;
}

.settings-person {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.settings-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.settings-role {
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-group > .detail-rows {
  align-self: stretch;
}

.settings-note {
  color: var(--muted);
  font-size: 14px;
}

.settings-action {
  display: flex;
}

.settings-close {
  position: absolute;
  top: 12px;
  right: 12px;
  margin: 0;
}

/* a phone: the dialog fills the screen, the sections are a row on top */
@media (max-width: 620px) {
  .settings-dialog {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .settings {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings[data-frame="page"] {
    min-height: 0;
  }

  .settings-side {
    padding: 16px 12px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings[data-frame="dialog"] .settings-title {
    padding-right: 48px;
  }

  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .settings-tab {
    flex: none;
  }

  .settings-body {
    padding: 20px 16px 24px;
  }

  .settings[data-frame="dialog"] .settings-heading {
    padding-right: 0;
  }
}

/* ---- ThemePicker: light, dark or as the device is set ---- */

.theme-picker {
  margin: 0;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--wash);
}

/* the icon above the label, so "Avtomatik" stays on one line in a narrow
   column */
.theme-option {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 56px;
  padding: 6px 4px;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.theme-option:hover {
  color: var(--ink);
}

/* the chosen one: a raised surface and its border, not colour alone */
.theme-option[aria-pressed="true"] {
  border-color: var(--control-line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-card);
}

/* in the staff portal's sidebar, on the navy */
.theme-picker[data-ground="chrome"] .theme-options {
  padding: 0;
  border: 0;
  background: transparent;
}

.theme-legend {
  padding: 0 12px 4px;
  color: var(--on-chrome-muted);
  font-size: 12px;
}

.theme-picker[data-ground="chrome"] .theme-option {
  min-height: 44px;
  padding: 4px 2px;
  gap: 2px;
  color: var(--on-chrome-muted);
  font-size: 12px;
}

.theme-picker[data-ground="chrome"] .theme-option:hover {
  background: var(--chrome-raised);
  color: var(--on-chrome);
}

.theme-picker[data-ground="chrome"] .theme-option[aria-pressed="true"] {
  border-color: var(--chrome-raised);
  background: var(--chrome-raised);
  color: var(--on-chrome);
  box-shadow: none;
}

.theme-picker[data-ground="chrome"] :focus-visible {
  outline-color: var(--on-chrome);
}

/* ---- ProgramCards: the programs as cards on Home (version A of
   design/canvas-programs/) ---- */

.program-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.program-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 0;
  list-style: none;
}

.program-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.program-card[data-state="soon"] {
  background: var(--wash);
  box-shadow: none;
}

.program-card form {
  margin-top: auto;
}

.program-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.program-card-name {
  flex: 1;
  min-width: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.program-card-about {
  color: var(--muted);
  font-size: 14px;
}

/* a program's mark: its short name on a tint of its own */
.program-tile {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--tint);
  color: var(--progress);
  font-size: 14px;
  font-weight: 700;
}

.program-tile-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 12px;
}

.program-tile[data-tone="accent"] {
  background: var(--accent-wash);
  color: var(--accent);
}

.program-tile[data-tone="warning"] {
  background: var(--warning-wash);
  color: var(--warning);
}

/* every program: the switcher outside a program, on the chrome */
.program-tile[data-tone="all"] {
  background: var(--on-chrome);
  color: var(--chrome);
}

.program-subjects {
  display: grid;
  padding: 0;
  list-style: none;
}

.program-subject {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  font-weight: 500;
}

.program-card-note {
  color: var(--muted);
  font-size: 14px;
}

.program-card-topics {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.program-card-topics .mono {
  color: var(--ink);
}

.program-card-stats {
  display: flex;
  padding: 12px 0;
  border-block: 1px solid var(--line);
}

.program-card-stats div {
  flex: 1;
  min-width: 0;
}

.program-card-stats div:not(:first-child) {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.program-card-stats dt {
  color: var(--muted);
  font-size: 13px;
}

.program-card-stats dd {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
}

.program-card-ahead {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--wash);
  color: var(--muted);
  font-size: 14px;
}

/* ---- ProgramSwitcher: where the page is (a program, or every program),
   at the top of the navigation, and the list that changes it (versions B
   and D of design/canvas-programs/) ---- */

.program-switch {
  margin-bottom: 12px;
}

.program-switch-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--on-chrome-muted);
  border-radius: 14px;
  background: var(--chrome-raised);
  color: var(--on-chrome);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.program-switch-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.program-switch-label {
  color: var(--on-chrome-muted);
  font-size: 12px;
}

.program-switch-name,
.program-option-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* the list floats over the page beside the sidebar: the sidebar keeps its
   place in the window, so the list's place is fixed under the button */
.program-menu {
  position: fixed;
  inset: 148px auto auto 26px;
  width: 340px;
  max-width: calc(100vw - 52px);
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-panel);
}

.program-menu :focus-visible {
  outline-color: var(--accent);
}

.program-menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.program-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
}

button.program-option {
  cursor: pointer;
}

button.program-option:hover {
  background: var(--wash);
}

.program-option[aria-current="true"] {
  background: var(--accent-wash);
}

.program-option[data-state="soon"] {
  color: var(--muted);
}

.program-option-name {
  flex: 1;
  min-width: 0;
}

.program-option-mark {
  display: flex;
  color: var(--accent);
}

.program-menu-all {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin-top: 4px;
  padding: 0 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

a.program-menu-all:hover {
  color: var(--accent);
}

/* outside every program "Bütün proqramlar" is where the page is */
.program-menu-all[aria-current="true"] {
  border-radius: 0 0 12px 12px;
}

.program-menu-all-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
}

/* the copy in the phone's top bar: beside the brand's mark, on the light
   bar, its list under the bar (the bar is at the top of the document, so
   the list scrolls with it) */
.program-switch[data-compact] {
  min-width: 0;
  margin-bottom: 0;
}

.program-switch[data-compact] .program-switch-button {
  gap: 8px;
  width: auto;
  max-width: 100%;
  min-height: 44px;
  padding: 4px 10px 4px 4px;
  border-color: var(--control-line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}

.program-switch[data-compact] .program-tile-sm {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 11px;
}

.program-switch[data-compact] .program-tile[data-tone="all"] {
  background: var(--chrome);
  color: var(--on-chrome);
}

.program-switch[data-compact] .program-switch-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.program-switch[data-compact] .program-switch-name {
  font-size: 14px;
}

.program-switch[data-compact] .program-menu {
  position: absolute;
  inset: 66px auto auto 16px;
  width: 320px;
  max-width: calc(100vw - 32px);
}

/* on a narrow phone the switcher takes the mark's place: its name is where
   the student is, and must not be cut */
@media (max-width: 440px) {
  .top-bar .brand:has(.program-switch) .brand-mark {
    display: none;
  }
}

/* ---- Sidebar's note: outside every program, where the other places are ---- */

.sidebar-note {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--on-chrome-muted);
  border-radius: 12px;
  color: var(--on-chrome-muted);
  font-size: 13px;
}

/* ---- Analytics: how well a topic is known, in a colour and a word ---- */

.level-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.level-swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.level-mark[data-level="weak"] .level-swatch,
.topic-strip > [data-level="weak"] {
  background: var(--level-weak);
}

.level-mark[data-level="middling"] .level-swatch,
.topic-strip > [data-level="middling"] {
  background: var(--level-middling);
}

.level-mark[data-level="good"] .level-swatch,
.topic-strip > [data-level="good"] {
  background: var(--level-good);
}

.level-mark[data-level="strong"] .level-swatch,
.topic-strip > [data-level="strong"] {
  background: var(--level-strong);
}

/* not started: an outline, so it reads as empty in either theme */
.level-mark[data-level="none"] .level-swatch,
.topic-strip > [data-level="none"] {
  border: 1.5px dashed var(--control-line);
}

.level-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 0;
  color: var(--muted);
  list-style: none;
}

.level-key .level-mark {
  font-size: 13px;
  font-weight: 400;
}

/* ---- TopicStrip: one cell for each topic ---- */

.topic-strip {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 14px;
}

.topic-strip > * {
  flex: 1;
  min-width: 0;
  border-radius: 3px;
}

/* ---- Segments: the same page seen another way ---- */

.segments {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--wash);
}

.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.segment[data-icon] {
  padding: 0;
}

.segment:hover {
  color: var(--ink);
}

.segment[aria-current] {
  background: var(--chrome);
  box-shadow: inset 0 0 0 1px var(--chrome-edge);
  color: var(--on-chrome);
}

/* ---- Forecast: a range of a paper in large figures, over its bar ---- */

.forecast {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.forecast-lead,
.forecast-tail {
  color: var(--muted);
  font-size: 14px;
}

.forecast-figure {
  font-size: 52px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.forecast-bar {
  display: block;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
}

.forecast-track,
.bar-track {
  fill: var(--wash);
}

.forecast-span,
.bar-fill {
  fill: var(--accent);
}

.forecast-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.forecast-note {
  color: var(--muted);
  font-size: 13px;
}

.card-note strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---- TrendChart: the forecast over time ---- */

.trend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.trend-chart {
  display: block;
  width: 100%;
  height: auto;
}

.trend-grid {
  fill: none;
  stroke: var(--line);
}

.trend-tick,
.trend-when {
  fill: var(--muted);
  font-size: 12px;
}

.trend-tick {
  font-family: var(--mono);
  font-size: 11px;
}

.trend-band {
  fill: var(--band);
}

.trend-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-end {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.trend-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--muted);
  font-size: 13px;
}

.trend-key > * {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trend-key-line::before {
  width: 18px;
  height: 2px;
  background: var(--accent);
  content: "";
}

.trend-key-band::before {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: var(--band);
  content: "";
}

/* ---- Bars: shares on one scale, each with its figure ---- */

.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 34%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.bar {
  display: block;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 4px;
}

.bar-value {
  min-width: 78px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.bar-value strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---- Calendar: weeks as columns, a day shaded by what was done ---- */

.calendar-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3px;
  max-width: 380px;
}

.calendar-week {
  display: grid;
  gap: 3px;
}

.calendar-week > * {
  aspect-ratio: 1;
  border-radius: 4px;
}

.calendar-key {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-key > * {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.calendar [data-shade="0"],
.calendar-key [data-shade="0"] {
  border: 1px solid var(--line);
  background: var(--wash);
}

.calendar [data-shade="1"],
.calendar-key [data-shade="1"] {
  background: var(--heat-1);
}

.calendar [data-shade="2"],
.calendar-key [data-shade="2"] {
  background: var(--heat-2);
}

.calendar [data-shade="3"],
.calendar-key [data-shade="3"] {
  background: var(--heat-3);
}

.calendar [data-shade="4"],
.calendar-key [data-shade="4"] {
  background: var(--heat-4);
}

/* a day still to come */
.calendar [data-shade="ahead"] {
  border: 1px dashed var(--line);
}

/* ---- AnswerRun: right answers above, wrong ones below ---- */

.answer-run {
  display: flex;
  gap: 10px;
}

.answer-run-names {
  display: flex;
  flex: none;
  flex-direction: column;
  justify-content: space-between;
  height: 52px;
  color: var(--muted);
  font-size: 13px;
  line-height: 24px;
}

.answer-run-cells {
  display: flex;
  flex: 1;
  gap: 2px;
  min-width: 0;
  height: 52px;
  border-radius: 4px;
  background: linear-gradient(var(--wash) 0 24px, transparent 24px 28px, var(--wash) 28px);
}

.answer-run-cells > * {
  position: relative;
  flex: 1;
  min-width: 0;
  /* a few answers stay cells, not bands across the card */
  max-width: 28px;
}

.answer-run-cells > *::before {
  position: absolute;
  right: 0;
  left: 0;
  height: 24px;
  border-radius: 3px;
  content: "";
}

.answer-run-cells > [data-answer="right"]::before {
  top: 0;
  background: var(--success);
}

.answer-run-cells > [data-answer="wrong"]::before {
  bottom: 0;
  background: var(--danger);
}

/* where the topic was started over */
.answer-run-cells > [data-restarted] {
  margin-left: 8px;
}

.answer-run-cells > [data-restarted]::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -6px;
  width: 2px;
  background: var(--ink);
  content: "";
}

/* ---- The analytics pages ---- */

.insight-ready {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.insight-ready > .forecast {
  flex: 1 1 230px;
}

.insight-ready > .trend,
.insight-ready > .card-note {
  flex: 2 1 320px;
  align-self: flex-start;
}

.insight-link {
  color: var(--ink);
  text-decoration: none;
}

.insight-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.row-text > .level-mark {
  margin-top: 6px;
}

.insight-trio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 24px;
}

.insight-warning {
  background: var(--warning-wash);
  color: var(--ink);
}

.insight-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.insight-figures dt {
  color: var(--muted);
  font-size: 13px;
}

.insight-figures dd {
  font-size: 20px;
  font-weight: 500;
}

/* a topic's level under its page's heading */
.insight-level {
  margin-top: -12px;
}

/* the map by section: a strip that opens into the section's topics */
.map-section {
  border-top: 1px solid var(--line);
}

.map-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  min-height: 44px;
  padding: 14px 0;
  cursor: pointer;
  list-style: none;
}

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

.map-summary::before {
  flex: none;
  width: 16px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 18px;
  content: "+";
}

.map-section[open] > .map-summary::before {
  content: "−";
}

.map-name {
  display: flex;
  flex: 0 1 250px;
  flex-direction: column;
  min-width: 0;
}

.map-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.map-strip {
  display: flex;
  flex: 1 1 260px;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.map-scroll {
  /* holds what is placed inside it (the heading read out, not drawn), so
     the table scrolls here and never widens the page */
  position: relative;
  margin-bottom: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.map-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
}

.map-table th,
.map-table td {
  padding: 8px 14px;
  text-align: left;
}

.map-table thead th {
  background: var(--wash);
  color: var(--muted);
  font-weight: 500;
}

.map-table tbody tr {
  border-top: 1px solid var(--line);
}

.map-table tbody th {
  font-weight: 600;
}

.map-table .map-number,
.map-table .map-action {
  text-align: right;
  white-space: nowrap;
}

/* the map by level: a column for each */
.map-levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  align-items: start;
  gap: 12px;
}

.map-level {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--wash);
}

.map-level-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 15px;
}

.map-level-head .level-mark {
  font-size: 15px;
  font-weight: 600;
}

.map-level-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.map-level-topic {
  display: block;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.map-level-topic:hover {
  border-color: var(--accent);
}

.map-level-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Locked: what a subscription opens, in the place it would be. The rows
   behind the panel are decoration: nothing of what is locked is drawn. */
.locked {
  display: grid;
  align-items: center;
}

.locked > * {
  grid-area: 1 / 1;
}

.locked-ghost {
  display: grid;
  gap: 0;
  min-height: 260px;
  opacity: 0.7;
  pointer-events: none;
}

.locked-ghost span {
  display: block;
  border-top: 1px solid var(--line);
  background: linear-gradient(var(--wash), var(--wash)) 0 50% / 100% 14px no-repeat;
}

.locked-ghost span:nth-child(2n) {
  background-size: 72% 14px;
}

.locked-ghost span:nth-child(3n) {
  background-size: 88% 14px;
}

.locked-panel {
  /* over the rows, which their opacity would otherwise paint on top */
  position: relative;
  justify-self: center;
  box-sizing: border-box;
  width: min(100%, 760px);
  margin: 24px 0;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.locked-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-wash);
  color: var(--accent);
}

.locked-text {
  flex: 1 1 280px;
  min-width: 0;
}

.locked-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.locked-line {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.locked-action {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.locked-price {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* HelpForm: a message to the support desk */
.help-form {
  gap: 20px;
  max-width: 680px;
}

.help-topics {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.help-topics legend {
  padding: 0;
  font-weight: 600;
}

.help-topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.help-topic {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
}

.help-topic input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.help-topic:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: 600;
}

.help-topic:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.help-text {
  min-height: 160px;
  padding-block: 10px;
  resize: vertical;
}

.help-foot {
  display: flex;
  justify-content: flex-end;
}

/* the ways out of a payment's page, side by side in its bar */
.checkout-ways {
  display: flex;
  gap: 20px;
}
