/* Tessere. The look borrows from an Italian school exercise book: squared paper,
   blue ballpoint, a red margin rule, yellow highlighter, and the teacher's red pencil. */
:root {
  --paper: #fcfdfb; --sheet: #ffffff; --grid: rgba(45, 92, 170, .11);
  --ink: #1f3d99; --ink-deep: #152a6e; --ink-wash: #e7edfb;
  --text: #1b2130; --pencil: #646b7c; --rule: #c5cfe4;
  --red: #d2362b; --red-wash: #fde8e5;
  --green: #1f7a45; --green-wash: #e2f3e8;
  --hi: #ffe35a; --hi-wash: #fff6c2; --amber: #8a6400;
  --font: "Lexend", "Segoe UI", system-ui, sans-serif;
  --cell: 22px;
}
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/lexend-latin-ext-wght-normal.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Lexend"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../fonts/lexend-latin-wght-normal.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; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: 300 17px/1.55 var(--font);
  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);
}
h1 { font: 800 1.75rem/1.15 var(--font); letter-spacing: -.01em; margin: 0 0 .6rem; color: var(--ink-deep); }
p { margin: 0 0 .9rem; max-width: 68ch; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--hi); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink-deep); }

/* top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding: .65rem 1.25rem; background: var(--sheet); border-bottom: 2px solid var(--ink); }
.brand { text-decoration: none; font-weight: 800; font-size: 1.25rem; color: var(--ink-deep); display: flex; align-items: center; gap: .55rem; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 11px); gap: 2px; transform: rotate(-4deg); }
.brand-mark i { width: 11px; height: 11px; border-radius: 2px; background: var(--ink); }
.brand-mark i:nth-child(2) { background: var(--hi); }
.brand-mark i:nth-child(3) { background: var(--red); }
.brand-mark i:nth-child(4) { background: var(--green); }
.tag { font-weight: 300; font-size: .95rem; color: var(--pencil); }
.top-title { font-weight: 600; flex: 1; min-width: 0; }
.top-user { color: var(--pencil); font-size: .9rem; margin-left: auto; }
.top-links { display: flex; gap: 1rem; margin-left: auto; }
.tabs { display: flex; gap: 1.25rem; flex: 1; }
.tab { border: 0; background: none; padding: .3rem 0; font-weight: 600; color: var(--pencil); border-bottom: 4px solid transparent; }
.tab.on { color: var(--ink-deep); border-bottom-color: var(--hi); }
.link { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* sheets of paper */
.wrap { max-width: 940px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.card { position: relative; background: var(--sheet); border: 1.5px solid var(--rule); border-radius: 3px; padding: 1.6rem 1.75rem 1.75rem 4rem; box-shadow: 3px 4px 0 rgba(31, 61, 153, .09); }
.card::before { content: ""; position: absolute; top: 0; bottom: 0; left: 2.6rem; width: 2px; background: var(--red); opacity: .45; }
.card.narrow { max-width: 500px; margin: 7vh auto 0; }
.card.empty { color: var(--pencil); }
.card.empty p { margin: 0; }
.card-head { margin-bottom: 1.1rem; }
.muted { color: var(--pencil); }
.hint { color: var(--pencil); font-size: .88rem; font-weight: 300; }
.error { color: var(--red); font-weight: 600; min-height: 1.2em; }
.error:empty { margin: 0; min-height: 0; }
.notice { background: var(--hi-wash); border-left: 4px solid var(--hi); padding: .6rem .8rem; }
.intro { font-size: 1.05rem; }
.status { min-height: 1.5em; font-weight: 600; margin-top: .75rem; }
.counter { color: var(--pencil); font-size: .9rem; font-variant-numeric: tabular-nums; margin-left: auto; }
.counter.over { color: var(--red); font-weight: 800; }

/* buttons are tiles: a face and a thick bottom edge */
.btn { border: 2px solid var(--ink-deep); border-bottom-width: 5px; background: var(--ink); color: #fff; font-weight: 600; padding: .5rem 1.1rem; border-radius: 5px; }
.btn:hover:not(:disabled) { background: var(--ink-deep); }
.btn:active:not(:disabled) { border-bottom-width: 2px; margin-top: 3px; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: var(--sheet); color: var(--ink-deep); }
.btn.ghost:hover:not(:disabled) { background: var(--ink-wash); }
.btn.warm, .btn.danger { background: var(--red); border-color: #8f1f17; color: #fff; }
.btn.small { padding: .25rem .65rem; font-size: .9rem; border-bottom-width: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.1rem; align-items: center; }
.actions.center { justify-content: center; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .75rem; min-height: 1.5rem; }
.mini { border: 1.5px solid var(--rule); border-bottom-width: 3px; background: var(--sheet); border-radius: 4px; width: 2.2rem; height: 2.2rem; line-height: 1; color: var(--ink-deep); }
.mini:disabled { opacity: .3; }

.help { font-weight: 300; font-size: .9rem; color: var(--pencil); margin: -.4rem 0 1.3rem; }
.help p { margin: .5rem 0 .15rem; }
.help .eg { margin: 0 0 0 .9rem; padding: .1rem .5rem; display: inline-block; background: var(--ink-wash); color: var(--ink-deep); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86rem; border-radius: 3px; }

/* forms */
.field { display: block; margin-bottom: 1.15rem; font-weight: 600; }
.field-head { display: flex; align-items: baseline; gap: .5rem; }
.text-input, .text-area { display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; border: 1.5px solid var(--rule); border-bottom: 2.5px solid var(--ink); border-radius: 3px; background: var(--paper); font-weight: 300; }
.text-input.auto { width: auto; margin: 0; }
.text-area { min-height: 8rem; resize: vertical; line-height: 1.55; }
.text-area.tall { min-height: 14rem; }
.check { display: block; margin-bottom: 1rem; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--ink); vertical-align: -2px; }
.inline { font-weight: 400; font-size: .92rem; white-space: nowrap; }
.inline select { padding: .2rem .35rem; border-radius: 3px; border: 1.5px solid var(--rule); background: var(--sheet); }

/* student progress: one numbered tile per activity */
.stepper { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.1rem; }
.step { display: flex; align-items: center; gap: .45rem; border: 0; background: none; padding: 0 .5rem 0 0; font-size: .88rem; color: var(--pencil); }
.step-num { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; background: var(--sheet); border: 2px solid var(--rule); border-bottom-width: 4px; border-radius: 4px; font-weight: 800; color: var(--pencil); }
.step.current { color: var(--ink-deep); font-weight: 600; }
.step.current .step-num { background: var(--hi); border-color: var(--ink-deep); color: var(--ink-deep); }
.step.passed .step-num { background: var(--green-wash); border-color: var(--green); color: var(--green); }
.step:disabled { opacity: .5; }

/* result: the score, circled in red pencil like a grade on a test */
.result { text-align: center; border-top: 1.5px dashed var(--rule); margin-top: 1.75rem; padding-top: 1.5rem; }
.result p { margin-left: auto; margin-right: auto; }
.score { display: inline-grid; place-items: center; min-width: 8.5rem; padding: 1.1rem 1.4rem; font: 800 3rem/1 var(--font); color: var(--red); border: 4px solid var(--red); border-radius: 52% 48% 55% 45% / 46% 54% 44% 56%; transform: rotate(-5deg); }
.score span { transform: rotate(2deg); }
.score.good { color: var(--green); border-color: var(--green); }
.result-msg { font-weight: 600; margin-top: 1rem; }
.summary { display: flex; gap: 2.5rem; margin: 1rem 0 1.25rem; }
.summary div { display: flex; flex-direction: column; }
.summary strong { font: 800 2rem/1.1 var(--font); color: var(--ink-deep); }
.summary span { color: var(--pencil); font-size: .9rem; }

/* tables and lists */
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1.5px solid var(--rule); border-radius: 3px; box-shadow: 3px 4px 0 rgba(31, 61, 153, .09); }
.grid { border-collapse: collapse; width: 100%; font-size: .93rem; }
.grid th, .grid td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--rule); vertical-align: top; white-space: nowrap; }
.grid th { font-weight: 600; color: var(--ink-deep); border-bottom: 2px solid var(--ink); background: var(--ink-wash); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td:first-child, .grid th:first-child { position: sticky; left: 0; background: var(--sheet); }
.grid th:first-child { background: var(--ink-wash); }
.sub { display: block; color: var(--pencil); font-size: .8rem; font-weight: 400; }
.cell-ok { color: var(--green); font-weight: 600; }
.cell-low { color: var(--red); font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.list { display: grid; gap: .7rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; background: var(--sheet); border: 1.5px solid var(--rule); border-left: 5px solid var(--ink); border-radius: 3px; padding: .85rem 1.1rem; }
.row-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 280px; }
.row-main strong { font-size: 1.08rem; color: var(--ink-deep); }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.link-box { margin-top: .4rem; width: 100%; max-width: 30rem; border: 1.5px dashed var(--ink); background: var(--ink-wash); border-radius: 3px; padding: .3rem .5rem; font-size: .88rem; color: var(--ink-deep); }

/* authoring */
.gap-picker { background: var(--paper); border: 1.5px solid var(--rule); border-radius: 3px; padding: .8rem; line-height: 2.1; white-space: pre-wrap; font-weight: 400; max-height: 22rem; overflow: auto; }
.pick { border: 0; background: none; padding: .05rem .15rem; border-radius: 2px; }
.pick:hover { background: var(--hi-wash); }
.pick.on { background: var(--hi); box-shadow: 0 2px 0 var(--ink-deep); font-weight: 600; }
.pick.on.joined-right { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 0; }
.pick.on.joined-left { border-top-left-radius: 0; border-bottom-left-radius: 0; padding-left: 0; }
.join { border: 0; background: none; padding: 0; white-space: pre; vertical-align: baseline; }
.join.on { background: var(--hi); box-shadow: 0 2px 0 var(--ink-deep); padding: .05rem 0; }
.join-plus { display: inline-grid; place-items: center; width: 1.25rem; height: 1.25rem; margin: 0 .1rem; border-radius: 50%; background: var(--ink); color: #fff; font-size: .85rem; font-weight: 800; line-height: 1; vertical-align: 2px; }
.join:hover .join-plus { background: var(--ink-deep); }
.join.on:hover { background: var(--hi-wash); }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; margin-top: .4rem; }
.add-act { text-align: left; border: 1.5px solid var(--rule); border-bottom-width: 4px; background: var(--sheet); border-radius: 4px; padding: .45rem .7rem; display: flex; flex-direction: column; font-weight: 400; }
.add-act:hover { border-color: var(--ink); background: var(--ink-wash); }
.add-act strong { color: var(--ink-deep); }
.add-act span { color: var(--pencil); font-size: .84rem; }
.steps-edit { padding-left: 1.6rem; margin: .5rem 0; font-weight: 400; }
.steps-edit .plain { list-style: none; margin-left: -1.6rem; }
.step-edit { padding: .3rem 0; }
.step-edit::marker { font-weight: 800; color: var(--ink-deep); }
.step-edit > * { vertical-align: middle; }
.step-edit-name { font-weight: 600; display: inline-block; width: 17.5rem; max-width: 100%; }
.step-edit .strip-btns { margin-left: .75rem; }

/* authoring: gap options, English version */
.actions.tight { margin: .2rem 0 .6rem; gap: .4rem; }
.gap-rows { margin-top: .5rem; max-height: 20rem; overflow: auto; }
.gap-row { display: grid; grid-template-columns: minmax(6rem, 1fr) auto auto auto; gap: .4rem 1rem; align-items: center; padding: .35rem 0; border-bottom: 1px dashed var(--rule); font-weight: 300; }
.gap-row strong { font-weight: 600; color: var(--ink-deep); }
.clue-input.wide { width: 13rem; }
.clue-input { width: 8rem; padding: .2rem .4rem; border: 1.5px solid var(--rule); border-radius: 3px; background: var(--paper); }
.en-rows { display: grid; gap: .7rem; margin-top: .5rem; }
.en-row { display: grid; grid-template-columns: 2fr 1fr; gap: .3rem .5rem; padding-bottom: .7rem; border-bottom: 1px dashed var(--rule); }
.en-row .text-input { margin: 0; }
.en-src { grid-column: 1 / -1; margin: 0; font-weight: 600; color: var(--ink-deep); max-width: none; }
.chunks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; row-gap: .35rem; font-weight: 600; color: var(--ink-deep); }
.chunk-word { padding: .1rem .45rem; border: 1.5px solid var(--rule); border-bottom-width: 3px; border-radius: 4px; background: var(--sheet); }
.chunk-word.glued-right { border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: .2rem; background: var(--hi-wash); border-color: var(--ink); }
.chunk-word.glued-left { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; padding-left: .2rem; background: var(--hi-wash); border-color: var(--ink); }
.chunk-join { border: 0; background: none; color: var(--pencil); font-weight: 800; width: 1.15rem; padding: 0; line-height: 1; font-size: .85rem; }
.chunk-join:hover { color: var(--ink); }
.chunk-join.on { width: .5rem; align-self: stretch; background: var(--hi-wash); border-top: 1.5px solid var(--ink); border-bottom: 3px solid var(--ink); }
.chunk-join.on:hover { background: var(--red-wash); }
.paste-en { font-weight: 300; margin: .3rem 0 .6rem; }
.paste-en summary { cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* gradebook reports */
.report { margin-top: 1.75rem; }
.report h2 { font-size: 1.25rem; font-weight: 800; color: var(--ink-deep); margin: 0 0 .3rem; }
.missed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .7rem; }
.missed-block, .written { background: var(--sheet); border: 1.5px solid var(--rule); border-left: 5px solid var(--red); border-radius: 3px; padding: .7rem .9rem; }
.written { border-left-color: var(--ink); margin-bottom: .7rem; }
.missed-block ul, .written ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.missed-item { font-weight: 600; }
.written details { margin-top: .4rem; }
.written summary { cursor: pointer; font-weight: 600; }

/* gap extras */
.gap-select { font: inherit; line-height: 1.5; border: 0; border-bottom: 2.5px solid var(--ink); background: var(--ink-wash); border-radius: 3px 3px 0 0; padding: 0 .2rem; margin: 0 .15rem; color: var(--ink); max-width: 100%; }
.gap-select.ok { background: var(--green-wash); border-color: var(--green); color: var(--green); font-weight: 600; opacity: 1; }
.gap-select.bad { background: var(--red-wash); border-color: var(--red); }
.gap-select.revealed { background: var(--red-wash); border-color: var(--red); color: var(--red); }
.gap-input.ending { margin-left: 0; text-align: left; border-radius: 0 3px 0 0; }
.gap-stem + .gap-slot, .gap-stem + .gap-select { margin-left: 1px; min-width: 2.5rem; }
.gap-clue { color: var(--pencil); font-size: .9em; font-style: italic; }

/* spot the errors: every word looks the same until it is tapped */
.hunt-word { font: inherit; color: inherit; border: 0; background: none; padding: 0 .1rem; margin: 0 -.1rem; border-radius: 3px; line-height: 1.5; }
.hunt-word:hover:not(:disabled) { background: var(--ink-wash); }
.hunt-word:disabled { opacity: 1; }
.hunt-word.picked { background: var(--hi); }
.hunt-word.ok { background: var(--green-wash); color: var(--green); font-weight: 600; }
.hunt-word.revealed { background: var(--red-wash); color: var(--red); font-weight: 600; }
.fixer { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: .9rem; padding: .6rem .7rem; background: var(--hi-wash); border-left: 4px solid var(--hi); }
.chip:disabled { opacity: .3; }

/* with the teacher's English */
.reveal { display: grid; gap: .5rem; }
.reveal-src { display: block; width: 100%; text-align: left; font: inherit; font-size: 1.12rem; font-weight: 400; color: var(--text); background: var(--sheet); border: 1.5px solid var(--rule); border-left: 6px solid var(--ink); border-radius: 3px; padding: .5rem .7rem; }
.reveal-src[aria-expanded="true"] { border-left-color: var(--green); }
.reveal-en { margin: .2rem 0 .3rem .9rem; color: var(--ink); font-style: italic; }
.build-prompt, .tr-src { font-size: 1.2rem; font-weight: 600; color: var(--ink-deep); background: var(--hi-wash); border-left: 4px solid var(--hi); padding: .5rem .8rem; max-width: none; }
.tile.spare { opacity: .35; text-decoration: line-through; }
.tr-box { min-height: 5rem; font-size: 1.1rem; }
.tr-box.bad { border-color: var(--red); }
.tr-model { margin-top: .8rem; color: var(--green); font-weight: 600; }

/* assignment type picker and choice-board editor */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .5rem; margin-top: .4rem; }
.mode { text-align: left; display: flex; flex-direction: column; gap: .15rem; padding: .55rem .75rem; background: var(--sheet); border: 1.5px solid var(--rule); border-bottom-width: 4px; border-radius: 4px; font-weight: 300; }
.mode strong { color: var(--ink-deep); font-weight: 600; }
.mode span { color: var(--pencil); font-size: .86rem; }
.mode.on { border-color: var(--ink-deep); background: var(--hi-wash); }
.steps-edit.unordered { list-style: none; padding-left: 0; }
.cols-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: .7rem; margin-top: .4rem; font-weight: 300; }
.col-edit { border: 1.5px solid var(--rule); border-top: 5px solid var(--ink); border-radius: 3px; padding: .7rem; background: var(--paper); display: grid; gap: .5rem; align-content: start; }
.col-head { display: flex; gap: .4rem; align-items: center; }
.col-head .text-input { margin: 0; font-weight: 600; }
.col-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.col-steps li { display: grid; grid-template-columns: 1fr auto; gap: .2rem .4rem; align-items: center; padding-bottom: .35rem; border-bottom: 1px dashed var(--rule); }
.col-steps .step-edit-name { width: auto; grid-column: 1 / -1; }
.col-edit .text-input { margin: 0; }

/* student choice board */
.back { display: inline-block; margin-bottom: .9rem; font-weight: 600; }
.board-head { margin-bottom: 1rem; }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; align-items: start; }
.board-col { background: var(--sheet); border: 1.5px solid var(--rule); border-top: 6px solid var(--ink); border-radius: 3px; padding: .8rem; display: grid; gap: .5rem; box-shadow: 3px 4px 0 rgba(31, 61, 153, .09); }
.board-col.complete { border-top-color: var(--green); }
.board-col h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--ink-deep); }
.board-need { margin: 0; display: flex; justify-content: space-between; gap: .5rem; font-weight: 600; }
.board-count { font-weight: 300; color: var(--pencil); }
.board-col.complete .board-count { color: var(--green); font-weight: 600; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; }
.board-card { position: relative; text-align: left; display: flex; flex-direction: column; gap: .1rem; padding: .55rem 2rem .55rem .75rem; background: var(--sheet); border: 2px solid var(--rule); border-bottom-width: 5px; border-radius: 5px; color: var(--text); }
.board-card:hover { border-color: var(--ink); background: var(--ink-wash); }
.board-name { font-weight: 600; color: var(--ink-deep); }
.board-line { font-size: .85rem; color: var(--pencil); }
.board-card.tried { border-color: var(--hi); }
.board-card.passed { border-color: var(--green); background: var(--green-wash); }
.board-tick { position: absolute; right: .6rem; top: .5rem; color: var(--green); font-weight: 800; }

/* sign in and account */
.gate-links { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: 1.1rem 0 0; }
.card.legacy { margin-bottom: 1rem; border-left: 6px solid var(--hi); }
.card.legacy h2, .plan h2 { font-size: 1.15rem; font-weight: 800; color: var(--ink-deep); margin: 0 0 .4rem; }
.plan { margin: 1.2rem 0; padding: 1rem 1.1rem; background: var(--ink-wash); border-left: 5px solid var(--ink); }
a.btn { text-decoration: none; display: inline-block; color: #fff; }
a.btn.ghost { color: var(--ink-deep); }

.strip { margin: 0 0 1rem; padding: .5rem .8rem; background: var(--hi-wash); border-left: 5px solid var(--hi); max-width: none; }
.strip.over { background: var(--red-wash); border-left-color: var(--red); display: flex; flex-wrap: wrap; gap: .7rem 1.2rem; align-items: center; justify-content: space-between; padding: .8rem 1rem; }
.strip.over p { margin: 0; flex: 1 1 22rem; }
.grid.admin td { white-space: normal; vertical-align: middle; }
.admin-acts { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; min-width: 17rem; }

.danger-zone { margin-top: 1.6rem; padding-top: 1.1rem; border-top: 1.5px dashed var(--rule); }
.danger-zone h2 { font-size: 1.1rem; font-weight: 800; color: var(--ink-deep); margin: 0 0 .4rem; }
.code-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; }
.code-row .text-input { flex: 1 1 12rem; width: auto; margin: 0; }

/* accent keys */
.accents { display: flex; flex-wrap: wrap; gap: .3rem; }
.accents:empty { display: none; }
.accent-key { border: 1.5px solid var(--rule); border-bottom-width: 4px; background: var(--sheet); border-radius: 4px; min-width: 2.3rem; height: 2.4rem; font-size: 1.1rem; font-weight: 600; color: var(--ink-deep); }
.accent-key:hover { border-color: var(--ink); }

/* the reading itself: bigger, airy, on ruled lines */
.lf-text, .gap-text, .built { font-size: 1.15rem; font-weight: 400; line-height: 2.2rem; white-space: pre-wrap; padding: .55rem 0; background-image: linear-gradient(transparent calc(2.2rem - 1px), var(--rule) calc(2.2rem - 1px)); background-size: 100% 2.2rem; background-position: 0 .55rem; }
.lf-text { cursor: text; max-height: 62vh; overflow: auto; word-spacing: .5em; }
.lf-word { white-space: nowrap; }
.lf-cell { display: inline-block; min-width: .66em; text-align: center; color: transparent; border-bottom: 2px solid var(--pencil); margin: 0 1px; line-height: 1.3; }
.lf-cell.current { background: var(--hi); border-color: var(--ink-deep); }
.lf-cell.filled { color: var(--ink); border-color: transparent; font-weight: 600; }
.lf-cell.missed { color: var(--red); }
.ghost-input { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; }

.gap-input { font: inherit; line-height: 1.5; border: 0; border-bottom: 2.5px solid var(--ink); background: var(--ink-wash); border-radius: 3px 3px 0 0; padding: 0 .35rem; margin: 0 .15rem; text-align: center; max-width: 100%; color: var(--ink); }
.gap-slot { font: inherit; line-height: 1.5; min-width: 4.5rem; border: 2px dashed var(--pencil); background: var(--sheet); border-radius: 4px; padding: 0 .5rem; margin: 0 .15rem; color: var(--ink); }
.gap-slot.active { border-color: var(--ink-deep); background: var(--hi); }
.gap-slot.placed { border-style: solid; border-color: var(--ink); }
.gap-input.ok, .gap-slot.ok { background: var(--green-wash); border-color: var(--green); color: var(--green); font-weight: 600; border-style: solid; opacity: 1; }
.gap-input.accent, .gap-slot.accent { background: var(--hi-wash); border-color: var(--amber); color: var(--amber); font-weight: 600; border-style: solid; opacity: 1; }
.gap-input.bad, .gap-slot.bad { background: var(--red-wash); border-color: var(--red); }
.gap-input.revealed, .gap-slot.revealed { background: var(--red-wash); border-color: var(--red); color: var(--red); }
.bank { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; position: sticky; top: 0; background: var(--sheet); padding: .45rem 0; z-index: 1; border-bottom: 1.5px dashed var(--rule); }
.chip, .tile { border: 2px solid var(--ink); border-bottom-width: 5px; background: var(--sheet); color: var(--ink-deep); border-radius: 5px; padding: .25rem .7rem; font-size: 1.08rem; font-weight: 600; }
.chip:hover, .tile:hover { background: var(--ink-wash); }
.chip.used { opacity: .25; }
.chip.gone { display: none; }

.built { min-height: 4.95rem; margin-bottom: 1.1rem; }
.placeholder { color: var(--pencil); }
.pool { display: flex; flex-wrap: wrap; gap: .55rem; }
.tile { text-align: left; }

.strips { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.strip { display: flex; gap: .75rem; align-items: center; justify-content: space-between; background: var(--sheet); border: 1.5px solid var(--rule); border-left: 6px solid var(--ink); border-radius: 3px; padding: .5rem .7rem; font-size: 1.08rem; cursor: grab; }
.strip.ok { border-left-color: var(--green); background: var(--green-wash); }
.strip.bad { border-left-color: var(--red); background: var(--red-wash); }
.strip-btns { display: inline-flex; gap: .25rem; flex: none; }

.anagram-letters { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin: 1.5rem 0 1rem; }
.letter { width: 2.7rem; height: 3rem; display: grid; place-items: center; background: var(--sheet); border: 2px solid var(--ink); border-bottom-width: 5px; border-radius: 5px; font-weight: 800; font-size: 1.5rem; color: var(--ink-deep); }
.letter:nth-child(odd) { transform: rotate(-2deg); }
.letter:nth-child(3n) { transform: rotate(3deg); }
.big-input { font-size: 1.3rem; padding: .45rem .8rem; border: 1.5px solid var(--rule); border-bottom: 3px solid var(--ink); border-radius: 3px; text-align: center; width: min(20rem, 100%); background: var(--paper); color: var(--ink); }
.big-input.bad { border-color: var(--red); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.match-col { display: grid; gap: .5rem; align-content: start; }
.match-card, .mc-option { border: 2px solid var(--rule); border-bottom-width: 5px; background: var(--sheet); border-radius: 5px; padding: .55rem .8rem; text-align: left; font-size: 1.08rem; min-height: 3.1rem; color: var(--text); }
.match-card:hover:not(:disabled), .mc-option:hover:not(:disabled) { border-color: var(--ink); }
.match-card.picked { border-color: var(--ink-deep); background: var(--hi); }
.match-card.ok, .mc-option.ok { border-color: var(--green); background: var(--green-wash); color: var(--green); opacity: 1; font-weight: 600; }
.mc-option.bad { border-color: var(--red); background: var(--red-wash); color: var(--red); opacity: 1; }
.mc-prompt { font-weight: 800; font-size: 1.6rem; line-height: 1.25; margin: 1.25rem 0; color: var(--ink-deep); }
.mc-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }

/* flashcard: an index card */
.flash { display: grid; place-items: center; width: min(26rem, 100%); min-height: 13rem; margin: 1rem auto; padding: 1.5rem; background: var(--sheet) linear-gradient(transparent 2.6rem, var(--red) 2.6rem, var(--red) calc(2.6rem + 2px), transparent calc(2.6rem + 2px)); border: 2px solid var(--ink); border-bottom-width: 7px; border-radius: 6px; font-weight: 800; font-size: 1.6rem; line-height: 1.3; text-align: center; color: var(--ink-deep); }
.flash.flipped { background-color: var(--hi-wash); }

.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; }
.mem-card { aspect-ratio: 4 / 3; border: 2px solid var(--ink-deep); border-bottom-width: 5px; border-radius: 5px; padding: .4rem; font-size: 1rem; line-height: 1.2; overflow: hidden; color: var(--text);
  background-color: var(--ink); background-image: linear-gradient(rgba(255,255,255,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.16) 1px, transparent 1px); background-size: 11px 11px; }
.mem-card span { visibility: hidden; }
.mem-card.up { background: var(--sheet); }
.mem-card.up.side-b { background: var(--hi-wash); }
.mem-card.up span { visibility: visible; }
.mem-card.ok { background: var(--green-wash); border-color: var(--green); }

.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; outline: 3px solid var(--red); } }
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: .9rem .7rem 3rem; }
  .card { padding: 1.1rem 1rem 1.25rem 1rem; }
  .card::before { display: none; }
  .card.narrow { margin-top: 2vh; }
  .top { padding: .55rem .8rem; }
  .step-name { display: none; }
  .step { padding: 0; }
  .memory { grid-template-columns: repeat(3, 1fr); }
  .mem-card { font-size: .85rem; }
  .match { gap: .6rem; }
  .step-edit-name { width: auto; display: block; }
  .step-edit .strip-btns { margin-left: .4rem; }
  .gap-row { grid-template-columns: 1fr; gap: .2rem; }
  .en-row { grid-template-columns: 1fr; }
  .lf-text, .gap-text, .built { font-size: 1.1rem; }
  .tabs { order: 3; flex-basis: 100%; }
}

/* footer shared by every page */
.foot { max-width: 940px; margin: 0 auto; padding: 1.25rem 1.25rem 2.5rem; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: .88rem; color: var(--pencil); border-top: 1.5px dashed var(--rule); }
.foot a { color: var(--ink); text-underline-offset: 3px; }
.foot span:first-child { margin-right: auto; }
