@font-face { font-family: "Schola"; src: url(fonts/texgyreschola-regular.c65b32538c.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Schola"; src: url(fonts/texgyreschola-italic.028989ee46.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Schola"; src: url(fonts/texgyreschola-bold.8516ee2872.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Schola"; src: url(fonts/texgyreschola-bolditalic.f5fb5c3ae8.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }

/* Squared school notebook (zeszyt w kratkę) in light mode, school blackboard in dark mode. */
:root {
  --cell: 1.25rem;
  --paper: #F8FAF7;
  --grid: #DCE6EE;
  --margin: #E06873;
  --ink: #24357F;
  --ink-soft: #6070AE;
  --typed: #24357F;
  --graphite: #5C6370;
  --faint: #6B7380;
  --redpen: #C42633;
  --tick: #2C7A4F;
  --wash: rgba(36, 53, 127, 0.08);
  --wash-strong: rgba(36, 53, 127, 0.16);
  --lvl0: transparent;
  --lvl1: #B9C6EA;
  --lvl2: #6F80C4;
  --lvl3: #24357F;
  --heat0: rgba(36, 53, 127, 0.05);
  --heat1: #C9D3F0;
  --heat2: #8F9DD6;
  --heat3: #5466AE;
  --heat4: #24357F;
  --focus: #24357F;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1E2925;
    --grid: #283630;
    --margin: #9A4C55;
    --ink: #ECF0E6;
    --ink-soft: #B8C4B5;
    --typed: #F2DB8C;
    --graphite: #A7B2A5;
    --faint: #8F9C92;
    --redpen: #FF8F8F;
    --tick: #8FD4A7;
    --wash: rgba(236, 240, 230, 0.07);
    --wash-strong: rgba(236, 240, 230, 0.14);
    --lvl1: #4A5C53;
    --lvl2: #8FA394;
    --lvl3: #ECF0E6;
    --heat0: rgba(236, 240, 230, 0.05);
    --heat1: #3B4C44;
    --heat2: #5E7568;
    --heat3: #93AB9B;
    --heat4: #E3EADF;
    --focus: #F2DB8C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --paper: #1E2925;
    --grid: #283630;
    --margin: #9A4C55;
    --ink: #ECF0E6;
    --ink-soft: #B8C4B5;
    --typed: #F2DB8C;
    --graphite: #A7B2A5;
    --faint: #8F9C92;
    --redpen: #FF8F8F;
    --tick: #8FD4A7;
    --wash: rgba(236, 240, 230, 0.07);
    --wash-strong: rgba(236, 240, 230, 0.14);
    --lvl1: #4A5C53;
    --lvl2: #8FA394;
    --lvl3: #ECF0E6;
    --heat0: rgba(236, 240, 230, 0.05);
    --heat1: #3B4C44;
    --heat2: #5E7568;
    --heat3: #93AB9B;
    --heat4: #E3EADF;
    --focus: #F2DB8C;
    color-scheme: dark;
  }

* { box-sizing: border-box; }
html { font-size: clamp(16px, calc(9.6px + 0.5vw), 24px); }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: "Schola", "Century Schoolbook", Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  -webkit-font-smoothing: antialiased;
}
/* the red margin line */
body::before {
  content: ""; position: fixed; top: 0; bottom: 0; left: 4.9375rem; width: 2px;
  background: var(--margin); opacity: .85; pointer-events: none; z-index: 0;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 0.1875rem; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  position: relative; z-index: 1;
  display: flex; align-items: baseline; justify-content: space-between;
  height: 5rem; padding: 1.875rem 2.5rem 0 7.5rem;
}
.top { max-width: 62.5rem; }
.brand { font-style: italic; font-size: 1.5rem; text-decoration: none; letter-spacing: .01em; }
.top nav { display: flex; gap: 1.75rem; font-size: 1rem; }
.top nav a { text-decoration: none; color: var(--graphite); padding-bottom: 2px; border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

main { position: relative; z-index: 1; padding: 1.25rem 2.5rem 6.25rem 7.5rem; max-width: 62.5rem; }
main:focus, main:focus-visible { outline: none; }

/* ---------- shared type ---------- */
h1, h2, h3 { font-weight: 700; margin: 0; }
h2 { font-size: 1.375rem; line-height: 2.5rem; }
p { margin: 0; }
.muted { color: var(--graphite); }
.small { font-size: 0.875rem; }
.pl { font-family: "Schola", serif; }

.btn {
  display: inline-flex; align-items: center; gap: 0.625rem;
  height: 2.5rem; padding: 0 1.375rem; border: 2px solid var(--ink); border-radius: 0.1875rem;
  background: var(--ink); color: var(--paper); cursor: pointer; font-size: 1.0625rem; text-decoration: none;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--wash); filter: none; }
.btn:disabled { opacity: .45; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 0.1875rem; cursor: pointer; }
.linkbtn.quiet { color: var(--graphite); }
kbd { font-family: inherit; font-size: 0.75rem; color: var(--graphite); border: 1px solid var(--faint); border-radius: 0.1875rem; padding: 0 0.25rem; }

/* ---------- today ---------- */
.date-line { text-align: right; font-style: italic; font-size: 1.1875rem; color: var(--graphite); line-height: 2.5rem; }
.today-lead { font-size: 1.6875rem; line-height: 2.5rem; max-width: 30ch; margin-top: 1.25rem; }
.today-lead strong { font-weight: 700; }
.today-sub { margin-top: 1.25rem; color: var(--graphite); max-width: 60ch; line-height: 1.25rem; }
.today-actions { margin-top: 2.5rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.section { margin-top: 5rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; }
.legend { display: flex; gap: 1.125rem; flex-wrap: wrap; font-size: 0.875rem; color: var(--graphite); }
.legend i { display: inline-block; width: 0.625rem; height: 0.625rem; margin-right: 0.375rem; vertical-align: -1px; border: 1px solid var(--ink-soft); }
.deckmap-wrap { margin-top: 1.25rem; position: relative; }
.map-toggle { margin-top: 1.25rem; }
.deckmap canvas { display: block; }
.stats-row { display: flex; gap: 3rem; flex-wrap: wrap; margin-top: 1.25rem; align-items: flex-start; }
.stat-list { display: grid; grid-template-columns: max-content auto; column-gap: 1.5rem; row-gap: 0; line-height: 2.5rem; margin: 0.625rem 0 0; }
.stat-list dt { color: var(--graphite); }
.stat-list dd { margin: 0; font-weight: 700; }
.stat-list dd.rates { font-weight: 400; }
.stat-list dd.rates b { font-weight: 700; }

#tip {
  position: fixed; z-index: 10; pointer-events: none; max-width: 21.25rem;
  background: var(--paper); border: 1.5px solid var(--ink); padding: 0.375rem 0.625rem; font-size: 0.9375rem; line-height: 1.25rem;
  box-shadow: 0.1875rem 0.1875rem 0 var(--wash-strong);
}

/* ---------- study ---------- */
.study-head { display: flex; justify-content: space-between; align-items: baseline; line-height: 2.5rem; color: var(--graphite); }
.mode { font-style: italic; font-size: 1.1875rem; }
.left { font-size: 0.9375rem; }
.progress { height: 2px; background: var(--wash-strong); margin-bottom: 2.5rem; }
.progress > div { height: 100%; background: var(--ink); transition: width .25s; }

.prompt-word { font-size: 2.875rem; line-height: 3.75rem; font-weight: 700; letter-spacing: .005em; }
.prompt-gloss { font-size: 1.25rem; font-style: italic; color: var(--graphite); line-height: 2.5rem; }
.sentences { margin: 1.25rem 0 0; padding: 0; list-style: none; font-size: 1.4375rem; line-height: 2.5rem; max-width: 34em; }
.sentences.numbered { counter-reset: s; }
.sentences.numbered li { counter-increment: s; position: relative; }
.sentences.numbered li::before { content: counter(s) "."; position: absolute; left: -2rem; color: var(--faint); font-size: 1.125rem; }
.sentences .target { text-decoration-skip-ink: none; text-decoration: underline; text-decoration-color: var(--ink-soft); text-decoration-thickness: 2px; text-underline-offset: 0.3125rem; }
.en-sentence { font-size: 1.1875rem; line-height: 2.5rem; color: var(--graphite); max-width: 40em; }
.speak {
  display: inline-flex; vertical-align: middle; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; margin-left: 0.625rem; border: 1.5px solid var(--ink-soft); border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer; position: relative; top: -2px;
}
.speak:hover { background: var(--wash); }
.speak svg { width: 1rem; height: 1rem; }

.answer-row { margin-top: 2.5rem; }
.answer {
  font-family: "Schola", serif; font-size: 1.625rem; line-height: 2.5rem; height: 2.75rem;
  width: min(35rem, 100%); padding: 0 0.25rem; color: var(--typed); caret-color: var(--typed);
  background: transparent; border: 0; border-bottom: 2px solid var(--ink-soft); border-radius: 0; outline: none;
}
.answer::placeholder { color: var(--faint); font-style: italic; font-size: 1.1875rem; }
.answer:focus { border-bottom: 0.1875rem solid var(--focus); }
.gap-sentence { font-size: 1.625rem; line-height: 3.75rem; max-width: 32em; }
.gap-input {
  font-family: "Schola", serif; font-size: 1.625rem; height: 2.5rem; padding: 0 0.25rem; min-width: 5ch;
  color: var(--typed); caret-color: var(--typed); background: var(--wash); border: 0; border-bottom: 2px solid var(--ink-soft);
  outline: none; text-align: center; border-radius: 2px 2px 0 0;
}
.gap-input:focus { border-bottom: 0.1875rem solid var(--focus); }
.gap-filled { padding: 0 0.1875rem; background: var(--wash); border-bottom: 2px solid var(--ink); }
/* the other words of the key word's phrase ("przyniósł … korzyści"): underlined to go with it */
.phrase { text-decoration-skip-ink: none; text-decoration: underline; text-decoration-color: var(--ink-soft); text-decoration-thickness: 2px; text-underline-offset: 0.3125rem; }
.hint-line { font-size: 1.0625rem; color: var(--graphite); line-height: 2.5rem; }
.hint-line b { color: var(--ink); font-weight: 700; }

.letters { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 1.25rem; }
.letters button {
  width: 2.25rem; height: 2.25rem; border: 1px solid var(--faint); background: var(--paper); border-radius: 2px;
  font-family: "Schola", serif; font-size: 1.25rem; cursor: pointer; color: var(--ink);
}
.letters button:hover { border-color: var(--ink); background: var(--wash); }
.keys-hint { margin-top: 0.625rem; font-size: 0.875rem; color: var(--graphite); line-height: 1.25rem; }

/* feedback: the teacher's red pen */
.feedback { margin-top: 2.5rem; }
.verdict { font-size: 1.1875rem; line-height: 2.5rem; font-style: italic; }
.verdict.good { color: var(--tick); }
.verdict.bad { color: var(--redpen); }
.yours { font-size: 1.625rem; line-height: 2.5rem; color: var(--typed); }
.yours s { text-decoration-color: var(--redpen); text-decoration-thickness: 2px; }
.redpen {
  font-family: "Schola", serif; font-style: italic; color: var(--redpen); font-size: 2.125rem; line-height: 3.125rem;
  display: inline-block; transform: rotate(-1.2deg); transform-origin: left center; margin-left: 2px;
}
.redpen .fix { text-decoration-skip-ink: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.25rem; }
.accept-mine { margin-top: 0.25rem; font-size: 0.9375rem; }

.reveal { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1.5px dashed var(--faint); max-width: 44em; }
.reveal .en-word { font-size: 1.75rem; line-height: 2.5rem; font-weight: 700; }
.reveal .pl-word { font-size: 1.875rem; line-height: 2.5rem; font-weight: 700; }
.sense { margin-top: 0.625rem; }
.sense .gloss { font-style: italic; color: var(--graphite); }
.sense .ex { font-size: 1.1875rem; line-height: 1.875rem; }
.lit { font-size: 0.9375rem; line-height: 1.25rem; color: var(--graphite); font-style: italic; }
.grammar { margin-top: 0.625rem; font-size: 1.0625rem; line-height: 1.875rem; }
.grammar b { font-weight: 700; }

.grades { display: flex; flex-wrap: wrap; }
.grades button {
  width: 8.75rem; height: 3.75rem; margin-right: -2px; border: 2px solid var(--ink-soft); background: var(--paper);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.25rem; position: relative;
}
.grades button:hover { background: var(--wash); }
.grades button .k { position: absolute; top: 0.1875rem; left: 0.375rem; font-size: 0.75rem; color: var(--faint); }
.grades button .lbl { font-size: 1.125rem; }
.grades button .ivl { font-size: 0.875rem; color: var(--graphite); }
.grades button.suggested { background: var(--ink); color: var(--paper); border-color: var(--ink); z-index: 1; }
.grades button:focus-visible { z-index: 2; }
.grades button.suggested .ivl, .grades button.suggested .k { color: var(--paper); opacity: .8; }
.gradebar {
  position: sticky; bottom: 0; z-index: 3; margin-top: 2.5rem; padding: 0.875rem 0 1rem;
  background: var(--paper); box-shadow: 0 -1.5px 0 var(--grid);
}
.study-foot { margin-top: 0.75rem; font-size: 0.875rem; color: var(--graphite); line-height: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0; }
.study-foot .foot-right { margin-left: auto; padding-left: 1.25rem; }
.study-foot.nudge { animation: nudge .5s; }
@keyframes nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-0.25rem); } 75% { transform: translateX(0.25rem); } }
.tick { color: var(--tick); }
.redpen.ink { color: var(--ink); transform: none; }
.page-title { font-size: 2.125rem; line-height: 2.5rem; font-weight: 700; }
.intro { margin-top: 1.25rem; max-width: 62ch; line-height: 1.5rem; color: var(--ink); }
.legend i.lg0 { border: 0; background: none; position: relative; }
.legend i.lg0::after { content: ""; position: absolute; left: 0.25rem; top: 0.25rem; width: 2px; height: 2px; background: var(--faint); }
.legend i.lg1 { background: var(--lvl1); border-color: var(--lvl1); }
.legend i.lg2 { background: var(--lvl2); border-color: var(--lvl2); }
.legend i.lg3 { background: var(--lvl3); border-color: var(--lvl3); }
.legend i.lgs { border-color: var(--redpen); }
.words-legend { margin-top: 1.25rem; align-items: center; }
.words-legend .mark { display: inline-block; vertical-align: -2px; margin-right: 0.375rem; width: 0.75rem; height: 0.75rem; }
#toast {
  position: fixed; left: 7.5rem; bottom: 1.25rem; z-index: 30; max-width: 35rem;
  background: var(--paper); border: 1.5px solid var(--ink); color: var(--ink); padding: 0.625rem 0.875rem; line-height: 1.25rem; font-size: 0.9375rem;
  box-shadow: 0.1875rem 0.1875rem 0 var(--wash-strong);
}
@media (max-height: 820px) {
  .prompt-word { font-size: 2.375rem; line-height: 3.125rem; }
  .sentences { margin-top: 0.625rem; line-height: 2.25rem; }
  .answer-row, .feedback, .reveal { margin-top: 1.25rem; }
  .progress { margin-bottom: 1.25rem; }
  .reveal { padding-top: 0.75rem; }
  .gradebar { margin-top: 1.25rem; padding: 0.625rem 0 0.75rem; }
  .grades button { height: 3.25rem; }
}

.done-title { font-size: 2.125rem; line-height: 3.75rem; font-style: italic; }

/* ---------- words ---------- */
.words-tools { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; margin-top: 1.25rem; }
.search {
  font-family: "Schola", serif; font-size: 1.25rem; height: 2.5rem; width: min(23.75rem, 100%); padding: 0 0.25rem;
  color: var(--typed); background: transparent; border: 0; border-bottom: 2px solid var(--ink-soft); outline: none;
}
.search:focus { border-bottom-color: var(--focus); }
.chips { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.chips button { height: 2rem; padding: 0 0.75rem; border: 1.5px solid var(--faint); background: var(--paper); border-radius: 1rem; cursor: pointer; font-size: 0.9375rem; color: var(--graphite); }
.chips button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--wash); }
/* rows sit on the page grid: each is two cells tall and starts half a cell below a grid line (snapGrid in modules/words.js),
   so its word is written between two lines and no extra divider is drawn */
.wlist { margin-top: 1.25rem; }
.wrow {
  display: grid; grid-template-columns: 3.25rem minmax(0, 1.3fr) minmax(0, 1fr) 5.625rem; align-items: center; gap: 0.75rem;
  height: calc(2 * var(--cell)); padding: 0 0.5rem; cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
  font-size: 1.0625rem; color: var(--ink);
}
/* the highlight fills the grid row the word is written in */
.wrow:hover, .wrow[aria-expanded="true"] {
  background: linear-gradient(transparent calc(.5 * var(--cell) + 1px), var(--wash) 0, var(--wash) calc(1.5 * var(--cell)), transparent 0);
}
.wrow[aria-expanded="true"] { background: linear-gradient(transparent calc(.5 * var(--cell) + 1px), var(--wash) 0); }
.wrow .rk { color: var(--faint); font-size: 0.875rem; }
.wrow .plw { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow .enw { color: var(--graphite); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marks { display: flex; gap: 0.375rem; justify-content: flex-end; }
.mark { width: 0.875rem; height: 0.875rem; border: 1.5px solid var(--ink-soft); }
.mark.learning { background: linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%); }
.mark.review { background: var(--lvl2); border-color: var(--lvl2); }
.mark.strong { background: var(--lvl3); border-color: var(--lvl3); }
.mark.na { border-style: dotted; border-color: var(--faint); }
.mark.susp { border-color: var(--redpen); }
/* the details stop half a cell short, on the grid line above the next word */
.wdetail { padding: 0.625rem 0.5rem 1.875rem 4.5rem; background: linear-gradient(var(--wash), var(--wash)) top / 100% calc(100% - .5 * var(--cell)) no-repeat; }
.wdetail .sense { margin-top: 0.875rem; }
.wdetail .states { margin-top: 1rem; font-size: 0.9375rem; line-height: 1.5rem; color: var(--graphite); }
.wdetail .acts { margin-top: 1rem; display: flex; gap: 1.375rem; flex-wrap: wrap; font-size: 0.9375rem; }
.more { margin-top: 1.25rem; }

/* ---------- settings ---------- */
.settings { max-width: 40rem; }
.field { margin-top: 2.5rem; }
.field > label, .field > .label { display: block; font-weight: 700; line-height: 1.875rem; }
.field .help { color: var(--graphite); font-size: 0.9375rem; line-height: 1.25rem; margin-bottom: 0.5rem; }
.num {
  font-family: "Schola", serif; font-size: 1.25rem; width: 5.625rem; height: 2.5rem; padding: 0 0.375rem; color: var(--typed);
  background: var(--paper); border: 1.5px solid var(--ink-soft); border-radius: 2px;
}
.opts { display: flex; flex-direction: column; gap: 2px; }
.opts label { display: flex; gap: 0.625rem; align-items: center; line-height: 1.875rem; cursor: pointer; }
.opts input { accent-color: var(--ink); width: 1rem; height: 1rem; }
select.sel { font-family: "Schola", serif; font-size: 1rem; height: 2.25rem; color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink-soft); border-radius: 2px; padding: 0 0.375rem; max-width: 100%; }
.saved-note { color: var(--tick); font-style: italic; font-size: 0.9375rem; margin-left: 0.75rem; }

#banner {
  position: fixed; left: 7.5rem; right: 2.5rem; bottom: 1.25rem; z-index: 20;
  background: var(--paper); border: 2px solid var(--redpen); color: var(--redpen); padding: 0.625rem 0.875rem; line-height: 1.25rem;
}

@media (max-width: 720px) {
  body::before { left: 1.9375rem; }
  #toast { left: 1rem; right: 1rem; }
  .study-foot .foot-right { margin-left: 0; padding-left: 0; }
  .top { padding: 1.25rem 1rem 0 3rem; height: auto; flex-wrap: wrap; gap: 0.5rem; }
  main { padding: 1.25rem 1rem 5rem 3rem; }
  .prompt-word { font-size: 2.25rem; line-height: 3rem; }
  .grades button { width: 25%; min-width: 0; }
  .wrow { grid-template-columns: 2.5rem minmax(0, 1fr) 4.375rem; }
  .wrow .enw { display: none; }
  .wdetail { padding-left: 0.75rem; }
  #banner { left: 1rem; right: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ================= v1.2: progress visuals and study polish ================= */
.top nav { gap: 1.625rem; }

/* entrance: one quiet movement per card */
.stage { animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(0.375rem); } to { opacity: 1; transform: none; } }
.stage.shown:not(.fresh) { animation: none; }
/* the red pen writes its correction in, once */
.stage.fresh .redpen { animation: write .55s ease-out .05s both; }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.tick-svg { width: 1.5rem; height: 1.5rem; vertical-align: -3px; fill: none; stroke: var(--tick); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.stage.fresh .tick-svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .35s ease-out .1s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.tick { color: var(--tick); }

/* study head */
.mode-name { font-size: 1.3125rem; }
.mode .small { margin-left: 0.375rem; }

/* grade buttons: a coloured rule says which is which at a glance */
.grades button { border-top-width: 0.25rem; }
.grades button.g1 { border-top-color: var(--redpen); }
.grades button.g2 { border-top-color: var(--faint); }
.grades button.g3 { border-top-color: var(--ink-soft); }
.grades button.g4 { border-top-color: var(--tick); }
.grades button.suggested { border-top-color: inherit; }
.grades button.suggested.g1 { background: var(--redpen); border-color: var(--redpen); }

/* session squares (done screens) */
.session-squares { display: flex; flex-wrap: wrap; gap: 0.1875rem; margin-top: 1.875rem; max-width: 47.5rem; }
.sq { display: inline-block; width: 0.875rem; height: 0.875rem; border-radius: 2px; }
.sq.g1 { background: var(--redpen); }
.sq.g2 { background: var(--faint); }
.sq.g3 { background: var(--ink-soft); }
.sq.g4 { background: var(--tick); }
.sq-legend { margin-top: 0.625rem; }
.sq-legend .sq { width: 0.625rem; height: 0.625rem; margin-right: 0.375rem; vertical-align: -1px; }

/* today: at-a-glance boxes, drawn on the squares like workbook answer boxes */
.today-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; margin-top: 3.75rem; }
.glance { border: 1.5px solid var(--ink-soft); padding: 0.625rem 0.875rem 0.75rem; min-height: 5rem; display: flex; flex-direction: column; justify-content: space-between; background: var(--paper); }
.g-num { font-size: 1.875rem; line-height: 2.5rem; font-weight: 700; }
.g-lbl { font-size: 0.875rem; color: var(--graphite); line-height: 1.125rem; }
.section .muted a { color: var(--ink); }

/* progress page */
.progress-lede { font-size: 1.375rem; line-height: 2.125rem; margin-top: 1.25rem; max-width: 34em; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; margin: 1.875rem 0 0; }
.stat-strip > div { border-top: 2px solid var(--ink); padding-top: 0.5rem; }
.stat-strip dt { color: var(--graphite); font-size: 0.875rem; }
.stat-strip dd { margin: 0; font-size: 1.375rem; line-height: 2rem; font-weight: 700; }
.chart { margin-top: 1rem; overflow-x: auto; }
.chart svg, .multiples svg { display: block; overflow: visible; }
svg .ax { font: 12px "Schola", serif; fill: var(--graphite); }
svg .gl { stroke: var(--grid); stroke-width: 1; }
svg .hc { stroke: none; }
svg .hc.h0 { fill: var(--heat0); }
svg .hc.h1 { fill: var(--heat1); }
svg .hc.h2 { fill: var(--heat2); }
svg .hc.h3 { fill: var(--heat3); }
svg .hc.h4 { fill: var(--heat4); }
svg .hc:hover { stroke: var(--ink); stroke-width: 1.5; }
svg .bar { fill: var(--ink-soft); }
svg .bar.today { fill: var(--ink); }
svg .hit { fill: transparent; cursor: default; }
svg .hit:hover { fill: var(--wash); }
svg .target { stroke: var(--tick); stroke-width: 1.5; stroke-dasharray: 4 4; }
svg .rline { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
svg .rdot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.heat-legend { margin-top: 0.625rem; align-items: center; gap: 0.375rem; }
.heat-legend i, .mem-legend i { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; border: 0; margin: 0; vertical-align: -1px; }
.mem-legend i { margin-right: 0.375rem; }
.legend i.h0 { background: var(--heat0); }
.legend i.h1 { background: var(--heat1); }
.legend i.h2 { background: var(--heat2); }
.legend i.h3 { background: var(--heat3); }
.legend i.h4 { background: var(--heat4); }
.heat-legend .muted { margin-left: 0.625rem; }
.mem-legend { margin-top: 0.625rem; }
.multiples { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 1rem; }
.mult { margin: 0; }
.mult figcaption { font-weight: 700; line-height: 1.875rem; }

.help.error { color: var(--redpen); }

@media (max-width: 720px) {
  .today-stats, .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.mem-legend i.lgs { border: 1.5px solid var(--redpen); background: none; }
.mem-legend i.lg0 { width: 0.75rem; }

/* ================= large windows: the notebook grows with the window ================= */
.today-top { display: block; }
@media (min-width: 1400px) {
  .top, main { max-width: 88rem; }
  .today-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "main stats" "main map"; column-gap: 3.75rem; align-items: start; }
  .today-main { grid-area: main; }
  .today-top .today-stats { grid-area: stats; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.25rem; }
  .today-top .today-map { grid-area: map; margin-top: 2.5rem; }
  .today-top .today-map .section-head { display: block; }
  .today-top .today-map .legend { margin-top: 0.25rem; }
  .today-lead { max-width: 28ch; }
  /* answer screen: what you typed on the left, the explanation on the right, grades across the bottom */
  .stage.shown { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 3.75rem; align-items: start; }
  .stage.shown > * { grid-column: 1; }
  .stage.shown > .reveal { grid-column: 2; grid-row: 1 / span 8; margin-top: 0; padding: 0.5rem 0 0 2.5rem; border-top: 0; border-left: 1.5px dashed var(--faint); max-width: none; }
  .stage.shown > .gradebar { grid-column: 1 / -1; }
  .stage:not(.shown) { max-width: 64rem; }
  .settings { max-width: 50rem; }
  .wrow { grid-template-columns: 3.25rem minmax(0, 1.3fr) minmax(0, 1fr) 6rem; }
}

/* ================= today's amount, "More", finish line ================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chooser { margin-top: 1.25rem; padding: 1rem 1.25rem 1.25rem; border: 1.5px solid var(--ink-soft); background: var(--paper); max-width: 40rem; }
.chooser-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 0.625rem; }
.chooser-row:first-child { margin-top: 0; }
.c-lbl { width: 10.5rem; font-weight: 700; }
.chooser .chips button { min-width: 2.75rem; }
.chooser-est { margin-top: 1rem; line-height: 1.5rem; }
.chooser .today-actions { margin-top: 1rem; }
.chosen-line { margin-top: 1rem; font-size: 0.9375rem; color: var(--graphite); font-style: italic; }
.finish-line { margin-top: 0.75rem; font-size: 0.9375rem; color: var(--graphite); max-width: 40rem; line-height: 1.375rem; }
.finish-line b { color: var(--ink); }
.finish-line a { color: var(--ink); }

.more-block { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1.5px dashed var(--faint); max-width: 44rem; }
.more-title { font-size: 1.375rem; line-height: 2.5rem; }
.more-block .today-actions { margin-top: 0.75rem; }
.more-btn { font-size: 1.25rem; height: 3rem; padding: 0 2rem; letter-spacing: .02em; }
.more-ahead { margin-top: 0.75rem; }

.planner .plan-controls { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; margin-top: 1rem; }
.plan-slider { display: flex; align-items: center; gap: 1rem; }
.plan-slider input[type=range] { width: 22rem; max-width: 60vw; accent-color: var(--ink); }
.plan-num { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; min-width: 13rem; }
.plan-num .num { width: 4.75rem; }
.num.plan-day { width: auto; }
.plan-result { margin-top: 1.25rem; max-width: 46rem; line-height: 1.6rem; transition: opacity .15s; min-height: 7.5rem; }
#planCharts { min-height: 13.5rem; }
.plan-result.busy { opacity: .45; }
.plan-result p + p { margin-top: 0.5rem; }
.plan-big { font-size: 1.375rem; line-height: 2rem; }
.plan-actions { margin-top: 1rem; }
.plan-pace { margin-top: 0.75rem; }

/* card state label in the study header */
.state-badge {
  display: inline-flex; align-items: center; gap: 0.4375rem; margin-left: 0.875rem; padding: 0 0.5625rem; height: 1.625rem;
  font-style: normal; font-size: 0.875rem; color: var(--graphite); border: 1px solid var(--faint); border-radius: 0.8125rem;
  vertical-align: 0.125rem; white-space: nowrap; background: var(--paper);
}
.state-badge i { display: inline-block; width: 0.625rem; height: 0.625rem; border: 1.5px solid currentColor; border-radius: 2px; }
.state-badge.s-new { color: var(--ink); border-color: var(--ink); font-weight: 700; }
.state-badge.s-learning i { background: linear-gradient(135deg, currentColor 50%, transparent 50%); }
.state-badge.s-review i { background: currentColor; }
.state-badge.s-relearn { color: var(--redpen); border-color: var(--redpen); }
.state-badge.s-relearn i { background: linear-gradient(135deg, currentColor 50%, transparent 50%); }
@media (max-width: 720px) { .state-badge { margin: 0.375rem 0 0; display: flex; width: fit-content; } }

/* ================= memory hooks, tricky words, notes ================= */
:root { --hook-bg: #FFF3BF; --hook-edge: #D9B23A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hook-bg: rgba(242, 219, 140, 0.12); --hook-edge: #F2DB8C; } }
:root[data-theme="dark"] { --hook-bg: rgba(242, 219, 140, 0.12); --hook-edge: #F2DB8C; }
.hook-slot:empty { display: none; }
.hook { margin-top: 1.25rem; padding: 0.625rem 0.875rem 0.75rem; background: var(--hook-bg); border-left: 3px solid var(--hook-edge); max-width: 40rem; line-height: 1.5rem; }
.hook-lbl { display: block; font-size: 0.875rem; color: var(--graphite); font-style: italic; }
.hook-text { font-size: 1.1875rem; color: var(--ink); }
.hook-row { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.375rem; flex-wrap: wrap; }
.hook-input {
  font-family: "Schola", serif; font-size: 1.125rem; height: 2.25rem; flex: 1 1 16rem; min-width: 0; padding: 0 0.25rem;
  color: var(--typed); background: transparent; border: 0; border-bottom: 2px solid var(--ink-soft); outline: none;
}
.hook-input::placeholder { color: var(--faint); font-style: italic; }
.hook-input:focus { border-bottom-color: var(--focus); }
.btn.small { height: 2.125rem; padding: 0 0.875rem; font-size: 0.9375rem; }
.hook .keys-hint { margin-top: 0.375rem; }
.knew-line { margin-top: 1rem; font-size: 0.9375rem; line-height: 1.375rem; color: var(--tick); font-style: italic; max-width: 40rem; }
.note-box { margin-top: 1.25rem; padding: 0.75rem 1rem; border: 1.5px solid var(--ink-soft); background: var(--wash); max-width: 62ch; line-height: 1.5rem; }
.note-box p + p { margin-top: 0.375rem; }
.miss { font-size: 0.8125rem; color: var(--redpen); margin-right: 0.125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.has-hook { display: inline-block; width: 0.5rem; height: 0.5rem; background: var(--hook-edge); border-radius: 50%; margin-right: 0.375rem; vertical-align: 0.15rem; }
.wdetail .hook-edit { margin-top: 1.125rem; max-width: 36rem; }
.wdetail .hook-edit .help { color: var(--graphite); font-size: 0.875rem; line-height: 1.25rem; margin-top: 0.25rem; }
@media (max-width: 720px) { .wrow { grid-template-columns: 2.5rem minmax(0, 1fr) 5.25rem; } }
.study-foot .foot-right { display: inline-flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }

/* ================= whole-sentence step ================= */
.prompt-sentence { font-size: 2rem; line-height: 2.75rem; font-weight: 700; color: var(--ink); max-width: 36ch; margin-top: 0.5rem; }
.prompt-sentence.small-sent { font-size: 1.375rem; line-height: 2rem; font-weight: 400; color: var(--graphite); }
.answer.sentence { width: min(48rem, 100%); font-size: 1.5rem; }
/* Listening: the recording plays as the card comes up; these play it again */
.listen-row { display: flex; align-items: center; gap: 1.25rem; margin-top: 1.25rem; }
.listen-play svg { width: 1.125rem; height: 1.125rem; }
.yours.sent { font-size: 1.5rem; line-height: 2.25rem; }
.redpen.sent { font-size: 1.75rem; line-height: 2.5rem; }
.redpen .opt { opacity: 0.55; }
.pair { font-weight: 400; color: var(--graphite); }
.prompt-word .pair { font-size: 0.75em; }
/* part of speech after a headword: "(verb)" */
.pos { font-weight: 400; font-style: italic; color: var(--graphite); font-size: 0.8em; white-space: nowrap; }
.prompt-word .pos { font-size: 0.55em; }
.pos-hover { position: relative; cursor: help; text-decoration: underline dotted var(--faint); text-decoration-thickness: 1px; text-underline-offset: 0.3em; }
.pos-hover::after {
  content: attr(data-pos); position: absolute; left: 50%; top: 100%; transform: translateX(-50%); z-index: 5; pointer-events: none;
  background: var(--paper); border: 1.5px solid var(--ink); padding: 0.125rem 0.5rem; box-shadow: 0.1875rem 0.1875rem 0 var(--wash-strong);
  font-size: 0.9375rem; line-height: 1.25rem; font-weight: 400; font-style: italic; letter-spacing: 0; color: var(--graphite); white-space: nowrap;
  opacity: 0; visibility: hidden; transition: opacity .12s;
}
.pos-hover:hover::after, .pos-hover.show::after { opacity: 1; visibility: visible; }
.freq-pill { display: inline-block; margin-left: 0.5rem; font-size: 0.8125rem; color: var(--graphite); font-style: normal; font-variant-numeric: tabular-nums; vertical-align: 0.1rem; }
.progress-sub { margin-top: 0.75rem; max-width: 62ch; color: var(--graphite); line-height: 1.5rem; }

/* levels */
/* Today: level tiles — tap to study one level, tick for daily new words */
.levels { margin-top: 2.5rem; container-type: inline-size; }
.levels-title { font-size: 1.25rem; line-height: 1.75rem; font-weight: 700; color: var(--ink); }
.level-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
/* wide: all six levels in one row */
@container (min-width: 66rem) { .level-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.level-tile { position: relative; }
.lt-study {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.375rem; width: 100%; height: 100%; text-align: left;
  padding: 0.75rem 0.75rem 0.625rem; background: var(--paper); border: 1.5px solid var(--ink-soft); border-radius: 0.25rem;
  color: var(--ink); font: inherit; cursor: pointer; transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.lt-study:hover { background: var(--wash); border-color: var(--ink); }
.lt-study:active { transform: translateY(1px); }
.lt-study:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.level-tile.off .lt-study { border-style: dashed; }
.lt-top { display: flex; align-items: center; gap: 0.5rem; padding-right: 2rem; }
.lt-steps { width: 2.25rem; height: 1.2rem; flex: none; }
.lt-steps rect { fill: none; stroke: var(--ink-soft); stroke-width: 1; }
.lt-steps rect.on { fill: var(--ink); stroke: var(--ink); }
.lt-name { font-size: 1.375rem; line-height: 1.75rem; font-weight: 700; }
.lt-how { font-size: 0.8125rem; line-height: 1.125rem; color: var(--graphite); min-height: 2.25rem; }
.lt-bar { margin-top: 0.125rem; }
.lt-num { font-size: 0.875rem; color: var(--graphite); font-variant-numeric: tabular-nums; line-height: 1.25rem; }
.lt-num b { color: var(--ink); }
.lt-sub { display: block; margin-top: -0.25rem; font-size: 0.8125rem; color: var(--graphite); }
.lt-due { color: var(--ink); font-weight: 700; }
.lt-go { margin-top: auto; padding-top: 0.25rem; font-size: 0.875rem; color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.lt-pick {
  position: absolute; top: 0.5rem; right: 0.5rem; width: 1.75rem; height: 1.75rem; padding: 0; display: grid; place-items: center;
  background: var(--paper); border: 1.5px solid var(--ink-soft); border-radius: 0.25rem; color: var(--paper); cursor: pointer;
}
.lt-pick svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.lt-pick[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.lt-pick[aria-pressed="false"] svg { opacity: 0; }
.lt-pick:hover { border-color: var(--ink); }
.lt-pick:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.levels-help { margin-top: 0.625rem; font-size: 0.875rem; color: var(--graphite); max-width: 62ch; }
.lv-only { color: var(--ink); }
/* narrow: one row per level */
@container (max-width: 46rem) {
  .level-tiles { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .lt-study { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "top num" "bar bar" "how sub"; column-gap: 0.75rem; row-gap: 0.375rem; align-items: center; padding: 0.625rem 3.5rem 0.625rem 0.75rem; }
  .lt-top { grid-area: top; padding-right: 0; }
  .lt-name { font-size: 1.25rem; }
  .lt-num { grid-area: num; text-align: right; }
  .lt-bar { grid-area: bar; margin-top: 0; }
  .lt-how { grid-area: how; min-height: 0; }
  .lt-sub { grid-area: sub; margin-top: 0; text-align: right; }
  .lt-go { display: none; }
  .lt-pick { top: 50%; transform: translateY(-50%); right: 0.625rem; width: 2.25rem; height: 2.25rem; }
}
.lv-tag { font-weight: 700; color: var(--ink); font-variant-numeric: normal; }
.wrow .rk.lv-tag { color: var(--ink-soft); font-size: 0.8125rem; letter-spacing: 0.02em; }
.lvbars { display: grid; gap: 0.5rem; margin: 1rem 0 0.75rem; max-width: 44rem; }
.lvbar-row { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr) 9.5rem; align-items: center; gap: 0.75rem; }
.lvbar-row.off { opacity: 0.55; }
.lvbar-name { font-weight: 700; color: var(--ink); }
.lvbar { display: flex; height: 0.875rem; border: 1px solid var(--ink-soft); background: var(--paper); overflow: hidden; }
.lvbar i { display: block; height: 100%; }
.lvbar i.b1 { background: var(--lvl1); }
.lvbar i.b2 { background: var(--lvl2); }
.lvbar i.b3 { background: var(--lvl3); }
.lvbar-num { font-size: 0.875rem; color: var(--graphite); font-variant-numeric: tabular-nums; }

.plan-levels { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem 1rem; margin-top: 0.75rem; }
.plan-levels .muted { flex-basis: 100%; }
.pl-lv { white-space: nowrap; color: var(--graphite); }
.pl-lv b { color: var(--ink); margin-right: 0.25rem; }
.plan-warn { margin-top: 0.75rem; color: var(--redpen); }

/* ================= phones ================= */
@media (max-width: 560px) {
  .lvbar-row { grid-template-columns: 2.5rem minmax(0, 1fr) 7.25rem; gap: 0.5rem; }
  .lvbar-num { font-size: 0.8125rem; }
  .plan-slider { flex-wrap: wrap; width: 100%; }
  .plan-slider input[type=range] { width: 100%; max-width: none; }
  .plan-num { min-width: 0; }
  .study-head { flex-wrap: wrap; line-height: 1.75rem; row-gap: 0.25rem; }
  .study-head .mode { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.375rem; }
  .study-head .left { width: 100%; }
  .study-head .mode { max-width: 100%; min-width: 0; }
  /* long labels ("Review · moving up from Recognise · …") wrap instead of pushing the page sideways */
  .state-badge { margin-left: 0; white-space: normal; height: auto; min-height: 1.625rem; max-width: 100%; line-height: 1.35; padding: 0.1875rem 0.5625rem; }
}
/* touch screens: no keyboard shortcuts to explain */
@media (pointer: coarse) and (hover: none) {
  .keys-hint, .study-foot > span:first-child, .today-actions .muted.small kbd, .today-actions > .muted.small { display: none; }
  .study-foot { justify-content: flex-end; }
}

/* ================= tapped words: green = I know it, red = I don't ================= */
:root { --know-bg: rgba(44, 122, 79, 0.14); --dunno-bg: rgba(196, 38, 51, 0.12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --know-bg: rgba(143, 212, 167, 0.18); --dunno-bg: rgba(255, 143, 143, 0.18); } }
:root[data-theme="dark"] { --know-bg: rgba(143, 212, 167, 0.18); --dunno-bg: rgba(255, 143, 143, 0.18); }
.tw[data-w] { cursor: pointer; border-radius: 0.1875rem; transition: background-color .12s, color .12s; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .tw[data-w]:hover { background: var(--wash); } }
.tw.k { color: var(--tick); background: var(--know-bg); }
.tw.u { color: var(--redpen); background: var(--dunno-bg); }
@media (hover: hover) { .tw.k:hover { background: var(--know-bg); } .tw.u:hover { background: var(--dunno-bg); } }
.marks-hint { margin-top: 0.5rem; font-size: 0.875rem; color: var(--graphite); }
.marks-hint .tw { padding: 0 0.1875rem; }

/* ================= sign in (the web app) ================= */
.signin { max-width: 26rem; margin-top: 1rem; }
.signin .field { display: block; margin-top: 1.5rem; }
.signin .field .label { display: block; margin-bottom: 0.25rem; }
.signin .search { width: 100%; font-size: 1.125rem; }
.si-actions { margin-top: 1.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.375rem; }
.si-msg { margin-top: 1rem; min-height: 1.25rem; color: var(--redpen); }
.si-msg.good { color: var(--tick); }
/* Continue with Google: the colours Google gives for its button, light and dark */
:root { --g-fill: #FFFFFF; --g-edge: #747775; --g-text: #1F1F1F; --g-hover: rgba(48, 48, 48, 0.08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --g-fill: #131314; --g-edge: #8E918F; --g-text: #E3E3E3; --g-hover: rgba(227, 227, 227, 0.08); } }
:root[data-theme="dark"] { --g-fill: #131314; --g-edge: #8E918F; --g-text: #E3E3E3; --g-hover: rgba(227, 227, 227, 0.08); }
.si-google { margin-top: 2.5rem; }
.gbtn {
  display: inline-flex; align-items: center; gap: 0.75rem;
  height: 2.5rem; padding: 0 1.375rem 0 1rem; border: 1px solid var(--g-edge); border-radius: 0.1875rem;
  background: var(--g-fill); color: var(--g-text); cursor: pointer; font-size: 1.0625rem;
}
.gbtn:hover { background-image: linear-gradient(var(--g-hover), var(--g-hover)); }
.gbtn:disabled { opacity: .45; cursor: default; background-image: none; }
.gbtn svg { width: 1.25rem; height: 1.25rem; flex: none; }
.si-or { margin-top: 1.25rem; line-height: 1.25rem; color: var(--graphite); font-style: italic; }

/* a newer version of the web app is ready */
#update {
  position: fixed; right: 2.5rem; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); z-index: 35; max-width: 26rem;
  background: var(--paper); border: 2px solid var(--ink); color: var(--ink); padding: 0.75rem 1rem; line-height: 1.375rem;
  box-shadow: 0.25rem 0.25rem 0 var(--wash-strong);
}
#update[hidden] { display: none; }
#update .upd-actions { margin-top: 0.75rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.375rem; }
@media (max-width: 720px) {
  #update { left: 1rem; right: 1rem; max-width: none; }
}

/* ================= feedback ================= */
.nav-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--redpen); margin-left: 0.3125rem; vertical-align: 0.5em; }
.field > .label .nav-dot { vertical-align: 0.375em; }
.fb-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.375rem; margin-top: 0.25rem; }
.back-link { font-size: 0.9375rem; margin-bottom: 0.5rem; }
.fbpage .intro { color: var(--graphite); font-size: 0.9375rem; line-height: 1.375rem; }
.fbpage .today-actions { margin-top: 1.25rem; }
.fbpage .field { margin-top: 2.5rem; }
.fb-inbox .section-head { align-items: baseline; }
.fb-inbox .chips { margin-top: 0.5rem; }
.fb-list { margin-top: 0.5rem; }
.fb-item { padding: 0.75rem 0 0.875rem; border-bottom: 1px solid var(--grid); line-height: 1.375rem; }
.fb-item.new { border-left: 3px solid var(--redpen); padding-left: 0.75rem; }
.fb-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.fb-status { font-size: 0.8125rem; line-height: 1.25rem; padding: 0 0.5rem; border: 1.5px solid var(--faint); border-radius: 1rem; color: var(--graphite); white-space: nowrap; }
.fb-status.s-fixed { border-color: var(--tick); color: var(--tick); }
.fb-new { font-size: 0.8125rem; color: var(--redpen); font-style: italic; }
.fb-about { color: var(--ink); }
.fb-date, .fb-who { font-size: 0.875rem; color: var(--graphite); }
.fb-issue { font-size: 0.875rem; color: var(--ink-soft); }
.fb-cats, .fb-card, .fb-dev { font-size: 0.875rem; color: var(--graphite); margin-top: 0.125rem; }
.fb-dev { color: var(--faint); font-size: 0.8125rem; overflow-wrap: anywhere; }
.fb-text { margin-top: 0.25rem; white-space: pre-wrap; overflow-wrap: anywhere; font-style: italic; }
.fb-reply { margin-top: 0.375rem; padding-left: 0.625rem; border-left: 3px solid var(--tick); font-size: 0.9375rem; overflow-wrap: anywhere; }
.fb-reply-lbl { color: var(--graphite); font-style: italic; }
.fb-acts { margin-top: 0.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.125rem; font-size: 0.9375rem; }
.fb-note {
  flex: 1 1 14rem; min-width: 0; font-family: "Schola", serif; font-size: 1rem; height: 2.125rem; padding: 0 0.25rem;
  color: var(--typed); background: transparent; border: 0; border-bottom: 1.5px solid var(--ink-soft); outline: none;
}
.fb-note:focus { border-bottom-color: var(--focus); }
.fb-note::placeholder { color: var(--faint); font-style: italic; }

/* the report window */
#dlg { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(20, 28, 48, 0.32); }
.dlg-card {
  width: 100%; max-width: 33rem; max-height: calc(100vh - 2rem); overflow: auto; padding: 1.25rem 1.5rem 1.375rem;
  background-color: var(--paper); border: 2px solid var(--ink); box-shadow: 0.25rem 0.25rem 0 var(--wash-strong);
}
.dlg-title { font-size: 1.375rem; line-height: 1.875rem; }
.dlg-word { margin-top: 0.25rem; color: var(--graphite); }
.dlg-word b { color: var(--ink); }
.dlg-opts { border: 0; padding: 0; margin: 0.875rem 0 0; }
.dlg-opts legend { padding: 0; font-weight: 700; margin-bottom: 0.25rem; }
.dlg-opts label { line-height: 1.375rem; padding: 0.3125rem 0; align-items: flex-start; }
.dlg-opts input { margin-top: 0.1875rem; flex: none; }
.dlg-lbl { display: block; margin-top: 0.875rem; font-weight: 700; }
.dlg-lbl .muted { font-weight: 400; }
#fbText {
  display: block; width: 100%; margin-top: 0.25rem; padding: 0.375rem 0.5rem; resize: vertical; min-height: 5.5rem;
  font-family: "Schola", serif; font-size: 1.0625rem; line-height: 1.375rem; color: var(--typed);
  background: var(--paper); border: 1.5px solid var(--ink-soft); border-radius: 2px; outline: none;
}
#fbText:focus { border-color: var(--focus); }
#fbText::placeholder { color: var(--faint); font-style: italic; }
.dlg-note { margin-top: 0.5rem; font-size: 0.875rem; line-height: 1.25rem; color: var(--graphite); }
.dlg-msg { margin-top: 0.5rem; min-height: 1.25rem; font-size: 0.9375rem; color: var(--redpen); }
.dlg-actions { margin-top: 0.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.375rem; }
@media (max-width: 720px) {
  #dlg { align-items: flex-end; padding: 0; }
  .dlg-card { max-width: none; max-height: 92vh; border-width: 2px 0 0; padding: 1.125rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px)); }
  .fb-note { flex-basis: 100%; }
}

/* ================= updates ================= */
.updpage .intro { color: var(--graphite); font-size: 0.9375rem; line-height: 1.375rem; }
.updpage .upd-by { margin-top: 1.25rem; }
.upd-day { margin-top: 2.25rem; }
.upd-day h2 { font-size: 1.25rem; line-height: 1.875rem; }
.upd-list { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.upd-list li { margin-top: 0.5rem; line-height: 1.375rem; }
.upd-list li::marker { color: var(--faint); }

/* spacing that used to be written into the markup (style="…" isn't allowed by the website's Content-Security-Policy);
   !important on the margins keeps the precedence the inline styles had ([hidden] must still win over display) */
.mt-xs { margin-top: 0.375rem !important; }
.mt-s { margin-top: 0.625rem !important; }
.mt-l { margin-top: 1.25rem !important; }
.ml-m { margin-left: 0.75rem !important; }
.linkrow { margin-top: 0.75rem !important; display: flex; gap: 1.375rem; flex-wrap: wrap; }
/* ---------- mini grammar lesson under the answer ---------- */
.grammar-lesson { margin-top: 1.25rem; border-top: 1.5px dashed var(--faint); padding-top: 0.25rem; }
.stage.shown > .grammar-lesson { grid-column: 1 / -1; }
.grammar-lesson > summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.25rem 0.75rem;
  padding: 0.625rem 0; line-height: 1.5rem; color: var(--ink);
}
.grammar-lesson > summary::-webkit-details-marker { display: none; }
.grammar-lesson > summary::before {
  content: ""; align-self: center; width: 0.5rem; height: 0.5rem; margin-right: 0.125rem;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg); transition: transform .15s;
}
.grammar-lesson[open] > summary::before { transform: rotate(45deg); }
.grammar-lesson > summary:hover .gl-topic { text-decoration: underline; text-underline-offset: 0.1875rem; }
.grammar-lesson > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gl-lbl { font-style: italic; color: var(--graphite); }
.gl-topic { font-size: 1.1875rem; font-weight: 700; }
.gl-form { color: var(--graphite); }
.gl-key { margin-left: auto; font-size: 0.875rem; color: var(--graphite); }
.gl-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr)); gap: 0.5rem 2.5rem; padding: 0.25rem 0 1.5rem; }
.gl-sec h3 { font-size: 1rem; font-weight: 700; font-style: italic; color: var(--ink); line-height: 1.5rem; margin: 0.25rem 0 0.375rem; }
.gl-sec h3.gl-more { margin-top: 1rem; }
.gl-sec p { line-height: 1.5rem; margin: 0 0 0.625rem; color: var(--ink); font-size: 1rem; }
.gl-sec p.gl-ex { font-size: 0.9375rem; line-height: 1.375rem; }
.gl-sec .muted { color: var(--graphite); }
.gl-table { border-collapse: collapse; font-size: 0.9375rem; line-height: 1.25rem; margin: 0.25rem 0 0.5rem; width: 100%; }
.gl-table th, .gl-table td { border: 1px solid var(--grid); padding: 0.25rem 0.5rem; text-align: left; vertical-align: top; }
.gl-table thead th { font-style: italic; font-weight: 400; color: var(--graphite); }
.gl-table tbody th { font-weight: 400; color: var(--graphite); white-space: nowrap; }
.gl-table tr.hi > * { background: var(--wash); }
.gl-table mark { background: var(--wash-strong); color: inherit; font-weight: 700; padding: 0 0.125rem; }
.gl-scroll { overflow-x: auto; }
@media (pointer: coarse) and (hover: none) { .gl-key { display: none; } }
@media (max-width: 720px) { .gl-cols { grid-template-columns: minmax(0, 1fr); } }
.gl-nowrap td { white-space: nowrap; }

/* ================= guided tour (Settings → Guided tour) ================= */
:root { --tour-dim: rgba(20, 28, 48, 0.42); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tour-dim: rgba(0, 0, 0, 0.55); } }
:root[data-theme="dark"] { --tour-dim: rgba(0, 0, 0, 0.55); }
/* room to scroll the last part of a page up above the card */
body.tour-on main { padding-bottom: 70vh; }
.tour-block { position: fixed; inset: 0; z-index: 45; }
/* the spotlight: everything outside it is dimmed by its shadow */
.tour-spot {
  position: fixed; z-index: 47; pointer-events: none; border: 2px solid var(--focus); border-radius: 0.25rem;
  box-shadow: 0 0 0 200vmax var(--tour-dim);
}
.tour-spot.none { left: 50%; top: 50%; width: 0; height: 0; border: 0; }
.tour.moving .tour-spot { transition: left .25s, top .25s, width .25s, height .25s; }
.tour-card {
  position: fixed; z-index: 48; width: min(23.75rem, calc(100vw - 1.5rem)); padding: 1rem 1.25rem 1.125rem;
  background-color: var(--paper); border: 2px solid var(--ink); box-shadow: 0.25rem 0.25rem 0 var(--wash-strong);
}
.tour-count { font-size: 0.875rem; font-style: italic; color: var(--graphite); line-height: 1.25rem; }
.tour-title { font-size: 1.375rem; line-height: 1.875rem; }
.tour-text { margin-top: 0.25rem; font-size: 1rem; line-height: 1.5rem; }
.tour-text .tw { padding: 0 0.1875rem; }
.tour-actions { margin-top: 0.875rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.tour-actions .linkbtn { margin-left: auto; font-size: 0.9375rem; }
.tour-keys { margin-top: 0.625rem; font-size: 0.8125rem; color: var(--graphite); }
/* the practice card: a study screen of its own, over the page */
.tour-practice {
  position: fixed; inset: 0; z-index: 46; overflow-y: auto; overscroll-behavior: contain;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell); background-attachment: local;
}
.tour-practice::before {
  content: ""; position: fixed; top: 0; bottom: 0; left: 4.9375rem; width: 2px;
  background: var(--margin); opacity: .85; pointer-events: none;
}
.tour-practice-in { position: relative; max-width: 62.5rem; padding: 1.875rem 2.5rem 70vh 7.5rem; }
.tour-practice-lbl { font-style: italic; color: var(--graphite); line-height: 2.5rem; margin-bottom: 1.25rem; }
.tour-practice .gradebar { position: static; }
.tw.tour-w { cursor: pointer; border-radius: 0.1875rem; transition: background-color .12s, color .12s; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .tw.tour-w:hover { background: var(--wash); } .tw.tour-w.k:hover { background: var(--know-bg); } .tw.tour-w.u:hover { background: var(--dunno-bg); } }
@media (max-width: 720px) {
  .tour-card {
    left: 0; right: 0; bottom: 0; width: auto; max-height: 50vh; overflow-y: auto;
    border-width: 2px 0 0; padding: 0.875rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  }
  .tour-practice::before { left: 1.9375rem; }
  .tour-practice-in { padding: 1.25rem 1rem 70vh 3rem; }
}

/* ================= pomodoro ================= */
.pomo { display: inline-flex; align-items: center; gap: 0.3125rem; color: var(--redpen); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pomo-face { width: 1.0625rem; height: 1.0625rem; flex: none; }
.pomo-next { font-style: italic; }
.pomo-toggle {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.5rem; padding: 0 1rem; cursor: pointer;
  border: 2px solid var(--faint); border-radius: 1.25rem; background: transparent; color: var(--graphite); font-size: 1rem; font-variant-numeric: tabular-nums;
}
.pomo-toggle .muted { font-size: 0.875rem; }
.pomo-toggle[aria-pressed="true"] { border-color: var(--redpen); color: var(--redpen); }
.pomo-toggle:hover { background: var(--wash); }
.pomo-big { margin-top: 1.25rem; display: flex; align-items: center; gap: 1.25rem; font-size: 5.5rem; line-height: 6.25rem; font-weight: 700; color: var(--redpen); font-variant-numeric: tabular-nums; }
.pomo-big .pomo-face { width: 4.5rem; height: 4.5rem; }
.pomo-dots { margin-top: 1.25rem; display: flex; align-items: center; flex-wrap: wrap; gap: 0.375rem 0.75rem; font-size: 0.9375rem; color: var(--graphite); }
.pomo-dot-row { display: inline-flex; gap: 0.375rem; }
.pomo-dot-row i { width: 0.75rem; height: 0.75rem; border-radius: 50%; border: 1.5px solid var(--redpen); }
.pomo-dot-row i.on { background: var(--redpen); }
.pomo-lens { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; margin-top: 0.75rem; }
.pomo-lens label { display: inline-flex; align-items: center; gap: 0.5rem; }
.pomo-lens .num { width: 4.5rem; }
@media (max-width: 720px) {
  .pomo-big { font-size: 4rem; line-height: 5rem; }
  .pomo-big .pomo-face { width: 3.25rem; height: 3.25rem; }
}

/* web app */
.gradebar { padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }
body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
