/* Layout: a bleu-marine slate in a striped marinière frame, with a bleu-blanc-rouge ribbon across the top.
   Headings are in French school cursive; everything else stays in a plain, readable font. Deliberately single-theme (a slate is always dark). */
:root {
  --board: #1d2b52;
  --board-2: #26386a;
  --chalk: #f7f2e8;
  --chalk-dim: #aebbd8;
  --yellow: #ffd27a;
  --pink: #ff9eaa;
  --blue: #a9c8ff;
  --green: #a3e0ab;
  --orange: #f5b47e;
  --rouge: #e63946;
  --rouge-dark: #a3222c;
  --bleu: #2f56c9;
  --stripe: #1a2547;
  --room: #f3ecdf;
  --font: "Andika", "Trebuchet MS", system-ui, sans-serif;
  --script: "Playwrite FR Moderne", "Snell Roundhand", cursive;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }
[hidden] { display: none !important; }
body { background: var(--room); color: var(--chalk); font-family: var(--font); font-size: 18px; line-height: 1.45; margin: 0; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); padding-block: max(20px, env(safe-area-inset-top)) max(40px, env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
.wrap {
  max-width: 780px; margin: 0 auto; padding: 14px; border-radius: 14px;
  background: repeating-linear-gradient(180deg, var(--stripe) 0 11px, var(--chalk) 11px 22px);
  box-shadow: 0 10px 30px rgba(26,37,71,.35);
}
.board {
  background:
    linear-gradient(90deg, var(--bleu) 0 33.33%, var(--chalk) 33.33% 66.66%, var(--rouge) 66.66%) top / 100% 8px no-repeat,
    radial-gradient(ellipse at 20% 15%, rgba(255,255,255,.06), transparent 55%),
    radial-gradient(ellipse at 85% 80%, rgba(255,255,255,.04), transparent 50%),
    var(--board);
  border-radius: 6px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.3);
  padding: clamp(26px, 4vw, 40px) clamp(18px, 4vw, 36px) clamp(18px, 4vw, 36px);
  min-height: 520px;
  display: flex; flex-direction: column; gap: 22px;
}
@media (max-width: 520px) { .wrap { padding: 8px; } body { font-size: 17px; } }
h1, h2 { margin: 0; font-weight: 700; text-wrap: balance; }
h1 { font-family: var(--script); font-weight: 400; font-size: clamp(1.6rem, 5.5vw, 2.3rem); color: var(--chalk); line-height: 1.6; }
h2 { font-family: var(--script); font-weight: 400; font-size: 1.1rem; color: var(--blue); line-height: 1.7; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.link { background: none; border: none; color: var(--chalk-dim); text-decoration: underline; text-underline-offset: 4px; padding: 6px 2px; font-size: .95rem; }
.link:hover { color: var(--chalk); }
.meta { color: var(--chalk-dim); margin: 0; font-size: .95rem; }
section { display: flex; flex-direction: column; gap: 12px; }

/* tally */
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.count { font-size: 1.4rem; font-weight: 700; color: var(--orange); font-variant-numeric: tabular-nums; }
.tally { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.tally svg { width: 46px; height: 40px; }
.tally line { stroke: var(--chalk); stroke-width: 3.2; stroke-linecap: round; }
.tally line.empty { stroke-opacity: .13; }
.tally line.slash { stroke: var(--orange); }

/* topic chips */
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.chip { text-align: left; background: transparent; border: 2px solid rgba(238,236,227,.25); border-radius: 14px 10px 16px 9px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.chip small { color: var(--chalk-dim); font-size: .8rem; }
.chip[aria-pressed="true"] { border-color: var(--green); background: rgba(169,217,161,.1); }
.chip[aria-pressed="true"] strong { color: var(--green); }

.start { align-self: flex-start; background: var(--rouge); color: var(--chalk); border: none; font-weight: 700; font-size: 1.35rem; padding: 14px 30px; border-radius: 16px 12px 18px 10px; box-shadow: 0 4px 0 var(--rouge-dark); }
.start:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--rouge-dark); }
.ghost { background: transparent; border: 2px solid rgba(238,236,227,.35); border-radius: 12px; padding: 10px 20px; font-weight: 700; }
.row-btns { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* play */
.play-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ticks { display: flex; gap: 6px; }
.ticks span { width: 14px; height: 6px; border-radius: 3px; background: rgba(238,236,227,.15); }
.ticks span.done { background: var(--green); }
.ticks span.miss { background: var(--pink); }
.ticks span.now { background: var(--yellow); }
.skill-label { color: var(--chalk-dim); font-size: .9rem; }
.problem { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; min-height: 190px; justify-content: center; }
.q { font-size: clamp(2.6rem, 11vw, 4.2rem); font-weight: 700; letter-spacing: .02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.story { font-size: clamp(1.25rem, 4.2vw, 1.6rem); max-width: 34ch; line-height: 1.5; }
.ask { font-size: 1.3rem; color: var(--blue); }
.box { display: inline-block; width: .9em; height: 1em; border: 4px dashed var(--yellow); border-radius: 8px; vertical-align: -0.1em; }
.say { background: transparent; border: 2px solid rgba(159,203,233,.5); color: var(--blue); border-radius: 999px; width: 46px; height: 46px; display: grid; place-items: center; flex: none; }
.say svg { width: 24px; height: 24px; }

.column { display: grid; grid-template-columns: repeat(var(--w), .72em); font-size: clamp(2.8rem, 11vw, 4.2rem); font-weight: 700; line-height: 1.15; justify-content: center; }
.cc { text-align: center; }
.cc.op { color: var(--blue); }
.rule { grid-column: 1 / -1; height: 5px; background: var(--chalk); border-radius: 3px; margin-top: 6px; }

.dots { display: grid; gap: var(--g); grid-template-columns: repeat(var(--c), var(--d)); }
.dots i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--yellow); box-shadow: inset -2px -3px 0 rgba(0,0,0,.18); }
.dots i.alt { background: var(--orange); }
.blocks { display: grid; gap: 3px; grid-template-columns: repeat(var(--c), var(--d)); padding: 6px; border: 3px solid var(--blue); border-radius: 6px; }
.blocks i { width: var(--d); height: var(--d); background: var(--blue); border-radius: 3px; opacity: .85; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice { position: relative; background: rgba(255,255,255,.03); border: 3px solid rgba(238,236,227,.55); border-radius: 18px 12px 20px 11px; padding: 16px 10px; font-size: clamp(1.6rem, 6vw, 2.2rem); font-weight: 700; font-variant-numeric: tabular-nums; min-height: 80px; }
.choice:hover:not(:disabled) { border-color: var(--yellow); background: rgba(243,215,122,.08); }
.choice .key { position: absolute; top: 6px; left: 10px; font-size: .75rem; color: var(--chalk-dim); font-weight: 400; }
.choice.no { opacity: .35; text-decoration: line-through; text-decoration-color: var(--pink); text-decoration-thickness: 4px; border-color: var(--pink); }
.choice.ok { border-color: var(--green); background: rgba(169,217,161,.16); color: var(--green); }
.choice:disabled { cursor: default; }
.feedback { min-height: 3.2em; text-align: center; font-size: 1.15rem; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.feedback .big { font-weight: 700; font-size: 1.4rem; }
.feedback .good { color: var(--green); }
.feedback .try { color: var(--pink); }
.feedback .how { color: var(--chalk-dim); }
.next-row { display: flex; justify-content: center; }
@keyframes wobble { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }
.shake { animation: wobble .25s ease 2; }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }

/* done */
.stars { display: flex; flex-wrap: wrap; gap: 8px; }
.stars svg { width: 44px; height: 44px; }
.done-text { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ups { margin: 0; padding-left: 1.2em; color: var(--green); }

/* grown-ups */
.levels { display: flex; flex-direction: column; gap: 2px; }
.lvl { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed rgba(238,236,227,.18); }
.lvl > div { min-width: 0; }
.lvl small { display: block; color: var(--chalk-dim); font-size: .85rem; }
.stepper { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.stepper button { width: 36px; height: 36px; border-radius: 10px; background: transparent; border: 2px solid rgba(238,236,227,.35); font-weight: 700; }
.stepper button:disabled { opacity: .25; cursor: default; }
.seg { display: inline-flex; border: 2px solid rgba(238,236,227,.3); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: none; padding: 6px 14px; }
.seg button[aria-pressed="true"] { background: var(--chalk); color: var(--board); font-weight: 700; }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: .95rem; }
.list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed rgba(238,236,227,.12); padding-bottom: 4px; }
.list li span:last-child { color: var(--chalk-dim); text-align: right; font-variant-numeric: tabular-nums; }
.note { color: var(--chalk-dim); font-size: .88rem; margin: 0; }
.pick { font: inherit; font-size: .95rem; background: var(--board-2); color: var(--chalk); border: 2px solid rgba(238,236,227,.3); border-radius: 10px; padding: 6px 10px; max-width: 100%; min-width: 0; }
.danger { color: var(--pink); border-color: rgba(242,167,184,.5); }
.code-input { width: 11em; letter-spacing: .08em; text-transform: uppercase; }
.sync-code { font-size: 1.5rem; letter-spacing: .12em; color: var(--yellow); font-variant-numeric: tabular-nums; user-select: all; }
.danger-text { color: var(--pink); }
input:focus-visible, select:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* home groups */
.group { display: flex; flex-direction: column; gap: 10px; }
.group h3 { margin: 6px 0 0; font-size: 1rem; color: var(--chalk); }
.group h3 small { font-weight: 400; color: var(--chalk-dim); font-size: .82rem; margin-left: 6px; }

/* off the screen */
.hands { border: 2px dashed rgba(169,217,161,.5); border-radius: 14px; padding: 14px 18px; }
.hands h2 { color: var(--green); }
.hands ul { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 8px; }

/* paper practice */
@media screen { #print { display: none; } }
@media print {
  :root { --board: #ffffff; --chalk: #1d1d1d; --chalk-dim: #5c5c5c; --yellow: #c99700; --blue: #2f6d9a; --green: #3c7a39; --orange: #c46a1e; --pink: #b8456a; --room: #ffffff; color-scheme: light; }
  body { background: #fff; color: #1d1d1d; padding: 0; font-size: 15pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .wrap { display: none; }
  #print { display: block; font-family: var(--font); }
  .pp-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #1d1d1d; margin-bottom: 8pt; }
  .pp-head h1 { color: #1d1d1d; font-size: 22pt; }
  .sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14pt; }
  .sheet-card { break-inside: avoid; border: 1.5pt dashed #999; border-radius: 10pt; padding: 10pt 6pt 8pt; display: flex; flex-direction: column; align-items: center; gap: 6pt; text-align: center; }
  .sheet-card .emo { font-size: 46pt; line-height: 1.1; }
  .sheet-card .swatch, .sheet-card .shape { width: 64pt; height: 64pt; }
  .sheet-card .shape { --fill: #fff; stroke: #1d1d1d; }
  .trace { font-size: 22pt; font-weight: 700; color: #fff; -webkit-text-stroke: 1.2pt #1d1d1d; letter-spacing: .04em; line-height: 1.2; }
  .sheet-en { font-size: 10pt; color: #666; }
}

/* problem kinds */
.tag { font-weight: 700; border-radius: 999px; padding: 1px 8px; font-size: .8rem; }
.tag.again { color: var(--board); background: var(--pink); }
.tag.easier { color: var(--board); background: var(--blue); }
.tag.stretch { color: var(--board); background: var(--yellow); }
.big-news { color: var(--yellow); font-size: 1.15rem; }
.name-form { display: flex; flex-direction: column; gap: 8px; }
.name-form label { font-weight: 700; }
.name-input { width: 12em; font-size: 1.1rem; }

/* goal picker and topic level bars */
.goal-pick { display: flex; align-items: center; gap: 10px; min-width: 0; }
.goal-pick label { font-size: 1.05rem; color: var(--chalk-dim); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.goal-pick select { font-weight: 700; font-size: 1rem; }
.goal-head { flex-wrap: wrap; }
.lvlbar { display: flex; gap: 3px; margin-top: auto; padding-top: 8px; width: 100%; }
.seg-bar { flex: 1; height: 7px; border-radius: 4px; background: rgba(238,236,227,.14); overflow: hidden; }
.seg-bar i { display: block; height: 100%; background: var(--chalk-dim); border-radius: 4px; }
.chip[aria-pressed="true"] .seg-bar i { background: var(--green); }
.lvlbar.done .seg-bar i { background: var(--yellow) !important; }
.small-link { font-size: .82rem; padding: 2px 0; }
.topic-reset { gap: 14px; }
.topic-reset .link { font-size: .85rem; padding: 2px 0; }

.cheer { margin: 0; font-size: 1.15rem; color: var(--chalk); max-width: 34ch; }

/* pictures */
.emo { font-size: clamp(3rem, 12vw, 4.4rem); line-height: 1.1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.emo.sm { font-size: .6em; }
.swatch { width: clamp(70px, 20vw, 96px); height: auto; }
.swatch path { stroke: var(--chalk); stroke-width: 3; stroke-opacity: .7; }
.shape { width: clamp(70px, 20vw, 100px); height: auto; overflow: visible; }
.shape > * { fill: var(--fill); stroke: var(--chalk); stroke-width: 4; stroke-linejoin: round; }
.shape .mid { fill: var(--yellow); }
.numeral { font-size: clamp(2.8rem, 11vw, 4rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.many { display: grid; grid-template-columns: repeat(3, auto); justify-content: center; gap: 2px 6px; font-size: clamp(1.7rem, 6.5vw, 2.4rem); line-height: 1.15; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.pair { display: inline-flex; align-items: flex-end; gap: 4px; }
.pair .emo { font-size: clamp(2.6rem, 10vw, 3.6rem); }
.pair .emo.sm { font-size: clamp(1.7rem, 6.5vw, 2.3rem); }
/* dans / sur / sous / à côté */
.scene { position: relative; display: block; width: 120px; height: 120px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.scene span { position: absolute; transform: translate(-50%, -50%); line-height: 1; }
.scene .obj { font-size: 58px; z-index: 2; }
.scene .who { font-size: 40px; z-index: 3; }
.scene.sur .obj { left: 50%; top: 74%; } .scene.sur .who { left: 50%; top: 26%; }
.scene.sous .obj { left: 50%; top: 30%; } .scene.sous .who { left: 50%; top: 82%; }
.scene.dans .obj { left: 50%; top: 66%; } .scene.dans .who { left: 50%; top: 44%; z-index: 1; }
.scene.cote .obj { left: 34%; top: 62%; } .scene.cote .who { left: 82%; top: 70%; }

/* play */
.prompt { font-size: clamp(1.5rem, 5.5vw, 2.1rem); font-weight: 700; color: var(--blue); line-height: 1.3; max-width: 26ch; }
.prompt .dim, .dim { color: var(--chalk-dim); font-weight: 400; font-size: .8em; }
.bigpic .emo { font-size: clamp(5rem, 22vw, 7.5rem); }
.bigpic .swatch, .bigpic .shape { width: clamp(120px, 34vw, 170px); }
.bigpic .numeral { font-size: clamp(4.5rem, 18vw, 6.5rem); }
.choices.pics .choice { min-height: clamp(110px, 26vw, 150px); display: grid; place-items: center; padding: 12px 8px; }
.choice.no { text-decoration: none; }
.choice.no > :not(.key) { filter: grayscale(1); }
.feedback .word { font-size: clamp(1.6rem, 6vw, 2.1rem); font-weight: 700; color: var(--yellow); }
.say.slow { font-size: 1.3rem; }
.row-btns.center, .center { justify-content: center; text-align: center; }
.start svg { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }
.start small { font-size: .7em; font-weight: 400; opacity: .8; margin-left: .3em; }

/* new words on the done screen */
.learned { display: flex; flex-wrap: wrap; gap: 10px; }
.learned-word { background: transparent; border: 2px solid rgba(243,215,122,.5); border-radius: 14px 10px 16px 9px; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--yellow); font-weight: 700; }
.learned-word .emo { font-size: 2.4rem; }
.learned-word .swatch, .learned-word .shape { width: 48px; }
.learned-word .numeral { font-size: 2rem; }

/* grown-ups: known words, own words */
.import-box { width: 100%; min-height: 5em; resize: vertical; font-size: 1rem; }
.known-lists { display: flex; flex-direction: column; gap: 4px; }
.known-lists details { border-bottom: 1px dashed rgba(238,236,227,.18); padding: 8px 0; }
.known-lists summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.known-lists details[open] summary { margin-bottom: 10px; }
.wordchips { display: flex; flex-wrap: wrap; gap: 8px; }
.wchip { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 2px solid rgba(238,236,227,.22); border-radius: 999px; padding: 3px 12px 3px 6px; font-size: .95rem; }
.wchip small { color: var(--chalk-dim); }
.wchip[aria-pressed="true"] { border-color: var(--green); color: var(--green); background: rgba(169,217,161,.1); }
.wpic { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; }
.wpic .emo { font-size: 1.3rem; }
.wpic .swatch, .wpic .shape { width: 1.5em; }
.wpic .numeral { font-size: 1rem; }
.custom-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.custom-form input { width: 9em; }
.custom-form .emoji-input { width: 4.5em; text-align: center; }
small.inline { display: inline; color: var(--chalk-dim); font-size: .85rem; }
.link.inline-link { padding: 0; font-size: inherit; }

/* conversations */
.scenes { display: flex; flex-wrap: wrap; gap: 10px; }
.scene-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 2px solid rgba(159,203,233,.45); border-radius: 16px 11px 18px 10px; padding: 8px 16px 8px 10px; font-weight: 700; color: var(--blue); }
.scene-btn .emo { font-size: 1.8rem; }
.scene-btn small { color: var(--yellow); font-weight: 400; }
.convo { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 560px; }
.bubble { display: flex; align-items: flex-end; gap: 10px; }
.bubble.you { flex-direction: row-reverse; }
.bubble .av { font-size: 2.6rem; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; flex: none; }
.bubble .text { font: inherit; text-align: left; font-size: clamp(1.2rem, 4.5vw, 1.55rem); font-weight: 700; line-height: 1.3; padding: 10px 16px; border-radius: 18px 18px 18px 4px; background: rgba(159,203,233,.14); border: 2px solid rgba(159,203,233,.55); color: var(--chalk); max-width: 80%; }
.bubble.you .text { border-radius: 18px 18px 4px 18px; background: rgba(243,215,122,.12); border-color: rgba(243,215,122,.55); color: var(--yellow); }
.bubble.past { opacity: .5; }
.bubble.past .av { font-size: 1.8rem; }
.bubble.past .text { font-size: 1rem; padding: 6px 12px; }
.bubble.hint .text { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.bubble.hint small { color: var(--chalk-dim); font-weight: 400; font-size: .8rem; }
.intent .emo, .intro-pic .emo { font-size: clamp(2.6rem, 10vw, 3.4rem); }
.intro-pic { align-self: flex-end; margin-right: 56px; }
.emo.reply { font-size: clamp(2.4rem, 9vw, 3.2rem); }
.intro-btn { background: transparent; border: 3px dashed rgba(243,215,122,.6); border-radius: 22px; padding: 10px 26px; }
.intro-btn .emo { font-size: clamp(5rem, 22vw, 7.5rem); }
.intro-btn .swatch, .intro-btn .shape { width: clamp(120px, 34vw, 170px); }
.intro-btn .numeral { font-size: clamp(4.5rem, 18vw, 6.5rem); }
.ticks span.intro { background: var(--blue); }
.ticks span.intro-later { background: rgba(159,203,233,.25); }
.kids { display: flex; flex-wrap: wrap; gap: 10px; }
.kid { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 2px solid rgba(247,242,232,.25); border-radius: 999px; padding: 4px 16px 4px 8px; font-weight: 700; font-size: 1.1rem; }
.kid .emo { font-size: 1.8rem; }
.kid[aria-pressed="true"] { border-color: var(--rouge); background: rgba(230,57,70,.15); }
.cast-input { width: min(100%, 26em); }
.jacques { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.jacques .emo { font-size: clamp(3.4rem, 13vw, 4.6rem); }
.jacques .prompt { font-size: clamp(1.8rem, 6.5vw, 2.5rem); }
.board > .bigpic { align-self: center; }
/* conversation replies: written, each with its own speaker */
.replies { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 560px; align-self: center; }
.reply-row { display: flex; align-items: center; gap: 10px; }
.choice.reply { flex: 1; text-align: left; font-size: clamp(1.15rem, 4.4vw, 1.45rem); min-height: 0; padding: 12px 16px 12px 34px; line-height: 1.3; }
.choice.reply .key { top: 50%; transform: translateY(-50%); left: 12px; }
.choice.reply.no { text-decoration: line-through; text-decoration-color: var(--pink); text-decoration-thickness: 3px; }
