/* Revision: chunky sticker style on exercise-book paper. */

:root {
    --paper: #f3f5fb;
    --grid: rgba(70, 110, 200, .09);
    --surface: #ffffff;
    --surface-2: #e9ecf7;
    --ink: #1d1f3f;
    --text: #1d1f3f;
    --muted: #5f6488;
    --line: #1d1f3f;
    --soft-line: #cfd4ea;
    --accent: #6a4cff;
    --accent-ink: #ffffff;
    /* Words on green and orange: dark in both themes, since white on them is under 3:1. */
    --on-good: #1d1f3f;
    --on-miss: #1d1f3f;
    --good: #19b37a;
    --good-soft: #d7f6e8;
    --miss: #f08a24;
    --miss-soft: #ffe9d2;
    --gold: #ffc531;
    --silver: #b9c6dc;
    --bronze: #d68a4b;
    --grey: #dfe3f1;
    --subject: var(--accent);
    --on-subject: var(--accent-ink);
    --shadow-hard: 0 3px 0 var(--ink);
    --radius: 20px;
    --display: 'Lexend Giga', 'Lexend', system-ui, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #17183a;
        --grid: rgba(150, 160, 255, .07);
        --surface: #25275a;
        --surface-2: #2f3270;
        --ink: #07081c;
        --text: #f2f2ff;
        --muted: #a9acd6;
        --line: #07081c;
        --soft-line: #3a3d7a;
        --accent: #8f7bff;
        --accent-ink: #0b0c24;
        --good: #3ad69a;
        --good-soft: #163f39;
        --miss: #ffa24a;
        --miss-soft: #4a3020;
        --grey: #3a3d72;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --paper: #17183a;
    --grid: rgba(150, 160, 255, .07);
    --surface: #25275a;
    --surface-2: #2f3270;
    --ink: #07081c;
    --text: #f2f2ff;
    --muted: #a9acd6;
    --line: #07081c;
    --soft-line: #3a3d7a;
    --accent: #8f7bff;
    --accent-ink: #0b0c24;
    --good: #3ad69a;
    --good-soft: #163f39;
    --miss: #ffa24a;
    --miss-soft: #4a3020;
    --grey: #3a3d72;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    color: var(--text);
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 22px 22px;
    background-attachment: fixed;
    font-family: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 17px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.rq-app {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: max(14px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.rq-center { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; }

h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.display { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; }

/* Buttons that press down */
.btn {
    position: relative;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 58px; padding: 12px 20px;
    border: 2.5px solid var(--ink); border-radius: 16px;
    background: var(--surface); color: var(--text);
    font-weight: 700; font-size: 1.05rem;
    box-shadow: var(--shadow-hard);
    cursor: pointer; text-decoration: none;
    transition: transform .07s ease, box-shadow .07s ease, filter .15s;
    user-select: none; -webkit-user-select: none;
    margin-bottom: 3px;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-subject { background: var(--subject); color: var(--on-subject); }
.btn-good { background: var(--good); color: var(--on-good); }
.btn-miss { background: var(--miss); color: var(--on-miss); }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--soft-line); margin-bottom: 0; }
.btn-ghost:active:not(:disabled) { transform: scale(.98); }
.btn-big { min-height: 76px; font-size: 1.3rem; border-radius: 22px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px; }

.card {
    background: var(--surface);
    border: 2.5px solid var(--ink);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-hard);
}

/* Top bar */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar .grow { flex: 1; min-width: 0; }
.icon-btn {
    width: 46px; height: 46px; border-radius: 14px; border: 3px solid var(--ink);
    background: var(--surface); box-shadow: 0 3px 0 var(--ink);
    display: grid; place-items: center; cursor: pointer; font-size: 1.15rem; text-decoration: none; color: var(--text);
    flex: none;
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }

/* Home habitat */
.habitat {
    position: relative; overflow: hidden;
    border: 2.5px solid var(--ink); border-radius: 24px; box-shadow: 0 4px 0 var(--ink);
    background:
        radial-gradient(120% 90% at 50% 110%, color-mix(in srgb, var(--pet) 38%, transparent), transparent 60%),
        var(--surface);
    padding: 16px 16px 14px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.habitat .pet-wrap { width: 172px; height: 170px; flex: none; }
.habitat > * { position: relative; }
.pet-line {
    max-width: 94%; background: var(--paper); border: 3px solid var(--ink); border-radius: 16px;
    padding: 8px 14px; font-weight: 600; text-align: center; animation: pop .35s ease;
}
.roost { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; margin-bottom: -10px; }
.ledge {
    align-self: stretch; margin: 0 -16px 6px; height: 18px;
    background: var(--surface-2); border-top: 3px solid var(--ink); border-bottom: 2px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
.nest { position: relative; width: 92px; height: 52px; flex: none; margin: 0 0 8px -6px; text-decoration: none; }
.nest-bits { position: absolute; left: 0; right: 0; top: 0; text-align: center; font-size: 1.45rem; letter-spacing: -6px; line-height: 1; }
.nest-bits .bit { display: inline-block; margin: 0 -3px; }
.nest-bowl { position: absolute; left: 0; right: 0; bottom: 0; height: 28px; background: #a9773d; border: 3px solid var(--ink); border-radius: 8px 8px 40px 40px; }
/* The nest grows with the collection: wider and deeper, and twigs show in the weave. */
.nest.size-2 { width: 108px; height: 58px; }
.nest.size-2 .nest-bowl { height: 32px; background: repeating-linear-gradient(160deg, #a9773d 0 7px, #8f6230 7px 9px); }
.nest.size-3 { width: 124px; height: 64px; }
.nest.size-3 .nest-bowl { height: 36px; background: repeating-linear-gradient(160deg, #a9773d 0 6px, #8f6230 6px 8px), #a9773d;
    box-shadow: inset 0 5px 0 #c08a4a; }
.nest.size-3 .nest-bits { font-size: 1.6rem; }
.nest-bits .bit.drop { animation: nest-drop .9s cubic-bezier(.3, 0, .5, 1.4) .4s both; }
@keyframes nest-drop { from { transform: translateY(-70px) rotate(-30deg); opacity: 0; } 60% { opacity: 1; } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .nest-bits .bit.drop { animation: none; } }
a.stat-chip { color: inherit; text-decoration: none; }

/* A test is close: the pigeon's home charges up and Cram lights up. Bright on purpose: a test coming isn't a threat. */
.habitat.charged {
    background:
        radial-gradient(120% 80% at 50% 115%, color-mix(in srgb, var(--gold) 70%, transparent), transparent 62%),
        repeating-linear-gradient(135deg, transparent 0 22px, color-mix(in srgb, var(--gold) 16%, transparent) 22px 26px),
        var(--surface);
}
.habitat.charged .pet-line { background: var(--gold); color: #2e2200; }
.habitat.charged .ledge { background: color-mix(in srgb, var(--gold) 45%, var(--surface)); }
.habitat.charged .xpbar > span { background: var(--gold); }
.mode.mode-charged { background: var(--gold); color: #2e2200; box-shadow: var(--shadow-hard), 0 0 22px color-mix(in srgb, var(--gold) 55%, transparent); }
.mode.mode-charged .mode-sub { color: #4b3f10; }
.thunder-flash { position: fixed; inset: 0; z-index: 55; pointer-events: none; background: #ffc531; opacity: 0; animation: thunder .6s ease-out; }
@keyframes thunder { 0% { opacity: 0; } 15% { opacity: .3; } 100% { opacity: 0; } }

/* Finds */
.finds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.find { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; text-align: center; font-size: .78rem; font-weight: 600;
    background: var(--surface); border: 2.5px solid var(--ink); border-radius: 16px; }
.find .icon { font-size: 1.8rem; line-height: 1.1; }
button.find { font: inherit; font-size: .78rem; color: inherit; cursor: pointer; }
.find-card { background: var(--surface); border: 3px solid var(--ink); border-radius: var(--radius); padding: 24px 20px 20px; box-shadow: 0 4px 0 var(--ink); }
.find-card.rare { background: color-mix(in srgb, var(--gold) 16%, var(--surface)); }
.find-card .find-icon { width: 128px; height: 128px; }
.find-card h2 { margin: 0; }
.find-card p { margin: 0; }
.find .n { color: var(--muted); font-weight: 500; }
.find.rare { background: color-mix(in srgb, var(--gold) 16%, var(--surface)); }
.tag-rare { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; background: var(--gold); color: #2e2200; border-radius: 6px; padding: 1px 6px; }

/* The shop: the pigeon trying things on, and a close-up of each thing on it */
/* The pigeon stays at the top of the screen while the things to buy scroll under it, so what's being
   tried on is always in view. It sits in a band of plain paper the width of the screen: nothing shows
   round the panel's corners or beside it, and the things to buy fade out a little way below it. */
.shop-top { position: sticky; top: 0; z-index: 5; padding: 8px 0 26px; margin-bottom: -8px;
    background: linear-gradient(var(--paper) calc(100% - 18px), transparent);
    box-shadow: 0 0 0 100vmax var(--paper); clip-path: inset(0 -100vmax); }
/* The pigeon on the left, and beside it what's picked with what can be done about it. */
.shop-stage { display: grid; grid-template-columns: 124px minmax(0, 1fr); align-items: center; gap: 14px; padding: 10px 16px 12px 10px;
    background: color-mix(in srgb, var(--pet) 10%, var(--surface)); border: 2.5px solid var(--ink); border-radius: 20px; box-shadow: 0 4px 0 var(--ink); }
.shop-stage .pet-wrap { width: 124px; height: 124px; }
.shop-pick { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin: 0; text-align: left; }
.shop-pick-name { font-family: var(--display); font-size: 1.15rem; line-height: 1.2; letter-spacing: -.02em; }
.shop-pick .btn { min-height: 46px; padding: 8px 12px; margin: 0 0 3px; font-size: 1rem; line-height: 1.15; }
.shop-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; color: inherit; text-decoration: none; margin-bottom: 6px; }
.crumbs-n { font-family: var(--display); color: var(--text); }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; cursor: pointer; font: inherit;
    color: inherit; text-align: center; background: var(--surface); border: 2.5px solid var(--ink); border-radius: 16px; }
.shop-item.picked { box-shadow: 0 0 0 3px var(--gold); }
.shop-item.owned { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
.shop-look { width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; }
.shop-look .pet { width: 100%; height: 100%; }
.shop-look .pet, .shop-look .pet * { animation: none !important; }
.shop-name { font-size: .8rem; font-weight: 700; line-height: 1.2; }
.shop-price { font-size: .74rem; color: var(--muted); font-weight: 600; }
.find.none { border-style: dashed; border-color: var(--soft-line); color: var(--muted); }
.find.none .icon { filter: grayscale(1) brightness(.55); opacity: .5; }
.find-rows { display: grid; gap: 8px; }
.find-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; padding: 8px 12px; font-weight: 700;
    background: var(--surface); border: 2.5px solid var(--ink); border-radius: 16px; }
.find-row .icon { font-size: 1.6rem; }
.find-row small { display: block; font-weight: 500; color: var(--muted); }
.find-row.held { background: color-mix(in srgb, var(--gold) 16%, var(--surface)); }
.find-row.none { border-style: dashed; border-color: var(--soft-line); color: var(--muted); }
.find-row.none .icon { filter: grayscale(1) brightness(.55); opacity: .5; }
.found { font-weight: 600; margin: 0; }
.found-new { font-weight: 800; }
.found-crumbs { color: var(--muted); font-weight: 600; white-space: nowrap; }
.found-rare .found-crumbs { color: inherit; }
.found-rare { background: var(--gold); color: #2e2200; padding: 6px 12px; border-radius: 12px; }
.found-rare .find-icon { --ink: #2e2200; }
.pet-meta { display: flex; align-items: center; gap: 12px; width: 100%; }
.pet-name { font-weight: 800; font-size: 1.1rem; }
.level-badge {
    font-family: var(--display); font-weight: 700; font-size: .8rem;
    background: var(--ink); color: #fff; border-radius: 10px; padding: 4px 8px; flex: none;
}
.xpbar { flex: 1; height: 14px; border-radius: 99px; border: 3px solid var(--ink); background: var(--surface-2); overflow: hidden; }
.xpbar > span { display: block; height: 100%; background: var(--pet, var(--accent)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.evolve-note { font-size: .8rem; color: var(--muted); align-self: flex-start; }

/* Streak, finds and crumbs: one row, each opening its own page. The number on top, what it counts underneath. */
.chips { display: flex; gap: 8px; }
.stat-chip {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1 1 0; min-width: 0;
    border: 3px solid var(--ink); border-radius: 14px; background: var(--surface);
    padding: 5px 6px 6px; font-weight: 700; box-shadow: 0 3px 0 var(--ink);
}
.stat-chip .top { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.stat-chip .n { font-family: var(--display); font-size: 1.05rem; }
.stat-chip .w { font-size: .72rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.stat-chip .chip-extra { display: inline-flex; align-items: center; gap: .2em; color: var(--muted); }
.stat-chip .chip-extra .mark { width: 1em; height: 1em; }
.stat-chip.lit .mark-streak { animation: flicker 1.6s ease-in-out infinite; transform-origin: 50% 85%; }

/* The streak page: six weeks, Monday first, and what was done on the day tapped */
.streak-freezes { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 12px; }
.streak-freezes .mark { width: 22px; height: 22px; margin-top: 1px; }
.streak-span { margin: 0 0 6px; }
.streak-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 8px; }
.streak-dow { text-align: center; font-size: .75rem; font-weight: 800; color: var(--muted); }
.streak-day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; font: inherit; font-weight: 700; font-size: .85rem;
    border: 2px solid transparent; background: none; color: var(--muted); padding: 0; cursor: pointer; }
.streak-day.studied { background: #f08a24; border-color: var(--ink); color: #2e1600; }
.streak-day.frozen { background: color-mix(in srgb, #3aa0e0 22%, var(--surface)); border-color: #3aa0e0; }
.streak-day.frozen .mark { width: 60%; height: 60%; }
.streak-day.missed { border: 2px dashed var(--soft-line); }
.streak-day.today { border-color: var(--text); color: var(--text); }
.streak-day.ahead, .streak-day.before { opacity: .45; cursor: default; }
.streak-day.picked { outline: 3px solid var(--accent); outline-offset: 2px; }
.streak-detail h2 { margin-bottom: 6px; }
.streak-runs { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.streak-runs li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; padding: 8px 12px;
    background: var(--surface); border: 2.5px solid var(--ink); border-radius: 14px; font-weight: 600; }
.streak-find { display: inline-flex; gap: 6px; align-items: center; }

/* Drawn marks in buttons and chips (Mark.razor) */
.mark, .find-icon { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -.2em; overflow: visible; }
.icon-btn .mark { width: 24px; height: 24px; }

.start-hint { text-align: center; margin-top: -10px; }

/* What to do next: one thing, why, and a button */
.plan-label { font-size: .95rem; color: var(--muted); margin-bottom: -8px; }
.start {
    display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; cursor: pointer;
    padding: 18px; border-radius: 22px; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
    background: var(--accent); color: var(--accent-ink); font: inherit; margin-bottom: 4px;
}
.start:active { transform: translateY(4px); box-shadow: none; }
.start-what { font-family: var(--display); font-weight: 700; font-size: 1.35rem; line-height: 1.15; }
.start-why { font-weight: 500; }
.start-go {
    margin-top: 6px; padding: 14px; border-radius: 16px; border: 3px solid var(--ink); text-align: center;
    background: #fff; color: #1d1f3f; font-weight: 800; font-size: 1.1rem;
}
.start.start-test { background: var(--gold); color: #2e2200; }
.then { display: grid; gap: 8px; }
.then-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px;
    padding: 10px 14px; border-radius: 14px; border: 2.5px solid var(--soft-line); background: var(--surface);
    color: var(--text); text-decoration: none; font-weight: 600;
}
.then-n { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 10px; border-radius: 50%; border: 2px solid var(--soft-line); font-family: var(--display); font-size: .8rem; color: var(--muted); }
.then-row .row-name { display: inline-flex; align-items: center; gap: 10px; }
.then-row small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.done-today { text-align: center; }
.btn-wrap { height: auto; white-space: normal; padding-top: 14px; padding-bottom: 14px; line-height: 1.2; font-size: 1.1rem; }

/* Tests: a card each on the home screen, and the form for adding one */
.tests { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.test-card {
    display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 16px; border: 2.5px solid var(--ink);
    box-shadow: var(--shadow-hard); background: var(--surface); color: var(--text); text-decoration: none;
}
.test-card.soon { background: color-mix(in srgb, var(--gold) 22%, var(--surface)); }
.test-card strong { line-height: 1.15; }
.test-card small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.test-card .xpbar { height: 10px; border-width: 2px; }
/* How did it go? The day after a test */
.went {
    display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px; border: 2.5px solid var(--ink);
    box-shadow: var(--shadow-hard); background: var(--surface);
}
.went small { color: var(--muted); font-weight: 600; font-size: .8rem; margin-top: -6px; }
.went-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.went-choices .btn { min-height: 52px; font-size: 1rem; }
.went-skip { align-self: center; background: none; border: 0; padding: 6px 10px; color: var(--muted); font: inherit; font-size: .9rem; text-decoration: underline; cursor: pointer; }
.went-said { margin: 0; font-weight: 700; }
.went-said:empty { display: none; }
.add-test {
    display: block; padding: 12px; border-radius: 14px; border: 2.5px dashed var(--soft-line); text-align: center;
    font-weight: 700; color: var(--muted); text-decoration: none;
}
.tick {
    display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; min-height: 52px; padding: 8px 12px; text-align: left;
    border-radius: 14px; border: 2.5px solid var(--soft-line); background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
}
.tick.on { border-color: var(--ink); color: var(--text); }
.tick small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.tick-box { width: 26px; height: 26px; border-radius: 8px; border: 2.5px solid var(--soft-line); display: grid; place-items: center; font-weight: 800; }
.tick.on .tick-box { background: var(--good); border-color: var(--ink); color: var(--on-good); }
/* Sending a revision list from the phone (NewTest), and how it's getting on (Home). */
.list-ways { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.file-pick {
    display: block; padding: 18px 12px; border-radius: 14px; border: 2.5px dashed var(--soft-line); text-align: center;
    font-weight: 700; color: var(--text); cursor: pointer; background: var(--surface);
}
.file-pick.on { border-style: solid; border-color: var(--ink); }
.file-pick:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.list-input {
    width: 100%; box-sizing: border-box; padding: 12px; border-radius: 14px; border: 2.5px solid var(--soft-line); background: var(--surface);
    color: var(--text); font: inherit; font-weight: 500; resize: vertical;
}
.list-input:focus { border-color: var(--ink); outline: none; }
.list-note {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 14px; border: 2.5px solid var(--ink);
    background: color-mix(in srgb, var(--gold) 22%, var(--surface)); color: var(--text); text-decoration: none;
}
.list-note span { color: var(--muted); font-weight: 600; font-size: .9rem; }
.making-pips { display: flex; gap: 8px; justify-content: center; }
.making-pips span { width: 10px; height: 22px; border-radius: 99px; background: var(--gold); border: 2px solid var(--ink); animation: pulse-pip 1s ease-in-out infinite; }
.making-pips span:nth-child(2) { animation-delay: .15s; }
.making-pips span:nth-child(3) { animation-delay: .3s; }
@media (prefers-reduced-motion: reduce) { .making-pips span { animation: none; } }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* A choice between a few things: a pill, quieter than a button until it is the one chosen. */
.pick { min-height: 46px; border-radius: 99px; border: 2px solid var(--soft-line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.pick.on { background: var(--gold); border-color: var(--ink); color: #2e2200; font-weight: 700; }
.date-label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--muted); }

.shelf-row .btn { min-height: 40px; padding: 6px 12px; font-size: .9rem; flex: none; }
.plan-day { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 14px; border: 2.5px dashed var(--soft-line); color: var(--muted); font-weight: 600; }
.plan-day strong { color: var(--text); }
.plan-day.now { border-style: solid; border-color: var(--ink); background: color-mix(in srgb, var(--gold) 22%, var(--surface)); color: var(--text); }
.check-card { display: flex; flex-direction: column; gap: 8px; }

/* A topic's steps, in order */
.path { list-style: none; margin: 0; padding: 0; display: grid; }
.path-step { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; position: relative; padding-bottom: 18px; }
.path-step:not(:last-child)::before { content: ""; position: absolute; left: 22px; top: 48px; bottom: 0; width: 4px; border-radius: 2px; background: var(--soft-line); }
.path-step.done:not(:last-child)::before { background: var(--good); }
.path-dot {
    width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center;
    font-family: var(--display); font-weight: 700; font-size: 1.1rem; background: var(--surface);
}
.path-step.done .path-dot { background: var(--good); color: var(--on-good); }
.path-step.now .path-dot { background: var(--gold); color: #2e2200; box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 35%, transparent); }
.path-step.todo .path-dot { border-color: var(--soft-line); color: var(--muted); background: transparent; }
.path-body { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.path-body strong { font-size: 1.1rem; }
.path-step.todo .path-body strong { color: var(--muted); }
.path-body .btn { margin-top: 4px; }

/* Topic stickers */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.tile {
    position: relative; text-align: left; color: var(--text);
    background: var(--surface); border: 2.5px solid var(--ink); border-radius: 18px;
    padding: 12px 12px 12px; cursor: pointer; box-shadow: 0 3px 0 var(--ink);
    display: flex; flex-direction: column; gap: 6px; min-height: 132px;
    transition: transform .08s ease, box-shadow .08s ease;
}
.tile:active { transform: translateY(3px); box-shadow: none; }
.tile .stripe { height: 10px; border-radius: 99px; background: var(--subject); border: 2px solid var(--ink); }
.tile .subject { font-size: .78rem; font-weight: 700; color: color-mix(in srgb, var(--subject) 55%, var(--text)); }
.tile .topic { font-weight: 700; line-height: 1.2; }
.tile .foot { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; }
.medal {
    width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); flex: none;
    display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: var(--ink);
    position: relative;
}
.medal::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); }
.tier-Grey { background: var(--grey); }
.tier-Bronze { background: var(--bronze); }
.tier-Silver { background: var(--silver); }
.tier-Gold { background: var(--gold); animation: shine 3s ease-in-out infinite; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; border: 2px solid var(--ink); }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 700;
    background: var(--surface-2); color: var(--text); border: 2px solid var(--ink);
}
.chip-test { background: var(--gold); color: #3a2a00; }
.chip-due { background: var(--accent); color: var(--accent-ink); }

/* Run screen */
.run-head { display: flex; align-items: center; gap: 12px; }
.pips { flex: 1; display: grid; grid-template-columns: repeat(var(--n, 10), 1fr); gap: 5px; }
.pip { height: 14px; border-radius: 99px; border: 2.5px solid var(--ink); background: var(--surface); transition: background .25s; }
.pip.now { background: var(--surface-2); animation: pulse-pip 1.2s ease-in-out infinite; }
.pip.right { background: var(--good); }
.pip.partial { background: var(--gold); }
.pip.wrong { background: var(--miss); }
.combo-meter {
    min-width: 62px; height: 46px; border-radius: 14px; border: 3px solid var(--ink);
    display: flex; align-items: center; justify-content: center; gap: 2px; font-family: var(--display); font-weight: 700; font-size: .95rem;
    background: var(--surface); color: var(--muted); transition: background .2s, color .2s;
}
.combo-meter.x2 { background: var(--gold); color: #3a2a00; }
.combo-meter.x3 { background: #ff5b3a; color: #fff; animation: flicker 1s ease-in-out infinite; }
.combo-meter.bump { animation: bump .45s ease; }
.count-label { font-weight: 700; color: var(--muted); font-size: .85rem; text-align: center; margin-top: -10px; }

.item { display: flex; flex-direction: column; gap: 16px; animation: slidein .28s cubic-bezier(.2,.8,.2,1); }
.item-subject { font-size: .82rem; font-weight: 700; color: color-mix(in srgb, var(--subject) 55%, var(--text)); }
.prompt { font-size: 1.4rem; font-weight: 700; line-height: 1.3; }
.item img { max-width: 100%; border-radius: 14px; border: 3px solid var(--ink); background: #fff; }

.flashcard {
    min-height: 230px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    gap: 14px; cursor: pointer; border-top-width: 10px; border-top-color: var(--subject);
    perspective: 800px;
}
.flashcard.flipped { animation: flip .35s ease; }
.flashcard .back { font-size: 1.3rem; font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--subject) 16%, transparent); border-radius: 14px; padding: 10px 14px; }
.flashcard .hint { color: var(--muted); font-size: .9rem; }

.options { display: flex; flex-direction: column; gap: 12px; }
.option {
    text-align: left; padding: 14px 16px; min-height: 62px;
    border-radius: 16px; border: 3px solid var(--ink); background: var(--surface);
    box-shadow: 0 4px 0 var(--ink); margin-bottom: 4px;
    font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 12px;
    transition: transform .07s, box-shadow .07s, background .2s;
}
.option:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.option .letter {
    width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); border: 2.5px solid var(--ink);
    display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none;
}
.option.right { background: var(--good-soft); }
.option.right .letter { background: var(--good); color: var(--on-good); }
.option.wrong { background: var(--miss-soft); }
.option.wrong .letter { background: var(--miss); color: var(--on-miss); }
.option.faded { opacity: .55; }
.option:disabled { cursor: default; color: var(--text); }

.cloze-text { font-size: 1.35rem; font-weight: 600; line-height: 1.7; }
.gap {
    display: inline-block; min-width: 96px; padding: 0 10px; margin: 0 4px;
    border-bottom: 4px solid var(--subject); text-align: center; font-weight: 800; color: color-mix(in srgb, var(--subject) 55%, var(--text));
}
.gap.right { color: color-mix(in srgb, var(--good) 55%, var(--text)); border-color: var(--good); }
.gap.wrong { color: color-mix(in srgb, var(--miss) 55%, var(--text)); border-color: var(--miss); text-decoration: line-through; }
.words { display: flex; flex-wrap: wrap; gap: 10px; }
.word {
    padding: 10px 16px; border-radius: 14px; border: 3px solid var(--ink); background: var(--surface);
    box-shadow: 0 3px 0 var(--ink); font-weight: 700; cursor: pointer; min-height: 52px; margin-bottom: 3px;
}
.word:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.word.picked { background: var(--subject); color: var(--on-subject); }

.answer-input {
    width: 100%; min-height: 64px; padding: 12px 16px; font-size: 1.5rem; font-weight: 700;
    border-radius: 16px; border: 3px solid var(--ink); background: var(--surface); outline: none;
    font-family: var(--display);
}
.answer-input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--subject) 35%, transparent); }
.unit-row { display: flex; align-items: center; gap: 10px; }
.unit-row .unit { font-weight: 700; color: var(--muted); }
.sign-btn {
    flex: none; min-width: 52px; min-height: 52px; padding: 0 10px; border-radius: 14px;
    border: 2px solid var(--soft-line); background: transparent; color: var(--muted);
    font: 700 1.05rem var(--display); cursor: pointer;
}
.sign-btn:active:not(:disabled) { background: var(--soft-line); color: var(--text); }
.sign-btn:disabled { opacity: .4; cursor: default; }

.steps { display: flex; flex-direction: column; gap: 10px; }
.step {
    display: flex; align-items: center; gap: 12px; text-align: left;
    padding: 12px 14px; border-radius: 16px; border: 3px solid var(--ink); background: var(--surface);
    box-shadow: 0 3px 0 var(--ink); margin-bottom: 3px; cursor: pointer; min-height: 56px; font-weight: 600;
}
.step .n {
    width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface-2); border: 2.5px solid var(--ink); font-weight: 800; flex: none;
}
.step.placed .n { background: var(--subject); color: var(--on-subject); }
.step.right { background: var(--good-soft); }
.step.wrong { background: var(--miss-soft); }

.markpoints { display: flex; flex-direction: column; gap: 10px; }
.markpoint {
    display: flex; gap: 12px; align-items: flex-start; text-align: left;
    padding: 12px 14px; border-radius: 16px; border: 3px solid var(--ink); background: var(--surface); cursor: pointer;
}
.markpoint .box {
    width: 30px; height: 30px; border-radius: 9px; border: 3px solid var(--ink); flex: none;
    display: grid; place-items: center; font-weight: 800; background: var(--surface);
}
.markpoint.ticked { background: var(--good-soft); }
.markpoint.ticked .box { background: var(--good); color: var(--on-good); animation: bump .3s ease; }

.feedback {
    border: 3px solid var(--ink); border-radius: 20px; padding: 12px 14px;
    display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; align-items: center;
    animation: rise .3s cubic-bezier(.2,.8,.2,1);
}
.feedback.good { background: var(--good-soft); }
.feedback.miss { background: var(--miss-soft); }
.feedback .pet-wrap { width: 64px; height: 64px; grid-row: span 2; align-self: start; }
.feedback .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 1.15rem; }
.feedback .body { grid-column: 2; display: flex; flex-direction: column; gap: 4px; }
.feedback .body:empty { display: none; }
.feedback .extra { grid-column: 1 / -1; margin-top: 8px; }
.xp-pop { font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--ink); background: var(--gold); border: 2.5px solid var(--ink); border-radius: 10px; padding: 2px 8px; animation: pop .45s ease; white-space: nowrap; }

.worked { display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); border: 3px dashed var(--soft-line); border-radius: 16px; padding: 14px 16px; }
.worked ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.worked li { animation: rise .25s ease; }

.askmum {
    display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
    border: 3px dashed var(--soft-line); background: transparent; cursor: pointer; font-weight: 700; color: var(--muted);
}
.askmum.on { border-style: solid; border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* Reporting a question: quiet until it's wanted. */
.report-link { align-self: center; padding: 6px 10px; border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: .9rem; text-decoration: underline; }
.report { display: flex; flex-direction: column; gap: 8px; }
.report p { margin: 0; font-weight: 700; }
.report-done { margin: 0; text-align: center; color: var(--muted); font-size: .9rem; }

.footer-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }

/* Results */
.results { text-align: center; align-items: center; }
.results .pet-wrap { width: 150px; height: 150px; }
/* The dots fill the top bar during a run; on the results screen they stay one row high, or a tall screen opens a gap under them. */
.results .pips { flex: none; }
/* End of a check: what the green and orange dots mean, and what happens to each lot. */
.check-key { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.check-key li { display: flex; gap: 12px; align-items: flex-start; }
.check-key .dot { margin-top: 4px; }
.check-key strong { display: block; font-family: var(--display); font-size: 1.1rem; }
.check-key .muted { display: block; font-weight: 600; }
.dot-good { background: var(--good); }
.dot-miss { background: var(--miss); }
.big-xp { font-family: var(--display); font-size: 3rem; font-weight: 700; line-height: 1; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.result-grid .card { padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.result-grid .num { font-family: var(--display); font-size: 1.3rem; font-weight: 700; }
.result-grid .label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.unlock {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; width: 100%;
    background: var(--gold); color: #2e2200; border: 3px solid var(--ink); box-shadow: var(--shadow-hard);
    font-weight: 700; text-align: left; animation: pop .5s ease both;
}
.unlock .icon { font-size: 1.6rem; }

/* Level up / evolve overlay */
.overlay {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
    background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(4px);
    animation: fadein .25s ease;
}
.overlay .panel { max-width: 380px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.overlay .pet-wrap { width: 190px; height: 190px; }
.overlay .rays {
    position: absolute; width: 320px; height: 320px; border-radius: 50%; z-index: -1;
    background: radial-gradient(circle, color-mix(in srgb, var(--pet) 55%, transparent) 0%, color-mix(in srgb, var(--pet) 18%, transparent) 40%, transparent 70%);
    animation: glow-pulse 2.4s ease-in-out infinite;
}
.overlay .level-big { font-family: var(--display); font-size: 2.6rem; font-weight: 700; }

/* Hooks */
.hooks { display: flex; flex-direction: column; gap: 10px; }
.hook { padding: 0 0 12px; border-bottom: 2px dashed var(--soft-line); }
.hook:last-child { border-bottom: 0; padding-bottom: 0; }
.hook strong { display: block; color: color-mix(in srgb, var(--subject) 60%, var(--text)); }

/* Pairing and setup */
.code-input {
    width: 100%; text-align: center; letter-spacing: .35em; font-size: 2.2rem; font-weight: 700; font-family: var(--display);
    padding: 14px; border-radius: 20px; border: 3px solid var(--ink); background: var(--surface); outline: none; box-shadow: var(--shadow-hard);
}
.code-input:focus { box-shadow: 0 4px 0 var(--ink), 0 0 0 5px color-mix(in srgb, var(--accent) 30%, transparent); }
.error { color: color-mix(in srgb, var(--miss) 55%, var(--text)); font-weight: 700; }
.swatches { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.swatch {
    width: 44px; height: 44px; border-radius: 14px; border: 3px solid var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink);
}
.swatch.on { outline: 4px solid var(--ink); outline-offset: 3px; }
.name-input {
    width: 100%; text-align: center; font-size: 1.4rem; font-weight: 800; padding: 12px; border-radius: 16px;
    border: 0; border-bottom: 3px solid var(--text); border-radius: 0; background: transparent; color: var(--text); outline: none;
}
/* A line to write on, so it can't be taken for a button. */
.name-input:focus { border-bottom-color: var(--accent); }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 2px solid var(--soft-line); }
.toggle:last-child { border-bottom: 0; }
.seg { display: inline-flex; background: var(--surface-2); border: 2.5px solid var(--ink); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; cursor: pointer; font-weight: 700; }
.seg button.on { background: var(--ink); color: #fff; }
.switch { width: 56px; height: 34px; border-radius: 99px; border: 3px solid var(--ink); background: var(--grey); position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); transition: left .15s; }
.switch.on { background: var(--good); }
.switch.on::after { left: 24px; }

/* Confetti (made by rq.js) */
.confetti { position: fixed; pointer-events: none; z-index: 60; width: 10px; height: 14px; border: 2px solid var(--ink); border-radius: 3px; }

/* The companion */
.pet { width: 100%; height: 100%; overflow: visible; }
.pet * { transform-box: fill-box; transform-origin: center; }
/* Worn things are drawn with plain SVG rotations, which turn about the point they name */
.pet .wear * { transform-box: view-box; transform-origin: 0 0; }
.pet .body-group { transform-origin: 50% 100%; }
.pet.idle .body-group, .pet.content .body-group { animation: breathe 4s ease-in-out infinite; }
.pet .eyes-open { animation: blink 5s infinite; }
.pet.happy .body-group { animation: hop .6s cubic-bezier(.3,.7,.4,1.4); }
.pet.wow .body-group { animation: hop-spin .8s cubic-bezier(.3,.7,.4,1.3); }
.pet.think .body-group { animation: tilt .7s ease both; }
.pet.sleep .body-group { animation: breathe 4s ease-in-out infinite; }
.pet.cheer .body-group { animation: cheer 1s ease-in-out infinite; }
.pet .zzz { animation: float-z 2.8s ease-in infinite; opacity: 0; }
.pet .zzz.z2 { animation-delay: 1.4s; }
.pet .spark { animation: twinkle 1.2s ease-in-out infinite; }
.pet .spark.s2 { animation-delay: .4s; }
.pet .spark.s3 { animation-delay: .8s; }
.pet.cheer .wing-l, .pet.wow .wing-l { transform-origin: 75% 4%; animation: flap-l .26s ease-in-out 6 alternate; }
.pet.cheer .wing-r, .pet.wow .wing-r { transform-origin: 25% 4%; animation: flap-r .26s ease-in-out 6 alternate; }
.pet .cloud { animation: bob 3.2s ease-in-out infinite; }
.pet .strike, .pet .static { animation: glow 1.3s ease-in-out infinite; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes flap-l { from { transform: rotate(0); } to { transform: rotate(38deg); } }
@keyframes flap-r { from { transform: rotate(0); } to { transform: rotate(-38deg); } }
@keyframes shadow { 0%, 100% { transform: scaleX(1); opacity: .16; } 50% { transform: scaleX(.85); opacity: .1; } }
@keyframes glow-pulse { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes hop { 0% { transform: translateY(0) scale(1); } 25% { transform: translateY(0) scale(1.12, .86); } 55% { transform: translateY(-16px) scale(.94, 1.08); } 80% { transform: translateY(0) scale(1.06, .94); } 100% { transform: none; } }
@keyframes hop-spin { 0% { transform: none; } 20% { transform: scale(1.15, .85); } 60% { transform: translateY(-22px) rotate(-12deg) scale(1.05); } 85% { transform: translateY(0) rotate(4deg); } 100% { transform: none; } }
@keyframes tilt { 0% { transform: none; } 40% { transform: rotate(-9deg) translateX(-3px); } 100% { transform: rotate(-6deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, .97); } }
@keyframes cheer { 0%, 100% { transform: translateY(0); } 30% { transform: translateY(-12px) rotate(-5deg); } 60% { transform: translateY(0) rotate(4deg); } }
@keyframes float-z { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -26px) scale(1.1); } }
@keyframes twinkle { 0%, 100% { transform: scale(.4); opacity: .3; } 50% { transform: scale(1.1); opacity: 1; } }
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 25% { transform: scale(1.08) rotate(-4deg); } 60% { transform: scale(.96) rotate(3deg); } }
@keyframes shine { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 197, 49, .0); } 50% { box-shadow: 0 0 0 5px rgba(255, 197, 49, .45); } }
@keyframes pulse-pip { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.3); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes slidein { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(80deg); } 100% { transform: rotateX(0); } }
@keyframes wobble { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
.wobble { animation: wobble .3s ease; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Topic modes */
.modes { display: grid; gap: 12px; }
.mode {
    display: grid; grid-template-columns: 48px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
    text-align: left; padding: 14px 16px; border-radius: 18px; border: 2.5px solid var(--ink);
    background: var(--surface); box-shadow: var(--shadow-hard); margin-bottom: 3px; cursor: pointer; color: var(--text);
}
.mode:active { transform: translateY(3px); box-shadow: none; }
.mode-main { background: var(--subject); color: var(--on-subject); }
.mode-main .mode-sub { color: color-mix(in srgb, var(--on-subject) 85%, transparent); }
.mode-icon { grid-row: span 2; font-size: 1.7rem; width: 48px; height: 48px; display: grid; place-items: center; background: var(--surface-2); border-radius: 14px; border: 2px solid var(--ink); }
.mode-main .mode-icon { background: color-mix(in srgb, var(--on-subject) 20%, transparent); }
.mode-name { font-weight: 800; font-size: 1.15rem; }
.mode-sub { font-size: .85rem; color: var(--muted); }
.status-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-struggle { background: var(--miss); color: var(--on-miss); }
.chip-learned { background: var(--good); color: var(--on-good); }

/* Learn mode */
.learn-card { display: flex; flex-direction: column; gap: 14px; border-top-width: 10px; border-top-color: var(--subject); }
.learn-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.learn-title { font-size: 1.45rem; font-weight: 800; }
.learn-summary { font-size: 1.2rem; font-weight: 700; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--subject) 15%, transparent); }
.learn-detail { color: var(--text); }
.learn-steps { margin: 0; padding-left: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 8px; }
.learn-steps li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; text-align: left; }
.learn-steps li::before {
    content: counter(step); width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
    background: var(--subject); color: var(--on-subject); font-weight: 800; font-size: .85rem; border: 2px solid var(--ink);
}

/* Cram */
.seg-wide { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.seg-wide button { padding: 10px 12px; }
.cram-card {
    min-height: 300px; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; text-align: center; cursor: pointer; color: var(--text); font: inherit;
    border-top-width: 10px; border-top-color: var(--subject); animation: rise .2s ease;
}
.cram-card.shown { animation: flip .3s ease; }
.cram-title { font-size: 1.6rem; font-weight: 800; line-height: 1.25; }
.cram-answer { font-size: 1.3rem; font-weight: 700; padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--subject) 15%, transparent); }
.cram-card .learn-steps { width: 100%; }
/* A small stack of flashcards: same top band as the cards themselves, two more peeking out below. */
.come-backs { flex: 1; font-weight: 700; color: var(--muted); }

/* Feel like an app, not a web page: no text selection, long-press menus or double-tap zoom.
   Typing boxes keep normal selection. */
.rq-app, .rq-app * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.rq-app input, .rq-app textarea {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}
.rq-app { touch-action: pan-x pan-y; } /* no pinch or double-tap zoom: the children kept zooming in by accident */
.rq-app img, .rq-app svg { -webkit-user-drag: none; }

.xpbar-stack { display: flex; flex: none; }
.xpbar-stack > span { flex: none; }
.xpbar > .xpbar-soft { background: var(--subject, var(--accent)); opacity: .45; }
.topic-pct { font-size: 1.3rem; }

.parent-help { text-align: left; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.parent-help ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.parent-help a { color: var(--accent); }
.parent-help .link { padding: 0; color: var(--accent); }
.parent-help-links { display: flex; justify-content: space-between; gap: 12px; }
.rq-app .parent-help { -webkit-user-select: text; user-select: text; }

/* Get the app */
.get-app { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.get-app-help { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; }
.get-app-help a { color: var(--accent); }
.get-app-help[hidden] { display: none; }
.rq-installed [data-install-hide] { display: none; }

/* Ones to go over, at the end of a run */
.missed { width: 100%; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.missed h2 { margin: 6px 0 0; }

/* Games after a run */
.game-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; width: 100%; max-width: 420px; margin: 0 auto; }
.game-cell {
    aspect-ratio: 1; border: 3px solid var(--ink); border-radius: 14px; background: var(--surface);
    box-shadow: var(--shadow-hard); color: var(--text); font: 700 1.8rem var(--display);
    display: grid; place-items: center; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.game-cell:active { transform: translateY(3px); box-shadow: none; }
.game-cell.pair { background: var(--accent); }
.game-cell.pair.open { background: var(--surface); }
.game-cell.pair.matched { background: var(--good-soft); border-color: var(--good); box-shadow: none; }
/* Slide: each tile is a ninth of the child's pigeon, three times the tile's size and moved so its own
   part shows, with its number in the corner. The number goes green when the tile is home. */
.game-cell.slide { position: relative; overflow: hidden; background: color-mix(in srgb, var(--pet, var(--accent)) 12%, var(--surface)); }
.slide-pic { position: absolute; width: 300%; height: 300%; left: calc(var(--col) * -100%); top: calc(var(--row) * -100%); pointer-events: none; }
.slide-pic .pet, .slide-pic .pet * { animation: none !important; }
.slide-n { position: absolute; left: 5px; top: 5px; min-width: 24px; height: 24px; padding: 0 4px; display: grid; place-items: center; border-radius: 8px; border: 2px solid var(--ink); background: var(--surface); font-size: .85rem; line-height: 1; }
.game-cell.slide.home .slide-n { background: var(--good); color: var(--on-good); }
.game-cell.gap { background: transparent; border-style: dashed; border-color: var(--soft-line); box-shadow: none; cursor: default; }
.game-cell.glow { background: var(--surface-2); }
.game-cell.glow.on { background: var(--gold); box-shadow: 0 3px 0 var(--ink), 0 0 18px var(--gold); }
/* A square that's still on carries a bolt, so on and off don't depend on colour alone. */
.game-cell.glow.on::after { content: ""; width: 46%; height: 46%; background: #2e2200; opacity: .8; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2 5 13.4h5.4L9 22l10-12.4h-5.6z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2 5 13.4h5.4L9 22l10-12.4h-5.6z'/%3E%3C/svg%3E") center / contain no-repeat; }
/* A find on a turned-over card */
.game-cell.pair .find-icon { width: 62%; height: 62%; }

.code-key { display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 0; }
.code-rows { display: flex; flex-direction: column; gap: 8px; }
.code-row { display: flex; align-items: center; gap: 8px; }
.code-row.reveal { padding-top: 8px; border-top: 2px dashed var(--soft-line); }
.code-peg {
    width: 44px; height: 44px; flex: none; border-radius: 50%; border: 3px solid var(--ink);
    background: var(--peg, var(--surface)); color: rgba(0,0,0,.55); font-size: 1.1rem;
    display: grid; place-items: center; padding: 0; cursor: pointer;
}
.code-peg.empty { background: transparent; border-style: dashed; border-color: var(--soft-line); cursor: default; }
span.code-peg { cursor: default; }
.code-peg:disabled { opacity: .45; cursor: default; }
.code-score { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; font-weight: 700; font-size: .85rem; }
.code-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text); display: inline-block; }
.code-dot.exact { background: var(--text); }
.code-dot.near { background: transparent; }
.code-palette { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.code-palette .code-peg { width: 52px; height: 52px; box-shadow: var(--shadow-hard); }

.word-rows { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.word-row { display: flex; gap: 6px; }
.word-row.reveal { padding-top: 8px; border-top: 2px dashed var(--soft-line); }
.word-tile {
    width: 52px; height: 52px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%;
    background: var(--surface); color: var(--text); font: 700 1.4rem var(--display); text-transform: uppercase;
}
.word-tile.exact { background: var(--accent); color: var(--accent-ink); }
.word-tile.present { border-style: dashed; border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface-2); }
.word-tile.mini { width: 16px; height: 16px; border-width: 2px; display: inline-block; }
.word-out { text-align: center; letter-spacing: .08em; margin: 0; }
.word-entry { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.word-input {
    min-height: 56px; border: 3px solid var(--ink); border-radius: 16px; padding: 0 16px; background: var(--surface); color: var(--text);
    font: 700 1.5rem var(--display); text-transform: uppercase; letter-spacing: .3em; min-width: 0;
}

/* Dash */
.dash-wrap { position: relative; width: 100%; max-width: 480px; margin: 0 auto; }
.dash-canvas { display: block; width: 100%; border: 3px solid var(--ink); border-radius: 20px; touch-action: none; background: var(--surface-2); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dash-over {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(280px, 85%);
    display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
}
.dash-over p { margin: 0; }
.dash-score { font: 700 2.4rem var(--display); }

/* Traces of the pigeon. rq.js chooses which screen gets which, one at a time, and draws each one
   differently; these only say how they are painted.
   A bite out of a button: rq.js cuts the button, and hands over the outline of the cut as a mask the
   size of the button, because the cut itself would leave the edge open. */
.start-go[data-bite="1"] { position: relative; --bite-edge: 3px; }
[data-bite="1"]::after {
    content: ""; position: absolute; inset: calc(0px - var(--bite-edge, 2.5px)); background: var(--ink); pointer-events: none;
    -webkit-mask: var(--bite-mask) no-repeat 0 0 / 100% 100%; mask: var(--bite-mask) no-repeat 0 0 / 100% 100%;
}
/* The cut can clip what lies outside the button, so the keyboard's focus ring is drawn inside it. */
.btn[data-bite="1"]:focus-visible { outline-offset: -6px; }

/* Footprints across the empty paper at the foot of a screen. Faint, and never over anything. */
.pigeon-tracks {
    position: fixed; pointer-events: none; background: var(--text); opacity: .2;
    -webkit-mask: var(--trail) no-repeat 0 0 / 100% 100%; mask: var(--trail) no-repeat 0 0 / 100% 100%;
}
.pigeon-tracks[hidden] { display: none; }

/* Figures: diagrams drawn from a pack's data (Components/Figures, layouts in Shared/Figures).
   Everything is painted from the theme's colours so a figure follows dark mode. */
.figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text); }
.figure svg { display: block; width: 100%; height: auto; overflow: visible; }
.figure figcaption { font-size: .85rem; color: var(--muted); text-align: center; }
.fig-line { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.fig-thick { stroke-width: 6; stroke-linecap: butt; }
.fig-thin { stroke-width: 2; }
.fig-dash { stroke-dasharray: 8 7; stroke-linecap: butt; }
.fig-dot-line { stroke-dasharray: 2 5; }
.fig-grid { stroke: var(--soft-line); stroke-width: 1.5; }
.fig-body, .fig-shape, .fig-box { fill: var(--surface); stroke: currentColor; stroke-width: 3; stroke-linejoin: round; }
.fig-shape { fill: color-mix(in srgb, var(--subject) 12%, var(--surface)); }
.fig-box { fill: none; }
.fig-solid { fill: currentColor; stroke: none; }
.fig-subject, .fig-particle { fill: var(--subject); stroke: currentColor; stroke-width: 2.5; }
.fig-open { fill: var(--surface); stroke: var(--subject); stroke-width: 3.5; }
.fig-subject-line { stroke: var(--subject); }
.fig-subject-head { fill: var(--subject); stroke: none; }
.fig-range { stroke-width: 5; }
.fig-bar { fill: var(--subject); stroke: currentColor; stroke-width: 2.5; }
.fig-series-0 { stroke: var(--subject); stroke-width: 3.5; }
.fig-series-1 { stroke: currentColor; stroke-dasharray: 9 6; stroke-linecap: butt; }
.fig-series-2 { stroke: var(--good); stroke-width: 3.5; }
.fig-series-3 { stroke: var(--miss); stroke-dasharray: 3 6; }
.fig-series-4 { stroke: var(--accent); stroke-dasharray: 12 4 2 4; stroke-linecap: butt; }
.fig-series-5 { stroke: var(--muted); stroke-dasharray: 16 6; stroke-linecap: butt; }
.fig-dot { stroke: currentColor; stroke-width: 2; }
.fig-dot-0 { fill: var(--subject); }
.fig-dot-1 { fill: currentColor; }
.fig-dot-2 { fill: var(--good); }
.fig-dot-3 { fill: var(--miss); }
.fig-dot-4 { fill: var(--accent); }
.fig-dot-5 { fill: var(--muted); }
.fig-cross-0 { stroke: var(--subject); stroke-width: 2.5; } .fig-cross-1 { stroke: currentColor; stroke-width: 2.5; }
.fig-cross-2 { stroke: var(--good); stroke-width: 2.5; } .fig-cross-3 { stroke: var(--miss); stroke-width: 2.5; }
.fig-cross-4 { stroke: var(--accent); stroke-width: 2.5; } .fig-cross-5 { stroke: var(--muted); stroke-width: 2.5; }
.fig-ring-0, .fig-ring-1, .fig-ring-2, .fig-ring-3, .fig-ring-4, .fig-ring-5 { fill: var(--surface); stroke-width: 2.5; }
.fig-force { stroke-width: 3.5; }
.fig-ray { stroke-width: 3; }
.fig-medium { fill: color-mix(in srgb, var(--subject) 12%, var(--surface)); stroke: none; }
.fig-lens { fill: color-mix(in srgb, var(--subject) 14%, var(--surface)); stroke: currentColor; stroke-width: 3; stroke-linejoin: round; }
.fig-text { fill: currentColor; font-family: 'Lexend', system-ui, sans-serif; font-size: 15px; dominant-baseline: central;
    stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; paint-order: stroke; }
.fig-small { font-size: 13px; }
.fig-tiny { font-size: 11px; }
.fig-bold, .fig-meter { font-weight: 700; }
.fig-meter { font-size: 15px; }
.fig-table-wrap { width: 100%; overflow-x: auto; container-type: inline-size; }
.fig-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--surface); }
.fig-table th, .fig-table td { padding: 9px 12px; text-align: left; border-bottom: 2px solid var(--soft-line); overflow-wrap: break-word; }
@container (max-width: 380px) { .fig-table { font-size: .88rem; } .fig-table th, .fig-table td { padding: 8px 7px; } }
/* A table too wide for a phone at the usual size is set smaller, and smaller again if it must be (TableLayout.Density). */
@container (max-width: 520px) {
    .fig-table-dense { font-size: .76rem; } .fig-table-dense th, .fig-table-dense td { padding: 7px 4px; }
    .fig-table-tight { font-size: .7rem; } .fig-table-tight th, .fig-table-tight td { padding: 6px 3px; text-align: center; }
}
.fig-table th { font-weight: 700; background: color-mix(in srgb, var(--subject) 16%, var(--surface)); border-bottom-color: var(--ink); }
.fig-table tr:last-child td { border-bottom: none; }
.fig-table td + td, .fig-table th + th { border-left: 2px solid var(--soft-line); }
