/* Study Loop Kit — app styles. Phone first (360 px), RTL first, touch and mouse. Components add their own CSS
   (style.css in their folder, bundled into components.js and added to the page by the shells). */

/* ---------------------------------------------------------------- fonts (bundled; system fonts if they fail) */
@font-face { font-family: "Readex"; src: url("../assets/fonts/readex-arabic-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Readex"; src: url("../assets/fonts/readex-arabic-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Readex"; src: url("../assets/fonts/readex-arabic-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Readex"; src: url("../assets/fonts/readex-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Readex"; src: url("../assets/fonts/readex-latin-600.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Readex"; src: url("../assets/fonts/readex-latin-700.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Baloo"; src: url("../assets/fonts/baloo-arabic-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Baloo"; src: url("../assets/fonts/readex-latin-700.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0030-0039, U+0025, U+002D-002F; }
@font-face { font-family: "Scheherazade"; src: url("../assets/fonts/ScheherazadeNew-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Scheherazade"; src: url("../assets/fonts/ScheherazadeNew-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #faf6ef;
  --card: #ffffff;
  --soft: #f4efe6;
  --ink: #2b2620;
  --muted: #6b6257;
  --line: #ddd3c3;
  --accent: #0b6e60;        /* 5.2:1 on --accent-soft, 6:1 on white */
  --accent-ink: #ffffff;
  --accent-soft: #dff1ec;
  --ok: #17703c;            /* 5.4:1 on --ok-soft */
  --ok-soft: #e3f4e8;
  --mid: #b7791f;           /* borders and dots only; text in --mid-ink */
  --mid-ink: #8a5a12;
  --bad: #c2410c;
  --bad-soft: #fdeadf;
  --bad-ink: #a3370a;       /* text on --bad-soft: 5.8:1 */
  --radius: 16px;
  --ui: "Readex", system-ui, -apple-system, "Segoe UI", "Geeza Pro", "Noto Sans Arabic", Tahoma, sans-serif;
  --display: "Baloo", "Readex", system-ui, "Geeza Pro", "Noto Sans Arabic", Tahoma, sans-serif;
  --book: "Scheherazade", "Noto Naskh Arabic", "Geeza Pro", "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 17px; line-height: 1.5; }
button, input, textarea { font: inherit; color: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.view { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }

/* ---------------------------------------------------------------- buttons */
.btn { -webkit-tap-highlight-color: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--card); color: var(--ink); font-weight: 600;
  cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn:hover { border-color: var(--accent); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-big { width: 100%; min-height: 60px; font-size: 1.1em; }
.btn-small { min-height: 44px; padding: 6px 14px; font-size: .92em; }

/* ---------------------------------------------------------------- app bar, tabs, views */
body { padding-bottom: env(safe-area-inset-bottom); }
body[data-view="home"] .view, body[data-view="lessons"] .view, body[data-view="progress"] .view { padding-bottom: 96px; }
.appbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 640px; margin: 0 auto;
  padding: 10px 16px 0; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.15em; color: var(--accent); margin: 0; }
.icon-btn { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 2px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 18px;
  touch-action: manipulation; }
.icon-btn:focus-visible, .tab:focus-visible, .seg-btn:focus-visible, .chip:focus-visible, .mk-res:focus-visible,
.choice-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tabs { position: fixed; z-index: 5; inset-inline: 0; bottom: 0; display: flex; justify-content: center; gap: 4px;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(60, 45, 20, .06); }
.tab { flex: 1 1 0; max-width: 200px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-weight: 600; font-size: .85em; cursor: pointer;
  touch-action: manipulation; }
.tab[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.page-title { font-family: var(--display); font-size: 1.4em; margin: 6px 0 14px; }
.sub-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sub-top .page-title { margin: 0; }
.sub-top:has(> :only-child) { justify-content: flex-end; }
.sec-title { display: block; font-size: 1.02em; margin: 0 0 10px; }
.muted { color: var(--muted); margin: 4px 0; }
.hint { color: var(--muted); font-size: .9em; margin: 8px 0 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toast { position: fixed; z-index: 9; inset-inline: 16px; bottom: 92px; margin: 0 auto; max-width: 480px; padding: 12px 16px;
  border-radius: 14px; background: #2b2620; color: #fff; font-weight: 600; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.btn-wide { width: 100%; }
.btn-hero { width: 100%; min-height: 68px; font-size: 1.3em; border-radius: 18px; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(60, 45, 20, .06); }
.badge { display: inline-block; font-size: .78em; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft);
  color: var(--accent); font-weight: 600; margin: 0; }
.lesson-title { font-family: var(--display); font-size: 1.2em; line-height: 1.4; margin: 8px 0 4px; overflow-wrap: anywhere; }
.fix { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--bad-soft); display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px; justify-content: space-between; }
.fix p { margin: 0; }
details.more { margin: 0 0 12px; color: var(--muted); font-size: .92em; }
details.more summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
details.more ul { margin: 6px 0 0; padding-inline-start: 20px; }
.error { color: var(--bad); font-weight: 600; margin: 10px 0; }
.saved { color: var(--muted); font-size: .88em; text-align: center; margin: 8px 0 0; }
.saved-warn { color: var(--bad); font-weight: 600; }
.oops { font-weight: 600; }
body.dragging::after { content: ""; position: fixed; inset: 8px; border: 4px dashed var(--accent); border-radius: 20px;
  background: rgba(13, 122, 107, .06); pointer-events: none; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* first opening */
.hero { padding: 8px 2px 4px; }
.hero-title { font-family: var(--display); font-size: 1.55em; line-height: 1.35; margin: 4px 0 8px; color: var(--ink); }
.hero-line { color: var(--muted); margin: 0 0 16px; }
.demo-card { border: 2px solid var(--accent); }
.demo-card .btn-big { margin-top: 10px; }
.add-row { display: grid; gap: 10px; }
.paste-box { margin-top: 10px; display: grid; gap: 8px; }
.paste-text { width: 100%; min-height: 120px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.folder { margin-top: 14px; }
.folder h3 { font-size: 1em; margin: 0 0 6px; }
.folder ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.folder-btn { width: 100%; justify-content: flex-start; text-align: start; }

/* the three ways in (first screen, Lessons) */
.ways { display: grid; gap: 10px; }
.btn-way { min-height: 56px; justify-content: flex-start; text-align: start; font-size: 1.05em; }
.btn-way[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.way-panel { padding: 2px 2px 8px; display: grid; gap: 10px; }
.way-line { margin: 0; color: var(--muted); }
.way-steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 4px; }
/* phones cannot drag a file onto the page: no "drop the file here" line there */
@media (hover: none) and (pointer: coarse) { .drop-hint { display: none; } }

/* home */
.today { padding: 18px 16px; }
.today-title { font-family: var(--display); font-size: 1.45em; line-height: 1.35; margin: 0 0 6px; }
.today-why { margin: 0 0 14px; }
.today-min { text-align: center; margin-top: 8px; }
.today-done, .today-nothing { background: var(--ok-soft); border-color: #bfe3cb; }
.rolled { font-size: .9em; margin-top: 12px; }
.card-title { font-size: 1.08em; margin: 0 0 4px; }
.card-line { margin: 0 0 4px; font-weight: 600; }
.home-card .btn { margin-top: 8px; }
.card-sheet { border-inline-start: 6px solid var(--mid); }
.card-fix { border-inline-start: 6px solid var(--bad); }

/* the exchange with the assistant, backup (Home cards, the answer page, Settings, sharing) */
.card-paste { border: 2px solid var(--accent); }
.card-paste .btn-hero { margin: 12px 0 4px; }
.card-paste .row { display: grid; grid-template-columns: 1fr 1fr; }
.card-paste .row .btn { margin-top: 4px; width: 100%; }
.card-paste .row .btn-quiet { grid-column: 1 / -1; }
.card-send .btn-small { margin-top: 4px; }
.card-send { border-inline-start: 6px solid var(--accent); }
.card-backup { border-inline-start: 6px solid var(--mid); }
.ask-list { margin: 6px 0 4px; padding-inline-start: 22px; display: grid; gap: 2px; }
.ask-list li { overflow-wrap: anywhere; }
.answer-card { display: grid; gap: 10px; }
.answer-card > * { margin: 0; }
.answer-card .badge { justify-self: start; }
.badge-bad { background: var(--bad-soft); color: #9a3412; }  /* 5.9:1 */
.answer-line { font-weight: 700; font-size: 1.08em; overflow-wrap: anywhere; }
.answer-new { font-weight: 600; color: var(--accent); }
.answer-note { padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); }
.answer-note p { margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-line; }
.answer-note .sec-title { margin: 0; color: var(--accent); }
.paste-answer { min-height: 180px; font-family: var(--ui); font-size: 15px; }
.set-row { display: grid; gap: 8px; }
.share { display: grid; gap: 8px; }
.share h3 { margin: 0; font-size: 1em; }
.share-line { margin: 0; }

/* the "lesson added" / child question pages */
.added-card .btn { margin-top: 10px; }
.ask { text-align: center; padding-top: 12vh; }
.ask-title { font-family: var(--display); font-size: 1.5em; line-height: 1.4; margin: 0 0 8px; }
.ask-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.btn-choice { min-height: 96px; font-size: 1.35em; }

/* lessons */
.lesson-row .row { margin-top: 10px; }
.lesson-more:empty { display: none; }
.lesson-more { margin-top: 12px; }
.choose { display: grid; gap: 10px; }
.choose h3, .confirm p { margin: 0; font-size: 1em; }
.choice-btn { display: grid; gap: 2px; text-align: start; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--soft); cursor: pointer; touch-action: manipulation; }
.choice-btn:hover { border-color: var(--accent); }
.choice-btn span { color: var(--muted); font-size: .9em; }
.confirm { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--bad-soft); }

/* progress */
.pg-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.pg-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--soft); }
.pg-dot { flex: none; width: 16px; height: 16px; border-radius: 50%; margin-top: 5px; background: var(--line); }
.pg-ok { background: var(--ok); }
.pg-mid { background: #e0a526; }
.pg-bad { background: var(--bad); }
.pg-new { background: transparent; border: 2px solid var(--line); }
.pg-text p { margin: 0; }
.pg-name { font-weight: 700; }
.pg-state { margin-top: 2px !important; }
.pg-small { color: var(--muted); font-size: .88em; }
.empty p { margin: 0; color: var(--muted); }

/* settings */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-btn { flex: 1 1 90px; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card);
  font-weight: 600; cursor: pointer; touch-action: manipulation; }
.seg-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.date { min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); }
.keep-state { margin: 0 0 8px; }

/* marking card */
.mk-head .lesson-title { font-size: 1.05em; margin-top: 0; }
.mk-how { margin: 8px 0 0; font-weight: 600; }
.mk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mk-row { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; scroll-margin: 80px; }
.mk-row[data-result="wrong"] { border-color: var(--bad); background: var(--bad-soft); }
.mk-row[data-result="half"] { border-color: var(--mid); background: #fdf3dc; }
.mk-next { box-shadow: 0 0 0 3px var(--accent); }
.mk-top { display: flex; align-items: flex-start; gap: 10px; }
.mk-num { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .9em; }
.mk-key { flex: 1; min-width: 0; font-size: .95em; overflow-wrap: anywhere; }
.mk-key :first-child { margin-top: 0; }
.mk-key :last-child { margin-bottom: 0; }
.mk-key table { max-width: 100%; }
/* the result button keeps one place and one size whatever its word (✓ Juste · ✗ Faux · ½ À moitié): tapping the
   same spot again always hits it */
.mk-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px; margin-top: 8px; }
.mk-res { width: 7.6em; min-height: 44px; padding: 6px 8px; border-radius: 12px; border: 2px solid var(--ok); white-space: nowrap;
  background: var(--ok-soft); color: var(--ok); font-weight: 700; cursor: pointer; touch-action: manipulation; }
.mk-wrong { border-color: var(--bad); background: #fff; color: var(--bad); }
.mk-half { border-color: var(--mid); background: #fff; color: var(--mid-ink); }
.mk-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.chip { min-height: 44px; padding: 6px 10px; border-radius: 99px; border: 2px solid var(--line); background: var(--card); color: var(--muted);
  font-size: .85em; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.chip[aria-pressed="true"] { border-color: var(--mid); background: #fdf3dc; color: var(--ink); }
.mk-confirm .row .btn { flex: 1 1 120px; }
.mk-foot { position: sticky; bottom: 0; display: grid; gap: 6px; padding: 12px 0 8px; margin-top: 8px;
  background: linear-gradient(to bottom, rgba(250, 246, 239, 0), var(--bg) 22%); }

/* ---------------------------------------------------------------- play shell */
.play { display: flex; flex-direction: column; gap: 14px; }
.play-top { display: flex; align-items: center; gap: 12px; }
.play-x { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: var(--card);
  font-size: 18px; cursor: pointer; }
.play-dots { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; flex: 1; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dot-done { background: var(--accent); }
.dot-now { background: var(--card); border: 3px solid var(--accent); }
.play-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  font-size: 1.12em; }
.play[lang^="ar"] .play-card { font-family: var(--book); }
.play[lang^="ar"] .play-card .cl-how { font-family: var(--ui); }
.play-card .cl-q { font-size: 1.15em; }
.play-card .cl-card { font-size: 1.1em; }
.play-help { display: flex; flex-wrap: wrap; gap: 8px; }
.help-btn { min-height: 44px; padding: 8px 14px; border-radius: 99px; border: 2px solid var(--line); background: var(--card);
  cursor: pointer; font-weight: 600; font-size: .92em; }
.help-btn[aria-pressed="true"] { border-color: var(--mid); background: #fdf3dc; }
.help-read::before { content: "🗣 "; }
.help-strong { border-color: var(--accent); background: var(--accent-soft); }
.play-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #fdf3dc; }
.play-ask p { margin: 0; flex: 1 1 180px; font-weight: 600; }
.play-claim { align-self: center; min-height: 44px; padding: 6px 14px; border-radius: 99px; border: 2px dashed var(--line);
  background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.play-confirm { padding: 12px; border-radius: 14px; background: var(--card); border: 2px solid var(--mid); }
.play-confirm-q { margin: 0 0 10px; font-weight: 700; }
.play-confirm-row { display: flex; flex-wrap: wrap; gap: 8px; }
.play-confirm-row .btn { flex: 1 1 120px; }
.end-next { font-weight: 600; }
.end-actions .btn-big { max-width: 360px; }
.help-listen::before { content: "🔊 "; }
.help-hint::before { content: "💡 "; }
.help-btn:disabled { opacity: .6; cursor: default; }
.play-hint { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fdf3dc; }
.play-feedback { margin: 4px 0 0; min-height: 1.5em; font-weight: 700; font-size: 1.1em; text-align: center; }
.play-media { margin: 0 0 12px; text-align: center; }
.play-media img { max-width: 100%; max-height: 40vh; border-radius: 10px; }
.play-media-alt, .p-media-alt { border: 2px dashed var(--line); border-radius: 10px; padding: 8px 12px; color: var(--muted); text-align: start; }
.end-warn { color: var(--bad); font-weight: 600; }
.fb-ok { color: var(--ok); }
.fb-mid { color: var(--mid-ink); }
.fb-not { color: var(--muted); }
.fb-bad { color: var(--bad); }
.play-next { width: 100%; min-height: 56px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 1.1em; cursor: pointer; }
.play-skip { color: var(--muted); }
.play-end { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 16px; }
.play-end h2 { font-family: var(--display); font-size: 1.6em; margin: 0 0 8px; color: var(--accent); }
.play-end p { margin: 4px 0; }
.end-help { color: var(--muted); }
.end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }

/* ---------------------------------------------------------------- paper shell (fixed A4 pages) */
#view-paper.view { max-width: none; padding: 0 0 24px; background: #8f8a82; min-height: 100vh; }
.paper-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--bg); border-bottom: 1px solid var(--line); }
.paper-bar .hint { flex: 1 1 200px; margin: 0; font-size: .85em; color: var(--muted); }
.paper-pages { position: relative; margin: 16px auto 0; }
.paper-sheet { position: absolute; top: 0; left: 0; width: 210mm; transform-origin: 0 0; }
.page { width: 210mm; height: 297mm; margin: 0 auto 12px; background: #fff; color: #1d1a16; overflow: hidden; position: relative;
  padding: 13mm 14mm 9mm; display: flex; flex-direction: column; box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
  font-family: var(--ui); font-size: 11.5pt; line-height: 1.45; }
.paper-pages[lang^="ar"] .page { font-family: var(--book); font-size: 14.5pt; line-height: 1.45; }
.page-flow { flex: 1; min-height: 0; overflow: hidden; }
.page-foot { display: flex; justify-content: space-between; gap: 8mm; padding-top: 2mm; border-top: .25mm solid #b9b0a2;
  font-family: var(--ui); font-size: 8pt; color: #6b6257; }
/* the kit's brand mark (SLK.paper.marks, the host of app/config.js "pages"): the host centred in the footer, like a
   footnote, which stays one line (the code is cut with "…" rather than wrapped); none with pages "" */
.page-foot.p-branded { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: baseline; }
.p-branded .p-code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-branded .p-pnum { justify-self: end; }
.p-brand { color: #8a8174; letter-spacing: .03em; white-space: nowrap; }
.p-block { break-inside: avoid; }
.p-head { border: .4mm solid #3d362c; border-radius: 3mm; padding: 3mm 5mm; margin-bottom: 5mm; }
.p-head h1 { font-family: var(--display); font-size: 17pt; line-height: 1.3; margin: 0 0 2mm; }
.p-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4mm; font-family: var(--ui); font-size: 10pt; color: #3d362c; }
.p-item { padding: 1.5mm 0 3mm; border-bottom: .2mm dashed #cfc6b8; margin-bottom: 3mm; }
.p-ih { display: flex; align-items: center; gap: 3mm; margin-bottom: 1.5mm; }
.p-num { display: inline-flex; align-items: center; justify-content: center; min-width: 8mm; height: 8mm; padding: 0 1.5mm;
  border-radius: 50%; background: #2b2620; color: #fff; font-family: var(--ui); font-weight: 700; font-size: 11pt; }
.p-pts { font-family: var(--ui); font-size: 9pt; color: #5b5348; }
.tk { margin-inline-start: auto; display: flex; flex-direction: column; gap: .6mm; font-family: var(--ui); font-weight: 400;
  font-size: 7.4pt; line-height: 3.4mm; color: #5b5348; }
.tk > span { display: flex; align-items: center; gap: 1.4mm; white-space: nowrap; }
.tk .bx { display: inline-block; width: 3.2mm; height: 3.2mm; border: .3mm solid #5b5348; border-radius: .5mm; background: #fff; flex: none; }
.p-body { padding-inline-start: 1mm; }
/* a sheet whose last page would hold one question alone is poured again tighter (SLK.paper.layout) */
.page.p-tight { font-size: 10.5pt; line-height: 1.25; padding-top: 10mm; }
.paper-pages[lang^="ar"] .page.p-tight { font-size: 13pt; line-height: 1.25; }
.page.p-tight .p-head { padding: 1.5mm 4mm; margin-bottom: 2.5mm; }
.page.p-tight .p-head h1 { font-size: 15pt; margin-bottom: .5mm; }
.page.p-tight .p-item { padding: .5mm 0 1.2mm; margin-bottom: 1.2mm; }
.page.p-tight .p-ih { margin-bottom: .4mm; }
.page.p-tight td, .page.p-tight th { padding-top: .5mm; padding-bottom: .5mm; }
.p-fail { color: #9a3412; }
.p-media { margin: 0 0 2mm; }
.p-media img { max-width: 70mm; max-height: 50mm; }
.paper-pages .p-media-alt { border: .3mm dashed #8a8174; border-radius: 2mm; padding: 1.5mm 3mm; color: #3d362c; font-size: .9em; }
.p-cut { outline: .6mm dashed #c2410c; }
@media print { .p-cut { outline: none; } }
.p-guide { border: .4mm solid #0d7a6b; border-radius: 3mm; padding: 3mm 5mm; margin-bottom: 5mm; font-family: var(--ui); font-size: 10pt; }
.p-guide h2 { font-size: 12pt; margin: 0 0 2mm; color: #0d7a6b; }
.p-guide ol { margin: 0; padding-inline-start: 6mm; }
.p-guide li { margin-bottom: 1mm; }
.k-title { font-family: var(--display); font-size: 13pt; margin: 0 0 3mm; }
.k-item { display: flex; gap: 3mm; align-items: flex-start; margin-bottom: 2.5mm; font-size: .9em; }
.k-item .p-num { min-width: 6.5mm; height: 6.5mm; font-size: 9pt; flex: none; }
.k-body { flex: 1; }

@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(#view-paper) { display: none !important; }
  #view-paper.view { background: none; padding: 0; min-height: 0; }
  .paper-bar { display: none !important; }
  .paper-pages { width: auto !important; height: auto !important; margin: 0; position: static; }
  .paper-sheet { position: static; transform: none !important; width: auto; }
  .page { margin: 0; box-shadow: none; height: 296.8mm; }
  .page + .page { break-before: page; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Stage 5: Report a mistake's question list (44 px), the answer on a tapped shared lesson */
.report-item { display: block; width: 100%; min-height: 48px; font: inherit; padding: 8px 12px; margin: 4px 0 8px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--card, #fff); color: inherit; }
.choice-btn .community-said { font-weight: 600; }
.choice-btn .community-said.error { color: var(--bad); }
.choice-btn[aria-busy="true"] { opacity: .8; }

@media (max-width: 380px) {
  body { font-size: 16px; }
  .card { padding: 14px; }
}

/* Stage 6: photos of a sheet on the marking card (app/ui/photos.js) */
.ph-host { margin-bottom: 14px; }
.ph-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ph-row { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--line); border-radius: 12px; padding: 8px; }
.ph-row.ph-bad { border-color: var(--bad); background: var(--bad-soft); }
.ph-thumb { width: 96px; height: 128px; object-fit: cover; border-radius: 8px; background: var(--line); flex: 0 0 auto; }
.ph-info { flex: 1 1 auto; min-width: 0; }
.ph-name { font-weight: 600; margin: 0 0 4px; }
.ph-state { margin: 0 0 8px; }
.ph-days { font-size: .9em; }
.ph-attach { font-weight: 600; overflow-wrap: anywhere; }
/* Stage 6 review: "too dark" on the pink row was 4.44:1 (F25); --bad-ink is 5.8:1 on --bad-soft */
.ph-row.ph-bad .ph-state.error { color: var(--bad-ink, #a3370a); }
.ph-ways { gap: 8px; }
.ph-ways .btn { flex: 1 1 140px; }
.card-photos .row { gap: 8px; flex-wrap: wrap; }
.card-photos-unread { border: 2px solid var(--mid); }
.pg-held { color: var(--mid-ink); font-weight: 600; }
.ph-result { margin: 14px 0; }
.ph-marks { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.ph-m { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; min-height: 44px; box-sizing: border-box; }
.ph-m-n { font-weight: 700; min-width: 1.6em; text-align: center; }
.ph-m-sign { font-weight: 700; }
.ph-m-right .ph-m-sign { color: var(--ok); }
.ph-m-wrong .ph-m-sign { color: var(--bad-ink, #a3370a); }
.ph-m-half .ph-m-sign { color: var(--mid-ink); }
.ph-m-wait { border-style: dashed; background: var(--soft); }
.ph-m-t { font-size: .92em; }
.mk-photos .mk-list, .mk-photos .mk-foot { display: none; }

/* Stage 9: the owner's loop on Home (app/ui/loop.js): the strip of five steps, the new-lesson and child-film cards */
.loop-strip { padding: 12px 14px; border-inline-start: 6px solid var(--accent); }
.loop-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.loop-title { font-size: .98em; margin: 0; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.loop-round { flex: 0 0 auto; margin: 0; }
.loop-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.loop-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  color: var(--muted); font-size: .76em; line-height: 1.45; min-width: 0; }
.loop-step + .loop-step::before { content: ""; position: absolute; top: 14px; inset-inline-end: calc(50% + 15px); width: calc(100% - 24px);
  height: 2px; background: var(--line); }
.loop-step.loop-done + .loop-step::before { background: var(--ok); }
.loop-step.loop-skipped + .loop-step::before { background: var(--line); }
.loop-dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; line-height: 1; }
.loop-name { display: block; font-size: .82rem; hyphens: manual; overflow-wrap: normal; word-break: keep-all; white-space: nowrap; }
/* French step names are the longest (« Correction », « Rattrapage »): a smaller size keeps them apart at 360 px */
:lang(fr) .loop-name { font-size: .68rem; }
.loop-done .loop-dot { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.loop-skipped .loop-dot { border-color: var(--line); background: var(--card); color: var(--muted); }
/* the skipped film's dash is a button (asks for the film): a 44 px touch target around the 30 px dot */
.loop-strip .loop-dot-btn { margin: 0; padding: 0; min-height: 0; cursor: pointer; font: inherit; font-weight: 700; }
.loop-dot-btn::after { content: ""; position: absolute; inset: -7px; }
.loop-caption { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }
.loop-strip .btn-wide { margin-top: 10px; }
.loop-now { color: var(--ink); }
.loop-step.loop-now .loop-dot { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.loop-step.loop-now .loop-name { color: var(--accent); font-weight: 700; }
.loop-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loop-hint { margin: 10px 0 0; font-size: .92em; color: var(--muted); }
.loop-hint .loop-now { display: block; color: var(--accent); }
.loop-new { border: 2px solid var(--accent); }
.loop-new .btn-wide, .loop-child .btn-wide { margin-top: 10px; }
.loop-row { margin-top: 6px; }
.loop-row .btn { flex: 1 1 120px; min-height: 44px; }
.loop-row .btn-quiet { flex: 0 1 auto; }
.loop-asked { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.loop-child { border: 2px solid var(--mid); }
.loop-line { margin: 4px 0 0; }
.loop-skills { margin: 4px 0 0; padding: 0; list-style-position: inside; font-weight: 600; }
/* the diagnostic test: one line before item 1 (play), its line under the sheet's title and the note to the parent */
.play-intro { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); line-height: 1.6; }
.p-diag { margin: 1mm 0 2mm; font-family: var(--ui); font-size: 10.5pt; color: #3d362c; }
.p-diag-note { margin: 3mm 0; font-family: var(--ui); font-size: 10pt; }
