/* =====================================================================
   MarkMate Psychology — styles
   Layout idea: an examiner's desk. A quiet navigation rail on the left
   (a tab bar on phones) and white paper sheets on a cool desk.
   Blue biro = the student's actions. Red pen = the examiner's marks.
   ===================================================================== */

/* ---------- 1. Design tokens (light theme) ---------- */
:root {
  --desk: #E8ECF1;          /* page background */
  --paper: #FFFFFF;         /* sheets and cards */
  --paper-2: #F4F6FA;       /* quiet fills */
  --paper-3: #E9EDF4;       /* tracks, meters */
  --ink: #16213A;           /* main text */
  --ink-2: #47536B;         /* secondary text */
  --ink-3: #6F7A91;         /* captions */
  --rule: #D6DCE6;          /* borders, ruled lines */
  --rule-2: #B9C2D2;        /* stronger borders */
  --biro: #2346C0;          /* primary actions */
  --biro-hover: #1A3699;
  --biro-weak: #E6ECFF;
  --on-biro: #FFFFFF;
  --pen: #CC2A3E;           /* examiner red */
  --pen-weak: #FCE9EB;
  --on-pen: #FFFFFF;
  --good: #19774F;
  --good-weak: #E1F3E9;
  --warn: #93570A;
  --warn-weak: #FBEFDA;
  --card-line: #C7D5F1;     /* index-card blue rule */
  --card-head: #E2828E;     /* index-card red rule */
  --shadow: 0 1px 2px rgba(22, 33, 58, 0.06), 0 6px 18px rgba(22, 33, 58, 0.06);
  --shadow-lift: 0 2px 4px rgba(22, 33, 58, 0.08), 0 14px 34px rgba(22, 33, 58, 0.12);

  /* one colour per part of the course */
  --c-biological: #0C7781;
  --c-cognitive: #5843C4;
  --c-learning: #9C5C17;
  --c-social: #AD376C;
  --c-rm: #3B5576;
  --c-id: #417B37;
  --c-alevel: #6E5A24;

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --r-1: 6px;
  --r-2: 10px;
  --r-3: 16px;
  --rail-w: 244px;
  --tabbar-h: 62px;
}

/* ---------- 2. Dark theme (system setting or explicit toggle) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #0F141C;
    --paper: #182029;
    --paper-2: #1D2632;
    --paper-3: #26303E;
    --ink: #E6EAF1;
    --ink-2: #AFB8C8;
    --ink-3: #8691A6;
    --rule: #2A3443;
    --rule-2: #3B475A;
    --biro: #8EA7FF;
    --biro-hover: #ABBEFF;
    --biro-weak: #1E2A4C;
    --on-biro: #0D1530;
    --pen: #FF7483;
    --pen-weak: #3A1D25;
    --on-pen: #2B0A12;
    --good: #58C795;
    --good-weak: #15352A;
    --warn: #F0B45E;
    --warn-weak: #3A2C15;
    --card-line: #2C3A55;
    --card-head: #8C4652;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 16px 36px rgba(0, 0, 0, 0.4);
    --c-biological: #47C1CB;
    --c-cognitive: #A596FF;
    --c-learning: #E2A65F;
    --c-social: #EE84B6;
    --c-rm: #9DB2D2;
    --c-id: #8DCB80;
    --c-alevel: #D6BE7C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #0F141C;
  --paper: #182029;
  --paper-2: #1D2632;
  --paper-3: #26303E;
  --ink: #E6EAF1;
  --ink-2: #AFB8C8;
  --ink-3: #8691A6;
  --rule: #2A3443;
  --rule-2: #3B475A;
  --biro: #8EA7FF;
  --biro-hover: #ABBEFF;
  --biro-weak: #1E2A4C;
  --on-biro: #0D1530;
  --pen: #FF7483;
  --pen-weak: #3A1D25;
  --on-pen: #2B0A12;
  --good: #58C795;
  --good-weak: #15352A;
  --warn: #F0B45E;
  --warn-weak: #3A2C15;
  --card-line: #2C3A55;
  --card-head: #8C4652;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 16px 36px rgba(0, 0, 0, 0.4);
  --c-biological: #47C1CB;
  --c-cognitive: #A596FF;
  --c-learning: #E2A65F;
  --c-social: #EE84B6;
  --c-rm: #9DB2D2;
  --c-id: #8DCB80;
  --c-alevel: #D6BE7C;
  color-scheme: dark;
}

/* ---------- 3. Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* paints the strip behind the phone status bar */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 40;
  background: var(--desk);
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
img, svg { max-width: 100%; }
a { color: var(--biro); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--biro);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 4. App frame ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-block: 24px 18px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: 14px;
  border-right: 1px solid var(--rule);
}

.brand {
  display: grid;
  gap: 2px;
  padding-inline: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand-name {
  font-family: var(--font-read);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-name .tick { color: var(--pen); font-family: var(--font-hand); font-size: 26px; margin-left: 2px; }
.brand-sub { font-size: 12.5px; color: var(--ink-3); }

.nav { display: grid; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}
.nav a svg { width: 19px; height: 19px; flex: none; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a[aria-current="page"] {
  background: var(--paper);
  color: var(--biro);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.nav .badge {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--biro-weak);
  color: var(--biro);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rail-foot { margin-top: auto; display: grid; gap: 8px; padding-inline: 10px; }
.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.35;
}
.ai-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}
.ai-status.on .dot { background: var(--good); }
.rail-foot a { font-size: 13px; color: var(--ink-2); text-decoration: none; }
.rail-foot a:hover { color: var(--biro); }

.main {
  min-width: 0;
  padding-block: 34px 80px;
  padding-left: max(28px, env(safe-area-inset-left, 0px));
  padding-right: max(28px, env(safe-area-inset-right, 0px));
}
.view { max-width: 1060px; margin: 0 auto; }

/* phone top bar and tab bar */
.topbar {
  display: none;
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--desk);
  border-bottom: 1px solid var(--rule);
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topbar .brand { padding: 0; }
.topbar .brand-name { font-size: 19px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none;
}
.icon-btn svg { width: 19px; height: 19px; }

.tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--paper);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(6px, env(safe-area-inset-left, 0px));
  padding-right: max(6px, env(safe-area-inset-right, 0px));
}
.tabbar a {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 9px 2px 8px;
  color: var(--ink-3);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a[aria-current="page"] { color: var(--biro); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { display: flex; }
  .tabbar { display: grid; }
  .main {
    padding-block: 22px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
}

/* ---------- 5. Shared pieces ---------- */
.view-head { display: grid; gap: 8px; margin-bottom: 26px; }
.view-head h1 {
  font-family: var(--font-read);
  font-weight: 650;
  font-size: clamp(27px, 3.4vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.012em;
}
.kicker { font-size: 13.5px; font-weight: 500; color: var(--ink-3); }
.lede { color: var(--ink-2); max-width: 64ch; font-size: 15.5px; }

.crumbs { font-size: 13.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--biro); text-decoration: underline; }

.block { margin-top: 36px; }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.block-head h2, .h2 {
  font-family: var(--font-read);
  font-size: 22px;
  font-weight: 650;
  line-height: 1.2;
}
.block-head a { font-size: 14px; font-weight: 600; text-decoration: none; }
.h-sm { font-size: 15px; font-weight: 650; font-family: var(--font-ui); }

.sheet {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--biro);
  color: var(--on-biro);
  font: 600 14px/1.2 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--biro-hover); }
.btn svg { width: 16px; height: 16px; }
.btn-quiet { background: var(--paper); color: var(--ink); border-color: var(--rule-2); }
.btn-quiet:hover { background: var(--paper-2); border-color: var(--ink-3); }
.btn-pen { background: var(--pen); color: var(--on-pen); }
.btn-pen:hover { background: var(--pen); filter: brightness(0.92); }
.btn-text {
  background: none;
  border: 0;
  padding: 6px 4px;
  color: var(--biro);
  font-weight: 600;
}
.btn-text:hover { background: none; text-decoration: underline; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--chip, var(--ink-2));
  background: color-mix(in srgb, var(--chip, var(--ink-3)) 13%, transparent);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.k-biological { --chip: var(--c-biological); }
.k-cognitive { --chip: var(--c-cognitive); }
.k-learning { --chip: var(--c-learning); }
.k-social { --chip: var(--c-social); }
.k-rm { --chip: var(--c-rm); }
.k-id { --chip: var(--c-id); }
.k-alevel, .k-ai { --chip: var(--c-alevel); }

/* selectable filter buttons */
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--rule-2);
  background: var(--paper);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}
.pick .n { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pick[aria-pressed="true"] {
  border-color: var(--chip, var(--biro));
  color: var(--ink);
  background: color-mix(in srgb, var(--chip, var(--biro)) 10%, var(--paper));
  box-shadow: inset 0 0 0 1px var(--chip, var(--biro));
}
.pick::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--chip, var(--ink-3));
}

.field { display: grid; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--rule-2);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
}
.input:focus { outline: 2px solid var(--biro); outline-offset: 0; border-color: var(--biro); }
.hint { font-size: 13px; color: var(--ink-3); }

.meter {
  height: 5px;
  border-radius: 5px;
  background: var(--paper-3);
  overflow: hidden;
}
.meter > i {
  display: block;
  height: 100%;
  width: var(--v, 0%);
  background: var(--chip, var(--biro));
  border-radius: 5px;
}

.empty {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 26px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r-2);
  color: var(--ink-2);
}
.empty h2, .empty h3 { font-family: var(--font-read); font-size: 19px; color: var(--ink); }

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-1);
  background: var(--warn-weak);
  color: var(--ink);
  font-size: 14px;
}
.notice svg { width: 18px; height: 18px; flex: none; color: var(--warn); margin-top: 1px; }

/* the examiner's red pen */
.pen { font-family: var(--font-hand); color: var(--pen); }
.mark {
  position: relative;
  display: inline-grid;
  place-items: center;
  padding: 4px 14px;
  font: 700 30px/1 var(--font-hand);
  color: var(--pen);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mark svg {
  position: absolute;
  inset: -8px -10px;
  width: calc(100% + 20px);
  height: calc(100% + 16px);
  max-width: none;
  overflow: visible;
  pointer-events: none;
}
.mark svg path { stroke: currentColor; }
.mark.big { font-size: 46px; padding: 6px 20px; }
.mark.draw svg path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: pen-circle 0.9s 0.15s ease-out forwards; }
@keyframes pen-circle { to { stroke-dashoffset: 0; } }

.tick-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.tick-list li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; }
.tick-list svg { width: 18px; height: 18px; color: var(--pen); margin-top: 2px; }
.tick-list.good svg { color: var(--good); }

.examiner-note {
  font-family: var(--font-hand);
  color: var(--pen);
  font-size: 22px;
  line-height: 1.3;
  max-width: 62ch;
  transform: rotate(-0.5deg);
  transform-origin: left center;
}
.examiner-note b { font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  z-index: 60;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 860px) {
  .toast { bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px)); }
}

/* in-page confirm (the viewer can't show confirm() dialogs) */
.confirm {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-2);
  border: 1px solid var(--pen);
  background: var(--pen-weak);
}
.confirm p { font-weight: 500; }

details.fold { border-top: 1px solid var(--rule); padding-top: 10px; }
details.fold summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::before { content: "+"; width: 14px; color: var(--ink-3); font-weight: 700; }
details.fold[open] summary::before { content: "–"; }
details.fold > div { padding-top: 10px; }

/* ---------- 6. Today ---------- */
.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}
.plan h2 { margin-bottom: 6px; }
.plan-list { list-style: none; padding: 0; display: grid; }
.plan-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding-block: 14px;
  border-bottom: 1px solid var(--rule);
}
.plan-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.plan-list strong { display: block; font-weight: 600; font-size: 15.5px; }
.plan-list span { font-size: 13.5px; color: var(--ink-3); }

.stats { display: grid; gap: 16px; align-content: start; }
.stat { display: grid; gap: 6px; }
.stat-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.stat-label { font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.stat-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week span {
  display: grid;
  gap: 4px;
  justify-items: center;
  font-size: 11px;
  color: var(--ink-3);
}
.week i {
  display: block;
  width: 100%;
  height: 22px;
  border-radius: 5px;
  background: var(--paper-3);
}
.week .on i { background: var(--biro); }
.week .today { color: var(--ink); font-weight: 600; }
.last-mark { display: flex; align-items: center; gap: 18px; min-height: 54px; }
.last-mark .mark { font-size: 32px; }
.save-line { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.save-line svg { width: 14px; height: 14px; }

/* syllabus map: 4 approaches × 3 studies */
.syllabus {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.syl-col { display: grid; gap: 8px; align-content: start; min-width: 0; }
.syl-col > a.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 6px;
  color: var(--chip);
  font-weight: 650;
  font-size: 14px;
  text-decoration: none;
  border-bottom: 2px solid var(--chip);
}
.syl-col > a.col-head:hover { text-decoration: underline; }
.study-tile {
  display: grid;
  gap: 6px;
  padding: 12px 14px 13px;
  border-radius: var(--r-2);
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.study-tile:hover { border-color: var(--chip, var(--biro)); box-shadow: var(--shadow); }
.t-name { font-family: var(--font-read); font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.t-name .yr { color: var(--ink-3); font-weight: 400; }
.t-nick { font-size: 13px; color: var(--ink-3); }
.t-foot { display: flex; align-items: center; gap: 10px; }
.t-foot .meter { flex: 1; }
.t-foot small { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.tile {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 16px 18px;
  border-radius: var(--r-2);
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tile:hover { border-color: var(--chip, var(--biro)); box-shadow: var(--shadow); }
.tile h3 { font-family: var(--font-read); font-size: 17px; font-weight: 650; }
.tile p { font-size: 13.5px; color: var(--ink-2); }
.tile .chip { justify-self: start; }

@media (max-width: 1120px) {
  .syllabus { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .today-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .syllabus { grid-template-columns: minmax(0, 1fr); }
  .plan-list li { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .plan-list li .btn { justify-self: start; }
}

/* ---------- 7. Notes ---------- */
.searchbar { position: relative; max-width: 560px; margin-top: 6px; }
.searchbar svg {
  position: absolute;
  left: 12px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: var(--ink-3);
}
.searchbar .input { padding-left: 40px; }
.results { display: grid; gap: 10px; }
.result {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--r-2);
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.result:hover { border-color: var(--biro); }
.result h3 { font-family: var(--font-read); font-size: 16.5px; font-weight: 650; }
.result p { font-size: 14px; color: var(--ink-2); }
.result mark { background: var(--biro-weak); color: var(--ink); border-radius: 3px; padding: 0 2px; }

.approach-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr);
  gap: 14px;
  padding-block: 16px;
  border-top: 1px solid var(--rule);
}
.approach-row:first-of-type { border-top: 0; padding-top: 0; }
.approach-card {
  display: grid;
  gap: 8px;
  align-content: start;
  color: var(--ink);
  text-decoration: none;
}
.approach-card h3 { font-family: var(--font-read); font-size: 19px; font-weight: 650; color: var(--chip); }
.approach-card:hover h3 { text-decoration: underline; }
.approach-card p { font-size: 14px; color: var(--ink-2); }
.approach-studies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) {
  .approach-row { grid-template-columns: minmax(0, 1fr); }
  .approach-studies { grid-template-columns: minmax(0, 1fr); }
}

.topic-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.topic-group h3 { font-size: 14px; font-weight: 650; color: var(--ink-2); margin-bottom: 8px; }
.topic-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.topic-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.topic-list a:hover { border-color: var(--chip, var(--biro)); }
.topic-list small { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
@media (max-width: 760px) { .topic-groups { grid-template-columns: minmax(0, 1fr); } }

/* study / topic pages */
.study-head { display: grid; gap: 10px; margin-bottom: 24px; }
.study-head .chip { justify-self: start; }
.study-head h1 {
  font-family: var(--font-read);
  font-size: clamp(28px, 3.8vw, 40px);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.study-head h1 .yr { color: var(--ink-3); font-weight: 400; }
.nickname { font-family: var(--font-read); font-style: italic; color: var(--ink-2); font-size: 19px; }
.oneliner { max-width: 64ch; color: var(--ink-2); font-size: 16px; }
.study-head .btn-row { margin-top: 6px; }

.study-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}
.side { display: grid; gap: 14px; position: sticky; top: 24px; }
@media (max-width: 1040px) {
  .study-layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
}

.reading {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3.5vw, 38px);
  font-family: var(--font-read);
  font-size: 16.5px;
  line-height: 1.68;
  min-width: 0;
}
.reading section + section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--rule); }
.reading h2 {
  font-family: var(--font-read);
  font-size: 21px;
  font-weight: 650;
  line-height: 1.25;
  margin-bottom: 10px;
}
.reading h3 {
  font: 650 13.5px/1.3 var(--font-ui);
  color: var(--ink-2);
  margin: 18px 0 8px;
}
.reading p, .reading li { max-width: 68ch; }
.reading ul, .reading ol { padding-left: 1.25em; display: grid; gap: 6px; }
.reading ol.steps { gap: 8px; }
.reading ol.steps li::marker { font-family: var(--font-ui); font-weight: 600; color: var(--ink-3); }
.reading p + p { margin-top: 10px; }
.reading code { font-size: 0.92em; }

.method-grid {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px 18px;
}
.method-grid dt { font: 600 13.5px/1.6 var(--font-ui); color: var(--ink-3); padding-top: 2px; }
.method-grid dd ul { padding-left: 1.1em; }
@media (max-width: 600px) {
  .method-grid { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .method-grid dd { margin-bottom: 10px; }
}

.eval { list-style: none; padding: 0 !important; display: grid; gap: 14px !important; }
.eval li { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; }
.eval .sign {
  grid-row: span 2;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 15px/1 var(--font-ui);
  margin-top: 3px;
}
.eval .strength .sign { background: var(--good-weak); color: var(--good); }
.eval .weakness .sign { background: var(--pen-weak); color: var(--pen); }
.eval .e-point { font-weight: 650; }
.eval .e-issue {
  font: 600 12px/1 var(--font-ui);
  color: var(--ink-3);
  margin-left: 6px;
  white-space: nowrap;
}
.eval .e-explain { color: var(--ink-2); }

.terms { display: grid; gap: 2px; }
.terms dt { font-weight: 650; }
.terms dd { color: var(--ink-2); margin: 0 0 12px; }
.terms dd:last-child { margin-bottom: 0; }

.debates { display: grid; gap: 12px; list-style: none; padding: 0 !important; }
.debates li { display: grid; gap: 2px; }
.debates b { font-family: var(--font-ui); font-size: 14px; font-weight: 650; }

.side .sheet h3 { font-size: 14.5px; font-weight: 650; margin-bottom: 8px; }
.side-stats { display: grid; gap: 12px; }
.side-note textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 0 2px;
  border: 0;
  background-color: transparent;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--rule) 27px, var(--rule) 28px);
  background-attachment: local;
  color: var(--biro);
  font: 400 15px/28px var(--font-ui);
}
.side-note textarea:focus { outline: none; }
.side-note .hint { margin-top: 6px; }

/* rendered AI text (tutor, A Level notes) */
.prose { font-family: var(--font-read); line-height: 1.66; }
.prose > * + * { margin-top: 10px; }
.prose h3, .prose h4, .prose h5, .prose h6 { font-family: var(--font-read); font-weight: 650; font-size: 18px; margin-top: 20px; }
.prose ul, .prose ol { padding-left: 1.25em; display: grid; gap: 4px; }
.prose code { font-size: 0.9em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- 8. Practice set-up screens ---------- */
.setup { display: grid; gap: 18px; }
.setup-row { display: grid; gap: 10px; }
.setup-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.seg {
  display: inline-flex;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}
.seg button {
  border: 0;
  background: none;
  padding: 8px 14px;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--rule-2); }
.seg button[aria-pressed="true"] { background: var(--biro-weak); color: var(--biro); font-weight: 650; }
@media (max-width: 640px) {
  .seg-stack { display: grid; width: 100%; }
  .seg-stack button { text-align: left; padding: 11px 14px; }
  .seg-stack button + button { border-left: 0; border-top: 1px solid var(--rule-2); }
}

.due-line {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.due-line strong { font-size: 22px; font-family: var(--font-read); font-weight: 650; display: block; }
.due-line span { color: var(--ink-3); font-size: 14px; }

.hub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 520px) { .hub { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 9. Flashcards: index cards ---------- */
.session-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 660px;
  margin: 0 auto 14px;
}
.session-top .count { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.progress-line { max-width: 660px; margin: 0 auto 18px; }

.flash-stage { perspective: 1600px; max-width: 660px; margin: 0 auto; }
.flash {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
  cursor: pointer;
  border-radius: 6px;
}
.flash.flipped { transform: rotateY(180deg); }
.face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  min-height: 300px;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  border-radius: 6px;
  box-shadow: var(--shadow-lift);
  background:
    linear-gradient(var(--card-head), var(--card-head)) 0 44px / 100% 2px no-repeat,
    repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--card-line) 31px, var(--card-line) 32px) 0 46px / 100% calc(100% - 46px) no-repeat,
    var(--paper);
}
.face-back { transform: rotateY(180deg); }
.face-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px;
  min-width: 0;
}
.face-label { font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.face-text {
  padding: 6px 26px 26px;
  font-family: var(--font-read);
  font-size: clamp(18px, 2.2vw, 21px);
  line-height: 32px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.face-back .face-text { color: var(--biro); font-weight: 400; }

.rate {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 660px;
  margin: 18px auto 0;
}
.rate button {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--rule-2);
  background: var(--paper);
  font: 650 14px/1.2 var(--font-ui);
  color: var(--ink);
  cursor: pointer;
}
.rate button small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.rate button kbd { font: 600 11px var(--font-ui); color: var(--ink-3); }
.rate button:hover { border-color: var(--biro); }
.rate .r0 { color: var(--pen); }
.rate .r0:hover { border-color: var(--pen); }
.flip-row { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.key-hint { text-align: center; margin-top: 12px; }
@media (max-width: 520px) {
  .face { min-height: 260px; }
  .face-text { padding: 4px 18px 22px; }
  .rate { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .key-hint { display: none; }
}

.summary {
  max-width: 660px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  justify-items: center;
  text-align: center;
  padding: 30px 22px;
}
.summary h2 { font-family: var(--font-read); font-size: 26px; font-weight: 650; }
.summary p { color: var(--ink-2); max-width: 52ch; }
.summary .btn-row { justify-content: center; }
.summary-list { width: 100%; text-align: left; display: grid; gap: 10px; margin-top: 6px; }
.summary-list .item {
  padding: 12px 14px;
  border-radius: var(--r-1);
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.summary-list .item b { display: block; font-weight: 600; margin-bottom: 2px; }
.summary-list .item span { color: var(--ink-2); font-size: 14px; }

/* ---------- 10. Quick recall ---------- */
.sprint { max-width: 660px; margin: 0 auto; display: grid; gap: 18px; }
.sprint-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink-2);
}
.sprint-meta .time { font-size: 22px; color: var(--ink); font-family: var(--font-read); }
.timer { height: 6px; border-radius: 6px; background: var(--paper-3); overflow: hidden; }
.timer > i { display: block; height: 100%; width: 100%; background: var(--biro); transform-origin: left center; transition: transform 0.2s linear; }
.timer.low > i { background: var(--pen); }
.prompt-card { display: grid; gap: 16px; padding: 26px; }
.prompt-card .chip { justify-self: start; }
.prompt {
  font-family: var(--font-read);
  font-size: clamp(20px, 2.6vw, 25px);
  line-height: 1.35;
  font-weight: 600;
}
.answer-row { display: flex; gap: 8px; }
.answer-row .input { font-size: 19px; padding: 13px 14px; }
.feedback { min-height: 26px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.feedback.ok { color: var(--good); }
.feedback.no { color: var(--pen); }
.feedback .ans { color: var(--ink); font-weight: 500; }
@media (max-width: 520px) { .answer-row { flex-direction: column; } }

/* ---------- 11. Quiz ---------- */
.quiz-card { max-width: 720px; margin: 0 auto; display: grid; gap: 18px; }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.q-title { font-family: var(--font-read); font-size: clamp(19px, 2.3vw, 23px); line-height: 1.4; font-weight: 600; }
.options { display: grid; gap: 10px; }
.opt {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  border-radius: var(--r-2);
  border: 1px solid var(--rule-2);
  background: var(--paper);
  color: var(--ink);
  font: 500 15px/1.45 var(--font-ui);
  cursor: pointer;
}
.opt:hover:not(:disabled) { border-color: var(--biro); background: var(--paper-2); }
.opt:disabled { cursor: default; }
.opt .letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--rule-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-2);
}
.opt svg { width: 20px; height: 20px; }
.opt.is-correct { border-color: var(--good); background: var(--good-weak); }
.opt.is-correct .letter { border-color: var(--good); color: var(--good); }
.opt.is-correct svg { color: var(--good); }
.opt.is-wrong { border-color: var(--pen); background: var(--pen-weak); }
.opt.is-wrong .letter { border-color: var(--pen); color: var(--pen); }
.opt.is-wrong svg { color: var(--pen); }
.explain {
  padding: 14px 16px;
  border-radius: var(--r-2);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  font-size: 14.5px;
  color: var(--ink-2);
}
.explain b { color: var(--ink); }

/* ---------- 12. Practice exam paper ---------- */
.paper {
  max-width: 840px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 4.5vw, 48px);
}
.paper-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 6px;
}
.paper-title { font-family: var(--font-read); font-weight: 700; font-size: 21px; line-height: 1.25; }
.paper-meta { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.paper-instr { font-size: 14px; color: var(--ink-2); padding-block: 12px; border-bottom: 1px solid var(--rule); }
.timer-chip {
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--rule-2);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
}
.timer-chip.low { color: var(--pen); border-color: var(--pen); }
.timer-chip svg { width: 16px; height: 16px; }
.section-label {
  font-family: var(--font-read);
  font-weight: 700;
  font-size: 16px;
  padding-top: 22px;
}
.q {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 12px;
  padding-block: 20px;
  border-bottom: 1px solid var(--rule);
}
.q:last-of-type { border-bottom: 0; }
.paper > .q:first-child { padding-top: 0; }
.q-num { font: 700 16px/1.55 var(--font-read); }
.q-body { display: grid; gap: 10px; min-width: 0; }
.q-line { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; }
.q-text { font-family: var(--font-read); font-size: 16.5px; line-height: 1.58; }
.q-marks { font: 700 15px var(--font-read); white-space: nowrap; }
.q-study { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.answer {
  width: 100%;
  min-height: calc(32px * var(--lines, 3));
  resize: vertical;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--rule-2) 31px, var(--rule-2) 32px);
  background-attachment: local;
  color: var(--biro);
  font: 400 16px/32px var(--font-ui);
}
.answer:focus { outline: none; background-color: color-mix(in srgb, var(--biro) 4%, transparent); }
.word-count { font-size: 12px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.paper-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 20px; }

.written {
  white-space: pre-wrap;
  color: var(--biro);
  font: 400 16px/1.7 var(--font-ui);
  padding: 10px 12px;
  border-left: 2px solid var(--rule-2);
  background: var(--paper-2);
  border-radius: 0 var(--r-1) var(--r-1) 0;
}
.written.blank { color: var(--ink-3); font-style: italic; }
.marking { display: grid; gap: 12px; margin-top: 4px; }
.marking-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.marking .pen-summary { font-family: var(--font-hand); color: var(--pen); font-size: 23px; line-height: 1.25; flex: 1; min-width: 200px; }
.marking h4 { font-size: 13px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.marking-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 640px) { .marking-cols { grid-template-columns: minmax(0, 1fr); } }
.self-mark { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.self-mark .input { width: 84px; }
.scheme-list { padding-left: 1.2em; display: grid; gap: 4px; font-size: 14.5px; color: var(--ink-2); }
.result-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 22px;
  margin: 0 auto 18px;
  max-width: 840px;
}
.result-band .left { display: grid; gap: 4px; }
.result-band h2 { font-family: var(--font-read); font-size: 22px; font-weight: 650; }

.history { display: grid; gap: 8px; }
.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.history-row b { font-weight: 600; }
.history-row span { color: var(--ink-3); font-size: 13px; }
.history-row .mark { font-size: 24px; padding: 2px 10px; }

/* ---------- 13. AI tutor ---------- */
.tutor { max-width: 820px; margin: 0 auto; display: grid; gap: 14px; }
.tutor-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tutor-bar .field { min-width: 220px; flex: 1; max-width: 380px; }
.msgs { display: grid; gap: 14px; padding-bottom: 6px; }
.msg {
  max-width: min(680px, 92%);
  padding: 12px 16px;
  border-radius: 14px;
  line-height: 1.58;
  overflow-wrap: anywhere;
}
.msg.user {
  justify-self: end;
  background: var(--biro);
  color: var(--on-biro);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.msg.ai {
  justify-self: start;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-bottom-left-radius: 4px;
  font-family: var(--font-read);
  font-size: 16px;
  box-shadow: var(--shadow);
}
.msg.ai.thinking { color: var(--ink-3); font-family: var(--font-ui); font-size: 14px; }
.msg.ai .err { color: var(--pen); font-family: var(--font-ui); font-size: 14px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestions button {
  border: 1px solid var(--rule-2);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}
.suggestions button:hover { border-color: var(--biro); color: var(--ink); }
.composer {
  position: sticky;
  bottom: 16px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--rule-2);
  background: var(--paper);
  box-shadow: var(--shadow-lift);
}
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 180px;
  resize: none;
  border: 0;
  background: transparent;
  padding: 10px 8px;
  font-size: 15.5px;
  line-height: 1.45;
}
.composer textarea:focus { outline: none; }
@media (max-width: 860px) {
  .composer { bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- 14. My notes ---------- */
.notes-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.note-list { display: grid; gap: 8px; align-content: start; }
.note-list .list { display: grid; gap: 6px; max-height: 64vh; overflow-y: auto; padding: 2px; }
.note-item {
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--paper);
  cursor: pointer;
  min-width: 0;
}
.note-item b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item[aria-current="true"] { border-color: var(--biro); box-shadow: inset 0 0 0 1px var(--biro); }
.note-editor { display: grid; gap: 12px; }
.note-editor .title-input {
  width: 100%;
  border: 0;
  background: transparent;
  font: 650 24px/1.25 var(--font-read);
  color: var(--ink);
  padding: 2px 0;
}
.note-editor .title-input:focus { outline: none; }
.note-editor .body-input {
  width: 100%;
  min-height: 52vh;
  resize: vertical;
  border: 0;
  padding: 0 2px;
  background-color: transparent;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 29px, var(--rule) 29px, var(--rule) 30px);
  background-attachment: local;
  color: var(--ink);
  font: 400 16px/30px var(--font-read);
}
.note-editor .body-input:focus { outline: none; }
.note-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
@media (max-width: 860px) {
  .notes-layout { grid-template-columns: minmax(0, 1fr); }
  .note-list .list { max-height: none; }
}

/* ---------- 15. Preferences ---------- */
.prefs { display: grid; gap: 16px; max-width: 760px; }
.prefs .sheet { display: grid; gap: 14px; }
.prefs h2 { font-family: var(--font-read); font-size: 19px; font-weight: 650; }
.prefs p { color: var(--ink-2); font-size: 14.5px; max-width: 64ch; }
.key-row { display: flex; gap: 8px; flex-wrap: wrap; }
.key-row .input { flex: 1; min-width: 220px; }

/* ---------- 16. Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  .mark.draw svg path { stroke-dashoffset: 0; }
}
