/* menus.css — un seul carnet pour tous les menus : onglets de cuir en haut
   (Carnet, Objectifs, Badges, Réglages), même taille, même place ; le HUD de jeu
   s'efface pendant qu'on lit. Chargé en dernier. */

.panel-wrap:not(.hidden) { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.panel-wrap .panel.book-panel { order: 2; margin-right: 0; width: min(calc(96vw - 180px), 1000px); height: min(82vh, 620px); transform: translateX(-60px); }
.panel-wrap .menu-tabs { order: 1; transform: translateX(-60px); }

/* le jeu derrière : on n'affiche plus que le carnet */
#ui.panel-open .hud, #ui.panel-open .trad, #ui.panel-open .toasts, #ui.panel-open .place-banner,
#ui.panel-open .tag-layer, #ui.panel-open .prompt, #ui.panel-open .wlabel { opacity: 0 !important; pointer-events: none !important; transition: opacity 0.15s; }
.panel-wrap { background: radial-gradient(ellipse at 50% 55%, rgba(20, 10, 6, 0.45), rgba(8, 6, 10, 0.78)); }

/* onglets */
.menu-tabs {
  display: flex; gap: 6px; align-items: flex-end; position: relative; z-index: 3;
  margin-bottom: -8px; padding: 0 18px; animation: tabs-in 0.22s ease-out both;
}
.menu-tab {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 8px;
  border: none; border-radius: 12px 12px 0 0; cursor: pointer;
  font-family: var(--pixel); word-spacing: 0.3em; font-size: 0.86em; color: #f3e6c8;
  background: linear-gradient(180deg, #7a4428, #4e2716 80%);
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.18), 0 -2px 0 #2a120a;
  transition: transform 0.12s ease, background 0.12s ease;
}
.menu-tab:hover { transform: translateY(-3px); }
.menu-tab .mt-icon { font-size: 1.05em; }
.menu-tab kbd { font-size: 0.68em; padding: 0 5px; background: rgba(240, 192, 74, 0.85); box-shadow: 0 2px 0 #8a5a1c; }
.menu-tab.on {
  height: 48px; color: var(--ink);
  background: linear-gradient(180deg, #fff8e6, #f3e6c8);
  box-shadow: inset 0 0 0 2px #4e2716, 0 -2px 0 #2a120a;
}
.menu-tab.close { width: 40px; justify-content: center; padding: 0 0 8px; margin-left: 10px; font-size: 1em; }
@keyframes tabs-in { from { opacity: 0; transform: translate(-60px, 8px); } to { opacity: 1; transform: translateX(-60px); } }

/* pages communes */
.page-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px 4px; }

/* badges */
.badge-list { display: flex; flex-direction: column; gap: 10px; }
.badge-list .badge-card {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; padding: 10px 12px;
  border-radius: 10px; background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.18);
  border-left: 5px solid var(--accent);
}
.badge-list .badge-card.locked { opacity: 0.72; border-left-color: #b8a88c; }
.badge-list .badge-emblem {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6em;
  background: radial-gradient(circle at 35% 30%, #fff6dc, #e8c070 60%, #a87420);
  box-shadow: 0 0 0 3px #4e2716, 0 3px 0 3px #2a120a;
}
.badge-list .badge-card.silver .badge-emblem { background: radial-gradient(circle at 35% 30%, #ffffff, #c8ccd4 60%, #7a808c); }
.badge-list .badge-card.bronze .badge-emblem { background: radial-gradient(circle at 35% 30%, #ffe0c0, #d08a50 60%, #8a4a20); }
.badge-list .badge-card.locked .badge-emblem { background: radial-gradient(circle at 35% 30%, #f4ead4, #d8c8a4); font-size: 1.2em; }
.badge-list .badge-emblem i { font-style: normal; }
.badge-info .badge-name { font-family: var(--pixel); word-spacing: 0.3em; font-size: 0.95em; color: var(--ink); }
.badge-info .badge-cat { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 0.85em; }
.badge-info .badge-stats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: 0.8em; font-family: var(--serif); color: var(--ink); }
.badge-info .badge-stats.muted { color: var(--ink-soft); }
.badge-info .dot { color: #b8a080; }

/* records */
.recs { display: flex; flex-direction: column; gap: 12px; }
.rec { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: baseline; }
.rec b { grid-row: span 2; font-family: var(--pixel); font-size: 1.3em; color: #8a4a20; }
.rec span { font-family: var(--serif); color: var(--ink-soft); }
.rec-bar { display: block; height: 8px; border-radius: 4px; background: rgba(120, 85, 50, 0.15); overflow: hidden; }
.rec-bar u { display: block; height: 100%; background: linear-gradient(90deg, #e8b048, #d0603a); }
.rival-faces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.rf { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; border-radius: 8px; background: rgba(255, 255, 255, 0.4); filter: grayscale(0.7); opacity: 0.75; }
.rf.won { filter: none; opacity: 1; box-shadow: inset 0 0 0 2px #e8b048; }
.rf img { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 6px; background: #e8d6ae; }
.rf span { color: #d89a20; font-size: 0.8em; min-height: 1em; }

/* réglages */
.set-group { display: flex; flex-direction: column; gap: 6px; }
.set-group h4 { margin: 4px 0 2px; font-family: var(--pixel); font-weight: normal; word-spacing: 0.3em; color: #8a4a20; font-size: 0.9em; }
.page .set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.5); font-family: var(--serif); color: var(--ink); }
.page .slider { width: 46%; accent-color: #d0603a; }
.game-card { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.18); }
.gc-row { display: flex; flex-direction: column; }
.gc-row span { font-family: var(--serif); font-style: italic; font-size: 0.8em; color: var(--ink-soft); }
.gc-row b { font-family: var(--pixel); font-weight: normal; color: var(--ink); }
.ctl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.ctl { display: flex; align-items: center; gap: 8px; font-family: var(--serif); color: var(--ink); font-size: 0.9em; }
.ctl kbd { min-width: 42px; text-align: center; }
.page .set-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; padding-top: 8px; }

@media (max-width: 900px) {
  .panel-wrap .panel.book-panel, .panel-wrap .menu-tabs { transform: none; }
  .menu-tab .mt-label { display: none; }
}

/* aides de lecture : furigana / pinyin au-dessus, ligne latine dessous */
.tl { display: inline-flex; flex-direction: column; align-items: inherit; line-height: 1.15; }
.tl-main { line-height: 1.6; }
.tl ruby { ruby-position: over; }
.tl rt { font-family: var(--serif); font-size: 0.62em; letter-spacing: 0.02em; color: inherit; opacity: 0.85; font-weight: normal; }
.tl-roman { font-family: var(--serif); font-style: italic; font-size: 0.78em; opacity: 0.8; word-spacing: normal; letter-spacing: 0; margin-top: 1px; }
.dlg-text .tl, .toast-title .tl, .wl-main .tl, .lesson-word .tl { align-items: flex-start; }
.wl-main .tl, .lesson-word .tl { align-items: center; }
.set-group.aids { padding: 8px 10px; border-radius: 10px; background: rgba(127, 240, 255, 0.10); box-shadow: inset 0 0 0 2px rgba(60, 150, 170, 0.25); }
.aid-preview { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.7); font-size: 1.1em; color: var(--ink); }
.aid-kicker { font-family: var(--serif); font-style: italic; font-size: 0.7em; color: var(--ink-soft); }

/* ---- programme des 500 mots : 26 signets, révision, maîtrise ---- */
.ribbons.compact.many { top: 14px; bottom: 14px; right: -168px; gap: 2px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; padding-right: 18px; }
.ribbons.compact.many .ribbon { transform: none; width: 176px; }
.ribbons.compact.many .ribbon:hover { transform: translateX(6px); }
.ribbons.compact.many .ribbon.on { transform: translateX(14px); }
.ribbons.compact.many::-webkit-scrollbar { display: none; }
.ribbons.compact.many .ribbon { flex-shrink: 0; padding: 2px 22px 2px 8px; font-size: 0.6em; }
.ribbons.compact.many .ribbon.grp { margin-top: 7px; }
.sum-review { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; flex-wrap: wrap; }
.sum-mastery { font-family: var(--pixel); font-size: 0.85em; color: var(--ink-soft); word-spacing: 0.3em; }
.entry-lv, .review-lv { display: inline-flex; gap: 2px; }
.entry-lv { position: absolute; right: 6px; bottom: 4px; }
.entry-lv i, .review-lv i { width: 5px; height: 5px; border-radius: 1px; background: rgba(120, 85, 50, 0.22); }
.entry-lv i.on, .review-lv i.on { background: #e0a030; }
.review-lv i { width: 9px; height: 9px; }
.review-pic { display: flex; justify-content: center; margin-bottom: 6px; }
.review-pic canvas.pix { width: 88px; height: 88px; }
.review-screen .quiz-choice.right { border-color: #4caf50 !important; background: rgba(76, 175, 80, 0.25) !important; }
.review-screen .quiz-choice.bad { border-color: #e2564c !important; background: rgba(226, 86, 76, 0.25) !important; }

/* ---- salle des trophées (panneau) ---- */
.tr-h { margin: 10px 0 4px; font-family: var(--pixel); font-size: 0.85em; color: var(--ink-soft); word-spacing: 0.3em; font-weight: normal; }
.tr-row { display: grid; grid-template-columns: 34px 1fr auto 74px; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; border-left: 3px solid var(--accent); background: rgba(255, 255, 255, 0.35); margin-bottom: 3px; }
.tr-row.gold { background: linear-gradient(90deg, rgba(255, 214, 102, 0.45), rgba(255, 255, 255, 0.3)); box-shadow: inset 0 0 0 1px rgba(224, 160, 48, 0.6); }
.tr-face { width: 32px; height: 32px; image-rendering: pixelated; border-radius: 4px; background: rgba(120, 85, 50, 0.12); }
.tr-row.dark .tr-face { filter: brightness(0) opacity(0.45); }
.tr-name { display: flex; flex-direction: column; min-width: 0; }
.tr-name b { font-family: var(--pixel); font-weight: normal; font-size: 0.85em; word-spacing: 0.25em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-name i { font-family: var(--serif); font-size: 0.72em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-stars i { font-style: normal; color: rgba(120, 85, 50, 0.25); font-size: 1em; }
.tr-stars i.on { color: #e8a820; text-shadow: 0 1px 0 #9a6410; }
.tr-time { font-family: var(--pixel); font-size: 0.78em; text-align: right; color: var(--ink); }
.tr-big { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.tr-pct { font-family: var(--pixel); font-size: 2.6em; line-height: 1; color: var(--ink); }
.rec-bar.big { height: 10px; }
.tr-run { display: grid; grid-template-columns: 70px 1fr auto; align-items: baseline; gap: 10px; padding: 4px 8px; border-radius: 6px; background: rgba(30, 40, 70, 0.08); margin-bottom: 4px; }
.tr-run-k { font-family: var(--pixel); font-size: 0.85em; color: var(--ink-soft); }
.tr-run b { font-family: var(--pixel); font-weight: normal; font-size: 1.25em; color: #1e2a4a; letter-spacing: 0.04em; }
.tr-run-pb { font-family: var(--serif); font-size: 0.78em; color: #a0703c; }
.tr-splits { display: flex; flex-direction: column; gap: 2px; }
.tr-split { display: grid; grid-template-columns: 1fr auto 72px; gap: 8px; font-size: 0.8em; padding: 1px 6px; }
.tr-split span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-split b { font-family: var(--pixel); font-weight: normal; }
.tr-split i, .res-split b { font-style: normal; font-family: var(--pixel); text-align: right; }
.ahead { color: #2f9a4a !important; }
.behind { color: #d0453c !important; }
.res-split { font-family: var(--pixel); word-spacing: 0.25em; margin: 4px 0; }
.res-split.ahead b { color: #3fc66a; }
.res-split.behind b { color: #ff6a5a; }
/* chrono speedrun du HUD */
.hud-chrono { position: absolute; left: 14px; bottom: 52px; padding: 4px 10px; border-radius: 6px; background: rgba(20, 24, 40, 0.78); color: #9ff6c8; font-family: var(--pixel); font-size: 0.95em; letter-spacing: 0.05em; box-shadow: inset 0 0 0 2px rgba(159, 246, 200, 0.35); pointer-events: none; }
.tr-row { grid-template-columns: 26px 1fr auto 70px; padding: 2px 6px; margin-bottom: 2px; gap: 6px; }
.tr-face { width: 24px; height: 24px; }
.tr-name i { font-size: 0.68em; }
.tr-pct { font-size: 2em; }
.tr-big { margin: 0 0 6px; }
/* réglage à choix (heure du jour) */
.set-row-time { flex-wrap: wrap; gap: 6px; }
.seg-choice { display: flex; gap: 3px; flex-wrap: wrap; }
.seg-btn { border: none; border-radius: 6px; padding: 3px 7px; cursor: pointer; background: rgba(255, 255, 255, 0.5); font-family: var(--pixel); font-size: 0.78em; color: var(--ink-soft); word-spacing: 0.2em; box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.25); }
.seg-btn:hover { background: #fff8e4; }
.seg-btn.on { background: #fff3c8; color: var(--ink); box-shadow: inset 0 0 0 2px #e0a030; }

/* mot appris : il s'écrit au-dessus de l'objet, monte et s'efface */
.wfloat { position: absolute; left: 0; top: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px; animation: wfIn 0.28s cubic-bezier(.2,1.6,.4,1) both; will-change: transform; }
.wf-word { font-family: var(--pixel); font-size: 1.55em; color: #fff; word-spacing: 0.25em; padding: 2px 10px 4px; border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 140, 190, 0.92), rgba(255, 196, 92, 0.92)); box-shadow: 0 3px 0 rgba(90, 40, 60, 0.45), 0 0 18px rgba(255, 220, 140, 0.8);
  text-shadow: 0 2px 0 rgba(90, 40, 60, 0.55); white-space: nowrap; }
.wf-word .tl-roman { display: block; font-size: 0.55em; opacity: 0.9; }
.wf-combo { font-family: var(--pixel); font-size: 0.95em; color: #fff3a0; text-shadow: 0 2px 0 #8a3a10, 0 0 10px rgba(255, 200, 60, 0.9); animation: wfCombo 0.5s ease-out both; letter-spacing: 0.08em; }
.wfloat.out { opacity: 0; transition: opacity 0.55s ease-in; }
@keyframes wfIn { from { opacity: 0; scale: 0.4; } to { opacity: 1; scale: 1; } }
@keyframes wfCombo { 0% { scale: 2.2; opacity: 0; } 60% { scale: 0.9; opacity: 1; } 100% { scale: 1; } }

/* duel de boss : portrait, barre de vie, coups */
.m-boss { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: min(100%, 640px); margin: 0 auto; padding: 8px 12px; border-radius: 10px; background: rgba(251, 244, 226, 0.92); box-shadow: inset 0 0 0 3px var(--accent), 0 4px 0 rgba(40, 20, 10, 0.35); }
.m-face-wrap { position: relative; }
.m-face { width: 56px; height: 56px; image-rendering: pixelated; border-radius: 8px; background: rgba(120, 85, 50, 0.15); display: block; }
.m-hp { position: relative; height: 16px; border-radius: 8px; background: #3a2418; box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.4); overflow: hidden; }
.m-hp i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 8px; transition: width 0.18s ease-out; }
.m-hp-lag { background: #ffe8a0; transition: width 0.6s ease-in !important; }
.m-hp-fill { background: linear-gradient(180deg, #ff8a7a, #e0443c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), inset 0 2px 0 rgba(255, 255, 255, 0.35); }
.m-lives { font-size: 1.15em; color: #e0443c; letter-spacing: 2px; white-space: nowrap; }
.m-boss.hit .m-face { animation: bossHit 0.32s ease-out; }
.m-boss.taunt .m-face { animation: bossTaunt 0.5s ease-in-out; }
.m-pops { position: absolute; left: 50%; top: 0; pointer-events: none; }
.m-pop { position: absolute; transform: translateX(-50%); font-family: var(--pixel); font-size: 1.2em; color: #fff; text-shadow: 0 2px 0 #8a2020, 0 0 6px rgba(255, 80, 60, 0.7); animation: popUp 0.9s ease-out forwards; white-space: nowrap; }
.m-pop.crit { font-size: 1.5em; color: #fff3a0; text-shadow: 0 2px 0 #8a4a10, 0 0 10px rgba(255, 200, 60, 0.9); }
@keyframes bossHit { 0% { transform: translateX(0) scale(1); filter: brightness(3) saturate(0); } 30% { transform: translateX(-6px) scale(0.92); } 60% { transform: translateX(5px); filter: none; } 100% { transform: none; } }
@keyframes bossTaunt { 0%, 100% { transform: none; } 25% { transform: translateY(-6px) rotate(-6deg); } 50% { transform: translateY(0) rotate(5deg); } 75% { transform: translateY(-3px); } }
@keyframes popUp { 0% { opacity: 0; translate: 0 6px; scale: 0.6; } 20% { opacity: 1; scale: 1.25; } 100% { opacity: 0; translate: 0 -46px; scale: 1; } }
.ko-stamp { position: absolute; top: 14%; left: 50%; transform: translateX(-50%) rotate(-8deg); font-family: var(--pixel); font-size: 4.2em; color: #ffe066; text-shadow: 0 5px 0 #8a2a10, 0 0 30px rgba(255, 180, 60, 0.9); animation: koIn 0.6s cubic-bezier(.2,1.8,.4,1) both, koOut 0.5s ease-in 1.4s forwards; pointer-events: none; z-index: 3; }
@keyframes koIn { from { scale: 3; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes koOut { to { opacity: 0; scale: 0.8; } }

/* ---- écran-titre : compte, langues en cartes, classement ---- */
.tl2 .tl-card-main { width: min(94vw, 760px); display: flex; flex-direction: column; gap: 10px; position: relative; }
.tl-top { display: flex; justify-content: flex-end; min-height: 30px; }
.tl-acc { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 16px; border: none; background: rgba(255, 255, 255, 0.6); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.3); font-family: var(--pixel); font-size: 0.85em; color: var(--ink); word-spacing: 0.2em; }
.tl-acc.guest { cursor: pointer; }
.tl-acc.guest:hover { background: #fff3c8; box-shadow: inset 0 0 0 2px #e0a030; }
.tl-acc-act { padding: 2px 8px; border-radius: 10px; background: #e0a030; color: #fff; }
.tl-acc-st { font-family: var(--serif); font-size: 0.85em; color: var(--ink-soft); }
.tl-acc.offline .tl-acc-st { color: #c0503c; }
.tl-acc-out { border: none; background: none; cursor: pointer; font-size: 1em; color: var(--ink-soft); padding: 0 4px; }
.tl-flag { image-rendering: pixelated; border-radius: 2px; box-shadow: 0 0 0 1px rgba(60, 30, 20, 0.35); vertical-align: middle; }
.tl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.tl-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; text-align: left; padding: 6px 8px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.22); transition: transform 0.12s; }
.tl-card canvas { grid-row: span 2; width: 36px; height: 24px; }
.tl-card b { font-family: var(--pixel); font-weight: normal; font-size: 0.9em; color: var(--ink); }
.tl-card i { font-family: var(--serif); font-size: 0.72em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-card:hover { transform: translateY(-2px); background: #fffaf0; }
.tl-card.on { background: #fff3c8; box-shadow: inset 0 0 0 3px #e0a030, 0 3px 0 rgba(160, 100, 30, 0.35); transform: translateY(-2px); }
.lang-block.small h3 { font-size: 0.8em; }
.tl-native, .lb-langs { display: flex; flex-wrap: wrap; gap: 4px; }
.tl-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 6px; border: none; cursor: pointer; background: rgba(255, 255, 255, 0.45); box-shadow: inset 0 0 0 1px rgba(120, 85, 50, 0.22); font-size: 0.78em; color: var(--ink-soft); }
.tl-chip.on { background: #fff3c8; color: var(--ink); box-shadow: inset 0 0 0 2px #e0a030; }
.tl-chip canvas { width: 18px; height: 12px; }
.title-note { display: flex; align-items: center; justify-content: center; gap: 2px; flex-wrap: wrap; }
.tl-sum { color: var(--ink-soft); }
.tl-modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 10, 6, 0.55); z-index: 20; animation: tlFade 0.18s ease-out; }
.tl-box { width: min(92vw, 420px); display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border-radius: 12px; background: var(--paper, #fbf4e2); box-shadow: inset 0 0 0 3px var(--leather, #6a3e22), 0 10px 30px rgba(0, 0, 0, 0.5); }
.tl-box h2 { font-family: var(--pixel); font-weight: normal; margin: 0; color: var(--ink); word-spacing: 0.25em; }
.tl-sub { margin: 0; font-family: var(--serif); font-size: 0.85em; color: var(--ink-soft); }
.tl-in { font: inherit; font-size: 1.05em; padding: 8px 10px; border-radius: 8px; border: none; background: #fff; box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.3); color: var(--ink); }
.tl-in:focus { outline: none; box-shadow: inset 0 0 0 2px #e0a030; }
.tl-msg { margin: 0; min-height: 1.2em; font-size: 0.85em; color: var(--ink-soft); }
.tl-msg.bad { color: #c0403a; } .tl-msg.ok { color: #2f8a4a; }
.tl-box-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.lb-box { width: min(94vw, 560px); }
.lb-tabs { display: flex; gap: 4px; }
.lb-list { display: flex; flex-direction: column; gap: 3px; max-height: 46vh; overflow-y: auto; }
.lb-row { display: grid; grid-template-columns: 44px 1fr auto 90px; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.5); }
.lb-row.top1 { background: linear-gradient(90deg, rgba(255, 214, 102, 0.6), rgba(255, 255, 255, 0.4)); }
.lb-row.top2 { background: linear-gradient(90deg, rgba(210, 216, 228, 0.7), rgba(255, 255, 255, 0.4)); }
.lb-row.top3 { background: linear-gradient(90deg, rgba(230, 170, 120, 0.55), rgba(255, 255, 255, 0.4)); }
.lb-row.me { box-shadow: inset 0 0 0 2px #e0a030; }
.lb-row.foot { margin-top: 6px; }
.lb-rank { font-family: var(--pixel); text-align: center; }
.lb-name { font-family: var(--pixel); font-weight: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-meta { font-size: 0.75em; color: var(--ink-soft); }
.lb-time { font-family: var(--pixel); text-align: right; color: #1e2a4a; }
.tl-toast { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 8px; background: #fff3c8; box-shadow: inset 0 0 0 2px #e0a030; font-family: var(--pixel); z-index: 30; }
@keyframes tlFade { from { opacity: 0; } }
.lb-name { color: var(--ink, #3a2418); }

/* questions des défis : image, écoute, lecture */
.qz-prompt { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qz-pic canvas.pix, .m-pic canvas.pix { width: 96px; height: 96px; image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(40, 20, 10, 0.25)); }
.m-q { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.m-pic canvas.pix { width: 64px; height: 64px; }
.qz-target { font-size: 2em !important; }
.qz-sub { margin: 0; font-family: var(--serif); color: var(--paper, #fbf4e2); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.qz-ear { width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer; font-size: 2.4em; background: #fff3c8; box-shadow: inset 0 0 0 3px #e0a030, 0 4px 0 rgba(120, 70, 20, 0.4); animation: earPulse 1.4s ease-in-out infinite; }
.qz-ear:hover { background: #fff; }
@keyframes earPulse { 50% { transform: scale(1.07); } }
.quiz-grid.pics .quiz-choice { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 88px; }
.qz-choice-pic canvas.pix { width: 72px; height: 72px; image-rendering: pixelated; }

/* ======================================================================
   UN SEUL STYLE pour tout ce qui s'affiche par-dessus le jeu (v8.8)
   papier crème + cadre de cuir + liseré de couleur à gauche + ombre portée.
   Fiche de quête, notifications, bulle de visée, bandeau du lieu, mot appris,
   compteurs, chrono : mêmes rayons, mêmes ombres, mêmes polices.
   ====================================================================== */
:root {
  --card-bg: linear-gradient(180deg, var(--paper), var(--paper-2));
  --card-frame: 0 0 0 2px var(--leather), 0 3px 0 2px var(--leather-d), 0 8px 18px rgba(0, 0, 0, 0.3);
  --card-r: 9px;
  --k-scan: #2f9a8a; --k-phrase: #5d7592; --k-gold: #e0a030; --k-locked: #c0403a;
  --medal-bronze: #c47a44; --medal-silver: #aab6c6; --medal-gold: #f0c040;
}
.quest-track, .toast, .wlabel, .place-banner, .badge-count, .hud-chrono, .wf-word, .tl-acc {
  background: var(--card-bg); color: var(--ink); border: none !important; border-radius: var(--card-r);
  box-shadow: var(--card-frame); font-family: var(--pixel); word-spacing: 0.25em;
}
.toast { position: relative; }
.toast::before, .place-banner::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: var(--card-r) 0 0 var(--card-r); background: var(--accent, var(--k-gold));
}
.quest-track::before { width: 5px; border-radius: var(--card-r) 0 0 var(--card-r); }
.toast { --accent: var(--k-gold); padding-left: 14px; }
.toast.scan { --accent: var(--k-scan); }
.toast.phrase { --accent: var(--k-phrase); }
.toast.locked { --accent: var(--k-locked); }
.toast.gold { --accent: var(--k-gold); background: linear-gradient(180deg, #fff8e0, #f6dc9a); }
.toast-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.6); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent); font-size: 1.05em; }
.wlabel::after { border-top-color: var(--leather); bottom: -9px; }
.wl-key, kbd { background: var(--k-gold); color: var(--ink); border: none; border-radius: 4px; box-shadow: 0 2px 0 var(--gold-d); }
.place-banner { padding-left: 1.1em; }
.pb-sub { color: var(--ink-soft); }
.hud-chrono { color: var(--ink); background: var(--card-bg); }
.wf-word { color: var(--ink); text-shadow: none; padding: 2px 12px 4px; box-shadow: var(--card-frame), 0 0 18px rgba(255, 220, 140, 0.7); }
.wf-sub { font-family: var(--pixel); font-size: 0.72em; color: var(--paper); text-shadow: 0 1px 0 var(--leather-d), 0 0 6px rgba(0, 0, 0, 0.5); }
.badge-count { padding: 3px 9px; font-size: 0.78em; }
/* médailles : une seule pièce, du HUD aux trophées */
.badge-chip { width: 22px; height: 22px; border-radius: 50%; border: none; box-shadow: 0 0 0 2px var(--leather), 0 2px 0 2px var(--leather-d); background: var(--paper-2); }
.badge-chip i { display: none; }
.badge-chip.bronze { background: radial-gradient(circle at 35% 30%, #f0b080, var(--medal-bronze) 60%, #8a4a20); }
.badge-chip.silver { background: radial-gradient(circle at 35% 30%, #fff, var(--medal-silver) 60%, #6a7484); }
.badge-chip.gold { background: radial-gradient(circle at 35% 30%, #fff6c0, var(--medal-gold) 60%, #a06a10); }
/* une touche à presser, mise en avant par le fil guidé */
.qt-key { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 0.78em; color: var(--ink-soft); }
.qt-key kbd { font-size: 1.15em; padding: 1px 7px; animation: kbdPulse 1.2s ease-in-out infinite; }
@keyframes kbdPulse { 50% { transform: scale(1.12); box-shadow: 0 2px 0 var(--gold-d), 0 0 12px var(--k-gold); } }
.keyrow.nudge { animation: kbdPulse 1.2s ease-in-out infinite; box-shadow: 0 0 0 3px var(--k-gold), 0 3px 0 3px var(--gold-d), 0 0 18px var(--k-gold); }
/* première ouverture d'un panneau : une bulle d'explication */
.coach { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 6; width: min(560px, 86%); display: flex; gap: 12px; align-items: center;
  padding: 10px 14px; background: var(--card-bg); border-radius: var(--card-r); box-shadow: var(--card-frame), 0 0 0 6px rgba(240, 192, 64, 0.35); animation: coachIn 0.35s cubic-bezier(.2,1.5,.4,1) both; }
.coach-ico { font-size: 1.8em; }
.coach p { margin: 0; flex: 1; font-family: var(--serif); font-size: 0.92em; color: var(--ink); line-height: 1.35; }
@keyframes coachIn { from { opacity: 0; transform: translate(-50%, -10px) scale(0.95); } }

/* flashcards : la carte se retourne */
.fc-stage { display: grid; place-items: center; perspective: 1200px; }
.fc-card { position: relative; width: min(78vw, 360px); height: min(48vh, 300px); border: none; padding: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform 0.45s cubic-bezier(.3,1.3,.5,1); }
.fc-card.flipped { transform: rotateY(180deg); }
.fc-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; backface-visibility: hidden;
  background: var(--card-bg); border-radius: 14px; box-shadow: var(--card-frame), inset 0 0 0 6px rgba(255, 255, 255, 0.5); }
.fc-back { transform: rotateY(180deg); background: linear-gradient(180deg, #fffaf0, #f7e7c0); }
.fc-pic canvas.pix { width: 112px; height: 112px; image-rendering: pixelated; }
.fc-pic.small canvas.pix { width: 64px; height: 64px; }
.fc-pic.big { font-size: 3.4em; }
.fc-native { font-family: var(--pixel); font-size: 1.3em; color: var(--ink); text-align: center; word-spacing: 0.25em; }
.fc-native.small { font-family: var(--serif); font-size: 0.95em; color: var(--ink-soft); }
.fc-q { font-family: var(--serif); font-style: italic; color: var(--ink-soft); font-size: 0.9em; }
.fc-target { font-family: var(--pixel); font-size: 2em; color: #1e2a4a; text-align: center; word-spacing: 0.25em; }
.fc-target.phrase { font-size: 1.3em; line-height: 1.5; }
.fc-actions { display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.fc-btn { margin-left: 4px; }
/* défi des phrases : tuiles de mots */
.ph-answer, .ph-pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(94%, 760px); margin: 0 auto; }
.ph-answer { min-height: 58px; padding: 10px; border-radius: 12px; background: rgba(251, 244, 226, 0.25); box-shadow: inset 0 0 0 2px rgba(251, 244, 226, 0.5); }
.ph-placeholder { color: var(--paper); font-family: var(--pixel); opacity: 0.7; align-self: center; }
.ph-tile { font-family: var(--pixel); font-size: 1.15em; padding: 6px 12px 8px; border: none; border-radius: 8px; cursor: pointer; background: var(--card-bg); color: var(--ink);
  box-shadow: var(--card-frame); word-spacing: 0.2em; transition: transform 0.1s; }
.ph-tile:hover { transform: translateY(-2px); }
.ph-tile.in { background: linear-gradient(180deg, #fff6d8, #f6dc9a); }
.ph-tile.used { opacity: 0.25; cursor: default; transform: none; }
.ph-screen.wrong .ph-answer { animation: shakeX 0.35s ease; box-shadow: inset 0 0 0 2px #e0564c; }
.ph-ok .qz-target { animation: wfIn 0.3s cubic-bezier(.2,1.6,.4,1) both; }
.fc-screen:not(.result), .ph-screen { display: flex !important; flex-direction: column; gap: 14px; }
.fc-screen .quiz-foot, .ph-screen .quiz-foot { margin-top: auto; }
.fc-screen .fc-stage { flex: 1; min-height: 0; }
.fc-actions { align-items: center; }
.fc-actions .btn { height: auto; align-self: center; min-width: 150px; }
.ph-screen .quiz-q { margin-top: 6px; }
.ph-screen .m-boss { flex: none; }
.coach { top: auto; bottom: 46px; }

/* fin de l'aventure */
.end2 { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px; overflow-y: auto; }
.end2 .end-title { font-size: 2.2em; margin: 0; text-align: center; }
.end2 .end-body { max-width: 720px; text-align: center; margin: 0; }
.end2-cols { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.6fr); gap: 14px; width: min(96vw, 1040px); }
.end2-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--card-bg); border-radius: 12px; box-shadow: var(--card-frame); color: var(--ink); }
.end2-k { font-family: var(--pixel); font-size: 0.85em; color: var(--ink-soft); word-spacing: 0.25em; }
.end2-time { font-family: var(--pixel); font-size: 2.6em; line-height: 1; color: #1e2a4a; letter-spacing: 0.04em; }
.end2-pb { font-family: var(--serif); font-size: 0.85em; color: #a0703c; }
.end2-rank { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: rgba(240, 192, 64, 0.2); font-family: var(--pixel); }
.end-rank-v { font-size: 1.4em; }
.end2-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.end2-stats div { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.5); }
.end2-stats b { font-family: var(--pixel); font-weight: normal; font-size: 1.1em; }
.end2-stats span { font-family: var(--serif); font-size: 0.75em; color: var(--ink-soft); }
.end2-coins { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.end2-coins.small { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.end-coin { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 5px; border-radius: 10px; background: rgba(255, 255, 255, 0.45); }
.end-coin img { width: 36px; height: 36px; image-rendering: pixelated; border-radius: 50%; padding: 3px; background: var(--paper-2); box-shadow: 0 0 0 3px #cbb898; }
.end-coin span { font-size: 0.62em; text-align: center; line-height: 1.15; color: var(--ink-soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 3px; }
.end-coin.bronze img { box-shadow: 0 0 0 3px var(--medal-bronze), 0 0 10px rgba(196, 122, 68, 0.6); }
.end-coin.silver img { box-shadow: 0 0 0 3px var(--medal-silver), 0 0 10px rgba(200, 210, 230, 0.8); }
.end-coin.gold img { box-shadow: 0 0 0 3px var(--medal-gold), 0 0 14px rgba(240, 192, 64, 0.9); }
.end-coin.none img { filter: grayscale(1) opacity(0.5); }
@media (max-width: 760px) { .end2-cols { grid-template-columns: 1fr; } }
/* résultat de duel : la médaille en pièce, comme partout */
.badge-big { width: 96px; height: 96px; border-radius: 50%; margin: 6px auto; box-shadow: 0 0 0 4px var(--leather), 0 5px 0 4px var(--leather-d), 0 0 26px rgba(255, 220, 120, 0.8); animation: coinIn 0.7s cubic-bezier(.2,1.6,.4,1) both; }
.master-screen.result.bronze .badge-big { background: radial-gradient(circle at 35% 30%, #f6c49a, var(--medal-bronze) 55%, #7a3e18); }
.master-screen.result.silver .badge-big { background: radial-gradient(circle at 35% 30%, #fff, var(--medal-silver) 55%, #5a6474); }
.master-screen.result.gold .badge-big { background: radial-gradient(circle at 35% 30%, #fff8c8, var(--medal-gold) 55%, #9a6008); }
.badge-big i { display: none; }
@keyframes coinIn { 0% { transform: scale(0.2) rotateY(540deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.qstep-done-sum { font-family: var(--pixel); font-size: 0.8em; color: #2f8a4a; margin: 2px 0 6px 4px; }
/* grand moment (chapitre complet) */
.moment { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 34px 16px; background: var(--card-bg); border-radius: 14px; box-shadow: var(--card-frame), 0 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 40px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: momentIn 0.55s cubic-bezier(.2,1.7,.4,1) both; text-align: center; }
.moment-icon { font-size: 2.6em; animation: momentIcon 1.2s ease-in-out infinite; }
.moment-title { font-family: var(--pixel); font-size: 1.7em; color: var(--ink); word-spacing: 0.25em; }
.moment-sub { font-family: var(--serif); font-size: 0.95em; color: var(--ink-soft); max-width: 460px; }
.moment.out { opacity: 0; transform: translate(-50%, -60%) scale(0.95); transition: opacity 0.5s, transform 0.5s; }
@keyframes momentIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-4deg); } }
@keyframes momentIcon { 50% { transform: translateY(-4px) scale(1.1); } }
/* flashcards bien visibles dans le Carnet */
.fc-btn.big { background: linear-gradient(180deg, #fff6d8, #f6dc9a); color: var(--ink); box-shadow: inset 0 0 0 2px #e0a030, 0 2px 0 #b07a1c; font-size: 0.95em; padding: 4px 12px; }
.fc-btn.big:hover { filter: brightness(1.05); transform: translateY(-1px); }
.pin.fc-mini.off { opacity: 0.25; cursor: default; }
/* nom du personnage (créateur) */
.cr-namebox { display: flex; flex-direction: column; gap: 3px; width: 100%; margin: 4px 0 2px; }
.cr-namebox span { font-family: var(--pixel); font-size: 0.85em; color: var(--ink); }
.cr-namebox i { font-family: var(--serif); font-size: 0.72em; color: var(--ink-soft); }
.cr-name { font: inherit; font-family: var(--pixel); font-size: 1.05em; padding: 6px 10px; border-radius: 8px; border: none; background: #fff; box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.3); color: var(--ink); }
.cr-name:focus { outline: none; box-shadow: inset 0 0 0 2px #e0a030; }
/* écran-titre : les parties enregistrées */
.sl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 150px; overflow-y: auto; }
.sl-card { display: flex; align-items: stretch; border-radius: 9px; background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.22); }
.sl-card.on { background: #fff3c8; box-shadow: inset 0 0 0 2px #e0a030; }
.sl-open { flex: 1; display: flex; align-items: center; gap: 8px; padding: 5px 6px; border: none; background: none; cursor: pointer; text-align: left; min-width: 0; }
.sl-open:hover { background: rgba(255, 255, 255, 0.5); border-radius: 9px; }
.sl-face { width: 40px; height: 40px; image-rendering: pixelated; border-radius: 8px; background: var(--paper-2); flex: none; }
.sl-info { display: flex; flex-direction: column; min-width: 0; }
.sl-info b { font-family: var(--pixel); font-weight: normal; color: var(--ink); font-size: 0.95em; }
.sl-langs { display: flex; align-items: center; gap: 4px; font-size: 0.72em; color: var(--ink-soft); }
.sl-langs canvas { width: 15px; height: 10px; image-rendering: pixelated; }
.sl-info i { font-family: var(--serif); font-size: 0.7em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-del { border: none; background: none; cursor: pointer; padding: 0 8px; opacity: 0.45; }
.sl-del:hover { opacity: 1; }

/* journal des scans : à droite, sous la fiche de quête */
.scan-log { position: absolute; right: 14px; top: 168px; z-index: 4; display: flex; flex-direction: column; gap: 6px; width: 250px; pointer-events: none; }
#ui.panel-open .scan-log { display: none; }
.sc-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 12px; background: var(--card-bg); border-radius: var(--card-r); box-shadow: var(--card-frame);
  animation: scIn 0.32s cubic-bezier(.2,1.5,.4,1) both; }
.sc-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; border-radius: var(--card-r) 0 0 var(--card-r); background: var(--accent); }
.sc-row.out { opacity: 0; transform: translateX(20px); transition: opacity 0.5s, transform 0.5s; }
.sc-pic canvas.pix { width: 40px; height: 40px; image-rendering: pixelated; display: block; }
.sc-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sc-word { font-family: var(--pixel); font-weight: normal; font-size: 1.05em; color: #1e2a4a; word-spacing: 0.2em; }
.sc-txt i { font-family: var(--serif); font-size: 0.74em; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-combo { position: absolute; right: 6px; top: -8px; font-style: normal; font-family: var(--pixel); font-size: 0.72em; padding: 1px 6px; border-radius: 6px; background: var(--k-gold); color: var(--ink); box-shadow: 0 2px 0 var(--gold-d); }
@keyframes scIn { from { opacity: 0; transform: translateX(30px) scale(0.9); } }
/* bulle de visée compacte (scanner / réécouter) */
.wlabel.compact { display: flex; align-items: center; gap: 6px; padding: 2px 8px 3px 4px; font-size: 0.8em; opacity: 0.92; }
.wlabel.compact .wl-main { font-size: 1em; }
.wlabel.compact .wl-key { margin: 0; font-size: 0.85em; padding: 0 5px; }
.wlabel.compact::after { border-width: 5px; bottom: -7px; }

/* ---- écran de chargement : le ciel du village, pas un mur marron ---- */
#boot { background: linear-gradient(180deg, #7ec8f2 0%, #a8dcf6 45%, #fdf1d4 78%, #f6e0b0 100%) !important; overflow: hidden; }
.boot-sky { position: absolute; inset: 0; pointer-events: none; }
.boot-sun { position: absolute; right: 14%; top: 12%; width: 72px; height: 72px; border-radius: 50%; background: radial-gradient(circle, #fff6c8 30%, #ffd860 62%, rgba(255, 216, 96, 0) 70%); box-shadow: 0 0 60px 20px rgba(255, 230, 140, 0.55); animation: bootSun 4s ease-in-out infinite; }
.boot-cloud { position: absolute; width: 120px; height: 34px; background: #fff; border-radius: 4px;
  box-shadow: 16px -14px 0 -2px #fff, 46px -22px 0 0 #fff, 78px -12px 0 -4px #fff, 0 6px 0 0 #e4f2fb, 46px -16px 0 0 #fff; image-rendering: pixelated; animation: bootCloud linear infinite; opacity: 0.95; }
.boot-cloud.c1 { top: 18%; left: -160px; animation-duration: 38s; }
.boot-cloud.c2 { top: 32%; left: -160px; animation-duration: 54s; animation-delay: -20s; transform: scale(0.7); }
.boot-cloud.c3 { top: 9%; left: -160px; animation-duration: 46s; animation-delay: -34s; transform: scale(0.85); }
.boot-hills { position: absolute; left: 0; right: 0; bottom: 0; height: 22%;
  background: radial-gradient(ellipse 40% 90% at 20% 100%, #6ab85c 60%, transparent 61%), radial-gradient(ellipse 45% 100% at 75% 100%, #88cc58 60%, transparent 61%), linear-gradient(0deg, #63ba58 0 40%, transparent 40%); }
@keyframes bootCloud { to { left: 110%; } }
@keyframes bootSun { 50% { transform: scale(1.06); } }
#boot .boot-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 16px; }
#boot h1 { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; font-size: clamp(2.4rem, 7vw, 4.2rem); color: #fff !important; text-shadow: 0 5px 0 #4a2f3c, 0 0 24px rgba(255, 255, 255, 0.6) !important; }
#boot h1 em { color: #f0b040 !important; letter-spacing: 0.34em; text-shadow: 0 5px 0 #8a4a10, 0 0 24px rgba(255, 220, 120, 0.7); }
#boot .boot-card { padding: 10px 14px 8px; background: var(--card-bg); border-radius: 12px; box-shadow: var(--card-frame); }
#boot .boot-track { margin: 0; background: #f0e2c0; box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.3); }
#boot #boot-bar { background: repeating-linear-gradient(90deg, #f0b040 0 8px, #ffd27a 8px 12px); box-shadow: 0 0 8px rgba(240, 176, 64, 0.7); }
#boot #boot-note { margin: 6px 0 0; color: var(--ink) !important; font-size: 0.85rem; text-align: center; }
#boot #boot-note::before { content: none; }
#boot-tip { margin: 0; max-width: min(520px, 86vw); padding: 6px 12px; border-radius: 9px; background: rgba(255, 255, 255, 0.75); color: var(--ink); font-family: var(--serif); font-size: 0.92rem; text-align: center; box-shadow: 0 2px 0 rgba(74, 47, 60, 0.25); }
#boot-tip:empty { display: none; }
#boot #boot-tip { color: var(--ink) !important; font-family: var(--serif) !important; word-spacing: normal; }
#boot #boot-tip::before { content: none !important; }
/* créateur : bandeau des langues choisies + retour */
.creator-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; }
.creator-wrap .creator { position: relative; inset: auto; flex: 1; min-height: 0; }
.cr-langs { align-self: center; margin-top: 14px; display: flex; align-items: center; gap: 14px; padding: 7px 14px 7px 8px; background: var(--card-bg); border-radius: var(--card-r); box-shadow: var(--card-frame); font-family: var(--pixel); color: var(--ink); z-index: 2; }
.cr-langs-pair { display: flex; align-items: center; gap: 7px; font-size: 1.05em; word-spacing: 0.2em; }
.cr-langs-pair b { font-weight: normal; }
.cr-langs canvas { width: 27px; height: 18px; image-rendering: pixelated; }
.cr-arrow { color: #e0a030; font-size: 1.2em; }
.cr-langs i { font-family: var(--serif); font-size: 0.82em; color: var(--ink-soft); }
.cr-back { font-size: 0.85em; padding: 0.35em 0.8em; }
@media (max-height: 560px) { .cr-langs { margin-top: 6px; padding: 4px 10px 4px 6px; transform: scale(0.85); } }
/* « ! » au-dessus des personnages importants */
.npc-mark { position: absolute; left: 0; top: 0; width: 26px; height: 32px; display: grid; place-items: center; font-family: var(--pixel); font-size: 1.5em; color: #c0392b;
  background: linear-gradient(180deg, #fff6c8, #ffd860); border-radius: 8px; box-shadow: 0 0 0 2px var(--leather), 0 3px 0 2px var(--leather-d), 0 0 14px rgba(255, 200, 60, 0.8); pointer-events: none; }
/* l'image d'une question, sur une carte (les icônes pâles ne se perdent plus dans le décor) */
.qz-pic { padding: 8px; border-radius: 14px; background: var(--card-bg); box-shadow: var(--card-frame); }

/* ======================================================================
   Pages Carte, Statistiques, Amis (ui/pages.js)
   ====================================================================== */
:root { --pg-chip: rgba(255, 255, 255, 0.5); --pg-chip-on: #fff3c8; --pg-track: rgba(120, 85, 50, 0.16); }
[data-theme="dark"] { --pg-chip: rgba(255, 240, 210, 0.07); --pg-chip-on: rgba(240, 188, 88, 0.18); --pg-track: rgba(255, 240, 210, 0.1); }
.pg-bar { flex: 1; min-width: 40px; height: 8px; border-radius: 4px; background: var(--pg-track); overflow: hidden; }
.pg-bar i { display: block; height: 100%; border-radius: 4px; background: var(--accent, #e0a030); }
.pg-where { margin: 0 0 6px; font-family: var(--pixel); font-size: 0.85em; color: var(--ink); word-spacing: 0.25em; }
.pg-note { margin: 6px 0 0; font-size: 0.78em; color: var(--ink-soft); font-style: italic; }
/* carte : vieille carte encadrée (liseré d'encre, coins, vignette), dessin pixel dans ui/mapArt.js */
.pg-map-wrap { position: relative; padding: 5px; border-radius: 6px; background: #e9d6a8; box-shadow: 0 0 0 2px var(--leather), 0 4px 0 2px var(--leather-d), 0 8px 14px rgba(60, 30, 20, 0.25); }
.pg-map-wrap::before { content: ''; position: absolute; inset: 2px; border: 1px solid rgba(74, 47, 60, 0.55); border-radius: 4px; pointer-events: none; }
.pg-map-wrap::after { content: ''; position: absolute; inset: 5px; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(58, 36, 48, 0.7), inset 0 0 22px rgba(120, 80, 30, 0.35); }
.pg-map { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.pg-compass { position: absolute; right: 12px; top: 12px; width: 26px; height: 26px; border-radius: 50%; background: #fbf1d8; box-shadow: 0 0 0 1.5px #3a2430, 0 2px 0 1.5px rgba(58, 36, 48, 0.4); pointer-events: none; z-index: 1; }
.pg-compass::before { content: ''; position: absolute; left: 50%; top: 4px; width: 0; height: 0; transform: translateX(-50%); border: 4px solid transparent; border-bottom: 9px solid #c0392b; border-top: 0; }
.pg-compass::after { content: ''; position: absolute; left: 50%; bottom: 4px; width: 0; height: 0; transform: translateX(-50%); border: 4px solid transparent; border-top: 9px solid #3a2430; border-bottom: 0; }
.pg-compass b { position: absolute; left: 50%; top: -11px; transform: translateX(-50%); font: 9px/1 var(--pixel); color: #3a2430; text-shadow: 0 0 2px #fbf1d8, 0 0 2px #fbf1d8; }
/* épingle de lieu : médaillon à l'icône du chapitre, anneau = mots trouvés, or = complet */
.pg-pin { position: absolute; transform: translate(-50%, -78%); width: 22px; height: 22px; border-radius: 50%; font-style: normal;
  background: conic-gradient(var(--accent, #c08040) var(--p, 0%), rgba(58, 36, 48, 0.22) 0); box-shadow: 0 0 0 1.5px #3a2430, 0 2px 0 1.5px rgba(58, 36, 48, 0.45); }
.pg-pin > span { position: absolute; inset: 3px; display: grid; place-items: center; border-radius: 50%; background: #fbf1d8; color: #3a2430; font-size: 10px; line-height: 1; }
.pg-pin::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 4px solid transparent; border-top: 5px solid #3a2430; border-bottom: 0; }
.pg-pin.done { background: linear-gradient(180deg, #ffe680, #e0a020); }
.pg-pin.done > span { background: #fff6c8; color: #b07810; font-family: var(--pixel); }
.pg-pin.pinned { animation: pgPin 1.1s ease-in-out infinite; z-index: 1; }
.pg-pin.static { position: relative; display: inline-block; transform: none; width: 16px; height: 16px; margin-right: 6px; vertical-align: middle; animation: none; }
.pg-pin.static > span { inset: 2.5px; font-size: 7px; }
.pg-pin.static::after { display: none; }
@keyframes pgPin { 50% { transform: translate(-50%, -96%); } }
.pg-map-layer { position: absolute; inset: 0; pointer-events: none; }
.pg-mk { position: absolute; transform: translate(-50%, -50%); font-style: normal; }
.pg-mk.me { width: 12px; height: 12px; border-radius: 50%; background: #e8403a; box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(232, 64, 58, 0.35); animation: pgPulse 1.2s ease-in-out infinite; }
.pg-mk.npc { min-width: 14px; height: 16px; padding: 0 2px; border-radius: 4px; background: linear-gradient(180deg, #fff6c8, #ffd860); color: #c0392b; font: 12px/16px var(--pixel); text-align: center; box-shadow: 0 0 0 1.5px #4a2f3c; animation: pgBob 0.9s ease-in-out infinite; }
.pg-mk.weapon { font-size: 13px; filter: drop-shadow(0 1px 0 #4a2f3c); }
.pg-mk.static { position: static; display: inline-block; transform: none; animation: none; margin-right: 5px; vertical-align: middle; }
.pg-mk.me.static { width: 10px; height: 10px; }
@keyframes pgPulse { 50% { box-shadow: 0 0 0 2px #fff, 0 0 0 7px rgba(232, 64, 58, 0.15); } }
@keyframes pgBob { 50% { transform: translate(-50%, -62%); } }
.pg-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); padding: 5px 9px; border-radius: 7px; background: var(--card-bg); box-shadow: var(--card-frame); color: var(--ink); white-space: nowrap; pointer-events: none; display: flex; flex-direction: column; gap: 1px; font-size: 0.8em; z-index: 2; }
.pg-tip b { font-family: var(--pixel); word-spacing: 0.25em; }
.pg-tip.hidden { display: none; }
.pg-tip-hint { font-size: 0.85em; opacity: 0.7; }
.pg-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 0.78em; color: var(--ink); }
.pg-legend > span { display: inline-flex; align-items: center; }
.pg-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; box-shadow: 0 0 0 1.5px #4a2f3c; }
.pg-place { margin-bottom: 8px; }
.pg-place h4 { margin: 4px 0; font-family: var(--pixel); font-size: 0.82em; color: var(--ink-soft); word-spacing: 0.25em; }
.pg-row { display: flex; align-items: center; gap: 8px; width: 100%; margin: 3px 0; padding: 4px 8px; border: none; border-radius: 7px; background: var(--pg-chip); color: var(--ink); cursor: pointer; text-align: left; box-shadow: inset 3px 0 0 var(--accent); font: inherit; }
.pg-row:hover, .pg-row.on { background: var(--pg-chip-on); }
.pg-row.on::after { content: "📌"; }
.pg-row.done b { color: #b08010; }
.pg-ico { width: 1.4em; text-align: center; }
.pg-name { flex: 0 0 42%; font-size: 0.85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-row b { font-family: var(--pixel); font-size: 0.75em; min-width: 46px; text-align: right; }

.pg-group { margin-bottom: 10px; }
.pg-stat { display: flex; align-items: center; gap: 8px; padding: 3px 8px; margin: 2px 0; border-radius: 6px; background: var(--pg-chip); color: var(--ink); font-size: 0.86em; }
.pg-stat > span { flex: 1; }
.pg-stat > b { font-family: var(--pixel); font-size: 0.85em; word-spacing: 0.2em; }
.pg-stat .pg-bar { flex: 0 0 70px; }
.pg-lang canvas { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3); }

.pg-add { display: flex; gap: 6px; margin: 8px 0 4px; }
.pg-in { flex: 1; min-width: 0; padding: 6px 10px; border: none; border-radius: 7px; background: #fffaf0; color: var(--ink); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.3); font: inherit; }
[data-theme="dark"] .pg-in { background: #1a1420; box-shadow: inset 0 0 0 2px rgba(255, 230, 190, 0.15); }
.pg-msg { margin: 4px 0; font-size: 0.82em; color: var(--ink-soft); font-style: italic; }
.pg-friends { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.pg-friend { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; background: var(--pg-chip); color: var(--ink); }
.pg-friend.me { background: var(--pg-chip-on); box-shadow: inset 0 0 0 2px rgba(240, 192, 64, 0.5); }
.pg-face { width: 40px; height: 40px; border-radius: 8px; background: var(--paper-2); image-rendering: pixelated; flex: 0 0 auto; box-shadow: 0 0 0 2px var(--leather); }
.pg-f-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pg-f-name b { font-family: var(--pixel); word-spacing: 0.2em; }
.pg-f-name i { color: var(--ink-soft); font-size: 0.85em; }
.pg-f-lang { display: flex; align-items: center; gap: 5px; font-size: 0.8em; color: var(--ink-soft); }
.pg-f-bar { display: flex; align-items: center; gap: 6px; font-size: 0.75em; }
.pg-f-bar .pg-bar { flex: 0 0 34%; }
.pg-f-cmp { font-size: 0.75em; color: #b0601a; }
[data-theme="dark"] .pg-f-cmp { color: #e0a070; }
.pg-f-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 0.72em; color: var(--ink-soft); }
.pg-f-x { border: none; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 1em; padding: 2px 4px; border-radius: 4px; }
.pg-f-x:hover { background: rgba(192, 64, 58, 0.15); color: #c0403a; }
.pg-rank { display: flex; flex-direction: column; gap: 4px; }
.pg-rank-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; background: var(--pg-chip); color: var(--ink); font-size: 0.86em; }
.pg-rank-row.me { background: var(--pg-chip-on); }
.pg-rank-row .pg-face { width: 26px; height: 26px; border-radius: 6px; }
.pg-rank-n { font-family: var(--pixel); width: 1.4em; text-align: center; }
.pg-rank-name { flex: 0 0 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-rank-row b { font-family: var(--pixel); font-size: 0.85em; min-width: 34px; text-align: right; }
/* 7 onglets : les libellés se tassent sur les écrans étroits */
@media (max-width: 1100px) { .menu-tab .mt-label { display: none; } }

/* ======================================================================
   v8.19 — le carnet tient dans sa largeur
   ====================================================================== */
/* onglets : exactement la largeur du carnet, ils se partagent la place */
.panel-wrap .menu-tabs { width: min(calc(96vw - 180px), 1000px); box-sizing: border-box; container-type: inline-size; padding: 0 14px; gap: 5px; }
.panel-wrap .menu-tabs .menu-tab { flex: 1 1 auto; min-width: 0; justify-content: center; padding: 0 8px 8px; gap: 6px; }
.panel-wrap .menu-tabs .menu-tab.close { flex: 0 0 40px; }
.menu-tab .mt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.menu-tab kbd, .menu-tab .mt-icon { flex: 0 0 auto; }
@container (max-width: 940px) { .menu-tab kbd { display: none; } }
@container (max-width: 640px) { .menu-tab .mt-label { display: none; } }
@media (max-width: 1100px) { .menu-tab .mt-label { display: revert; } }
@container (max-width: 640px) { .menu-tab .mt-label { display: none !important; } }

/* signets : une icône par chapitre, rubans fins qui dépassent à peine du carnet */
.panel.panel-book.book-panel { margin-right: 46px; }
.ribbons.compact.many { right: -50px; top: 14px; bottom: 14px; gap: 1px; padding-right: 6px; }
.ribbons.compact.many .ribbon {
  width: 52px; min-height: 0; height: clamp(13px, calc((100% - 40px) / 36), 19px); flex: 1 1 0; max-height: 19px;
  padding: 0 14px 0 6px; font-size: 12px; line-height: 1; justify-content: center; align-items: flex-start;
  background: linear-gradient(90deg, var(--accent) var(--fill, 100%), color-mix(in srgb, var(--accent) 55%, #5a4030) var(--fill, 100%));
  filter: brightness(0.9);
}
.ribbons.compact.many .ribbon .ribbon-label { display: block; overflow: hidden; }
.ribbons.compact.many .ribbon:hover { transform: translateX(6px); filter: brightness(1.08); }
.ribbons.compact.many .ribbon.on { transform: translateX(10px); filter: none; box-shadow: inset 0 0 0 2px #fff8e8; }
.ribbons.compact.many .ribbon.grp { margin-top: 6px; }
/* les onglets suivent le carnet ouvert (même largeur, même décalage) */
.panel-wrap:has(.panel-book) .menu-tabs { margin-right: 46px; }
.panel-wrap:has(.panel-quests) .menu-tabs { width: min(96vw, 1060px); }

/* graphiques de la page Statistiques (ui/charts.js) — couleurs validées (outil dataviz) */
:root { --ch-bar: #b07a1c; --ch-hi: #6e4410; --ch-axis: rgba(120, 85, 50, 0.35); --ch-track: rgba(120, 85, 50, 0.12);
  --ch-lv0: #d4a04a; --ch-lv1: #b8801e; --ch-lv2: #8c5a12; --ch-lv3: #56340a; }
[data-theme="dark"] { --ch-bar: #c08628; --ch-hi: #f6d488; --ch-axis: rgba(255, 230, 190, 0.25); --ch-track: rgba(255, 240, 210, 0.08);
  --ch-lv0: #6e5638; --ch-lv1: #9c763a; --ch-lv2: #d0a048; --ch-lv3: #f6d488; }
.ch-box { position: relative; padding: 6px 8px 8px; border-radius: 9px; background: var(--pg-chip); margin-bottom: 8px; }
.ch-title { font-family: var(--pixel); font-size: 0.78em; color: var(--ink-soft); word-spacing: 0.25em; margin-bottom: 4px; }
.ch-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-bar { fill: var(--ch-bar); }
.ch-bar.hi { fill: var(--ch-hi); }
.ch-hit { fill: transparent; }
.ch-hit:hover + .ch-bar, .ch-bar:hover { filter: brightness(1.15); }
.ch-axis { stroke: var(--ch-axis); stroke-width: 1; }
.ch-track { fill: var(--ch-track); }
.ch-lbl { fill: var(--ink-soft); font: 9px var(--sans); }
.ch-lbl.hi { fill: var(--ink); font-weight: 700; }
.ch-val { fill: var(--ink); font: 700 9px var(--sans); }
.ch-seg.lv0, .ch-sw.lv0 { fill: var(--ch-lv0); background: var(--ch-lv0); }
.ch-seg.lv1, .ch-sw.lv1 { fill: var(--ch-lv1); background: var(--ch-lv1); }
.ch-seg.lv2, .ch-sw.lv2 { fill: var(--ch-lv2); background: var(--ch-lv2); }
.ch-seg.lv3, .ch-sw.lv3 { fill: var(--ch-lv3); background: var(--ch-lv3); }
.ch-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 5px; font-size: 0.74em; color: var(--ink); }
.ch-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ch-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.ch-empty { position: absolute; inset: 22px 0 18px; display: grid; place-items: center; font-size: 0.78em; font-style: italic; color: var(--ink-soft); pointer-events: none; }
.ch-tip { position: absolute; transform: translate(-50%, calc(-100% - 8px)); padding: 3px 8px; border-radius: 6px; background: var(--card-bg); box-shadow: var(--card-frame); color: var(--ink); font-size: 0.74em; white-space: nowrap; pointer-events: none; z-index: 3; }
.ch-tip.hidden { display: none; }

/* page Pouvoirs (ui/pages.js renderPowers) */
.pw-count { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-family: var(--pixel); font-size: 0.82em; color: var(--ink); }
.pw-count .pg-bar { flex: 1; }
.pw-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 7px; border-radius: 10px; background: var(--pg-chip); color: var(--ink); }
.pw-card.got { box-shadow: inset 3px 0 0 #e8b830; }
.pw-card.locked .pw-ico { filter: grayscale(1) brightness(0.55); opacity: 0.55; }
.pw-ico { flex: 0 0 44px; height: 44px; display: grid; place-items: center; font-size: 26px; border-radius: 10px; background: var(--paper-2); box-shadow: 0 0 0 2px var(--leather), 0 2px 0 2px var(--leather-d); }
.pw-main { flex: 1; min-width: 0; }
.pw-name { display: flex; align-items: center; gap: 8px; }
.pw-name b { font-family: var(--pixel); word-spacing: 0.2em; }
.pw-tag { font-size: 0.68em; padding: 1px 6px; border-radius: 6px; background: var(--pg-track); color: var(--ink-soft); }
.pw-tag.ok { background: rgba(232, 184, 48, 0.25); color: var(--ink); }
.pw-desc { margin: 2px 0; font-size: 0.8em; color: var(--ink); }
.pw-how { margin: 0; font-size: 0.75em; color: var(--ink-soft); font-style: italic; }
.pw-card .toggle { flex: 0 0 auto; }

/* ======================================================================
   v8.26 — cinq onglets : Aventure en livre (carte | objectifs), Collection,
   Profil et Réglages en une seule feuille avec intercalaires
   ====================================================================== */
.panel.panel-adventure.book-panel { width: min(96vw, 1060px); margin-right: 0; }
.panel-wrap:has(.panel-adventure) .menu-tabs { width: min(96vw, 1060px); }
.sheet-book { display: flex; }
.sheet {
  position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 22px 30px 18px; border-radius: 10px; color: var(--ink);
  background: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(120, 150, 190, 0.12) 31px 32px),
    radial-gradient(ellipse at 50% 35%, var(--paper) 0%, var(--paper-2) 100%);
  filter: drop-shadow(0 3px 0 #d8c8a4) drop-shadow(0 6px 0 #c8b48c);
}
[data-theme="dark"] .sheet {
  background: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(150, 180, 230, 0.06) 31px 32px),
    radial-gradient(ellipse at 50% 35%, #30263a 0%, #221a28 100%);
  filter: drop-shadow(0 3px 0 #3a3042) drop-shadow(0 6px 0 #2a2230);
}
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 2px dashed rgba(120, 85, 50, 0.28); }
[data-theme="dark"] .sheet-head { border-bottom-color: rgba(255, 230, 190, 0.14); }
.sheet-titles .chapter-title { margin: 0; }
.sheet-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sheet-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: none; border-radius: 8px 8px 3px 3px; cursor: pointer;
  font-family: var(--pixel); font-size: 0.82em; word-spacing: 0.2em; color: var(--ink-soft);
  background: var(--pg-chip); box-shadow: inset 0 -2px 0 rgba(120, 85, 50, 0.18);
}
.sheet-tab:hover { color: var(--ink); background: var(--pg-chip-on); }
.sheet-tab.on { color: var(--ink); background: var(--pg-chip-on); box-shadow: inset 0 -3px 0 #e0a030; }
.sheet-cols { flex: 1; min-height: 0; display: grid; gap: 26px; }
.sheet-cols.n1 { grid-template-columns: 1fr; }
.sheet-cols.n2 { grid-template-columns: 1fr 1fr; }
.sheet-col { min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.sheet-col > .page-scroll, .sheet-col > .qscroll { flex: 1; min-height: 0; overflow-y: auto; }
.sheet-col-title { margin: 0; font-family: var(--pixel); font-size: 0.88em; color: var(--ink-soft); word-spacing: 0.25em; }
@media (max-width: 760px) { .sheet-cols.n2 { grid-template-columns: 1fr; overflow-y: auto; } .sheet-col { min-height: auto; } .sheet { padding: 14px; } }

/* Collection → Pouvoirs : une planche en grille */
.pw-board { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.pw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.pw-grid .pw-card { margin: 0; align-items: flex-start; }

/* Profil → Parties */
.pf-slots { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.pf-slot { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--pg-chip); color: var(--ink); }
.pf-slot.on { background: var(--pg-chip-on); box-shadow: inset 3px 0 0 #e0a030; }
.pf-slot .pg-face { width: 48px; height: 48px; }
.pf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pf-name { display: flex; align-items: center; gap: 8px; }
.pf-name b { font-family: var(--pixel); word-spacing: 0.2em; }
.pf-langs { display: flex; align-items: center; gap: 6px; font-size: 0.8em; color: var(--ink-soft); }
.pf-bar { display: flex; align-items: center; gap: 8px; font-size: 0.76em; }
.pf-bar .pg-bar { flex: 0 0 30%; }
.pf-ago { font-size: 0.72em; color: var(--ink-soft); }
.pf-actions { display: flex; justify-content: flex-end; margin-top: 4px; }

/* ---------------------------------------------------------- contrôles (touches, manette) */
.kb-row { display: grid; grid-template-columns: 1fr 58px 58px 58px; align-items: center; gap: 4px; padding: 2px 0; border-bottom: 1px dashed rgba(120, 85, 50, 0.18); }
.kb-head { border: none; font-family: var(--pixel); font-size: 0.72em; color: var(--ink-soft); word-spacing: 0.2em; }
.kb-head > span:nth-child(2) { grid-column: 2 / span 2; text-align: center; }
.kb-name { font-size: 0.86em; color: var(--ink); }
.kb-slot { height: 26px; border: none; border-radius: 6px; cursor: pointer; background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.22); display: grid; place-items: center; padding: 0; }
.kb-slot:hover { background: #fff8e4; box-shadow: inset 0 0 0 2px #e0a030; }
.kb-slot.empty kbd { opacity: 0.35; }
.kb-slot.waiting { background: #fff3c8; box-shadow: inset 0 0 0 2px #e0a030; animation: kbWait 0.8s ease-in-out infinite; }
.kb-slot kbd { min-width: 22px; }
@keyframes kbWait { 50% { box-shadow: inset 0 0 0 2px #e0a030, 0 0 0 3px rgba(224, 160, 48, 0.35); } }
.kb-group h4 { margin-bottom: 2px; }
.kb-wait, .kb-note { margin: 0 0 8px; padding: 6px 9px; border-radius: 7px; background: #fff3c8; box-shadow: inset 0 0 0 2px #e0a030; font-size: 0.82em; color: var(--ink); }
.kb-note { background: rgba(255, 255, 255, 0.55); box-shadow: inset 0 0 0 2px rgba(120, 85, 50, 0.22); }
.kb-pad { margin: 2px 0 4px; font-size: 0.85em; color: var(--ink); }
.kb-help { margin: 2px 0 0; font-size: 0.76em; color: var(--ink-soft); line-height: 1.35; }

/* boutons de manette : pastille ronde aux couleurs de la manette (A vert, B rouge, X bleu, Y jaune) */
kbd.pad { border-radius: 999px; min-width: 20px; padding: 0 5px; color: #fff; background: #4a4450; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); font-family: var(--pixel); }
kbd.pad-a { background: #3aa856; } kbd.pad-b { background: #d0453a; } kbd.pad-x { background: #3a78d0; } kbd.pad-y { background: #e0b020; color: #3a2a10; }
kbd.pad-lb, kbd.pad-rb, kbd.pad-lt, kbd.pad-rt { border-radius: 6px; }

/* curseur de la manette dans les menus */
.pad-focus { outline: 3px solid #f0b020 !important; outline-offset: 2px; border-radius: 6px; box-shadow: 0 0 0 6px rgba(240, 176, 32, 0.28) !important; position: relative; z-index: 2; animation: padFocus 1.1s ease-in-out infinite; }
@keyframes padFocus { 50% { outline-color: #ffd860; } }
html:not([data-device="pad"]) .pad-focus { outline: none !important; animation: none; }

/* ---- zoom de la carte du carnet (pages.js mapZoom) : molette, glisser, pincer, barre − / + */
.pg-map-view { position: relative; overflow: hidden; touch-action: none; border-radius: 3px; }
.pg-map-view.zoomed { cursor: grab; }
.pg-map-view.grabbing { cursor: grabbing; }
.pg-map-stage { position: relative; transform-origin: 0 0; will-change: transform; }
/* les marqueurs gardent leur taille à l'écran quel que soit le zoom */
.pg-map-stage :is(.pg-pin, .pg-mk) { scale: calc(1 / var(--zoom, 1)); transform-origin: 0 0; }
.pg-zoom { position: absolute; right: 12px; bottom: 12px; z-index: 2; display: none; align-items: center; gap: 6px;
  padding: 4px 6px; border-radius: 8px; background: var(--card-bg); box-shadow: var(--card-frame); }
.pg-zoom .slider { width: 110px; }
.pg-zoom-btn { width: 26px; height: 26px; border: none; border-radius: 6px; cursor: pointer; font: 16px/1 var(--pixel);
  background: var(--paper-2); color: var(--ink); box-shadow: 0 0 0 2px var(--leather); }
/* la barre de zoom : sur les écrans tactiles (la molette n'existe pas) */
body.touch .pg-zoom { display: flex; }
@media (pointer: coarse) { .pg-zoom { display: flex; } }
/* tactile : la barre sous la carte (pas par-dessus), compacte */
body.touch .pg-zoom { position: static; margin: 6px auto 0; width: max-content; padding: 3px 6px; box-shadow: none; background: transparent; }
body.touch .pg-zoom .slider { width: 120px; }
body.touch .pg-zoom-btn { width: 24px; height: 24px; font-size: 14px; }
