/* =============================================================================
   CARTEL EMPIRE — Design system « Ciudad Ficticia, la nuit »
   Mobile-first. Toutes les valeurs visuelles passent par les tokens ci-dessous.
   Voir ART_DIRECTION.md.
   ============================================================================= */

@font-face {
  font-family: 'Anton';
  src: url('../assets/fonts/anton-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-latin-var.woff2') format('woff2');
  font-weight: 400 800; font-style: normal; font-display: swap;
}

/* ─── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --bg-0: #0c0a12;
  --bg-1: #14111d;
  --bg-2: #1c1828;
  --bg-3: #262035;
  --bg-4: #312a44;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --hi: rgba(255, 255, 255, 0.06);

  --gold: #f5c451;
  --gold-deep: #c8912b;
  --gold-ink: #2a1c02;
  --neon: #ff3d7f;
  --cyan: #3fd4ff;
  --green: #3ddc84;
  --amber: #ffad33;
  --red: #ff5468;
  --violet: #b46bff;

  --text-1: #f6f3fb;
  --text-2: #c9c3d6;
  --text-3: #8d86a0;
  --text-4: #5d5770;

  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Anton', 'Impact', 'Arial Narrow Bold', sans-serif;

  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-base: 15px; --fs-lg: 17px;
  --fs-xl: 20px; --fs-2xl: 26px; --fs-3xl: 34px; --fs-4xl: 44px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;

  --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;

  --shadow-1: 0 1px 0 var(--hi) inset, 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 1px 0 var(--hi) inset, 0 14px 40px rgba(0, 0, 0, 0.55);
  --shadow-gold: 0 8px 26px rgba(245, 196, 81, 0.25);

  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-press: 120ms; --t-open: 220ms; --t-reward: 380ms;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --hud-h: 58px;
  --nav-h: 62px;
  --actionbar-h: 64px;
}

/* ─── BASE ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; width: 100%; overflow: hidden;
  background: var(--bg-0); color: var(--text-1);
  font-family: var(--font-ui); font-size: var(--fs-base); line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.ico { width: 1.25em; height: 1.25em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }
.ico-lg { width: 28px; height: 28px; }
.ico-xl { width: 40px; height: 40px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.t-gold { color: var(--gold); } .t-green { color: var(--green); } .t-red { color: var(--red); }
.t-cyan { color: var(--cyan); } .t-amber { color: var(--amber); } .t-neon { color: var(--neon); }
.display { font-family: var(--font-display); letter-spacing: 0.5px; text-transform: uppercase; font-weight: 400; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }

/* ─── SHELL ──────────────────────────────────────────────────────────────── */
#app { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ─── BOUTONS ────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--bg-3); --btn-lip: #17131f; --btn-fg: var(--text-1);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 700; font-size: var(--fs-md);
  box-shadow: 0 3px 0 var(--btn-lip), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  transition: transform var(--t-press) var(--ease-out), box-shadow var(--t-press) var(--ease-out), filter var(--t-press);
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-lip), 0 1px 0 rgba(255, 255, 255, 0.08) inset; }
.btn:disabled { filter: grayscale(0.8) brightness(0.65); cursor: not-allowed; }
.btn-primary { --btn-bg: linear-gradient(180deg, #ffd875, var(--gold) 55%, #e7ab33); --btn-lip: #9c6a12; --btn-fg: var(--gold-ink); }
.btn-danger { --btn-bg: linear-gradient(180deg, #ff6b96, var(--neon)); --btn-lip: #9a1342; --btn-fg: #fff; }
.btn-success { --btn-bg: linear-gradient(180deg, #6ff0a8, var(--green)); --btn-lip: #1b7a47; --btn-fg: #052713; }
.btn-ghost { --btn-bg: transparent; --btn-lip: transparent; box-shadow: none; border: 1px solid var(--line-strong); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-xs { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon { min-width: 44px; min-height: 44px; padding: 0; border-radius: var(--r-md); }
.btn .sub { font-weight: 600; opacity: 0.75; font-size: 0.9em; }
.btn-stack { display: flex; flex-direction: column; gap: var(--sp-2); }
.btn-row { display: flex; gap: var(--sp-2); }
.btn-row > .btn { flex: 1; }

/* ─── CARTES ─────────────────────────────────────────────────────────────── */
.card {
  position: relative; background: linear-gradient(180deg, var(--bg-2), #18142290);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--sp-4);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--sp-3); }
.card.tap { cursor: pointer; transition: transform var(--t-press) var(--ease-out), border-color var(--t-press); }
.card.tap:active { transform: scale(0.985); }
.card-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 800; font-size: var(--fs-md); text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-2); margin-bottom: var(--sp-3); }
.card-title .right { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text-3); font-size: var(--fs-sm); }
.card-gold { border-color: rgba(245, 196, 81, 0.35); background: radial-gradient(120% 140% at 0% 0%, rgba(245, 196, 81, 0.16), transparent 60%), linear-gradient(180deg, var(--bg-2), var(--bg-1)); }
.card-danger { border-color: rgba(255, 61, 127, 0.35); background: radial-gradient(120% 140% at 0% 0%, rgba(255, 61, 127, 0.14), transparent 60%), var(--bg-2); }
.section { margin-top: var(--sp-5); }
.section-head { display: flex; align-items: baseline; gap: var(--sp-2); margin: 0 2px var(--sp-2); }
.section-head h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-lg); letter-spacing: 0.6px; text-transform: uppercase; }
.section-head .right { margin-left: auto; color: var(--text-3); font-size: var(--fs-sm); }

/* Tuile d'icône teintée */
.tile {
  --c: var(--gold);
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 38%, transparent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
}
.tile .ico { width: 24px; height: 24px; }
.tile-sm { width: 34px; height: 34px; border-radius: 10px; }
.tile-sm .ico { width: 19px; height: 19px; }
.tile-lg { width: 56px; height: 56px; border-radius: 16px; }
.tile-lg .ico { width: 30px; height: 30px; }

/* Puces / tags */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; background: var(--bg-3); color: var(--text-2); white-space: nowrap; }
.chip .ico { width: 13px; height: 13px; }
.chip-gold { background: rgba(245, 196, 81, 0.14); color: var(--gold); }
.chip-green { background: rgba(61, 220, 132, 0.14); color: var(--green); }
.chip-red { background: rgba(255, 84, 104, 0.15); color: var(--red); }
.chip-neon { background: rgba(255, 61, 127, 0.15); color: var(--neon); }
.chip-cyan { background: rgba(63, 212, 255, 0.13); color: var(--cyan); }
.chip-amber { background: rgba(255, 173, 51, 0.15); color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Barres */
.bar { height: 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--gold); transform-origin: left; transition: width var(--t-open) var(--ease-out); }
.bar.thin { height: 5px; }
.bar.green > i { background: var(--green); } .bar.red > i { background: var(--red); }
.bar.cyan > i { background: var(--cyan); } .bar.amber > i { background: var(--amber); } .bar.neon > i { background: var(--neon); }

/* Lignes de liste */
.row { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex-shrink: 0; }
.list { display: flex; flex-direction: column; }
.list-pad .row { padding: var(--sp-2) 0; }

/* Grilles de stats */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
.kpis.k3 { grid-template-columns: repeat(3, 1fr); }
.kpi { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; min-width: 0; }
.kpi .lbl { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .val { font-size: var(--fs-lg); font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { text-align: center; padding: var(--sp-6) var(--sp-4); color: var(--text-3); }
.empty .ico { width: 40px; height: 40px; color: var(--text-4); margin-bottom: var(--sp-2); }
.empty p { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.hint { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; }
.divider { height: 1px; background: var(--line); margin: var(--sp-3) 0; }

/* Interrupteur */
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--bg-4); transition: background var(--t-open); }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform var(--t-open) var(--ease-out); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(20px); }

/* Segmented / onglets */
.seg { display: flex; gap: 4px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px; overflow-x: auto; }
.seg button { flex: 1; min-height: 38px; border-radius: 10px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-3); white-space: nowrap; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--bg-3); color: var(--text-1); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--bg-1); color: var(--text-1); font-size: var(--fs-base); }
textarea.input { min-height: 96px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-xs); resize: vertical; word-break: break-all; }
input[type=range] { width: 100%; height: 36px; background: transparent; -webkit-appearance: none; appearance: none; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 8px; background: linear-gradient(90deg, var(--green), var(--gold) 50%, var(--red)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: #fff; border: 4px solid var(--gold); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 8px; background: linear-gradient(90deg, var(--green), var(--gold) 50%, var(--red)); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 4px solid var(--gold); }

/* ═══════════════════════════════════════════════════════════════════════════
   ÉCRAN DE CHARGEMENT & MENU
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-loading { align-items: center; justify-content: center; gap: 18px; background: var(--bg-0); }
#screen-loading .logo-mark { width: 72px; height: 72px; color: var(--gold); animation: pulse 1.4s var(--ease-out) infinite; }
.loader { width: 120px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.loader i { display: block; width: 40%; height: 100%; background: var(--gold); border-radius: 4px; animation: load 1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: 0.8; } }

#screen-menu { background: radial-gradient(120% 70% at 50% 0%, #2a1840 0%, var(--bg-0) 60%); overflow: hidden; }
.menu-sky { position: absolute; inset: 0; pointer-events: none; }
.menu-city { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46%; pointer-events: none; }
.menu-inner {
  position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--safe-top) + 6vh) var(--sp-5) calc(var(--safe-bottom) + var(--sp-5));
  overflow-y: auto; max-width: 440px; width: 100%; margin: 0 auto;
}
.brand { text-align: center; margin-bottom: auto; }
.brand .mark { width: 64px; height: 64px; color: var(--gold); filter: drop-shadow(0 0 18px rgba(245, 196, 81, 0.45)); }
.brand h1 {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(44px, 15vw, 64px); line-height: 0.92; letter-spacing: 1px; margin-top: 10px;
  background: linear-gradient(180deg, #fff3c4 0%, var(--gold) 45%, #b47a1c 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.45));
}
.brand .tagline { margin-top: 10px; font-size: var(--fs-sm); letter-spacing: 3px; text-transform: uppercase; color: var(--neon); font-weight: 800; text-shadow: 0 0 12px rgba(255, 61, 127, 0.6); }
.menu-actions { width: 100%; display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-6); }
.menu-actions .btn { min-height: 56px; font-size: var(--fs-base); }
.save-card { background: rgba(12, 10, 18, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.save-card .grow { flex: 1; min-width: 0; }
.menu-footer { margin-top: var(--sp-5); text-align: center; font-size: var(--fs-xs); color: var(--text-4); line-height: 1.5; }
.menu-links { display: flex; gap: var(--sp-2); justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   ÉCRAN DE JEU : HUD, CONTENU, BARRE D'ACTION, NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-game { background: linear-gradient(180deg, #120f1b 0%, var(--bg-0) 40%); }

#hud {
  position: relative; z-index: 50; flex-shrink: 0;
  padding: calc(var(--safe-top) + 8px) 10px 8px;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, rgba(12, 10, 18, 0.98), rgba(12, 10, 18, 0.88));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hud-boss { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.hud-boss .rank-insignia { width: 32px; height: 32px; }
.hud-day { display: flex; flex-direction: column; line-height: 1.05; }
.hud-day b { font-family: var(--font-display); font-weight: 400; font-size: 16px; letter-spacing: 0.5px; white-space: nowrap; }
.hud-day span { font-size: 9px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.hud-chips { flex: 1; min-width: 0; display: flex; gap: 5px; justify-content: flex-end; }
.hud-chip {
  min-width: 0; flex: 0 1 auto; display: flex; align-items: center; gap: 5px;
  padding: 5px 8px 5px 6px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line);
}
.hud-chip .ico { width: 16px; height: 16px; }
.hud-chip .v { font-weight: 800; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-chip .l { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-3); line-height: 1; }
.hud-chip .stack { display: flex; flex-direction: column; min-width: 0; }
.hud-chip.bank { color: var(--cyan); }
.hud-chip.cash { color: var(--amber); }
.hud-chip.risk { color: var(--green); }
.hud-chip.risk.med { color: var(--amber); }
.hud-chip.risk.high { color: var(--red); animation: alarm 1.2s ease-in-out infinite; }
.hud-chip .v { color: var(--text-1); }
@keyframes alarm { 50% { border-color: rgba(255, 84, 104, 0.7); box-shadow: 0 0 14px rgba(255, 84, 104, 0.35); } }
.hud-chip.bump { animation: bump var(--t-reward) var(--ease-spring); }
@keyframes bump { 40% { transform: scale(1.12); } }
.hud-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); background: var(--bg-2); border: 1px solid var(--line); flex-shrink: 0; }
.hud-btn .ico { width: 20px; height: 20px; }

#game-content { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; position: relative; }
.panel { display: none; padding: var(--sp-4) var(--sp-4) calc(var(--sp-6) + 8px); max-width: 640px; margin: 0 auto; animation: panelIn var(--t-open) var(--ease-out); }
.panel.active { display: block; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } }
.panel-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.panel-head h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-2xl); letter-spacing: 0.6px; text-transform: uppercase; line-height: 1; }
.panel-head .right { margin-left: auto; }

/* Barre d'action (jour suivant) */
#action-bar {
  flex-shrink: 0; position: relative; z-index: 40; display: flex; gap: 8px; padding: 8px 12px;
  background: linear-gradient(0deg, rgba(12, 10, 18, 0.98), rgba(12, 10, 18, 0.7));
  border-top: 1px solid var(--line);
}
#btn-next-day { flex: 1; min-height: 50px; font-size: var(--fs-base); }
#btn-next-day .day { font-weight: 700; opacity: 0.7; font-size: var(--fs-sm); }
#btn-next-day.busy { pointer-events: none; filter: brightness(0.8); }
#btn-next-day.busy .ico { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#btn-fast { min-width: 74px; min-height: 50px; }

#game-nav {
  flex-shrink: 0; position: relative; z-index: 40; display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 4px 4px calc(var(--safe-bottom) + 4px); background: var(--bg-1); border-top: 1px solid var(--line);
}
.nav-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; border-radius: 12px; color: var(--text-4); font-size: 10px; font-weight: 700; letter-spacing: 0.2px; transition: color var(--t-press); }
.nav-item .ico { width: 23px; height: 23px; transition: transform var(--t-open) var(--ease-spring); }
.nav-item.active { color: var(--gold); }
.nav-item.active .ico { transform: translateY(-2px) scale(1.08); }
.nav-item.active::before { content: ''; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.nav-badge { position: absolute; top: 6px; right: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--neon); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg-1); }

/* ═══════════════════════════════════════════════════════════════════════════
   QG (ACCUEIL)
   ═══════════════════════════════════════════════════════════════════════════ */
.boss-card { display: flex; align-items: center; gap: 14px; }
.boss-card .rank-insignia { width: 56px; height: 56px; flex-shrink: 0; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5)); }
.boss-card .grow { flex: 1; min-width: 0; }
.boss-card .rank-name { font-family: var(--font-display); font-size: var(--fs-xl); letter-spacing: 0.5px; text-transform: uppercase; line-height: 1.05; }
.boss-card .respect { text-align: right; }
.boss-card .respect b { display: flex; align-items: center; gap: 4px; justify-content: flex-end; color: var(--gold); font-size: var(--fs-xl); font-weight: 800; }
.label-xs { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); font-weight: 700; }

.yesterday { display: flex; align-items: flex-end; gap: var(--sp-3); }
.yesterday .big { font-family: var(--font-display); font-size: var(--fs-3xl); line-height: 1; letter-spacing: 0.5px; }
.spark { flex: 1; height: 44px; display: flex; align-items: flex-end; gap: 3px; }
.spark i { flex: 1; min-width: 3px; border-radius: 3px 3px 1px 1px; background: var(--green); opacity: 0.85; }
.spark i.neg { background: var(--red); }

.advice { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.advice + .advice { border-top: 1px solid var(--line); }
.advice .grow { flex: 1; min-width: 0; font-size: var(--fs-md); line-height: 1.35; }
.advice .grow b { color: var(--text-1); }
.advice .grow span { display: block; font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }

.objective { padding: 10px 0; }
.objective + .objective { border-top: 1px solid var(--line); }
.objective .top { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.objective .top .grow { flex: 1; font-size: var(--fs-md); font-weight: 600; line-height: 1.3; }
.objective .top .prog { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.objective .rewards { display: flex; gap: 6px; margin-top: 7px; }

/* ═══════════════════════════════════════════════════════════════════════════
   VILLE
   ═══════════════════════════════════════════════════════════════════════════ */
.city-map { position: relative; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-2); background: #0b0f1a; }
.city-map svg { display: block; width: 100%; height: auto; }
.city-map .zone { cursor: pointer; }
.city-map .zone:active .zone-body { filter: brightness(1.3); }
.city-map .contested { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.map-legend { display: flex; gap: 14px; justify-content: center; padding: 10px; font-size: var(--fs-xs); color: var(--text-3); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.district-card { display: flex; gap: 12px; align-items: center; }
.district-card .grow { flex: 1; min-width: 0; }
.meter-row { display: grid; grid-template-columns: 74px 1fr 34px; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.meter-row + .meter-row { margin-top: 6px; }
.meter-row b { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.dots i.on { background: currentColor; }

/* ═══════════════════════════════════════════════════════════════════════════
   LOCAUX
   ═══════════════════════════════════════════════════════════════════════════ */
.local-card { padding: 14px; }
.local-card .head { display: flex; align-items: center; gap: 12px; }
.local-card .head .grow { flex: 1; min-width: 0; }
.local-card .name { font-weight: 800; font-size: var(--fs-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.local-card .meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.local-card .profit { text-align: right; }
.local-card .profit b { display: block; font-weight: 800; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.local-card.closed { opacity: 0.6; }
.local-card.contested { border-color: rgba(255, 61, 127, 0.45); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; margin-top: 12px; }
.slot {
  --c: var(--gold); position: relative; border-radius: 12px; padding: 9px 9px 8px; min-height: 76px;
  background: color-mix(in srgb, var(--c) 9%, var(--bg-1)); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
}
.slot:active { transform: scale(0.97); }
.slot .top { display: flex; align-items: center; gap: 6px; color: var(--c); }
.slot .top .ico { width: 18px; height: 18px; }
.slot .pname { font-size: var(--fs-xs); font-weight: 800; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .stock { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.slot .bar { height: 4px; margin-top: auto; }
.slot .bar > i { background: var(--c); }
.slot.low { animation: lowstock 1.6s ease-in-out infinite; }
@keyframes lowstock { 50% { border-color: rgba(255, 173, 51, 0.8); } }
.slot.empty { --c: var(--text-4); align-items: center; justify-content: center; border-style: dashed; color: var(--text-3); font-size: var(--fs-xs); font-weight: 700; gap: 4px; }
.slot.empty .ico { width: 22px; height: 22px; }
.prod-strip { margin-top: 12px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); font-size: var(--fs-sm); }

/* ═══════════════════════════════════════════════════════════════════════════
   ARGENT / POLICE / EMPIRE
   ═══════════════════════════════════════════════════════════════════════════ */
.treasury { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.treasury.single { grid-template-columns: 1fr; }
.money-card { border-radius: var(--r-lg); padding: 14px; border: 1px solid var(--line); background: var(--bg-2); }
.money-card .lbl { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.6px; }
.money-card .val { font-family: var(--font-display); font-size: var(--fs-2xl); letter-spacing: 0.5px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.money-card.bank { color: var(--cyan); background: linear-gradient(160deg, rgba(63, 212, 255, 0.14), var(--bg-2) 60%); border-color: rgba(63, 212, 255, 0.28); }
.money-card.cash { color: var(--amber); background: linear-gradient(160deg, rgba(255, 173, 51, 0.14), var(--bg-2) 60%); border-color: rgba(255, 173, 51, 0.28); }
.money-card .val { color: var(--text-1); }
.flow-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: var(--fs-sm); padding: 6px 0; }
.flow-row .bar { grid-column: 1 / -1; height: 6px; }
.chart { width: 100%; height: 150px; display: block; }

.gauge { position: relative; width: 168px; height: 168px; margin: 4px auto 0; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge .center b { font-family: var(--font-display); font-size: 46px; line-height: 1; letter-spacing: 0.5px; }
.gauge .center span { font-size: var(--fs-xs); font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-3); margin-top: 4px; }
.bribe-opt { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.bribe-opt + .bribe-opt { border-top: 1px solid var(--line); }
.bribe-opt .grow { flex: 1; }
.rival-card { display: flex; align-items: center; gap: 12px; }
.rival-card .grow { flex: 1; min-width: 0; }
.rival-card.dead { opacity: 0.5; }
.log-item { display: flex; gap: 10px; padding: 9px 0; font-size: var(--fs-sm); line-height: 1.4; }
.log-item + .log-item { border-top: 1px solid var(--line); }
.log-item .d { flex-shrink: 0; width: 44px; font-size: var(--fs-xs); color: var(--text-4); font-weight: 700; padding-top: 1px; }
.log-item.negative .m { color: #ffb3bd; } .log-item.positive .m { color: #b5f5d0; }

.upgrade { padding: 12px 0; }
.upgrade + .upgrade { border-top: 1px solid var(--line); }
.upgrade .head { display: flex; align-items: center; gap: 12px; }
.upgrade .head .grow { flex: 1; min-width: 0; }
.upgrade .pips { display: flex; gap: 4px; margin: 10px 0; }
.upgrade .pips i { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); }
.upgrade .pips i.on { background: var(--gold); box-shadow: 0 0 8px rgba(245, 196, 81, 0.5); }
.ach-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ach { border-radius: var(--r-md); padding: 10px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.ach .grow { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.ach .n { font-size: var(--fs-sm); font-weight: 800; line-height: 1.2; }
.ach .d { font-size: 10.5px; color: var(--text-3); line-height: 1.3; margin-top: 2px; }
.ach.locked { opacity: 0.5; }
.ach.locked .tile { --c: var(--text-4) !important; }
.ach.done { border-color: rgba(245, 196, 81, 0.35); }

/* ═══════════════════════════════════════════════════════════════════════════
   FEUILLES (MODALES), DIALOGUES
   ═══════════════════════════════════════════════════════════════════════════ */
#sheet-root { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(5, 3, 10, 0.66); opacity: 0; transition: opacity var(--t-open) var(--ease-out); pointer-events: auto; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.sheet-backdrop.in { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 92%;
  display: flex; flex-direction: column; pointer-events: auto;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1) 30%); border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(100%); transition: transform var(--t-open) var(--ease-out);
}
.sheet.in { transform: translateY(0); }
.sheet.full { top: calc(var(--safe-top) + 12px); max-height: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); margin: 8px auto 0; flex-shrink: 0; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px 12px; flex-shrink: 0; }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-head h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); letter-spacing: 0.5px; text-transform: uppercase; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { flex: 1; overflow-y: auto; padding: 0 16px calc(var(--safe-bottom) + 18px); -webkit-overflow-scrolling: touch; }
.sheet-foot { flex-shrink: 0; padding: 12px 16px calc(var(--safe-bottom) + 12px); border-top: 1px solid var(--line); background: var(--bg-1); display: flex; gap: 8px; }
.sheet-foot .btn { flex: 1; }
.sheet .seg { margin-bottom: var(--sp-3); }

.dialog-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(5, 3, 10, 0.72); opacity: 0; transition: opacity var(--t-open); }
.dialog-wrap.in { opacity: 1; }
.dialog { width: 100%; max-width: 360px; border-radius: var(--r-xl); padding: 22px 18px 16px; background: linear-gradient(180deg, var(--bg-3), var(--bg-2)); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2); text-align: center; transform: scale(0.92); transition: transform var(--t-open) var(--ease-spring); }
.dialog-wrap.in .dialog { transform: scale(1); }
.dialog .tile { margin: 0 auto 12px; }
.dialog h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 8px; }
.dialog p { font-size: var(--fs-md); color: var(--text-2); line-height: 1.5; }
.dialog .btn-stack { margin-top: 18px; }

/* ═══════════════════════════════════════════════════════════════════════════
   RAPPORT DU JOUR
   ═══════════════════════════════════════════════════════════════════════════ */
.report-hero { text-align: center; padding: 6px 0 14px; }
.report-hero .lbl { font-size: var(--fs-xs); font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-3); }
.report-hero .amount { font-family: var(--font-display); font-size: clamp(44px, 14vw, 60px); line-height: 1; margin-top: 6px; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.report-hero .amount.pos { color: var(--green); text-shadow: 0 0 24px rgba(61, 220, 132, 0.35); }
.report-hero .amount.neg { color: var(--red); }
.report-hero .verdict { margin-top: 6px; font-size: var(--fs-md); color: var(--text-2); }
.alert-card { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--r-md); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.alert-card + .alert-card { margin-top: 8px; }
.alert-card .grow { flex: 1; min-width: 0; font-size: var(--fs-sm); line-height: 1.4; }
.alert-card .grow b { display: block; font-size: var(--fs-md); color: var(--text-1); }
.alert-card.bad { border-color: rgba(255, 84, 104, 0.35); background: rgba(255, 84, 104, 0.08); }
.alert-card.good { border-color: rgba(61, 220, 132, 0.3); background: rgba(61, 220, 132, 0.07); }
.alert-card.gold { border-color: rgba(245, 196, 81, 0.4); background: rgba(245, 196, 81, 0.08); }
.breakdown .row { min-height: 38px; font-size: var(--fs-md); }
details.fold { border-radius: var(--r-md); background: rgba(0, 0, 0, 0.2); border: 1px solid var(--line); }
details.fold + details.fold { margin-top: 8px; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px; font-weight: 700; font-size: var(--fs-md); }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .chev { margin-left: auto; transition: transform var(--t-open); color: var(--text-3); }
details.fold[open] > summary .chev { transform: rotate(180deg); }
details.fold > .inner { padding: 0 12px 12px; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.55; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOASTS, TUTORIEL, EFFETS
   ═══════════════════════════════════════════════════════════════════════════ */
#toasts { position: fixed; z-index: 3000; left: 0; right: 0; top: calc(var(--safe-top) + var(--hud-h) + 6px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 12px; }
.toast {
  max-width: 420px; width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: rgba(28, 24, 40, 0.96); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: var(--fs-md); font-weight: 600; line-height: 1.35; color: var(--text-1);
  animation: toastIn 260ms var(--ease-spring) both; pointer-events: auto;
}
.toast .ico { width: 20px; height: 20px; }
.toast.good { border-color: rgba(61, 220, 132, 0.45); } .toast.good .ico { color: var(--green); }
.toast.bad { border-color: rgba(255, 84, 104, 0.5); } .toast.bad .ico { color: var(--red); }
.toast.gold { border-color: rgba(245, 196, 81, 0.5); } .toast.gold .ico { color: var(--gold); }
.toast.info .ico { color: var(--cyan); }
.toast.out { animation: toastOut 220ms ease-in both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

#coach {
  position: fixed; z-index: 900; left: 10px; right: 10px; margin: 0 auto; max-width: 520px;
  bottom: calc(var(--safe-bottom) + var(--nav-h) + var(--actionbar-h) + 10px);
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px 12px 14px; border-radius: 16px;
  background: linear-gradient(180deg, #2d2440, #221b31); border: 1px solid rgba(245, 196, 81, 0.45);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.3);
  animation: toastIn 300ms var(--ease-spring) both;
}
#coach .step { flex-shrink: 0; font-family: var(--font-display); color: var(--gold); font-size: var(--fs-lg); line-height: 1.2; min-width: 34px; }
#coach .txt { flex: 1; font-size: var(--fs-md); line-height: 1.42; color: var(--text-1); }
#coach .txt b { color: var(--gold); }
#coach .acts { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
#coach.raise { bottom: auto; top: calc(var(--safe-top) + var(--hud-h) + 10px); }
#coach.low { bottom: calc(var(--safe-bottom) + 84px); }
.coach-target { position: relative; z-index: 2; animation: coachRing 1.3s ease-in-out infinite; border-radius: 14px; }
@keyframes coachRing { 0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 0 6px rgba(245, 196, 81, 0.25); } 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 0 12px rgba(245, 196, 81, 0); } }

#fx-layer { position: fixed; inset: 0; z-index: 2500; pointer-events: none; overflow: hidden; }
.coin { position: absolute; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c9, var(--gold) 45%, #b9801f); box-shadow: 0 0 8px rgba(245, 196, 81, 0.6); will-change: transform, opacity; }
.float-num { position: absolute; font-weight: 900; font-size: 18px; color: var(--green); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); will-change: transform, opacity; white-space: nowrap; }
.float-num.neg { color: var(--red); }

.celebrate { position: fixed; inset: 0; z-index: 2400; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: radial-gradient(60% 50% at 50% 45%, rgba(245, 196, 81, 0.22), rgba(5, 3, 10, 0.9)); opacity: 0; transition: opacity 260ms; }
.celebrate.in { opacity: 1; }
.celebrate .rays { position: absolute; width: 520px; height: 520px; background: repeating-conic-gradient(rgba(245, 196, 81, 0.12) 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: spin 18s linear infinite; mask-image: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 65%); }
.celebrate .content { position: relative; transform: scale(0.7); transition: transform 500ms var(--ease-spring); }
.celebrate.in .content { transform: scale(1); }
.celebrate .kicker { font-size: var(--fs-sm); font-weight: 800; letter-spacing: 3px; text-transform: uppercase; color: var(--neon); }
.celebrate h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(38px, 12vw, 56px); line-height: 1; margin: 10px 0; text-transform: uppercase; background: linear-gradient(180deg, #fff3c4, var(--gold) 50%, #b47a1c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.celebrate p { color: var(--text-2); font-size: var(--fs-md); max-width: 300px; margin: 0 auto; }
.celebrate .rank-insignia { width: 110px; height: 110px; filter: drop-shadow(0 8px 24px rgba(245, 196, 81, 0.5)); }
.celebrate .tap { margin-top: 26px; font-size: var(--fs-xs); color: var(--text-3); letter-spacing: 1px; text-transform: uppercase; }

.pop { animation: pop var(--t-reward) var(--ease-spring); }
@keyframes pop { 40% { transform: scale(1.08); } }
.shake { animation: shake 360ms ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* Guide */
.guide-section h4 { font-size: var(--fs-md); margin: 12px 0 6px; }
.guide-section p, .guide-section li { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.55; }
.guide-section ul { padding-left: 18px; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 399px) {
  .hud-chip .ico { display: none; }
  .hud-chip { padding: 5px 8px; }
}
@media (max-width: 359px) {
  .ach-grid { grid-template-columns: 1fr; }
  :root { --fs-base: 14px; }
  .hud-chip .l { display: none; }
  .hud-chip { padding: 6px 7px 6px 6px; gap: 4px; }
  .hud-chip .v { font-size: var(--fs-sm); }
  .hud-day span { display: none; }
  .nav-item { font-size: 9px; }
  .panel { padding-left: 12px; padding-right: 12px; }
  .kpi .val { font-size: var(--fs-base); }
}
@media (min-width: 700px) {
  .panel { padding-top: var(--sp-6); }
  .sheet { bottom: 24px; border-radius: var(--r-xl); border-bottom: 1px solid var(--line-strong); max-height: 86%; }
  .sheet.full { top: 40px; bottom: 24px; }
  .sheet:not(.in) { transform: translateY(calc(100% + 40px)); }
}

/* Animations réduites (paramètre ou préférence système) */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
