/* ==========================================================================
   Brainrot Quest — style « console portable » : panneaux épais, boutons
   en relief, tout est pensé pour le doigt autant que pour la souris.
   ========================================================================== */
:root {
  --bg: #14102a; --panel: #211a4a; --panel2: #2c2462; --panel3: #3a3080; --line: #5a4eb0; --line2: #1d1633;
  --ink: #f6f2ff; --muted: #b9aee6; --gold: #ffd24a; --gold2: #e8a81a; --green: #4be08a; --red: #ff5a73; --blue: #4da3ff; --pink: #ff7ad9; --teal: #2de2c6;
  --paper: #f7ecd2; --paper2: #ecdcb4; --paper-ink: #3b2b18; --paper-line: #c8b080;
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  --r: 16px; --safe-t: env(safe-area-inset-top, 0px); --safe-b: max(env(safe-area-inset-bottom, 0px), var(--hub-safe, 0px), var(--vp-hidden, 0px)); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  /* diagrammes UML (clair : les schémas sont toujours posés sur du papier) */
  --dg-bg: #ffffff; --dg-ink: #2a211d; --dg-stroke: #6e2a1a; --dg-class-fill: #fffbe0; --dg-client-fill: #f1efe9; --dg-client-stroke: #6b675d;
  --dg-note-fill: #fffdf1; --dg-note-stroke: #a08a35; --dg-lane: #9a958a; --dg-muted: #6a6459;
  --t-blue-f: #e4edff; --t-blue-s: #2f5fc4; --t-green-f: #e1f4e7; --t-green-s: #25804a; --t-orange-f: #fff0db; --t-orange-s: #bd6410;
  --t-grey-f: #f1efe9; --t-grey-s: #6b675d; --t-purple-f: #efe8fb; --t-purple-s: #7347c0; --t-red-f: #fde7e4; --t-red-s: #bf3a2b;
  --font-ui: var(--font); --font-mono: var(--mono);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { min-height: -webkit-fill-available; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--font); overscroll-behavior: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--blue); }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .9em; background: rgba(255, 255, 255, .13); padding: .05em .35em; border-radius: 5px; }
.ic { width: 1.3em; height: 1.3em; vertical-align: -0.3em; flex: none; }
* { scrollbar-width: thin; scrollbar-color: #5a4eb0 transparent; }

/* ----- disposition ----- */
/* 100lvh = la plus grande hauteur possible : le jeu passe aussi sous la barre du navigateur (iPhone) au lieu de laisser une bande noire ; les commandes remontent via --safe-b */
#app { position: fixed; left: 0; top: 0; right: 0; bottom: 0; min-height: 100vh; min-height: 100lvh; display: flex; flex-direction: column; background: #14102a; }
/* web app iPhone : document un peu plus haut que l'écran, défilé de 80 px par main.js, ce qui fait passer iOS à la fenêtre complète (le jeu est en position fixe, rien ne bouge) */
html.ios-fill, html.ios-fill body { overflow: auto; height: calc(100% + 240px); height: calc(100lvh + 240px); overscroll-behavior: none; }
/* web app iPhone dont la fenêtre s'arrête avant le bas de l'écran (iOS ne peint rien en dessous) : le bas du jeu se fond dans la bande */
html.vp-short #app::after { content: ''; position: absolute; left: 0; right: 0; bottom: var(--vp-hidden, 0px); height: 30px; background: linear-gradient(rgba(20, 16, 42, 0), #14102a); pointer-events: none; z-index: 45; }
#stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: #14102a; }
#game { position: absolute; inset: 0; display: block; image-rendering: pixelated; touch-action: none; }
#pad { display: none; }
body.touch #pad { display: flex; }
/* --hub-dock : hauteur de la barre flottante du hub quand le jeu est intégré dedans (0 sinon) */
@media (orientation: portrait) {
  /* la manette flotte par-dessus la carte (aucun fond) ; la caméra garde le joueur au-dessus (voir world.js) */
  body.touch #pad { position: absolute; left: 0; right: 0; bottom: 0; height: calc(190px + var(--hub-dock, 0px)); pointer-events: none; align-items: flex-end; justify-content: space-between; padding: 0 calc(14px + var(--safe-r)) calc(10px + var(--safe-b) + var(--hub-dock, 0px)) calc(14px + var(--safe-l)); z-index: 5; }
  body.touch #pad > * { pointer-events: auto; }
  body.touch #dpad { opacity: .8; } body.touch #pad-btns { opacity: .88; }
  /* COURIR ne prend pas de place dans la rangée (sinon A débordait de l'écran sur les téléphones de 390 px) */
  body.touch #pad-mid { flex: 0 0 0; width: 0; min-width: 0; position: relative; align-self: stretch; padding: 0; }
  body.touch #btn-run { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); white-space: nowrap; }
}
@media (orientation: landscape) {
  body.touch #pad { position: absolute; inset: 0; pointer-events: none; align-items: flex-end; justify-content: space-between; padding: 0 calc(18px + var(--safe-r)) calc(14px + var(--safe-b) + var(--hub-dock, 0px)) calc(18px + var(--safe-l)); z-index: 5; }
  body.touch #pad > * { pointer-events: auto; }
  body.touch #dpad { opacity: .78; } body.touch #pad-btns { opacity: .85; }
}
#layers { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
#layers > * { pointer-events: auto; }

/* ----- manette ----- */
#dpad { position: relative; width: 150px; height: 150px; flex: none; touch-action: none; }
#dpad::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a3f9a, #251d58); border: 4px solid #1d1633; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .15), 0 5px 0 rgba(0, 0, 0, .4); }
#dpad .pk { position: absolute; width: 0; height: 0; border: 15px solid transparent; opacity: .55; transition: opacity .06s; }
#dpad .pk.on { opacity: 1; }
#dpad .up { left: 50%; top: 14px; margin-left: -15px; border-bottom: 22px solid #f6f2ff; border-top: 0; }
#dpad .dn { left: 50%; bottom: 14px; margin-left: -15px; border-top: 22px solid #f6f2ff; border-bottom: 0; }
#dpad .lf { top: 50%; left: 14px; margin-top: -15px; border-right: 22px solid #f6f2ff; border-left: 0; }
#dpad .rt { top: 50%; right: 14px; margin-top: -15px; border-left: 22px solid #f6f2ff; border-right: 0; }
#dpad .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8a7be0, #4a3f9a); border: 3px solid #1d1633; transition: transform .05s; }
#pad-mid { flex: 1; display: flex; justify-content: center; align-items: flex-end; align-self: flex-end; padding-bottom: 6px; }
#pad-btns { position: relative; width: 150px; height: 130px; flex: none; }
.pbtn { border-radius: 50%; font: 900 24px var(--font); color: #fff; border: 4px solid #1d1633; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .3), 0 5px 0 rgba(0, 0, 0, .45); touch-action: none; }
.pbtn:active, .pbtn.on { transform: translateY(3px); box-shadow: inset 0 4px 0 rgba(255, 255, 255, .2), 0 2px 0 rgba(0, 0, 0, .45); }
.pbtn.a { position: absolute; right: 0; top: 8px; width: 78px; height: 78px; background: radial-gradient(circle at 35% 30%, #ff8aa0, #d63e56); font-size: 30px; }
.pbtn.b { position: absolute; left: 0; bottom: 4px; width: 62px; height: 62px; background: radial-gradient(circle at 35% 30%, #ffe08a, #e8a81a); color: #5a3a00; }
.pbtn.small { border-radius: 14px; width: auto; padding: 8px 14px; font-size: 12px; letter-spacing: .08em; background: #3a3080; opacity: .85; }
.pbtn.small.on { background: #ffb02e; color: #3a2200; }

/* ----- HUD ----- */
#hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); pointer-events: none; z-index: 6; }
#hud > div { display: flex; gap: 6px; align-items: center; min-width: 0; }
.hud-r { justify-content: flex-end; flex: 1; }
.pill { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 8px; border-radius: 19px; background: rgba(33, 26, 74, .9); border: 3px solid #1d1633; box-shadow: 0 3px 0 rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .12); font-weight: 800; font-size: 15px; white-space: nowrap; transition: transform .1s; }
.pill:active { transform: translateY(2px); }
.pill .pi { display: inline-flex; font-size: 20px; }
.pill b { font-variant-numeric: tabular-nums; }
.pill.bump { animation: bump .35s; }
.pill.round { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 14px; }
.pill.obj { max-width: min(300px, 52vw); height: auto; min-height: 38px; padding: 5px 12px 5px 8px; border-radius: 16px; white-space: normal; font-weight: 700; font-size: 12.5px; line-height: 1.25; text-align: left; }
.pill.obj .pi { color: var(--gold); }
.pill.obj.hide { display: none; }
@keyframes bump { 40% { transform: scale(1.18); } }
#banner { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translate(-50%, -20px); opacity: 0; pointer-events: none; z-index: 7; text-align: center; padding: 8px 22px; border-radius: 14px; background: rgba(20, 16, 42, .92); border: 3px solid #ffd24a; box-shadow: 0 5px 0 rgba(0, 0, 0, .4); font-weight: 900; font-size: 20px; letter-spacing: .02em; text-shadow: 0 2px 0 #1d1633; transition: opacity .35s, transform .35s; max-width: 90vw; }
#banner small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; text-shadow: none; }
#banner.show { opacity: 1; transform: translate(-50%, 0); }
#toasts { position: absolute; left: 50%; bottom: calc(14px + var(--hub-dock, 0px)); transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column-reverse; gap: 8px; align-items: center; pointer-events: none; width: min(520px, 94vw); }
.toast { background: #2c2462; border: 3px solid #1d1633; outline: 2px solid var(--blue); padding: 8px 16px; border-radius: 14px; font-weight: 700; font-size: 14.5px; box-shadow: 0 4px 0 rgba(0, 0, 0, .4); animation: toast .25s ease-out; max-width: 100%; text-align: center; }
.toast.good { outline-color: var(--green); } .toast.bad { outline-color: var(--red); } .toast.gold { outline-color: var(--gold); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .3s; }
@keyframes toast { from { transform: translateY(14px) scale(.9); opacity: 0; } }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 30; transition: opacity .28s; }
#fade.on { opacity: 1; pointer-events: auto; }
#flash { position: absolute; inset: 0; z-index: 31; pointer-events: none; opacity: 0; background: #fff; }
#flash.go { animation: flash .9s steps(1) 1; }
@keyframes flash { 0%, 20%, 40% { opacity: 1; } 10%, 30%, 50% { opacity: 0; } 60% { opacity: 1; } 100% { opacity: 0; } }

/* ----- dialogues ----- */
#dialog { position: absolute; left: 50%; bottom: calc(12px + var(--safe-b) + var(--hub-dock, 0px)); transform: translateX(-50%); width: min(720px, calc(100% - 20px)); z-index: 12; padding: 18px 20px 16px; border-radius: 18px; background: linear-gradient(#fffdf4, #f7ecd2); color: var(--paper-ink); border: 4px solid #1d1633; box-shadow: 0 6px 0 rgba(0, 0, 0, .45), inset 0 0 0 3px #e0c98c; min-height: 104px; cursor: pointer; animation: pop .16s ease-out; }
.dlg-name { position: absolute; left: 14px; top: -17px; padding: 3px 14px; border-radius: 10px; border: 3px solid #1d1633; background: var(--c, #4a6fd0); color: #fff; font-weight: 900; font-size: 14px; letter-spacing: .03em; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.dlg-name:empty { display: none; }
.dlg-text { font-size: 18px; font-weight: 700; line-height: 1.4; min-height: 50px; white-space: pre-wrap; }
.dlg-text b, .dlg-text strong { color: #a02e42; }
.dlg-text code { background: rgba(59, 43, 24, .12); color: #2a3a8a; }
.dlg-next { position: absolute; right: 18px; bottom: 10px; width: 0; height: 0; border: 9px solid transparent; border-top: 12px solid #d63e56; border-bottom: 0; animation: bob 0.7s infinite alternate; }
.dlg-next.hide { display: none; }
@keyframes bob { to { transform: translateY(4px); } }
.dlg-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dlg-choices:empty { display: none; }
.dlg-choices button { text-align: left; padding: 10px 16px; border-radius: 12px; background: #fff; border: 3px solid #1d1633; color: var(--paper-ink); font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.dlg-choices button:hover, .dlg-choices button.sel { background: #ffe9a0; transform: translateX(4px); }
.dlg-choices button:active { transform: translateY(2px); }
@keyframes pop { from { transform: translateX(-50%) scale(.92); opacity: 0; } }

/* ----- boutons génériques ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 14px; font-weight: 900; font-size: 15px; background: linear-gradient(#5a4eb0, #3a3080); border: 3px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .22); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); transition: transform .08s, filter .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { background: linear-gradient(#ffd24a, #e8a81a); color: #4a2e00; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.btn.green { background: linear-gradient(#4be08a, #1fb870); color: #022a18; text-shadow: 0 1px 0 rgba(255, 255, 255, .35); }
.btn.red { background: linear-gradient(#ff7a90, #d63e56); }
.btn.ghost { background: rgba(255, 255, 255, .08); box-shadow: none; border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 11px; }
.btn.wide { width: 100%; }

/* ----- écrans plein cadre ----- */
.screen { position: absolute; inset: 0; z-index: 41; display: flex; flex-direction: column; background: radial-gradient(900px 500px at 80% -10%, rgba(255, 122, 217, .13), transparent), radial-gradient(800px 500px at 0 0, rgba(77, 163, 255, .15), transparent), var(--bg); animation: fadein .18s; padding-top: var(--safe-t); }
.screen.light { background: var(--paper); color: var(--paper-ink); }
@keyframes fadein { from { opacity: 0; transform: scale(.985); } }
.s-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(#352c78, #261f58); border-bottom: 4px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); z-index: 2; }
.s-head h2 { margin: 0; flex: 1; font-size: 19px; font-weight: 900; letter-spacing: .02em; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); display: flex; align-items: center; gap: 8px; min-width: 0; }
.s-head .x { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: #d63e56; border: 3px solid #1d1633; box-shadow: 0 3px 0 rgba(0, 0, 0, .4); color: #fff; font-size: 20px; flex: none; }
.s-head .x:active { transform: translateY(2px); }
.s-head .meta { font-size: 13px; color: var(--muted); font-weight: 700; display: flex; gap: 10px; align-items: center; }
.s-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 14px calc(18px + var(--safe-b) + var(--hub-dock, 0px)); -webkit-overflow-scrolling: touch; }
.s-body.pad0 { padding: 0; }
.sheet-wrap { position: absolute; inset: 0; z-index: 41; background: rgba(8, 5, 24, .6); display: flex; align-items: flex-end; justify-content: center; animation: fadein .15s; }
.sheet { width: min(640px, 100%); max-height: 86%; display: flex; flex-direction: column; background: var(--bg); border: 4px solid #1d1633; border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -6px 0 rgba(0, 0, 0, .3); animation: up .22s ease-out; padding-bottom: var(--hub-dock, 0px); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .s-head { border-radius: 18px 18px 0 0; }
.center-modal { position: absolute; inset: 0; z-index: 45; background: rgba(8, 5, 24, .72); display: flex; align-items: center; justify-content: center; padding: 14px; animation: fadein .15s; }
.cm { width: min(460px, 100%); max-height: 92%; overflow: auto; background: var(--panel); border: 4px solid #1d1633; border-radius: 20px; padding: 18px; box-shadow: 0 8px 0 rgba(0, 0, 0, .4); text-align: center; animation: popm .2s ease-out; }
.cm h3 { margin: 4px 0 8px; font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.cm p { margin: 8px 0; color: var(--muted); font-weight: 600; }
.cm .row { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
@keyframes popm { from { transform: scale(.85); opacity: 0; } }

/* ----- menu principal ----- */
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 560px; margin: 0 auto; }
.mi { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px 8px 12px; border-radius: 18px; background: linear-gradient(#352c78, #2a2262); border: 4px solid #1d1633; box-shadow: 0 5px 0 rgba(0, 0, 0, .4), inset 0 3px 0 rgba(255, 255, 255, .14); font-weight: 900; font-size: 15px; text-align: center; transition: transform .1s; min-height: 108px; }
.mi:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.mi .big { font-size: 38px; display: flex; }
.mi .big .ic { width: 1em; height: 1em; }
.mi small { font-size: 12px; color: var(--muted); font-weight: 700; }
.mi .dot { position: absolute; top: 8px; right: 10px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--red); border: 2px solid #1d1633; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.mi.wide { grid-column: 1 / -1; min-height: 64px; flex-direction: row; gap: 12px; }
.mi.wide .big { font-size: 28px; }

/* ----- composants ----- */
.card { background: var(--panel); border: 3px solid #1d1633; border-radius: var(--r); padding: 12px 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--c, #5a4eb0); color: #fff; border: 2px solid #1d1633; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.chip.dim { background: #3a3358; color: var(--muted); }
.bar { height: 14px; border-radius: 8px; background: #14102a; border: 3px solid #1d1633; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe08a, #e8a81a); transition: width .4s; }
.h3 { margin: 18px 0 8px; font-size: 13px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-weight: 700; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.tabs button { flex: none; padding: 8px 14px; border-radius: 12px; background: #2a2262; border: 3px solid #1d1633; font-weight: 800; font-size: 13.5px; }
.tabs button.on { background: var(--gold); color: #4a2e00; }

/* ----- écran titre ----- */
.title { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden; background: linear-gradient(#2a1f6a 0%, #5a3ea8 45%, #e07ab8 78%, #ffb870 100%); }
.title canvas { position: absolute; left: 0; bottom: var(--vp-hidden, 0px); width: 100%; height: 46%; pointer-events: none; }
.title .logo { position: relative; z-index: 2; font-weight: 900; line-height: .92; letter-spacing: .02em; font-size: clamp(42px, 11vw, 92px); color: #ffd24a; text-shadow: 0 5px 0 #a8501a, 0 9px 0 #1d1633, 0 0 40px rgba(255, 210, 74, .5); -webkit-text-stroke: 3px #1d1633; paint-order: stroke fill; transform: rotate(-3deg); animation: logo 3s ease-in-out infinite alternate; }
.title .logo small { display: block; font-size: .36em; color: #fff; text-shadow: 0 3px 0 #1d1633; letter-spacing: .12em; margin-top: 10px; -webkit-text-stroke: 2px #1d1633; }
@keyframes logo { to { transform: rotate(-3deg) translateY(-8px) scale(1.02); } }
.title .menu { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 12px; margin-top: 34px; width: min(300px, 80vw); }
.title .menu .btn { padding: 14px; font-size: 18px; }
.title .menu .btn.ghost { background: rgba(34, 24, 86, .9); border-color: #6a5ec8; padding: 10px; font-size: 16px; }
@media (max-height: 760px) { .title .menu { gap: 9px; margin-top: 22px; } .title .menu .btn { padding: 11px; font-size: 17px; } .title .menu .btn.ghost { padding: 8px; font-size: 15px; } }
.title .credit { position: absolute; z-index: 2; top: calc(12px + var(--safe-t)); left: 0; right: 0; padding: 0 10px; font-size: 12px; color: rgba(255, 255, 255, .85); font-weight: 700; text-shadow: 0 2px 0 #1d1633; }
.title .stars { position: absolute; inset: 0; background-image: radial-gradient(2px 2px at 20% 15%, #fff, transparent), radial-gradient(2px 2px at 70% 25%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 8%, #fff, transparent), radial-gradient(2px 2px at 85% 10%, #fff, transparent), radial-gradient(1.5px 1.5px at 10% 35%, #fff, transparent), radial-gradient(2px 2px at 58% 40%, #fff9, transparent); animation: twinkle 2.4s infinite alternate; }
@keyframes twinkle { to { opacity: .45; } }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin: 10px 0; }
.field label { font-weight: 900; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field input { font: 800 20px var(--font); padding: 10px 14px; border-radius: 12px; border: 3px solid #1d1633; background: #fff; color: #1d1633; outline: none; user-select: text; -webkit-user-select: text; }
.field input:focus { box-shadow: 0 0 0 4px rgba(255, 210, 74, .6); }
.looks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.look { border-radius: 14px; border: 4px solid #1d1633; background: #3a3080; padding: 6px 2px 2px; display: flex; flex-direction: column; align-items: center; }
.look.on { background: var(--gold); box-shadow: 0 0 0 3px #fff; }
.look canvas { width: 36px; height: 64px; image-rendering: pixelated; }
.hero-prev { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 14px; padding: 14px 0 10px; border-radius: 18px; background: radial-gradient(ellipse at 50% 85%, rgba(255, 210, 74, .25), transparent 65%), #231b52; border: 3px solid #1d1633; }
.hero-prev canvas { width: 90px; height: 160px; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .35)); animation: bobt 1s ease-in-out infinite alternate; }
.hero-nm { font-weight: 900; font-size: 20px; color: var(--gold); text-shadow: 0 2px 0 #1d1633; }

/* ----- combat ----- */
.screen.battle { padding-top: 0; background: #1b1540; }
.battle .b-root { display: flex; flex-direction: column; height: 100%; }
.bg-grass .b-arena { background: repeating-linear-gradient(100deg, rgba(255, 255, 255, .09) 0 14px, transparent 14px 38px) bottom / 100% 54% no-repeat, radial-gradient(circle at 80% 18%, #fff7c2 0 4%, transparent 4.5%), linear-gradient(#7fcfff 0%, #c9efff 46%, #8fdc62 46%, #55a63a 100%); }
.bg-dojo .b-arena { background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .16) 0 3px, transparent 3px 46px) bottom / 100% 54% no-repeat, linear-gradient(#2a1414 0%, #5a2e22 46%, #c08a52 46%, #8a5a33 100%); }
.bg-tower .b-arena { background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .22) 0 3px, transparent 3px 60px) bottom / 100% 54% no-repeat, linear-gradient(#1c2046 0%, #3d4678 46%, #707a98 46%, #4a526a 100%); }
.bg-temple .b-arena { background: repeating-linear-gradient(90deg, rgba(60, 40, 130, .14) 0 3px, transparent 3px 56px) bottom / 100% 54% no-repeat, linear-gradient(#4a2e98 0%, #a87ae0 46%, #e8e4f0 46%, #aab3cc 100%); }
.bg-academy .b-arena { background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .18) 0 3px, transparent 3px 52px) bottom / 100% 54% no-repeat, linear-gradient(#241c52 0%, #4a3f9a 46%, #c9a56a 46%, #8a6a3a 100%); }
.b-arena::before { content: ""; position: absolute; left: 0; right: 0; top: 46%; height: 6px; background: rgba(0, 0, 0, .18); pointer-events: none; }
.b-arena::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 46%; pointer-events: none; }
.bg-grass .b-arena::after { background: radial-gradient(ellipse 36% 52% at 12% 100%, #74c654 0 99%, transparent 100%), radial-gradient(ellipse 46% 70% at 84% 100%, #62b64a 0 99%, transparent 100%), radial-gradient(ellipse 15% 9% at 28% 30%, rgba(255, 255, 255, .92) 0 99%, transparent 100%), radial-gradient(ellipse 11% 7% at 35% 34%, rgba(255, 255, 255, .88) 0 99%, transparent 100%), radial-gradient(ellipse 14% 8% at 62% 44%, rgba(255, 255, 255, .85) 0 99%, transparent 100%); }
.bg-temple .b-arena::after { background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(255, 255, 255, .26) 14px 30px, rgba(60, 30, 130, .4) 30px 34px, transparent 34px 84px), radial-gradient(ellipse 50% 70% at 50% 100%, rgba(255, 240, 200, .35), transparent 70%); }
.bg-tower .b-arena::after { background: radial-gradient(circle at 14% 10%, #ffe9a0 0 7px, transparent 8px), radial-gradient(circle at 24% 26%, #fff 0 1.6px, transparent 2.2px), radial-gradient(circle at 70% 14%, #fff 0 1.6px, transparent 2.2px), radial-gradient(circle at 46% 34%, #fff 0 1.2px, transparent 1.8px), radial-gradient(circle at 90% 38%, #fff 0 1.2px, transparent 1.8px), radial-gradient(circle at 56% 20%, #fff 0 1.2px, transparent 1.8px), linear-gradient(90deg, transparent 0 6%, #232850 6% 13%, transparent 13% 58%, #232850 58% 64%, transparent 64% 70%, #232850 70% 80%, transparent 80%) bottom / 100% 62% no-repeat; }
.bg-dojo .b-arena::after { background: repeating-linear-gradient(90deg, rgba(255, 226, 170, .14) 0 54px, rgba(30, 10, 10, .45) 54px 58px), linear-gradient(transparent 0 52%, rgba(30, 10, 10, .45) 52% 58%, transparent 58%); }
.bg-academy .b-arena::after { background: repeating-linear-gradient(90deg, #b8503a 0 7px, #3c6ac8 7px 14px, #e0b43a 14px 19px, #4aa05a 19px 26px, #8a4ab8 26px 31px, #d8d0b0 31px 34px) bottom / 100% 34% no-repeat, linear-gradient(transparent 62%, #6a4a28 62% 67%, transparent 67%); }
.b-foe, .b-me { position: relative; z-index: 1; }
.b-top { position: absolute; z-index: 3; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 10px 0; pointer-events: none; }
.b-top > * { pointer-events: auto; }
.b-title { flex: 1; text-align: center; font-weight: 900; font-size: 14px; text-shadow: 0 2px 0 #1d1633, 0 0 6px #1d1633; letter-spacing: .03em; }
.b-hp { display: flex; gap: 1px; background: rgba(20, 16, 42, .85); border: 3px solid #1d1633; border-radius: 14px; padding: 3px 8px; font-size: 20px; min-height: 36px; align-items: center; flex-wrap: wrap; max-width: 46%; justify-content: flex-end; }
.b-arena { position: relative; flex: 0 0 clamp(210px, 38vh, 340px); transition: flex-basis .3s; display: flex; flex-direction: column; justify-content: space-between; padding: calc(52px + var(--safe-t)) 12px 6px; overflow: hidden; }
.screen.compact .b-arena { flex-basis: 150px; padding-top: calc(48px + var(--safe-t)); }
.b-foe, .b-me { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 46%; min-height: 0; }
.b-info { background: rgba(255, 253, 244, .95); color: var(--paper-ink); border: 3px solid #1d1633; border-radius: 14px; padding: 6px 12px; min-width: 150px; max-width: 58%; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); align-self: flex-start; }
.b-me .b-info { align-self: flex-end; }
.b-name { font-weight: 900; font-size: 15px; line-height: 1.2; }
.b-sub { display: flex; gap: 6px; align-items: center; font-size: 11.5px; font-weight: 800; margin: 3px 0; flex-wrap: wrap; }
.b-sub .own { color: #6a5a40; }
.b-segs { display: flex; gap: 3px; margin-top: 4px; }
.b-segs i { flex: 1; height: 12px; border-radius: 5px; background: #cfc6aa; border: 2px solid #1d1633; transition: background .3s, transform .3s; }
.b-segs i.on { background: linear-gradient(#ff8aa0, #d63e56); }
.screen.compact .b-info { padding: 3px 10px; }
.screen.compact .b-sub { display: none; }
.b-spr { position: relative; height: 100%; aspect-ratio: 1; flex: none; }
.b-plat { position: absolute; left: 4%; right: 4%; bottom: 0; height: 22%; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, .45), rgba(0, 0, 0, .28) 70%); border: 3px solid rgba(29, 22, 51, .45); }
.b-cv { position: absolute; inset: 0; width: 100%; height: 100%; }
.b-fx { position: absolute; inset: 0; pointer-events: none; }
.b-pop { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); font-weight: 900; font-size: 22px; white-space: nowrap; text-shadow: 0 2px 0 #1d1633, 0 0 8px #1d1633; animation: popup 1s ease-out forwards; }
.b-pop.good { color: var(--green); } .b-pop.bad { color: var(--red); }
@keyframes popup { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -4px) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -34px) scale(1); } }
.b-me .b-spr.lunge { animation: lunge .5s ease-in-out; }
.b-foe .b-spr.lunge-foe { animation: lungeF .5s ease-in-out; }
.b-spr.shake { animation: shake .5s; }
@keyframes lunge { 40% { transform: translate(60px, -34px) scale(1.12); } }
@keyframes lungeF { 40% { transform: translate(-60px, 34px) scale(1.12); } }
@keyframes shake { 20% { transform: translateX(-9px); filter: brightness(2); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); filter: brightness(1.6); } 80% { transform: translateX(4px); } }
.b-cv.faint { animation: faint .8s forwards; }
.b-cv.captured { animation: captured .7s forwards; }
@keyframes faint { to { transform: translateY(40%) scale(.7); opacity: 0; } }
@keyframes captured { to { transform: scale(.1); opacity: 0; } }
.b-crate { position: absolute; left: 50%; top: 0; width: 60%; transform: translateX(-50%); font-size: 80px; animation: crateFall 1.4s ease-in forwards; z-index: 2; }
.b-crate .ic { width: 100%; height: auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .35)); }
@keyframes crateFall { 0% { top: -80%; } 40% { top: 26%; } 50% { top: 18%; } 60% { top: 28%; } 70% { top: 22%; transform: translateX(-50%) rotate(-8deg); } 80% { top: 28%; transform: translateX(-50%) rotate(8deg); } 100% { top: 26%; transform: translateX(-50%) rotate(0); } }
.b-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; background: #1b1540; border-top: 5px solid #1d1633; padding: 12px 14px calc(14px + var(--safe-b) + var(--hub-dock, 0px)); display: flex; flex-direction: column; gap: 10px; box-shadow: inset 0 4px 0 rgba(255, 255, 255, .06); }
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 800; color: var(--muted); font-size: 13.5px; min-height: 30px; }
.q-badge b { color: var(--gold); font-size: 16px; }
.q-badge .kd { margin-left: 6px; padding: 2px 9px; border-radius: 99px; background: #2c2462; border: 2px solid #1d1633; font-size: 11.5px; color: var(--ink); }
.q-text { font-size: 18px; font-weight: 800; line-height: 1.38; }
.q-intro { font-size: 15.5px; font-weight: 600; line-height: 1.45; }
.q-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .q-opts { grid-template-columns: 1fr; } }
.q-opt { text-align: left; display: flex; gap: 10px; align-items: center; padding: 11px 13px; border-radius: 14px; background: linear-gradient(#3a3080, #2c2462); border: 3px solid #1d1633; font-weight: 700; font-size: 15.5px; box-shadow: 0 4px 0 rgba(0, 0, 0, .4); transition: transform .08s; line-height: 1.3; }
.q-opt:hover:not(:disabled) { filter: brightness(1.15); }
.q-opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.q-opt .ol { width: 28px; height: 28px; border-radius: 9px; background: #1d1633; display: flex; align-items: center; justify-content: center; font-weight: 900; flex: none; font-size: 14px; }
.q-opt .ot { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.q-opt.right { background: linear-gradient(#4be08a, #1fb870); color: #022a18; }
.q-opt.right .ol { background: #0b5a36; color: #fff; }
.q-opt.wrong { background: linear-gradient(#ff7a90, #d63e56); color: #fff; }
.q-opt.wrong .ol { color: #fff; }
.q-opt.gone { opacity: .22; text-decoration: line-through; }
.q-opt:disabled { cursor: default; }
.q-diagram { background: #fff; border-radius: 12px; padding: 8px; border: 3px solid #1d1633; max-width: 460px; align-self: center; width: 100%; }
.q-diagram svg { display: block; width: 100%; height: auto; }
.code { font: 13.5px/1.55 var(--mono); background: #0e0b22; border: 3px solid #1d1633; border-radius: 12px; padding: 12px; overflow-x: auto; color: #e8e4ff; white-space: pre; margin: 0; user-select: text; -webkit-user-select: text; }
.code .kw { color: #f2a65a; font-weight: 700; } .code .st { color: #8fd18f; } .code .cm { color: #8a96b8; font-style: italic; } .code .ty { color: #7fb4ff; }
.code select { font: inherit; font-size: 13px; background: #2c2462; color: #ffe08a; border: 2px dashed #ffd24a; border-radius: 7px; padding: 1px 4px; max-width: 220px; }
.code select.ok { border: 2px solid var(--green); color: #b8ffd4; background: #12361f; } .code select.bad { border: 2px solid var(--red); color: #ffc0c8; background: #3a1620; }
.o-line, .t-line { min-height: 56px; border: 3px dashed #5a4eb0; border-radius: 12px; padding: 8px; display: flex; gap: 6px; background: rgba(255, 255, 255, .03); }
.o-line { flex-direction: column; } .t-line { flex-wrap: wrap; }
.o-line:empty::before, .t-line:empty::before { content: attr(data-ph); color: var(--muted); font-weight: 700; font-size: 13.5px; }
.o-bank { display: flex; flex-direction: column; gap: 6px; } .t-bank { display: flex; flex-wrap: wrap; gap: 6px; }
.o-chip { font: 13px/1.4 var(--mono); text-align: left; padding: 7px 10px; border-radius: 10px; background: #2c2462; border: 3px solid #1d1633; color: #fff; white-space: pre; box-shadow: 0 3px 0 rgba(0, 0, 0, .4); }
.t-bank .o-chip, .t-line .o-chip { text-align: center; font-size: 14px; font-weight: 800; }
.o-chip.ok { background: #1c5a38; border-color: var(--green); } .o-chip.bad { background: #5a1c28; border-color: var(--red); }
.q-valid { display: flex; justify-content: flex-end; }
.q-fb-in { border-radius: 14px; padding: 10px 14px; font-weight: 600; font-size: 14.5px; line-height: 1.45; border: 3px solid #1d1633; animation: fadein .2s; }
.q-fb-in.good { background: rgba(75, 224, 138, .16); border-color: #1d7a4a; } .q-fb-in.bad { background: rgba(255, 90, 115, .16); border-color: #a02e42; }
.q-fb-in .fh { display: block; font-size: 16px; font-weight: 900; margin-bottom: 2px; }
.q-fb-in.good .fh { color: var(--green); } .q-fb-in.bad .fh { color: var(--red); }
.q-fb-in .fe { color: #e2dcff; }
.q-foot { display: flex; justify-content: flex-end; gap: 8px; }
/* téléphone en paysage : l'arène à gauche, la question à droite */
@media (orientation: landscape) and (max-height: 520px) {
  .battle .b-root { flex-direction: row; }
  .b-arena, .screen.compact .b-arena { flex: 0 0 42%; transition: none; padding: calc(46px + var(--safe-t)) 8px 6px; }
  .b-top { right: auto; width: 42%; padding-right: 0; }
  .b-title { font-size: 12px; }
  .b-hp { max-width: 40%; }
  .b-panel { flex: 1 1 0; border-top: 0; border-left: 5px solid #1d1633; padding-right: calc(14px + var(--safe-r, 0px)); }
  .b-info { min-width: 120px; padding: 4px 8px; }
  .b-name { font-size: 13px; }
  .q-opts { grid-template-columns: 1fr; gap: 6px; }
  .q-opt { padding: 7px 10px; font-size: 14px; }
}
.b-result { text-align: center; padding: 6px; font-weight: 800; }
.b-result .big { font-size: 46px; font-weight: 900; letter-spacing: .05em; text-shadow: 0 4px 0 #1d1633; animation: bigin .5s ease-out; }
.b-result.win .big { color: var(--gold); } .b-result.lose .big { color: var(--red); }
@keyframes bigin { from { transform: scale(2.4); opacity: 0; } }

/* ----- livre de cours (papier) ----- */
.screen.book .s-head { background: linear-gradient(var(--bk, #4da3ff), #261f58); }
.pg-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 16px 24px; background: repeating-linear-gradient(transparent 0 31px, rgba(150, 110, 60, .09) 31px 32px), var(--paper); }
.pg { max-width: 760px; margin: 0 auto; color: var(--paper-ink); animation: pgin .25s ease-out; }
.pg.slide-l { animation: pgl .28s ease-out; } .pg.slide-r { animation: pgr .28s ease-out; }
@keyframes pgl { from { transform: translateX(40px); opacity: 0; } } @keyframes pgr { from { transform: translateX(-40px); opacity: 0; } } @keyframes pgin { from { opacity: 0; } }
.pg-top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #8a6a3a; margin-bottom: 4px; }
.pg-n { background: var(--bk, #4da3ff); color: #fff; padding: 2px 10px; border-radius: 99px; border: 2px solid #1d1633; letter-spacing: .04em; }
.pg h3 { margin: 4px 0 12px; font-size: 26px; font-weight: 900; line-height: 1.15; color: #2a1d3a; }
.pg h4 { margin: 18px 0 8px; font-size: 17px; font-weight: 900; color: #4a2d7a; }
.pg h5 { margin: 0 0 6px; font-size: 13px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.pg p, .pg li { font-size: 17px; line-height: 1.58; font-weight: 500; }
.pg p { margin: 0 0 12px; } .pg ul, .pg ol { margin: 0 0 12px; padding-left: 22px; } .pg li { margin: 5px 0; }
.pg strong, .pg b { color: #8a2a3a; font-weight: 800; } .pg em { color: #4a3d82; }
.pg code { background: rgba(59, 43, 24, .1); color: #2a3a8a; font-weight: 600; user-select: text; }
.pg .lead { font-size: 21px; font-weight: 700; line-height: 1.45; color: #2a1d3a; }
.pg .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pg .metaphor { background: #e4f3ff; border: 3px dashed #4da3ff; border-radius: 14px; padding: 12px 16px; margin: 14px 0; font-size: 16px; line-height: 1.5; }
.pg .metaphor b { display: block; color: #1f6fc4; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.pg .tip { background: #fff3c4; border: 3px solid #e8a81a; border-left-width: 9px; border-radius: 12px; padding: 10px 14px; margin: 12px 0; font-size: 16px; line-height: 1.5; }
.pg .tip b:first-child { display: block; color: #a86a00; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.pg .naive, .pg .sol, .pg .when, .pg .pros, .pg .cons { border-radius: 14px; padding: 12px 16px; border: 3px solid #1d1633; margin: 0 0 12px; }
.pg .naive { background: #ffe4e0; } .pg .naive h5 { color: #bf3a2b; } .pg .sol { background: #e1f4e7; } .pg .sol h5 { color: #25804a; }
.pg .when { background: #efe8fb; } .pg .when h5 { color: #7347c0; }
.pg .pros { background: #e1f4e7; } .pg .pros h5 { color: #25804a; } .pg .cons { background: #ffe4e0; } .pg .cons h5 { color: #bf3a2b; }
.pg .proscons, .pg .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 600px) { .pg .proscons, .pg .cols { grid-template-columns: 1fr; } }
.pg .syntax { background: #2a2347; color: #f6f2ff; border: 3px solid #1d1633; border-radius: 14px; padding: 10px 14px; margin: 12px 0; }
.pg .syntax .st { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #ffd24a; font-weight: 900; margin-bottom: 4px; }
.pg .syntax pre { margin: 4px 0; font: 14px/1.6 var(--mono); color: #ffe9a0; white-space: pre-wrap; user-select: text; }
.pg .syntax .sx { font-size: 15px; color: #e2dcff; margin-top: 6px; line-height: 1.5; } .pg .syntax .sx strong { color: #ffd24a; } .pg .syntax .sx code { background: rgba(255, 255, 255, .15); color: #fff; }
.pg .tablewrap { overflow-x: auto; margin: 10px 0 14px; border-radius: 12px; border: 3px solid #1d1633; background: #fffdf4; }
.pg table { border-collapse: collapse; width: 100%; font-size: 15px; }
.pg th { background: #3a3080; color: #fff; text-align: left; padding: 8px 12px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.pg td { padding: 8px 12px; border-top: 1px solid #e0d2a8; vertical-align: top; line-height: 1.45; }
.pg tr:nth-child(even) td { background: #fbf2d9; }
.pg .fig { margin: 12px 0 14px; }
.pg .fig-title { font-weight: 800; font-size: 14.5px; margin-bottom: 6px; color: #4a2d7a; }
.pg .fig-box { background: #fff; border: 3px solid #1d1633; border-radius: 14px; padding: 8px; box-shadow: 0 4px 0 rgba(0, 0, 0, .2); }
.pg .fig-box.zoomable { cursor: zoom-in; }
.pg .fig-box svg { display: block; width: 100%; height: auto; }
.pg .fig-zoom { text-align: center; font-size: 12px; color: #8a6a3a; font-weight: 700; margin-top: 4px; }
.pg .figcap { font-size: 14.5px; color: #5a4a30; line-height: 1.5; margin: 8px 2px 0; font-weight: 500; }
.zoom-wrap { overflow: auto; background: #fff; border: 3px solid #1d1633; border-radius: 14px; padding: 10px; max-height: 76vh; }
.pg .codebox { margin: 8px 0 14px; }
.pg .codetabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.pg .codetabs button { padding: 5px 12px; border-radius: 10px; background: #e0d2a8; border: 3px solid #1d1633; font-weight: 800; font-size: 13px; color: #3b2b18; }
.pg .codetabs button.on { background: #ffd24a; }
.pg .code-label { font-size: 13px; font-weight: 800; color: #8a6a3a; margin-bottom: 4px; }
.pg .code { font-size: 13px; max-height: 60vh; }
.pg .videos { display: grid; gap: 10px; }
.pg a.video { display: flex; flex-direction: column; gap: 3px; background: #fffdf4; border: 3px solid #1d1633; border-radius: 14px; padding: 10px 14px; text-decoration: none; color: var(--paper-ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.pg a.video:active { transform: translateY(2px); }
.pg .vt { font-weight: 800; font-size: 15.5px; } .pg .vc { font-size: 13px; color: #8a6a3a; font-weight: 600; }
.pg .vm { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pg .vtag { font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 99px; background: #e0d2a8; border: 2px solid #1d1633; } .pg .vtag.go { background: #ff5a73; color: #fff; }
.book-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px calc(10px + var(--safe-b) + var(--hub-dock, 0px)); background: linear-gradient(#352c78, #261f58); border-top: 4px solid #1d1633; }
.book-foot .dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; flex: 1; }
.book-foot .dots i { width: 9px; height: 9px; border-radius: 50%; background: #5a4eb0; border: 2px solid #1d1633; }
.book-foot .dots i.seen { background: #8a7be0; } .book-foot .dots i.on { background: var(--gold); transform: scale(1.35); }

/* ----- diagrammes (SVG) ----- */
svg.dg { overflow: visible; }
.dg text { font: 400 12.5px var(--font-ui); fill: var(--dg-ink); }
.dg .nm { font-weight: 600; text-anchor: middle; }
.dg .it { font-style: italic; }
.dg .st { text-decoration: underline; }
.dg .stereo { font-size: 11.5px; }
.dg .mem { font-size: 12.5px; }
.dg .mono { font: 400 12px var(--font-mono); }
.dg .role { font: 600 10.5px var(--font-ui); fill: var(--dg-muted); letter-spacing: .02em; paint-order: stroke; stroke: var(--dg-bg); stroke-width: 4px; stroke-linejoin: round; }
.dg .lab { font-size: 12px; paint-order: stroke; stroke: var(--dg-bg); stroke-width: 4px; stroke-linejoin: round; }
.dg .lab.role2 { font-style: italic; fill: var(--dg-muted); }
.dg .cap { fill: var(--dg-muted); font-size: 12.5px; }
.dg .big { font-size: 14px; font-weight: 700; }
.dg .ol { font-size: 12.5px; }
.dg .laneTitle { font: 700 11.5px var(--font-ui); fill: var(--dg-muted); letter-spacing: .03em; }
.dg .box { fill: var(--dg-class-fill); stroke: var(--dg-stroke); stroke-width: 1.4; }
.dg .sep { stroke: var(--dg-stroke); stroke-width: 1; }
.dg .cls.tone-client .box { fill: var(--dg-client-fill); stroke: var(--dg-client-stroke); }
.dg .cls.tone-client .sep { stroke: var(--dg-client-stroke); }
.dg .note .box { fill: var(--dg-note-fill); stroke: var(--dg-note-stroke); stroke-width: 1.2; }
.dg .note .fold { fill: none; stroke: var(--dg-note-stroke); stroke-width: 1.2; }
.dg .noteLink { stroke: var(--dg-note-stroke); stroke-width: 1.1; stroke-dasharray: 3 3; }
.dg .laneBox { fill: none; stroke: var(--dg-lane); stroke-width: 1.2; stroke-dasharray: 5 4; }
.dg .laneBox.solid { stroke-dasharray: none; }
.dg .laneBox.pkgTab { fill: var(--dg-class-fill); stroke-dasharray: none; stroke: var(--dg-stroke); }
.dg .lane .laneBox:not(.pkgTab):not(.solid) { fill: color-mix(in srgb, var(--dg-lane) 5%, transparent); }
.dg .rel .ln { fill: none; stroke: var(--dg-stroke); stroke-width: 1.4; }
.dg .rel.dash .ln { stroke-dasharray: 6 4; }
.dg .rel .tri { fill: var(--dg-bg); stroke: var(--dg-stroke); stroke-width: 1.4; stroke-linejoin: miter; }
.dg .rel .dia { fill: var(--dg-bg); stroke: var(--dg-stroke); stroke-width: 1.4; }
.dg .rel .dia.full { fill: var(--dg-stroke); }
.dg .rel .head { fill: none; stroke: var(--dg-stroke); stroke-width: 1.4; stroke-linejoin: miter; }
.dg .bead { fill: var(--dg-stroke); }
.dg .beadN { font: 700 11px var(--font-ui); fill: var(--dg-bg); text-anchor: middle; }
.dg .dim { opacity: .42; }
.dg .obj .box { stroke-width: 1.5; }
.dg .obj.dashed .box { stroke-dasharray: 5 3; }
.dg .tone-blue .box   { fill: var(--t-blue-f);   stroke: var(--t-blue-s); }
.dg .tone-green .box  { fill: var(--t-green-f);  stroke: var(--t-green-s); }
.dg .tone-orange .box { fill: var(--t-orange-f); stroke: var(--t-orange-s); }
.dg .tone-grey .box   { fill: var(--t-grey-f);   stroke: var(--t-grey-s); }
.dg .tone-purple .box { fill: var(--t-purple-f); stroke: var(--t-purple-s); }
.dg .tone-red .box    { fill: var(--t-red-f);    stroke: var(--t-red-s); }


/* extensions UML : n-aire, classe-association, qualificatif, contraintes, correction */
.dg .dmd polygon { fill: var(--dg-bg); stroke: var(--dg-stroke); stroke-width: 1.4; }
.dg .rel.dot .ln { stroke-dasharray: 2 3; }
.dg .acLink { stroke: var(--dg-stroke); stroke-width: 1.3; stroke-dasharray: 2 3; }
.dg .qual .box { fill: var(--dg-class-fill); stroke: var(--dg-stroke); stroke-width: 1.2; }
.dg .qt { font-size: 12px; text-anchor: middle; }
.dg .bad { font-size: 26px; font-weight: 700; fill: var(--t-red-s); }
.dg .rel.ok .ln, .dg .rel.ok .head, .dg .rel.ok .tri, .dg .rel.ok .dia { stroke: var(--t-green-s); }
.dg .rel.ok .dia.full { fill: var(--t-green-s); }
.dg .rel.bad .ln, .dg .rel.bad .head, .dg .rel.bad .tri, .dg .rel.bad .dia { stroke: var(--t-red-s); }
.dg .rel.bad .dia.full { fill: var(--t-red-s); }
.dg .rel.miss .ln, .dg .rel.miss .head, .dg .rel.miss .tri, .dg .rel.miss .dia { stroke: var(--t-orange-s); }
.dg .rel.miss .dia.full { fill: var(--t-orange-s); }


/* ----- cartes à collectionner ----- */
.muted { color: var(--muted); font-weight: 600; font-size: 14px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.tcard { position: relative; display: flex; flex-direction: column; border-radius: 14px; border: 4px solid #1d1633; background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 38%, #2a2262), #1f1a4a 70%); box-shadow: 0 4px 0 rgba(0, 0, 0, .4), inset 0 0 0 2px color-mix(in srgb, var(--tc) 70%, transparent); overflow: hidden; cursor: pointer; transition: transform .1s; text-align: center; }
.tcard:active { transform: translateY(2px) scale(.98); }
.tcard .tc-top { display: flex; justify-content: space-between; font-size: 9.5px; font-weight: 900; padding: 4px 7px 0; letter-spacing: .05em; color: #fff; text-shadow: 0 1px 0 #1d1633; }
.tcard .tc-t { color: var(--tg); }
.tcard .tc-art { aspect-ratio: 1; margin: 2px 4px 0; }
.tcard canvas { width: 100%; height: 100%; display: block; }
.tcard .tc-name { font-size: 11px; font-weight: 900; line-height: 1.15; padding: 0 5px; min-height: 26px; display: flex; align-items: center; justify-content: center; }
.tcard .tc-foot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 4px 6px; }
.tcard .tc-concept { font-size: 9.5px; font-weight: 700; color: var(--muted); line-height: 1.1; }
.tcard .tc-stars { display: flex; gap: 2px; min-height: 8px; }
.tcard .tc-stars i { width: 8px; height: 8px; background: #3a3358; clip-path: polygon(50% 0, 62% 36%, 100% 38%, 70% 60%, 80% 100%, 50% 76%, 20% 100%, 30% 60%, 0 38%, 38% 36%); }
.tcard .tc-stars i.on { background: var(--gold); }
.tcard .tc-count { position: absolute; right: 5px; top: 22px; background: #1d1633; color: #fff; font-weight: 900; font-size: 11px; padding: 0 6px; border-radius: 8px; border: 2px solid var(--tc); }
.tcard.unknown { filter: grayscale(.5); background: linear-gradient(160deg, #2c2850, #1b1740); box-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
.tcard.unknown .tc-name, .tcard.unknown .tc-concept { color: #7a70a8; }
.tcard.locked { opacity: .45; }
.tcard.leader { box-shadow: 0 0 0 4px var(--gold), 0 4px 0 rgba(0, 0, 0, .4); }
.tcard.isnew::after { content: "NEW"; position: absolute; left: 0; top: 14px; background: var(--red); color: #fff; font-size: 9px; font-weight: 900; padding: 1px 6px; border-radius: 0 6px 6px 0; border: 2px solid #1d1633; border-left: 0; }
.tcard.t3 .tc-name, .tcard.t4 .tc-name, .tcard.t5 .tc-name { text-shadow: 0 0 8px var(--tc); }
.tcard.shiny { box-shadow: 0 0 0 3px #fff, 0 0 16px 3px rgba(255, 122, 217, .7), 0 4px 0 rgba(0, 0, 0, .4); }
.tcard.shiny::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .45) 45%, rgba(255, 122, 217, .25) 50%, rgba(120, 220, 255, .3) 55%, transparent 70%); background-size: 250% 100%; animation: holo 2.6s linear infinite; mix-blend-mode: screen; }
@keyframes holo { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.tcard.big { width: min(240px, 62vw); margin: 0 auto; border-width: 5px; border-radius: 20px; cursor: default; }
.tcard.big .tc-top { font-size: 13px; padding: 8px 12px 0; } .tcard.big .tc-name { font-size: 19px; min-height: 40px; padding: 0 10px; } .tcard.big .tc-concept { font-size: 13px; } .tcard.big .tc-stars i { width: 14px; height: 14px; } .tcard.big .tc-foot { padding-bottom: 12px; }
.tcard.mini { box-shadow: 0 3px 0 rgba(0, 0, 0, .4), inset 0 0 0 2px color-mix(in srgb, var(--tc) 70%, transparent); }
.tier-hint { display: flex; gap: 8px; align-items: center; padding: 8px 12px; margin: 8px 0 12px; border-radius: 12px; background: color-mix(in srgb, var(--c, #4da3ff) 18%, #1b1540); border: 3px solid var(--c, #4da3ff); font-weight: 700; font-size: 13.5px; }
.cd-top { display: flex; justify-content: center; padding: 6px 0 8px; }
.cd-info { font-size: 15.5px; line-height: 1.5; font-weight: 600; margin: 8px 0; }
.cd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 10px 0; }
.cd-stats > div { background: var(--panel); border: 3px solid #1d1633; border-radius: 12px; padding: 6px 10px; text-align: center; }
.cd-stats small { display: block; color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.cd-stats b { font-size: 17px; }
.perk { font-size: 13.5px; background: rgba(77, 163, 255, .12); border: 3px solid #1d1633; border-radius: 12px; padding: 8px 12px; line-height: 1.45; margin: 8px 0; }
.cd-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.team-top { margin-bottom: 4px; }

/* ----- caisses ----- */
.crate-list { display: flex; flex-direction: column; gap: 10px; }
.crate-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 6px; border-radius: 16px; background: linear-gradient(90deg, color-mix(in srgb, var(--cc) 30%, #2a2262), #211a4a 60%); border: 4px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.cr-cv { width: 68px; height: 68px; flex: none; }
.cr-i { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cr-i b { font-size: 16px; } .cr-i small { color: var(--muted); font-weight: 600; font-size: 12px; line-height: 1.25; }
.cr-i .price { font-weight: 900; color: var(--gold); display: flex; align-items: center; gap: 4px; margin-top: 2px; } .cr-i .price s { color: var(--muted); font-size: 12px; margin-left: 4px; }
.cr-n { font-weight: 900; font-size: 22px; color: var(--gold); }
.cr-btns { display: flex; flex-direction: column; gap: 5px; }
.shop-top { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; } .big-coins { font-size: 26px; font-weight: 900; display: flex; align-items: center; gap: 8px; color: var(--gold); }
.odds { display: grid; gap: 4px; font-size: 13px; }
.odds .oh, .odds .or { display: grid; grid-template-columns: 1.6fr repeat(6, 1fr); gap: 4px; align-items: center; text-align: center; }
.odds .oh { font-weight: 900; font-size: 11px; } .odds .or { background: color-mix(in srgb, var(--cc) 22%, #1b1540); border: 3px solid #1d1633; border-radius: 10px; padding: 6px 4px; font-weight: 800; } .odds .or b { text-align: left; padding-left: 6px; } .odds .z { color: #6a6090; }
.crate-open { background: radial-gradient(circle at 50% 45%, #3a2a7a, #120d2a 70%); padding-top: 0; }
.co-body { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; overflow: hidden; }
.co-cv { position: absolute; inset: 0; width: 100%; height: 100%; }
.co-txt { position: relative; z-index: 2; font-weight: 900; font-size: 22px; text-align: center; padding: 0 20px; text-shadow: 0 3px 0 #1d1633; margin-bottom: 14vh; animation: bobt 1s infinite alternate; cursor: pointer; }
@keyframes bobt { to { transform: translateY(-6px); } }
.co-cards { position: absolute; inset: 0 0 90px; z-index: 3; display: flex; align-items: center; justify-content: center; padding: 14px; overflow-y: auto; pointer-events: none; }
.co-cards > * { pointer-events: auto; }
.co-card { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: cardIn .6s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes cardIn { from { transform: scale(.2) rotateY(180deg); opacity: 0; } }
.co-lab { font-weight: 900; font-size: 16px; text-align: center; text-shadow: 0 2px 0 #1d1633; }
.co-lab .new { background: var(--red); padding: 2px 12px; border-radius: 99px; border: 3px solid #1d1633; font-size: 15px; letter-spacing: .06em; animation: bump .6s infinite alternate; display: inline-block; }
.co-lab .dup { color: var(--muted); }
.co-foot { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; padding: 14px 14px calc(14px + var(--safe-b) + var(--hub-dock, 0px)); display: flex; justify-content: center; gap: 10px; }
.co-rays { position: absolute; left: 50%; top: 44%; width: 200vmax; height: 200vmax; margin: -100vmax 0 0 -100vmax; pointer-events: none; z-index: 1; opacity: .5; background: repeating-conic-gradient(from 0deg, rgba(255, 225, 120, .32) 0 8deg, rgba(255, 225, 120, 0) 8deg 22deg); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 38%); mask-image: radial-gradient(circle, #000 0, transparent 38%); animation: rays 24s linear infinite; }
@keyframes rays { to { transform: rotate(360deg); } }
.co-ttl { position: absolute; z-index: 4; left: 0; right: 0; top: calc(26px + var(--safe-t, 0px)); text-align: center; font-weight: 900; font-size: 24px; letter-spacing: .02em; color: var(--gold); text-shadow: 0 3px 0 #1d1633; padding: 0 16px; }
.co-sum { text-align: center; width: min(560px, 100%); margin: auto; }
.co-sum h3 { margin: 0 0 10px; font-size: 22px; font-weight: 900; text-shadow: 0 2px 0 #1d1633; }
.co-sum .grid-cards { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.co-sum p { font-weight: 800; color: var(--gold); display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ----- carnet, bibliothèque, listes ----- */
.goal-card { cursor: pointer; border-color: var(--gold); background: linear-gradient(#3a2f78, #2a2262); }
.goal-card .gc-h { font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.goal-card.big .gc-t { font-size: 18px; font-weight: 800; line-height: 1.4; }
.goal-card .gc-w { margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.bdg { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: 10px; font-weight: 800; color: var(--muted); }
.bdg .ic { width: 44px; height: 44px; filter: grayscale(1) brightness(.6); } .bdg.ok { color: var(--ink); } .bdg.ok .ic { filter: drop-shadow(0 0 8px rgba(255, 210, 74, .6)); }
.chapter { margin-top: 12px; padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 3px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.chapter.locked { opacity: .55; }
.ch-h { display: flex; justify-content: space-between; align-items: center; font-weight: 900; } .ch-h span { color: var(--muted); font-size: 13px; }
.chapter .bar.sm { height: 10px; margin: 6px 0 8px; } .chapter ul { list-style: none; margin: 0; padding: 0; } .chapter li { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; font-size: 14px; font-weight: 600; }
.chapter li .ck { width: 20px; height: 20px; border-radius: 7px; border: 3px solid #1d1633; background: #14102a; display: flex; align-items: center; justify-content: center; flex: none; color: #022a18; font-size: 12px; margin-top: 1px; }
.chapter li.ok .ck { background: var(--green); } .chapter li.ok { color: var(--muted); }
.lib-list { display: flex; flex-direction: column; gap: 8px; }
.lib-row { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 28%, #2a2262), #211a4a 70%); border: 3px solid #1d1633; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.lib-row:active { transform: translateY(2px); } .lr-ic { font-size: 24px; display: flex; } .lr-t { flex: 1; display: flex; flex-direction: column; } .lr-t small { color: var(--muted); font-weight: 600; font-size: 12px; } .lr-lock { font-size: 20px; display: flex; opacity: .8; }
.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick-row { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px 8px 8px; border-radius: 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--tc, #5a4eb0) 26%, #2a2262), #211a4a 70%); border: 3px solid #1d1633; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.pick-row:disabled { opacity: .4; } .pick-row.cur { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(0, 0, 0, .35); }
.pick-row:active:not(:disabled) { transform: translateY(2px); }
.pr-cv { width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 28px; } .pr-cv canvas { width: 100%; height: 100%; }
.pr-t { flex: 1; display: flex; flex-direction: column; min-width: 0; } .pr-t small { color: var(--muted); font-weight: 600; font-size: 12px; } .pr-inc { font-weight: 900; color: var(--green); font-size: 14px; white-space: nowrap; }
.mtext { margin: 8px 0 0; font-size: 15.5px; line-height: 1.5; font-weight: 600; }
.tier-hint.t { margin: 0; }
.rew { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.rw { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .07); border: 3px solid #1d1633; font-weight: 700; text-align: left; font-size: 15.5px; animation: rwin .4s backwards; }
.rw:nth-child(2) { animation-delay: .1s; } .rw:nth-child(3) { animation-delay: .2s; } .rw:nth-child(4) { animation-delay: .3s; }
.rw .ri { font-size: 26px; display: flex; flex: none; }
@keyframes rwin { from { transform: translateX(-30px); opacity: 0; } }


/* ----- comptes : connexion, classement, profils ----- */
.auth { max-width: 440px; margin: 0 auto; }
.au-err { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 90, 115, .16); border: 3px solid #a02e42; color: #ffd0d8; font-weight: 800; font-size: 14px; }
.au-warn { margin-top: 14px; font-size: 12.5px; text-align: center; }
.lb { display: flex; flex-direction: column; gap: 8px; max-width: 620px; margin: 0 auto; }
.lb-sep { text-align: center; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 6px 0 -2px; }
.lb-cta { max-width: 620px; margin: 0 auto 12px; }
.lb-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 12px 8px 8px; border-radius: 16px; background: linear-gradient(#352c78, #2a2262); border: 3px solid #1d1633; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); min-height: 62px; }
.lb-row:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.lb-row.me { border-color: var(--gold); background: linear-gradient(#4a3d96, #34297a); }
.lb-rank { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; background: #1d1633; color: var(--muted); }
.lb-rank.r1 { background: linear-gradient(#ffe38a, #e8a81a); color: #4a2e00; box-shadow: 0 0 12px rgba(255, 210, 74, .6); }
.lb-rank.r2 { background: linear-gradient(#f0f2fa, #a9b0c8); color: #2a2f45; }
.lb-rank.r3 { background: linear-gradient(#ffc08a, #c4763a); color: #3d1f08; }
.lb-av { flex: none; width: 28px; height: 46px; display: flex; align-items: flex-end; justify-content: center; }
.av { image-rendering: pixelated; display: block; }
.lb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-name { font-size: 16px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.lb-main small { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-stat { flex: none; text-align: right; display: flex; flex-direction: column; }
.lb-stat b { font-size: 18px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.lb-stat small { font-size: 11px; color: var(--muted); font-weight: 800; }
.dot-on { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex: none; }
.pf { max-width: 620px; margin: 0 auto; }
.pf-head { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: radial-gradient(ellipse at 20% 100%, rgba(255, 210, 74, .22), transparent 60%), linear-gradient(#352c78, #2a2262); border: 4px solid #1d1633; box-shadow: 0 5px 0 rgba(0, 0, 0, .35); }
.pf-av { flex: none; width: 56px; height: 100px; display: flex; align-items: flex-end; justify-content: center; }
.pf-av .av { filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .35)); }
.pf-id { flex: 1; min-width: 0; }
.pf-id h3 { margin: 0 0 2px; font-size: 22px; font-weight: 900; overflow-wrap: anywhere; }
.pf-id .muted { font-size: 13px; }
.pf-score { flex: none; text-align: center; display: flex; flex-direction: column; }
.pf-score b { font-size: 28px; font-weight: 900; color: var(--gold); line-height: 1; font-variant-numeric: tabular-nums; }
.pf-score small { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.pf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.pf-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 4px; border-radius: 14px; background: var(--panel); border: 3px solid #1d1633; text-align: center; }
.pf-stat b { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.pf-stat small { font-size: 11px; color: var(--muted); font-weight: 800; }
.pf-team { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pf-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.pf-tile { position: relative; aspect-ratio: 1; border-radius: 14px; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--tc, #5a4eb0) 38%, #2a2262), #1b1540); border: 3px solid var(--tc, #5a4eb0); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pf-tile canvas { width: 100%; height: 100%; display: block; }
.pf-tile.unknown { border-color: #2e2850; background: #1b1540; opacity: .75; }
.pf-tile.shiny { box-shadow: 0 0 10px rgba(255, 255, 255, .55), inset 0 0 10px rgba(255, 255, 255, .25); }
.pf-tile .lv { position: absolute; right: 3px; bottom: 2px; font-style: normal; font-size: 10px; font-weight: 900; background: #1d1633; border-radius: 8px; padding: 0 5px; }
.pf-tile.big { flex: none; width: 92px; aspect-ratio: auto; flex-direction: column; padding: 4px 4px 6px; gap: 2px; }
.pf-tile.big canvas { height: 74px; }
.pf-tile.big small { font-size: 10px; font-weight: 800; text-align: center; line-height: 1.1; max-height: 22px; overflow: hidden; }
.pf-tile.lead { box-shadow: 0 0 0 3px var(--gold); }
.pf-actions { display: flex; flex-direction: column; gap: 10px; }

/* ----- minicarte ----- */
#minimap { position: absolute; left: calc(8px + var(--safe-l)); top: calc(56px + var(--safe-t)); z-index: 6; width: 104px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 0; pointer-events: auto; }
#minimap[hidden] { display: none; }
#minimap canvas { width: 104px; height: 104px; display: block; border-radius: 14px; border: 3px solid #1d1633; background: rgba(20, 16, 42, .8); box-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
#minimap:active canvas { transform: translateY(2px); }
#minimap .mm-cap { align-self: flex-start; max-width: 168px; padding: 2px 9px; border-radius: 10px; background: rgba(20, 16, 42, .88); border: 2px solid #ffd24a; color: #ffd24a; font-weight: 900; font-size: 11.5px; line-height: 1.25; text-align: left; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
@media (max-height: 520px) { #minimap { width: 76px; } #minimap canvas { width: 76px; height: 76px; } #minimap .mm-cap { display: none; } }
.mm-full { display: flex; justify-content: center; }
.mm-full canvas { border-radius: 16px; border: 4px solid #1d1633; background: #14102a; box-shadow: 0 5px 0 rgba(0, 0, 0, .35); max-width: 100%; }
.mm-legend { display: flex; justify-content: center; gap: 16px; margin-top: 10px; font-size: 12.5px; font-weight: 800; color: var(--muted); }
.mm-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; border: 2px solid #1d1633; }
.mm-legend .lg-p { background: #fff; border-color: #2a4fd0; } .mm-legend .lg-d { background: #fff3b0; border-radius: 2px; } .mm-legend .lg-w { background: #ffd24a; }
.mm-route { margin-top: 8px; padding-top: 8px; border-top: 2px solid rgba(255, 255, 255, .12); font-size: 13.5px; color: #ffe9a0; font-weight: 700; }

/* logo sur l'écran titre (masqué sur les écrans très bas) */
.title .tlogo { position: relative; z-index: 2; width: 84px; height: 84px; border-radius: 22px; margin-bottom: 14px; box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 30px rgba(255, 210, 74, .35); animation: logo 3s ease-in-out infinite alternate; }
@media (max-height: 640px) { .title .tlogo { display: none; } }

/* ----- code de récupération ----- */
.rc-box { margin: 12px 0; padding: 14px 12px; border-radius: 16px; background: radial-gradient(ellipse at 50% 0%, rgba(255, 210, 74, .22), transparent 70%), #1b1540; border: 4px solid var(--gold); text-align: center; box-shadow: 0 5px 0 rgba(0, 0, 0, .35); }
.rc-label { font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.rc-code { font: 900 21px var(--mono); letter-spacing: .04em; color: var(--gold); word-break: break-all; user-select: all; -webkit-user-select: all; line-height: 1.5; }
.rc-warn { background: rgba(255, 210, 74, .12); border-color: #a8851e; color: #ffe9a0; font-weight: 700; }
.rc-actions { display: flex; justify-content: center; margin: 12px 0 4px; }
.rc-check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 800; font-size: 15px; justify-content: center; cursor: pointer; }
.rc-check input { width: 22px; height: 22px; accent-color: #ffd24a; }
.link { display: block; width: 100%; margin-top: 14px; padding: 8px; text-align: center; font-weight: 800; font-size: 13.5px; color: #9fc6ff; text-decoration: underline; text-underline-offset: 3px; }

/* ----- écran titre : connexion obligatoire, indicateur de sauvegarde ----- */
.title-msg { margin: 0 0 4px; padding: 10px 14px; border-radius: 14px; background: rgba(34, 24, 86, .86); border: 3px solid #1d1633; color: #fff; font-weight: 700; font-size: 14.5px; line-height: 1.4; text-align: center; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.sync-info { font-size: 11.5px; font-weight: 800; color: var(--green); max-width: 150px; line-height: 1.2; display: inline-block; text-align: right; }
/*@@MORE@@*/



