:root {
  --bg: #12111f;
  --bg-2: #1a1830;
  --card: #221f3d;
  --card-hi: #2b2850;
  --well: #161428;
  --line: #35315c;
  --text: #f3f0ff;
  --muted: #a39fc4;
  --gold: #ffcc4d;
  --gold-d: #e0a91f;
  --green: #3ddc84;
  --green-d: #1f9d5a;
  --violet: #a78bfa;
  --cyan: #5cc8ff;
  --red: #ff6b6b;
  --radius: 14px;
  --top-h: 68px;
  --ticker-h: 34px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% -10%, #2a2552 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
h2, h3, p { margin: 0; }
.hidden { display: none !important; }

/* ---------- En-tête ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--top-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: rgba(18, 17, 31, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand-logo { font-size: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { color: var(--violet); font-size: 12px; font-weight: 600; }

.wallet { text-align: center; }

.money {
  font-size: 30px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.income { color: var(--green); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.pill.gold { background: var(--gold); color: #2a1e00; }
.pill.violet { background: var(--violet); color: #1b1240; }

.resources { display: flex; justify-content: flex-end; gap: 8px; }

.res {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.res:hover { background: var(--card-hi); }
.res.off { opacity: 0.45; }

/* ---------- Bandeau d'infos ---------- */

.ticker {
  position: sticky;
  top: var(--top-h);
  z-index: 19;
  height: var(--ticker-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  background: #0e0d19;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.ticker-tag { flex: none; color: var(--gold); font-weight: 700; }
.ticker-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker .pill { flex: none; margin-left: 0; }

/* ---------- Structure ---------- */

.app {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 20px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 20px 80px;
  align-items: start;
}

.nav {
  position: sticky;
  top: calc(var(--top-h) + var(--ticker-h) + 18px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--top-h) - var(--ticker-h) - 36px);
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
}
.nav button:hover { background: var(--card); color: var(--text); }
.nav button.active { background: var(--card-hi); color: var(--gold); }
.nav button.locked { opacity: 0.45; }
.nav button.locked .nav-icon { filter: grayscale(1); }
.nav-icon { width: 22px; text-align: center; }
.nav-label { flex: 1; }

.badge {
  min-width: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--green);
  color: #06301a;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}
.badge:empty { display: none; }

.page { display: none; }
.page.active { display: block; }

.page-head { margin-bottom: 16px; }
.page-head h2 { font-size: 22px; }
.page-head p { margin-top: 4px; color: var(--muted); font-size: 14px; max-width: 760px; }

.sub { font-size: 16px; margin-bottom: 4px; }
.note { margin: 8px 0 12px; color: var(--muted); font-size: 13px; }
.empty { padding: 30px 8px; text-align: center; color: var(--muted); }
.row-actions { margin-bottom: 12px; }

/* ---------- Ville ---------- */

.city {
  position: relative;
  height: 112px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 31% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 28%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 71% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 30%, #fff 50%, transparent 51%),
    linear-gradient(#14163a, #3b2a63 55%, #7b4a72);
}
.city::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  height: 12px;
  background: #15132a;
}

/* Cycle jour / nuit de 3 minutes */
.sky-day {
  position: absolute;
  inset: 0;
  background: linear-gradient(#4aa8f5, #9fd6ff 55%, #ffe1b3);
  opacity: 0;
  animation: daylight 180s linear infinite;
}
@keyframes daylight {
  0%, 12% { opacity: 0; }
  24%, 62% { opacity: 1; }
  76%, 100% { opacity: 0; }
}

.orbit { position: absolute; inset: 0; animation: orbit-x 180s linear infinite; }
.orbit span {
  position: absolute;
  left: 50%;
  top: 8px;
  margin-left: -13px;
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(255, 225, 140, 0.8));
  animation: orbit-y 180s ease-in-out infinite;
}
.moon-orbit, .moon-orbit span { animation-delay: -90s; }
@keyframes orbit-x {
  0%, 18% { transform: translateX(-56%); }
  72%, 100% { transform: translateX(56%); }
}
@keyframes orbit-y {
  0%, 18% { transform: translateY(90px); }
  45% { transform: translateY(0); }
  72%, 100% { transform: translateY(90px); }
}

.cloud { position: absolute; left: -60px; line-height: 1; opacity: 0.85; animation: cloud 70s linear infinite; }
.cloud.c1 { top: 6px; font-size: 26px; }
.cloud.c2 { top: 30px; font-size: 18px; opacity: 0.6; animation-duration: 96s; animation-delay: -40s; }
@keyframes cloud { to { transform: translateX(1800px); } }

.city-plane { position: absolute; top: 10px; left: -40px; font-size: 18px; line-height: 1; animation: plane 34s linear infinite; }
@keyframes plane {
  0% { transform: translate(0, 22px) rotate(45deg); }
  55%, 100% { transform: translate(1800px, -6px) rotate(45deg); }
}

.city-rocket { position: absolute; bottom: 14px; right: 12%; z-index: 1; font-size: 20px; line-height: 1; opacity: 0; animation: launch 26s ease-in infinite; }
@keyframes launch {
  0%, 70% { transform: translateY(0) rotate(-45deg); opacity: 0; }
  73% { transform: translateY(0) rotate(-45deg); opacity: 1; }
  100% { transform: translateY(-180px) rotate(-45deg); opacity: 1; }
}

.city-car { position: absolute; bottom: 3px; left: 100%; z-index: 4; font-size: 15px; line-height: 1; animation: drive 16s linear infinite; }
@keyframes drive { to { transform: translateX(-1800px); } }

.skyline {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 0 14px 10px;
}
.skyline span { flex: none; line-height: 1; transform-origin: bottom center; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.skyline span.new { animation: build 0.6s cubic-bezier(.2, 1.5, .4, 1) backwards; }
@keyframes build { from { transform: translateY(40px) scaleY(0.2); opacity: 0; } }

/* ---------- Page Commerces ---------- */

.hint {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(92, 200, 255, 0.1);
  border: 1px solid rgba(92, 200, 255, 0.4);
  color: #d5f0ff;
  font-weight: 600;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.chip-info { color: var(--violet); font-size: 13px; font-weight: 600; }

.toggle {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.toggle.on { border-color: var(--green-d); color: var(--green); }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--well);
  border: 1px solid var(--line);
}
.seg button {
  padding: 6px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--gold); color: #2a1e00; }

.quick {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 34px;
  margin-bottom: 12px;
}
.quick-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; }
.quick-empty { color: #6f6b93; font-size: 13px; }

.chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 204, 77, 0.12);
  border: 1px solid var(--gold-d);
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.chip:hover { background: rgba(255, 204, 77, 0.25); }

.biz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.biz {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  transition: border-color 0.2s, opacity 0.2s;
}
.biz.locked { opacity: 0.6; }
.biz.locked .biz-emoji { filter: grayscale(1); }
.biz.boosted { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet), 0 0 18px rgba(167, 139, 250, 0.35); }

.biz-icon {
  position: relative;
  flex: none;
  width: 76px;
  border-radius: 12px;
  background: var(--card-hi);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  transition: transform 0.08s;
}
.biz-icon:hover { background: #343060; }
.biz-icon:active { transform: scale(0.95); }
.biz-emoji { font-size: 34px; line-height: 1; }
.biz-count { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.biz-milebar { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--violet); transition: width 0.3s ease-out; }

.biz-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.biz-head { display: flex; align-items: center; gap: 6px; }
.biz-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.biz-mgr { flex: none; font-size: 12px; color: var(--green); font-weight: 600; }
.biz-mile { margin-left: auto; flex: none; color: var(--violet); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

.bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--well);
  overflow: hidden;
  text-align: left;
}
.bar-fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--green-d), var(--green));
}
.bar.fast .bar-fill {
  background-image: repeating-linear-gradient(-45deg, var(--green-d) 0 12px, #2bbd6e 12px 24px);
  background-size: 34px 100%;
  animation: stripes 0.6s linear infinite;
}
@keyframes stripes { to { background-position: 34px 0; } }

.bar-label, .bar-time {
  position: relative;
  z-index: 1;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}
.bar-time { font-weight: 600; color: #e6e2ff; }
.bar.idle { box-shadow: inset 0 0 0 1px var(--green-d); }
.bar.idle:hover { background: #1c2a2c; }

.buy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--gold);
  color: #2a1e00;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.buy:hover:not(:disabled) { background: #ffd970; }
.buy:active:not(:disabled) { transform: translateY(1px); }
.buy:disabled { background: #3a3660; color: #8a86ad; }

.float {
  position: absolute;
  left: 96px;
  top: 30px;
  z-index: 3;
  color: var(--gold);
  font-weight: 800;
  font-size: 15px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  animation: float-up 0.9s ease-out forwards;
}
@keyframes float-up {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-34px); }
}

/* ---------- Cartes génériques ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.cards.one { grid-template-columns: 1fr; }

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.item.hired { border-color: #2d5a45; }

.item-icon { flex: none; font-size: 26px; width: 36px; text-align: center; }
.item-text { flex: 1; min-width: 0; }
.item-text strong { display: block; font-size: 14px; }
.item-text small { display: block; color: var(--muted); font-size: 12px; }

.lvl {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--card-hi);
  color: var(--violet);
  font-size: 11px;
  font-weight: 700;
}

.item-buy {
  flex: none;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--gold);
  color: #2a1e00;
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.item-buy:hover:not(:disabled) { filter: brightness(1.1); }
.item-buy.gems { background: var(--cyan); color: #04263a; }
.item-buy.stars { background: var(--violet); color: #1b1240; }
.item-buy.rp { background: var(--green); color: #06301a; }
.item-buy:disabled { background: #3a3660; color: #8a86ad; }

.item-done { flex: none; color: var(--green); font-weight: 700; font-size: 13px; }
.lock { flex: none; opacity: 0.6; }

.btn {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--card-hi);
  border: 1px solid var(--line);
  font-weight: 700;
}
.btn:hover:not(:disabled) { background: #343060; }
.btn.small { display: inline-block; width: auto; flex: none; padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.primary { background: var(--violet); color: #1b1240; border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: #bda7ff; }
.btn.danger { background: transparent; color: var(--red); border-color: #6b2f3a; }
.btn.danger:hover { background: #3a1c26; }
.btn.on { border-color: var(--green-d); color: var(--green); }
.btn.ghost { background: transparent; }
.btn:disabled { background: #2c2948; color: #77739b; border-color: transparent; }

.thin-bar { height: 8px; border-radius: 999px; background: var(--well); overflow: hidden; }
.thin-bar > span { display: block; height: 100%; width: 0; background: var(--violet); transition: width 0.3s ease-out; }

.kpis { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.kpi {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.kpi small { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---------- Missions ---------- */

.mission {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.mission-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.mission-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mission-bottom small { color: var(--muted); font-variant-numeric: tabular-nums; }
.reward {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--card-hi);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- Multijoueur ---------- */

.panel-card {
  padding: 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.panel-card h3 { font-size: 15px; margin-bottom: 6px; }
.panel-card .note { margin: 0 0 10px; }

.mp-join {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 460px;
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.field input, .chat-form input {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--text);
  font: inherit;
}
.field input:focus, .chat-form input:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
.note.error { color: var(--red); margin: 0; }

.mp-help { max-width: 720px; }
.mp-help ol { margin: 6px 0 10px; padding-left: 20px; color: var(--muted); font-size: 14px; }
.mp-help li { margin-bottom: 5px; }
.mp-help strong { color: var(--text); }

.mp-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.mp-col { display: flex; flex-direction: column; gap: 12px; }
.mp-address { font-size: 14px !important; word-break: break-all; }

.mp-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.mp-row + .mp-row { border-top: 1px dashed var(--line); }
.mp-row.me { background: rgba(255, 204, 77, 0.1); }
.mp-money { text-align: right; }
.mp-money strong { display: block; color: var(--gold); font-size: 14px; }
.mp-money small { color: var(--green); font-size: 12px; }

.sprint-clock { font-size: 34px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; text-align: center; }

.chat-list {
  height: 280px;
  overflow-y: auto;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--well);
  font-size: 14px;
}
.chat-line { padding: 2px 0; word-break: break-word; }
.chat-line strong { color: var(--cyan); }
.chat-line.me strong { color: var(--gold); }
.chat-line.system { color: var(--muted); font-size: 13px; font-style: italic; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; }
.page.entering .panel-card { animation: rise 0.4s ease-out backwards; }

/* ---------- Synergies ---------- */

.synergy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.synergy.on { border-color: #2d5a45; }
.synergy.on .thin-bar > span { background: var(--green); }
.synergy-top { display: flex; align-items: center; gap: 10px; }
.synergy-icons { flex: none; font-size: 22px; white-space: nowrap; }
.synergy-icons i { margin: 0 3px; color: var(--muted); font-size: 14px; font-style: normal; }
.synergy-note { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.page.entering .synergy { animation: rise 0.4s ease-out backwards; }

/* ---------- Recherche ---------- */

.lab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1f3a3a, var(--card));
  border: 1px solid #2f6a5c;
}
.lab-icon { font-size: 34px; }

.tree { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.branch { display: flex; flex-direction: column; gap: 8px; }
.branch h3 { font-size: 14px; color: var(--muted); padding: 0 2px 2px; }

.tech {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
  min-height: 112px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
}
.tech strong { font-size: 13px; }
.tech small { flex: 1; color: var(--muted); font-size: 12px; }
.tech.done { border-color: #2d5a45; background: #1c2c33; }
.tech.locked { opacity: 0.5; }

/* ---------- Bourse ---------- */

.stocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }

.stock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.stock-head { display: flex; align-items: center; gap: 10px; }
.stock-price { text-align: right; font-variant-numeric: tabular-nums; }
.stock-price strong { display: block; font-size: 16px; }
.chg { color: var(--green); font-weight: 700; font-size: 12px; }
.chg.down { color: var(--red); }
.stock-pos { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.stock-pos span { color: var(--text); font-weight: 600; }
.stock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stock-actions .btn { width: 100%; }

.spark { display: block; width: 100%; height: 64px; border-radius: 8px; background: var(--well); }
.spark.tall { height: 140px; margin-top: 8px; }

/* ---------- Prestige ---------- */

.prestige-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }

.prestige-hero {
  padding: 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #332a66, #221f3d);
  border: 1px solid #4b4390;
  text-align: center;
}
.prestige-hero .big { font-size: 38px; font-weight: 800; color: var(--violet); }
.prestige-hero > small { color: var(--muted); }
.prestige-next { margin: 16px 0; }
.prestige-next p { margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.prestige-next strong { color: var(--text); }

/* ---------- Succès, classement, stats ---------- */

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.ach {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  opacity: 0.45;
}
.ach-icon { flex: none; font-size: 24px; filter: grayscale(1); }
.ach strong { display: block; font-size: 13px; }
.ach small { display: block; color: var(--muted); font-size: 12px; }
.ach.unlocked { opacity: 1; border-color: var(--gold-d); }
.ach.unlocked .ach-icon { filter: none; }

.rank { margin: 0; padding: 0; list-style: none; max-width: 720px; }
.rank li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.rank li:nth-child(odd) { background: var(--card); }
.rank li.me { background: rgba(255, 204, 77, 0.15); box-shadow: inset 0 0 0 1px var(--gold-d); font-weight: 700; }
.rank li.live { background: rgba(92, 200, 255, 0.12); box-shadow: inset 0 0 0 1px rgba(92, 200, 255, 0.45); }
.rank-n { width: 28px; color: var(--muted); font-weight: 700; }
.rank-name { flex: 1; }
.rank-val { color: var(--gold); font-weight: 600; }

.chart-card {
  max-width: 720px;
  padding: 12px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.chart-card small { color: var(--muted); }

.stat-list { margin: 0; padding: 0; list-style: none; max-width: 720px; }
.stat-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px dashed var(--line);
  font-variant-numeric: tabular-nums;
}
.stat-list li span:first-child { color: var(--muted); }

.locked-page { max-width: 420px; margin: 60px auto; text-align: center; }
.locked-page .big { font-size: 54px; }
.locked-page p { margin: 8px 0 16px; color: var(--muted); }

/* ---------- Client VIP ---------- */

.vip {
  position: fixed;
  z-index: 30;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff3c4, var(--gold));
  box-shadow: 0 0 0 4px rgba(255, 204, 77, 0.25), 0 0 30px rgba(255, 204, 77, 0.7);
  font-size: 32px;
  animation: vip-bounce 0.9s ease-in-out infinite alternate;
}
@keyframes vip-bounce {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-10px) scale(1.08); }
}

/* ---------- Notifications ---------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 340px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card-hi);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 14px;
}
.toast.good { border-left-color: var(--green); }
.toast.star { border-left-color: var(--violet); }

/* ---------- Fenêtre modale ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 7, 16, 0.72);
}
.modal-box {
  width: min(460px, 100%);
  padding: 22px;
  border-radius: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal-box h2 { margin-bottom: 10px; font-size: 20px; }
.modal-body { color: var(--muted); }
.modal-body strong { color: var(--gold); }
.modal-actions { display: flex; gap: 8px; margin-top: 18px; }

.io {
  display: block;
  width: 100%;
  height: 110px;
  margin-top: 10px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--well);
  color: var(--text);
  font: 12px/1.3 Consolas, monospace;
  resize: none;
  word-break: break-all;
}

/* ---------- Animations ---------- */

/* Halos de fond qui dérivent lentement */
body::before, body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.3;
  pointer-events: none;
}
body::before { top: -120px; left: -100px; background: #4b3fb0; animation: drift-a 38s ease-in-out infinite alternate; }
body::after { bottom: -160px; right: -120px; background: #7a3f8f; animation: drift-b 46s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate(260px, 180px) scale(1.2); } }
@keyframes drift-b { to { transform: translate(-300px, -160px) scale(1.15); } }

.brand-logo { display: inline-block; animation: logo 4s ease-in-out infinite alternate; }
@keyframes logo { from { transform: translateY(1px) rotate(-3deg); } to { transform: translateY(-2px) rotate(3deg); } }

/* Rebonds déclenchés par le jeu */
.bump { animation: bump 0.32s ease-out; }
@keyframes bump { 35% { transform: scale(1.28); } }

.money.tick { animation: tick 0.25s ease-out; }
@keyframes tick { 40% { transform: scale(1.07); } }

.money.rush {
  background: linear-gradient(90deg, var(--gold), #fff7d6, var(--gold));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.biz.pop { animation: pop 0.28s ease-out; }
@keyframes pop { 40% { transform: scale(1.03); } }

.biz.working .biz-emoji { animation: bob 1.1s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(1px) rotate(-4deg); } to { transform: translateY(-3px) rotate(4deg); } }
.biz:nth-child(3n) .biz-emoji { animation-delay: -0.4s; }
.biz:nth-child(3n + 1) .biz-emoji { animation-delay: -0.8s; }

.biz.boosted { animation: glow 1.1s ease-in-out infinite alternate; }
@keyframes glow {
  from { box-shadow: 0 0 0 1px var(--violet), 0 0 8px rgba(167, 139, 250, 0.25); }
  to { box-shadow: 0 0 0 1px var(--violet), 0 0 28px rgba(167, 139, 250, 0.65); }
}

.bar.idle { animation: idle-pulse 1s ease-in-out infinite alternate; }
@keyframes idle-pulse { to { box-shadow: inset 0 0 0 1px var(--green), 0 0 12px rgba(61, 220, 132, 0.45); } }

.buy.ready { animation: ready 0.7s ease-out; }
@keyframes ready {
  from { box-shadow: 0 0 0 0 rgba(255, 204, 77, 0.9); }
  to { box-shadow: 0 0 0 12px rgba(255, 204, 77, 0); }
}

.hint { animation: hint-pulse 1.4s ease-in-out infinite alternate; }
@keyframes hint-pulse { to { box-shadow: 0 0 18px rgba(92, 200, 255, 0.35); } }

/* Boutons et cartes */
.buy, .item-buy, .btn, .chip, .res, .seg button, .nav button { transition: transform 0.08s, background 0.15s, color 0.15s, filter 0.15s, opacity 0.15s; }
.item-buy:active:not(:disabled), .btn:active:not(:disabled), .chip:active, .res:active, .nav button:active { transform: scale(0.95); }
.item, .tech, .stock, .mission, .kpi { transition: transform 0.15s, border-color 0.15s; }
.item:hover, .stock:hover, .mission:hover { transform: translateY(-2px); border-color: #4a4580; }

.nav button.unlock { animation: unlock 0.9s ease-out; }
@keyframes unlock {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 204, 77, 0.9); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); box-shadow: 0 0 0 16px rgba(255, 204, 77, 0); }
}

.mission.ready { border-color: var(--green-d); animation: mission-ready 1.1s ease-in-out infinite alternate; }
@keyframes mission-ready { to { box-shadow: 0 0 18px rgba(61, 220, 132, 0.4); } }

.stock-price strong.up { animation: price-up 0.8s ease-out; }
.stock-price strong.down { animation: price-down 0.8s ease-out; }
@keyframes price-up { from { color: var(--green); transform: scale(1.14); } }
@keyframes price-down { from { color: var(--red); transform: scale(1.14); } }

.ticker-text.slide { animation: ticker-in 0.45s ease-out; }
@keyframes ticker-in { from { opacity: 0; transform: translateY(12px); } }

/* Changement de page : fondu, puis cartes en cascade */
.page.active { animation: page-in 0.3s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .kpi, .rank li, .lab) { animation: rise 0.4s ease-out backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(2) { animation-delay: 0.03s; }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(3) { animation-delay: 0.06s; }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(4) { animation-delay: 0.09s; }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(5) { animation-delay: 0.12s; }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(6) { animation-delay: 0.15s; }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(7) { animation-delay: 0.18s; }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(8) { animation-delay: 0.21s; }
.page.entering :is(.biz, .item, .tech, .stock, .mission, .ach, .rank li):nth-child(n + 9) { animation-delay: 0.24s; }

/* Notifications et fenêtres */
.toast { animation: toast-in 0.32s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } }
.toast.out { animation: toast-out 0.3s ease-in forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

.modal { animation: fade-in 0.2s ease-out; }
.modal-box { animation: modal-in 0.3s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.88) translateY(12px); } }

.vip::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  animation: ring 1.2s ease-out infinite;
}
@keyframes ring { from { transform: scale(0.9); opacity: 0.9; } to { transform: scale(1.7); opacity: 0; } }

/* Pièces, confettis, heure de pointe, flash du prestige */
.coin {
  position: fixed;
  z-index: 45;
  margin: -10px 0 0 -10px;
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
  will-change: transform;
}

#fx { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; }

.rush {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(255, 204, 77, 0.5);
  opacity: 0;
  transition: opacity 0.4s;
}
.rush.on { animation: rush 0.9s ease-in-out infinite alternate; }
@keyframes rush { from { opacity: 0.4; } to { opacity: 1; } }

.flash-overlay { position: fixed; inset: 0; z-index: 55; pointer-events: none; background: #fff; opacity: 0; }
.flash-overlay.go { animation: flash 0.7s ease-out; }
@keyframes flash { from { opacity: 0.8; } to { opacity: 0; } }

.slider { flex: none; width: 120px; accent-color: var(--gold); }

/* Animations coupées : option du jeu ou réglage du système */
body.no-anim *, body.no-anim *::before, body.no-anim *::after,
body.no-anim::before, body.no-anim::after { animation: none !important; transition: none !important; }
body.no-anim .sun-orbit { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sun-orbit { display: none; }
}

/* ---------- Petits écrans ---------- */

@media (max-width: 1100px) {
  .prestige-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --top-h: 60px; }
  .top { padding: 0 10px; gap: 8px; grid-template-columns: auto 1fr auto; }
  .brand-text { display: none; }
  .money { font-size: 22px; }
  .res { padding: 5px 8px; font-size: 12px; }
  .resources { gap: 4px; }
  #soundBtn { display: none; }
  .ticker { padding: 0 10px; }

  .app { grid-template-columns: 1fr; padding: 12px 10px 90px; }
  .nav {
    position: fixed;
    top: auto;
    left: 0; right: 0; bottom: 0;
    z-index: 25;
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 0;
    border-width: 1px 0 0;
    padding: 4px;
  }
  .nav button { position: relative; flex: none; flex-direction: column; gap: 0; padding: 6px 10px; font-size: 10px; }
  .nav-icon { font-size: 18px; }
  .nav .badge { position: absolute; top: 2px; right: 2px; }

  .biz-grid, .cards, .stocks { grid-template-columns: 1fr; }
  .tree { grid-template-columns: 1fr; }
  .mp-grid { grid-template-columns: 1fr; }
  .tech { min-height: 0; }
  .toolbar { justify-content: center; }
  .toasts { bottom: 70px; right: 8px; left: 8px; }
  .city { height: 92px; }
  .slider { width: 84px; }
}
