/* Vision 10 · charte d'après le logo Inspirvia : fond ardoise, argent métallique, accent bleu.
   Une colonne mobile, terrain en héros de l'écran de jeu. Commun à l'appli joueur et à l'espace parent. */
:root {
  --bg: #0F1215; --panel: #171B1F; --panel-2: #1F252A; --anthracite: #3B4144;
  --silver-1: #888890; --silver-2: #C8C8C8; --silver: linear-gradient(135deg, #C8C8C8 0%, #9a9aa2 45%, #e4e4e6 70%, #888890 100%);
  --blue-1: #205090; --blue-2: #50C0E8; --blue: linear-gradient(90deg, #205090, #2f7fc4 55%, #50C0E8);
  --blue-soft: rgba(80, 192, 232, .12);
  --ink: #E6E8EA; --muted: #9AA1A7; --line: rgba(200, 200, 200, .16); --line-2: rgba(200, 200, 200, .3);
  --ok: #5CC39A; --ko: #E07A6B;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--ink); margin: 0; }
body {
  font-family: var(--body); font-weight: 300; line-height: 1.55; font-size: 15px;
  padding: max(18px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(40px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
  background: radial-gradient(120% 60% at 50% -10%, #1a222a 0%, var(--bg) 60%) fixed;
}
.app { max-width: 720px; margin: 0 auto; display: grid; gap: 22px; }
.screen { display: grid; gap: 20px; }
.eyebrow { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--silver-2); margin: 0; }
h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.6rem, 11vw, 3.6rem); line-height: 1; margin: 6px 0 0; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 600; font-size: 1.6rem; line-height: 1.15; margin: 0 0 6px; text-wrap: balance; }
h3 { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-2); font-weight: 500; margin: 0 0 4px; }
p { margin: 0; }
a { color: var(--blue-2); }
.muted { color: var(--muted); }
.lede { color: var(--muted); max-width: 46ch; margin-top: 10px; }
.silver-text { background: var(--silver); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Marque */
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: auto; flex: none; }
.logo-full { width: 173px; height: auto; display: block; }
.wordmark { font-weight: 500; letter-spacing: .26em; font-size: .78rem; color: var(--silver-2); }
.wordmark i { display: inline-block; width: 3px; height: .95em; margin-left: .45em; vertical-align: -1px; background: linear-gradient(180deg, var(--blue-2), var(--blue-1)); }

/* Boutons */
.btn { font: inherit; font-weight: 500; background: var(--blue); color: #fff; border: 0; padding: 13px 22px; border-radius: 6px; cursor: pointer; min-height: 48px; box-shadow: 0 6px 20px rgba(32, 80, 144, .35); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); box-shadow: none; }
.btn.silver { background: var(--silver); color: #15191c; box-shadow: none; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.link { font: inherit; background: none; border: 0; color: var(--blue-2); cursor: pointer; padding: 10px 0; min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; }
.icon-btn { font: inherit; background: var(--panel); color: var(--silver-2); border: 1px solid var(--line); border-radius: 999px; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--blue-2); outline-offset: 2px; }

/* Formulaires */
.form { display: grid; gap: 10px; }
.form label { font-size: .85rem; color: var(--muted); }
.input, select.input { font: inherit; font-size: 1.05rem; background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; padding: 12px 14px; min-height: 48px; width: 100%; }
.input.code { letter-spacing: .12em; text-transform: uppercase; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: .88rem; color: var(--muted); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--blue-2); }
.err { color: var(--ko); min-height: 1.4em; font-size: .9rem; }

/* Cartes */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 10px; }
/* Le bouton PayPal arrive dans un cadre clair, avec une mention en texte sombre : un fond blanc franc plutôt qu'un rectangle blanc découpé */
#plusPaypal:not(:empty) { background: #fff; border-radius: 10px; padding: 12px 12px 4px; }
.card.feature { background: linear-gradient(160deg, #1c242b 0%, var(--panel) 60%); border-color: rgba(80, 192, 232, .28); }
.card.quiet { background: transparent; }
.card .row { display: flex; gap: 10px; flex-wrap: wrap; }
.close { position: absolute; right: 8px; top: 8px; }
.promo { position: relative; padding-right: 52px; }
.promo p { color: var(--muted); font-size: .9rem; }

/* Bienvenue */
.welcome { min-height: 78vh; align-content: center; }
.welcome .form { margin-top: 18px; max-width: 380px; }
.fine { font-size: .82rem; color: var(--muted); max-width: 46ch; }

/* Accueil */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.who { font-family: var(--display); font-size: 1.35rem; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.stat b { font-family: var(--display); font-size: 1.8rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: .74rem; color: var(--muted); }
.dots { display: flex; gap: 5px; margin-top: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.dots i.on { background: var(--blue-2); box-shadow: 0 0 8px rgba(80, 192, 232, .6); }
.today-list { display: flex; flex-wrap: wrap; gap: 6px; }
.today-list span { font-size: .78rem; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--muted); }
.today-list span.done { border-color: var(--ok); color: var(--ok); }
.focus { font-size: .88rem; color: var(--muted); }
.focus b { color: var(--blue-2); font-weight: 500; }

.block { display: grid; gap: 12px; }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.pillar { min-width: 0; border-top: 1px solid var(--silver-1); padding-top: 10px; }
.pillar p { color: var(--muted); font-size: .9rem; }
.pillar span { font-size: .78rem; color: var(--silver-2); }

.levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.lvl { font: inherit; display: grid; gap: 2px; justify-items: center; text-align: center; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 10px 4px; cursor: pointer; min-width: 0; min-height: 44px; }
.lvl[aria-selected="true"] { border-color: var(--blue-2); background: var(--blue-soft); }
.lvl[data-locked] { opacity: .55; }
.lvln { font-family: var(--display); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.lvlname { font-size: .72rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lvlst { font-size: .66rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lvlinfo { display: grid; gap: 6px; }
.prog { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--blue); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip { font: inherit; font-size: .8rem; white-space: nowrap; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 44px; }
.chip[aria-pressed="true"] { background: var(--silver); color: #15191c; border-color: transparent; }
.exos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.exo { font: inherit; text-align: left; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; min-width: 0; min-height: 56px; }
.exo:disabled { opacity: .45; cursor: default; }
.exo.locked { opacity: .7; border-style: dashed; }
.exo .num { font-family: var(--display); font-size: 1.3rem; font-variant-numeric: tabular-nums; width: 2.2ch; color: var(--silver-2); }
.exo .nm { display: grid; min-width: 0; }
.exo .nm b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exo .nm small { color: var(--muted); font-size: .76rem; }
.stars { letter-spacing: 2px; color: var(--line-2); font-size: .9rem; white-space: nowrap; }
.stars .on { color: var(--blue-2); }
.lock { font-size: .9rem; color: var(--silver-2); }

.code-box { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.15rem; letter-spacing: .1em; background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 6px; padding: 10px 12px; text-align: center; user-select: all; }
.status { font-size: .86rem; color: var(--muted); min-height: 1.3em; }
.status[data-tone="ok"] { color: var(--ok); }

/* Exercice */
.ex-head { display: grid; gap: 6px; }
.ex-title { font-size: 2rem; margin: 0; }
.brief { max-width: 60ch; }
.field { font-size: .88rem; color: var(--muted); }
.field span:first-child { color: var(--blue-2); text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; margin-right: 4px; }
.stage { position: relative; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #1A2025; }
canvas { display: block; width: 100%; touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.say { z-index: 2; position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: calc(100% - 24px); text-align: center; background: rgba(15, 18, 21, .86); border: 1px solid var(--line-2); color: var(--ink); padding: 6px 14px; border-radius: 999px; font-size: .92rem; pointer-events: none; }
.say[data-tone="ok"] { border-color: var(--ok); color: var(--ok); }
.say[data-tone="ko"] { border-color: var(--ko); color: var(--ko); }
.tbar-wrap { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: -12px; }
.tbar { height: 100%; width: 0; background: var(--blue); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; }
.choice { font: inherit; font-weight: 500; flex: 1 1 0; min-width: 64px; min-height: 52px; background: var(--panel); color: var(--ink); border: 1px solid var(--blue-2); border-radius: 8px; cursor: pointer; font-size: 1rem; }
.choice:active { background: var(--blue-2); color: var(--bg); }
.hud { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hud b { color: var(--ink); font-weight: 500; }
.result { border: 1px solid rgba(80, 192, 232, .4); border-radius: 10px; padding: 18px; display: grid; gap: 8px; text-align: center; background: var(--blue-soft); }
.rstars { font-size: 2rem; letter-spacing: 6px; color: var(--line-2); }
.rstars .on { color: var(--blue-2); }
.result .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.recap { display: grid; gap: 4px; text-align: left; font-size: .88rem; }
.recap > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.recap .prog { flex: 0 0 50%; }

/* Pied de page */
.foot { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.note { font-size: .78rem; color: var(--muted); }
.beta-ribbon { position: fixed; top: env(safe-area-inset-top, 0px); right: 0; z-index: 50; background: var(--blue); color: #fff; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; padding: 4px 10px; border-bottom-left-radius: 6px; }
.toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--panel-2); border: 1px solid var(--blue-2); color: var(--ink); padding: 10px 16px; border-radius: 8px; max-width: calc(100% - 32px); font-size: .9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }

/* Onglets */
.tab { display: grid; gap: 20px; }
body.with-tabs { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(15, 18, 21, .96); border-top: 1px solid var(--line-2); padding: 4px 4px max(4px, env(safe-area-inset-bottom, 0px)); backdrop-filter: blur(8px); }
.tabbar button { font: inherit; font-size: .68rem; background: none; border: 0; color: var(--muted); min-height: 54px; display: grid; gap: 1px; justify-items: center; align-content: center; cursor: pointer; }
.tabbar .ti { font-size: 1.15rem; line-height: 1.2; }
.tabbar [aria-current="true"] { color: var(--blue-2); }
.hero { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.hero-card { font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%; }
.hero { touch-action: auto; cursor: inherit; background: #0B1016; }
.hero-card .hero { border: 0; border-radius: 6px; }

/* Exercice en cours : tout tient à l'écran, sans défiler */
body.in-play { padding-top: max(8px, env(safe-area-inset-top, 0px)); padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
body.in-play .app, body.in-play .screen { gap: 8px; }
body.in-play .ex-head, body.in-play .foot { display: none; }
body.in-play .tbar-wrap { margin-top: 0; }
.stage-demo { position: absolute; inset: 0; height: 100%; z-index: 1; touch-action: auto; cursor: default; }
.stage-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0D1013; }
.is-recap #pStage, .is-recap #pBar, .is-recap #choices, .is-recap #pHud, .is-recap #startEx, .is-recap .field { display: none; }

/* Visualisation */
.breath-wrap { position: relative; height: clamp(230px, 38vh, 340px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0B1016; }
.breath-wrap canvas { width: 100%; height: 100%; touch-action: auto; cursor: default; }
.breath { position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; background: radial-gradient(circle, rgba(80, 192, 232, .34), rgba(80, 192, 232, .05) 70%); border: 1px solid rgba(80, 192, 232, .55); pointer-events: none; }
.breath.breathing { animation: breath 10s ease-in-out infinite; }
@keyframes breath { 0%, 100% { transform: scale(.75); } 50% { transform: scale(1.7); } }
.visu-text { font-family: var(--display); font-size: 1.45rem; line-height: 1.25; text-align: center; min-height: 5.2em; display: grid; place-items: center; }

/* Corps */
.clip-wrap canvas { height: 44vh; width: auto; max-width: 100%; margin: 0 auto; aspect-ratio: 3 / 4; border-radius: 10px; border: 1px solid var(--line); background: #0B1016; touch-action: auto; cursor: default; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink); }
.drill-stage { position: relative; min-height: calc(100vh - 110px); border-radius: 12px; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; background: var(--panel); border: 1px solid var(--line); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.d-big { font-family: var(--display); font-size: min(38vw, 11rem); line-height: 1; font-weight: 600; }
.d-arrow { font-size: min(52vw, 16rem); line-height: 1; color: var(--blue-2); }
.d-word { font-size: min(10vw, 3.2rem); font-weight: 500; line-height: 1.1; padding: 0 12px; }
.d-small { font-size: 1.05rem; color: var(--muted); padding: 0 16px; }
.drill-stage.green { background: #1f8a5b; color: #fff; }
.drill-stage.red { background: #b5382c; color: #fff; }
.drill-stage.go { background: var(--blue-1); color: #fff; }
.drill-stage.beat { background: var(--panel-2); }
.drill-stage.beat.alt { background: rgba(32, 80, 144, .55); }
.d-target { position: absolute; top: 50%; width: 42vw; height: 42vw; max-width: 220px; max-height: 220px; border-radius: 50%; background: var(--blue-2); transform: translate(-50%, -50%); }
.d-target.c { left: 50%; } .d-target.l { left: 28%; } .d-target.r { left: 72%; }
.d-target.nogo { background: var(--ko); }
.d-dot { position: absolute; top: 45%; left: 50%; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; background: var(--silver-2); }
.d-dot.on { background: var(--blue-2); box-shadow: 0 0 30px var(--blue-2); }

/* Training : leçon animée, légende mot à mot */
.l-stage { position: relative; height: min(64vh, 118vw, 640px); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0B1016; }
.l-stage canvas { width: 100%; height: 100%; cursor: default; touch-action: manipulation; }
.l-cap { position: absolute; left: 14px; right: 14px; top: 12px; z-index: 2; font-weight: 600; font-size: clamp(1.25rem, 6.2vw, 2rem); line-height: 1.12; text-transform: uppercase; letter-spacing: .01em; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .75); pointer-events: none; text-wrap: balance; }
.l-cap span { display: inline-block; animation: wordIn .3s ease-out both; animation-delay: calc(var(--i) * 70ms); }
.l-cap .on { color: var(--blue-2); }
@keyframes wordIn { from { opacity: 0; transform: translateY(.45em); } }
.l-segs { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 2; display: flex; gap: 4px; pointer-events: none; }
.l-segs i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.l-segs u { display: block; height: 100%; width: 0; background: var(--blue-2); text-decoration: none; }
.l-tap { position: absolute; top: 0; bottom: 0; width: 34%; z-index: 3; background: none; border: 0; cursor: pointer; }
.l-tap.l { left: 0; } .l-tap.r { right: 0; }
.l-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.l-ctrl .ex-title { font-size: 1.6rem; }
.l-ctrl .btn { flex: none; }
.l-rate { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.l-rate .chip { padding: 8px 0; text-align: center; font-size: .95rem; }

@media (prefers-reduced-motion: reduce) { *:not(.tbar) { transition: none !important; animation: none !important; } .breath { transform: scale(1.1); } }
