/* Recto Verso : style « Zen papier » et mécanique de retournement */
@font-face { font-family: Fraunces; src: url(../fonts/fraunces-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Fraunces; src: url(../fonts/fraunces-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Inter; src: url(../fonts/inter-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(../fonts/inter-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(../fonts/inter-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(../fonts/inter-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
/* Police chinoise : 2 Mo, téléchargée seulement quand un caractère chinois s'affiche */
@font-face { font-family: RVKai; src: url(../fonts/kai.woff2) format('woff2'); font-display: swap; unicode-range: U+2E80-9FFF, U+F900-FAFF, U+FF00-FFEF; }

:root {
  --paper: #F4EEE2; --paper2: #EDE5D5; --card: #FBF8F1; --ink: #1E1B17; --ink2: #5E574D; --line: #D9CFBC; --seal: #B3352B;
  --t1: #C0392B; --t2: #D98324; --t3: #3F8F5A; --t4: #2F6DB5; --t0: #8A8378;
  --flip: 650ms; --ease: cubic-bezier(.45, .05, .3, 1);
  --serif: Fraunces, Georgia, serif; --sans: Inter, system-ui, sans-serif; --zh: RVKai, "Noto Serif SC", serif;
  --verso: #FFFCF5; --field: #fff; --seal-soft: rgba(179,53,43,.35); --hair: rgba(30,27,23,.12); --shadow: rgba(30,27,23,.1); --scrim: rgba(30,27,23,.35); --inv-sub: #CFC6B6;
  color-scheme: light;
}
/* Thème sombre « Nuit encre » : choisi dans les réglages, ou automatique selon le téléphone */
:root[data-theme="dark"] {
  --paper: #15120F; --paper2: #221E19; --card: #1E1A16; --ink: #F1EBDF; --ink2: #A89F91; --line: #3A342C; --seal: #D9473A;
  --t1: #E26A5E; --t2: #E8A04C; --t3: #6CBF86; --t4: #6FA0E6; --t0: #8F877B;
  --verso: #241C18; --field: #26211C; --seal-soft: rgba(217,71,58,.45); --hair: rgba(241,235,223,.18); --shadow: rgba(0,0,0,.35); --scrim: rgba(0,0,0,.55); --inv-sub: #5E574D;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); transition: background-color .3s, color .3s; }
body { min-height: 100dvh; overscroll-behavior-y: contain; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: max(14px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; }
a { color: inherit; }
h1 { font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.15; margin: 8px 0 8px; }
h1.small { font-size: 21px; }
h2 { font-family: var(--serif); font-size: 21px; margin: 4px 0 14px; }
.hint { color: var(--ink2); font-size: 14.5px; line-height: 1.45; margin: 0 0 18px; }
.hint.small { font-size: 13px; }
.empty { text-align: center; color: var(--ink2); margin: 60px 0 20px; }
.enter { animation: enter .35s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink); text-decoration: none; }
.icon-btn:active { background: var(--paper2); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 15px; border-radius: 16px; border: 1.5px solid var(--ink); background: transparent; font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; margin-top: 12px; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.ghost { border-color: var(--line); background: var(--card); }
.btn:disabled { opacity: .35; cursor: default; }
.btn:active:not(:disabled) { transform: scale(.98); }
.mini-btn { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 7px 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.mini-btn.armed { border-color: var(--seal); background: var(--seal); color: #fff; }
.field { width: 100%; font-size: 18px; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--field); color: var(--ink); outline: none; }
.field:focus { border-color: var(--ink); }

.flag { width: 30px; height: 20px; border-radius: 4px; flex: none; box-shadow: 0 0 0 1px var(--hair); }
.flag.big { width: 42px; height: 28px; border-radius: 5px; }
.flag.huge { width: 72px; height: 48px; border-radius: 8px; }
.logo { width: 100%; height: 100%; }

/* ---------- Retournement (commun aux cartes, tuiles, pastille) ---------- */
.flip { position: relative; perspective: 800px; border: 0; background: none; padding: 0; cursor: pointer; text-align: inherit; }
.flip .in { position: absolute; inset: 0; display: block; transform-style: preserve-3d; transition: transform var(--flip) var(--ease); }
.flip.flipped .in { transform: rotateY(180deg); }
.flip.flipping .in { animation: flipUp var(--flip) var(--ease) both; }
.flip.unflipping .in { animation: flipDown var(--flip) var(--ease) both; }
@keyframes flipUp { 0% { transform: translateZ(0) rotateY(0); } 50% { transform: translateZ(70px) rotateY(90deg); } 100% { transform: translateZ(0) rotateY(180deg); } }
@keyframes flipDown { 0% { transform: translateZ(0) rotateY(180deg); } 50% { transform: translateZ(70px) rotateY(90deg); } 100% { transform: translateZ(0) rotateY(0); } }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: inherit; }
.flip .face.back { transform: rotateY(180deg); }
/* Mode sobre : la carte se pince puis s'ouvre, sans profondeur */
@keyframes squashUp { 0% { transform: rotateY(0) scaleX(1); } 49.9% { transform: rotateY(0) scaleX(.03); } 50% { transform: rotateY(180deg) scaleX(.03); } 100% { transform: rotateY(180deg) scaleX(1); } }
@keyframes squashDown { 0% { transform: rotateY(180deg) scaleX(1); } 49.9% { transform: rotateY(180deg) scaleX(.03); } 50% { transform: rotateY(0) scaleX(.03); } 100% { transform: rotateY(0) scaleX(1); } }
.calm { --flip: 420ms; }
.calm .flip.flipping .in { animation: squashUp var(--flip) ease-in-out both; }
.calm .flip.unflipping .in { animation: squashDown var(--flip) ease-in-out both; }
.calm .enter { animation: none; }

/* ---------- Premier lancement ---------- */
.ob { padding-top: 6px; }
.ob .back { margin-left: -8px; }
.ob-head { text-align: center; margin: 10px 0 18px; }
.ob-logo { width: 74px; height: 74px; display: block; margin: 0 auto 4px; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: .2px; }
.ask { font-size: 24px; margin-top: 16px; min-height: 30px; }
.ask.swap { animation: askSwap .36s var(--ease); }
@keyframes askSwap { 0% { transform: rotateX(0); opacity: 1; } 50% { transform: rotateX(90deg); opacity: .2; } 100% { transform: rotateX(0); opacity: 1; } }
.lang-list { display: flex; flex-direction: column; gap: 8px; }
.lang-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; text-align: left; font-size: 17px; font-weight: 600; }
.lang-row .ln { flex: 1; }
.lang-row small { color: var(--ink2); font-weight: 500; font-size: 13px; }
.lang-row:active { border-color: var(--ink); }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick { height: 128px; border-radius: 18px; }
.pick .face { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--card); border: 1.5px solid var(--line); }
.pick .face b { font-size: 16px; }
.pick .face small { color: var(--ink2); font-size: 12px; }
.pick .face.back { background: var(--verso); border: 2px solid var(--seal); box-shadow: inset 0 0 0 5px var(--verso), inset 0 0 0 6.5px var(--seal-soft); }
.tick { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 7px; background: var(--seal); color: #fff; display: grid; place-items: center; transform: rotate(-6deg); }
.tick .i { width: 18px; height: 18px; stroke-width: 2.6; }
.lvl-flag { display: flex; justify-content: center; margin: 4px 0 6px; }
.seg { display: flex; gap: 6px; background: var(--paper2); padding: 4px; border-radius: 14px; margin: 6px 0 14px; }
.seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; padding: 10px 6px; border-radius: 11px; font-weight: 600; font-size: 14px; cursor: pointer; }
.seg button .flag { width: 24px; height: 16px; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px var(--shadow); }
.levels { display: flex; flex-direction: column; gap: 8px; }
.lvl { text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-weight: 600; font-size: 16px; cursor: pointer; }
.lvl.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.lvl.opt b { display: block; }
.lvl.opt small { display: block; color: var(--ink2); font-weight: 500; font-size: 13.5px; margin-top: 3px; }

/* ---------- Accueil ---------- */
.home-top { display: flex; align-items: center; justify-content: space-between; margin: 0 -6px 6px 0; }
.brandline { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 700; font-size: 18px; }
.mini-logo { width: 34px; height: 34px; }
.hello h1 { font-size: 27px; margin: 10px 0 4px; }
.hello p { margin: 0 0 16px; color: var(--ink2); }
.course-pill { display: block; width: 100%; height: 64px; border-radius: 18px; }
.course-pill .face { display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--card); border: 1.5px solid var(--ink); }
.course-pill .arrow { color: var(--ink2); }
.pill-txt { flex: 1; display: flex; flex-direction: column; text-align: left; margin-left: 4px; }
.pill-txt small { font-size: 11.5px; color: var(--ink2); }
.pill-txt b { font-family: var(--serif); font-size: 18px; }
.streak { margin: 12px 2px 16px; font-size: 14px; color: var(--ink2); }
.streak b { color: var(--ink); font-weight: 600; }
.streak.zero { opacity: .7; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode { height: 150px; border-radius: 20px; }
.mode .face { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; padding: 16px; background: var(--card); border: 1.5px solid var(--ink); box-shadow: 0 6px 16px var(--shadow); }
.mode .face .i { width: 30px; height: 30px; margin-bottom: auto; }
.mode .face b { font-family: var(--serif); font-size: 20px; }
.mode .face small { color: var(--ink2); font-size: 12.5px; line-height: 1.3; }
.mode:first-child .face.front { background: var(--ink); color: var(--paper); }
.mode:first-child .face.front small { color: var(--inv-sub); }
.mode .face.back { background: var(--verso); border: 2px solid var(--seal); justify-content: center; }
.mode .face.back b { font-size: 17px; color: var(--seal); }

/* ---------- Pages, réglages, panneau ---------- */
.top { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px 10px; }
.top .ttl { font-family: var(--serif); font-weight: 700; font-size: 19px; }
.set-label { font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--ink2); margin: 22px 2px 8px; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); text-decoration: none; cursor: pointer; text-align: left; font-size: 15.5px; margin-bottom: 8px; }
.set-row span { flex: 1; }
.set-row.static { cursor: default; }
.seg.wide { margin: 0; }
.course-list { display: flex; flex-direction: column; gap: 8px; }
.course-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; text-align: left; }
.course-row span { flex: 1; display: flex; flex-direction: column; }
.course-row b { font-size: 16px; }
.course-row small { color: var(--ink2); font-size: 13px; }
.course-row.on { border-color: var(--ink); }
.course-row.static { cursor: default; }
.course-row.src small a { color: var(--ink2); }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 10px 18px max(22px, env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .3s var(--ease); max-height: 85dvh; overflow: auto; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 12px; }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 12px; font-size: 14px; z-index: 60; max-width: 90vw; text-align: center; animation: enter .25s var(--ease); }
.update-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 14px; z-index: 60; }
.update-bar button { border: 0; background: var(--seal); color: #fff; padding: 8px 12px; border-radius: 10px; font-weight: 600; }
.zh { font-family: var(--zh); }

/* ---------- Étape 4 : cartes et modes ---------- */
.center { text-align: center; }
.meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink2); margin: 0 2px 8px; }
.bar { height: 4px; background: var(--paper2); border-radius: 4px; overflow: hidden; margin-bottom: 16px; }
.bar i { display: block; height: 100%; width: 0; background: var(--seal); transition: width .5s var(--ease); }
.stage { position: relative; height: min(58dvh, 440px); margin-bottom: 16px; }
.stage.tall { height: min(62dvh, 470px); }
.stack { position: absolute; inset: 0; border-radius: 24px; background: var(--card); border: 1.5px solid var(--line); }
.stack.g1 { transform: translateY(9px) scale(.95); opacity: .75; }
.stack.g2 { transform: translateY(18px) scale(.9); opacity: .45; }
.card { position: absolute; inset: 0; border-radius: 24px; cursor: pointer; }
.card .face { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 26px 22px; text-align: center; background: var(--card); border: 1.5px solid var(--ink); box-shadow: 0 10px 28px var(--shadow); }
.card .face.back { background: var(--verso); border: 2px solid var(--seal); box-shadow: inset 0 0 0 7px var(--verso), inset 0 0 0 8.5px var(--seal-soft), 0 10px 28px var(--shadow); }
.card.flipping .face { box-shadow: 0 30px 46px var(--shadow); }
.corner { position: absolute; top: 14px; left: 18px; font: 700 10.5px var(--sans); letter-spacing: 1.4px; color: var(--ink2); text-transform: uppercase; }
.corner.r { left: auto; right: 18px; color: var(--seal); }
.w { font-family: var(--serif); font-weight: 700; font-size: 26px; line-height: 1.15; }
.w.big { font-size: 42px; }
.hz { font-size: 30px; font-weight: 400; letter-spacing: 2px; }
.hz.big { font-size: 78px; line-height: 1.1; }
.art.g-m { color: var(--t4); } .art.g-f { color: var(--t1); } .art.g-n { color: var(--t3); }
.py { font-weight: 600; letter-spacing: .3px; }
.py .t1 { color: var(--t1); } .py .t2 { color: var(--t2); } .py .t3 { color: var(--t3); } .py .t4 { color: var(--t4); } .py .t0 { color: var(--t0); }
.py-line { font-size: 26px; min-height: 34px; opacity: 0; transform: translateY(8px); transition: all .35s var(--ease); }
.py-line.show { opacity: 1; transform: none; }
.hint-line { position: absolute; bottom: 18px; left: 0; right: 0; font-size: 12.5px; color: var(--ink2); }
.pict { font-size: 74px; line-height: 1; margin-bottom: 6px; }
.pict.huge { font-size: 110px; margin: 6px 0 16px; }
.tr .w { font-size: 34px; }
.tr .hz { font-size: 44px; }
.tr.small .w { font-size: 18px; }
.recall { color: var(--ink2); font-size: 15px; }
.recall .w, .recall .hz { font-size: 17px; font-family: var(--sans); font-weight: 600; letter-spacing: 0; }
.ex { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); width: 100%; font-size: 14.5px; color: var(--ink2); line-height: 1.45; }
.badge { position: absolute; bottom: 14px; font-size: 11px; color: var(--ink2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }
.enter-card { animation: dealIn .45s var(--ease); }
@keyframes dealIn { from { transform: translateY(18px) scale(.92); opacity: .3; } to { transform: none; opacity: 1; } }
.card.out-0 { animation: out0 .6s var(--ease) forwards; }
.card.out-1 { animation: out1 .55s var(--ease) forwards; }
.card.out-2 { animation: out2 .55s var(--ease) forwards; }
.card.out-3 { animation: out3 .85s var(--ease) forwards; }
@keyframes out0 { to { transform: translateY(40px) scale(.88); opacity: 0; } }
@keyframes out1 { to { transform: translateX(-120%) rotate(-8deg); opacity: 0; } }
@keyframes out2 { to { transform: translateX(120%) rotate(10deg); opacity: 0; } }
@keyframes out3 { 0% { transform: none; } 40% { transform: translateY(-30px) rotateY(180deg) scale(1.05); } 100% { transform: translateY(-140%) rotateY(360deg) scale(.7); opacity: 0; } }
.calm .card[class*="out-"] { animation: out0 .4s ease forwards; }
.calm .enter-card { animation: none; }
.rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: all .3s var(--ease); }
.rates.show { opacity: 1; pointer-events: auto; transform: none; }
.rate { border: 1.5px solid var(--ink); background: var(--card); border-radius: 14px; padding: 10px 2px 8px; cursor: pointer; }
.rate b { display: block; font-size: 14px; }
.rate small { display: block; font-size: 11px; color: var(--ink2); margin-top: 2px; }
.rate.r-again { border-color: var(--t1); color: var(--t1); }
.rate.r-easy { background: var(--ink); color: var(--paper); }
.rate.r-easy small { color: var(--inv-sub); }
.rate:active { transform: scale(.96); }
.duo { display: flex; gap: 10px; }
.duo .btn { margin-top: 0; }

.games { display: flex; flex-direction: column; gap: 10px; }
.game-row { display: flex; align-items: center; gap: 14px; padding: 18px 16px; border-radius: 18px; border: 1.5px solid var(--ink); background: var(--card); text-decoration: none; }
.game-row .i { width: 28px; height: 28px; }
.game-row span { flex: 1; display: flex; flex-direction: column; }
.game-row b { font-family: var(--serif); font-size: 19px; }
.game-row small { color: var(--ink2); font-size: 13px; }

.q-card { min-height: 170px; border-radius: 22px; border: 1.5px solid var(--ink); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 26px; position: relative; }
.q-card .hz.big { font-size: 64px; }
.q-card .w.big { font-size: 36px; }
.hint.center { margin: 14px 0 12px; }
.answers { display: flex; flex-direction: column; gap: 10px; }
.answer { position: relative; height: 62px; border-radius: 16px; perspective: 600px; cursor: pointer; }
.answer .face { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line); font-size: 17px; }
.answer .w { font-size: 19px; }
.answer .hz { font-size: 24px; }
.answer .face.back.ok { border: 2px solid var(--t3); color: var(--t3); }
.answer .face.back.ko { border: 2px solid var(--t1); color: var(--t1); }
.answer .face.back .w, .answer .face.back .hz { color: var(--ink); }

.m-grid { display: grid; gap: 8px; }
.m-grid.c3 { grid-template-columns: repeat(3, 1fr); }
.m-grid.c4 { grid-template-columns: repeat(3, 1fr); }
.m-card { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; perspective: 600px; cursor: pointer; }
.m-card .face { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; background: var(--card); border: 1.5px solid var(--ink); }
.m-card .face.front { background: var(--paper2); border-color: var(--line); }
.m-logo { width: 46%; height: 46%; opacity: .55; }
.m-card .w { font-size: 15px; font-family: var(--sans); font-weight: 600; }
.m-card .hz { font-size: 24px; }
.m-card .py { font-size: 11px; }
.m-card .face.back.b { background: var(--verso); border-color: var(--seal); }
.m-pict { font-size: 28px; line-height: 1; }
.m-card.matched .face.back { box-shadow: 0 0 0 3px var(--t3); }

.verdict-box { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stamp { width: 62px; height: 62px; border-radius: 13px; background: var(--seal); color: #fff; font-family: var(--zh); font-size: 34px; display: grid; place-items: center; transform: rotate(-6deg) scale(0); transition: transform .45s cubic-bezier(.3, 1.6, .5, 1) .35s; }
.card.flipped .stamp { transform: rotate(-6deg) scale(1); }
.stamp.s-ok { background: var(--t3); }
.verdict { font-weight: 700; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.verdict.v-ok { color: var(--t3); } .verdict.v-near { color: var(--t2); } .verdict.v-ko { color: var(--t1); }
.yours { font-size: 13.5px; color: var(--ink2); }
.write .field { margin-bottom: 4px; }

.cover { background: var(--paper2) !important; border-color: var(--line) !important; }
.cover-logo { width: 96px; height: 96px; opacity: .8; }
.disc-front { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 4px; }
.disc-front .corner { display: none; }
.disc-front .w.big { font-size: 32px; }
.disc-front .hz.big { font-size: 52px; }
.discover .card .face.back .pict { font-size: 54px; }
.discover .card .face.back .recall { display: none; }

.form-stage { height: auto; min-height: 420px; }
.form-stage .card { position: relative; min-height: 420px; }
.form-stage .card .in { position: absolute; }
.form-stage .face { justify-content: flex-start; padding-top: 44px; gap: 8px; cursor: default; }
.lbl { align-self: flex-start; font-size: 12.5px; font-weight: 600; color: var(--ink2); margin-top: 6px; }
.field.center { text-align: center; }
.field.big { font-size: 24px; font-weight: 600; }
.create .face .btn { margin-top: 10px; }

.win { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 20px; }
.win-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-bottom: 18px; }
.tile { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; perspective: 600px; }
.tile .face { display: grid; place-items: center; background: var(--card); border: 1.5px solid var(--line); font-size: 40px; padding: 6px; }
.tile .face.front { background: var(--paper2); }
.tile .face.back .w { font-size: 16px; } .tile .face.back .hz { font-size: 26px; }
.seal-tile .face.back { background: var(--seal); border-color: var(--seal); color: #fff; }
.seal-tile .face.back .i { width: 46px; height: 46px; stroke-width: 2.6; }
.win h2 { font-size: 26px; margin: 4px 0 4px; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 30px; }
.empty-card { position: relative; width: 110px; height: 146px; border-radius: 16px; margin-bottom: 18px; cursor: default; }
.empty-card .face { display: grid; place-items: center; font-size: 46px; background: var(--card); border: 1.5px solid var(--line); }
.empty-title { font-family: var(--serif); font-weight: 700; font-size: 20px; margin: 0 0 6px; }

.mode .due { position: absolute; top: 14px; right: 14px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--seal); color: #fff; font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.mode .face.back { align-items: center; }
.mode-logo { width: 64px; height: 64px; }

/* ---------- Images : pictos OpenMoji, émojis, photos perso ---------- */
.vis { display: inline-block; vertical-align: middle; }
img.vis { object-fit: contain; }
.pict .vis { width: 84px; height: 84px; font-size: 70px; line-height: 84px; }
.pict.huge .vis { width: 140px; height: 140px; font-size: 110px; line-height: 140px; }
.vis.ph { object-fit: cover; border-radius: 16px; }
.m-pict.vis, .m-card .vis { width: 38px; height: 38px; font-size: 30px; line-height: 38px; }
.m-card .vis.ph { border-radius: 8px; }
.tile .face.back .vis { width: 60%; height: auto; font-size: 40px; }
.thumb { width: 42px; height: 42px; font-size: 30px; line-height: 42px; text-align: center; flex: none; }
.thumb.ph { border-radius: 10px; }
.thumb-empty { width: 42px; flex: none; }
.photo-row { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.photo-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--line); border-radius: 14px; padding: 8px; cursor: pointer; font-weight: 600; font-size: 14px; background: var(--field); min-height: 56px; }
.ph-prev { font-size: 24px; line-height: 1; }
.ph-prev img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; display: block; }
.field.emoji { width: 120px; flex: none; font-size: 22px; }
label.btn { cursor: pointer; }
.discover .card .face.back .pict .vis { width: 60px; height: 60px; font-size: 50px; line-height: 60px; }

/* 0.4.0 : finalisation de la phase 1 */
/* Bouton d'action toujours visible en bas sur les petits écrans */
.sticky-act { position: sticky; bottom: 0; margin: 0 -18px; padding: 4px 18px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--paper) 22%); z-index: 5; }
/* Langues pas encore prêtes */
.pick.soon { position: relative; opacity: .55; }
.pick.soon .face { position: absolute; inset: 0; border-radius: 18px; border-style: dashed; }
.pick.soon .soon-tag { font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 10.5px; color: var(--seal); }
.course-row:disabled { opacity: .5; cursor: default; }
.course-row small { color: var(--ink2); font-size: 12.5px; }
/* Sélection lisible aussi en thème sombre */
.seg button.on { box-shadow: 0 1px 3px var(--shadow), inset 0 0 0 1.5px var(--line); }
:root[data-theme="dark"] .seg button.on { background: var(--ink); color: var(--paper); box-shadow: none; }
.nowrap { white-space: nowrap; }
/* Memory à 12 cartes : la grille tient dans l'écran sans défiler */
.m-grid.c4 { max-width: calc((100dvh - 150px) * .5625 + 16px); margin: 0 auto; }
/* Bandeau d'accueil (installation, sauvegarde) */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin: 0 0 12px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--seal-soft); transition: opacity .3s, transform .3s; }
.notice > svg { flex: none; width: 22px; height: 22px; color: var(--seal); margin-top: 1px; }
.notice b { font-family: var(--serif); font-size: 16px; }
.notice p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--ink2); }
.notice-act { display: flex; gap: 8px; margin-top: 10px; }
.btn.sm { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 12px; margin: 0; }
.notice.gone { opacity: 0; transform: translateY(-6px); }
/* Étapes d'installation */
.steps { list-style: none; padding: 0; margin: 4px 0 6px; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.4; }
.steps .n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

/* ===== 0.6.0 : esthétique « J'apprends le chinois » (couleurs, formes, accueil) ===== */
:root {
  --line: #DCD2BF; --ink2: #857C6E; --shadow: rgba(80,60,30,.08); --dots: rgba(120,100,70,.06);
  --block-bg: #1E1B17; --block-fg: #F4EEE2; --accent: #B3352B; --accent-soft: #F1DDD6; --on-accent: #fff;
}
:root[data-theme="dark"] {
  --paper: #16140F; --paper2: #1F1C16; --card: #221F19; --ink: #EFE7D6; --ink2: #A39A8A; --line: #3A342B;
  --shadow: rgba(0,0,0,.35); --dots: rgba(255,240,210,.035); --block-bg: #2C2820; --block-fg: #EFE7D6;
  --accent: #D2584C; --accent-soft: #3B2420; --seal: #D2584C;
}
body { background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 6px 6px; font-size: 15px; -webkit-font-smoothing: antialiased; }
/* Boutons : l'action principale est rouge, les autres sont des cartes */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 15px; padding: 14px; font-size: 15px; }
.btn.primary, .btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.ghost { border-color: var(--line); background: var(--card); color: var(--ink); }
.btn:active:not(:disabled) { transform: none; filter: brightness(.92); }
.mini-btn { border-width: 1px; border-radius: 999px; padding: 7px 12px; }
.field { border-width: 1px; font-size: 16px; padding: 13px 14px; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Cartes, listes et tuiles : bord fin, coins plus ronds */
.lang-row, .lvl, .set-row, .course-row { border-width: 1px; border-radius: 18px; }
.lang-row:active, .course-row.on, .lvl.on { border-color: var(--ink); }
.lvl.on { box-shadow: 0 0 0 1px var(--ink); }
.pick .face { border-width: 1px; }
.icon-btn { border-radius: 50%; color: var(--ink2); }
.top .ttl { font-family: var(--sans); font-weight: 600; font-size: 15px; }
.set-label { font-size: 11.5px; letter-spacing: .07em; color: var(--ink2); }
/* Sélecteurs : boutons séparés, le choix est plein */
.seg { background: transparent; padding: 0; gap: 8px; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 8px; }
.seg button.on, :root[data-theme="dark"] .seg button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); box-shadow: none; }
/* Barres de progression */
.bar { height: 6px; border-radius: 3px; background: var(--line); }
.bar i { background: var(--accent); }
/* Notes de révision : pastilles pleines aux couleurs des tons */
.rate { border: 0; border-radius: 16px; color: #fff; padding: 10px 2px; }
.rate b { font-size: 14.5px; font-weight: 700; }
.rate small { color: rgba(255,255,255,.85); font-size: 12px; }
.rate.r-again { background: var(--t1); color: #fff; } .rate.r-hard { background: var(--t2); } .rate.r-good { background: var(--t3); } .rate.r-easy { background: var(--t4); color: #fff; }
.rate.r-easy small { color: rgba(255,255,255,.85); }
:root[data-theme="dark"] .rate { color: #16140F; } :root[data-theme="dark"] .rate small { color: rgba(22,20,15,.75); }
/* Panneau et messages */
.sheet { border-radius: 26px 26px 0 0; }
.toast { border-radius: 14px; padding: 11px 18px; }
.notice { border: 1px dashed var(--accent); }

/* Accueil */
.hello h1 { font-size: 28px; margin: 14px 0 2px; }
.hello p { color: var(--ink2); margin: 0 0 14px; }
.course-pill { height: 58px; }
.course-pill .face { border: 1px solid var(--line); background: var(--card); }
.today { margin: 14px 0 0; background: var(--block-bg); color: var(--block-fg); border-radius: 24px; padding: 20px; }
.today .n { font-family: var(--serif); font-size: 46px; font-weight: 700; line-height: 1; }
.today .l { font-size: 14px; opacity: .8; margin-top: 6px; line-height: 1.4; }
.today .l.done { font-family: var(--serif); font-size: 19px; opacity: 1; margin-top: 2px; }
.today .btn { margin-top: 16px; }
.goal { margin-top: 14px; }
.goal small { display: block; font-size: 12.5px; margin-top: 6px; opacity: .75; }
.goal-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }
.modes { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.mode { height: 86px; border-radius: 18px; }
.mode .face { justify-content: center; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--line); background: var(--card); box-shadow: none; text-align: center; }
.mode .face .i { width: 28px; height: 28px; margin: 0; }
.mode .face .glyph { font-family: var(--zh); font-size: 28px; line-height: 1.1; }
.mode .face b { font-family: var(--sans); font-size: 13px; font-weight: 600; }
.mode:first-child .face.front { background: var(--card); color: var(--ink); }
.mode .face.back { border: 2px solid var(--seal); }
.mode .face.back .mode-logo { width: 40px; height: 40px; }
.stats { display: flex; justify-content: space-around; margin-top: 16px; padding: 14px; border-radius: 18px; background: var(--paper2); }
.stats div { text-align: center; font-size: 11.5px; color: var(--ink2); }
.stats b { display: block; font-size: 20px; color: var(--ink); font-family: var(--serif); }
/* Cartes de jeu : recto clair au bord fin, verso inchangé (signature Recto Verso) */
.card { border-radius: 28px; }
.card .face { border: 1px solid var(--line); box-shadow: 0 10px 30px var(--shadow); }
.card .face.back { border: 2px solid var(--seal); }
.answer .face, .m-card .face { border-width: 1px; border-color: var(--line); }
.answer .face { border-radius: 16px; }
.stats + .notice { margin: 16px 0 0; }
.mode .face, .course-pill .face, .pick .face { border-radius: 18px; }
.flip .in { border-radius: inherit; }

/* 0.7.0 : recherche dans Créer */
.searchbox { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; margin: 4px 0 6px; }
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.searchbox .i { color: var(--ink2); width: 20px; height: 20px; }
.searchbox input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; padding: 14px 0; color: var(--ink); }
.results { margin-bottom: 14px; }
.results .set-label { margin-top: 14px; }
.results .btn.manual { margin-top: 12px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.list .row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; min-height: 56px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink); }
.list .row + .row { border-top: 1px solid var(--line); }
.list .row:active:not(:disabled) { background: var(--paper2); }
.list .row:disabled { cursor: default; opacity: .6; }
.list .row .grow { flex: 1; min-width: 0; }
.list .row .grow b { font-size: 16px; }
.list .row .grow small { display: block; color: var(--ink2); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .row .py { font-size: 14px; font-weight: 600; }
.list .row .hz { font-size: 28px; min-width: 44px; text-align: center; }
.list .row .tag { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.list .row .tag.hsk { color: var(--ink2); }
.list .row .thumb, .list .row .thumb-empty { width: 36px; height: 36px; flex: none; }
.list .row .w, .list .row .w.big { font-size: 16px; font-family: var(--sans); font-weight: 700; }

/* 0.8.0 : Découvrir par thème */
.disc-mode { margin: 0 0 12px; }
.lots-hint { color: var(--ink2); font-size: 13px; margin: 0 2px 4px; }
.list.lots .row .grow small.have { color: var(--accent); white-space: normal; }
.list.lots .row:disabled .tag { color: var(--ink2); }
.list.lots { margin-bottom: 4px; }

/* 0.9.0 : choix thème et niveau, séances sans fin, effets de réponse */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip small { font-size: 12px; font-weight: 600; color: var(--ink2); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.on small { color: var(--inv-sub); }
.chip:disabled { opacity: .38; cursor: default; }
.filter .sticky-act .need { margin: 0 0 8px; text-align: center; }
.btn.off { opacity: .4; pointer-events: none; }
.rates.two { grid-template-columns: 1fr 1fr; gap: 10px; }
.rates.two .rate { padding: 15px 4px; }
.rates.two .rate b { font-size: 16px; }
.fx-burst { position: fixed; width: 0; height: 0; pointer-events: none; z-index: 70; }
.fx-burst i { position: absolute; left: 0; top: 0; width: 8px; height: 8px; border-radius: 2px; }
.fx-veil { position: fixed; inset: 0; pointer-events: none; z-index: 69; background: radial-gradient(ellipse at center, transparent 45%, rgba(192,57,43,.28) 100%); background: radial-gradient(ellipse at center, transparent 45%, color-mix(in srgb, var(--t1) 28%, transparent) 100%); }

/* 0.10.0 : indices dans Écris ce que tu vois */
.write .clue { font-size: 13px; color: var(--ink2); text-align: center; margin: -4px 0 8px; }
.write .clue-word { text-align: center; margin: 0 0 8px; color: var(--t2); }
.write .card .duo .btn { flex: 1; }
.stamp.s-other { background: var(--t0); }
.verdict.v-other { color: var(--ink2); }
.write .card .duo { width: 100%; }
[hidden] { display: none !important; }

/* 0.11.0 : compte et synchronisation */
.acc h1 { text-align: center; }
.acc .hint { text-align: center; }
.acc-form { display: flex; flex-direction: column; }
.acc-form .set-label:first-child { margin-top: 4px; }
.acc-err { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--seal) 12%, transparent); color: var(--seal); font-size: 14px; font-weight: 600; }
.link-btn { display: block; margin: 16px auto 0; background: none; border: 0; color: var(--ink2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; }
.acc-alt { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.acc-privacy { margin-top: 18px; text-align: left !important; }
.acc-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.acc-mail { display: flex; align-items: center; gap: 10px; }
.acc-mail .i { color: var(--accent); flex: none; }
.acc-mail span { display: flex; flex-direction: column; min-width: 0; }
.acc-mail b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-mail small { color: var(--ink2); font-size: 13px; }
.acc-card .duo { display: flex; gap: 10px; }
.acc-card .duo .btn { flex: 1; margin-top: 12px; padding: 11px; font-size: 14px; }
.acc-card .btn.logout.armed { border-color: var(--seal); color: var(--seal); }
.acc-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.acc-links .link-btn { margin: 8px 0 0; font-size: 13px; }
.btn.danger { background: var(--seal); border-color: var(--seal); color: #fff; }
.inv-out { margin-top: 14px; }
.inv-link { padding: 12px; border-radius: 12px; background: var(--field); border: 1px dashed var(--line); word-break: break-all; font-size: 13px; }
.inv-out .duo { display: flex; gap: 10px; }
.inv-out .duo .btn { flex: 1; }
.inv-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.inv-row span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.inv-row small { color: var(--ink2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
@supports not (color: color-mix(in srgb, red 10%, white)) { .acc-err { background: rgba(192, 57, 43, .12); } }

/* 0.12.0 : un mot par traduction, Duo, Découvrir par niveau, Progrès, Admin, signalements, lancement */
/* Retournement : l'animation seule pilote la rotation (la transition en plus pouvait rejouer un second tour, sur Safari notamment) */
.flip .in { transition: none; }
@keyframes flipUp { 0% { transform: rotateY(0); } 50% { transform: translateZ(24px) rotateY(90deg); } 100% { transform: rotateY(180deg); } }
@keyframes flipDown { 0% { transform: rotateY(180deg); } 50% { transform: translateZ(24px) rotateY(90deg); } 100% { transform: rotateY(0); } }
.mode.pressed .in { transform: scale(.95); transition: transform .14s ease; }
.top-acts { display: flex; gap: 2px; }

.wnote { display: block; font-family: var(--sans); font-weight: 500; font-size: max(12px, .38em); color: var(--ink2); letter-spacing: 0; margin-top: .25em; line-height: 1.2; }
.alt-line { font-size: 13px; color: var(--ink2); margin-top: 4px; }
.stamp:has(.stamp-logo), .stamp .stamp-logo { background: none; }
.stamp .stamp-logo { width: 100%; height: 100%; }

.lots .row.lot { cursor: default; }
.lots .row.lot.full .grow b { color: var(--ink2); }
.lots .row.lot.busy { opacity: .5; pointer-events: none; }
.lot-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.lot-acts .mini-btn.add { border-color: var(--accent); color: var(--accent); }
.lot-acts .mini-btn.rm { font-weight: 500; color: var(--ink2); }
.lot-acts .mini-btn.armed { background: var(--seal); border-color: var(--seal); color: #fff; }
.lots.levels .row.lot .grow b { font-family: var(--serif); }

.duo-bar { height: 8px; border-radius: 99px; background: var(--paper2); overflow: hidden; margin: 4px 2px 6px; }
.duo-fill { display: block; height: 100%; width: 0; background: var(--t3); border-radius: inherit; transition: width .35s var(--ease); }
.duo-count { text-align: center; font-size: 13px; color: var(--ink2); margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.duo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duo-col { display: flex; flex-direction: column; gap: 10px; }
.duo-cell { min-height: 74px; padding: 10px 8px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; box-shadow: 0 3px 10px var(--shadow); transition: transform .12s ease, border-color .12s ease, background .12s ease, opacity .3s ease; }
.duo-cell .w { font-size: 18px; font-family: var(--sans); font-weight: 700; }
.duo-cell .hz { font-size: 28px; }
.duo-cell .py { font-size: 12.5px; margin-top: 2px; }
.duo-cell .wnote { font-size: 11px; }
.duo-cell.on { border-color: var(--ink); background: var(--paper2); transform: scale(1.03); }
.duo-cell.gone { opacity: 0; transform: scale(.9); pointer-events: none; border-color: var(--t3); }
.duo-cell:empty { visibility: hidden; }
.duo-cell.arrive { animation: dealIn .35s var(--ease); }
.calm .duo-cell.arrive { animation: none; }
.duo-win .win-logo { width: 84px; height: 84px; margin: 10px auto; display: block; }
.duo-stats { display: flex; justify-content: center; gap: 30px; margin: 6px 0 18px; }
.duo-stats div { display: flex; flex-direction: column; align-items: center; }
.duo-stats b { font-family: var(--serif); font-size: 30px; }
.duo-stats small { color: var(--ink2); font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; margin: 8px 0 6px; }
.kpis div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; }
.kpis b { font-family: var(--serif); font-size: 24px; }
.kpis small { font-size: 11.5px; color: var(--ink2); line-height: 1.25; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.hint.center { text-align: center; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .area { fill: var(--t3); opacity: .12; }
.chart .line { fill: none; stroke: var(--t3); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--t3); }
.chart .val { font: 700 13px var(--sans); fill: var(--ink); }
.chart .lbl { font: 11px var(--sans); fill: var(--ink2); }
.cal { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.cal i, .cal-legend i { aspect-ratio: 1; border-radius: 3px; background: var(--paper2); display: block; }
.cal-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 10px; font-size: 11.5px; color: var(--ink2); }
.cal-legend i { width: 11px; flex: none; }
.c1 { background: color-mix(in srgb, var(--t3) 30%, var(--paper2)) !important; }
.c2 { background: color-mix(in srgb, var(--t3) 55%, var(--paper2)) !important; }
.c3 { background: color-mix(in srgb, var(--t3) 78%, var(--paper2)) !important; }
.c4 { background: var(--t3) !important; }
.lvl-row { display: grid; grid-template-columns: 7.2em 1fr; gap: 4px 10px; align-items: center; margin-bottom: 12px; }
.lvl-row b { margin: 0; line-height: 1.2; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvl-row small { grid-column: 2; font-size: 12px; color: var(--ink2); }
.lvl-row .bar { margin: 0; }
.bar { position: relative; height: 10px; border-radius: 99px; background: var(--paper2); overflow: hidden; }
.bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.bar .own, .cal-legend i.own { background: color-mix(in srgb, var(--t4) 45%, var(--paper2)); }
.bar .mas, .cal-legend i.mas { background: var(--t3); }
.cal-legend i.own, .cal-legend i.mas { aspect-ratio: auto; height: 8px; width: 16px; border-radius: 99px; margin-left: 8px; }

.announce { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--accent); border-radius: 16px; padding: 10px 6px 10px 14px; margin: 4px 0 12px; }
.announce > .i { color: var(--accent); flex: none; }
.announce p { flex: 1; margin: 0; font-size: 14.5px; line-height: 1.4; }
.report-btn .i { width: 20px; height: 20px; opacity: .7; }

.splash { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--ink2); font-size: 14px; }
.splash-logo { width: 72px; height: 72px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.92); opacity: .7; } }
.steps .st-ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; font-weight: 700; }
.steps .st-ic .i { width: 18px; height: 18px; }

.admin-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.admin-tabs .chip { flex: none; }
.badge-n:empty { display: none; }
.badge-n { background: var(--seal); color: #fff; border-radius: 99px; padding: 0 6px; margin-left: 4px; }
.admin .list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 8px; }
.admin .list .row .grow small { white-space: normal; }
.admin .inv-row { padding: 10px 14px; }
.wrow .wvis, .rep-vis { width: 36px; height: 36px; flex: none; display: grid; place-items: center; }
.wrow .wvis .vis, .rep-vis .vis { width: 32px; height: 32px; font-size: 26px; }
.rep-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.rep-row + .rep-row { border-top: 1px solid var(--line); }
.rep-row small { display: block; color: var(--ink2); font-size: 12.5px; }
.rep-c { font-style: italic; }
.pic-edit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pic-edit .vis { width: 56px; height: 56px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; flex: 1; }
.word-form .duo { display: flex; gap: 10px; }
.word-form .duo > span { flex: 1; }
.panel.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.panel.kv span { color: var(--ink2); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.bars i { flex: 1; background: var(--t3); border-radius: 2px 2px 0 0; min-height: 2px; }
.err-row { font-size: 13px; margin: 0 0 8px; word-break: break-word; }
.btn.danger-t { color: var(--seal); }
.btn.danger-t.armed { background: var(--seal); color: #fff; border-color: var(--seal); }
.word-q { margin: 8px 0 4px; }
.cal { max-width: 330px; margin: 0 auto; }

/* 0.13.0 : niveaux plein écran, Duo par vagues, pages sans défilement */
.page.fill { display: flex; flex-direction: column; min-height: calc(100dvh - max(14px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom))); }
.lvl-grid { flex: 1; display: grid; grid-template-rows: repeat(4, 1fr); gap: 12px; min-height: 0; }
.lvl-tile { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; align-items: center; column-gap: 16px; padding: 16px 20px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; box-shadow: 0 6px 16px var(--shadow); min-height: 84px; transition: transform .12s ease; }
.lvl-tile:active { transform: scale(.98); }
.lvl-tile .lvl-n { grid-row: 1 / span 2; font-family: var(--serif); font-weight: 700; font-size: clamp(34px, 8dvh, 56px); line-height: 1; color: var(--ink2); width: 1.1em; text-align: center; }
.lvl-tile .lvl-txt b { display: block; font-family: var(--serif); font-size: clamp(20px, 3.4dvh, 28px); }
.lvl-tile .lvl-txt small { color: var(--ink2); font-size: 14px; font-weight: 600; }
.lvl-tile .lvl-c { grid-column: 2; font-size: 13px; color: var(--ink2); }
.lvl-tile.cur { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.lvl-tile.cur .lvl-n { color: var(--accent); }
.lvl-tile.off { opacity: .45; box-shadow: none; pointer-events: none; }
.lvl-badge { position: absolute; top: 12px; right: 14px; font-size: 11.5px; font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 99px; padding: 3px 9px; }
.lv-seg { flex-wrap: wrap; }
.lv-seg button { flex: 1 1 40%; display: flex; flex-direction: column; align-items: center; }
.lv-seg button small { font-size: 11px; opacity: .7; font-weight: 500; }

/* Duo : la grille occupe la hauteur disponible */
.duo-page { display: flex; flex-direction: column; min-height: calc(100dvh - 40px); }
.duo-grid { flex: 1; align-content: start; }
.duo-cell { min-height: clamp(52px, 10dvh, 84px); }

/* Petits écrans : on resserre plutôt que de faire défiler */
@media (max-height: 700px) {
  #app { padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .hello h1 { font-size: 24px; margin-top: 6px; }
  .hello p { margin-bottom: 8px; }
  .today { padding: 14px 16px; margin-top: 10px; }
  .today .btn { margin-top: 10px; padding: 11px; }
  .modes { margin-top: 10px; }
  .mode { height: 92px; }
  .stats { margin-top: 10px; padding: 10px; }
  .stage { height: min(52dvh, 400px); }
  .top { margin-bottom: 6px; }
}
/* Progrès : tout sur un écran de téléphone courant */
.progress .kpis { margin: 2px 0; }
.progress .kpis div { padding: 7px 4px; }
.progress .kpis b { font-size: 20px; }
.progress .set-label { margin-top: 10px; margin-bottom: 4px; }
.progress .panel { padding: 10px 12px; }
.progress .chart { max-height: 120px; }
.progress .panel .hint.small { margin: 4px 0 0; font-size: 12px; }
.progress .cal { max-width: 250px; gap: 2px; }
.progress .cal-legend { margin-top: 6px; }
.progress .lvl-row { margin-bottom: 6px; }
.progress .hint.center { margin: 0 0 4px; }
@media (max-height: 900px) { .progress .panel .hint.small { display: none; } .progress .chart { max-height: 96px; } }
@media (max-height: 700px) { .progress .cal { max-width: 200px; } .progress .kpis small { font-size: 10.5px; } }
/* 0.13 : page Progrès sans défilement sur les petits écrans */
@media (max-height: 940px) {
  .progress .hint.center { display: none; }
  .progress .set-label { margin-top: 6px; margin-bottom: 2px; }
  .progress .panel { padding: 8px 10px; }
  .progress .chart { max-height: 72px; }
  .progress .panel:not(.levels-bars) .cal-legend { display: none; }
  .progress .cal { max-width: 190px; }
  .progress .lvl-row { margin-bottom: 2px; }
}
@media (max-height: 700px) { .progress .cal { max-width: 170px; } .progress .chart { max-height: 60px; } .progress .kpis small { font-size: 10px; line-height: 1.1; } .progress .kpis div { padding: 4px 3px; } .progress .kpis b { font-size: 18px; } }
.vis.ai { border-radius: 18%; object-fit: cover; background: #f7ecd9; }
