/* Writing Practice: the same Sticker Book look as Email Room
   (../../email-room/css/style.css): a sunny yellow ground, cream cards with a
   thick dark outline and a hard shadow. */
:root {
  --ink: #221a3a; --sky: #6fd3c1; --pop: #e4452a;
  --bg: #ffd84d; --card: #fffdf5; --line: #e2d6ad; --muted: #5a5068;
  --good: #1f8a5b; --good-bg: #e3f6ec; --fix: #a34f00; --fix-bg: #fff1dc; --mark: #ffd2a6;
  --display: "Baloo 2", "Nunito", "Segoe UI", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --hard: 4px 4px 0 var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }
p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { padding: 24px; text-align: center; }
[hidden] { display: none !important; }
.small { font-size: 15px; color: var(--muted); }

main { max-width: 860px; margin: 0 auto; padding: 0 16px 48px; }
.card { background: var(--card); border: 3px solid var(--ink); border-radius: 18px; padding: 18px; box-shadow: var(--hard); margin-bottom: 16px; }

.btn { border: 3px solid var(--ink); border-radius: 14px; padding: 10px 20px; min-height: 48px; font-weight: 800; background: var(--sky); color: var(--ink); box-shadow: 0 4px 0 var(--ink); transition: transform .1s, box-shadow .1s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.big { font-family: var(--display); font-size: 22px; padding: 8px 28px; }
.btn.ghost { background: #fff; }
.in { width: 100%; min-height: 44px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; }
.in:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(34, 26, 58, .15); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.bar-btn { border: 0; background: none; font-weight: 800; padding: 10px 4px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.tag { background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; padding: 6px 14px; border-radius: 999px; }

/* ---------- home and the list of tasks ---------- */
.home { max-width: 640px; padding-top: 24px; }
.hero { display: flex; align-items: center; gap: 16px; background: var(--ink); color: #fff; border-radius: 22px; padding: 20px; margin-bottom: 18px; overflow: hidden; }
.hero-reyy { flex: 0 0 110px; align-self: flex-end; margin-bottom: -20px; }
.hero-reyy svg { display: block; width: 100%; }
.kicker { color: var(--sky); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .08em; }
.hero h1 { font-size: clamp(36px, 8vw, 54px); }
.hero-say { margin-top: 6px; color: #f3ecd6; }
.year-btns { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.year-btns .btn { flex: 1 1 140px; font-size: 26px; }
.menu { padding-top: 16px; }
.part { margin-bottom: 18px; }
.part h2 { font-size: 26px; margin-bottom: 8px; }
.part h2 span { font-family: var(--body); font-size: 16px; font-weight: 700; color: var(--muted); }
.task-list { display: grid; gap: 10px; }
.task-btn { width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--card); border: 3px solid var(--ink); border-radius: 16px; padding: 14px 16px; box-shadow: var(--hard); font-size: 19px; }
.task-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.task-kind { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--ink); }
.task-kind.guided { background: var(--sky); }
.task-kind.alone { background: #fff; }
.task-best { margin-left: auto; font-size: 15px; font-weight: 800; color: var(--good); }

/* ---------- Mr Reyy ---------- */
.coach { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; margin-bottom: 14px; background: #fff; border-radius: 18px; border: 3px solid var(--ink); box-shadow: var(--hard); min-height: 84px; }
.coach-face { flex: 0 0 68px; height: 68px; border-radius: 50%; background: var(--sky); overflow: hidden; border: 2px solid var(--ink); }
.coach-face svg { display: block; width: 100%; height: 100%; }
.coach-bubble { flex: 1; font-weight: 700; line-height: 1.35; min-width: 0; }
.coach-bm { margin-top: 4px; font-weight: 500; font-style: italic; font-size: 15px; color: var(--muted); }
.coach-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.coach-row:empty { display: none; }
.coach-step { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.coach-bm-btn { margin-left: auto; border: 0; background: none; font-size: 13px; font-weight: 800; color: var(--muted); text-decoration: underline; padding: 6px 4px; min-height: 36px; }
.coach-next { border: 2px solid var(--ink); background: var(--bg); border-radius: 999px; padding: 6px 16px; font-weight: 800; min-height: 40px; box-shadow: 0 3px 0 var(--ink); }
.coach[data-tone="fix"] { background: var(--fix-bg); }
.coach[data-tone="fix"] .coach-face { background: #ffd591; }
.coach[data-tone="good"] { background: var(--good-bg); }
.coach[data-tone="good"] .coach-face { background: #a9e3c5; }
.coach.pop { animation: pop .35s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes pop { from { transform: scale(.96); } to { transform: scale(1); } }
/* what Mr Reyy is pointing at */
.glow { position: relative; outline: 4px solid var(--pop); outline-offset: 4px; animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { outline-color: rgba(228, 69, 42, .25); } }
@media (prefers-reduced-motion: reduce) { .glow, .coach.pop { animation: none; } }
.play section[id], .play .card { scroll-margin-top: 150px; }

/* ---------- the question ---------- */
.q h1 { font-size: 26px; margin-bottom: 6px; }
.q-tell { margin-top: 10px; font-weight: 800; }
.points { display: grid; gap: 6px; margin-top: 6px; }
.points li { display: flex; gap: 10px; align-items: baseline; }
.num { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.q-words { margin-top: 10px; }

.plan h2 { font-size: 22px; margin-bottom: 10px; }
.plan-row { display: grid; grid-template-columns: 28px 1fr; gap: 6px 10px; align-items: center; margin-bottom: 10px; }
.plan-q { font-weight: 700; }
.plan-in { grid-column: 2; }

/* ---------- the poster ---------- */
.poster { border: 4px solid var(--ink); border-radius: 14px; padding: 14px; background: #fff; text-align: center; }
.poster.lost { background: repeating-linear-gradient(45deg, #fff, #fff 18px, #fff6f3 18px, #fff6f3 36px); }
.poster.notes { background: #fff; text-align: left; }
.poster.notes .poster-title { color: var(--ink); -webkit-text-stroke: 0; font-size: clamp(26px, 7vw, 36px); }
.poster.notes .poster-name { color: var(--muted); }
.checks-left { margin-top: 10px; }
/* the exam-style poster and notes card (examPoster in app.js): black and white, compact */
.poster.exam { background: #fff; border: 3px solid var(--ink); border-radius: 10px; padding: 10px; color: #111; }
.poster.exam .poster-title { color: #111; -webkit-text-stroke: 0; font-size: clamp(28px, 8vw, 42px); letter-spacing: .02em; }
.poster.exam .poster-name { margin: 2px 0 8px; }
.poster.exam .poster-name span { display: inline-block; border: 2.5px solid #111; border-radius: 8px; padding: 0 14px; font-family: var(--display); font-size: 22px; letter-spacing: .05em; }
.poster.exam .ficon { filter: grayscale(1); font-size: 17px; width: 22px; }
.ex-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 8px; text-align: left; }
.ex-art { width: 100%; height: auto; display: block; align-self: center; }
.poster.exam .pbox { border: 2px solid #111; border-radius: 10px; padding: 6px 8px; }
.poster.exam .pbox h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; background: #e8e8e8; border: 1.5px solid #111; border-radius: 6px; margin-bottom: 4px; padding: 1px 4px; }
.ex-lines { display: grid; gap: 0; }
.poster.exam .fact { min-height: 0; padding: 3px 2px; gap: 6px; border: 0; border-bottom: 1.5px dotted #999; border-radius: 0; background: none; font-size: 15px; font-weight: 600; color: #111; }
.poster.exam li:last-child .fact { border-bottom: 0; }
.poster.exam button.fact { min-height: 32px; }
.poster.exam button.fact.picked { background: #e9f7ef; }
.poster.exam .ex-big .fact { font-family: var(--display); font-size: 30px; font-weight: 800; justify-content: center; }
.ex-notes { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; align-items: center; text-align: left; }
.poster.exam.notes .poster-title { font-size: clamp(22px, 6vw, 30px); text-decoration: underline; text-underline-offset: 4px; }
.poster.exam.notes .poster-name { color: #444; font-weight: 700; margin-bottom: 4px; }
.poster.exam.notes .fact::before { content: "•"; font-weight: 800; }
@media (max-width: 520px) {
  .ex-notes { grid-template-columns: 1fr; }
  .ex-notes .ex-art { order: -1; max-height: 170px; object-fit: contain; }
}
.poster.event { background: repeating-linear-gradient(45deg, #fff, #fff 18px, #f1fbf3 18px, #f1fbf3 36px); }
.poster-title { font-size: clamp(30px, 8vw, 46px); letter-spacing: .03em; color: var(--pop); -webkit-text-stroke: 1px var(--ink); }
.event .poster-title { color: var(--good); }
.poster-name { font-weight: 800; margin-bottom: 4px; }
.poster-hint { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.poster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; text-align: left; margin-top: 8px; }
.pbox { border: 2.5px solid var(--ink); border-radius: 12px; padding: 10px; background: #fff; }
.pbox h3 { font-size: 18px; text-align: center; background: var(--bg); border-radius: 8px; margin-bottom: 6px; padding: 2px 6px; }
.pbox ul { display: grid; gap: 4px; }
.fact { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 2px solid transparent; background: none; border-radius: 10px; padding: 4px 8px; min-height: 40px; font-weight: 700; }
button.fact { border-color: var(--line); background: #fffdf5; }
button.fact.picked { background: var(--good-bg); border-color: var(--good); }
button.fact.picked::after { content: "✓"; margin-left: auto; color: var(--good); font-weight: 800; }
.ficon { font-size: 22px; width: 28px; text-align: center; }
.big-fact { font-family: var(--display); font-size: 28px; justify-content: center; text-align: center; }
.big-fact small { font-family: var(--body); font-size: 15px; display: block; }
.facts-count { margin-top: 8px; font-weight: 800; }

/* ---------- the map and the direction cards ---------- */
.map svg { display: block; width: 100%; height: auto; border: 3px solid var(--ink); border-radius: 12px; }
.map-key { font-size: 14px; color: var(--muted); margin-top: 6px; }
.key-pin { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; background: var(--pop); color: #fff; font-weight: 800; font-size: 12px; align-items: center; justify-content: center; }
.key-arrow { color: var(--pop); font-weight: 800; }
#cards-card h2 { font-size: 22px; }
.cards { display: grid; gap: 8px; margin-top: 10px; }
.dcard { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; padding: 8px 12px; min-height: 52px; font-weight: 700; box-shadow: 0 3px 0 var(--ink); }
.dcard.on { background: var(--good-bg); }
.dcard.bad { background: var(--fix-bg); border-color: var(--fix); animation: shake .4s; }
.dnum { flex: 0 0 34px; height: 34px; border-radius: 8px; border: 2.5px dashed var(--muted); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 20px; }
.dcard.on .dnum { border-style: solid; border-color: var(--ink); background: var(--ink); color: #fff; }
.dx { margin-left: auto; color: var(--fix); font-weight: 800; font-size: 20px; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.order-msg { margin-top: 8px; font-weight: 800; }
.order-msg.good { color: var(--good); }
.order-msg.fix { color: var(--fix); }
.writer.locked textarea { background: #eee; }
.lock-note { font-weight: 800; margin-bottom: 8px; }

/* ---------- the diary ---------- */
.diary-title { font-size: 34px; text-align: center; margin-bottom: 10px; }
.diary-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .diary-grid { grid-template-columns: 1fr 220px; } }
.diary-boxes { display: grid; gap: 10px; }
.dbox { display: flex; gap: 12px; border: 2.5px solid var(--ink); border-radius: 14px; padding: 10px; background: #fff; }
.dpic { flex: 0 0 92px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; font-size: 30px; line-height: 1.2; background: #f4f9ff; border-radius: 10px; text-align: center; }
.dpic:has(img) { flex-basis: 150px; background: #fff; }
.dpic img { width: 100%; height: auto; border-radius: 6px; }
.dbox h3 { font-size: 18px; }
.dlabel { font-size: 14px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.dline { font-size: 16px; }
.helper { border: 2.5px dashed var(--ink); border-radius: 14px; padding: 10px; background: #fff; }
.helper h3 { font-size: 18px; text-align: center; margin-bottom: 6px; }
.helper li { font-size: 15px; padding: 4px 0; border-bottom: 1px solid var(--line); }

/* ---------- writing ---------- */
.mail-head { border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: #fff; font-size: 16px; }
.mail-head span { font-weight: 800; display: inline-block; width: 74px; }
/* Ruled like an exercise book: one line every 34px, the same as the line height, starting
   where the writing starts (the 4px top padding) and moving with the writing when it scrolls. */
textarea { width: 100%; padding: 4px 12px 12px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff repeating-linear-gradient(transparent 0 29px, #d9cfae 29px 30.5px, transparent 30.5px 34px) 0 4px local; line-height: 34px; font-size: 19px; resize: vertical; }
.write-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.count { font-size: 15px; font-weight: 800; color: var(--fix); }
.count.ok { color: var(--good); }
.checks { display: grid; gap: 4px; margin: 10px 0 14px; }
.checks li { display: flex; gap: 8px; align-items: center; font-size: 16px; color: var(--muted); }
.checks .tick { flex: 0 0 24px; height: 24px; border-radius: 6px; border: 2px solid var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; }
.checks li.ok { color: var(--ink); font-weight: 700; }
.checks li.ok .tick { background: var(--good); border-color: var(--good); }
.send { width: 100%; }

/* ---------- the help above the writing box (all of it shown, no scrolling inside) ---------- */
.crib { border: 2px dashed var(--ink); border-radius: 12px; background: #fffbe6; padding: 8px 10px; margin-bottom: 10px; font-size: 15px; line-height: 1.35; }
.crib-list { display: grid; gap: 5px; }
.crib-list li { display: flex; gap: 8px; align-items: flex-start; }
.crib-list .num { flex: 0 0 22px; height: 22px; font-size: 13px; }
.crib-plan { color: var(--good); }
.crib-facts { display: flex; flex-wrap: wrap; gap: 5px; }
.crib-facts li { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px 10px; font-weight: 700; }
.starters { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.starter { display: inline; text-align: left; border: 1.5px solid var(--good); background: #fff; border-radius: 10px; padding: 2px 8px 2px 4px; margin: 2px 0; font-weight: 700; color: var(--ink); line-height: 1.5; }
.starter .plus { display: inline-block; width: 18px; height: 18px; margin-right: 4px; border-radius: 50%; background: var(--good); color: #fff; font-size: 13px; line-height: 18px; text-align: center; }
.starter .gap { color: var(--muted); }
.starter.used { border-color: var(--line); color: var(--muted); }
.starter.used .plus { background: var(--muted); }
.crib-pic { flex: 0 0 62px; font-size: 15px; white-space: nowrap; }   /* the same width for two or three pictures, so the sentences line up */

/* ---------- a class link: the pupil's name ---------- */
.who p { margin-bottom: 8px; }
.field-label { display: block; font-weight: 800; margin-bottom: 6px; }
.form-msg { color: var(--fix); font-weight: 700; min-height: 1em; }
.name-list { display: grid; gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px 4px 8px; margin-top: 8px; }
.name-pick { min-height: 48px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 700; text-align: left; }
.name-pick:hover, .name-pick:focus-visible { border-color: var(--ink); }
.who-line { margin: -6px 0 14px; font-size: 16px; }
.me-cls-label { margin-top: 12px; }
.cls-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.cls-btn { min-height: 46px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 800; }
.cls-btn.on { border-color: var(--ink); background: var(--sky); box-shadow: 0 3px 0 var(--ink); }
.to-teacher { margin-top: 10px; font-weight: 800; }

/* ---------- the marks ---------- */
.ai h2 { font-size: 26px; }
.ai h3 { font-size: 20px; margin: 14px 0 6px; }
.ai-wait { margin-top: 8px; font-weight: 700; }
.result-top { display: flex; gap: 14px; align-items: center; }
.result-reyy { flex: 0 0 90px; height: 90px; border-radius: 50%; background: var(--sky); overflow: hidden; border: 2px solid var(--ink); }
.result-reyy svg { width: 100%; height: 100%; display: block; }
.total { color: var(--good); }
.scores { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.scores li { font-size: 16px; display: flex; gap: 6px; }
.well { margin-top: 12px; font-weight: 800; color: var(--good); }
.tip { margin-top: 8px; background: var(--fix-bg); border-radius: 10px; padding: 8px 12px; }
.fixes { display: grid; gap: 6px; }
.fixes li { font-size: 17px; }
.was { background: var(--mark); border-radius: 4px; padding: 0 4px; text-decoration: line-through; text-decoration-color: rgba(163, 79, 0, .6); }
.now { background: var(--good-bg); border-radius: 4px; padding: 0 4px; font-weight: 800; }
pre { white-space: pre-wrap; word-wrap: break-word; font: 18px/1.6 var(--body); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; }
pre mark { background: var(--mark); border-radius: 4px; padding: 0 2px; }
pre.fixed { border-color: var(--good); background: #f6fdf9; }
.model { margin-top: 14px; }
.model summary { font-weight: 800; cursor: pointer; padding: 8px 0; }
.ai-note { margin-top: 12px; }
.after { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.after .btn { flex: 1 1 200px; }

@media (max-width: 480px) {
  body { font-size: 17px; }
  .coach { gap: 8px; padding: 6px 10px 6px 6px; min-height: 0; }
  .coach-face { flex-basis: 46px; height: 46px; align-self: flex-start; }
  .coach-bubble { font-size: 15.5px; line-height: 1.3; }
  .coach-bm { font-size: 13.5px; margin-top: 2px; }
  .coach-row { margin-top: 2px; }
  .coach-next { min-height: 36px; padding: 4px 14px; }
  .card { padding: 14px; }
  .dpic { flex-basis: 70px; font-size: 24px; }
  .dpic:has(img) { flex-basis: 112px; }
  /* with the phone's keyboard open, Mr Reyy, the help and the box fit on the screen together; the box scrolls inside */
  .crib { font-size: 14px; padding: 6px 8px; }
  .crib-list { gap: 3px; }
  #write { height: 186px; }   /* five lines */
}
