/* ===== Design system — Daymavi ===== */
:root {
  --bg: #fff8f0; --surface: #ffffff; --ink: #2a2540; --muted: #686285; --line: #eadfd3;
  --primary: #5b4bd6; --on-primary: #ffffff; --primary-soft: #eceaff; --primary-dark: #4637b8;
  --accent: #ff8a5b; --gold: #f6b73c; --ok: #1a8f64; --ok-soft: #dff5ea; --warn: #b3541c; --danger: #c0392f;
  --shadow: 0 6px 20px rgba(60, 40, 120, .09); --shadow-sm: 0 2px 8px rgba(60, 40, 120, .07);
  --r: 20px; --r-sm: 14px; --nav-h: 68px;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="lagune"] { --bg: #effafa; --primary: #0e7c86; --primary-dark: #0a626b; --primary-soft: #d9f1f2; --line: #cfe7e8; --accent: #ff9f6b; --ink: #12313a; --muted: #4c6770; }
:root[data-theme="foret"] { --bg: #f3f8ef; --primary: #2d7a4d; --primary-dark: #22613c; --primary-soft: #dcefdf; --line: #d9e6d2; --accent: #e8a33d; --ink: #1f3326; --muted: #566a5c; }
:root[data-theme="crepuscule"] { --bg: #16132b; --surface: #231f3f; --ink: #f2efff; --muted: #b5aed9; --line: #38325f; --primary: #a99bff; --on-primary: #1a1540; --primary-dark: #c3b9ff; --primary-soft: #312b5c; --ok: #5fd6a4; --ok-soft: #1f3b3a; --shadow: 0 6px 20px rgba(0,0,0,.35); --shadow-sm: 0 2px 8px rgba(0,0,0,.3); --warn: #ffb27e; --danger: #ff8d82; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; min-height: 100dvh; }
.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 0 0 10px 0; z-index: 999; }
.skip:focus { left: 0; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.8rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .center { text-align: center; }
a { color: var(--primary-dark); }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
button { font: inherit; color: inherit; }

/* ===== Layout ===== */
.page { max-width: 560px; margin: 0 auto; padding: 18px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }
.page.immersive { padding-bottom: 32px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); }
.card.flat { box-shadow: none; }
.card.tap { cursor: pointer; transition: transform .15s, box-shadow .15s; text-align: left; width: 100%; display: block; }
.card.tap:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card.tap:active { transform: scale(.985); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 0 10px; }
.section-title h2 { margin: 0; }
.link-btn { background: none; border: 0; color: var(--primary-dark); font-weight: 700; cursor: pointer; padding: 6px; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid transparent; border-radius: 16px; padding: 13px 22px; font-weight: 800; font-size: 1rem; cursor: pointer; background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 0 var(--primary-dark); transition: transform .12s, box-shadow .12s, opacity .2s; min-height: 48px; text-decoration: none; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--primary-dark); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.soft { background: var(--primary-soft); color: var(--primary-dark); box-shadow: none; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--danger); box-shadow: none; }
.btn.accent { background: var(--accent); color: #2a1408; box-shadow: 0 4px 0 #d66a3c; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: .9rem; border-radius: 12px; box-shadow: none; }
.icon-btn { background: none; border: 0; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 1.3rem; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--primary-soft); }

/* ===== Chips, progress ===== */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-dark); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: #fdeccb; color: var(--warn); } .chip.demo { background: #fff0d6; color: #8a5a00; border: 1px dashed #d9a441; }
:root[data-theme="crepuscule"] .chip.warn, :root[data-theme="crepuscule"] .chip.demo { background: #3d3050; color: #ffd08a; }
.bar { height: 12px; background: var(--primary-soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .9s cubic-bezier(.22, 1, .36, 1); }
.bar.thin { height: 8px; }
.dot-progress { display: flex; gap: 5px; } .dot-progress i { flex: 1; height: 6px; border-radius: 9px; background: var(--primary-soft); transition: background .3s; } .dot-progress i.on { background: var(--primary); }

/* ===== Orb (avatar de niveau) ===== */
.orb { position: relative; display: inline-grid; place-items: center; }
.orb svg { display: block; }
.orb .num { position: absolute; font-weight: 900; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.25); }
.orb.pop { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }

/* ===== Hero / landing ===== */
.hero { text-align: center; padding: 28px 8px 8px; }
.hero h1 { font-size: 2.2rem; margin-top: 16px; }
.hero .promise { font-size: 1.15rem; color: var(--muted); margin: 8px auto 22px; max-width: 28ch; }
.feature-list { display: grid; gap: 10px; margin: 24px 0; }
.feature { display: flex; gap: 12px; align-items: flex-start; } .feature .ico { font-size: 1.6rem; }
.notice { background: #fff7e0; border: 1px dashed #d9a441; color: #6b4a00; border-radius: var(--r-sm); padding: 10px 12px; font-size: .88rem; }
:root[data-theme="crepuscule"] .notice { background: #35293f; color: #ffd9a0; }
.field { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font: inherit; background: var(--surface); color: var(--ink); }
.field:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.field { min-height: 92px; resize: vertical; }
label.lbl { display: block; font-weight: 700; margin-bottom: 6px; }

/* ===== Onboarding / choices ===== */
.q-title { font-size: 1.5rem; margin: 18px 0 6px; } .q-sub { color: var(--muted); margin-bottom: 18px; }
.choices { display: grid; gap: 10px; }
.choices.two { grid-template-columns: 1fr 1fr; } .choices.three { grid-template-columns: repeat(3, 1fr); }
.choice { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 14px; cursor: pointer; text-align: left; transition: border-color .15s, transform .15s, background .15s; width: 100%; }
.choice:hover { border-color: var(--primary); transform: translateY(-1px); }
.choice[aria-checked="true"], .choice.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.choice .e { font-size: 1.7rem; width: 40px; text-align: center; flex: none; }
.choice b { display: block; } .choice small { color: var(--muted); display: block; }
.choice.col { flex-direction: column; text-align: center; padding: 14px 6px; gap: 4px; } .choice.col .e { width: auto; }
.keycap { margin-left: auto; font-size: .72rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.fade-in { animation: fadeUp .35s ease both; }
.scale5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; } .scale5 .choice { justify-content: center; padding: 10px 0; font-weight: 800; }
.scale-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 4px; }
.bilan-q { padding: 14px 0; border-bottom: 1px solid var(--line); } .bilan-q:last-child { border: 0; }

/* ===== Dashboard ===== */
.top { display: flex; align-items: center; gap: 14px; }
.greet h1 { font-size: 1.45rem; margin: 0; } .greet p { margin: 2px 0 0; color: var(--muted); }
.level-card { display: flex; gap: 14px; align-items: center; }
.session-card { background: linear-gradient(135deg, var(--primary), #8a5bd6 70%, var(--accent)); color: #fff; border: 0; position: relative; overflow: hidden; }
:root[data-theme="crepuscule"] .session-card { background: linear-gradient(135deg, #5a4cc8, #8a5bd6 70%, #d6735a); }
.session-card h2, .session-card p { color: #fff; } .session-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.12); }
.session-card .btn { background: #fff; color: #3b2fa0; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.mission-card { display: flex; gap: 12px; align-items: center; }
.skill-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; flex: none; background: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.diff { letter-spacing: 2px; color: var(--gold); font-size: .8rem; }
.skill-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; margin: 10px 0; }
.skill-row .bar > i { background: var(--c); }
.badge-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.badge-mini { flex: none; width: 64px; text-align: center; font-size: .72rem; font-weight: 700; }
.badge-mini .b { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; margin: 0 auto 4px; background: var(--primary-soft); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 14px 10px; } .badge .b { font-size: 2.2rem; } .badge.locked { opacity: .55; } .badge.locked .b { filter: grayscale(1); }
.timeline-day { margin-top: 16px; } .timeline-day h3 { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; display: flex; justify-content: space-between; }
.ev { display: flex; gap: 10px; padding: 8px 0; align-items: center; border-bottom: 1px dashed var(--line); } .ev .xp { margin-left: auto; font-weight: 800; color: var(--ok); white-space: nowrap; }

/* ===== Nav ===== */
.nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.nav-inner { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 560px; height: var(--nav-h); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; font-weight: 700; color: var(--muted); text-decoration: none; position: relative; }
.nav a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a[aria-current="page"] { color: var(--primary-dark); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 30px; height: 3px; border-radius: 0 0 4px 4px; background: var(--primary); }
.nav a.fab span.bubble { width: 52px; height: 52px; border-radius: 50%; margin-top: -22px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); box-shadow: 0 4px 0 var(--primary-dark), var(--shadow); }
.nav a.fab { color: var(--primary-dark); } .nav a.fab[aria-current="page"]::before { display: none; }

/* ===== Mission player ===== */
.player-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; } .player-top .dot-progress { flex: 1; }
.prompt { font-size: 1.35rem; font-weight: 800; margin: 14px 0 12px; }
.situation { background: var(--primary-soft); border-radius: var(--r-sm); padding: 14px; font-weight: 700; margin-bottom: 14px; }
.feedback { margin-top: 12px; padding: 12px 14px; background: var(--ok-soft); border-radius: var(--r-sm); color: var(--ink); animation: fadeUp .3s ease both; }
.list-inputs { display: grid; gap: 8px; } .list-inputs .n { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-weight: 800; flex: none; font-size: .85rem; }
.footer-cta { position: sticky; bottom: 0; padding: 14px 0 6px; background: linear-gradient(transparent, var(--bg) 35%); margin-top: 20px; }
.timer { text-align: center; padding: 10px 0; } .timer .t { font-size: 3rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.ring { transform: rotate(-90deg); } .ring circle { fill: none; stroke-width: 10; stroke-linecap: round; } .ring .bg { stroke: var(--primary-soft); } .ring .fg { stroke: var(--primary); transition: stroke-dashoffset .5s linear; }
.confirm-box { display: flex; gap: 14px; align-items: center; width: 100%; background: var(--surface); border: 2px dashed var(--primary); border-radius: 18px; padding: 18px; cursor: pointer; text-align: left; font-weight: 800; }
.confirm-box .tick { width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--primary); display: grid; place-items: center; color: transparent; flex: none; transition: all .2s; }
.confirm-box[aria-checked="true"] { border-style: solid; background: var(--ok-soft); } .confirm-box[aria-checked="true"] .tick { background: var(--ok); border-color: var(--ok); color: #fff; transform: scale(1.1); }
.mission-intro .meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 18px; }

/* ===== Reward ===== */
.reward { text-align: center; padding-top: 24px; }
.check-burst { width: 110px; height: 110px; margin: 0 auto; border-radius: 50%; background: var(--ok); display: grid; place-items: center; animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); box-shadow: 0 0 0 0 rgba(30,160,110,.5), 0 10px 30px rgba(30,160,110,.35); }
.check-burst svg { width: 60px; height: 60px; stroke: #fff; stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .5s .25s ease forwards; }
.xp-big { font-size: 3rem; font-weight: 900; color: var(--primary-dark); animation: floatUp .8s ease both; font-variant-numeric: tabular-nums; }
.xp-big.zero { color: var(--muted); font-size: 1.4rem; }
.rate-row { display: flex; gap: 10px; justify-content: center; }
.rate-row .choice { width: auto; flex-direction: column; text-align: center; padding: 10px 16px; }
.session-ring { margin: 10px auto; }

/* ===== Modal / toast / confetti ===== */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(30, 20, 60, .55); display: grid; place-items: center; padding: 20px; animation: fade .2s ease both; }
.modal { background: var(--surface); border-radius: 26px; max-width: 420px; width: 100%; padding: 26px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: pop .5s cubic-bezier(.3, 1.4, .5, 1) both; max-height: 90dvh; overflow: auto; }
.modal.left { text-align: left; }
.modal .big-emoji { font-size: 4rem; display: block; animation: wiggle 1s .3s ease; }
.toasts { position: fixed; z-index: 60; left: 0; right: 0; top: 14px; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-weight: 700; box-shadow: var(--shadow); animation: fadeDown .3s ease both; max-width: 420px; }
.toast.err { background: var(--danger); color: #fff; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* ===== Chart ===== */
.chart { width: 100%; height: auto; display: block; } .chart .grid { stroke: var(--line); stroke-width: 1; } .chart .ln { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; } .chart .area { fill: var(--primary); opacity: .1; } .chart .pt { fill: var(--surface); stroke: var(--primary); stroke-width: 3; } .chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; } table.t th, table.t td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--line); } table.t td.n { text-align: center; font-weight: 700; }
.avatars { display: flex; } .avatars span { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); border: 2px solid var(--surface); display: grid; place-items: center; margin-left: -8px; font-size: .95rem; } .avatars span:first-child { margin-left: 0; }
.member { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .member .av { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; font-size: 1.3rem; }
.seg { display: grid; grid-auto-flow: column; background: var(--primary-soft); border-radius: 14px; padding: 4px; gap: 4px; } .seg button { border: 0; background: none; padding: 9px; border-radius: 11px; font-weight: 800; cursor: pointer; color: var(--primary-dark); } .seg button[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow-sm); }
.theme-swatch { display: flex; align-items: center; gap: 10px; }

/* ===== Animations ===== */
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes floatUp { from { opacity: 0; transform: translateY(24px) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-10deg) scale(1.1); } 75% { transform: rotate(10deg) scale(1.1); } }
@keyframes glow { 0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.5); } 50% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } }
.pulse { animation: glow 2.4s infinite; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
html.calm *, html.calm *::before, html.calm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
html.calm .check-burst svg { stroke-dashoffset: 0; }
@media (min-width: 700px) { .page { padding-top: 32px; } }

/* programmes */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details.card summary { cursor: pointer; }
.row.wrap { flex-wrap: wrap; }

/* ===== Programme : résultat concret, état d'une échéance, carnet minimal ===== */
.info-text { white-space: pre-line; font-weight: 700; }
.when-date { margin-top: 12px; } .when-date .lbl { display: block; margin-bottom: 6px; font-weight: 700; }
.two-btn { display: grid; gap: 10px; }
.xp-chip { font-size: .95rem; }
.result-card { padding: 20px 18px; border-width: 2px; }
.result-card.tone-done, .result-card.tone-closed, .result-card.tone-cue { border-color: var(--ok); }
.result-card.tone-planned, .result-card.tone-started, .result-card.tone-clarified, .result-card.tone-method { border-color: var(--primary); }
.result-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; } .result-head h1 { margin: 0; font-size: 1.5rem; }
.result-ico { font-size: 2rem; line-height: 1; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.result-lines p { margin: 0 0 4px; font-size: 1.05rem; overflow-wrap: anywhere; }
.result-caveat { margin: 10px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--ink); font-size: .92rem; }
.result-next { margin: 10px 0 0; color: var(--muted); font-size: .92rem; }
.ladder { margin-top: 14px; }
.ladder-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ladder-step { text-align: center; font-size: .7rem; color: var(--muted); position: relative; padding-top: 18px; }
.ladder-step i { position: absolute; top: 0; left: 0; right: 0; height: 8px; border-radius: 9px; background: var(--primary-soft); }
.ladder-step.on i { background: var(--primary); } .ladder-step.on { color: var(--ink); } .ladder-step.cur { font-weight: 800; }
.ladder-cue { margin-top: 8px; font-size: .85rem; color: var(--muted); } .ladder-cue.ok { color: var(--ok); font-weight: 700; }
.carnet-item { padding: 10px 0; border-top: 1px solid var(--line); } .carnet-item:first-of-type { border-top: 0; }
.carnet-item .cue-ok { color: var(--ok); font-weight: 700; }
.chip.state-done, .chip.state-closed { background: var(--ok-soft); color: var(--ok); }
.chip.state-spotted { background: var(--primary-soft); color: var(--primary-dark); }
