/* =========================================================================
   ImmersiClasse — thème clair (accueil, lecteur, bases de l'éditeur)
   ========================================================================= */
:root {
  /* surfaces */
  --bg: #f3f4f8; --bg2: #eceef4;
  --surface: #ffffff; --surface2: #f8f9fc; --surface3: #eff1f6;
  --field: #ffffff;
  --line: #e4e7ef; --line2: #d4d9e4; --line3: #bfc6d4;
  /* texte */
  --text: #161a25; --text2: #343b4d; --muted: #5f687c; --faint: #8d95a7;
  /* couleurs */
  --accent: #0f6b7a; --accent-h: #0b5763; --accent-2: #475467; --accent-3: #0f6b7a;
  --accent-soft: #e7f1f3; --accent-soft2: #d4e7eb; --accent-ring: rgba(15, 107, 122, .26); --accent-line: rgba(15, 107, 122, .45);
  --ok: #138a4b; --ok-soft: #e6f6ed; --warn: #b26a00; --warn-soft: #fff4e0; --danger: #d92d43; --danger-soft: #fdecee;
  --grad: #0f6b7a;
  /* forme */
  --r-xs: 6px; --r-sm: 8px; --r: 11px; --r-lg: 16px; --r-xl: 22px;
  --shadow-xs: 0 1px 2px rgba(22, 26, 37, .06);
  --shadow-sm: 0 1px 2px rgba(22, 26, 37, .05), 0 2px 6px -2px rgba(22, 26, 37, .08);
  --shadow: 0 2px 4px rgba(22, 26, 37, .04), 0 10px 24px -10px rgba(22, 26, 37, .16);
  --shadow-lg: 0 4px 10px rgba(22, 26, 37, .05), 0 30px 70px -24px rgba(22, 26, 37, .32);
  --glass: rgba(255, 255, 255, .84); --glass-line: rgba(255, 255, 255, .9);
  --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration-color: rgba(15, 107, 122, .35); text-underline-offset: 3px; }
::selection { background: rgba(15, 107, 122, .2); }
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.i { display: inline-grid; place-items: center; flex: none; line-height: 0; }

* { scrollbar-width: thin; scrollbar-color: #c9cfdb transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd4df; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #b5bcca; }

/* ---------- boutons ---------- */
.btn {
  --b: var(--line2);
  background: var(--surface); border: 1px solid var(--b); border-radius: var(--r-sm); padding: 7px 13px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  color: var(--text2); font-size: .88rem; font-weight: 550; line-height: 1.2; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease), box-shadow .15s;
  user-select: none;
}
.btn:hover { --b: var(--line3); background: var(--surface2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 107, 122,.3), 0 6px 16px -8px rgba(15, 107, 122,.7); }
.btn.primary:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); box-shadow: none; }
.btn.soft:hover { background: var(--accent-soft2); color: var(--accent-h); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { --b: rgba(217,45,67,.35); color: var(--danger); background: var(--danger-soft); }
.btn:disabled, .btn:disabled:hover { opacity: .42; cursor: default; transform: none; --b: var(--line2); background: var(--surface); }
.btn.on { --b: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; box-shadow: none; --b: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface3); color: var(--text); }
.btn.ghost.on { background: var(--accent-soft); color: var(--accent); }
.btn.lg { padding: 11px 18px; font-size: .98rem; border-radius: var(--r); }
.btn.sm { padding: 5px 9px; font-size: .8rem; }
.btn.icon { padding: 7px; width: 34px; height: 34px; }

/* ---------- champs ---------- */
input[type=text], input[type=number], input[type=url], input[type=search], select, textarea {
  background: var(--field); border: 1px solid var(--line2); border-radius: var(--r-sm);
  padding: 6px 9px; width: 100%; transition: border-color .15s, box-shadow .15s; color: var(--text);
}
input[type=text]:hover, input[type=number]:hover, input[type=url]:hover, input[type=search]:hover, select:hover, textarea:hover { border-color: var(--line3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%235f687c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
textarea { resize: vertical; line-height: 1.45; }
input[type=color] { width: 40px; height: 30px; padding: 3px; border: 1px solid var(--line2); border-radius: var(--r-sm); background: var(--field); cursor: pointer; flex: none; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 4px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
input[type=range] { accent-color: var(--accent); }

.muted { color: var(--muted); }
.hidden { display: none !important; }
kbd {
  display: inline-block; min-width: 1.7em; text-align: center;
  background: var(--surface); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; font: 600 .76em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text2);
}

/* ---------- notifications ---------- */
#toasts { position: fixed; z-index: 90; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(560px, 92vw); background: #1d2230; color: #f4f6fb; padding: 9px 14px; border-radius: 12px;
  box-shadow: 0 12px 30px -10px rgba(10, 14, 24, .5); font-size: .88rem; animation: toast-in .25s var(--ease); white-space: pre-line; }
.toast .i { color: #9fd3dc; }
.toast.err { background: #8f1d2c; }
.toast.err .i { color: #ffd0d6; }
.toast.ok .i { color: #7ee2a8; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* =========================================================================
   Accueil
   ========================================================================= */
body.home-page { background: var(--bg); }
.home { max-width: 1160px; margin: 0 auto; padding: 0 28px 90px; }

.nav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 10px 0; margin: 0 -28px; padding-inline: 28px; background: rgba(243, 244, 248, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid transparent; }
.nav .nav-links { margin-left: auto; }
.nav-cta { padding: 7px 14px; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.015em; color: var(--text); text-decoration: none; font-size: 1.02rem; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--text); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.brand-accent { color: #3b6fd4; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 500; padding: 7px 11px; border-radius: 9px; }
.nav-links a:hover { color: var(--text); background: rgba(22, 26, 37, .05); }

.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 44px; align-items: center; padding: 50px 0 34px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(15, 107, 122, .18); padding: 5px 11px; border-radius: 999px; }
.eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.home h1 { font-size: clamp(2.3rem, 5vw, 3.7rem); line-height: 1.04; letter-spacing: -.038em; margin: 18px 0 16px; font-weight: 800; color: #10131c; }
.home h1 .grad { color: var(--accent); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 34em; margin: 0 0 26px; line-height: 1.6; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: .84rem; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; }
.hero-note span::before { content: '✓'; color: var(--ok); margin-right: 6px; font-weight: 700; }
.error-box { margin: 18px 0 0; padding: 10px 14px; border-radius: var(--r); background: var(--danger-soft); border: 1px solid rgba(217, 45, 67, .25); color: #9b1c2f; }

/* visuel 3D en CSS pur (salle claire) */
.hero-visual { position: relative; aspect-ratio: 5 / 4; border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(180deg, #eef1f4 0%, #f6f7f9 52%, #e3e7ec 52.2%, #eceff3 100%); box-shadow: var(--shadow-lg); isolation: isolate; }
.hero-visual::before { content: none; }
.hv-floor { position: absolute; left: -50%; right: -50%; bottom: -10%; height: 62%; transform-origin: 50% 0; transform: perspective(380px) rotateX(62deg);
  background-image: linear-gradient(rgba(15, 107, 122, .22) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 107, 122, .22) 1px, transparent 1px);
  background-size: 44px 44px; animation: hv-scroll 7s linear infinite;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 40%); mask-image: linear-gradient(to bottom, transparent 0%, #000 40%); }
.hv-horizon { position: absolute; left: 0; right: 0; top: 52%; height: 1px; background: linear-gradient(90deg, transparent, rgba(71, 84, 103, .5), transparent); }
@keyframes hv-scroll { to { background-position: 0 44px, 0 0; } }
.hv-obj { position: absolute; transform-style: preserve-3d; }
.hv-cube { --s: 62px; width: var(--s); height: var(--s); left: 20%; top: 36%; animation: hv-spin 16s linear infinite; }
.hv-cube i { position: absolute; inset: 0; border: 1px solid rgba(15, 107, 122, .55); background: rgba(255, 255, 255, .7); }
.hv-cube i:nth-child(1) { transform: translateZ(calc(var(--s) / 2)); }
.hv-cube i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.hv-cube i:nth-child(3) { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); background: rgba(231, 241, 243, .9); }
.hv-cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); background: rgba(231, 241, 243, .9); }
.hv-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); background: rgba(205, 225, 229, .95); }
.hv-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
@keyframes hv-spin { from { transform: perspective(600px) rotateX(-22deg) rotateY(0); } to { transform: perspective(600px) rotateX(-22deg) rotateY(360deg); } }
.hv-orb { width: 52px; height: 52px; right: 19%; top: 30%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #c9d3dc 45%, #8a97a6 100%);
  box-shadow: 0 18px 30px -12px rgba(14, 116, 144, .55); animation: hv-float 5s ease-in-out infinite; }
.hv-portal { width: 72px; height: 112px; left: 50%; top: 35%; margin-left: -36px; border-radius: 40px 40px 6px 6px; border: 3px solid #fff;
  background: rgba(15, 107, 122, .18);
  border-color: var(--accent); }
.hv-person { position: absolute; left: 60%; top: 58%; width: 18px; height: 46px; border-radius: 9px 9px 5px 5px; background: #0f6b7a; box-shadow: 0 10px 14px -8px rgba(22,26,37,.5); }
.hv-person::before { content: ''; position: absolute; left: 2px; top: -16px; width: 14px; height: 14px; border-radius: 50%; background: #f1c9a5; }
@keyframes hv-float { 50% { transform: translateY(-14px); } }
@keyframes hv-glow { 50% { box-shadow: 0 24px 50px -12px rgba(71, 84, 103, .85), inset 0 0 36px rgba(255, 255, 255, .7); } }
.hv-tag { position: absolute; font-size: .72rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .9); border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--text2); white-space: nowrap; }
.hv-tag b { color: var(--accent); font-weight: 700; margin-right: 4px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0; }
.feature { transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.feature:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line2); }
.feature .fi { font-size: 1.1rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; counter-reset: s; }
.steps li { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--r-lg); background: var(--surface2); border: 1px dashed var(--line3); }
.steps li > b { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: .9rem; }
.steps h3 { margin: 2px 0 4px; font-size: 1rem; }
.steps p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.cta-band { margin-top: 64px; padding: 30px 34px; border-radius: var(--r-xl); background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; box-shadow: var(--shadow-lg); }
.home .cta-band h2 { color: #fff; font-size: 1.45rem; }
.cta-band p { margin: 6px 0 0; color: rgba(255, 255, 255, .82); }
.cta-btn { background: #fff; color: var(--accent-h); border-color: #fff; }
.cta-btn:hover { background: var(--accent-soft); color: var(--accent-h); }
.card.skeleton { min-height: 280px; background: linear-gradient(100deg, var(--surface3) 30%, var(--surface2) 50%, var(--surface3) 70%); background-size: 200% 100%; animation: sk 1.2s linear infinite; box-shadow: none; }
@keyframes sk { to { background-position: -200% 0; } }
body.dropping::after { content: 'Déposez votre fichier .immersiclasse pour l\'importer'; position: fixed; inset: 12px; z-index: 80; display: grid; place-items: center; border: 3px dashed var(--accent); border-radius: var(--r-xl); background: rgba(231, 241, 243, .88); color: var(--accent-h); font-size: 1.3rem; font-weight: 700; pointer-events: none; }
.feature { padding: 18px 18px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
.feature .fi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 12px; background: var(--accent-soft); color: var(--accent); }
.feature:nth-child(2) .fi { background: var(--surface3); color: var(--text2); }
.feature:nth-child(3) .fi { background: var(--surface3); color: var(--text2); }
.feature h3 { margin: 0 0 4px; font-size: .98rem; }
.feature p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 50px 0 16px; }
.home h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.018em; font-weight: 750; }
.home h2 small { font-size: .85rem; font-weight: 500; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.count { font-size: .76rem; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; }
.card:hover { transform: translateY(-3px); border-color: var(--line2); box-shadow: var(--shadow); }
.card-thumb { --h: 240; position: relative; height: 148px; overflow: hidden;
  background: linear-gradient(180deg, hsl(var(--h) 85% 95%) 0%, hsl(calc(var(--h) + 25) 70% 90%) 55%, hsl(var(--h) 40% 84%) 55.5%, hsl(var(--h) 50% 92%) 100%); }
.card-thumb::before { content: ''; position: absolute; left: -40%; right: -40%; bottom: -30%; height: 80%; transform-origin: 50% 0; transform: perspective(260px) rotateX(60deg);
  background-image: linear-gradient(hsl(var(--h) 60% 50% / .25) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--h) 60% 50% / .25) 1px, transparent 1px);
  background-size: 30px 30px; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 50%); mask-image: linear-gradient(to bottom, transparent, #000 50%); transition: transform .6s var(--ease); }
.card:hover .card-thumb::before { transform: perspective(260px) rotateX(60deg) translateY(30px); }
.card-thumb::after { content: ''; position: absolute; left: 50%; top: 22%; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%;
  background: radial-gradient(circle, hsl(calc(var(--h) - 30) 90% 80% / .9), transparent 70%); }
.card-badge { position: absolute; top: 12px; left: 12px; z-index: 1; font-size: .72rem; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .9); border: 1px solid rgba(22, 26, 37, .08); color: var(--text2); }
.card-initial { position: absolute; right: 14px; bottom: 6px; z-index: 1; font-size: 3.1rem; font-weight: 800; letter-spacing: -.04em; color: hsl(var(--h) 40% 30% / .16); line-height: 1; }
.card-body { padding: 15px 17px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 1.05rem; letter-spacing: -.012em; }
.card p { margin: 0; color: var(--muted); font-size: .89rem; line-height: 1.5; flex: 1; }
.card .meta { font-size: .8rem; color: var(--faint); display: flex; gap: 6px; align-items: center; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.card .row .btn.danger { margin-left: auto; }
.card-new { align-items: center; justify-content: center; text-align: center; gap: 10px; min-height: 250px; border-style: dashed; border-color: var(--line3); background: transparent; color: var(--muted); text-decoration: none; padding: 20px; box-shadow: none; }
.card-new:hover { color: var(--text); background: rgba(15, 107, 122, .03); border-color: var(--accent-line); }
.card-new .plus { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); transition: transform .25s var(--ease); }
.card-new:hover .plus { transform: rotate(90deg) scale(1.05); }
.card-new strong { color: var(--text); font-size: 1rem; }
.empty { color: var(--muted); padding: 22px; border: 1px dashed var(--line3); border-radius: var(--r-lg); background: var(--surface); }
.foot { margin-top: 70px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--faint); font-size: .84rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .hero-visual { max-width: 560px; }
  .features, .steps { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav .nav-cta { margin-left: auto; }
  .cta-band { padding: 24px 22px; }
}

/* =========================================================================
   Lecteur
   ========================================================================= */
body.player { overflow: hidden; }
.stage { position: fixed; inset: 0; background: #dfe4ee; }
.stage canvas { width: 100%; height: 100%; display: block; touch-action: none; }
body.free-look .stage canvas { cursor: grab; }
body.free-look.dragging .stage canvas { cursor: grabbing; }
body.free-look.hovering .stage canvas { cursor: pointer; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; padding: 20px;
  background: rgba(236, 239, 246, .55); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); animation: fade-in .22s ease; }
.dialog { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 30px 32px 28px; max-width: 560px; width: 100%; box-shadow: var(--shadow-lg); animation: pop-in .32s var(--ease); max-height: calc(100vh - 40px); overflow-y: auto; }
.dialog h1, .dialog h2 { margin: 0 0 8px; letter-spacing: -.025em; color: #10131c; }
.dialog h1 { font-size: 1.75rem; }
.dialog h2 { font-size: 1.3rem; }
.dialog p { color: var(--muted); line-height: 1.6; white-space: pre-wrap; margin: 0; }
.dialog .actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.dialog .eyebrow { margin-bottom: 14px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.choice { margin-top: 20px; }
.choice > .lbl { font-size: .74rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; display: block; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { display: flex; gap: 11px; align-items: flex-start; text-align: left; padding: 11px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.opt:hover { border-color: var(--line3); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.opt .i { width: 30px; height: 30px; border-radius: 9px; background: var(--surface3); color: var(--text2); }
.opt.on .i { background: var(--accent); color: #fff; }
.opt b { display: block; font-size: .9rem; color: var(--text); }
.opt small { display: block; font-size: .78rem; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.choice > .lbl small { text-transform: none; letter-spacing: 0; font-weight: 500; }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: .86rem; color: var(--muted); }
.keys > span:nth-child(odd) { white-space: nowrap; }

#menu .dialog { max-width: 440px; }
.menu-list { display: grid; gap: 8px; margin-top: 18px; }
.menu-list .btn { justify-content: flex-start; padding: 10px 14px; font-size: .92rem; }
.menu-list .btn .i { color: var(--muted); }
.menu-list .btn.primary .i { color: #fff; }
.setting { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 12px; padding: 8px 2px; font-size: .88rem; color: var(--text2); border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: none; }
.seg-mini { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface3); gap: 2px; }
.seg-mini button { border: none; background: transparent; padding: 5px 10px; border-radius: 7px; font-size: .82rem; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg-mini button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* HUD */
.hud-pill { background: var(--glass); border: 1px solid var(--glass-line); box-shadow: 0 6px 24px -10px rgba(22, 26, 37, .35); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }
#hud-top { position: fixed; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; z-index: 10; pointer-events: none; }
#hud-top > * { pointer-events: auto; }
#zone-name { display: inline-flex; align-items: center; gap: 9px; padding: 8px 15px 8px 12px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--text);
  max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#zone-name::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .22); }
#hud-links { display: flex; gap: 2px; padding: 4px; border-radius: 13px; }
#hud-links .btn { background: transparent; border-color: transparent; box-shadow: none; padding: 6px 10px; font-size: .84rem; color: var(--text2); }
#hud-links .btn:hover { background: rgba(22, 26, 37, .06); }
#hud-links .btn.on { background: var(--accent-soft); color: var(--accent); }
#hud-links .sep { width: 1px; background: var(--line); margin: 4px 3px; }

#crosshair { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(22, 26, 37, .55); z-index: 10; pointer-events: none; transition: transform .15s var(--ease), background .15s, box-shadow .15s; }
#crosshair.hot { transform: scale(2.6); background: rgba(15, 107, 122, .25); box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba(15, 107, 122, .8); }
#prompt { position: fixed; left: 50%; top: calc(50% + 30px); transform: translateX(-50%); padding: 7px 14px; border-radius: 11px; z-index: 10; pointer-events: none; font-size: .9rem; font-weight: 600; color: var(--text); animation: fade-in .2s ease; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
#prompt.at-cursor { transform: translate(14px, 14px); }
#help { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); color: var(--text2); font-size: .78rem; z-index: 10; pointer-events: none; white-space: nowrap; padding: 6px 13px; border-radius: 999px; }
#help kbd { font-size: .72em; }
#help .esc { color: var(--accent); font-weight: 650; }
#zone-toast { position: fixed; top: 18%; left: 50%; transform: translate(-50%, 8px); font-size: clamp(1.6rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -.03em; color: #fff; text-shadow: 0 2px 18px rgba(10, 14, 24, .45); z-index: 10; pointer-events: none; opacity: 0; transition: opacity .5s, transform .6s var(--ease); text-align: center; }
#zone-toast::after { content: ''; display: block; width: 48px; height: 3px; margin: 10px auto 0; border-radius: 3px; background: #fff; }
#zone-toast.show { opacity: 1; transform: translate(-50%, 0); }
#fade { position: fixed; inset: 0; background: #f3f4f8; opacity: 0; pointer-events: none; transition: opacity .28s; z-index: 15; }
#fade.on { opacity: 1; }
#info-panel .dialog { max-width: 620px; }
#info-panel .body { max-height: 55vh; overflow-y: auto; margin-top: 6px; }
#info-panel .body p { margin: 0 0 .8em; color: var(--text2); }
#info-panel.wide .dialog { max-width: 780px; }
#info-panel .body { max-height: 64vh; }
/* fiche « sur le côté » : la scène reste visible et animée (maquettes reliées à un schéma, par exemple) */
#info-panel.dock { display: block; padding: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; animation: none; }
#info-panel.dock .dialog { pointer-events: auto; position: absolute; right: 16px; top: 64px; bottom: 16px; width: min(440px, 42vw); max-width: none; max-height: none; display: flex; flex-direction: column; padding: 22px 22px 18px; animation: none; box-shadow: var(--shadow-lg); }
#info-panel.dock .body { flex: 1; max-height: none; min-height: 0; }
#info-panel.dock .actions { margin-top: 12px; }
#info-panel.dock .info-content { display: flex; flex-direction: column; }
#info-panel.dock .ib-html { order: -1; } /* le schéma d'abord, les explications dessous */
#info-panel.dock .ib-text { order: 1; font-size: .88rem; }
/* contenu des fiches (js/core/info.js) — aussi utilisé par l'aperçu de l'éditeur */
.info-content { line-height: 1.6; color: var(--text2); }
.info-content .ib-text p { margin: 0 0 .8em; color: var(--text2); white-space: normal; }
.info-content .ib-text h3 { margin: 1.1em 0 .4em; font-size: 1.02rem; color: var(--text); letter-spacing: -.01em; }
.info-content .ib-text ul, .info-content .ib-text ol { margin: 0 0 .8em; padding-left: 1.3em; }
.info-content .ib-text li { margin: .15em 0; }
.info-content a { color: var(--accent); }
.info-content .ib-figure { margin: 4px 0 16px; }
.info-content .ib-figure img { display: block; max-width: 100%; max-height: 46vh; margin: 0 auto; border-radius: 12px; cursor: zoom-in; }
.info-content .ib-figure img.zoom { max-height: none; cursor: zoom-out; }
.info-content figcaption { margin-top: 6px; font-size: .82rem; color: var(--muted); text-align: center; }
.info-content figcaption p { margin: 0; text-align: center; color: var(--muted); }
.info-content .ib-video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #0d1018; }
.info-content .ib-video.file { aspect-ratio: auto; max-height: 52vh; }
.info-content .ib-audio { display: block; width: 100%; }
.info-content .ib-embed, .info-content .ib-frame { display: block; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.info-content .ib-frame { border-color: transparent; }
.info-content .ib-html { margin: 4px 0 16px; }
.info-content .ib-btn { margin: 4px 0 14px; }
.info-content .ib-missing { margin: 4px 0 14px; padding: 14px; border-radius: 12px; background: var(--accent-soft, #eef); color: var(--muted); font-size: .84rem; text-align: center; }

#minimap { position: fixed; left: 14px; bottom: 14px; z-index: 10; width: 188px; height: 188px; border-radius: 18px; padding: 0; overflow: hidden; }
#minimap canvas { width: 100%; height: 100%; display: block; }
#minimap .n { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font: 700 .66rem/1 system-ui; color: var(--muted); }

#touch-ui { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#touch-ui .btn { pointer-events: auto; position: absolute; bottom: 28px; width: 64px; height: 64px; border-radius: 50%; justify-content: center; font-size: 1.2rem; background: var(--glass); border-color: var(--glass-line); backdrop-filter: blur(10px); }
#stick { position: absolute; left: 30px; bottom: 30px; width: 116px; height: 116px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .9); background: rgba(255, 255, 255, .35); backdrop-filter: blur(6px); }
#stick i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px; border-radius: 50%; background: #fff; box-shadow: 0 4px 14px rgba(22, 26, 37, .25); }

@media (max-width: 640px) {
  #help, #minimap { display: none; }
  #hud-links .btn .lbl { display: none; }
  .dialog { padding: 24px 22px; }
  .choice-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================================
   Fenêtres modales (bibliothèque, aide)
   ========================================================================= */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(22, 26, 37, .32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; animation: fade-in .2s ease; }
.modal-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); width: min(1040px, 100%); height: min(760px, 100%); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop-in .3s var(--ease); }
.modal-box.small { height: auto; max-height: 100%; width: min(720px, 100%); }
.modal-box.drop { outline: 2px dashed var(--accent); outline-offset: -10px; }
.lib-head { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--surface); }
.lib-head h2 { margin: 0 6px 0 0; font-size: 1.06rem; letter-spacing: -.015em; }
.lib-head input[type=text] { flex: 1; min-width: 160px; width: auto; height: 36px; padding-left: 34px;
  background: var(--surface2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238d95a7' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center; }
.lib-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface3); }
.lib-tabs .btn { background: transparent; border-color: transparent; box-shadow: none; padding: 5px 11px; font-size: .84rem; color: var(--muted); border-radius: 7px; }
.lib-tabs .btn:hover { color: var(--text); }
.lib-tabs .btn.on { color: var(--text); background: var(--surface); box-shadow: var(--shadow-xs); }
.lib-grid { flex: 1; overflow-y: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; align-content: start; background: var(--surface2); }
.lib-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 8px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 5px; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.lib-card:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow); }
.lib-card.busy { opacity: .7; cursor: progress; transform: none; }
.lib-thumb { position: relative; aspect-ratio: 1; border-radius: 9px; overflow: hidden; display: grid; place-items: center; background: radial-gradient(80% 80% at 50% 30%, #ffffff, #e9ecf3); }
.lib-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .35s var(--ease); }
.lib-card:hover .lib-thumb img { transform: scale(1.06); }
.lib-card.nothumb .lib-thumb::after { content: '◆'; font-size: 2rem; color: #c9cfdb; position: absolute; }
.lib-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(22, 26, 37, .08); }
.lib-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.lib-name { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 2px 0; color: var(--text); }
.lib-sub { font-size: .72rem; color: var(--faint); min-height: 1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.lib-del { position: absolute; top: 13px; right: 13px; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, .95); border: 1px solid var(--line2); display: none; place-items: center; font-size: .7rem; cursor: pointer; color: var(--danger); }
.lib-card:hover .lib-del { display: grid; }
.lib-del:hover { background: var(--danger); color: #fff; }
.lib-empty, .lib-more { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 34px 10px; }
.lib-note { padding: 9px 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: .76rem; background: var(--surface); }
.lib-section { grid-column: 1 / -1; font-weight: 650; padding: 10px 2px 0; border-top: 1px solid var(--line); margin-top: 4px; }
.lib-section small { font-weight: 450; color: var(--faint); }
.lib-badge { position: absolute; top: 12px; left: 12px; font-size: .66rem; font-weight: 600; padding: 2px 7px; border-radius: 99px; background: rgba(20, 24, 33, .62); color: #fff; pointer-events: none; }
.lib-badge.free { background: #1f8a5b; }
.lib-tokenrow { margin-left: 6px; white-space: nowrap; }
.lib-token { width: 170px; font-size: .74rem; padding: 2px 6px; }
.lib-note a { color: inherit; }
.lib-msg { padding: 9px 16px; background: var(--ok-soft); border-bottom: 1px solid rgba(19, 138, 75, .2); color: #0d6b3a; font-size: .84rem; white-space: pre-wrap; }
.lib-msg.err { background: var(--danger-soft); border-bottom-color: rgba(217, 45, 67, .25); color: #9b1c2f; }

.shortcuts { padding: 6px 22px 22px; overflow-y: auto; columns: 2 300px; column-gap: 34px; }
.shortcuts section { break-inside: avoid; margin-bottom: 14px; }
.shortcuts h4 { margin: 14px 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.shortcuts .row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: .86rem; color: var(--text2); border-bottom: 1px dashed var(--line); }
.shortcuts .row span:last-child { white-space: nowrap; }

/* ---------- personnage : carte de l'accueil et fenêtre « Mon personnage » ---------- */
.av-current { width: 100%; align-items: center; }
.av-current img { width: 76px; height: 76px; border-radius: 12px; background: var(--surface3); object-fit: cover; flex: none; }
.av-current .btn { margin-top: 7px; pointer-events: none; }
.av-overlay { z-index: 40; }
.av-dialog { max-width: 920px; display: grid; grid-template-columns: 300px 1fr; gap: 22px; padding: 22px; height: min(640px, calc(100vh - 40px)); }
.av-preview { position: relative; border-radius: 16px; background: radial-gradient(120% 80% at 50% 30%, #ffffff, #e9ecf3); display: flex; flex-direction: column; overflow: hidden; }
.av-canvas { width: 300px; height: 420px; max-width: 100%; cursor: grab; touch-action: none; flex: 1; object-fit: contain; }
.av-canvas:active { cursor: grabbing; }
.av-who { text-align: center; font-weight: 650; color: var(--text); font-size: .92rem; padding: 0 10px; }
.av-preview-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 10px; }
.av-side { display: flex; flex-direction: column; min-height: 0; }
.av-side h2 { margin-bottom: 10px; }
.av-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 11px; background: var(--surface3); align-self: flex-start; }
.av-tab { border: none; background: transparent; padding: 6px 13px; border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.av-tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.av-body { flex: 1; overflow-y: auto; margin: 12px -6px 0; padding: 0 6px 6px; }
.av-body h3 { font-size: .74rem; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; margin: 16px 0 8px; }
.av-hint { font-size: .84rem; margin: 0 0 4px !important; }
.av-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.av-preset { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 6px 9px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; text-align: center; transition: border-color .15s, box-shadow .15s; }
.av-preset:hover { border-color: var(--line3); }
.av-preset.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.av-preset img { width: 100%; aspect-ratio: 1; border-radius: 9px; background: linear-gradient(#f4f5f9, #e6e9f0); }
.av-preset b { font-size: .83rem; color: var(--text); }
.av-preset small { font-size: .72rem; color: var(--muted); line-height: 1.3; }
.av-field { margin-top: 14px; }
.av-field > .lbl { display: block; font-size: .78rem; font-weight: 650; color: var(--text2); margin-bottom: 6px; }
.av-field .input { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1.5px solid var(--line); font: inherit; background: var(--surface); }
.av-field .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.av-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.av-chip, .av-toggle { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: .82rem; font-weight: 550; color: var(--text2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.av-chip:hover, .av-toggle:hover { border-color: var(--line3); }
.av-chip.on, .av-toggle.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.av-toggle input { accent-color: var(--accent); margin: 0; }
.av-swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.av-sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line2); cursor: pointer; padding: 0; position: relative; display: grid; place-items: center; font-size: .8rem; color: var(--muted); background: var(--surface3); }
.av-sw.on { box-shadow: 0 0 0 2.5px var(--accent); }
.av-sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
@media (max-width: 760px) {
  .av-dialog { grid-template-columns: 1fr; height: auto; }
  .av-canvas { height: 260px; }
}

/* mode « borne » : la fiche d'un totem s'affiche sur son écran (js/play/main.js : openKiosk) */
.kiosk { position: fixed; inset: 0; z-index: 12; pointer-events: none; overflow: hidden; }
.kiosk-screen { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: auto; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box;
  background: linear-gradient(180deg, #151a2a, #0c0f1a); color: #e8ecf5; font-size: 17px; border-radius: 6px;
  --text: #f2f5fc; --text2: #c3cad9; --line: rgba(255, 255, 255, .16); --accent: var(--k-accent, #3aa0ff); --surface: rgba(255, 255, 255, .06); }
.kiosk-head { flex: none; padding: 14px 20px 12px; border-bottom: 3px solid var(--k-accent, #3aa0ff); font-size: 1.12em; font-weight: 750; letter-spacing: -.01em; background: rgba(255, 255, 255, .04); }
.kiosk-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 22px; overscroll-behavior: contain; touch-action: pan-y; }
.kiosk-body .ib-figure img { max-height: none; }
.kiosk-body .ib-video { max-height: none; }
.kiosk-screen.fill .kiosk-body { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.kiosk-screen.fill .kiosk-body .ib-text { flex: none; padding: 12px 20px 0; }
.kiosk-screen.fill .kiosk-body .ib-btn { flex: none; padding: 8px 20px 12px; }
.kiosk-screen.fill .kiosk-body .ib-figure, .kiosk-screen.fill .kiosk-body .ib-html { flex: 1; min-height: 0; margin: 0; display: flex; flex-direction: column; }
.kiosk-screen.fill .kiosk-body iframe { flex: 1; min-height: 0; height: auto !important; border-radius: 0; border: 0; }
#kiosk-exit { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 13; padding: 9px 18px; border-radius: 999px; }
/* Affichage permanent : la page est DERRIÈRE le canvas, qui est troué à l'emplacement de l'écran (voir js/play/main.js) → l'avatar et le décor la recouvrent normalement. */
.kiosk.ambient { z-index: -1; }
body.player, body.player .stage { background: transparent; } /* sinon le fond de <body> recouvre la page (z-index négatif) */
.kiosk.ambient .kiosk-screen { pointer-events: none; }

/* ---------- lecteur intégré à l'accueil (?embed=1) ---------- */
.embed #start-keys, .embed #start-options, .embed #start .eyebrow, .embed #start .actions .ghost, .embed #menu a[href="index.html"] { display: none; }
.embed #start .dialog { max-width: 440px; padding: 22px 26px 22px; text-align: center; }
.embed #start .actions { justify-content: center; margin-top: 16px; }
.embed #start-title { font-size: 1.45rem; }
.embed #start-desc { font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- activité « légender un objet 3D » (js/play/legend.js) : tiroir sur le côté, la scène reste visible ---------- */
#legend-panel { position: fixed; right: 16px; top: 64px; bottom: 16px; width: min(400px, 42vw); z-index: 40; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 18px 18px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); color: var(--text); }
#legend-panel.hidden { display: none; }
#legend-panel .lg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#legend-panel h2 { margin: 0; font-size: 1.1rem; }
#legend-panel .lg-instr { margin: 0; color: var(--text2); font-size: .9rem; }
#legend-panel .lg-sec { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
#legend-panel .lg-progress { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--muted); }
#legend-panel .lg-progress .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
#legend-panel .lg-progress .bar i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
#legend-panel .lg-score { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--text2); font-size: .88rem; }
#legend-panel .lg-score b { font-size: 1.15rem; }
#legend-panel .lg-score.ok { background: var(--ok-soft); }
#legend-panel .lg-bank { display: flex; flex-wrap: wrap; gap: 4px; }
#legend-panel .chip { border: 1px solid var(--line2); background: var(--surface2); color: var(--text); border-radius: 99px; padding: 3px 9px; font: inherit; font-size: .78rem; cursor: pointer; }
#legend-panel .chip:hover { border-color: var(--accent); background: var(--accent-soft); }
#legend-panel .lg-empty { color: var(--faint); font-size: .84rem; }
#legend-panel .lg-rows { display: flex; flex-direction: column; gap: 6px; }
#legend-panel .lg-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); cursor: pointer; }
#legend-panel .lg-row.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--surface); }
#legend-panel .lg-row.ok { background: var(--ok-soft); border-color: var(--ok); }
#legend-panel .lg-row.ko { background: var(--danger-soft); border-color: var(--danger); }
#legend-panel .lg-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #e8590c; color: #fff; font-weight: 800; font-size: .8rem; display: grid; place-items: center; }
#legend-panel .lg-row.ok .lg-num { background: var(--ok); }
#legend-panel .lg-row.ko .lg-num { background: var(--danger); }
#legend-panel .lg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
#legend-panel .lg-main select { width: 100%; }
#legend-panel .lg-main small { color: var(--text2); font-size: .8rem; }
#legend-panel .lg-main .lg-fix { color: var(--danger); font-weight: 600; }
#legend-panel .lg-main .lg-hint { color: var(--warn); }
#legend-panel .lg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
@media (max-width: 700px) { #legend-panel { top: auto; height: 46vh; left: 8px; right: 8px; width: auto; bottom: 8px; } }
