/* Lesson templates (site/lesson.layout.md): Story, Slides, Practice and Sort.
   PathMX Player shows one Block per slide; these styles give every slide the
   Orcanomics "ocean" look. The components are in site/lesson.components.md.

   Sections: 1. tokens  2. top bar + Player chrome  3. slides  4. Ollie
   5. question cards  6. practice  7. sort game  8. finish  9. Slides template
   10. lesson pictures (coins, trade, penny…)  11. phones  12. Test template */
@import url("/assets/vendor/fonts/fonts.css");
@import url("/assets/vendor/font-awesome/css/all.min.css");

/* ---------- 1. Tokens ---------- */
:root {
    --ocean-dark: #0F172A;
    --ocean-primary: #0284C7;
    --ocean-teal: #0D9488;
    --ocean-light: #F0F9FF;
    --slate-gray: #CBD5E1;
    --text-dark: #1E293B;
    --text-muted: #64748B;
    --good: #22C55E;
    --good-bg: #DCFCE7;
    --good-fg: #166534;
    --bad: #EF4444;
    --bad-bg: #FEE2E2;
    --bad-fg: #991B1B;
    --gold: #F59E0B;
    --font-orbitron: "Orbitron", sans-serif;
    --font-inter: "Inter", sans-serif;
    --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.1);
    --lesson-bar-height: 60px;

    /* PathMX theme tokens: Player's buttons and progress use these. */
    --pmx-color-accent: var(--ocean-teal);
    --pmx-color-focus: var(--ocean-primary);
    --pmx-color-fg: var(--text-dark);
    --pmx-font-body: var(--font-inter);
    --pmx-font-heading: var(--font-orbitron);
    --pmx-document-measure: none;
}

body {
    margin: 0;
    color: var(--text-dark);
    background-color: #F8FAFC;
}

/* ---------- 2. Top bar and Player chrome ---------- */
.lesson-bar-source { display: none; }

.lesson-bar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1010;
    box-sizing: border-box;
    height: var(--lesson-bar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
    background: white;
    border-bottom: 1px solid #E2E8F0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    font-family: var(--font-orbitron);
}

.lesson-bar-exit,
.lesson-bar-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: none;
    color: var(--text-dark);
    font: 600 0.95rem var(--font-orbitron);
    text-decoration: none;
    cursor: pointer;
}

.lesson-bar-exit:hover,
.lesson-bar-button:hover { color: var(--ocean-primary); background: var(--ocean-light); }

.lesson-bar-title {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1.25;
}

.lesson-bar-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.lesson-bar-title strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
    color: var(--ocean-dark);
}

.lesson-bar-tools { display: flex; gap: 4px; }

/* Player's progress segments sit just under the bar. */
html.has-lesson-bar .pmx-play-progressbar {
    inset-block-start: calc(var(--lesson-bar-height) + 8px);
    height: 6px;
}

/* Player's Back / Next pills: the lesson's teal, bolder, rounder. */
html.has-lesson-bar .pmx-play-participant .pmx-button {
    font-family: var(--font-orbitron);
}

html.has-lesson-bar .pmx-play-participant-next {
    min-width: 9rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

html.has-lesson-bar .pmx-play-participant-context { display: none; }

/* ---------- 3. Slides ---------- */
/* Every lesson slide gets the dotted ocean background and room for the bar. */
.pmx-document:is([data-type="story"], [data-type="slides"], [data-type="practice"], [data-type="sort"], [data-type="test"]) {
    --pmx-slide-bg: #F8FAFC;
    --pmx-slide-fg: var(--text-dark);
    --pmx-slide-font-heading: var(--font-orbitron);
    --pmx-slide-padding: clamp(1rem, 3vw, 2.5rem);
    background-color: #F8FAFC;
    background-image: radial-gradient(rgba(2, 132, 199, 0.35) 1px, transparent 1px);
    background-size: 40px 40px;
}

html[data-pmx-play-active] .pmx-document:is([data-type="story"], [data-type="slides"], [data-type="practice"], [data-type="sort"], [data-type="test"]) section {
    background: transparent;
    padding-top: calc(var(--lesson-bar-height) + 2.5rem);
    padding-bottom: 6.5rem;
}

/* Components fill the slide's width instead of the 42rem reading column. */
.pmx-document section > :is(.ollie-scene, .quiz-card, .practice-card, .sort-card, .finish-card) {
    width: min(100%, 980px);
    margin-inline: auto;
}

/* Reading the lesson without Player (e.g. before it starts): one card per Block. */
html:not([data-pmx-play-active]) .pmx-document:is([data-type="story"], [data-type="slides"], [data-type="practice"], [data-type="sort"], [data-type="test"]) {
    padding: calc(var(--lesson-bar-height) + 24px) 16px 48px;
}

.lesson-gate {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    margin: 0;
}

.lesson-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 30px;
    border: none;
    border-radius: 12px;
    background: var(--ocean-teal);
    color: white;
    font: 800 1rem var(--font-orbitron);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background 0.2s;
}

.lesson-btn:hover:not(:disabled) { transform: translateY(-2px); background: #0F766E; }
.lesson-btn:disabled { background: #94A3B8; cursor: not-allowed; transform: none; }
.lesson-btn[hidden] { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-8px); }
    40%      { transform: translateX(8px); }
    60%      { transform: translateX(-5px); }
    80%      { transform: translateX(5px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-15px) rotate(2deg); }
}

/* ---------- 4. Ollie (Story) ---------- */
.ollie-scene {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: min(68vh, 640px);
    justify-content: space-between;
}

.ollie-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease;
}

.ollie-visual img { max-width: min(100%, 520px); max-height: 38vh; border-radius: 16px; }
.ollie-scene.no-visual .ollie-visual { display: none; }
.ollie-scene.no-visual { justify-content: flex-end; }

.ollie-row {
    display: flex;
    align-items: flex-end;
    gap: 24px;
}

.ollie-mascot {
    flex: 0 0 auto;
    width: clamp(150px, 22vw, 260px);
    height: auto;
    object-fit: contain;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 15px 20px rgba(0, 0, 0, 0.2));
}

.ollie-dialogue {
    position: relative;
    flex: 1;
    margin-bottom: 20px;
    padding: 40px 30px 24px;
    background: rgba(255, 255, 255, 0.96);
    border: 3px solid #E2E8F0;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    cursor: default;
}

/* Speech-bubble tail pointing at Ollie */
.ollie-dialogue::before {
    content: '';
    position: absolute;
    left: -17px;
    bottom: 40px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.96);
    border-left: 3px solid #E2E8F0;
    border-bottom: 3px solid #E2E8F0;
    transform: rotate(45deg);
}

.ollie-nameplate {
    position: absolute;
    top: -20px;
    left: 30px;
    padding: 8px 24px;
    border-radius: 8px;
    background: var(--ocean-primary);
    color: white;
    font: 800 0.9rem var(--font-orbitron);
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ollie-text {
    font: 600 clamp(1.05rem, 1.6vw, 1.3rem)/1.6 var(--font-inter);
    color: var(--text-dark);
}

/* A friend from Ollie's Crew talking: on the right, with their own nameplate colour. */
.ollie-scene:not([data-who=""]):not([data-who="ollie"]) .ollie-row { flex-direction: row-reverse; }
.ollie-scene:not([data-who=""]):not([data-who="ollie"]) .ollie-nameplate { left: auto; right: 30px; background: #F97316; }
.ollie-scene:not([data-who=""]):not([data-who="ollie"]) .ollie-dialogue::before {
    left: auto;
    right: -17px;
    border-left: none;
    border-bottom: none;
    border-top: 3px solid #E2E8F0;
    border-right: 3px solid #E2E8F0;
}
.ollie-scene:not([data-who=""]):not([data-who="ollie"]) .ollie-mascot { width: clamp(130px, 18vw, 210px); }

.ollie-text > :first-child { margin-top: 0; }
.ollie-text > :last-child { margin-bottom: 0; }
.ollie-scene[data-typing] .ollie-dialogue { cursor: pointer; }

/* ---------- 5. Question cards (shared by every template) ---------- */
.quiz-card,
.practice-card,
.sort-card {
    box-sizing: border-box;
    padding: clamp(20px, 3vw, 36px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.quiz-card.nudge,
.practice-card.nudge { animation: shake 0.4s ease; }

.quiz-kicker {
    margin-bottom: 10px;
    color: var(--text-muted);
    font: 700 0.85rem var(--font-orbitron);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.quiz-source,
.practice-prompt,
.sort-source {
    color: var(--ocean-dark);
    font: 800 clamp(1.15rem, 2vw, 1.45rem)/1.4 var(--font-orbitron);
}

.quiz-source p,
.practice-prompt p,
.sort-source p { margin: 0 0 12px; }

/* The ticked checklist is the answer key; the buttons replace it. */
.quiz-card .quiz-key { display: none; }

.quiz-options {
    display: grid;
    gap: 12px;
    max-width: 640px;
    margin: 20px auto 0;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 15px 18px;
    background: #F1F5F9;
    border: 2px solid var(--slate-gray);
    border-radius: 12px;
    color: var(--text-dark);
    font: 600 1.05rem var(--font-inter);
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.quiz-option:hover:not(:disabled) { background: #E0F2FE; border-color: var(--ocean-primary); transform: translateY(-2px); }
.quiz-option:disabled { cursor: default; }

.quiz-option-key {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: white;
    border: 2px solid var(--slate-gray);
    color: var(--text-muted);
    font: 800 0.85rem var(--font-orbitron);
}

.quiz-option.correct-answer { background: var(--good-bg); border-color: var(--good); color: var(--good-fg); }
.quiz-option.correct-answer .quiz-option-key { border-color: var(--good); color: var(--good-fg); }
.quiz-option.wrong-answer { background: var(--bad-bg); border-color: var(--bad); color: var(--bad-fg); }
.quiz-option.wrong-answer .quiz-option-key { border-color: var(--bad); color: var(--bad-fg); }
.quiz-option:disabled:not(.correct-answer):not(.wrong-answer) { opacity: 0.6; }

.quiz-feedback {
    min-height: 1.6em;
    margin: 18px 0 0;
    font: 700 1.05rem/1.5 var(--font-inter);
}

.quiz-feedback[data-tone="right"] { color: var(--good-fg); }
.quiz-feedback[data-tone="wrong"] { color: var(--bad-fg); }
.quiz-feedback[data-tone="nudge"] { color: var(--ocean-primary); }
.quiz-explain { display: block; margin-top: 4px; color: var(--text-dark); font-weight: 600; }

/* ---------- 6. Practice ---------- */
.practice-prompt .coin-row { margin: 18px 0 6px; }

.practice-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 22px;
}

.practice-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: #F8FAFC;
    border: 3px solid var(--slate-gray);
    border-radius: 14px;
    font: 800 1.6rem var(--font-orbitron);
    color: var(--ocean-dark);
}

.practice-field:focus-within { border-color: var(--ocean-primary); background: white; }

.practice-input {
    width: 7ch;
    padding: 8px 0;
    border: none;
    outline: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: center;
}

.practice-card:is([data-result="correct"], [data-result="solved"]) .practice-field { border-color: var(--good); background: var(--good-bg); }
.practice-card[data-result="wrong"] .practice-field { border-color: var(--bad); background: var(--bad-bg); }

/* ---------- 7. Sort game ---------- */
.sort-card :is(.sort-key, .sort-items) { display: none; }

.sort-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    margin-top: 16px;
}

.sort-item-card {
    position: relative;
    display: grid;
    place-items: center;
    min-width: min(100%, 300px);
    min-height: 110px;
    padding: 18px 28px;
    box-sizing: border-box;
    background: #FEF3C7;
    border: 3px solid var(--gold);
    border-radius: 18px;
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.25);
    font: 800 clamp(1.3rem, 3vw, 1.9rem) var(--font-inter);
    color: var(--ocean-dark);
}

.sort-item-card.sorted-in { animation: fadeIn 0.3s ease; }
.sort-item-card.shake { animation: shake 0.4s ease; }

.sort-count {
    position: absolute;
    top: 8px;
    right: 12px;
    color: #B45309;
    font: 700 0.75rem var(--font-orbitron);
}

.sort-buckets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    width: 100%;
}

.sort-bucket {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 150px;
    padding: 14px;
    background: var(--ocean-light);
    border: 3px dashed #7DD3FC;
    border-radius: 18px;
    color: var(--ocean-dark);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, border-color 0.2s;
}

.sort-bucket:hover { transform: translateY(-3px); background: #E0F2FE; border-color: var(--ocean-primary); border-style: solid; }

.sort-bucket-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font: 800 1.15rem var(--font-orbitron);
    text-transform: uppercase;
}

.sort-bucket-key {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: white;
    border: 2px solid #7DD3FC;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.sort-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.sort-chip {
    padding: 6px 10px;
    background: white;
    border: 2px solid var(--good);
    border-radius: 10px;
    font: 700 0.9rem var(--font-inter);
    animation: fadeIn 0.3s ease;
}

.sort-chip.missed { border-color: var(--gold); }

/* ---------- 8. Finish ---------- */
.finish-card {
    box-sizing: border-box;
    max-width: 560px;
    padding: 36px 30px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.pmx-document section > .finish-card { width: min(100%, 560px); }
.finish-trophy { display: block; width: 112px; height: 112px; margin: 0 auto; }
/* A test that wasn't passed yet: the trophy greyed out. */
.finish-trophy.not-yet { opacity: 0.4; filter: grayscale(1); }

.finish-title {
    margin: 12px 0 8px;
    color: var(--ocean-dark);
    font: 800 2rem var(--font-orbitron);
}

.finish-score { margin: 0; font: 600 1.15rem var(--font-inter); }

.finish-coins {
    margin: 20px 0;
    color: var(--gold);
    font: 800 2.5rem var(--font-orbitron);
}

.finish-missing {
    margin: 0 0 18px;
    padding: 12px 16px;
    background: #FFFBEB;
    border: 2px solid #FCD34D;
    border-radius: 12px;
    font: 600 1rem var(--font-inter);
}

.finish-missing p { margin: 0 0 6px; }
.finish-missing ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.finish-missing a { color: var(--ocean-primary); font-weight: 800; }
.finish-collect { padding: 15px 40px; font-size: 1.15rem; }
.finish-status { min-height: 1.4em; margin: 12px 0 0; font: 600 0.95rem var(--font-inter); color: var(--text-muted); }

/* ---------- 9. Slides template ---------- */
.pmx-document[data-type="slides"] {
    --pmx-slide-title-size: clamp(2.2rem, 6vw, 4.5rem);
    --pmx-slide-body-size: clamp(1.1rem, 2vw, 1.6rem);
}

.pmx-document[data-type="slides"] section :is(h1, h2, h3) {
    color: var(--ocean-dark);
    font-family: var(--font-orbitron);
    font-weight: 800;
}

.pmx-document[data-type="slides"] section > :is(p, ul, ol) {
    font-family: var(--font-inter);
    font-weight: 600;
}

.pmx-document[data-type="slides"] section img {
    border-radius: 18px;
}

/* Big fact slides (play: { variant: fact }) */
.pmx-document[data-type="slides"] section[data-pmx-play-variant="fact"] :is(h1, h2) {
    color: var(--ocean-teal);
    font-size: clamp(3rem, 10vw, 7rem);
}

/* Ollie's tip: a callout written as > [!ollie] Title */
.pmx-callout[data-callout="ollie"] {
    position: relative;
    padding: 20px 24px 20px 120px;
    min-height: 110px;
    box-sizing: border-box;
    background: white;
    border: 3px solid #BAE6FD;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    font-family: var(--font-inter);
}

.pmx-callout[data-callout="ollie"]::before {
    content: '';
    position: absolute;
    left: 14px;
    bottom: 10px;
    width: 92px;
    height: 92px;
    background: url("/assets/images/ollie/ollie-glasses.png") center / contain no-repeat;
}

.pmx-callout[data-callout="ollie"] .pmx-callout-title { color: var(--ocean-primary); font-family: var(--font-orbitron); }
.pmx-callout[data-callout="ollie"] .pmx-callout-icon { display: none; }

/* ---------- 10. Lesson pictures (used inside visual slots and slides) ---------- */
.trade-visual {
    display: flex;
    gap: 40px;
    align-items: center;
    padding: 20px 40px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    font-size: clamp(3rem, 10vw, 6rem);
}

.concept-visual {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    padding: 20px 40px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    font-size: clamp(2rem, 8vw, 5rem);
}

.concept-visual.coin-trio { padding: 16px 24px; gap: 12px; }

/* Lesson art: the drawings in /assets/images/lessons/ (scripts/make-lesson-art.mjs).
   Use these instead of emoji. `dim` greys one out (e.g. a want after a need). */
img.lesson-art {
    display: block;
    width: clamp(76px, 15vw, 128px);
    height: auto;
    max-height: none;
    border-radius: 0;
    object-fit: contain;
}

img.lesson-art.dim { opacity: 0.45; filter: grayscale(0.7); }
/* Wide pictures, like a bill from /assets/images/money/. */
img.lesson-art.wide { width: clamp(140px, 28vw, 230px); }

/* A small picture inside a sentence, like the magnifier before "Case 1". */
img.inline-art {
    display: inline-block;
    width: 1.7em;
    height: 1.7em;
    margin: 0 0.25em 0 0;
    border-radius: 0;
    vertical-align: -0.5em;
}

.pmx-document[data-type="slides"] section img:is(.lesson-art, .inline-art) { border-radius: 0; }

.concept-label {
    margin-bottom: 10px;
    color: var(--ocean-dark);
    font: 700 1.2rem var(--font-inter);
    text-align: center;
    text-transform: uppercase;
}

.coin-confused-label {
    margin-top: 10px;
    color: var(--bad);
    font: 700 1rem var(--font-inter);
    text-align: center;
}

.scenario-box {
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    padding: 20px 40px;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
}

.scenario-item i { font-size: clamp(3rem, 10vw, 4rem); color: var(--ocean-dark); }

/* Penny that flips on hover */
.penny-container { width: 150px; height: 150px; margin: 0 20px; perspective: 1000px; cursor: pointer; }
.penny-inner { position: relative; width: 100%; height: 100%; transition: transform 0.8s; transform-style: preserve-3d; }
.penny-container:hover .penny-inner { transform: rotateY(180deg); }

.penny-front,
.penny-back {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 30% 30%, #e6a372, #b87333);
    border: 4px solid #8d5524;
    border-radius: 50%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    color: #5a3214;
    font-family: serif;
    backface-visibility: hidden;
}

.penny-back { transform: rotateY(180deg); }
.penny-text { font-size: 0.8rem; font-weight: bold; }
.penny-face { font-size: 4rem; margin-top: -10px; }

/* Coins (<coin-row> and hand-written coin rows) */
.coin-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
}

.coin {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, #bdc3c7);
    border: 2px solid #95a5a6;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    color: #555;
    font: 700 0.85rem/1.2 var(--font-inter);
    text-align: center;
    transition: transform 0.3s;
}

.coin:hover { transform: translateY(-5px); }
.coin span { pointer-events: none; }
.coin.penny   { width: 76px;  height: 76px;  font-size: 0.75rem; background: radial-gradient(circle at 30% 30%, #f0b88a, #b87333); border-color: #8d5524; color: #4a2a10; }
.coin.dime    { width: 70px;  height: 70px;  font-size: 0.75rem; }
.coin.nickel  { width: 90px;  height: 90px;  font-size: 0.85rem; }
.coin.quarter { width: 110px; height: 110px; font-size: 0.95rem; }
.coin.half    { width: 124px; height: 124px; font-size: 1rem; }
.coin.dollar  { width: 116px; height: 116px; font-size: 1rem; background: radial-gradient(circle at 30% 30%, #fde68a, #d4a017); border-color: #a16207; color: #422006; }
.coin.zoomed  { width: 140px; height: 140px; font-size: 1.2rem; }

/* ---------- 11. Phones ---------- */
@media (max-width: 768px) {
    :root { --lesson-bar-height: 52px; }
    .lesson-bar-exit span { display: none; }
    .lesson-bar-title strong { font-size: 0.85rem; }

    .ollie-scene { min-height: auto; gap: 16px; }
    .ollie-row { flex-direction: column; align-items: center; gap: 0; }
    .ollie-scene:not([data-who=""]):not([data-who="ollie"]) .ollie-row { flex-direction: column; }
    .ollie-scene:not([data-who=""]):not([data-who="ollie"]) .ollie-mascot { width: 110px; }
    .ollie-mascot { width: 120px; margin-bottom: -10px; }
    .ollie-dialogue { width: 100%; box-sizing: border-box; margin-bottom: 0; padding: 30px 18px 16px; }
    .ollie-dialogue::before { display: none; }
    .ollie-visual img { max-height: 30vh; }

    .trade-visual { gap: 20px; padding: 10px 20px; }
    .concept-visual { flex-direction: column; gap: 15px; padding: 15px 20px; font-size: 2.5rem; text-align: center; }

    .quiz-option { padding: 12px 14px; font-size: 1rem; }
    .practice-field { font-size: 1.3rem; }
    .sort-bucket { min-height: 110px; }
    .pmx-callout[data-callout="ollie"] { padding-left: 90px; }
    .pmx-callout[data-callout="ollie"]::before { width: 66px; height: 66px; }

    .coin.dime    { width: 60px;  height: 60px;  font-size: 0.7rem; }
    .coin.penny   { width: 64px;  height: 64px;  font-size: 0.7rem; }
    .coin.nickel  { width: 80px;  height: 80px;  font-size: 0.8rem; }
    .coin.quarter { width: 100px; height: 100px; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
    .ollie-mascot { animation: none; }
}

/* ---------- 12. Test template ---------- */
/* A deep-ocean background sets tests apart from lessons. */
.pmx-document[data-type="test"] {
    --pmx-slide-bg: #0B2540;
    background-color: #0B2540;
    background-image: radial-gradient(rgba(125, 211, 252, 0.25) 1px, transparent 1px);
}

.pmx-document[data-type="test"] .ollie-text,
.pmx-document[data-type="test"] .quiz-card,
.pmx-document[data-type="test"] .practice-card,
.pmx-document[data-type="test"] .sort-card { color: var(--text-dark); }

.pmx-document[data-type="test"] section > :is(h1, h2, h3, p) { color: white; }

/* A chosen answer in a test: selected, not marked right or wrong. */
.quiz-card[data-mode="test"] .quiz-option.chosen {
    background: var(--ocean-primary);
    border-color: var(--ocean-primary);
    color: white;
}

.quiz-card[data-mode="test"] .quiz-option.chosen .quiz-option-key { border-color: white; color: var(--ocean-primary); }
.quiz-feedback[data-tone="saved"] { color: var(--text-muted); font-weight: 600; }
.practice-card[data-result="answered"] .practice-field { border-color: var(--ocean-primary); background: var(--ocean-light); }
.sort-chip.placed { border-color: #7DD3FC; }

/* The friend a Final Test rescues (Ollie's Crew) */
.finish-rescue {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 6px 0 18px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ECFEFF, #F0FDF4);
    border: 2px solid #5EEAD4;
    text-align: left;
}

.finish-rescue[hidden] { display: none; }
.finish-rescue[data-saved="false"] { background: #F8FAFC; border-color: #CBD5E1; }
.finish-rescue-img { flex: 0 0 auto; width: 96px; height: 96px; animation: float 4s ease-in-out infinite; }
.finish-rescue[data-saved="false"] .finish-rescue-img { filter: brightness(0) opacity(0.35); animation: none; }
.finish-rescue-title { margin: 0 0 4px; color: var(--ocean-dark); font: 800 1.15rem var(--font-orbitron); }
.finish-rescue-line { margin: 0 0 8px; color: var(--text-dark); font: 600 0.95rem/1.45 var(--font-inter); }
.finish-rescue-link { color: var(--ocean-teal); font: 800 0.9rem var(--font-inter); }
.finish-rescue-link[hidden] { display: none; }

.finish-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin: 0 0 18px;
    text-align: left;
}

.finish-category {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font: 600 0.9rem var(--font-inter);
    background: var(--good-bg);
    color: var(--good-fg);
}

.finish-category[data-level="work"] { background: #FEF3C7; color: #92400E; }

.finish-review {
    margin: 0 0 18px;
    padding: 10px 14px;
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    text-align: left;
    font: 600 0.95rem/1.45 var(--font-inter);
}

.finish-review summary { cursor: pointer; font-weight: 800; color: var(--ocean-primary); }
.finish-review ol { margin: 10px 0 0; padding-left: 1.3em; display: grid; gap: 8px; }
.finish-review li span { display: block; }
.finish-right-answer { color: var(--good-fg); font-weight: 800; }
/* A failed test names what was missed (its category), not the answers. */
.finish-missed { color: var(--text-muted); font-weight: 700; font-size: 0.9em; }
.finish-explain { color: var(--text-muted); font-size: 0.95em; }
.finish-review-note { margin: 10px 0 0; color: var(--text-muted); font-weight: 600; }
.finish-review-note[hidden] { display: none; }

.finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.lesson-btn-quiet { background: white; color: var(--ocean-dark); border: 2px solid var(--slate-gray); box-shadow: none; }
.lesson-btn-quiet:hover:not(:disabled) { background: #F1F5F9; }
.finish-card[data-passed="false"] .finish-coins { font-size: 1.4rem; color: var(--text-muted); }
.pmx-document[data-type="test"] section > .finish-card { width: min(100%, 640px); }

/* ---------- Mini-games (a unit's own game component; see "Mini-games" in lesson.components.md) ---------- */
.game-card {
    box-sizing: border-box;
    padding: clamp(20px, 3vw, 36px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    text-align: center;
    animation: fadeIn 0.4s ease;
}
.pmx-document section > .game-card {
    width: min(100%, 980px);
    margin-inline: auto;
}
.game-prompt { font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 700; color: var(--pmx-color-text, #0F172A); }
.game-prompt > :last-child { margin-bottom: 0; }
.game-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 18px; }
.lesson-btn.game-secondary { background: #E2E8F0; color: #1E293B; }
.lesson-btn.game-secondary:hover:not(:disabled) { background: #CBD5E1; }
.game-card.nudge { animation: shake 0.4s ease; }
/* On a phone, Player's floating Back/Next sit over the bottom of a tall game: leave room under its buttons. */
@media (max-width: 720px) {
    .game-card { padding-bottom: 84px; }
}
