/* Velella — "defter": a ruled exercise book, blue ballpoint ink, the teacher's red pen and a highlighter.
   Paper and ink carry the whole look; colour is reserved for meaning (blue = right / action, red = the
   teacher's correction, yellow = something to notice). Motion only answers what the learner just did. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-next-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/atkinson-next-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                 U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
                 U+A720-A7FF;
}
@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/caveat-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Caveat";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/caveat-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                 U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
                 U+A720-A7FF;
}

:root {
  --paper: #fbfbf8;
  --paper-2: #f2f3ee;
  --card: #ffffff;
  --rule: #e4eaf2;
  --line: #cfd8e5;
  --margin-line: #ecaea8;
  --ink: #1e2a5a;
  --ink-2: #3b4572;
  --muted: #5d668f;
  --blue: #2f5bd3;
  --blue-soft: #e7edfc;
  --red: #c92f27;
  --red-soft: #fbe9e7;
  --hl: #ffe45c;
  --hl-soft: rgba(255, 228, 92, 0.62);
  --on-ink: #fbfbf8;
  --focus: #2f5bd3;

  --font: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --pitch: 32px;           /* the ruled line distance */
  --radius: 12px;
  --radius-s: 8px;
  --tap: 48px;
  --tabbar-h: 66px;
  --gutter: 16px;
  --margin-gap: 26px;      /* text starts this far right of the red margin line */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

/* A notebook read at night: dark paper, light ink, the same pens. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #13172a;
    --paper-2: #1a1f36;
    --card: #1b2139;
    --rule: #1f2643;
    --line: #313a5e;
    --margin-line: #5e3138;
    --ink: #e8ebf7;
    --ink-2: #c8cde6;
    --muted: #9da5c8;
    --blue: #8fa7ff;
    --blue-soft: #232d57;
    --red: #ff8278;
    --red-soft: #3b2029;
    --hl: #ecca3a;
    --hl-soft: rgba(236, 202, 58, 0.3);
    --on-ink: #13172a;
    --focus: #8fa7ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #13172a;
  --paper-2: #1a1f36;
  --card: #1b2139;
  --rule: #1f2643;
  --line: #313a5e;
  --margin-line: #5e3138;
  --ink: #e8ebf7;
  --ink-2: #c8cde6;
  --muted: #9da5c8;
  --blue: #8fa7ff;
  --blue-soft: #232d57;
  --red: #ff8278;
  --red-soft: #3b2029;
  --hl: #ecca3a;
  --hl-soft: rgba(236, 202, 58, 0.3);
  --on-ink: #13172a;
  --focus: #8fa7ff;
  color-scheme: dark;
}

/* ---- base ---- */

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

/* Component display rules (e.g. .btn's inline-flex) must never override the hidden attribute. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--pitch) - 1px),
                                              var(--rule) calc(var(--pitch) - 1px), var(--rule) var(--pitch));
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: break-word;
  font-variant-numeric: lining-nums;
}

/* The red margin line of the exercise book, aligned with the content column. */
body::before {
  content: "";
  position: fixed; top: 0; bottom: 0; z-index: 0; pointer-events: none;
  left: max(calc(var(--gutter) + var(--safe-left) + 12px), calc((100% - 680px) / 2 + 12px));
  width: 1.5px;
  background: var(--margin-line);
}

a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a, button, input, select, textarea, label, summary, [role="button"] { touch-action: manipulation; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: 1.85rem; font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.005em; }
h3 { font-size: 1.07rem; font-weight: 700; }
p { margin: 0 0 .8em; }
b, strong { font-weight: 700; }

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

.icon {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

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

.hand { font-family: var(--hand); font-weight: 600; letter-spacing: 0; }

/* Highlighter stroke behind a word or heading. */
.marker {
  background: linear-gradient(transparent 56%, var(--hl-soft) 56%, var(--hl-soft) 92%, transparent 92%);
  padding: 0 .12em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* ---- motion ---- */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes wiggle { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes sheet-up { from { transform: translateY(105%); } to { transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes stamp { 0% { opacity: 0; transform: rotate(-4deg) scale(1.35); } 60% { opacity: 1; transform: rotate(-4deg) scale(.96); } 100% { opacity: 1; transform: rotate(-4deg) scale(1); } }
@keyframes note-in { from { opacity: 0; transform: translate(-50%, -12px) rotate(-6deg); } to { opacity: 1; transform: translate(-50%, 0) rotate(-3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- the sail mark ---- */

.sail { width: 28px; height: 28px; flex: none; overflow: visible; }
.sail-sail { fill: var(--blue); }
.sail-float { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.sail-lg { width: 76px; height: 76px; }

/* ---- layout ---- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: calc(60px + var(--safe-top));
  padding: var(--safe-top) max(calc(var(--gutter) + var(--safe-right)), calc((100% - 680px) / 2 + var(--gutter)))
           0 max(calc(var(--gutter) + var(--safe-left) + var(--margin-gap)), calc((100% - 680px) / 2 + var(--gutter) + var(--margin-gap)));
  background: var(--paper);
  border-bottom: 1.5px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap);
  color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.2rem; letter-spacing: -0.015em;
}
.topbar-action {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); margin-right: -10px;
  color: var(--ink-2); border-radius: 50%;
}
.topbar-action.is-active { color: var(--blue); }

.page {
  position: relative; z-index: 1;
  width: 100%; max-width: 680px; margin: 0 auto;
  padding: 16px calc(var(--gutter) + var(--safe-right)) 28px calc(var(--gutter) + var(--safe-left) + var(--margin-gap));
}
.has-nav .page { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 32px); }

.footer {
  margin-top: 56px; padding-top: 14px;
  border-top: 1.5px dashed var(--line);
  color: var(--muted); font-size: .8rem; line-height: 1.5;
}
.footer p { margin: 0 0 .3em; }
.footer a { color: inherit; }
.nowrap { white-space: nowrap; }

/* ---- bottom tab bar ---- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 0 max(var(--safe-right), calc((100% - 680px) / 2)) var(--safe-bottom) max(var(--safe-left), calc((100% - 680px) / 2));
  background: var(--paper);
  border-top: 1.5px solid var(--ink);
}
.tabbar a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: var(--tabbar-h);
  color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 650; line-height: 1.1;
}
.tab-icon { position: relative; display: grid; place-items: center; width: 44px; height: 30px; }
.tabbar a.is-active { color: var(--blue); font-weight: 750; }
/* A quick pen stroke under the active tab. */
.tabbar a.is-active::after {
  content: ""; position: absolute; bottom: 9px; left: 50%; width: 34px; height: 6px; margin-left: -17px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 6'%3E%3Cpath d='M2 3.6C10 2 22 2.4 32 3.1' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 6'%3E%3Cpath d='M2 3.6C10 2 22 2.4 32 3.1' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.tabbar a.is-active span:last-child { margin-bottom: 6px; }
.tab-badge {
  position: absolute; top: -3px; right: 2px;
  min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: .7rem; font-weight: 750; line-height: 1;
  box-shadow: 0 0 0 2px var(--paper);
}

/* On touch screens the keyboard would push the fixed bar over the input; app.js sets kb-open there. */
.kb-open .tabbar { display: none; }

/* ---- surfaces ---- */

.card, .panel {
  display: block; padding: 16px;
  background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--radius);
}
.panel { display: grid; gap: 16px; }
a.card { color: inherit; text-decoration: none; }
a.card:active { border-color: var(--ink); }
.panel > h2 { margin: 0 0 -6px; }
.panel > .hint { margin: 0; }
.panel > .btn { justify-self: start; }

.page-head { margin: 6px 0 18px; }
.page-head h1 { margin: 0; }
.eyebrow { margin: 0; font-family: var(--hand); font-weight: 600; font-size: 1.45rem; line-height: 1.2; color: var(--blue); }

.block { margin-bottom: 30px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.block-head h2 {
  margin: 0; font-size: 1.15rem;
  background: linear-gradient(transparent 56%, var(--hl-soft) 56%, var(--hl-soft) 92%, transparent 92%);
  padding: 0 .15em; margin-left: -.15em;
}
.block-head a {
  display: inline-flex; align-items: center; justify-content: flex-end;
  min-height: 44px; min-width: 44px; margin: -11px 0;
  font-size: .95rem; font-weight: 700; text-decoration: none;
}
.block-head .hint { font-size: .85rem; }
.stack { display: grid; gap: 10px; }

.empty-line {
  margin: 0; padding: 16px 0;
  color: var(--muted);
  font-family: var(--hand); font-size: 1.35rem; font-weight: 500; line-height: 1.3;
}

.hint { color: var(--muted); font-size: .92rem; }

.prose { max-width: 65ch; }
.prose p:last-child { margin-bottom: 0; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
article.prose h2 { margin-top: 1.4em; }

/* ---- marked text: [en:..] words speak when tapped ---- */

.en, .say-inline {
  display: inline; padding: 0 4px;
  border: 0; border-radius: 3px;
  background: var(--hl-soft); color: var(--ink);
  font: inherit; font-weight: 650; text-align: left; cursor: pointer;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  -webkit-user-select: none; user-select: none;
  transition: background-color .15s, color .15s;
}
.en.speaking, .say-inline.speaking { background: var(--blue); color: #fff; }
em.tr { font-style: italic; }
kbd {
  padding: 1px 6px; border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px;
  background: var(--card); font-family: inherit; font-size: .9em;
}

/* ---- notices & toast ---- */

.notice { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-s); font-size: .96rem; font-weight: 600; }
.notice-ok { background: var(--blue-soft); color: var(--blue); }
.notice-error { background: var(--red-soft); color: var(--red); }

.toast {
  position: fixed; z-index: 60;
  left: calc(var(--gutter) + var(--safe-left)); right: calc(var(--gutter) + var(--safe-right));
  bottom: calc(var(--safe-bottom) + 16px);
  max-width: 480px; margin: 0 auto; padding: 12px 16px;
  background: var(--ink); color: var(--on-ink);
  border-radius: 10px; font-size: .95rem; font-weight: 600;
  animation: rise .25s var(--ease-out) both;
}
.has-nav .toast { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); }

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

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend { font-weight: 700; font-size: .95rem; padding: 0; }
fieldset.field > legend { margin-bottom: 6px; }
.field .hint { margin: 0; font-size: .86rem; }
.field > span.hint { font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 16px+ text in inputs: iOS Safari zooms the page into smaller inputs. */
input, select, textarea, button { font: inherit; font-size: max(16px, 1rem); color: inherit; }

/* :where() keeps this at element specificity so component classes can override it. */
input:where(:not([type="radio"]):not([type="checkbox"]):not([type="hidden"])), select, textarea {
  width: 100%; min-height: var(--tap); margin: 0; padding: 10px 14px;
  background: var(--card); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px;
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
select {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-soft); }
::placeholder { color: var(--muted); opacity: .8; }

.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 600; cursor: pointer; }
.check input[type="checkbox"], .check input[type="radio"] { width: 22px; height: 22px; accent-color: var(--blue); flex: none; }
.check input:where(:not([type="checkbox"]):not([type="radio"])) { flex: 1 1 auto; min-width: 0; }

/* Segmented control: radio buttons or tab buttons. */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--paper-2); border: 1.5px solid var(--line); border-radius: 12px; }
.seg label { flex: 1 1 0; min-width: 0; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg span, .seg button {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 44px; padding: 6px 8px;
  border: 0; border-radius: 9px; background: transparent; text-align: center;
  font-size: .95rem; font-weight: 650; line-height: 1.2; color: var(--muted); cursor: pointer;
}
.seg input:checked + span, .seg button[aria-selected="true"] {
  background: var(--card); color: var(--ink); font-weight: 750;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}
.seg input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 1px; }

/* ---- buttons: ink on paper, with an offset pen line as their depth ---- */

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 11px 20px;
  border: 1.5px solid transparent; border-radius: 10px;
  font-size: 1.02rem; font-weight: 700; text-decoration: none; text-align: center; line-height: 1.2;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  transition: transform .08s, box-shadow .08s, background-color .15s, opacity .15s;
}
.btn .icon { width: 21px; height: 21px; }
.btn-primary { background: var(--ink); color: var(--on-ink); box-shadow: 3px 3px 0 var(--blue); }
.btn-ok { background: var(--blue); color: #fff; box-shadow: 3px 3px 0 var(--ink); }
.btn-bad { background: var(--ink); color: var(--on-ink); box-shadow: 3px 3px 0 var(--red); }
.btn-sun { background: var(--hl); color: #1e2a5a; box-shadow: 3px 3px 0 var(--ink); }
.btn-quiet { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--line); }
.btn:active:not([disabled]) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 transparent; }
.btn-quiet:active:not([disabled]), .btn-danger:active:not([disabled]) { transform: none; border-color: var(--ink); }
.btn-block { width: 100%; }
.btn-small { min-height: 44px; padding: 6px 14px; font-size: .93rem; }
.btn[disabled] { opacity: .42; cursor: default; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > * { flex: 1 1 auto; }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink-2); cursor: pointer;
}
.icon-btn:active { border-color: var(--ink); }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn.is-danger { color: var(--red); }
.icon-btn[disabled] { opacity: .35; cursor: default; }

.logout { margin-top: 32px; }

/* ---- login ---- */

.login-page .page { max-width: 440px; padding-top: calc(var(--safe-top) + 9vh); }
.login-page .page { padding-top: calc(var(--safe-top) + 9dvh); }
.login { display: grid; }
.login-hero { margin-bottom: 4px; }
.login-title { font-size: 3rem; font-weight: 800; letter-spacing: -0.035em; margin: 6px 0 0; }
.login-lead { margin: 0 0 30px; font-family: var(--hand); font-size: 1.7rem; font-weight: 600; color: var(--blue); }

.empty { padding-top: 8vh; }
.empty p { color: var(--muted); }

/* ---- today ---- */

.hello { margin: 4px 0 20px; }
.hello h1 { margin: 0; font-size: 2rem; }
.goal { display: grid; gap: 4px; margin-top: 12px; }
.goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.goal-top strong { font-size: 1.2rem; }
.goal-note { font-family: var(--hand); font-size: 1.35rem; font-weight: 600; color: var(--red); line-height: 1.1; }
.goal-note.is-blue { color: var(--blue); }
.goal-line { position: relative; height: 12px; }
.goal-line::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; border-top: 2px dotted var(--line); }
.goal-line span {
  position: absolute; left: 0; top: 3px; height: 6px; width: 0; min-width: 6px;
  border-radius: 6px; background: var(--blue);
  transition: width 1s var(--ease-out);
}

/* assignment rows */
.task {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 14px 14px 12px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none;
}
.task:active { border-color: var(--ink); }
.task-kind {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px;
  border: 1.5px solid var(--ink); border-radius: 9px; color: var(--ink); background: var(--paper);
}
.task-kind .icon { width: 21px; height: 21px; }
.task-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.task-title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.task-note {
  color: var(--red); font-family: var(--hand); font-size: 1.28rem; font-weight: 600; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 4px; }
.task.is-overdue { border-color: var(--red); }
.task.is-overdue .task-kind { border-color: var(--red); color: var(--red); }
.task.is-new { border-color: var(--blue); }
.task.is-new .task-kind { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }

/* Small stamps instead of pills: a pen-drawn box around a word. */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 7px; min-height: 24px;
  border: 1.5px solid var(--line); border-radius: 6px;
  color: var(--muted); background: transparent;
  font-size: .8rem; font-weight: 700; white-space: nowrap; line-height: 1.3;
}
.pill-bad { color: var(--red); border-color: currentColor; }
.pill-sun { color: var(--ink); border-color: transparent; background: var(--hl-soft); }
.pill-ok, .pill-blue { color: var(--blue); border-color: currentColor; }
a.pill { text-decoration: none; }

.lesson-card { display: grid; gap: 6px; }
.lesson-meta { margin: 0; color: var(--muted); font-size: .9rem; font-weight: 600; }
.lesson-card h3 { font-size: 1.25rem; margin: 0; }
.lesson-card h3 a { color: inherit; text-decoration: none; }
.lesson-card .btn { margin-top: 10px; justify-self: start; }
.remember { margin: 6px 0 0; font-size: .98rem; }
.remember strong { font-family: var(--hand); font-size: 1.3rem; font-weight: 700; color: var(--red); margin-right: 2px; }

/* ---- lessons ---- */

.back-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); margin: -6px 0 0;
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: .95rem;
}

/* Level tabs look like the tabbed dividers of a ring binder. */
.level-tabs {
  display: flex; gap: 4px; margin: 0 0 22px; padding: 0 2px;
  border-bottom: 1.5px solid var(--ink);
}
.level-tabs a {
  flex: 1 1 0; min-width: 0; min-height: 54px; margin-bottom: -1.5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--paper-2); color: var(--muted); text-decoration: none; line-height: 1.15;
}
.level-tabs strong { font-size: 1.02rem; font-weight: 750; }
.level-tabs span { font-size: .74rem; font-weight: 650; }
.level-tabs a.is-active { background: var(--card); color: var(--ink); border-color: var(--ink); border-bottom: 1.5px solid var(--card); }
.level-tabs-sm { margin: 0; }
.level-tabs-sm a { min-height: 46px; }

.path { list-style: none; margin: 0; padding: 0; position: relative; }
.path::before { content: ""; position: absolute; left: 23px; top: 26px; bottom: 26px; border-left: 2px dotted var(--line); }
.path li { position: relative; }
.path li + li { margin-top: 6px; }
.path form { margin: 0; }
.stop { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 6px 4px 6px 0; color: var(--ink); text-decoration: none; }
.stop-btn { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.stop-node {
  position: relative; z-index: 1; flex: none;
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 50%; background: var(--paper); border: 1.5px solid var(--line);
  font-weight: 750; font-size: 1.05rem; color: var(--muted);
}
.stop:active .stop-node { border-color: var(--ink); }
.status-done .stop-node { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.status-read .stop-node, .status-started .stop-node { border-color: var(--ink); color: var(--ink); }
.is-next .stop-node { border: 2px solid var(--ink); color: var(--ink); background: var(--hl); }
.stop-node .icon { width: 24px; height: 24px; stroke-width: 2.4; }
.stop-text { flex: 1 1 auto; min-width: 0; display: grid; }
.stop-title { font-weight: 700; font-size: 1.03rem; line-height: 1.3; }
.stop-sub { color: var(--muted); font-size: .87rem; line-height: 1.35; }
.stop .pill { align-self: center; }

.lesson-head { margin: 2px 0 18px; }
.lesson-head h1 { margin: 2px 0 4px; }
.lesson-head .stop-sub { font-size: .98rem; margin: 0; }

.tabs { margin-bottom: 22px; }

.lesson-intro { margin-bottom: 26px; font-size: 1.04rem; }
.lesson-section { margin: 0 0 30px; }
.lesson-section > h2 { font-size: 1.2rem; }
.lesson-section.is-work { padding: 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); }
.work-tag { margin-bottom: 8px; }

/* Tables scroll inside their own box; the page never scrolls sideways. */
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0;
  border: 1.5px solid var(--line); border-radius: var(--radius-s); background: var(--card);
}
.table-wrap table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.table-wrap th, .table-wrap td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.table-wrap th { background: var(--paper-2); font-weight: 700; white-space: nowrap; color: var(--muted); font-size: .85rem; border-bottom: 1.5px solid var(--line); }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td:first-child { font-weight: 700; }

/* Example sentences sit on the page's own lines. */
.examples { list-style: none; margin: 10px 0 0; padding: 0; }
.examples li { display: grid; padding: 6px 0 8px; border-bottom: 1px dashed var(--line); }
.examples li:last-child { border-bottom: 0; }
.say-row {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; min-height: 40px; padding: 4px 0;
  border: 0; background: none; color: var(--ink); text-align: left; font-weight: 700; font-size: 1.02rem; cursor: pointer;
}
.say-row .icon {
  width: 30px; height: 30px; padding: 6px; margin-top: -3px; flex: none;
  border: 1.5px solid var(--line); border-radius: 50%; color: var(--blue); background: var(--card);
}
.say-row.speaking .icon { background: var(--blue); border-color: var(--blue); color: #fff; }
.ex-tr { color: var(--muted); font-size: .93rem; padding-left: 40px; }

.mistakes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mistakes li { display: grid; gap: 4px; padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s); }
.mistakes p { margin: 0; }
.m-wrong, .m-right { display: flex; gap: 8px; align-items: flex-start; }
.m-wrong > :last-child, .m-right > :last-child { min-width: 0; }
.m-mark { flex: none; display: grid; place-items: center; width: 22px; height: 24px; }
.m-mark .icon { width: 20px; height: 20px; stroke-width: 2.4; }
.m-wrong { color: var(--red); }
.m-wrong s { text-decoration-thickness: 2px; }
.m-right { color: var(--blue); font-weight: 700; }
.m-note { color: var(--muted); font-size: .93rem; padding-left: 30px; }

.sources { margin: 0 0 24px; color: var(--muted); font-size: .9rem; }
.sources summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.sources a { color: inherit; display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; }

.review-card { display: grid; gap: 14px; }
.review-rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: rule; }
.review-rules li { position: relative; padding: 8px 0 10px 38px; border-bottom: 1px dashed var(--line); }
.review-rules li::before {
  counter-increment: rule; content: counter(rule) ".";
  position: absolute; left: 4px; top: 4px;
  font-family: var(--hand); font-size: 1.5rem; font-weight: 700; color: var(--red); line-height: 1;
}
.review-card .remember, .review-card .table-wrap { margin: 0; }

.lesson-actions { display: grid; gap: 14px; margin-top: 8px; }
.pager { display: flex; justify-content: space-between; gap: 10px; }
.pager .btn { padding-left: 14px; padding-right: 14px; font-size: .95rem; }

/* ---- exercise runner ---- */

.runner-page .page { padding-top: 0; padding-bottom: 40px; }
.runner-top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  margin: 0 calc(-1 * var(--gutter)) 0 calc(-1 * (var(--gutter) + var(--margin-gap)));
  padding: calc(var(--safe-top) + 6px) var(--gutter) 10px 8px;
  background: var(--paper);
}
.runner-exit {
  flex: none; display: grid; place-items: center; width: var(--tap); height: var(--tap);
  color: var(--muted); text-decoration: none;
}
.runner-exit .icon { width: 20px; height: 20px; stroke-width: 2; }
/* Progress as one stroke per question, like a tally in the margin. */
.runner-bar { flex: 1 1 auto; height: 18px; display: flex; align-items: flex-end; gap: 3px; }
.runner-bar .tick { flex: 1 1 0; min-width: 0; height: 8px; border-radius: 2px; background: var(--line); transition: height .2s, background-color .2s; }
.runner-bar .tick.is-right { height: 14px; background: var(--blue); }
.runner-bar .tick.is-wrong { height: 14px; background: var(--red); }
.runner-bar .tick.is-now { height: 18px; background: var(--ink); }
.runner-bar .tick.is-done { height: 14px; background: var(--ink-2); }
.runner-bar.is-long { height: 8px; border-radius: 4px; background: var(--line); display: block; overflow: hidden; }
.runner-bar.is-long .fill { display: block; height: 100%; width: 0; background: var(--blue); transition: width .4s var(--ease-out); }
.runner-count { flex: none; min-width: 3.4em; text-align: right; color: var(--muted); font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* The "3 in a row" sticky note. */
.combo {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 70px); z-index: 30;
  transform: translateX(-50%) rotate(-3deg);
  padding: 8px 16px 10px; background: var(--hl); color: #1e2a5a;
  font-family: var(--hand); font-size: 1.55rem; font-weight: 700; white-space: nowrap; line-height: 1;
  box-shadow: 0 6px 14px rgba(30, 42, 90, 0.18);
  pointer-events: none; animation: note-in .35s var(--ease-out) both;
}

.question { display: grid; gap: 18px; padding-top: 14px; }
.q-head { display: grid; gap: 6px; }
.q-head p { margin: 0; }
.q-type { color: var(--muted); font-size: .92rem; font-weight: 650; }
.q-instruction { font-weight: 700; }
.q-text { font-size: 1.65rem; line-height: 1.3; font-weight: 750; letter-spacing: -0.015em; }
.q-wrong { color: var(--red); text-decoration: line-through; text-decoration-thickness: 2px; }
.blank { display: inline-block; min-width: 3em; border-bottom: 3px solid var(--ink); margin: 0 4px 0 0; }

.options { display: grid; gap: 12px; }
.option {
  position: relative;
  min-height: 56px; padding: 12px 52px 12px 18px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
  color: var(--ink); font-size: 1.12rem; font-weight: 650; text-align: left; cursor: pointer;
}
.option:active:not(:disabled) { border-color: var(--ink); }
.option:disabled { cursor: default; opacity: 1; color: var(--ink); }
.option.is-chosen { border-color: var(--ink); }
.opt-text { position: relative; }
.option.is-right { border-color: var(--blue); color: var(--blue); font-weight: 750; }
.option.is-wrong { color: var(--muted); }
.option.is-wrong .opt-text { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
/* The teacher's pen: a tick beside the right answer, a loop around the wrong one. */
.option.is-right::after, .text-answer.is-right::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 30px; height: 26px; margin-top: -13px;
  background: var(--blue);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 26'%3E%3Cpath d='M3 14c3 2 5 5 7 9 4-9 10-16 18-21' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 26'%3E%3Cpath d='M3 14c3 2 5 5 7 9 4-9 10-16 18-21' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.option.is-wrong .opt-text::after {
  content: ""; position: absolute; left: -14px; right: -14px; top: -11px; bottom: -11px;
  background: var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' preserveAspectRatio='none'%3E%3Cpath d='M18 9C38 2 80 4 92 17c10 12-8 26-40 28C22 47 4 38 6 25 8 14 30 6 58 7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 50' preserveAspectRatio='none'%3E%3Cpath d='M18 9C38 2 80 4 92 17c10 12-8 26-40 28C22 47 4 38 6 25 8 14 30 6 58 7' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.text-answer { position: relative; display: grid; gap: 12px; }
input.answer-input { min-height: 58px; font-size: 1.15rem; border-radius: var(--radius); }
input.answer-input.is-right { border-color: var(--blue); color: var(--blue); font-weight: 700; padding-right: 54px; }
input.answer-input.is-wrong { border-color: var(--red); color: var(--red); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.text-answer.is-right::after { top: auto; bottom: 16px; margin-top: 0; }
.listen-buttons { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.listen-btn { min-height: 88px; flex-direction: column; gap: 6px; }
.listen-btn .icon { width: 30px; height: 30px; }
.listen-btn:first-child { background: var(--ink); color: var(--on-ink); border-color: var(--ink); box-shadow: 3px 3px 0 var(--blue); }
.listen-btn.speaking { border-color: var(--blue); }

.order { display: grid; gap: 18px; }
.order-line, .order-bank { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
/* The sentence is written on two ruled lines. */
.order-line {
  min-height: 112px; padding: 6px 2px;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 53px, var(--ink) 53px, var(--ink) 54.5px, transparent 54.5px, transparent 56px);
}
.order-line.is-right { background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 53px, var(--blue) 53px, var(--blue) 55px, transparent 55px, transparent 56px); }
.order-line.is-wrong { background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 53px, var(--red) 53px, var(--red) 55px, transparent 55px, transparent 56px); animation: wiggle .35s; }
.order-hint { align-self: center; padding: 0 4px; font-family: var(--hand); font-size: 1.3rem; color: var(--muted); }
.order-bank { justify-content: center; min-height: 52px; }
.tile {
  min-height: 46px; padding: 6px 14px;
  border: 1.5px solid var(--line); border-radius: 8px; background: var(--card);
  color: var(--ink); font-size: 1.06rem; font-weight: 650; cursor: pointer;
}
.tile:active:not(:disabled) { border-color: var(--ink); }
.order-line .tile { border-color: var(--ink); }
.tile:disabled { cursor: default; opacity: 1; color: var(--ink); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-item {
  min-height: 54px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--ink); font-size: .98rem; font-weight: 650; line-height: 1.25; text-align: center; cursor: pointer;
}
.match-item:disabled { cursor: default; opacity: 1; color: var(--ink); }
.match-item.is-selected { border: 2px solid var(--ink); background: var(--hl-soft); }
/* Each pair gets its own pen colour on the left edge; text stays ink. */
.match-item[class*="pair-"] { border-left-width: 6px; background: var(--card); }
.match-item.pair-0 { border-color: #2f5bd3; }
.match-item.pair-1 { border-color: #c92f27; }
.match-item.pair-2 { border-color: #d29b00; }
.match-item.pair-3 { border-color: #1f8a5b; }
.match-item.pair-4 { border-color: #8a43c4; }
.match-item.pair-5 { border-color: #e06b17; }

.q-actions { display: grid; gap: 10px; }
.q-actions:empty { display: none; }

/* Feedback: a strip of paper slides up; the teacher's verdict is handwritten. */
.q-feedback:empty { display: none; }
.q-feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; gap: 6px;
  max-height: 72vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px max(calc(var(--gutter) + var(--safe-right)), calc((100% - 680px) / 2 + var(--gutter)))
           calc(18px + var(--safe-bottom)) max(calc(var(--gutter) + var(--safe-left) + var(--margin-gap)), calc((100% - 680px) / 2 + var(--gutter) + var(--margin-gap)));
  background: var(--paper);
  border-top: 2px solid var(--blue);
  box-shadow: 0 -10px 28px rgba(30, 42, 90, 0.1);
  animation: sheet-up .32s var(--ease-out) both;
}
.q-feedback::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1.5px; background: var(--margin-line);
  left: max(calc(var(--gutter) + var(--safe-left) + 12px), calc((100% - 680px) / 2 + 12px));
}
.q-feedback.is-wrong { border-top-color: var(--red); }
.q-feedback p { margin: 0; }
.fb-title { font-family: var(--hand); font-weight: 700; font-size: 2.15rem; line-height: 1; }
.fb-badge { display: none; }
.is-right .fb-title { color: var(--blue); }
.is-wrong .fb-title { color: var(--red); }
.fb-answer { font-size: 1.05rem; }
.fb-explain { font-size: .97rem; color: var(--ink-2); }
.q-feedback .btn { margin-top: 10px; }
.appeal { margin-top: 4px; }
.appeal-result { margin: 0; font-weight: 650; font-size: .96rem; }
.appeal-accepted { color: var(--blue); }
.appeal-rejected { color: var(--red); }

.runner-wait { color: var(--muted); padding: 24px 0; font-family: var(--hand); font-size: 1.4rem; }
.summary { display: grid; gap: 14px; padding-top: 6px; }
/* The score is written in red pen and circled, like a graded paper. */
.score { display: grid; justify-items: center; gap: 2px; padding: 18px 0 6px; text-align: center; }
.score p { margin: 0; }
.grade { position: relative; display: grid; place-items: center; width: 210px; height: 128px; }
.grade svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.grade path { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 560; stroke-dashoffset: 560; animation: draw .9s .15s ease-out forwards; }
.grade-num { font-family: var(--hand); font-weight: 700; font-size: 3.8rem; line-height: 1; color: var(--red); font-variant-numeric: tabular-nums; }
.score-sub { font-family: var(--hand); font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.15; }
.score-of { color: var(--muted); font-weight: 650; }
.wrong-title { margin: 12px 0 0; }
.wrong-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.wrong-list li { display: grid; gap: 4px; padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s); }
.wrong-list p { margin: 0; }
.wl-q { font-weight: 700; }
.wl-given { color: var(--red); font-size: .96rem; }
.wl-answer { color: var(--blue); font-size: .96rem; font-weight: 650; }
.wl-explain { color: var(--muted); font-size: .92rem; }
.summary-actions { display: grid; gap: 14px; margin-top: 10px; }

/* "Tamamlandı" rubber stamp. */
.stamp {
  display: inline-block; padding: 4px 14px;
  border: 3px solid var(--blue); border-radius: 8px; color: var(--blue);
  font-weight: 800; font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase;
  transform: rotate(-4deg); animation: stamp .45s .8s var(--ease-out) both;
}

/* ---- assignment pages ---- */

.a-head { margin: 2px 0 18px; display: grid; gap: 6px; }
.a-head h1 { margin: 0; }
.a-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.note-box { padding: 2px 0; }
.note-box strong { display: block; font-size: .85rem; color: var(--muted); font-weight: 700; }
.note-box p { margin: 0; white-space: pre-line; font-family: var(--hand); font-size: 1.55rem; font-weight: 600; line-height: 1.25; color: var(--red); }

.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.result {
  display: grid; gap: 6px; padding: 14px 16px 14px 46px; position: relative;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s);
  scroll-margin-top: 80px;
}
.result::before {
  content: ""; position: absolute; left: 14px; top: 16px; width: 20px; height: 20px; background: var(--line);
}
.result.is-right::before {
  background: var(--blue);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 26'%3E%3Cpath d='M3 14c3 2 5 5 7 9 4-9 10-16 18-21' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 26'%3E%3Cpath d='M3 14c3 2 5 5 7 9 4-9 10-16 18-21' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.result.is-wrong::before, .result.is-blank::before {
  background: var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5c5 4 9 9 14 15M19 4C14 9 9 14 5 19' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5c5 4 9 9 14 15M19 4C14 9 9 14 5 19' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.result.is-blank::before { opacity: .5; }
.result p { margin: 0; }
.result-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.result-num { font-weight: 800; color: var(--muted); }
.result-q { font-weight: 700; }
.result-given { font-size: .96rem; }
.result-given.is-wrong { color: var(--red); }
.result-given.is-right { color: var(--blue); }
.result-answer { color: var(--blue); font-size: .96rem; font-weight: 650; }
.result-explain { color: var(--muted); font-size: .92rem; }
.override { display: grid; gap: 8px; margin-top: 4px; padding-top: 10px; border-top: 1.5px dashed var(--line); }
.override .btn-row .btn { flex: 1 1 0; }
.override .check { min-height: 40px; font-size: .92rem; font-weight: 600; }

.big-score { display: flex; align-items: baseline; gap: 10px; }
.big-score strong { font-family: var(--hand); font-size: 3rem; font-weight: 700; color: var(--red); line-height: 1; }
.comment-box { padding: 0; }
.comment-box strong { display: block; color: var(--muted); font-size: .85rem; margin-bottom: 2px; }
.comment-box p { margin: 0; white-space: pre-line; font-family: var(--hand); font-size: 1.55rem; font-weight: 600; line-height: 1.25; color: var(--red); }

/* ---- teacher ---- */

.create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 26px; }
.create-grid form { display: contents; }
.create {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 96px; padding: 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
  color: var(--ink); text-decoration: none; text-align: left; font: inherit; cursor: pointer;
}
.create:active { border-color: var(--ink); }
.create-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 1.5px solid var(--ink); border-radius: 8px; }
.create-icon .icon { width: 20px; height: 20px; }
.create strong { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.create span:not(.create-icon) { color: var(--muted); font-size: .82rem; line-height: 1.3; }
.create-form { cursor: default; }
.create-row { display: flex; gap: 8px; width: 100%; margin-top: auto; }
.create-row select { min-height: 44px; padding: 4px 30px 4px 10px; flex: 1 1 auto; min-width: 0; }

.item-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  display: grid; gap: 8px; padding: 12px 12px 12px 14px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s);
  scroll-margin-top: 80px;
}
.item-top { display: flex; align-items: center; gap: 8px; }
.item-num { font-family: var(--hand); font-size: 1.5rem; font-weight: 700; color: var(--red); min-width: 1.4em; line-height: 1; }
.item-tools { margin-left: auto; display: flex; gap: 6px; }
.item-tools form { margin: 0; }

.qp { display: grid; gap: 4px; font-size: .97rem; }
.qp p { margin: 0; }
.qp-text { font-weight: 700; }
.qp-options { margin: 2px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.qp-options li { padding: 1px 9px; border-radius: 6px; border: 1.5px solid var(--line); font-size: .9rem; }
.qp-options li.is-answer { border-color: var(--blue); color: var(--blue); font-weight: 750; }
.qp-answer { color: var(--blue); font-size: .93rem; font-weight: 650; }
.qp-meta { color: var(--muted); font-size: .82rem; }

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters .field > span { font-size: .85rem; }
.filters .btn { grid-column: 1 / -1; }
.pick-card { display: grid; gap: 10px; }
.pick-card .btn { justify-self: stretch; }
.pick-card .btn.is-added { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.sticky-bottom { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); z-index: 5; margin-top: 16px; }
.pager-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }

.type-chips, .chip-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.type-chips a, .chip-checks span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 6px 13px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: .9rem; cursor: pointer;
}
.type-chips a.is-active, .chip-checks input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip-checks label { position: relative; }
.chip-checks input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-checks input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 2px; }

.errors { margin: 0; padding: 12px 14px 12px 32px; background: var(--red-soft); color: var(--red); border-radius: var(--radius-s); }

.tg-code {
  margin: 0; padding: 14px; text-align: center; border-radius: var(--radius-s);
  background: var(--paper-2); border: 1.5px dashed var(--line);
  font-size: 1.15rem; overflow-wrap: anywhere; -webkit-user-select: all; user-select: all;
}
.gen-card .check { min-height: 40px; }

/* ---- writing ---- */

.task-box { gap: 8px; }
/* A long English prompt: tap to hear it, without painting the whole paragraph yellow. */
.task-box .say-inline {
  background: none; padding: 0; color: var(--ink-2); font-weight: 600; font-style: italic;
  text-decoration: underline dotted var(--blue); text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.task-box .say-inline.speaking { background: none; color: var(--blue); }
.task-box p { margin: 0; }
.task-box summary { min-height: 32px; cursor: pointer; }
details.panel > summary { list-style: none; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ""; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
details.panel[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }

/* Writing happens on ruled paper whose lines match the line height exactly. */
textarea.write-area {
  min-height: calc(var(--pitch) * 12 + 8px); padding: 4px 16px;
  font-size: 1.1rem; line-height: var(--pitch);
  border-radius: var(--radius);
  background-color: var(--card);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--pitch) - 1px), var(--rule) calc(var(--pitch) - 1px), var(--rule) var(--pitch));
  background-position: 0 4px; background-attachment: local;
}
.write-page .page { padding-bottom: calc(var(--safe-bottom) + 24px); }
.write-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.word-meter { font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.word-meter strong { font-size: 1.15rem; color: var(--ink); }
.word-meter.is-enough strong { color: var(--blue); }
.save-state { color: var(--muted); text-align: right; font-family: var(--hand); font-size: 1.15rem; }
.meter-track { height: 6px; border-radius: 6px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter-track span { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--hl); transition: width .9s var(--ease-out), background-color .3s; }
.write-bar + .meter-track { margin-top: -8px; }
.write-bar:has(.is-enough) + .meter-track span { background: var(--blue); }

.ai-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-s); background: var(--blue-soft); color: var(--ink); }
.ai-box p { margin: 0; }
.ai-failed { background: var(--red-soft); color: var(--red); }
.ai-skipped { background: transparent; color: var(--muted); border: 1.5px dashed var(--line); }
.ai-box .icon { color: var(--blue); flex: none; margin-top: 1px; }
.spinner {
  flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
.spinner-sm { width: 18px; height: 18px; margin: 0; border-color: rgba(255, 255, 255, .35); border-top-color: currentColor; }

.writing-text {
  padding: 4px 16px; white-space: pre-wrap;
  background-color: var(--card);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--pitch) - 1px), var(--rule) calc(var(--pitch) - 1px), var(--rule) var(--pitch));
  background-position: 0 4px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  font-size: 1.07rem; line-height: var(--pitch);
}
/* The teacher's red pen under a mistake; the number links it to its correction. */
.err-mark {
  background: none; color: inherit; cursor: pointer;
  text-decoration: underline wavy var(--red); text-decoration-thickness: 1.5px;
  text-underline-offset: 4px; text-decoration-skip-ink: none;
}
.err-mark.is-pending { text-decoration-style: dotted; text-decoration-thickness: 2px; }
.err-mark sup { font-family: var(--hand); font-size: 1.05rem; font-weight: 700; color: var(--red); margin-left: 1px; line-height: 0; }
.err-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.err-card { display: grid; gap: 8px; padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s); scroll-margin-top: 90px; }
.err-card.is-ok { border-color: var(--red); }
.err-card p { margin: 0; }
.err-fix { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.err-fix s { color: var(--muted); text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.err-fix strong, .err-fix .say-inline { font-family: var(--hand); font-size: 1.45rem; font-weight: 700; color: var(--red); background: none; padding: 0; line-height: 1.1; }
.err-num { font-family: var(--hand); font-size: 1.3rem; font-weight: 700; color: var(--red); line-height: 1; }
.err-edit { display: grid; gap: 10px; }
.err-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.err-tools .btn { padding-left: 6px; padding-right: 6px; }

.rubric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rubric-view { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rubric-view div { display: grid; justify-items: center; gap: 0; padding: 8px 4px; border: 1.5px solid var(--line); border-radius: var(--radius-s); text-align: center; }
.rubric-view span { font-size: .75rem; color: var(--muted); font-weight: 700; }
.rubric-view strong { font-family: var(--hand); font-size: 1.6rem; color: var(--red); line-height: 1.1; }

/* ---- words ---- */

.deck-hero { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; padding: 18px 16px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); }
.deck-hero.has-due { border-color: var(--ink); }
.deck-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 8px; }
.deck-text h2, .deck-text p { margin: 0; }
.deck-text .btn { justify-self: start; }
/* A little stack of index cards. */
.deck-stack { position: relative; flex: none; width: 66px; height: 82px; }
.deck-stack span { position: absolute; inset: 0; border-radius: 6px; background: var(--card); border: 1.5px solid var(--line); }
.deck-stack span:nth-child(1) { transform: rotate(-8deg) translate(-4px, 3px); }
.deck-stack span:nth-child(2) { transform: rotate(5deg) translate(4px, 1px); }
.deck-stack span:nth-child(3) {
  display: grid; place-items: center; border-color: var(--ink);
  background-color: var(--card);
  background-image: linear-gradient(var(--red), var(--red)), repeating-linear-gradient(to bottom, transparent 0, transparent 13px, var(--rule) 13px, var(--rule) 14px);
  background-size: 100% 1.5px, 100% 100%; background-position: 0 18px, 0 18px; background-repeat: no-repeat, repeat;
  font-weight: 800; font-size: 1.5rem; color: var(--ink);
}
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 26px; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stat { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 8px; text-align: center; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: var(--card); }
.stat-icon { display: none; }
.stat strong { display: block; font-size: 1.3rem; font-weight: 800; line-height: 1.15; }
.stat span { display: block; color: var(--muted); font-size: .8rem; font-weight: 650; }
.stat.is-hot { border-color: var(--red); }
.stat.is-hot strong { color: var(--red); }

.word-list { list-style: none; margin: 0; padding: 0; display: grid; }
.word-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: var(--pitch); padding: 9px 0; border-bottom: 1px dashed var(--line); }
.word-list li:last-child { border-bottom: 0; }
.word-tr { flex: 1 1 140px; min-width: 0; color: var(--muted); font-size: .93rem; }
.word-list form { margin: 0 0 0 auto; }
.suggest { list-style: none; margin: -8px 0 0; padding: 4px; display: grid; gap: 2px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.suggest button { width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); text-align: left; cursor: pointer; line-height: 1.3; }
.suggest button:active, .suggest button:focus-visible { background: var(--hl-soft); }
.suggest span { color: var(--muted); font-size: .88rem; }

/* Flashcards are index cards: a red head line, blue rules below. */
.flash-stage { perspective: 1200px; margin: 18px 0; }
.flashcard { position: relative; min-height: 340px; cursor: pointer; outline-offset: 6px; border-radius: 8px; }
.flash-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s var(--ease-out); }
.flashcard.is-flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 64px 24px 24px; text-align: center;
  background-color: var(--card);
  background-image: linear-gradient(var(--red), var(--red)), repeating-linear-gradient(to bottom, transparent 0, transparent 31px, var(--rule) 31px, var(--rule) 32px);
  background-size: 100% 1.5px, 100% 100%; background-position: 0 48px, 0 48px; background-repeat: no-repeat, repeat;
  border: 1.5px solid var(--line); border-radius: 8px;
  box-shadow: 4px 4px 0 var(--paper-2), 4px 4px 0 1.5px var(--line);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.flash-back { transform: rotateY(180deg); }
.flash-face p { margin: 0; }
.flash-face .pill { position: absolute; top: 12px; left: 14px; }
.flash-word { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; overflow-wrap: anywhere; }
.flash-ipa { color: var(--muted); font-size: 1.05rem; }
.flash-hint { position: absolute; bottom: 14px; left: 0; right: 0; color: var(--muted); font-family: var(--hand); font-size: 1.3rem; }
.flash-word-sm { position: absolute; top: 12px; left: 16px; font-weight: 750; color: var(--muted); font-size: 1rem; }
.flash-tr.is-long { font-size: 1.65rem; }
.flash-tr { font-family: var(--hand); font-size: 2.3rem; font-weight: 700; line-height: 1.15; color: var(--blue); }
.flash-say {
  position: absolute; top: 4px; right: 6px; z-index: 1;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: none; color: var(--blue); cursor: pointer;
}
.flash-say .icon { width: 26px; height: 26px; }
.flash-say.speaking { background: var(--blue); color: #fff; }
.grade-box { display: grid; gap: 4px; }
.grade-question { margin: 0; font-weight: 750; font-size: 1.08rem; }
.grade-help { margin: 0 0 8px; color: var(--muted); font-size: .9rem; }
.grade-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grade-row .grade-btn {
  display: grid; gap: 2px; justify-items: center; align-content: center; min-height: 64px; padding: 8px 6px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; color: var(--ink);
}
.grade-btn strong { font-size: 1.02rem; font-weight: 750; }
.grade-btn span { font-size: .82rem; font-weight: 600; color: var(--muted); }
.grade-btn:active:not(:disabled) { border-color: var(--ink); }
.grade-btn:disabled { opacity: .55; }
.grade-row .g-again { border-color: var(--red); }
.grade-row .g-again strong { color: var(--red); }
.grade-row .g-good strong { color: var(--blue); }
.grade-row .g-easy { background: var(--ink); border-color: var(--ink); }
.grade-row .g-easy strong, .grade-row .g-easy span { color: var(--on-ink); }
.flash-done { font-family: var(--hand); font-size: 3.4rem; font-weight: 700; color: var(--red); line-height: 1; }

/* ---- progress, exams, dashboard ---- */

.level-big { font-size: 3.4rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
/* The study calendar is a strip of squared paper filled in with ink. */
.heatmap { display: grid; grid-template-columns: repeat(10, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.heatmap span { aspect-ratio: 1; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--card); }
.heatmap .is-today { box-shadow: inset 0 0 0 2px var(--red); }
.hm-1 { background: color-mix(in srgb, var(--blue) 22%, var(--card)) !important; }
.hm-2 { background: color-mix(in srgb, var(--blue) 45%, var(--card)) !important; }
.hm-3 { background: color-mix(in srgb, var(--blue) 72%, var(--card)) !important; }
.hm-4 { background: var(--blue) !important; }
.heatmap-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 8px; font-size: .78rem; color: var(--muted); }
.heatmap-legend span[class] { width: 14px; height: 14px; border: 1px solid var(--line); background: var(--card); }

.level-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s); }
.level-row.is-current { border-color: var(--ink); }
.level-badge {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line); font-weight: 800; font-size: 1rem; color: var(--muted);
}
.is-current .level-badge, .student-card .level-badge { border: 2px solid var(--ink); color: var(--ink); background: var(--hl); }
.is-passed .level-badge { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.level-info { flex: 1 1 auto; min-width: 0; display: grid; gap: 6px; }
.level-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .92rem; font-weight: 650; }
.level-info .meter-track span, .student-card .meter-track span { background: var(--ink); }
.is-passed .meter-track span { background: var(--blue); }
.level-info form { margin: 0; }

.weak-row { display: grid; gap: 8px; padding: 12px 14px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s); }
.weak-row form { margin: 0; }
.weak-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.weak-meter span { background: var(--red); }
.weak-link { font-size: .93rem; font-weight: 700; text-decoration: none; min-height: 44px; display: flex; align-items: center; gap: 6px; }
.weak-link .icon { width: 18px; height: 18px; }

.student-card { display: grid; gap: 12px; }
.student-top { display: flex; gap: 12px; align-items: center; }
.student-top h2, .student-top p { margin: 0; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1.5px solid var(--line); border-radius: var(--radius-s); }
.mini-stats div { display: grid; justify-items: center; padding: 8px 2px; text-align: center; }
.mini-stats div + div { border-left: 1px solid var(--line); }
.mini-stats strong { font-size: 1.25rem; font-weight: 800; line-height: 1.15; }
.mini-stats span { font-size: .72rem; color: var(--muted); font-weight: 650; line-height: 1.2; }
.mini-stats .is-bad strong { color: var(--red); }

.exam-scores { display: grid; gap: 12px; }
.exam-section { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.exam-section span { font-weight: 700; }
.exam-section small { color: var(--muted); font-weight: 600; }
.exam-section strong { font-family: var(--hand); font-size: 1.6rem; color: var(--blue); line-height: 1; }
.exam-section .meter-track { grid-column: 1 / -1; }
.exam-section .meter-track span { background: var(--blue); }
.exam-section.is-low .meter-track span { background: var(--red); }
.exam-section.is-low strong { color: var(--red); }
/* The verdict is stamped onto the page. */
.exam-verdict { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.exam-verdict strong { font-family: var(--hand); font-size: 3rem; font-weight: 700; line-height: 1; }
.exam-verdict span {
  padding: 4px 14px; border: 3px solid currentColor; border-radius: 8px;
  font-weight: 800; font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase;
  transform: rotate(-4deg); animation: stamp .45s .2s var(--ease-out) both;
}
.exam-verdict.is-pass { color: var(--blue); }
.exam-verdict.is-fail { color: var(--red); }
.exam-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; counter-reset: step; }
.exam-steps li { position: relative; display: grid; gap: 2px; padding: 8px 0 10px 40px; border-bottom: 1px dashed var(--line); }
.exam-steps li:last-child { border-bottom: 0; }
.exam-steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 8px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid var(--line); color: var(--muted); font-weight: 800; font-size: .85rem;
}
.exam-steps li.is-now::before { border: 2px solid var(--ink); color: var(--ink); background: var(--hl); }
.exam-steps li.is-done::before { content: "✓"; border-color: var(--blue); color: var(--blue); background: var(--blue-soft); font-family: system-ui, sans-serif; }
.exam-steps span { color: var(--muted); font-size: .9rem; }

/* ---- teacher helper: suggestions, report, weekly plan ---- */

a.student-card { color: inherit; text-decoration: none; }
a.student-card:active { border-color: var(--ink); }
.student-more {
  margin-left: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 2px;
  color: var(--blue); font-weight: 750; font-size: .92rem; white-space: nowrap;
}
.student-more .icon { width: 17px; height: 17px; }

.idea-intro { margin: -2px 0 14px; color: var(--muted); font-size: .92rem; }
.idea-intro strong { color: var(--ink-2); }
/* A suggestion is an index card the teacher can send as it is. */
.idea {
  display: grid; gap: 10px; padding: 14px 14px 14px 16px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--rule);
}
.idea-head { display: flex; align-items: center; gap: 12px; }
.idea-name { flex: 1 1 auto; min-width: 0; }
.idea-name h3 { margin: 0; font-size: 1.08rem; line-height: 1.25; }
.idea-kicker { margin: 0 0 1px; font-family: var(--hand); font-size: 1.3rem; font-weight: 600; line-height: 1; color: var(--blue); }
.idea-dismiss { align-self: flex-start; margin: -4px -4px 0 0; border-color: transparent; background: transparent; color: var(--muted); }
.idea-why { margin: 0; font-weight: 650; color: var(--ink-2); line-height: 1.4; }
.idea-details { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; color: var(--muted); font-size: .9rem; line-height: 1.35; }
.idea-details li { position: relative; padding-left: 14px; }
.idea-details li::before { content: "–"; position: absolute; left: 0; }
.idea-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 2px 0 0; }

.report-head .hint { margin: 4px 0 0; }
.summary-note { padding: 14px 16px; margin-bottom: 12px; background: var(--blue-soft); border-radius: var(--radius-s); }
.summary-note p { margin: 0; line-height: 1.55; white-space: pre-line; }
#summary form + .hint { margin: 8px 0 0; font-size: .85rem; }

/* Week numbers on squared paper. */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  border-top: 1.5px solid var(--line); border-left: 1.5px solid var(--line);
  background: var(--card);
}
.stat {
  display: grid; align-content: start; gap: 1px; padding: 10px 12px 12px;
  border-right: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line);
}
.stat strong { font-size: 1.55rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat strong small { font-size: .95rem; font-weight: 700; color: var(--muted); }
.stat > span { font-size: .85rem; font-weight: 650; color: var(--ink-2); }
.stat .stat-before { font-size: .78rem; font-weight: 600; color: var(--muted); }

.topic-list, .lesson-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.topic { display: grid; gap: 5px; padding: 10px 0 12px; border-bottom: 1px dashed var(--line); }
.topic:last-child { border-bottom: 0; }
.topic-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.topic-acc { font-family: var(--hand); font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--blue); }
.topic-acc.is-low { color: var(--red); }
.topic-meter span { background: var(--blue); }
.topic-meter.is-low span { background: var(--red); }
.topic-sub { margin: 0; color: var(--muted); font-size: .86rem; }
.topic form { margin: 0; }
.text-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0; margin: -6px 0 -10px;
  border: 0; background: none; color: var(--blue); font: inherit; font-size: .93rem; font-weight: 700; cursor: pointer;
}
.text-link .icon { width: 17px; height: 17px; }
.trend { display: inline-flex; align-items: center; gap: 2px; }
.trend .icon { width: 15px; height: 15px; }
.trend.is-up { color: var(--blue); font-weight: 700; }
.trend.is-down { color: var(--red); font-weight: 700; }

.lesson-row { padding: 10px 12px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius-s); }
.lesson-row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.lesson-row-top strong { min-width: 0; line-height: 1.3; }
.lesson-row-top .pill, .lesson-row-top .hint { flex: none; }
.lesson-row-sub { margin: 3px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.4; }
details.learned { margin-top: 10px; }
details.learned > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; min-height: var(--tap);
  font-weight: 700; color: var(--ink-2); cursor: pointer;
}
details.learned > summary::-webkit-details-marker { display: none; }
details.learned > summary::after {
  content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s;
}
details.learned[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.err-example { margin: 6px 0 0; font-size: .95rem; line-height: 1.4; overflow-wrap: anywhere; }
.err-example s { color: var(--red); text-decoration-thickness: 1.5px; }
.err-example s + span { color: var(--muted); }
.err-example s ~ span:last-child { color: var(--blue); font-weight: 700; }

/* An on/off switch drawn like a pen-outlined pill. */
.switch-row { display: flex; align-items: flex-start; gap: 12px; padding: 4px 0; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  position: relative; flex: none; width: 50px; height: 30px; margin-top: 1px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: var(--card);
  transition: background-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--ink); transition: transform .2s var(--ease-out), background-color .2s;
}
.switch-row input:checked + .switch { background: var(--blue); border-color: var(--blue); }
.switch-row input:checked + .switch::after { transform: translateX(20px); background: #fff; }
.switch-row input:focus-visible + .switch { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.switch-row strong { display: block; line-height: 1.3; }
.switch-row small { display: block; margin-top: 2px; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.plan-form { gap: 18px; }
.plan-days { display: grid; gap: 16px; }
.plan-day { margin: 0; padding: 0 0 14px; border: 0; border-bottom: 1px dashed var(--line); min-width: 0; }
.plan-day:last-child { border-bottom: 0; padding-bottom: 0; }
.plan-day legend { padding: 0; margin-bottom: 8px; font-weight: 750; }

@media (min-width: 420px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

.mt { margin-top: 14px; }
.mt-l { margin-top: 28px; }

@media (min-width: 560px) {
  .create-grid { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .grade path { stroke-dashoffset: 0; }
}
