/* =====================================================================
 *  Cloud Capital — interface par-dessus la maquette 3D
 *
 *  Mise en page :  barre du haut (lieu · trésorerie · boutons)
 *                  colonne de gauche « Installation » (jauges + clic)
 *                  colonne de droite « Objectifs » (étape suivante, missions)
 *                  barre de construction en bas (onglets + cartes)
 *  Chaque bloc déclare --inset (top / left / right / bottom) : la caméra
 *  3D cadre la maquette dans l'espace qu'ils laissent libre.
 * ===================================================================== */
:root {
  --bg: #070b16;
  --panel-a: rgba(24, 35, 64, 0.8);
  --panel-b: rgba(10, 16, 32, 0.82);
  --panel-2: rgba(30, 44, 78, 0.9);
  --line: rgba(130, 165, 255, 0.16);
  --line-2: rgba(130, 165, 255, 0.3);
  --text: #eaf0fb;
  --muted: #98a6c6;
  --faint: #66739a;
  --accent: #3ee0ff;
  --accent-ink: #052230;
  --good: #3dff9a;
  --warn: #ffb547;
  --bad: #ff5d6c;
  --money: #ffd166;
  --font: "Segoe UI", Inter, Roboto, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, ui-monospace, monospace;
  --radius: 16px;
  --edge: 12px;          /* marge autour de l'interface */
  --top-h: 74px;         /* hauteur de la barre du haut */
  --side-w: 226px;       /* largeur des colonnes */
  --dock-h: 206px;       /* hauteur de la barre de construction (mesurée par ui.js) */
  --spring: cubic-bezier(0.2, 0.9, 0.3, 1.25);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 35%, #1b2a4a 0%, #0c1426 55%, var(--bg) 100%);
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  transition: background 1.2s;
}
button { font: inherit; color: inherit; }
kbd { font: 11px var(--mono); padding: 0 4px; border-radius: 4px; border: 1px solid var(--line-2); }

#scene {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; cursor: grab;
}
#scene:active { cursor: grabbing; }

/* Ambiance des événements sur le fond de l'écran */
body.ev-heatwave { background: radial-gradient(ellipse at 50% 35%, #5a3a24 0%, #2a1a14 55%, #120b08 100%); }
body.ev-storm { background: radial-gradient(ellipse at 50% 35%, #1a2230 0%, #0b0f18 55%, #04060b 100%); }
body.ev-rush { background: radial-gradient(ellipse at 50% 35%, #123a4a 0%, #0b1a2b 55%, var(--bg) 100%); }
/* Derniers lieux : sous l'océan, puis en orbite (ciel étoilé) */
body[data-world="abyss"] { background: radial-gradient(ellipse at 50% -10%, #2a93bd 0%, #0d4a6e 40%, #042036 75%, #020d18 100%); }
body[data-world="orbit"] {
  background-color: #02040c;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.6px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1.6px),
    radial-gradient(circle at 45% 80%, rgba(200, 220, 255, 0.85) 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 85% 15%, rgba(255, 240, 220, 0.6) 0 0.8px, transparent 1.3px),
    radial-gradient(ellipse at 50% 115%, #1b3f7a 0%, #070c1e 55%, #02040c 100%);
  background-size: 173px 167px, 211px 199px, 257px 241px, 131px 127px, 100% 100%;
}

/* Panneau de verre commun */
.panel {
  background: linear-gradient(180deg, var(--panel-a), var(--panel-b));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.panel h4 {
  margin: 0 0 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint);
}

/* Arrivée de l'interface au chargement */
.hud-top { animation: dropIn 0.6s var(--ease) backwards; }
.side-left { animation: slideL 0.6s 0.1s var(--ease) backwards; }
.side-right { animation: slideR 0.6s 0.15s var(--ease) backwards; }
.dock { animation: riseIn 0.6s 0.2s var(--ease) backwards; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-24px); } }
@keyframes slideL { from { opacity: 0; transform: translateX(-30px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(30px); } }
@keyframes riseIn { from { opacity: 0; transform: translate(-50%, 30px); } to { transform: translate(-50%, 0); } }

/* =========================================================== barre du haut */
.hud-top {
  --inset: top;
  position: fixed; top: var(--edge); left: var(--edge); right: var(--edge); z-index: 6;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }

.brand {
  justify-self: start; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px 8px 8px; min-width: 0; max-width: 100%; height: 62px;
}
.brand-icon {
  width: 46px; height: 46px; flex: none; border-radius: 13px; display: grid; place-items: center; font-size: 24px;
  background: radial-gradient(circle at 30% 25%, rgba(62, 224, 255, 0.22), rgba(62, 224, 255, 0.04) 70%);
  border: 1px solid var(--line-2);
}
.brand-icon .ic { animation: popIn 0.5s var(--spring); }
.brand-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.brand-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Badge de la version de test (branche beta sur Cloudflare) */
.channel-tag { margin-left: 6px; padding: 0 6px; border-radius: 99px; font: 800 9.5px var(--mono); letter-spacing: 0.6px;
  color: #06101f; background: #ffb44a; vertical-align: 1px; cursor: help; }
.brand-text small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; }
.stepper { display: flex; gap: 3px; margin-top: 4px; }
.stepper i { width: 14px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); transition: background 0.4s; }
.stepper i.done { background: var(--accent); }
.stepper i.now { background: var(--money); box-shadow: 0 0 8px var(--money); animation: breathe 1.6s ease-in-out infinite; }
.save-ind { font-size: 12px; opacity: 0.35; cursor: default; transition: opacity 0.6s; }
.save-ind.blink { animation: saveBlink 1.2s ease-out; }
.save-ind.bad { opacity: 1; animation: throb 0.9s infinite; }
@keyframes saveBlink { 0% { opacity: 1; transform: scale(1.4); } 100% { opacity: 0.35; transform: scale(1); } }

.wallet {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 28px 8px; min-width: 230px; height: 62px; border-color: rgba(255, 209, 102, 0.28);
  cursor: default;
}
.money {
  font: 800 28px/1 var(--mono); color: var(--money); white-space: nowrap; letter-spacing: -0.5px;
  text-shadow: 0 0 22px rgba(255, 209, 102, 0.3);
}
.money.up { animation: moneyUp 0.5s var(--ease); }
.money.down { animation: moneyDown 0.4s var(--ease); }
@keyframes moneyUp { 30% { transform: scale(1.08); text-shadow: 0 0 30px rgba(255, 209, 102, 0.8); } }
@keyframes moneyDown { 30% { color: #ffb0a0; transform: scale(0.97); } }
.income {
  font: 700 12px var(--mono); color: var(--good); white-space: nowrap;
  padding: 1px 10px; border-radius: 99px; background: rgba(61, 255, 154, 0.1);
}
body.fast .income { color: var(--warn); background: rgba(255, 181, 71, 0.14); }

.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.pill-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px 0 13px;
  border-radius: 999px; cursor: pointer; font-size: 18px; white-space: nowrap;
  background: linear-gradient(180deg, var(--panel-a), var(--panel-b)); border: 1px solid var(--line);
  backdrop-filter: blur(14px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s var(--ease), border-color 0.2s, background 0.2s;
}
.pill-btn span { font-size: 13px; font-weight: 600; }
.pill-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.pill-btn.on { border-color: var(--accent); background: rgba(62, 224, 255, 0.2); }
.pill-btn.gold { border-color: rgba(255, 209, 102, 0.45); }
.pill-btn.gold:hover { border-color: var(--money); }
.pill-btn:not([hidden]) { animation: popIn 0.45s var(--spring); }
.icon-group { display: flex; padding: 3px; gap: 2px; border-radius: 999px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 17px;
  display: grid; place-items: center; background: transparent; border: 0;
  transition: background 0.2s, transform 0.15s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); transform: scale(1.08); }
.icon-btn:active { transform: scale(0.92); }

/* Pastilles de comptage */
.badge {
  position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  font: 700 10.5px/18px var(--mono); font-style: normal; text-align: center;
  color: var(--accent-ink); background: var(--good); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  display: none; pointer-events: none;
}
.badge.on { display: block; animation: popIn 0.35s var(--spring); }
.badge.alert { display: block; background: var(--bad); color: #fff; animation: throb 0.8s infinite; }
.top-actions .badge { background: var(--money); color: #2b1d00; }
.pill-btn .badge { top: -6px; right: -4px; }

/* =========================================================== alertes / événements */
.ticker {
  position: fixed; top: calc(var(--edge) + var(--top-h)); left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: min(620px, calc(100vw - 2 * var(--side-w) - 60px));
  pointer-events: none;
}
.ticker > * { pointer-events: auto; }
.events { display: contents; }
#alert, .ev-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; border: 0; border-radius: 999px;
  padding: 0 12px 0 9px; font: 700 12px var(--mono); white-space: nowrap;
  backdrop-filter: blur(10px); animation: popIn 0.4s var(--spring);
}
#alert { cursor: pointer; background: rgba(255, 93, 108, 0.2); color: var(--bad); box-shadow: inset 0 0 0 1px rgba(255, 93, 108, 0.55), 0 0 18px rgba(255, 93, 108, 0.25); }
#alert::after { content: 'Résoudre ›'; font: 600 11px var(--font); opacity: 0.8; margin-left: 2px; }
#alert.warn { background: rgba(255, 181, 71, 0.18); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(255, 181, 71, 0.5); }
#alert.info { background: rgba(62, 224, 255, 0.14); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(62, 224, 255, 0.4); }
#alert.info::after { content: 'Voir ›'; }
#alert:not(.info) .ic { animation: wiggle 1.2s ease-in-out infinite; }
.ev-chip { cursor: default; }
.ev-chip span { font-size: 15px; display: grid; }
.ev-chip.good { background: rgba(61, 255, 154, 0.16); color: var(--good); box-shadow: inset 0 0 0 1px rgba(61, 255, 154, 0.45); }
.ev-chip.bad { background: rgba(255, 93, 108, 0.16); color: var(--bad); box-shadow: inset 0 0 0 1px rgba(255, 93, 108, 0.45); }
.ev-chip.pickup { cursor: pointer; animation: popIn 0.4s var(--spring), bob 1.4s 0.4s ease-in-out infinite; }
.ev-chip.pickup:hover { filter: brightness(1.3); }

/* =========================================================== colonnes */
.side {
  position: fixed; top: calc(var(--edge) + var(--top-h) + 10px); z-index: 5; width: var(--side-w);
  display: flex; flex-direction: column; gap: 10px;
}
.side-left { --inset: left; left: var(--edge); }
.side-right { --inset: right; right: var(--edge); }

/* Jauges de l'installation */
.status { padding: 12px 10px 8px; }
.status h4 { padding: 0 6px; }
.stat {
  width: 100%; display: grid; grid-template-columns: 24px 1fr auto; grid-template-rows: auto 5px; align-items: center;
  column-gap: 8px; row-gap: 5px; padding: 7px 6px 8px; border: 0; border-radius: 10px; background: transparent;
  cursor: pointer; text-align: left; transition: background 0.2s;
}
.stat:hover { background: rgba(255, 255, 255, 0.05); }
.stat-icon { font-size: 17px; display: grid; place-items: center; }
.stat-name { font-size: 12.5px; font-weight: 600; }
.stat-val { font: 600 11px var(--mono); color: var(--muted); white-space: nowrap; }
.stat-bar { grid-column: 1 / -1; position: relative; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stat-bar b {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #1fa9d6, var(--accent));
  transition: width 0.6s var(--ease), left 0.6s var(--ease), background 0.3s;
}
.stat.warn .stat-bar b { background: linear-gradient(90deg, #d68a1f, var(--warn)); }
.stat.warn .stat-val { color: var(--warn); }
.stat.bad .stat-bar b {
  background: repeating-linear-gradient(-45deg, var(--bad) 0 6px, #ff8c97 6px 12px); background-size: 17px 17px;
  animation: stripes 0.6s linear infinite;
}
.stat.bad .stat-val, .stat.bad .stat-name { color: var(--bad); }
.stat.bad .stat-icon { animation: wiggle 1s ease-in-out infinite; }
.stat.good .stat-bar b { background: linear-gradient(90deg, #1fbf73, var(--good)); }
.stat.good .stat-val { color: var(--good); }
.stat.rep .stat-bar::after { content: ''; position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px; background: rgba(255, 255, 255, 0.35); }

/* Bouton de clic manuel */
.orb {
  position: fixed; left: var(--edge); bottom: calc(var(--dock-h) + var(--edge) + 14px); z-index: 5;
  width: 84px; height: 84px; border-radius: 50%; cursor: pointer; animation: popIn 0.5s 0.3s var(--spring) backwards;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: radial-gradient(circle at 35% 28%, #2f7aa0, #123049 72%);
  border: 2px solid rgba(62, 224, 255, 0.6);
  box-shadow: 0 0 28px rgba(62, 224, 255, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.18), 0 10px 26px rgba(0, 0, 0, 0.4);
  transition: transform 0.08s;
}
.orb-icon { font-size: 30px; line-height: 1; display: grid; }
.orb small { font: 700 11px var(--mono); color: var(--money); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.orb:hover { box-shadow: 0 0 36px rgba(62, 224, 255, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.18), 0 10px 26px rgba(0, 0, 0, 0.4); }
.orb:active { transform: scale(0.92); }
.orb .ripple {
  position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--accent); pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
}
@keyframes ripple { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
.pulse { animation: pulse 1.3s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 224, 255, 0.65); }
  70% { box-shadow: 0 0 0 18px rgba(62, 224, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 224, 255, 0); }
}

/* Étape suivante */
.next { padding: 12px; cursor: default; transition: border-color 0.3s, box-shadow 0.3s; }
.next h4 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.next-icon {
  width: 46px; height: 46px; flex: none; border-radius: 13px; display: grid; place-items: center; font-size: 25px;
  background: rgba(255, 209, 102, 0.08); border: 1px solid rgba(255, 209, 102, 0.25);
}
.next-text { display: flex; flex-direction: column; min-width: 0; }
.next-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-text small { font: 11px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { display: block; position: relative; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.progress b {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #d9a43a, var(--money)); transition: width 0.6s var(--ease);
}
.next-btn {
  position: relative; overflow: hidden; width: 100%; margin-top: 10px; height: 38px; border-radius: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px;
  font: 700 12.5px var(--font); color: var(--faint); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  transition: background 0.3s, color 0.3s, transform 0.15s var(--ease);
}
.next-cost { font: 700 12px var(--mono); white-space: nowrap; }
#next-verb { white-space: nowrap; }
.next-btn:disabled { cursor: default; }
.next.ready { border-color: rgba(255, 209, 102, 0.6); box-shadow: 0 0 30px rgba(255, 209, 102, 0.22), 0 12px 32px rgba(0, 0, 0, 0.35); }
.next.ready .next-icon { animation: bob 1.6s ease-in-out infinite; }
.next.ready .next-btn { color: #2b1d00; background: linear-gradient(180deg, #ffe08f, var(--money)); border-color: var(--money); }
.next.ready .next-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.next.ready .next-btn::after, .toast.stage::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  background-size: 250% 100%; animation: sheen 2.2s ease-in-out infinite;
}
.next.done .next-btn, .next.done .progress { display: none; }
.next.saving .next-btn { border-color: rgba(255, 209, 102, 0.6); background: rgba(255, 209, 102, 0.1); }
.next.saving #next-bar { background: #ffd166; }
.mission.saving.ok { border-color: rgba(61, 255, 154, 0.5); }

/* Missions : objectif guidé, message, contrat, recherche, défi */
.missions { display: flex; flex-direction: column; gap: 8px; }
.mission {
  position: relative; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; column-gap: 10px; row-gap: 6px;
  width: 100%; padding: 9px 10px 10px; text-align: left; cursor: pointer; color: var(--text);
  animation: slideR 0.45s var(--ease) backwards; transition: transform 0.15s var(--ease), border-color 0.2s;
}
.mission:hover { transform: translateX(-3px); border-color: var(--line-2); }
.mission-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: rgba(255, 255, 255, 0.06); }
.mission-text { min-width: 0; display: flex; flex-direction: column; }
.mission-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
.mission-text b { font-size: 12.5px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mission-val { font: 700 11px var(--mono); color: var(--accent); white-space: nowrap; align-self: start; margin-top: 2px; }
.mission .progress { grid-column: 1 / -1; height: 4px; }
.mission .progress b { background: linear-gradient(90deg, #1fa9d6, var(--accent)); }
.mission.objective .mission-icon { background: rgba(62, 224, 255, 0.12); }
.mission.mail { border-color: rgba(62, 224, 255, 0.55); box-shadow: 0 0 22px rgba(62, 224, 255, 0.2); }
.mission.mail .mission-icon { background: rgba(62, 224, 255, 0.18); animation: wiggle 1.4s ease-in-out infinite; }
.mission.mail .progress b { background: var(--warn); }
.mission.contract.ok .progress b { background: linear-gradient(90deg, #1fbf73, var(--good)); }
.mission.contract.ok .mission-val { color: var(--good); }
.mission.contract.ko { border-color: rgba(255, 93, 108, 0.45); }
.mission.contract.ko .mission-val { color: var(--bad); }
.mission.contract.ko .progress b { background: var(--warn); }
.mission.research .progress b { background: linear-gradient(90deg, #1fbf73, var(--good)); }
.mission.research .mission-val { color: var(--good); }
.mission.challenge { border-color: rgba(255, 209, 102, 0.35); cursor: default; }
.mission.challenge .mission-val { color: var(--money); }
.mission.done { animation: missionDone 0.7s var(--ease) forwards; }
@keyframes missionDone {
  0% { border-color: var(--good); box-shadow: 0 0 30px rgba(61, 255, 154, 0.5); }
  60% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateX(40px); }
}

/* =========================================================== barre de construction */
.dock {
  --inset: bottom;
  position: fixed; left: 50%; bottom: var(--edge); transform: translateX(-50%); z-index: 5;
  width: min(1200px, calc(100vw - 2 * var(--edge))); padding: 10px 12px 12px; border-radius: 20px;
}
.dock-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.tabs { position: relative; display: flex; gap: 2px; min-width: 0; }
.tab-ink {
  position: absolute; top: 0; height: 100%; left: 0; width: 0; border-radius: 11px; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 0 16px rgba(62, 224, 255, 0.12);
  transition: left 0.35s var(--spring), width 0.35s var(--spring);
}
.tabs button {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; flex: none;
  border-radius: 11px; cursor: pointer; font-size: 17px; background: transparent; border: 0; color: var(--muted);
  transition: color 0.2s;
}
.tabs button span { font-size: 12.5px; font-weight: 600; }
.tabs button .ic { transition: transform 0.25s var(--spring), filter 0.2s; filter: grayscale(0.5) brightness(0.85); }
.tabs button:hover { color: var(--text); }
.tabs button:hover .ic { transform: translateY(-2px); filter: none; }
.tabs button.active { color: var(--text); }
.tabs button.active .ic { filter: none; transform: scale(1.1); }
.tabs .badge { top: -4px; right: -3px; }
.dock-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.amounts { display: flex; padding: 3px; gap: 2px; border-radius: 11px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.amounts button {
  border: 0; background: transparent; color: var(--muted); padding: 5px 10px; border-radius: 8px; cursor: pointer;
  font: 700 12px var(--mono); transition: background 0.2s, color 0.2s;
}
.amounts button:hover { color: var(--text); }
.amounts button.active { background: var(--accent); color: var(--accent-ink); }
.fold { width: 34px; height: 34px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); border-radius: 10px; }
.fold .ic { transition: transform 0.3s var(--ease); }
body.dock-folded .fold .ic { transform: rotate(180deg); }
body.dock-folded .cards { display: none; }
body.dock-folded .dock-head { margin-bottom: 0; }

.cards {
  display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 6px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; min-height: 146px;
}
.card {
  --i: 0;
  position: relative; flex: 0 0 auto; width: 128px; height: 136px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 52, 92, 0.85), rgba(16, 24, 46, 0.92));
  border: 1px solid var(--line);
  transition: transform 0.2s var(--ease), border-color 0.25s, box-shadow 0.25s;
  animation: cardIn 0.45s var(--ease) backwards; animation-delay: calc(var(--i) * 35ms);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.94); } }
.card:hover { transform: translateY(-5px); box-shadow: 0 14px 26px rgba(0, 0, 0, 0.45); border-color: var(--line-2); }
.card-main {
  position: absolute; inset: 0; width: 100%; border: 0; background: transparent; cursor: pointer; border-radius: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 8px; text-align: center;
}
.card-main:disabled { cursor: not-allowed; }
.card-icon { font-size: 34px; line-height: 1; height: 42px; display: grid; place-items: center; transition: filter 0.25s, opacity 0.25s, transform 0.25s var(--spring); }
.card-icon .ic { filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--a, #3ee0ff) 45%, transparent)); }
.card:hover .card-icon { transform: scale(1.1) rotate(-3deg); }
.card-name {
  font-size: 11.5px; font-weight: 600; line-height: 1.2; min-height: 2.4em; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-stat { font: 600 10.5px var(--mono); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.card-price {
  position: relative; overflow: hidden; margin-top: auto; width: 100%; height: 24px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: rgba(255, 255, 255, 0.05); font: 700 12px var(--mono); color: var(--faint);
  transition: background 0.3s, color 0.3s;
}
.card-price > * { position: relative; }
.card-price .afford {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(255, 209, 102, 0.14);
  transition: width 0.4s var(--ease);
}
.card-n { color: var(--muted); font-size: 10px; }
.card-qty {
  position: absolute; top: 7px; right: 7px; padding: 1px 6px; border-radius: 7px;
  font: 700 11px var(--mono); color: var(--accent); background: rgba(62, 224, 255, 0.12); pointer-events: none;
}
.card-qty:empty { display: none; }
.card-qty.bump { animation: popIn 0.35s var(--spring); }
.card-flag { position: absolute; top: 30px; right: 9px; font-size: 13px; pointer-events: none; }
.card-sell {
  position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 8px; z-index: 1;
  display: none; place-items: center; padding: 0; cursor: pointer; font-size: 13px;
  border: 1px solid var(--line-2); background: rgba(7, 11, 22, 0.85);
}
.card:hover .card-sell:not(:disabled), .card:focus-within .card-sell:not(:disabled) { display: grid; animation: popIn 0.25s var(--spring); }
.card-sell:hover { border-color: var(--bad); background: rgba(255, 93, 108, 0.2); }
@media (hover: none) { .card-sell:not(:disabled) { display: grid; } }

.card.can { border-color: rgba(62, 224, 255, 0.5); box-shadow: 0 0 18px rgba(62, 224, 255, 0.14); }
.card.can .card-price { background: rgba(255, 209, 102, 0.16); color: var(--money); }
.card.can .card-price .afford { width: 0 !important; }
.card.cant .card-icon { filter: grayscale(0.8); opacity: 0.55; }
.card.cant .card-name { color: var(--muted); }
.card.full .card-price { color: var(--bad); }
.card.locked { border-style: dashed; background: rgba(255, 255, 255, 0.02); animation-name: cardInLocked; }
@keyframes cardInLocked { from { opacity: 0; transform: translateY(18px); } to { opacity: 0.6; } }
.card.locked { opacity: 0.6; }
.card.locked .card-icon { filter: grayscale(1); }
.card.locked .card-name { color: var(--muted); }
.card.req .card-icon { filter: grayscale(1); opacity: 0.45; }
.card .req-bar { width: 100%; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: 4px; }
.card .req-bar i { display: block; height: 100%; width: 0; background: var(--warn); transition: width 0.4s var(--ease); }
/* Améliorations : nom sur une ligne, effet sur deux */
.card.upg:not(.research) .card-icon { height: 36px; font-size: 30px; }
.card.upg:not(.research) .card-name { -webkit-line-clamp: 1; min-height: 0; }
.card.upg:not(.research) .card-stat {
  font-size: 10px; line-height: 1.25; white-space: normal; text-overflow: clip;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card.buy-all { border-style: dashed; }
.card.buy-all.can { border-color: rgba(255, 209, 102, 0.6); background: linear-gradient(180deg, rgba(255, 209, 102, 0.10), transparent); }
.away-line { margin: 6px 0; }
.away-line.dim { color: var(--muted, #9fb0c8); font-size: 12.5px; }
.away-line.hint { color: var(--warn, #ffd166); font-size: 13px; }
.card.research.running { border-color: rgba(61, 255, 154, 0.55); box-shadow: 0 0 18px rgba(61, 255, 154, 0.15); }
.card.research .req-bar i { background: var(--good); }
.card.shine::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.28) 50%, transparent 65%);
  background-size: 250% 100%; animation: sheen 0.9s ease-out 1;
}
.cards .empty { color: var(--faint); padding: 40px 10px; font-size: 13px; margin: 0; }

/* Contrats clients */
.card.wide { width: 236px; }
.contract .ct-main, .contract.active { display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 6px; padding: 12px 14px; text-align: left; }
.ct-head { display: flex; align-items: center; gap: 10px; }
.ct-icon { font-size: 26px; display: grid; }
.ct-head b { font: 700 15px var(--mono); display: block; }
.ct-head small { font-size: 11px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.ct-line { display: flex; justify-content: space-between; gap: 6px; font: 12px var(--mono); color: var(--muted); }
.ct-dots { color: var(--warn); letter-spacing: 1px; }
.ct-reward { font: 700 13px var(--mono); color: var(--money); }
.ct-bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.ct-bar i { display: block; height: 100%; width: 0; background: var(--good); border-radius: inherit; transition: width 0.3s; }
.contract.active { border-color: rgba(61, 255, 154, 0.5); }
.contract.active.ko { border-color: rgba(255, 93, 108, 0.6); }
.contract.active.ko .ct-bar i { background: var(--warn); }
.contract.active .card-sell { left: auto; right: 8px; top: 8px; display: grid; }
.contract.tier1 { border-color: rgba(62, 224, 255, 0.3); }
.contract.tier2 { border-color: rgba(255, 181, 71, 0.4); }

/* =========================================================== infobulle */
.tooltip {
  position: fixed; z-index: 40; pointer-events: none;
  max-width: 300px; padding: 11px 13px; border-radius: 13px;
  background: rgba(9, 14, 28, 0.96); border: 1px solid var(--line-2);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  font-size: 13px; color: var(--text); animation: tipIn 0.14s var(--ease);
}
@keyframes tipIn { from { opacity: 0; transform: translateY(4px); } }
.tooltip b { display: block; font-size: 14px; margin-bottom: 2px; }
.tooltip p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.tooltip p.fx { color: var(--accent); }
.tooltip p.cost { color: var(--money); font-family: var(--mono); }
.tooltip p.bad { color: var(--bad); }
.tooltip p.warn { color: var(--warn); }
.tooltip p.good { color: var(--good); }
.tooltip .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tooltip .chips span { font: 11px var(--mono); padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); }

/* =========================================================== notifications */
.toasts {
  position: fixed; top: calc(var(--edge) + var(--top-h) + 44px); left: 50%; transform: translateX(-50%); z-index: 35;
  display: grid; gap: 8px; justify-items: center; pointer-events: none;
  width: min(560px, calc(100vw - 32px));
}
.toast {
  --ms: 3500ms;
  position: relative; overflow: hidden; max-width: 100%; padding: 10px 18px 12px; border-radius: 14px;
  font-weight: 600; font-size: 13.5px; text-align: center;
  background: linear-gradient(180deg, rgba(26, 38, 70, 0.92), rgba(12, 18, 36, 0.92));
  border: 1px solid var(--line-2); backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); animation: toastIn 0.45s var(--spring);
}
.toast .ic { font-size: 1.15em; }
.toast > .timer {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: currentColor; opacity: 0.45;
  transform-origin: left; animation: timer var(--ms) linear forwards;
}
@keyframes timer { to { transform: scaleX(0); } }
.toast.stage { font-size: 17px; padding: 14px 24px 16px; border-color: var(--money); color: var(--money); box-shadow: 0 0 34px rgba(255, 209, 102, 0.3); }
.toast.stage::after { animation-iteration-count: 2; }
.toast.unlock { color: var(--accent); }
.toast.goal { color: var(--accent); border-color: rgba(62, 224, 255, 0.45); }
.toast.event-good { color: var(--good); border-color: rgba(61, 255, 154, 0.5); }
.toast.event-bad { color: var(--bad); border-color: rgba(255, 93, 108, 0.5); }
.toast.news { color: #e2c2ff; border-color: rgba(199, 112, 255, 0.5); box-shadow: 0 0 22px rgba(199, 112, 255, 0.18); }
.toast.achievement { color: var(--money); border-color: var(--money); box-shadow: 0 0 26px rgba(255, 209, 102, 0.25); }
.toast.out { animation: toastOut 0.35s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(0.92); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.96); } }

.floater {
  position: fixed; z-index: 30; pointer-events: none;
  font: 800 16px var(--mono); color: var(--money);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  animation: floatUp 0.95s ease-out forwards;
}
.floater.big { font-size: 22px; animation-duration: 1.4s; }
.floater.mini { font-size: 12px; opacity: 0.85; animation-duration: 1.6s; z-index: 3; }
.floater.cost { color: #ff9aa4; font-size: 13px; }
@keyframes floatUp {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to { opacity: 0; transform: translate(-50%, -60px) scale(1.15); }
}
/* Icône qui s'envole de la carte vers la maquette après un achat */
.flyer { position: fixed; z-index: 31; pointer-events: none; font-size: 34px; line-height: 1; }

.flash { position: fixed; inset: 0; z-index: 20; pointer-events: none; background: #fff; opacity: 0; }
.flash.go { animation: flash 0.9s ease-out; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 0.85; } 100% { opacity: 0; } }
.flash.zap { animation: zap 0.35s ease-out; background: #dfe8ff; }
@keyframes zap { 0% { opacity: 0; } 10% { opacity: 0.35; } 25% { opacity: 0.05; } 40% { opacity: 0.25; } 100% { opacity: 0; } }

.nogl { position: fixed; inset: 0; display: grid; place-items: center; z-index: 1; color: var(--muted); }

/* =========================================================== mode Aménager */
.edit-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h) + var(--edge) + 12px); z-index: 6;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); padding: 8px 10px 8px 14px; border-radius: 16px;
  border-color: rgba(62, 224, 255, 0.55); box-shadow: 0 0 26px rgba(62, 224, 255, 0.2); font-size: 13px;
  animation: popIn 0.35s var(--spring);
}
.edit-text { color: var(--text); }
.edit-bar kbd { font-size: 10px; margin-left: 2px; }
body.editing #scene { box-shadow: inset 0 0 0 3px rgba(62, 224, 255, 0.35); }
body.editing .side-right, body.editing .ticker { opacity: 0.35; pointer-events: none; transition: opacity 0.3s; }

.site-back {
  position: fixed; top: calc(var(--edge) + var(--top-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 7; cursor: pointer;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--accent); color: var(--text); font-weight: 700;
  background: var(--panel-b); backdrop-filter: blur(10px); box-shadow: 0 0 24px rgba(62, 224, 255, 0.3);
  animation: popIn 0.4s var(--spring);
}

/* =========================================================== concurrents */
.mission.rival { border-color: rgba(199, 112, 255, 0.4); }
.mission.rival .progress b { background: linear-gradient(90deg, #8f4fd6, #c770ff); }
.mission.rival .mission-val { color: #d9a6ff; }
.mission.rival.top { border-color: rgba(255, 209, 102, 0.55); box-shadow: 0 0 22px rgba(255, 209, 102, 0.18); }
.mission.rival.top .progress b { background: linear-gradient(90deg, #e3b341, var(--money)); }
.mission.rival.top .mission-val { color: var(--money); }
.board { list-style: none; margin: 12px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.board-row {
  display: grid; grid-template-columns: 26px 34px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  animation: slideL 0.35s var(--ease) backwards;
}
.board-row:nth-child(2) { animation-delay: 40ms; } .board-row:nth-child(3) { animation-delay: 80ms; }
.board-row:nth-child(4) { animation-delay: 120ms; } .board-row:nth-child(5) { animation-delay: 160ms; }
.board-row:nth-child(6) { animation-delay: 200ms; } .board-row:nth-child(7) { animation-delay: 240ms; }
.board-rank { font: 800 15px var(--mono); color: var(--faint); text-align: center; }
.board-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: rgba(255, 255, 255, 0.06); }
.board-name { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.board-name b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-name .progress { height: 4px; }
.board-name .progress b { background: linear-gradient(90deg, #8f4fd6, #c770ff); }
.board-val { font: 700 12px var(--mono); color: var(--muted, #9fb0c8); white-space: nowrap; }
.board-row.beaten .board-name b::after { content: ' ✓'; color: var(--good); }
.board-row.boss { border-color: rgba(199, 112, 255, 0.4); }
.board-row.you { border-color: var(--accent); background: rgba(62, 224, 255, 0.08); box-shadow: 0 0 18px rgba(62, 224, 255, 0.15); }
.board-row.you .board-rank, .board-row.you .board-val { color: var(--accent); }
.board-row.you .progress b { background: linear-gradient(90deg, #1fa9d6, var(--accent)); }
.board-news { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--muted, #9fb0c8); font-size: 13px; }

/* =========================================================== mode photo */
/* Tout disparaît sauf la maquette (et le flash de l'appareil) */
body.photo > :not(#scene):not(#flash):not(#photo-bar):not(#photo-caption):not(dialog):not(script) {
  opacity: 0 !important; visibility: hidden; pointer-events: none; transition: opacity 0.5s, visibility 0s 0.5s;
}
.photo-bar {
  position: fixed; left: 50%; bottom: calc(var(--edge) + 8px); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px); padding: 8px 10px; border-radius: 16px;
  animation: riseIn 0.4s var(--ease) backwards; transition: opacity 0.6s;
}
.photo-bar[hidden], .photo-caption[hidden] { display: none; }
.photo-bar kbd { font-size: 10px; margin-left: 2px; }
.photo-bar .btn { width: auto; flex: 0 0 auto; }
@media (max-width: 600px) {
  .photo-bar { flex-wrap: nowrap; gap: 6px; padding: 6px; }
  .photo-bar #photo-spin span, .photo-bar #photo-exit span, .photo-bar kbd { display: none; }
}
.photo-bar .btn.on { border-color: var(--accent); box-shadow: 0 0 14px rgba(62, 224, 255, 0.35); }
/* Sans bouger la souris, la barre s'efface pour laisser la place à la vue */
body.photo.still .photo-bar { opacity: 0.12; }
body.screensaver, body.photo.still { cursor: none; }
.photo-caption {
  position: fixed; left: calc(var(--edge) + 18px); bottom: calc(var(--edge) + 18px); z-index: 30; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  animation: fadeIn 2.5s ease-out backwards;
}
.photo-caption b { font-size: 28px; letter-spacing: 0.01em; }
.photo-caption span { font-size: 15px; color: rgba(210, 230, 255, 0.85); }
.photo-caption .money { font-size: 18px; color: var(--gold, #ffd166); font-weight: 700; }

/* =========================================================== tutoriel */
.tour { position: fixed; inset: 0; z-index: 60; animation: fadeIn 0.3s ease-out; }
.tour.out { animation: fadeOut 0.3s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; } }
/* Le projecteur : un trou lumineux, le reste de l'écran assombri */
.tour-spot {
  position: fixed; border-radius: 16px; pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(3, 6, 14, 0.68), 0 0 0 2px var(--accent), 0 0 30px rgba(62, 224, 255, 0.5);
  transition: left 0.45s var(--spring), top 0.45s var(--spring), width 0.45s var(--spring), height 0.45s var(--spring), border-radius 0.3s;
  animation: spotPulse 1.8s ease-in-out infinite;
}
.tour-spot.none { border-radius: 50%; animation: none; box-shadow: 0 0 0 200vmax rgba(3, 6, 14, 0.68); }
@keyframes spotPulse {
  50% { box-shadow: 0 0 0 200vmax rgba(3, 6, 14, 0.68), 0 0 0 4px var(--accent), 0 0 44px rgba(62, 224, 255, 0.7); }
}
.tour-bubble {
  position: fixed; width: min(330px, calc(100vw - 24px)); padding: 16px 18px 14px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(26, 38, 70, 0.98), rgba(12, 18, 36, 0.98));
  border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  transition: left 0.45s var(--spring), top 0.45s var(--spring);
}
.tour-bubble.step { animation: popIn 0.4s var(--spring); }
.tour-count { display: block; font: 700 10.5px var(--mono); letter-spacing: 1px; color: var(--accent); margin-bottom: 4px; }
.tour-bubble b { display: block; font-size: 16px; margin-bottom: 4px; }
.tour-bubble p { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* Astuces contextuelles (sans assombrir l'écran) */
.coach-ring { position: fixed; z-index: 45; pointer-events: none; border-radius: 14px; border: 2px solid #ffd166;
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.18), 0 0 24px rgba(255, 209, 102, 0.35); animation: coachPulse 1.6s ease-in-out infinite; }
@keyframes coachPulse { 50% { box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.08), 0 0 34px rgba(255, 209, 102, 0.5); } }
.coach { position: fixed; z-index: 46; width: min(320px, calc(100vw - 24px)); padding: 13px 15px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(30, 40, 66, 0.98), rgba(16, 22, 40, 0.98)); border: 1px solid rgba(255, 209, 102, 0.45);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); animation: popIn 0.4s var(--spring); }
.coach.out { animation: fadeOut 0.25s ease-in forwards; }
.coach-kicker { display: block; font: 700 10.5px var(--mono); letter-spacing: 1px; color: #ffd166; margin-bottom: 4px; }
.coach b { display: block; font-size: 14.5px; margin-bottom: 4px; }
.coach p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
/* Guide du jeu */
.guide-list { display: grid; gap: 8px; }
.guide-item { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start; padding: 11px 13px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.guide-icon { font-size: 24px; text-align: center; padding-top: 2px; font-weight: 700; color: var(--accent); }
.guide-item b { display: block; font-size: 14px; margin-bottom: 3px; }
.guide-item p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--muted); }

/* =========================================================== fenêtres */
dialog {
  border: 1px solid var(--line-2); border-radius: 22px; padding: 0; overflow: visible;
  background: linear-gradient(180deg, rgba(20, 30, 56, 0.98), rgba(10, 15, 30, 0.98)); color: var(--text);
  width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 40px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  user-select: text; -webkit-user-select: text;
}
dialog[open] { animation: modalIn 0.32s var(--spring); }
dialog::backdrop { background: rgba(3, 6, 14, 0.6); backdrop-filter: blur(4px); animation: fadeIn 0.25s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes fadeIn { from { opacity: 0; } }
.modal-inner { position: relative; padding: 22px 24px 20px; max-height: calc(100vh - 42px); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.modal-x {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 10px; cursor: pointer; z-index: 1;
  display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); font-size: 15px;
  transition: background 0.2s, transform 0.2s var(--ease);
}
.modal-x:hover { background: rgba(255, 93, 108, 0.18); transform: rotate(90deg); }
.modal-inner h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 0 40px 14px 0; }
.modal-inner h2 > .ic:first-child { font-size: 1.3em; padding: 6px; box-sizing: content-box; border-radius: 12px; background: rgba(255, 255, 255, 0.06); }
.modal-inner h3 { display: flex; align-items: center; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--faint); margin: 20px 0 8px; }
.modal-inner p { color: var(--muted); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 0; border-radius: 11px; padding: 9px 15px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
  transition: filter 0.2s, transform 0.15s var(--ease);
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn.secondary { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.btn.danger { background: var(--bad); color: #2a0509; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stats-table td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.stats-table td:last-child { text-align: right; font-family: var(--mono); }
.journal { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 200px; overflow: auto; font-size: 12px; }
.journal li { color: var(--muted); }
.journal time { font-family: var(--mono); color: var(--faint); margin-right: 6px; }
.field { display: grid; gap: 4px; margin: 12px 0; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field textarea, .field select {
  background: #060a14; border: 1px solid var(--line-2); border-radius: 9px; color: var(--text);
  padding: 9px 11px; font: 13px var(--mono); width: 100%;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62, 224, 255, 0.15); }
.field input[type="range"] { padding: 0; accent-color: var(--accent); }
.field textarea { min-height: 80px; resize: vertical; word-break: break-all; }
.option-row { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.help { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13px; color: var(--muted); align-items: center; }
.help kbd { font-size: 12px; padding: 2px 7px; border-radius: 6px; color: var(--text); white-space: nowrap; justify-self: start; }
.save-status { font-size: 12px; margin: 0 0 8px; }
.backups { display: grid; gap: 6px; max-height: 26vh; overflow: auto; }
.backup { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 12px; }
.bk-when { font-family: var(--mono); color: var(--muted); }
.bk-what { font-family: var(--mono); color: var(--money); }
.bk-why { color: var(--faint); font-size: 11px; }
details.more { margin: 8px 0; font-size: 13px; color: var(--muted); }
details.more summary { cursor: pointer; }

/* Graphique des revenus */
/* Statistiques et options (grandes fenêtres à onglets) */
dialog.wide .chart > svg { height: 150px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0 0 12px; }
.stat-card { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 9px 11px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.stat-card small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-card b { font: 700 16px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-card small.sub { font-size: 11px; color: var(--faint); }
.gauges { display: grid; gap: 8px; margin: 0 0 12px; padding: 11px 13px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.gauge-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.gauge-row .bar { display: block; }
.gauge-row .bar i { background: var(--good); }
.gauge-row.high .bar i { background: #ffd166; }
.gauge-row.over .bar i { background: var(--bad); }
.gauge-row small { font: 600 11px var(--mono); color: var(--muted); white-space: nowrap; }
.prod-list { display: grid; gap: 4px; }
.prod-row { display: grid; grid-template-columns: 26px minmax(0, 1.4fr) 54px minmax(0, 1fr) 46px; gap: 8px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.prod-icon { font-size: 18px; text-align: center; }
.prod-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-row small { font: 600 11px var(--mono); color: var(--muted); text-align: right; }
.prod-row .bar { display: block; }
.prod-row .bar i { background: var(--accent); }
.journal.big { max-height: none; gap: 6px; font-size: 12.5px; }
.journal.big li { padding: 5px 0 5px 10px; border-left: 3px solid var(--line); }
.journal li.log-stage, .journal li.log-unlock { border-left-color: var(--accent); }
.journal li.log-achievement, .journal li.log-objective, .journal li.log-rival { border-left-color: #ffd166; }
.journal li.log-ok, .journal li.log-contract, .journal li.log-research, .journal li.log-parcel { border-left-color: var(--good); }
.journal li.log-warn, .journal li.log-event-bad, .journal li.log-heat, .journal li.log-both, .journal li.log-failure { border-left-color: var(--bad); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.opt-row:last-child { border-bottom: 0; }
.opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-text b { font-size: 13.5px; }
.opt-text small { font-size: 12px; color: var(--muted); }
.opt-input, .opt-select { flex: 0 0 auto; width: 220px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.25); color: var(--text); font: inherit; font-size: 13px; }
.opt-input:focus, .opt-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62, 224, 255, 0.15); }
.slider-box { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; width: 220px; }
.slider { flex: 1; accent-color: var(--accent); }
.slider-val { font: 600 12px var(--mono); color: var(--muted); width: 40px; text-align: right; }
input.switch { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 42px; height: 24px; margin: 0; border-radius: 99px; cursor: pointer;
  background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line-2); position: relative; transition: background 0.2s, border-color 0.2s; }
input.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #cfd6e0; transition: transform 0.2s var(--ease), background 0.2s; }
input.switch:checked { background: rgba(62, 224, 255, 0.35); border-color: var(--accent); }
input.switch:checked::after { transform: translateX(18px); background: #fff; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255, 93, 108, 0.35); background: rgba(255, 93, 108, 0.06); }
.opt-msg { min-height: 1.4em; margin: 6px 0 0; font-size: 12.5px; }
@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .gauge-row { grid-template-columns: 96px 1fr; }
  .gauge-row small { grid-column: 2; }
  .prod-row { grid-template-columns: 22px minmax(0, 1fr) 46px 42px; }
  .prod-row .bar { display: none; }
  .opt-row, .danger-zone { flex-wrap: wrap; }
  .opt-input, .opt-select, .slider-box { width: 100%; }
}
.chart { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.chart p { margin: 0; font-size: 13px; }
.chart > svg { display: block; width: 100%; height: 110px; margin: 6px 0 2px; }
.chart-head, .chart-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.chart-head span { font-family: var(--mono); color: var(--accent); }
.chart-foot { font-size: 10px; color: var(--faint); }

/* Bourse, défis, dilemmes */
/* Fenêtre de la bourse */
dialog.wide { width: min(780px, calc(100vw - 24px)); height: min(900px, calc(100vh - 40px)); }
dialog.wide .modal-inner { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
dialog.wide #modal-body { flex: 1 0 auto; }
dialog.wide.compact { width: min(700px, calc(100vw - 24px)); height: min(640px, calc(100vh - 40px)); }
#modal [hidden] { display: none !important; }
dialog.wide .modal-actions { position: sticky; bottom: -20px; z-index: 2; margin: 12px -24px -20px; padding: 12px 24px 16px; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(14, 21, 40, 0.92), rgba(10, 15, 30, 0.99)); backdrop-filter: blur(6px); }
.ipo-intro { margin: -4px 0 12px; font-size: 13.5px; }
.ipo-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.ipo-stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ipo-tile { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 11px 13px; border-radius: 13px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.ipo-tile small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ipo-tile small:first-child { text-transform: uppercase; letter-spacing: 0.8px; font-size: 10.5px; color: var(--faint); }
.ipo-tile b { font: 800 22px var(--mono); color: var(--money); white-space: nowrap; }
.ipo-tile.good { border-color: rgba(61, 255, 154, 0.4); background: rgba(61, 255, 154, 0.06); }
.ipo-tile.good b { color: var(--good); }
.ipo-tile.soon { border-color: rgba(255, 209, 102, 0.55); background: rgba(255, 209, 102, 0.07); }
.ipo-progress { margin: 0 0 10px; }
.ipo-progress-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.ipo-progress-head .mono { font-family: var(--mono); color: var(--text); }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--money); border-radius: inherit; }
.ipo-next { font-size: 12.5px; margin: 0 0 10px; }
.ipo-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.ipo-chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--muted); cursor: help; }
.ipo-chip.good { color: var(--good); border-color: rgba(61, 255, 154, 0.35); }
.ipo-chip.warn { color: #ffd166; border-color: rgba(255, 209, 102, 0.35); }
.seg-tabs { display: flex; gap: 4px; margin: 16px 0 10px; padding: 4px; border-radius: 13px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.seg-tab { flex: 1 1 auto; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 600 13px var(--font, inherit); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background 0.2s, color 0.2s; }
.seg-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.seg-tab.on { color: var(--text); background: rgba(62, 224, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(62, 224, 255, 0.35); }
.ipo-panel[hidden] { display: none; }
.ipo-legend { font-size: 12.5px; margin: 0 0 10px; }
.perk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.challenge-list { display: grid; gap: 6px; }
/* Arbres de la bourse : arbre de compétences */
dialog.wide.xl { width: min(940px, calc(100vw - 24px)); }
.tree-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.tree-head .ipo-legend { flex: 1; }
.sk-wrap { position: relative; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; margin: 4px 0 10px; border-radius: 16px; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 0%, rgba(62, 224, 255, 0.07), transparent 65%), rgba(0, 0, 0, 0.2); }
.sk-sizer { position: relative; overflow: hidden; }
.sk-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.sk-band { position: absolute; top: 0; border-radius: 14px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 11%, transparent), transparent 75%); }
.sk-band-title { position: absolute; top: 12px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--c); white-space: nowrap; }
.sk-band-title small { font: 600 10.5px var(--mono); color: var(--faint); letter-spacing: 0; }
.sk-links { position: absolute; inset: 0; pointer-events: none; }
.sk-links svg { display: block; overflow: visible; }
.sk-link { fill: none; stroke-width: 2.5; stroke: rgba(255, 255, 255, 0.12); stroke-linecap: round; }
.sk-link.on { stroke: var(--c); filter: drop-shadow(0 0 4px var(--c)); }
.sk-link.next { stroke: var(--c); stroke-dasharray: 6 6; opacity: 0.85; animation: skFlow 1.1s linear infinite; }
@keyframes skFlow { to { stroke-dashoffset: -12; } }
.sk-node { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; }
.sk-orb { position: relative; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.13), rgba(10, 15, 30, 0.96) 70%);
  border: 2px solid rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6); transition: transform 0.15s var(--ease), box-shadow 0.2s; }
.sk-icon { font-size: 24px; display: grid; place-items: center; }
.sk-node:hover .sk-orb { transform: scale(1.07); }
.sk-node.owned .sk-orb { border-color: var(--c);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 50%, transparent), color-mix(in srgb, var(--c) 14%, #0a0f1e) 72%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 55%, transparent), inset 0 0 10px rgba(0, 0, 0, 0.35); }
.sk-node.ok .sk-orb { border-color: #ffd166; animation: skPulse 1.6s ease-in-out infinite; }
@keyframes skPulse { 50% { box-shadow: 0 0 0 5px rgba(255, 209, 102, 0.14), 0 0 20px rgba(255, 209, 102, 0.45); } }
.sk-node.points .sk-icon, .sk-node.locked .sk-icon { opacity: 0.45; filter: grayscale(0.7); }
.sk-node.locked .sk-orb { border-style: dashed; }
.sk-node.sel .sk-orb { outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: 3px; }
.sk-badge { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-style: normal; }
.sk-badge.ok { background: var(--c); color: #06101f; font-weight: 900; }
.sk-badge.lock { background: #1b2238; border: 1px solid var(--line-2); font-size: 10px; }
.sk-cost { font: 700 10.5px var(--mono); color: var(--money); padding: 1px 7px; border-radius: 99px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--line); white-space: nowrap; }
.sk-node.owned .sk-cost { color: var(--c); }
.sk-name { font-size: 10.5px; line-height: 1.2; text-align: center; color: var(--muted); max-width: 100%; padding: 2px 5px; border-radius: 7px; background: rgba(8, 12, 24, 0.82);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sk-node.owned .sk-name, .sk-node.ok .sk-name, .sk-node.sel .sk-name { color: var(--text); }
.sk-detail { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 11%, transparent), rgba(255, 255, 255, 0.02)); }
.sk-detail-icon { font-size: 30px; text-align: center; }
.sk-detail-text b { display: block; font-size: 14.5px; }
.sk-detail-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.sk-detail-text small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--faint); }
.sk-detail-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sk-detail-buy small { font: 700 11px var(--mono); color: var(--money); }
.sk-owned { font-weight: 700; color: var(--good); white-space: nowrap; }
@media (max-width: 560px) { .sk-detail { grid-template-columns: 40px 1fr; } .sk-detail-buy { grid-column: 1 / -1; align-items: stretch; } .tree-head { flex-direction: column; } }
.perks { display: grid; gap: 6px; max-height: 34vh; overflow: auto; padding: 2px; }
.perk { display: grid; grid-template-columns: 30px 1fr auto; gap: 9px; align-items: center; padding: 8px 10px; border-radius: 11px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); opacity: 0.55; }
.perk.got { opacity: 1; border-color: rgba(61, 255, 154, 0.4); }
.perk.soon { opacity: 1; border-color: rgba(255, 209, 102, 0.6); background: rgba(255, 209, 102, 0.06); }
.perk-icon { font-size: 22px; text-align: center; }
.perk b { display: block; font-size: 13px; }
.perk small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.perk-req { font: 700 12px var(--mono); color: var(--money); white-space: nowrap; }
@media (max-width: 620px) {
  .ipo-stats { grid-template-columns: 1fr 1fr; }
  .ipo-stats > :last-child:nth-child(3) { grid-column: 1 / -1; }
  .ipo-tile b { font-size: 18px; }
  .perk-grid { grid-template-columns: 1fr; }
  .seg-tab { font-size: 12px; padding: 7px 6px; }
}
.ipo-keep { font-size: 12px; margin: 14px 0 0; }
.btn.ipo-go { background: linear-gradient(180deg, #ffe08f, var(--money)); color: #2b1d00; }
.btn.ipo-go:disabled { background: rgba(255, 255, 255, 0.08); color: var(--faint); }
.challenge {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; text-align: left; cursor: pointer;
  padding: 9px 11px; border-radius: 11px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.15s var(--ease);
}
.challenge:hover { border-color: var(--line-2); background: rgba(255, 255, 255, 0.06); transform: translateX(3px); }
.challenge b { display: block; font-size: 13px; }
.challenge small { display: block; font-size: 12px; color: var(--muted); }
.challenge.on { border-color: var(--accent); background: rgba(62, 224, 255, 0.1); }
.dilemma-text { font-size: 14px; color: var(--text) !important; line-height: 1.55; }

/* Vitrine des succès */
.seg-tabs.wrap { flex-wrap: wrap; }
.seg-tabs.wrap .seg-tab { flex: 1 0 auto; overflow: visible; }
.seg-count { margin-left: 6px; font: 600 10.5px var(--mono); color: var(--faint); }
.seg-tab.on .seg-count { color: var(--muted); }
.seg-tab.full:not(.on) { color: var(--good); }
.trophy-filter { margin: 0 0 10px; font-size: 12.5px; }
.trophy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; align-content: start; }
.trophy {
  display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 9px; row-gap: 6px; align-items: center;
  padding: 9px 11px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
  animation: cardIn 0.35s var(--ease) backwards;
}
.trophy.got { border-color: rgba(255, 209, 102, 0.45); background: linear-gradient(180deg, rgba(255, 209, 102, 0.09), rgba(255, 209, 102, 0.03)); }
.trophy.secret { border-style: dashed; }
.trophy-icon { font-size: 26px; text-align: center; opacity: 0.45; filter: grayscale(0.6); }
.trophy.got .trophy-icon { opacity: 1; filter: none; }
.trophy-text { min-width: 0; }
.trophy-text b { display: block; font-size: 13px; }
.trophy-text small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.trophy:not(.got) .trophy-text b { color: var(--muted); }
.trophy-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--faint); }
.trophy-foot.got { color: #ffd166; font: 600 11px var(--mono); }
.trophy-foot .bar { flex: 1; display: block; height: 5px; }
.trophy-foot small { font: 600 11px var(--mono); color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) { .trophy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .trophy-grid { grid-template-columns: 1fr; } }

/* Sites dans le monde */
dialog:has(.map-wrap) { width: min(800px, calc(100vw - 24px)); }
.map-wrap { border-radius: 14px; overflow: hidden; background: #0a1830; border: 1px solid var(--line); }
.worldmap { display: block; width: 100%; height: auto; }
.worldmap .grat { stroke: rgba(120, 160, 255, 0.08); stroke-width: 1; }
.worldmap .land { fill: #1c3554; stroke: #2f5583; stroke-width: 1; }
.worldmap .arc { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 5 5; animation: arcflow 1.2s linear infinite; opacity: 0.85; }
@keyframes arcflow { to { stroke-dashoffset: -20; } }
.worldmap .hq { fill: var(--money); stroke: #2b1d00; stroke-width: 2; }
.worldmap .pin { cursor: pointer; }
.worldmap .pin > circle { fill: #3a4660; stroke: #8a98b9; stroke-width: 1.5; transition: stroke 0.2s; }
.worldmap .pin:hover > circle { stroke: #fff; }
.worldmap .pin.open > circle { fill: #0f4b5c; stroke: var(--accent); stroke-width: 2; filter: drop-shadow(0 0 4px rgba(62, 224, 255, 0.8)); }
.worldmap .pin.sel > circle { stroke: var(--money); stroke-width: 3; }
.worldmap .pin.locked { opacity: 0.55; }
.worldmap .pin-lvl { fill: #fff; font: 700 9px var(--mono); text-anchor: middle; pointer-events: none; }
.worldmap .pin-label { fill: var(--text); font: 600 10px var(--font); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: #0a1830; stroke-width: 3px; }
.site-panel { margin-top: 12px; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.site-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.site-head b { font-size: 16px; }
.chip { font: 11px var(--mono); padding: 2px 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.chip.good { color: var(--good); }
.site-stats { font-family: var(--mono); font-size: 12px; color: var(--text) !important; }

/* =========================================================== animations partagées */
@keyframes popIn { from { opacity: 0; transform: scale(0.6); } }
@keyframes throb { 50% { filter: brightness(1.35); } }
@keyframes breathe { 50% { opacity: 0.55; } }
@keyframes bob { 50% { transform: translateY(-3px); } }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-12deg); } 80% { transform: rotate(10deg); } 90% { transform: rotate(-6deg); } }
@keyframes stripes { to { background-position: 17px 0; } }
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* =========================================================== icônes SVG */
/* Toutes les icônes du jeu (js/icons.js) : trait clair teinté + aplat translucide */
.ic { width: 1.2em; height: 1.2em; display: inline-block; vertical-align: -0.24em; flex: none; overflow: visible; }
.ic, .icn { fill: none; stroke: var(--s, currentColor); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:is(.ic, .icn) .a { fill: var(--a); fill-opacity: 0.34; }
:is(.ic, .icn) .A { fill: var(--a); stroke: none; }
:is(.ic, .icn) .w { fill: var(--s); }
:is(.ic, .icn) .s { stroke: var(--a); }
:is(.ic, .icn) .b { fill: var(--a); fill-opacity: 0.14; }
:is(.ic, .icn).flag { stroke: none; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.6)); }
/* Sur un bouton plein (fond coloré), l'icône prend la couleur du texte */
.btn:not(.secondary) .ic, .next.ready .next-btn .ic { --s: currentColor !important; --a: currentColor !important; }

/* =========================================================== écrans moyens */
@media (max-width: 1280px) {
  .pill-btn span { display: none; }
  .pill-btn { padding: 0 12px; }
}
@media (max-width: 1120px) {
  :root { --side-w: 200px; }
  .tabs button:not(.active) span { display: none; }
  .tabs button { padding: 0 11px; }
}
@media (max-height: 760px) and (min-width: 761px) {
  :root { --dock-h: 178px; }
  .cards { min-height: 124px; }
  .card { height: 116px; }
  .card-stat { display: none; }
  .stat { padding-top: 5px; padding-bottom: 6px; }
  .orb { width: 70px; height: 70px; }
  .orb-icon { font-size: 24px; }
}

/* =========================================================== mobile */
@media (max-width: 760px) {
  :root { --edge: 8px; --top-h: 100px; --dock-h: 196px; }
  /* Ligne 1 : lieu + boutons · ligne 2 : trésorerie */
  .hud-top { grid-template-columns: auto 1fr; grid-template-areas: "brand actions" "wallet wallet"; gap: 6px; }
  .brand { grid-area: brand; padding: 4px; height: auto; }
  .brand-text { display: none; }
  .brand-icon { width: 36px; height: 36px; font-size: 19px; border-radius: 11px; }
  .wallet { grid-area: wallet; justify-self: center; min-width: 0; height: auto; padding: 5px 18px 6px; }
  .money { font-size: 22px; }
  .income { font-size: 11px; }
  .top-actions { grid-area: actions; gap: 4px; }
  .pill-btn { height: 38px; width: 38px; padding: 0; justify-content: center; font-size: 16px; }
  .icon-group { padding: 1px; }
  .icon-btn { width: 32px; height: 32px; font-size: 15px; }
  #btn-view { display: none; }
  .ticker { top: calc(var(--edge) + var(--top-h) + 56px); max-width: calc(100vw - 16px); }

  /* Jauges : une rangée compacte sous la trésorerie */
  .side { top: calc(var(--edge) + var(--top-h)); }
  .side-left { --inset: top; right: var(--edge); width: auto; }
  .status { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 5px; border-radius: 13px; }
  .status h4, .stat-name { display: none; }
  .stat { grid-template-columns: 1fr; justify-items: center; row-gap: 3px; padding: 4px 3px 5px; }
  .stat-icon { font-size: 15px; }
  .stat-val { font-size: 9.5px; }
  .stat-bar { height: 4px; width: 100%; }
  .orb { left: auto; right: 10px; bottom: calc(var(--dock-h) + 12px); width: 66px; height: 66px; }
  .orb-icon { font-size: 22px; }

  /* Objectifs : petite colonne à droite, sous les jauges */
  .side-right { --inset: none; top: calc(var(--edge) + var(--top-h) + 98px); width: 150px; gap: 6px; align-items: flex-end; }
  .next { width: 100%; }
  .next { padding: 8px; border-radius: 13px; }
  .next h4, .next-text small { display: none; }
  .next-head { gap: 7px; margin-bottom: 7px; }
  .next-icon { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
  .next-text b { font-size: 12px; }
  .next-btn { height: 30px; margin-top: 7px; font-size: 11px; padding: 0 8px; }
  .next-btn #next-verb { display: none; }
  .next-btn { justify-content: center; }
  .missions { align-items: flex-end; }
  .mission { width: 46px; grid-template-columns: 1fr; padding: 5px 5px 6px; row-gap: 4px; border-radius: 12px; }
  .mission-icon { width: 34px; height: 30px; font-size: 16px; border-radius: 8px; }
  .mission-text, .mission-val { display: none; }

  .dock { bottom: 0; width: 100vw; border-radius: 18px 18px 0 0; padding: 8px 8px 10px; border-bottom: 0; }
  .dock-head { gap: 6px; margin-bottom: 6px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs button span { display: none !important; }
  .tabs button { padding: 0 9px; height: 34px; font-size: 16px; }
  .tab-ink { display: none; }
  .tabs button.active { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
  .amounts button { padding: 4px 6px; font-size: 10.5px; }
  .fold { display: none; }
  .cards { min-height: 128px; gap: 8px; }
  .card { width: 100px; height: 120px; }
  .card-icon { font-size: 28px; height: 34px; }
  .card-name { font-size: 10.5px; }
  .card-stat { display: none; }
  .card-price { font-size: 11px; height: 22px; }
  .card.wide { width: 210px; }
  .toasts { top: calc(var(--edge) + var(--top-h) + 70px); width: calc(100vw - 32px); }
  .toast { padding: 8px 12px 10px; font-size: 12.5px; }
  .toast.stage { font-size: 14px; }
  .edit-bar { bottom: calc(var(--dock-h) + 12px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
