:root {
  --bg: #0a0a12;
  --panel: rgba(255, 255, 255, .06);
  --panel2: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .12);
  --text: #f4f4fb;
  --muted: #9a9ab5;
  --a: #22d3ee;
  --b: #f472b6;
  --ok: #4ade80;
  --bad: #fb7185;
  --gold: #facc15;
  --lime: #a3e635;
  --violet: #a78bfa;
  --r: 22px;
  --font: 'Bricolage Grotesque', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }

.blobs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blobs i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .22; animation: drift 22s ease-in-out infinite alternate; }
.blobs i:nth-child(1) { background: var(--a); top: -25vmax; left: -20vmax; }
.blobs i:nth-child(2) { background: var(--b); bottom: -30vmax; right: -25vmax; animation-delay: -7s; }
.blobs i:nth-child(3) { background: var(--violet); top: 30%; left: 40%; width: 35vmax; height: 35vmax; opacity: .12; animation-delay: -12s; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

#app { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; }
@media (min-width: 600px) {
  #app { height: min(100dvh, 920px); margin-top: max(0px, calc((100dvh - 920px) / 2)); border-left: 1px solid var(--line); border-right: 1px solid var(--line); box-shadow: 0 0 80px rgba(0,0,0,.6); background: rgba(10,10,18,.55); }
}
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; width: 100%; height: 100%; }

.ca { color: var(--a); font-weight: 800; }
.cb { color: var(--b); font-weight: 800; }
.slot { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.4em; padding: 0 .2em; border: 2px dashed var(--gold); border-radius: 8px; color: var(--gold); font-size: .85em; vertical-align: middle; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(250,204,21,.15); } }

/* ---------- Accueil ---------- */
.home { flex: 1; overflow-y: auto; padding: 18px 16px 40px; scrollbar-width: none; }
.home::-webkit-scrollbar { display: none; }
.top { display: flex; align-items: center; gap: 12px; }
.avatar { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: linear-gradient(135deg, var(--a), var(--b)); flex: none; }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-size: 18px; }
.who small { color: var(--muted); font-size: 13px; }
.xpbar { height: 8px; border-radius: 99px; background: var(--panel2); margin-top: 6px; overflow: hidden; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--a), var(--b)); border-radius: 99px; transition: width .6s cubic-bezier(.2,.9,.3,1.2); }
.flame { text-align: center; font-weight: 800; font-size: 20px; line-height: 1; padding: 8px 10px; border-radius: 14px; background: var(--panel); }
.flame small { display: block; font-size: 10px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.flame.off { filter: grayscale(1); opacity: .6; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--panel); font-size: 18px; display: grid; place-items: center; flex: none; }

.daily { margin: 18px 0 14px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.ring { width: 54px; height: 54px; flex: none; }
.ring circle { fill: none; stroke-width: 7; }
.daily b { font-size: 16px; }
.daily p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.hero { display: block; width: 100%; text-align: left; position: relative; overflow: hidden; padding: 20px 18px; border-radius: 26px; background: linear-gradient(120deg, #22d3ee, #818cf8 50%, #f472b6); color: #0a0a12; margin-bottom: 12px; box-shadow: 0 10px 40px rgba(129,140,248,.35); transition: transform .15s; }
.hero:active { transform: scale(.97); }
.hero b { font-size: 26px; display: block; letter-spacing: -.02em; }
.hero span { font-weight: 600; opacity: .8; font-size: 14px; }
.hero::after { content: '▶'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; border-radius: 50%; background: #0a0a12; color: #fff; display: grid; place-items: center; font-size: 18px; animation: beat 1.4s ease-in-out infinite; }
@keyframes beat { 50% { transform: translateY(-50%) scale(1.1); } }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.tile { text-align: left; padding: 16px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); transition: transform .15s; position: relative; overflow: hidden; }
.tile:active { transform: scale(.96); }
.tile .e { font-size: 28px; }
.tile b { display: block; margin-top: 6px; font-size: 16px; }
.tile small { color: var(--muted); font-size: 12px; }
.tile .prog { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold); }

h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 6px 4px 10px; font-weight: 700; }
.zones { display: grid; gap: 10px; }
.zone { display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 14px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.zone .e { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; flex: none; background: color-mix(in srgb, var(--c) 20%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.zone .mid { flex: 1; min-width: 0; }
.zone b { font-size: 16px; }
.zone small { display: block; color: var(--muted); font-size: 12px; }
.stars { font-size: 12px; letter-spacing: 1px; margin-top: 2px; }
.zone .acts { display: flex; gap: 6px; }
.zone .play { width: 46px; height: 46px; border-radius: 14px; background: var(--c); color: #0a0a12; font-size: 18px; font-weight: 800; }
.zone .watch { width: 46px; height: 46px; border-radius: 14px; background: var(--panel2); font-size: 18px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.badge { width: 52px; height: 52px; border-radius: 16px; background: var(--panel); display: grid; place-items: center; font-size: 24px; border: 1px solid var(--line); }
.badge.locked { filter: grayscale(1); opacity: .25; }
.foot { color: var(--muted); font-size: 12px; text-align: center; margin-top: 26px; }

/* ---------- Lecteur de cartes ---------- */
.player { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 10px 14px 0; }
.ptop { display: flex; align-items: center; gap: 10px; }
.segs { flex: 1; display: flex; gap: 4px; }
.segs i { flex: 1; height: 4px; border-radius: 9px; background: var(--panel2); overflow: hidden; position: relative; }
.segs i.done::after, .segs i.cur::after { content: ''; position: absolute; inset: 0; background: #fff; border-radius: 9px; }
.segs i.cur::after { background: linear-gradient(90deg, var(--a), var(--b)); animation: grow .5s ease-out; }
@keyframes grow { from { transform: scaleX(0); transform-origin: left; } }
.chip { font-size: 13px; font-weight: 800; padding: 6px 10px; border-radius: 99px; background: var(--panel); white-space: nowrap; }
.chip.combo { background: linear-gradient(90deg, #f97316, #facc15); color: #1a0a00; animation: pop .35s; }
.chip.timer { font-variant-numeric: tabular-nums; }
.chip.timer.low { background: var(--bad); color: #fff; animation: pulse 1s infinite; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.2); } }
.timebar { height: 3px; margin-top: 8px; border-radius: 9px; background: var(--panel2); overflow: hidden; }
.timebar i { display: block; height: 100%; background: var(--gold); transition: width 1s linear; }

.stage { flex: 1; min-height: 0; position: relative; margin-top: 10px; }
.card { position: absolute; inset: 0; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: none; padding-bottom: 10px; }
.card::-webkit-scrollbar { display: none; }
.card.enter { animation: cardIn .45s cubic-bezier(.2,.9,.3,1.1); }
.card.leave { animation: cardOut .3s ease-in forwards; }
@keyframes cardIn { from { transform: translateY(70px) scale(.96); opacity: 0; } }
@keyframes cardOut { to { transform: translateY(-90px) scale(.96); opacity: 0; } }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

.tag { align-self: flex-start; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; padding: 5px 10px; border-radius: 99px; background: var(--panel2); color: var(--muted); }
.tag.sujet { background: var(--gold); color: #1a1400; }
.q { font-size: 23px; font-weight: 800; line-height: 1.2; margin: 12px 0 10px; letter-spacing: -.01em; }
.expr { font-size: clamp(22px, 6.6vw, 30px); font-weight: 700; text-align: center; padding: 18px 12px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); line-height: 1.5; word-break: break-word; }
.expr small { font-size: 15px; color: var(--muted); font-weight: 600; }

.hook { justify-content: center; align-items: center; text-align: center; gap: 18px; cursor: pointer; }
.hook .big { font-size: clamp(30px, 9vw, 42px); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; padding: 26px 18px; border-radius: 28px; background: var(--panel); border: 1px solid var(--line); width: 100%; animation: float 3s ease-in-out infinite; }
.hook.boss .big { border-color: var(--bad); box-shadow: 0 0 50px rgba(251,113,133,.35); }
@keyframes float { 50% { transform: translateY(-6px); } }
.hook .sub { color: var(--muted); font-size: 17px; max-width: 34ch; }
.hook .go { margin-top: 6px; padding: 16px 36px; border-radius: 99px; background: #fff; color: #0a0a12; font-weight: 800; font-size: 18px; }
.hook .ex-nb { font-size: 13px; color: var(--muted); }

.copy { margin-top: 12px; padding: 10px 14px 12px 40px; border-radius: 16px; background: #fdfcf3; color: #1d2a6b; font-family: 'Caveat', cursive; font-size: 24px; line-height: 1.25; position: relative; background-image: repeating-linear-gradient(#fdfcf3 0 29px, #c9d6f5 29px 30px); }
.copy::before { content: ''; position: absolute; left: 28px; top: 0; bottom: 0; width: 2px; background: #f3a6a6; }
.copy .cl { display: block; animation: write .6s ease-out; }
.copy .cl.new { color: #c2185b; }
.copy .ttl { font-family: var(--font); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #8a8fb5; display: block; margin-bottom: 2px; }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.answers { margin-top: auto; padding-top: 14px; display: grid; gap: 10px; }
.opt { padding: 16px 14px; border-radius: 18px; background: var(--panel2); border: 2px solid transparent; font-size: 20px; font-weight: 700; text-align: center; transition: transform .1s, background .2s; }
.opt:active { transform: scale(.97); }
.opt.ok { background: rgba(74,222,128,.18); border-color: var(--ok); }
.opt.bad { background: rgba(251,113,133,.15); border-color: var(--bad); opacity: .7; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chips .opt { flex: 1 1 40%; font-size: 22px; }

.fields { display: grid; gap: 10px; margin-top: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 16px; font-weight: 700; color: #d6d6ea; }
.field input { width: 100%; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--line); background: rgba(0,0,0,.35); color: var(--text); font-size: 22px; font-weight: 700; outline: none; transition: border-color .2s, box-shadow .2s; }
.field input:focus { border-color: var(--a); box-shadow: 0 0 0 4px rgba(34,211,238,.15); }
.field.ok input { border-color: var(--ok); background: rgba(74,222,128,.1); }
.field.bad input { border-color: var(--bad); }

.msg { margin-top: 10px; padding: 12px 14px; border-radius: 16px; font-size: 16px; font-weight: 600; line-height: 1.35; display: none; }
.msg.show { display: block; animation: cardIn .3s; }
.msg.bad { background: rgba(251,113,133,.14); border: 1px solid rgba(251,113,133,.4); }
.msg.hint { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.35); }

.keypad { position: sticky; bottom: 0; z-index: 2; background: linear-gradient(transparent, var(--bg) 12px); display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 10px 0 6px; }
.keypad button { height: 46px; border-radius: 12px; background: var(--panel2); font-size: 20px; font-weight: 700; transition: transform .08s, background .15s; }
.keypad button:active { transform: scale(.92); background: rgba(255,255,255,.2); }
.keypad .k-var { color: var(--a); }
.keypad .k-op { color: var(--gold); }
.keypad .k-del { color: var(--bad); }
.keypad .k-ok { grid-column: span 2; background: linear-gradient(90deg, var(--a), var(--b)); color: #0a0a12; font-weight: 800; font-size: 17px; }
.toolbar { display: flex; gap: 8px; margin-top: 10px; }
.toolbar button { flex: 1; padding: 11px; border-radius: 14px; background: var(--panel); font-weight: 700; font-size: 14px; color: var(--muted); }

.win { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0; background: #11281b; border-top: 2px solid var(--ok); z-index: 5; animation: up .35s cubic-bezier(.2,.9,.3,1.2); }
.win.reveal { background: #2a2210; border-color: var(--gold); }
@keyframes up { from { transform: translateY(100%); } }
.win .hype { font-size: 26px; font-weight: 800; color: var(--ok); display: flex; justify-content: space-between; align-items: center; }
.win.reveal .hype { color: var(--gold); }
.win .hype span { font-size: 16px; color: var(--gold); }
.win p { margin: 6px 0 14px; font-size: 17px; line-height: 1.4; }
.win .next { width: 100%; padding: 16px; border-radius: 18px; background: var(--ok); color: #052e16; font-weight: 800; font-size: 18px; }
.win.reveal .next { background: var(--gold); color: #1a1400; }
.win .swipe { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }

.xpfloat { position: fixed; font-weight: 800; font-size: 26px; color: var(--gold); pointer-events: none; z-index: 60; animation: floatUp 1s ease-out forwards; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
@keyframes floatUp { to { transform: translateY(-80px); opacity: 0; } }

.end { text-align: center; align-items: stretch; }
.end .trophy { font-size: 72px; animation: pop .6s; margin-top: 4px; }
.end h3 { font-size: 30px; margin: 4px 0; letter-spacing: -.02em; }
.end .gain { color: var(--gold); font-weight: 800; font-size: 20px; }
.end .copy { text-align: left; }
.btns { display: grid; gap: 10px; margin-top: 16px; }
.btn { padding: 16px; border-radius: 18px; font-weight: 800; font-size: 18px; background: var(--panel2); }
.btn.main { background: linear-gradient(90deg, var(--a), var(--b)); color: #0a0a12; }

/* ---------- Stories (méthodes) ---------- */
.story { position: fixed; inset: 0; z-index: 30; background: #07070d; display: flex; justify-content: center; }
.story .inner { width: 100%; max-width: 480px; height: 100dvh; display: flex; flex-direction: column; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); position: relative; }
.story .segs i.cur::after { animation: fill var(--d, 4.5s) linear forwards; }
.story.paused .segs i.cur::after { animation-play-state: paused; }
@keyframes fill { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }
.frame { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 22px; }
.frame .big { font-size: clamp(30px, 9vw, 44px); font-weight: 800; line-height: 1.25; letter-spacing: -.02em; animation: zoomIn .5s cubic-bezier(.2,.9,.3,1.3); }
.frame .big.small { font-size: clamp(22px, 6.5vw, 30px); }
.frame .sub { font-size: 19px; color: #c9c9de; max-width: 30ch; animation: cardIn .6s .25s both; }
.frame ol { text-align: left; font-size: 22px; font-weight: 700; line-height: 1.9; padding-left: 0; list-style: none; margin: 0; }
.frame ol li { animation: cardIn .4s both; }
.frame ol li:nth-child(2) { animation-delay: .5s; } .frame ol li:nth-child(3) { animation-delay: 1s; } .frame ol li:nth-child(4) { animation-delay: 1.5s; }
@keyframes zoomIn { from { transform: scale(.5); opacity: 0; } }
.tapzones { position: absolute; inset: 60px 0 90px; display: grid; grid-template-columns: 1fr 2fr; }
.story .close { position: absolute; top: 26px; right: 14px; z-index: 3; }
.story .cta { position: relative; z-index: 3; }
.area { width: min(260px, 70vw); }
.area rect { stroke: #0a0a12; stroke-width: 3; animation: zoomIn .5s both; transform-box: fill-box; transform-origin: center; }
.area text { font: 800 22px var(--font); fill: #0a0a12; text-anchor: middle; dominant-baseline: middle; }
.area .lbl { fill: #fff; font-size: 18px; }

/* ---------- Détective ---------- */
.det-expr { font-size: clamp(26px, 8vw, 36px); }
.det-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.det-opts .opt { font-size: 17px; padding: 14px 8px; }
.det-opts .opt:last-child { grid-column: span 2; }
.why { margin-top: 12px; font-size: 17px; font-weight: 600; text-align: center; min-height: 2.6em; }

/* ---------- Modale (formulaire, pseudo) ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.7); backdrop-filter: blur(8px); display: grid; place-items: end center; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet { width: 100%; max-width: 480px; max-height: 90dvh; overflow-y: auto; padding: 22px 18px calc(24px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0; background: #14141f; border-top: 1px solid var(--line); animation: up .35s cubic-bezier(.2,.9,.3,1.1); }
.sheet h3 { margin: 0 0 14px; font-size: 24px; }
.formula { padding: 14px; border-radius: 16px; background: var(--panel); margin-bottom: 10px; font-size: 20px; font-weight: 700; text-align: center; }
.formula small { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.sheet input.name { width: 100%; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: rgba(0,0,0,.35); color: #fff; font-size: 20px; margin-bottom: 12px; outline: none; }
.emojis { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.emojis button { width: 50px; height: 50px; border-radius: 14px; background: var(--panel); font-size: 26px; border: 2px solid transparent; }
.emojis button.sel { border-color: var(--a); background: rgba(34,211,238,.15); }

#toast { position: fixed; top: 14px; left: 50%; transform: translate(-50%, -150%); z-index: 70; padding: 12px 18px; border-radius: 18px; background: #1d1d2e; border: 1px solid var(--gold); font-weight: 700; display: flex; gap: 10px; align-items: center; transition: transform .4s cubic-bezier(.2,.9,.3,1.2); max-width: 92vw; }
#toast.show { transform: translate(-50%, 0); }
#toast .te { font-size: 30px; }
#toast small { display: block; color: var(--muted); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
