@font-face {
  font-family: "Scheherazade";
  src: url("fonts/scheherazade-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Baloo";
  src: url("fonts/baloo-2-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Baloo";
  src: url("fonts/baloo-2-latin-ext-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Baloo";
  src: url("fonts/baloo-2-latin-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Baloo";
  src: url("fonts/baloo-2-latin-ext-800-normal.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #FFF7E6;
  --ink: #23312C;
  --muted: #6B776F;
  --green: #0B6E55;
  --green-2: #3DBE92;
  --orange: #FF8A3D;
  --yellow: #FFC93C;
  --blue: #3C8DFF;
  --pink: #FF5C8A;
  --card: #FFFFFF;
  --line: #EADFC8;
  --shadow: 0 6px 0 rgba(0,0,0,.12);
  --radius: 26px;
  --arabic: "Scheherazade", "Geeza Pro", "Noto Naskh Arabic", "Times New Roman", serif;
  --round: "Baloo", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--round);
  font-weight: 600;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .35; cursor: default; }
.hidden { display: none !important; }

#app { height: 100dvh; position: relative; overflow: hidden; }

.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 14px) calc(env(safe-area-inset-right) + 16px) calc(env(safe-area-inset-bottom) + 16px) calc(env(safe-area-inset-left) + 16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; animation: pop .25s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Barre du haut ---------- */
.bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar h2 { margin: 0; text-align: center; font-weight: 800; font-size: clamp(22px, 4.5vw, 34px); color: var(--green); }
.round-btn {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow); font-size: 28px;
  display: grid; place-items: center;
}
.round-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.12); }

.stars-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border-radius: 999px; padding: 8px 18px;
  font-weight: 800; font-size: 26px; box-shadow: var(--shadow);
}
.stars-pill.small { font-size: 20px; padding: 6px 14px; }
.stars-pill.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.25); } }

/* ---------- Accueil ---------- */
.home-head { display: flex; justify-content: space-between; align-items: center; }
.parent-btn { position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; opacity: .55; }
.parent-btn .hold-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.parent-btn .hold-ring circle { fill: none; stroke: var(--green); stroke-width: 3; stroke-dasharray: 100.5; stroke-dashoffset: 100.5; }
.parent-btn.holding .hold-ring circle { transition: stroke-dashoffset 1.5s linear; stroke-dashoffset: 0; }

.home-title { text-align: center; margin: 2vh 0 3vh; }
.home-letters { font-family: var(--arabic); font-size: clamp(56px, 12vw, 110px); color: var(--green); line-height: 1.1; letter-spacing: .15em; }
.home-title h1 { margin: 0; font-weight: 800; font-size: clamp(34px, 7vw, 60px); line-height: 1; }
.home-title p { margin: 8px 0 0; color: var(--muted); font-size: clamp(18px, 3.5vw, 26px); }

.home-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 760px; width: 100%; margin: 0 auto; }
.big-btn {
  border-radius: var(--radius); padding: 22px 12px; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-weight: 800; font-size: clamp(22px, 4.5vw, 34px); color: #fff; box-shadow: 0 8px 0 rgba(0,0,0,.18);
}
.big-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.big-btn.small { min-height: 0; padding: 14px 22px; font-size: 22px; flex-direction: row; gap: 10px; }
.big-emoji { font-size: clamp(48px, 10vw, 76px); line-height: 1; }
.btn-learn { background: var(--green); }
.btn-game { background: var(--orange); }

.week { margin: 4vh auto 0; max-width: 760px; width: 100%; background: var(--card); border-radius: var(--radius); padding: 14px 16px 18px; box-shadow: var(--shadow); }
.week-title { margin: 0 0 10px; text-align: center; color: var(--muted); font-size: 20px; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 15px; color: var(--muted); }
.day .dot { width: clamp(34px, 8vw, 52px); aspect-ratio: 1; border-radius: 50%; background: #F1EBDD; display: grid; place-items: center; font-size: clamp(18px, 4vw, 28px); }
.day.done .dot { background: #FFF1C2; }
.day.today span:last-child { color: var(--green); font-weight: 800; }

/* ---------- Grille ---------- */
.letters-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(clamp(88px, 21vw, 130px), 1fr));
  padding-bottom: 20px;
}
.tile {
  position: relative; aspect-ratio: 1; border-radius: 22px; background: var(--card);
  box-shadow: var(--shadow); display: grid; place-items: center;
  font-family: var(--arabic); font-size: clamp(54px, 12vw, 84px); line-height: 1; padding-bottom: 8px;
}
.tile:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.tile:nth-child(5n+1) { color: var(--green); }
.tile:nth-child(5n+2) { color: var(--blue); }
.tile:nth-child(5n+3) { color: var(--orange); }
.tile:nth-child(5n+4) { color: var(--pink); }
.tile:nth-child(5n+5) { color: #8A5CF6; }
.tile .badge { position: absolute; top: 6px; left: 8px; font-size: 20px; font-family: var(--round); }
.tile .nosound { position: absolute; bottom: 6px; right: 10px; font-size: 12px; opacity: .35; font-family: var(--round); }
.empty { text-align: center; color: var(--muted); font-size: 24px; margin: auto; display: flex; flex-direction: column; align-items: center; gap: 18px; }

/* ---------- Une lettre ---------- */
.letter-stage { flex: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 0; }
.letter-big {
  font-family: var(--arabic); text-align: center; color: var(--green);
  font-size: min(52vh, 62vw); line-height: 1.05; padding-bottom: 4vh;
}
.letter-big.pulse { animation: pulse .6s ease; }
@keyframes pulse { 40% { transform: scale(1.08); } }
.nav-arrow { width: 64px; height: 64px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-size: 24px; color: var(--muted); }
.nav-arrow:active { transform: translateY(3px); }

.letter-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; }
.ctrl {
  border-radius: var(--radius); min-height: 118px; padding: 12px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: clamp(18px, 4vw, 26px); font-weight: 800; color: #fff; box-shadow: 0 8px 0 rgba(0,0,0,.18);
  position: relative; overflow: hidden;
}
.ctrl:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.ctrl-emoji { font-size: clamp(40px, 8vw, 56px); line-height: 1; }
.ctrl-listen { background: var(--blue); }
.ctrl-record { background: var(--pink); }
.ctrl-mine { background: #8A5CF6; }
.ctrl.playing { animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { filter: brightness(1.15); } }
.ctrl-record.recording { background: #E0243F; animation: glow .8s ease-in-out infinite; }
.rec-bar { position: absolute; left: 0; bottom: 0; height: 8px; width: 100%; background: rgba(255,255,255,.25); display: none; }
.rec-bar span { display: block; height: 100%; width: 0; background: #fff; }
.ctrl-record.recording .rec-bar { display: block; }
.hint { text-align: center; color: var(--muted); font-size: clamp(16px, 3.4vw, 22px); margin: 12px 0 0; min-height: 1.4em; }

/* ---------- Jeu ---------- */
.game-progress { font-weight: 800; font-size: 22px; background: var(--card); padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow); }
.game-play { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.game-listen { width: clamp(120px, 26vw, 170px); aspect-ratio: 1; border-radius: 50%; background: var(--blue); color: #fff; font-size: clamp(56px, 12vw, 80px); box-shadow: 0 8px 0 rgba(0,0,0,.18); }
.game-listen:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.game-listen.playing { animation: glow 1s ease-in-out infinite; }
.game-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; max-width: 720px; margin-top: 10px; }
.choice {
  aspect-ratio: 1; border-radius: 26px; background: var(--card); box-shadow: var(--shadow);
  font-family: var(--arabic); font-size: clamp(64px, 16vw, 120px); line-height: 1; color: var(--ink); padding-bottom: 10px;
}
.choice:active { transform: translateY(3px); }
.choice.good { background: #C9F2DE; color: var(--green); animation: pulse .5s; }
.choice.bad { background: #FFD6DE; opacity: .5; animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.game-end { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.trophy { font-size: 120px; animation: pulse 1s ease infinite; }
.game-end h3 { font-size: 48px; margin: 0; color: var(--green); font-weight: 800; }
.game-end p { font-size: 26px; color: var(--muted); }
.end-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* ---------- Parent ---------- */
.parent { background: #F4F1EA; -webkit-user-select: text; user-select: text; }
.parent-body { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 30px; }
.card { background: var(--card); border-radius: 18px; padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.card h3 { margin: 0 0 6px; font-size: 20px; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 16px; line-height: 1.35; }
.p-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px; background: #EEE8DA; font-size: 16px; font-weight: 600; min-height: 44px;
}
.p-btn.primary { background: var(--green); color: #fff; }
.p-btn.danger { background: #FFE1E6; color: #B4233C; }
.p-btn.rec { background: #FFE1E6; color: #B4233C; }
.p-btn.rec.recording { background: #E0243F; color: #fff; }
.p-row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.p-row-actions.center { justify-content: center; }
.parent-list { list-style: none; margin: 0; padding: 0; }
.parent-list li { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.p-letter { font-family: var(--arabic); font-size: 40px; text-align: center; line-height: 1; padding-bottom: 6px; }
.p-info { display: flex; flex-direction: column; font-size: 16px; }
.p-info small { color: var(--muted); font-weight: 600; font-size: 13px; }
.p-info small.ok { color: var(--green); }
.p-actions { display: flex; gap: 6px; align-items: center; }
.p-actions .p-btn { padding: 8px 10px; min-width: 44px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #D8D2C4; border-radius: 999px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green-2); }
.switch input:checked + span::after { transform: translateX(20px); }
.p-field { display: flex; flex-direction: column; gap: 6px; font-size: 16px; margin-bottom: 12px; }
.p-field input { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); font-size: 18px; }
.small-note { font-size: 14px !important; margin: 0 !important; }

/* ---------- Enregistrement rapide ---------- */
.quick { position: fixed; inset: 0; background: rgba(20,30,25,.55); display: grid; place-items: center; padding: 16px; z-index: 20; }
.quick-box { background: #fff; border-radius: 24px; padding: 18px; width: 100%; max-width: 460px; text-align: center; }
.quick-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.quick-letter { font-family: var(--arabic); font-size: 150px; line-height: 1.1; color: var(--green); }
.quick-name { margin: 0 0 12px; font-size: 22px; }
.quick-rec { width: 100%; padding: 18px; border-radius: 18px; background: var(--pink); color: #fff; font-size: 24px; font-weight: 800; margin-bottom: 12px; }
.quick-rec.recording { background: #E0243F; animation: glow .8s infinite; }

/* ---------- Toast & confettis ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translate(-50%, 140%);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-size: 18px;
  transition: transform .3s ease, opacity .3s ease; z-index: 30; opacity: 0; pointer-events: none; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 25; }

/* ---------- Paysage (iPad / téléphone couché) ---------- */
@media (orientation: landscape) and (max-height: 600px) {
  .home-title { margin: 0 0 12px; }
  .home-letters { font-size: 48px; }
  .big-btn { min-height: 110px; }
  .week { margin-top: 14px; }
  .letter-big { font-size: min(44vh, 40vw); padding-bottom: 2vh; }
  .ctrl { min-height: 86px; }
  .choice { font-size: 64px; }
  .game-choices { max-width: 520px; }
  .game-listen { width: 100px; font-size: 48px; }
}
@media (min-width: 900px) and (orientation: landscape) {
  .letter-big { font-size: min(50vh, 40vw); }
}

@media (max-width: 560px) {
  .parent-list li { grid-template-columns: 48px 1fr; row-gap: 4px; }
  .parent-list .p-actions { grid-column: 2; }
}
.game-progress:empty { visibility: hidden; }

/* =================================================================== */
/* AVENTURE & MINI-JEUX                                                 */
/* =================================================================== */
.btn-treasure { background: #8A5CF6; }
.home-actions.three { grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.home-actions.three .big-btn { min-height: 118px; font-size: clamp(18px, 4vw, 28px); padding: 14px 6px; }
.home-actions.three .big-emoji { font-size: clamp(38px, 8vw, 60px); }
.adventure-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; max-width: 760px; margin: 0 auto;
  padding: 18px 20px; border-radius: 30px; color: #fff; text-align: left;
  background: linear-gradient(135deg, #0B6E55, #3DBE92); box-shadow: 0 8px 0 #07513F;
  animation: breathe 2.4s ease-in-out infinite;
}
.adventure-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #07513F; }
@keyframes breathe { 50% { transform: scale(1.025); } }
.adv-emoji { font-size: clamp(54px, 12vw, 80px); line-height: 1; }
.adv-text { flex: 1; display: flex; flex-direction: column; }
.adv-title { font-weight: 800; font-size: clamp(30px, 7vw, 46px); line-height: 1; }
.adv-sub { font-size: clamp(16px, 3.6vw, 22px); opacity: .9; }
.adv-go { font-size: 34px; background: rgba(255,255,255,.2); width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; }
.home-stickers { text-align: center; font-size: 30px; letter-spacing: 4px; margin-top: 10px; min-height: 8px; }

/* ---- Carte ---- */
.map-screen { background: linear-gradient(#DDF3FF, #FFF7E6 30%, #E7F7E3); }
.bar.sticky { position: sticky; top: calc(-14px - env(safe-area-inset-top)); z-index: 3; padding-top: 4px; background: inherit; }
.bar h2 small { font-size: 60%; color: var(--muted); }
.map { position: relative; width: 100%; max-width: 560px; margin: 0 auto; flex: none; }
.map-path { position: absolute; left: 0; top: 0; pointer-events: none; }
.map-path path { fill: none; stroke: #D9C9A3; stroke-width: 14; stroke-linecap: round; stroke-dasharray: 2 26; }
.node {
  position: absolute; transform: translate(-50%, -50%); width: 96px; height: 96px; border-radius: 50%;
  background: #fff; box-shadow: 0 7px 0 rgba(0,0,0,.15); display: grid; place-items: center;
  border: 5px solid var(--green-2);
}
.node:active { transform: translate(-50%, calc(-50% + 4px)); }
.node-label { font-family: var(--arabic); font-size: 30px; line-height: 1; color: var(--green); padding-bottom: 6px; max-width: 84px; text-align: center; }
.node.rev { border-color: var(--orange); }
.node.rev .node-label, .node.final .node-label { font-family: var(--round); font-size: 40px; }
.node.final { border-color: var(--yellow); width: 112px; height: 112px; }
.node.done { background: #F1FFF8; }
.node.locked { border-color: #D8D2C4; background: #F1EBDD; box-shadow: 0 7px 0 rgba(0,0,0,.08); }
.node.locked .node-label { font-family: var(--round); font-size: 34px; }
.node.later { opacity: .55; }
.node.current { animation: nodePulse 1.4s ease-in-out infinite; border-color: var(--pink); }
@keyframes nodePulse { 50% { box-shadow: 0 7px 0 rgba(0,0,0,.15), 0 0 0 12px rgba(255,92,138,.18); } }
.node-stars { position: absolute; bottom: -26px; left: 50%; transform: translateX(-50%); font-size: 16px; white-space: nowrap; }
.node-stars i { font-style: normal; color: #CFC5AF; }
.node-sticker { position: absolute; top: -12px; right: -14px; font-size: 32px; }
.map-owl { position: absolute; font-size: 44px; animation: hop 1.2s ease-in-out infinite; pointer-events: none; }
@keyframes hop { 50% { transform: translateY(-10px); } }
.map-deco { position: absolute; font-size: 34px; opacity: .8; pointer-events: none; }

/* ---- Écran de jeu ---- */
.play-screen { overflow: hidden; }
.play-dots { display: flex; justify-content: center; gap: 4px; flex-wrap: nowrap; }
.play-dots span { width: 34px; height: 34px; font-size: 16px !important; border-radius: 50%; background: #F1EBDD; display: grid; place-items: center; font-size: 20px; opacity: .5; }
.play-dots span.on { background: #C9F2DE; opacity: 1; }
.play-dots span.cur { background: #FFF1C2; opacity: 1; transform: scale(1.15); box-shadow: 0 3px 0 rgba(0,0,0,.1); }
.play-area { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.coach { display: flex; align-items: center; gap: 8px; max-width: 640px; width: 100%; text-align: left; }
.coach .owl { font-size: 46px; line-height: 1; flex: none; animation: hop 2s ease-in-out infinite; }
.coach .bubble { background: #fff; border-radius: 18px; padding: 10px 14px; font-size: clamp(17px, 3.8vw, 24px); box-shadow: 0 3px 0 rgba(0,0,0,.08); position: relative; }
.coach .bubble::before { content: ""; position: absolute; left: -8px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-right-color: #fff; border-left: 0; }
.mini-dots { display: flex; gap: 8px; justify-content: center; margin-top: auto; }
.mini-dots span { width: 14px; height: 14px; border-radius: 50%; background: #E6DCC6; }
.mini-dots span.on { background: var(--green-2); }
.mini-dots span.cur { background: var(--orange); transform: scale(1.3); }

/* Découverte */
.disc-letter { flex: 1; min-height: 0; font-family: var(--arabic); color: var(--green); font-size: min(38vh, 56vw); line-height: 1.05; padding-bottom: 3vh; }
.disc-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 700px; }
.disc-row .ctrl { min-height: 104px; }
.ctrl-next { background: var(--green); }
.ctrl.attention { animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-6px) scale(1.04); } }

/* Quiz dans le jeu */
.play-area .game-listen { margin-top: 1vh; }
.play-area .game-choices { margin-top: auto; margin-bottom: 6px; }

/* Trace */
.trace-wrap { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; }
.trace-canvas { background: #fff; border-radius: 28px; box-shadow: 0 6px 0 rgba(0,0,0,.1); touch-action: none; }
.trace-tools { display: flex; gap: 14px; }

/* Ballons */
.balloon-top { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 700px; gap: 10px; }
.wanted { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 22px; padding: 4px 16px; box-shadow: var(--shadow); }
.wanted .w-letter { font-family: var(--arabic); font-size: 58px; line-height: 1.1; color: var(--green); padding-bottom: 6px; }
.wanted .w-sound { font-size: 30px; }
.wanted .w-sound.big { font-size: 46px; padding: 6px 4px; }
.wanted.playing { animation: glow 1s infinite; }
.balloon-score { font-size: 30px; letter-spacing: 2px; }
.balloon-score span { filter: grayscale(1); opacity: .3; }
.balloon-score span.on { filter: none; opacity: 1; }
.sky { position: relative; flex: 1; width: 100%; border-radius: 26px; overflow: hidden; touch-action: none;
  background: linear-gradient(#8FD3FF, #D8F1FF); box-shadow: inset 0 -30px 40px rgba(255,255,255,.6); }
.balloon {
  position: absolute; left: 0; top: 0; border-radius: 50% 50% 48% 48%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.55), transparent 30%), var(--c);
  box-shadow: inset -8px -10px 0 rgba(0,0,0,.12); display: grid; place-items: center;
  font-family: var(--arabic); color: #fff; font-size: 48px; line-height: 1; will-change: transform; text-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.balloon span { padding-bottom: 10px; }
.balloon::after { content: ""; position: absolute; bottom: -26px; left: 50%; width: 2px; height: 26px; background: rgba(0,0,0,.25); }
.balloon.pop { animation: pop-b .3s forwards; }
@keyframes pop-b { to { opacity: 0; scale: 1.6; } }
.balloon.wobble { animation: shake .4s; }

/* Memory */
.memory { flex: 1; display: grid; gap: 12px; width: 100%; max-width: 640px; align-content: center; }
.memory.n6 { grid-template-columns: repeat(3, 1fr); }
.memory.n8 { grid-template-columns: repeat(4, 1fr); }
.mcard { position: relative; aspect-ratio: 3/4; border-radius: 18px; perspective: 600px; }
.mcard span { position: absolute; inset: 0; border-radius: 18px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .35s; box-shadow: 0 5px 0 rgba(0,0,0,.12); }
.mcard .back { background: repeating-linear-gradient(45deg, #FF8A3D, #FF8A3D 12px, #FFA35F 12px, #FFA35F 24px); font-size: 36px; }
.mcard .front { background: #fff; transform: rotateY(180deg); font-family: var(--arabic); font-size: clamp(48px, 11vw, 84px); color: var(--ink); padding-bottom: 8px; }
.mcard.flip .back { transform: rotateY(180deg); }
.mcard.flip .front { transform: rotateY(360deg); }
.mcard.match .front { background: #C9F2DE; color: var(--green); }

/* Oui / non */
.tf-letter { flex: 1; min-height: 0; font-family: var(--arabic); font-size: min(34vh, 50vw); line-height: 1.05; color: var(--blue); display: grid; place-items: center; padding-bottom: 3vh; transition: color .2s; }
.tf-letter.ok { color: var(--green); animation: pulse .5s; }
.tf-letter.ko { color: #E0243F; animation: shake .4s; }
.tf-sound { width: 80px; height: 80px; font-size: 38px; }
.tf-sound.playing { animation: glow 1s infinite; }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 600px; }
.tf-btn { border-radius: 26px; min-height: 110px; font-size: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-weight: 800; box-shadow: 0 8px 0 rgba(0,0,0,.18); }
.tf-btn span { font-size: 24px; }
.tf-btn.yes { background: var(--green-2); }
.tf-btn.no { background: var(--pink); }
.tf-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }

/* Bravo entre deux jeux */
.cheer { position: fixed; inset: 0; display: grid; place-items: center; z-index: 22; background: rgba(255,247,230,.7); }
.cheer-box { background: #fff; border-radius: 30px; padding: 24px 34px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 0 rgba(0,0,0,.12); animation: popIn .4s cubic-bezier(.2,1.6,.4,1); }
.cheer-owl { font-size: 64px; }
.cheer-text { font-size: 44px; font-weight: 800; color: var(--green); }
@keyframes popIn { from { transform: scale(.3); opacity: 0; } }

/* Récompense */
.reward-screen { align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #FFF1C2, var(--bg) 60%); }
.reward-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.reward-sticker { font-size: clamp(120px, 34vw, 200px); line-height: 1.1; }
.reward-sticker.reveal { animation: reveal 1.2s cubic-bezier(.2,1.5,.4,1); }
.reward-sticker.bounce { animation: pulse 1s ease infinite; }
@keyframes reveal { 0% { transform: scale(0) rotate(-40deg); } 60% { transform: scale(1.25) rotate(10deg); } }
.reward-box h3 { margin: 0; font-size: 52px; color: var(--green); font-weight: 800; }
.reward-stars { font-size: 56px; display: flex; gap: 8px; }
.reward-stars span { filter: grayscale(1); opacity: .25; }
.reward-stars span.on { filter: none; opacity: 1; animation: popIn .5s backwards; }
.reward-msg { font-size: clamp(20px, 4.5vw, 28px); color: var(--muted); margin: 6px 0 16px; max-width: 520px; }

/* Trésors */
.treasure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; max-width: 640px; width: 100%; margin: 10px auto; }
.treasure { aspect-ratio: 1; border-radius: 24px; background: #F1EBDD; font-size: 56px; display: grid; place-items: center; }
.treasure span { opacity: .35; }
.treasure.got { background: #fff; box-shadow: var(--shadow); }
.treasure.got span { opacity: 1; }
.treasure.bounce { animation: pulse .6s; }

/* Jeux libres */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; max-width: 760px; width: 100%; margin: 6px auto; }
.game-tile { border-radius: 26px; min-height: 150px; color: #fff; font-weight: 800; font-size: clamp(18px, 4vw, 24px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 8px 0 rgba(0,0,0,.18); padding: 10px; }
.game-tile span { font-size: 58px; line-height: 1; }
.game-tile:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.game-tile.c1 { background: var(--blue); } .game-tile.c2 { background: var(--pink); } .game-tile.c3 { background: var(--orange); }
.game-tile.c4 { background: var(--green-2); } .game-tile.c5 { background: #8A5CF6; }

.p-check { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 16px; margin-bottom: 12px; }

@media (orientation: landscape) and (max-height: 600px) {
  .disc-letter { font-size: 34vh; }
  .disc-row .ctrl, .tf-btn { min-height: 80px; }
  .coach .owl { font-size: 34px; }
  .memory { max-width: 520px; }
  .memory.n8 { grid-template-columns: repeat(8, 1fr); }
  .memory.n6 { grid-template-columns: repeat(6, 1fr); }
}
