:root {
  --bg: #07070f;
  --panel: rgba(16, 16, 32, 0.94);
  --border: #2b2b55;
  --text: #e8e8ff;
  --muted: #8a8ab0;
  --accent: #00e5ff;
  --accent-2: #ff2bd6;
  --gold: #ffcc33;
  --event: #ff7a1a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

canvas { display: block; }

.hidden { display: none !important; }

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(4, 4, 16, 0.35), rgba(2, 2, 8, 0.75));
  backdrop-filter: blur(4px);
  padding: 16px;
  z-index: 10;
}

.panel {
  background:
    linear-gradient(180deg, rgba(40, 40, 80, 0.55), rgba(10, 10, 26, 0.0) 120px),
    linear-gradient(180deg, rgba(22, 22, 46, 0.94), rgba(10, 10, 24, 0.96));
  border: 1px solid rgba(160, 170, 255, 0.16);
  border-radius: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 80px rgba(0, 229, 255, 0.1), 0 0 140px rgba(255, 43, 214, 0.06);
  max-height: 100%;
  overflow-y: auto;
}

/* Logo : l'emblème (planète en orbite) remplace le « O » d'ORBITAL */
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Orbitron, system-ui, sans-serif;
  font-weight: 800;
  font-size: 52px;
  letter-spacing: 8px;
  margin: 0 0 4px;
  filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.6)) drop-shadow(0 0 28px rgba(255, 43, 214, 0.35));
  animation: pulse 3s ease-in-out infinite;
}
.logo span {
  background: linear-gradient(90deg, #4f8bff, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-o { width: 1.5em; height: 1.5em; margin: -0.25em -0.12em -0.25em -0.2em; animation: logo-spin 6s ease-in-out infinite; }
@keyframes logo-spin { 50% { transform: rotate(-6deg) scale(1.04); } }
@media (max-width: 420px) { .logo { font-size: 40px; letter-spacing: 6px; } }
@media (prefers-reduced-motion: reduce) { .logo-o { animation: none; } }

.tagline { color: var(--muted); margin: 0 0 16px; }
h2 {
  margin: 0 0 12px;
  font-family: Orbitron, system-ui, sans-serif;
  letter-spacing: 2px;
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.55);
}

@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.55)) drop-shadow(0 0 24px rgba(255, 43, 214, 0.3)); }
  50% { filter: drop-shadow(0 0 18px rgba(0, 229, 255, 0.8)) drop-shadow(0 0 40px rgba(255, 43, 214, 0.5)); }
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.btn {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: 12px;
  border: 1px solid rgba(160, 170, 255, 0.18);
  background: linear-gradient(180deg, #24244a, #16162e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.btn:hover { background: #24244a; box-shadow: 0 0 16px rgba(0, 229, 255, 0.25); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #00b8d4, #6a3df0 55%, #c51fb0);
  border: none;
  font-family: Orbitron, system-ui, sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.35), 0 0 30px rgba(197, 31, 176, 0.25);
}
.btn.primary:hover { box-shadow: 0 0 28px rgba(0, 229, 255, 0.55), 0 0 44px rgba(197, 31, 176, 0.4); }
.btn.ghost { background: transparent; }
.btn.small { width: auto; display: inline-block; padding: 6px 12px; margin: 0; font-size: 14px; }
.btn.buy-eur { background: linear-gradient(90deg, #ffb300, #ff6d00); border: none; color: #1a0d00; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.hint { color: var(--muted); font-size: 12px; margin-top: 16px; }

.event-banner {
  background: linear-gradient(90deg, #3a1500, #4a0f3a);
  border: 1px solid var(--event);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  cursor: pointer;
}

.gameover-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.gameover-stats div { background: #15152e; border-radius: 8px; padding: 8px; }
.gameover-stats b { display: block; font-size: 20px; font-family: Orbitron, system-ui, sans-serif; }
.gameover-stats .new-best { grid-column: span 2; color: var(--gold); font-weight: 700; }

.offer {
  border: 1px dashed var(--gold);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* Boutique */
.shop-panel { max-width: 720px; text-align: left; }
.shop-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.shop-header h2 { margin: 0; flex: 1; }
.wallet { font-size: 16px; }

.featured {
  display: flex;
  gap: 12px;
  align-items: center;
  background: linear-gradient(90deg, #2d1200, #3b0c30);
  border: 1px solid var(--event);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.featured .info { flex: 1; }
.featured .info small { color: #ffc999; }
.featured .btn { width: auto; margin: 0; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.tab.active { color: var(--text); border-color: var(--accent); background: #12233a; }

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.card {
  background: #13132a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card { transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.card:hover { border-color: #44448a; transform: translateY(-2px); }
.card.equipped { border-color: var(--accent); box-shadow: 0 0 18px rgba(0, 229, 255, 0.25); }
.card .preview {
  align-self: center;
  max-width: 100%;
  height: 64px;
  border-radius: 8px;
  background: #0a0a18;
}
.card h3 { margin: 0; font-size: 15px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; flex: 1; }
.card .btn { margin: 0; padding: 8px; font-size: 14px; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #222248;
  color: var(--muted);
}
.badge.event { background: #4a2000; color: #ffb27a; }
.badge.new { background: #003a40; color: #7af3ff; }
.badge.premium { background: #4a3a00; color: var(--gold); }

.demo-note { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1d1d40;
  border: 1px solid var(--accent);
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 20;
  font-size: 14px;
  max-width: calc(100% - 32px);
}

/* Comment jouer */
.howto-panel { max-width: 560px; text-align: left; }
.howto-panel h2 { text-align: center; }
.steps { display: grid; gap: 12px; margin-bottom: 8px; }
.step { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; }
.step canvas { border-radius: 8px; border: 1px solid var(--border); }
.step h3 { margin: 0 0 2px; font-family: Orbitron, system-ui, sans-serif; font-size: 14px; letter-spacing: 1px; color: #9ff3ff; }
.step p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* Conseils de première partie */
.tip {
  position: fixed;
  left: 50%;
  bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(16, 16, 32, 0.92);
  border: 1px solid var(--accent);
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.3);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  max-width: calc(100% - 32px);
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s;
}
.tip.fade { opacity: 0; }

/* Alerte boss */
.boss-warning {
  position: fixed;
  left: 50%;
  top: calc(90px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  padding: 10px 22px;
  border: 2px solid #ff1744;
  border-radius: 10px;
  background: rgba(40, 0, 10, 0.85);
  color: #ff5c7a;
  font-family: Orbitron, system-ui, sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 3px;
  text-align: center;
  text-shadow: 0 0 12px #ff1744;
  box-shadow: 0 0 30px rgba(255, 23, 68, 0.5);
  pointer-events: none;
  z-index: 5;
  animation: alarm 0.5s ease-in-out infinite alternate;
}
.boss-warning small { display: block; font-size: 13px; letter-spacing: 2px; color: #ffd1dc; margin-top: 2px; }
@keyframes alarm { from { opacity: 1; } to { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .boss-warning { animation: none; } }
.gameover-stats .wide { grid-column: span 2; }

/* ---------- Carte des missions ---------- */
.screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.map-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(8, 8, 20, 0.92);
  border-bottom: 1px solid var(--border);
  z-index: 2;
}
.map-counter { font-weight: 700; font-variant-numeric: tabular-nums; }
.map-counter.star { color: var(--gold); }
.map-spacer { flex: 1; }
.map-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.map-worlds { max-width: 560px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left, 0px)) 40px; display: grid; gap: 16px; }

.world {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(ellipse at 20% 20%, var(--w-a), transparent 60%),
    radial-gradient(ellipse at 80% 80%, var(--w-b), transparent 60%),
    var(--w-bg);
  overflow: hidden;
}
.world.event { border-color: var(--event); box-shadow: 0 0 30px rgba(255, 122, 26, 0.25); }
.world-head { padding: 16px 18px 0; text-align: center; }
.world-head h2 { margin: 2px 0 4px; color: var(--w-accent); text-shadow: 0 0 14px var(--w-accent); text-wrap: balance; }
.world-head p { margin: 0 auto 8px; color: #c9c9e8; font-size: 13px; max-width: 40ch; }
.world-num { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.world-stars { display: inline-block; font-weight: 700; color: var(--gold); font-size: 13px; font-variant-numeric: tabular-nums; }
.world-lock { display: block; margin-top: 6px; font-size: 12px; color: #ffb3c6; }
.world.endless { padding-bottom: 18px; background: linear-gradient(160deg, #14142c, #0a0a18); }
.world.endless .btn { width: calc(100% - 36px); margin: 10px auto 0; }

.path { position: relative; }
.path-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.path-glow { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 14; stroke-linecap: round; }
.path-dash { fill: none; stroke: rgba(255, 255, 255, 0.35); stroke-width: 3; stroke-dasharray: 2 10; stroke-linecap: round; }

.node {
  position: absolute;
  width: 58px;
  height: 58px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px solid var(--w-accent);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), rgba(0, 0, 0, 0.2) 60%), #1a1a38;
  color: #fff;
  font-family: Orbitron, system-ui, sans-serif;
  font-weight: 800;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 0 14px var(--w-accent), inset 0 -4px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.12s;
}
.node:hover { transform: translate(-50%, -50%) scale(1.08); }
.node:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.node.done { background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.5), transparent 60%), var(--w-accent); color: #0a0a18; }
.node.boss { width: 72px; height: 72px; font-size: 28px; border-color: #ff1744; box-shadow: 0 0 20px #ff1744, inset 0 -4px 0 rgba(0, 0, 0, 0.35); }
.node.locked { border-color: #44445e; box-shadow: none; background: #16162a; color: #6a6a8a; font-size: 16px; cursor: not-allowed; }
.node.current { animation: node-pulse 1.4s ease-in-out infinite; }
@keyframes node-pulse {
  0%, 100% { box-shadow: 0 0 10px var(--w-accent), 0 0 0 0 rgba(255, 255, 255, 0.5); }
  50% { box-shadow: 0 0 24px var(--w-accent), 0 0 0 10px rgba(255, 255, 255, 0); }
}
.node-stars { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px; font-size: 14px; white-space: nowrap; }
.node-stars i, .lvl-stars i, .result-stars span { font-style: normal; color: #3a3a58; }
.node-stars i.on, .lvl-stars i.on { color: var(--gold); text-shadow: 0 0 8px rgba(255, 204, 51, 0.7); }

/* ---------- Fiche de mission ---------- */
.level-panel { text-align: left; }
.level-panel h2 { text-align: left; }
.eyebrow { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.lvl-stars { font-size: 26px; margin: 0 0 10px; }
.lvl-info { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.lvl-info li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.lvl-info span { color: var(--muted); }
.lvl-info b { text-align: right; }
.dots { color: #ff5c7a; letter-spacing: 2px; }
.dots i { font-style: normal; color: #3a3a58; }
.lvl-ship { display: flex; align-items: center; gap: 10px; background: #12122a; border: 1px solid var(--border); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.lvl-ship > div { flex: 1; min-width: 0; }
.lvl-ship small { display: block; color: var(--muted); font-size: 12px; }
.lvl-warn { color: #ffcc80; font-size: 13px; margin: 0 0 8px; }

/* ---------- Résultat ---------- */
.result-stars { font-size: 48px; margin: 4px 0 6px; }
.result-stars span.on { color: var(--gold); text-shadow: 0 0 16px rgba(255, 204, 51, 0.8); display: inline-block; animation: star-pop 0.5s both; }
@keyframes star-pop { from { transform: scale(0) rotate(-40deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .result-stars span.on, .node.current { animation: none; } }
.result-rule, .result-hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.reward-lines { display: grid; gap: 6px; margin-bottom: 12px; text-align: left; }
.reward-lines div { display: flex; justify-content: space-between; background: #15152e; border-radius: 8px; padding: 8px 10px; font-variant-numeric: tabular-nums; }
.reward-lines .total { background: #2a2200; color: var(--gold); font-weight: 700; }

/* ---------- Hangar ---------- */
.hangar-panel { max-width: 860px; text-align: left; }
.hangar-body { display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
.ship-list { display: grid; gap: 8px; align-content: start; }
.ship-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #13132a;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.ship-item.active { border-color: var(--accent); box-shadow: 0 0 14px rgba(0, 229, 255, 0.25); }
.ship-item div { min-width: 0; }
.ship-item small { display: block; color: var(--muted); font-size: 12px; }
.ship-detail { min-width: 0; }
.ship-hero { display: block; width: 100%; max-width: 260px; aspect-ratio: 260 / 150; height: auto; margin: 0 auto; }
.ship-head h3 { margin: 0; font-family: Orbitron, system-ui, sans-serif; font-size: 20px; }
.ship-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.ship-head .perk { color: #69f0ae; }
.stat-rows { display: grid; gap: 8px; margin: 12px 0; }
.stat-row { display: grid; grid-template-columns: 110px 56px 1fr 64px auto; align-items: center; gap: 10px; border-radius: 10px; }
.stat-lvl { font-family: Orbitron, system-ui, sans-serif; font-size: 11px; color: var(--muted); white-space: nowrap; }
.stat-lvl b { font-family: Inter, system-ui, sans-serif; font-weight: 700; font-size: 18px; color: #fff; font-variant-numeric: tabular-nums; }
.stat-lvl small { font-size: 10px; }
.stat-gauge { display: flex; gap: 3px; }
.stat-gauge span { flex: 1; height: 12px; border-radius: 2px; background: #0a0a18; border: 1px solid var(--border); }
.stat-gauge span.on { background: linear-gradient(180deg, #7ff7ff, #00b8d4); border-color: #00e5ff; box-shadow: 0 0 8px rgba(0, 229, 255, 0.6); }
.stat-gauge span.new { animation: cell-pop 0.45s ease-out; }
@keyframes cell-pop { 0% { transform: scaleY(0.2); filter: brightness(2.5); } 100% { transform: none; filter: none; } }
.stat-row.leveled { animation: level-flash 0.9s ease-out; }
.stat-row.leveled .stat-lvl b { color: var(--gold); text-shadow: 0 0 10px var(--gold); }
@keyframes level-flash { 0% { background: rgba(255, 204, 51, 0.35); } 100% { background: transparent; } }
.stat-row.maxed .stat-gauge span { background: linear-gradient(180deg, #fff1a8, #c79100); border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 204, 51, 0.5); }
@media (prefers-reduced-motion: reduce) { .stat-gauge span.new, .stat-row.leveled { animation: none; } }
.stat-name small { display: block; color: var(--muted); font-size: 11px; }
.stat-val { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.stat-up { min-width: 92px; }
.stat-up.poor { opacity: 0.6; }
.ship-actions .btn { margin: 0; }
.piloted { color: #69f0ae; font-weight: 700; margin: 0; text-align: center; }
.wallet-btn {
  border: 1px solid var(--gold);
  background: #2a2200;
  color: var(--gold);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.wallet-btn span { margin-left: 4px; }
.wallet-btn.pulse { animation: wallet-pulse 0.4s 3; }
@keyframes wallet-pulse { 50% { box-shadow: 0 0 18px var(--gold); transform: scale(1.06); } }
@media (max-width: 640px) {
  .hangar-body { grid-template-columns: 1fr; }
  .ship-list { grid-auto-flow: column; grid-auto-columns: 168px; overflow-x: auto; padding-bottom: 4px; }
  .ship-item b { font-size: 13px; }
  .stat-row { grid-template-columns: 1fr auto auto; row-gap: 6px; }
  .stat-gauge { grid-column: 1 / 3; order: 4; }
  .stat-val { order: 5; }
  .stat-up { min-width: 0; }
  .map-top .btn.small { padding: 6px 10px; font-size: 13px; }
  .map-back-label { display: none; }
}

/* ---------- Boutique (packs) ---------- */
.card-actions { display: grid; gap: 6px; }
.card .amount { color: var(--gold); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.card.popular { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 204, 51, 0.25); }

/* ---------- Premium : icône de pièce, badge de niveau, reflets ---------- */
.coin {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.14em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c2 0 12%, #ffcc33 45%, #b07000 100%);
  box-shadow: inset 0 0 0 0.09em rgba(120, 70, 0, 0.55), 0 0 6px rgba(255, 204, 51, 0.45);
}
.btn.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.28) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: sheen 3.5s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .btn.primary::after { animation: none; display: none; } }
.power-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(105, 240, 174, 0.18), rgba(0, 229, 255, 0.18));
  border: 1px solid rgba(105, 240, 174, 0.55);
  color: #b9f6ca;
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: 0 0 12px rgba(105, 240, 174, 0.2);
  font-variant-numeric: tabular-nums;
}
.power-badge b { font-size: 15px; color: #fff; }
.power-badge small { color: var(--muted); font-size: 11px; }
.power-badge.big { font-size: 14px; padding: 4px 12px; }
.power-badge.big b { font-size: 20px; }
.ship-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.next-world { color: #b8f5ff !important; font-size: 13px; }
.ship-item .lvl { color: #69f0ae; font-weight: 700; }

/* ---------- Galaxie ---------- */
.galaxy-space { position: relative; max-width: 620px; margin: 0 auto; overflow: hidden; }
.galaxy-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
#galaxy { background: radial-gradient(ellipse at 50% 30%, #0c0820, #03030a 70%); }
.routes { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.route { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 2; stroke-dasharray: 3 9; stroke-linecap: round; }
.route.open { stroke: rgba(105, 240, 174, 0.55); stroke-width: 3; filter: drop-shadow(0 0 4px rgba(105, 240, 174, 0.8)); }
.planet {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s;
}
.planet canvas { display: block; animation: float 6s ease-in-out infinite; filter: drop-shadow(0 0 18px var(--p-accent)); }
.planet:nth-of-type(2n) canvas { animation-delay: -3s; }
.planet:hover { transform: translate(-50%, -50%) scale(1.05); }
.planet:focus-visible { outline: 2px solid #fff; outline-offset: 6px; border-radius: 12px; }
.planet.locked canvas { filter: grayscale(0.75) brightness(0.45); }
.planet-label {
  display: grid;
  justify-items: center;
  margin-top: -8px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(6, 6, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  max-width: 44vw;
  text-align: center;
  text-wrap: balance;
}
.planet-label em { font-style: normal; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--p-accent); font-weight: 700; }
.planet-label b { font-family: Orbitron, system-ui, sans-serif; font-size: 13px; letter-spacing: 1px; }
.planet-label span { font-size: 12px; font-variant-numeric: tabular-nums; }
.p-lock { color: #ffb3c6; }
.p-done { color: #69f0ae; }
.p-stars { color: var(--gold); }
.planet.event .planet-label { border-color: var(--event); }
.you-marker { position: absolute; width: 48px; height: 48px; transform: translate(-50%, -50%); animation: float 3s ease-in-out infinite; pointer-events: none; filter: drop-shadow(0 0 8px #00e5ff); }
@keyframes float { 50% { translate: 0 -6px; } }
@media (prefers-reduced-motion: reduce) { .planet canvas, .you-marker { animation: none; } }

.world-head { display: flex; flex-direction: column; align-items: center; }
.world-planet { width: 140px; height: 140px; margin: -6px 0 -14px; filter: drop-shadow(0 0 22px var(--w-accent)); }
.lvl-desc { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.power-gap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 12px; text-align: center; }
.power-gap div { background: #15152e; border-radius: 12px; padding: 10px; }
.power-gap small { display: block; color: var(--muted); font-size: 12px; }
.power-gap b { font-family: Orbitron, system-ui, sans-serif; font-size: 22px; }
.power-gap .gap-arrow { background: none; color: #ffb3c6; font-size: 13px; font-weight: 700; padding: 0; }

/* ---------- Défis du jour ---------- */
.badge-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: #ff1744;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(255, 23, 68, 0.6);
  vertical-align: 1px;
}
.badge-count[hidden], [hidden] { display: none !important; }
.daily-panel { max-width: 560px; text-align: left; }
.daily-title { margin: 14px 0 8px; font-family: Orbitron, system-ui, sans-serif; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #9ff3ff; }
.daily-title small { float: right; font-family: Inter, system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 12px; font-weight: 400; }
.streak { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.streak-day { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border-radius: 10px; background: #13132a; border: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.streak-day small { color: var(--muted); font-size: 10px; }
.streak-day b { font-size: 12px; white-space: nowrap; }
.streak-day.got { background: #0f2a1e; border-color: rgba(105, 240, 174, 0.5); color: #69f0ae; }
.streak-day.today { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 204, 51, 0.35); background: #2a2200; }
.streak-day.big b { color: var(--gold); }
.quests { display: grid; gap: 8px; }
.quest { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: #13132a; border: 1px solid var(--border); }
.quest.ready { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 204, 51, 0.25); }
.quest.claimed { opacity: 0.55; }
.quest-info { min-width: 0; }
.quest-info small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.quest-bar { height: 8px; margin: 6px 0 4px; border-radius: 4px; background: #0a0a18; border: 1px solid var(--border); overflow: hidden; }
.quest-bar span { display: block; height: 100%; background: linear-gradient(90deg, #00b8d4, #69f0ae); box-shadow: 0 0 8px rgba(105, 240, 174, 0.6); }
.quest .btn { margin: 0; min-width: 96px; }
.sound-row { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }
.sound-row .btn { flex: 1; }
.sound-row .btn.off { opacity: 0.45; text-decoration: line-through; }
@media (max-width: 420px) { .streak-day b { font-size: 10.5px; } .streak { gap: 4px; } }

/* =========================================================
   Passe graphique : identité « cockpit » (équerres, biseaux)
   ========================================================= */
.overlay {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(20, 16, 48, 0.35), rgba(2, 2, 8, 0.82) 75%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
}
.panel { position: relative; border-radius: 14px; }
/* Équerres lumineuses aux quatre coins des panneaux. Elles font partie du fond du panneau
   (et non d'un pseudo-élément) pour rester dans les coins quand son contenu défile. */
.panel {
  --c: rgba(0, 229, 255, 0.75);
  background:
    linear-gradient(var(--c), var(--c)) left 6px top 6px / 18px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left 6px top 6px / 2px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) right 6px top 6px / 18px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right 6px top 6px / 2px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) left 6px bottom 6px / 18px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) left 6px bottom 6px / 2px 18px no-repeat,
    linear-gradient(var(--c), var(--c)) right 6px bottom 6px / 18px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) right 6px bottom 6px / 2px 18px no-repeat,
    linear-gradient(180deg, rgba(40, 40, 80, 0.55), rgba(10, 10, 26, 0.0) 120px),
    linear-gradient(180deg, rgba(22, 22, 46, 0.94), rgba(10, 10, 24, 0.96));
  background-origin: border-box;
}
/* Bouton principal biseauté (coins coupés en haut à gauche et en bas à droite) ;
   les boutons à bordure restent arrondis, sinon la découpe effacerait leur contour. */
.btn.primary:not(.small) {
  border-radius: 4px;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
.btn.primary { text-shadow: 0 0 10px rgba(255, 255, 255, 0.5); }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Écran de résultat : halo derrière les étoiles, total qui défile */
.result-stars { position: relative; }
.result-stars::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 220px;
  height: 120px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255, 204, 51, 0.35), transparent 70%);
  pointer-events: none;
}
.reward-lines .total b { font-family: Orbitron, system-ui, sans-serif; font-size: 18px; }

/* Galaxie : routes ouvertes animées */
.route.open { animation: route-flow 1.6s linear infinite; }
@keyframes route-flow { to { stroke-dashoffset: -24; } }
.planet:not(.locked):hover canvas { filter: drop-shadow(0 0 30px var(--p-accent)) brightness(1.15); }

/* Hangar : plateforme holographique */
.ship-hero { background: radial-gradient(ellipse at 50% 85%, rgba(0, 229, 255, 0.12), transparent 60%); }
@media (prefers-reduced-motion: reduce) { .route.open { animation: none; } }

/* Bouton pause en jeu (coin haut droit, dans la zone sûre de l'écran) */
.hud-pause {
  position: fixed;
  z-index: 5;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(12, 12, 32, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
  touch-action: manipulation;
}
.hud-pause span { width: 5px; height: 16px; border-radius: 2px; background: #e8f8ff; box-shadow: 0 0 6px rgba(0, 229, 255, 0.8); }
.hud-pause:active { transform: scale(0.94); }
@media (max-width: 559px) { .hud-pause { top: calc(62px + env(safe-area-inset-top, 0px)); } }

/* Hangar : options du vaisseau */
.ship-options { margin: 4px 0 14px; }
.ship-options h4 { font-family: Orbitron, system-ui, sans-serif; font-size: 14px; letter-spacing: 1px; margin: 0 0 8px; color: #ffcc80; }
.ship-options h4 small { font-family: Inter, system-ui, sans-serif; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.option-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 145, 0, 0.35);
  background: linear-gradient(90deg, rgba(255, 145, 0, 0.08), rgba(21, 21, 46, 0.6));
}
.option-card.owned { border-color: rgba(105, 240, 174, 0.45); background: linear-gradient(90deg, rgba(105, 240, 174, 0.1), rgba(21, 21, 46, 0.6)); }
.option-card canvas { width: 40px; height: 40px; }
.option-text b { display: block; font-size: 13px; }
.option-text small { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; }
.option-card .btn { white-space: nowrap; }

/* ==========================================================================
   Navigation façon jeu mobile : barre du haut, onglets du bas, accueil
   ========================================================================== */
:root {
  --top-h: calc(56px + env(safe-area-inset-top, 0px));
  --tab-h: calc(64px + env(safe-area-inset-bottom, 0px));
}
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: var(--top-h);
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(6, 6, 18, 0.96), rgba(8, 8, 22, 0.82));
  border-bottom: 1px solid rgba(160, 170, 255, 0.14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.tb-stars { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.tb-spacer { flex: 1; }
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(160, 170, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
  color: #cfd3ff;
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active svg { transform: rotate(45deg); transition: transform 0.2s; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: var(--tab-h);
  padding: 0 max(4px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(4px, env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 120px));
  justify-content: center;
  align-items: stretch;
  background: linear-gradient(0deg, rgba(6, 6, 18, 0.97), rgba(8, 8, 22, 0.88));
  border-top: 1px solid rgba(160, 170, 255, 0.14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.tab-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 11px Inter, system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tab-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tab-btn.active { color: #fff; }
.tab-btn.active svg { stroke: var(--accent); filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.7)); }
.tab-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28%;
  right: 28%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.tab-home img {
  width: 54px;
  height: 54px;
  margin-top: -26px;
  padding: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #2a1f5c, #0b0a24 70%);
  border: 1px solid rgba(124, 77, 255, 0.6);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 16px rgba(124, 77, 255, 0.4);
  transition: transform 0.15s;
}
.tab-home.active::before { display: none; }
.tab-home.active img { transform: scale(1.06); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 24px rgba(0, 229, 255, 0.6); border-color: var(--accent); }
.tab-btn .badge-count { position: absolute; top: 6px; right: calc(50% - 22px); }

/* Écrans et pages entre les deux barres */
body.shell .screen { top: var(--top-h); bottom: var(--tab-h); }
body.shell .map-top { padding-top: 10px; }
body.shell .toast { bottom: calc(var(--tab-h) + 12px); }
.overlay.as-tab {
  top: var(--top-h);
  bottom: var(--tab-h);
  padding: 12px;
  align-items: stretch;
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.overlay.as-tab .panel { max-width: 980px; margin: 0 auto; max-height: 100%; }
.as-tab #btn-hangar-close, .as-tab #btn-shop-close, .as-tab #btn-daily-close,
.as-tab .shop-header .wallet, .as-tab #hangar-get-coins { display: none; }
#confirm { z-index: 30; }
#settings { z-index: 25; }
@media (max-width: 640px) { .overlay.as-tab { padding: 8px; } }

/* Accueil */
.lobby {
  position: fixed;
  top: var(--top-h);
  bottom: var(--tab-h);
  left: 0;
  right: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px max(16px, env(safe-area-inset-left, 0px));
  overflow-y: auto;
  text-align: center;
}
.lobby > * { width: min(100%, 440px); flex: none; }
.lobby .logo { font-size: 34px; letter-spacing: 6px; margin: 0; }
.lobby .event-banner { margin: 0; cursor: pointer; }
.lobby-hero { width: auto; height: min(26vh, 254px); aspect-ratio: 260 / 150; max-width: 100%; }
.lobby-ship, .lobby-progress {
  border-radius: 14px;
  border: 1px solid rgba(160, 170, 255, 0.16);
  background: linear-gradient(180deg, rgba(30, 30, 64, 0.7), rgba(12, 12, 30, 0.75));
  padding: 10px 14px;
  text-align: left;
}
.lobby-ship { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lobby-ship b { display: block; font-family: Orbitron, system-ui, sans-serif; font-size: 16px; letter-spacing: 0.5px; }
.lobby-ship small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.lp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.lp-row b { color: #fff; }
.lp-row span:last-child { font-weight: 700; color: #7fe9ff; white-space: nowrap; }
.lp-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); margin-top: 8px; overflow: hidden; }
.lp-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #00e5ff, #7c4dff, #ff2bd6); box-shadow: 0 0 10px rgba(0, 229, 255, 0.5); }
.play-big { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 24px; padding: 14px 16px; margin: 4px 0 0; }
.play-big small { font: 600 12px Inter, system-ui, sans-serif; letter-spacing: 0; text-transform: none; opacity: 0.9; }
.settings-panel .btn { width: 100%; }
@media (max-height: 640px) { .lobby .logo { display: none; } }

/* Boutique : offre mise en avant et packs de pièces illustrés */
.featured-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 14px 14px;
  margin-bottom: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 145, 0, 0.6);
  background: radial-gradient(ellipse at 20% 50%, rgba(255, 122, 26, 0.28), transparent 60%), linear-gradient(120deg, #2d1200, #2a0a2a 60%, #120a24);
  box-shadow: 0 0 30px rgba(255, 122, 26, 0.18);
}
.featured-hero canvas { width: 100%; height: auto; }
.fh-info h3 { font-family: Orbitron, system-ui, sans-serif; font-size: 20px; margin: 6px 0 6px; color: #ffd2a0; }
.fh-tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: #1a0d00; background: #ff9100; border-radius: 6px; padding: 3px 8px; }
.fh-info ul { list-style: none; margin: 0 0 6px; padding: 0; font-size: 13px; color: #f3e0ff; display: grid; gap: 3px; }
.fh-value { margin: 0 0 10px; font-size: 13px; color: #ffcc80; }
.fh-info .btn { width: 100%; margin: 0; font-size: 18px; }
@media (max-width: 520px) {
  .featured-hero { grid-template-columns: 1fr; text-align: center; }
  .featured-hero { padding: 6px 12px 12px; }
  .featured-hero canvas { max-width: 210px; justify-self: center; margin-bottom: -14px; }
  .fh-info h3 { font-size: 18px; margin: 4px 0; }
  .fh-info ul { grid-auto-flow: row; font-size: 12px; }
  .as-tab .shop-header h2 { font-size: 22px; }
  .fh-info ul { justify-items: center; }
}

.items:has(.pack) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card.pack { position: relative; padding: 0; overflow: hidden; gap: 0; }
.card.pack .pack-art { width: 100%; height: auto; display: block; }
.pack-info { position: relative; display: flex; flex-direction: column; align-items: center; padding: 8px 10px 4px; text-align: center; }
.pack-info small { color: var(--muted); font-size: 12px; }
.pack-amount { font-family: Orbitron, system-ui, sans-serif; font-size: 20px; color: #ffd54f; text-shadow: 0 0 12px rgba(255, 193, 7, 0.45); }
.pack-amount .coin { width: 18px; height: 18px; vertical-align: -2px; }
.pack-bonus {
  position: absolute;
  top: 8px;
  left: 8px;
  font: 800 12px Orbitron, system-ui, sans-serif;
  color: #072014;
  background: linear-gradient(90deg, #69f0ae, #00e5ff);
  border-radius: 6px;
  padding: 3px 7px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.pack-tag {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  background: #ff2bd6;
  padding: 3px 6px;
}
.pack-tag + .pack-bonus { top: 26px; }
.card.pack.best .pack-tag { background: linear-gradient(90deg, #ffb300, #ff2bd6); }
.card.pack.popular { border-color: #ffb300; box-shadow: 0 0 20px rgba(255, 179, 0, 0.25); }
.card.pack .card-actions { padding: 6px 10px 10px; }
.card.pack .card-actions .btn { width: 100%; margin: 0; }

/* ==========================================================================
   Transitions : chaque écran ou fenêtre s'anime à son apparition
   (passer de display: none à visible relance l'animation CSS)
   ========================================================================== */
:root { --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); --ease-pop: cubic-bezier(0.2, 0.9, 0.3, 1.25); }
body { --dx: 0px; --dy: 12px; }
body[data-dir="next"] { --dx: 32px; --dy: 0px; }
body[data-dir="prev"] { --dx: -32px; --dy: 0px; }
@keyframes view-in { from { opacity: 0; transform: translate(var(--dx), var(--dy)); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.92) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(48px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes tab-mark { from { transform: scaleX(0); } to { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

.screen, .overlay.as-tab > .panel { animation: view-in 0.32s var(--ease-out) both; }
.overlay:not(.as-tab) { animation: fade-in 0.2s ease-out both; }
.overlay:not(.as-tab) > .panel { animation: pop-in 0.3s var(--ease-pop) both; }
.lobby > * { animation: rise 0.45s var(--ease-out) both; }
.lobby > :nth-child(2) { animation-delay: 0.04s; }
.lobby > :nth-child(3) { animation-delay: 0.08s; }
.lobby > :nth-child(4) { animation-delay: 0.14s; }
.lobby > :nth-child(5) { animation-delay: 0.2s; }
.lobby > :nth-child(6) { animation-delay: 0.26s; }
.toast { animation: toast-in 0.25s var(--ease-out) both; }
.tab-btn.active::before { animation: tab-mark 0.25s var(--ease-out); }
.tab-btn svg, .tab-home img { transition: transform 0.15s var(--ease-out); }
.tab-btn:active svg, .tab-home:active img { transform: scale(0.86); }
.btn { transition: transform 0.12s var(--ease-out), filter 0.15s, box-shadow 0.15s; }
.btn:not(:disabled):active { transform: scale(0.97); }

/* Fiche de mission en panneau qui monte du bas sur mobile */
@media (max-width: 640px) {
  #level-modal { align-items: flex-end; }
  body.shell #level-modal { padding-bottom: calc(var(--tab-h) + 8px); }
  #level-modal > .panel { animation: sheet-in 0.32s var(--ease-out) both; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .overlay, .overlay > .panel, .lobby > *, .toast, .tab-btn.active::before { animation: none !important; }
  .btn, .tab-btn svg, .tab-home img { transition: none; }
}

/* Écran de victoire mis en scène */
.result-panel { position: relative; overflow: hidden; }
.result-panel > * { position: relative; }
.result-panel.win > :not(.result-burst) { animation: rise 0.4s var(--ease-out) both; }
.result-burst {
  position: absolute !important;
  left: 50%;
  top: 120px;
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  background: repeating-conic-gradient(rgba(255, 204, 51, 0.13) 0deg 8deg, transparent 8deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  animation: burst-spin 18s linear infinite;
  pointer-events: none;
}
.result-panel.perfect .result-burst { background: repeating-conic-gradient(rgba(255, 204, 51, 0.2) 0deg 8deg, rgba(255, 43, 214, 0.06) 8deg 22deg); }
@keyframes burst-spin { to { transform: rotate(360deg); } }
.result-kicker { margin: 0; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.result-panel.win h2 { font-size: 26px; margin: 4px 0 2px; }
.result-panel .result-stars span { font-size: 54px; }
.result-panel .result-stars span:nth-child(2) { font-size: 66px; }
.result-panel .result-stars span.on { animation: star-slam 0.45s var(--ease-pop) both; }
@keyframes star-slam { 0% { transform: scale(2.4) rotate(-30deg); opacity: 0; } 70% { transform: scale(0.9); opacity: 1; } 100% { transform: none; opacity: 1; } }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 12px; animation: none !important; }
.result-stats div { background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(160, 170, 255, 0.12); border-radius: 10px; padding: 6px 4px; animation: rise 0.4s var(--ease-out) both; }
.result-stats b { display: block; font-family: Orbitron, system-ui, sans-serif; font-size: 15px; }
.result-stats small { color: var(--muted); font-size: 11px; }
.result-panel.win .reward-lines { animation: none !important; }
.result-panel.win .reward-lines > div { animation: line-in 0.35s var(--ease-out) both; }
@keyframes line-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
.reward-lines .total { box-shadow: 0 0 0 1px rgba(255, 204, 51, 0.35), 0 0 22px rgba(255, 204, 51, 0.18); }
.result-actions { display: grid; gap: 0; }
.fly-coin {
  position: fixed;
  z-index: 40;
  width: 18px;
  height: 18px;
  pointer-events: none;
  animation: coin-fly 0.75s cubic-bezier(0.5, 0, 0.6, 1) both;
}
@keyframes coin-fly {
  0% { transform: translate(0, 0) scale(0.4); opacity: 0; }
  20% { transform: translate(calc(var(--tx) * 0.05), -40px) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.7); opacity: 0.9; }
}
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.fail-progress { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.fail-progress .lp-bar { flex: 1; margin: 0; }
.fail-progress b { font-family: Orbitron, system-ui, sans-serif; font-size: 14px; color: #7fe9ff; }
.result-close { margin: 0 0 10px; color: #ffcc80; font-weight: 700; }
@media (max-width: 420px) { .result-stats b { font-size: 13px; } .result-panel.win h2 { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) {
  .result-burst, .result-panel.win > *, .result-stats div, .result-panel.win .reward-lines > div, .result-panel .result-stars span.on { animation: none !important; }
}

/* Galaxie : bords du défilement en fondu sous les barres */
#galaxy-scroll {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
#game { position: fixed; top: 0; left: 0; }
.screen-info { font-size: 11px; opacity: 0.7; }
.lang-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
@media (max-width: 480px) { .lang-row { grid-template-columns: repeat(2, 1fr); } }
.lang-btn { margin: 0; padding: 8px 4px; font-size: 12px; }
.lang-btn.active { border-color: var(--accent); color: #fff; box-shadow: 0 0 12px rgba(0, 229, 255, 0.35); }

/* Écran de mise à jour et « Quoi de neuf ? » */
.update-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 42%, #1c1446, var(--bg) 70%);
  animation: fade-in 0.25s ease-out both;
}
.update-logo { width: 110px; height: 110px; filter: drop-shadow(0 0 24px rgba(124, 77, 255, 0.7)); animation: update-spin 2.4s ease-in-out infinite; }
@keyframes update-spin { 50% { transform: rotate(-12deg) scale(1.08); } }
.update-screen h2 { font-family: Orbitron, system-ui, sans-serif; margin: 10px 0 0; letter-spacing: 2px; }
.update-screen p { margin: 0 0 10px; color: var(--muted); }
.update-bar { width: min(260px, 70vw); }
.update-bar span { width: 0; animation: update-fill 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes update-fill { to { width: 100%; } }
#whatsnew { z-index: 55; }
.whatsnew-panel { text-align: center; }
.whatsnew-logo { width: 64px; height: 64px; filter: drop-shadow(0 0 16px rgba(124, 77, 255, 0.6)); }
.whatsnew-list { list-style: none; padding: 0; margin: 4px 0 16px; display: grid; gap: 8px; text-align: left; }
.whatsnew-list li {
  position: relative;
  padding: 10px 12px 10px 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(160, 170, 255, 0.14);
  font-size: 14px;
  animation: rise 0.4s var(--ease-out) both;
}
.whatsnew-list li:nth-child(2) { animation-delay: 0.08s; }
.whatsnew-list li:nth-child(3) { animation-delay: 0.16s; }
.whatsnew-list li::before { content: "✦"; position: absolute; left: 12px; top: 9px; color: var(--accent); text-shadow: 0 0 8px var(--accent); }
.version-line { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .update-logo, .whatsnew-list li { animation: none; } .update-bar span { animation: none; width: 100%; } }
.studio { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.studio a { color: var(--accent); text-decoration: none; font-weight: 600; }
.studio a:hover { text-decoration: underline; }
.btn.buy-eur.soon { display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.15; filter: saturate(0.55) brightness(0.85); }
.btn.buy-eur.soon small { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.85; }

/* Mentions légales et confidentialité */
#legal { z-index: 26; }
.legal-panel { max-width: 560px; text-align: left; }
.legal-panel h2 { text-align: center; }
.legal-body { font-size: 13px; line-height: 1.5; color: #cfd0ea; margin-bottom: 12px; }
.legal-body h3 { font-family: Orbitron, system-ui, sans-serif; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin: 14px 0 4px; }
.legal-body p { margin: 0 0 6px; }
.legal-body a { color: var(--accent); }
.btn.danger { color: #ff8a8a; border-color: rgba(255, 82, 82, 0.4); }

/* Réglages : rubriques espacées */
.settings-panel .set-title { font: 700 11px Orbitron, system-ui, sans-serif; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); text-align: left; margin: 16px 0 8px; }
.settings-panel h2 + .set-title { margin-top: 4px; }
.settings-panel .sound-row { margin: 0; gap: 8px; }
.settings-panel .sound-row .btn, .settings-panel .lang-btn { margin: 0; padding: 10px 6px; }
.settings-panel .lang-row { gap: 8px; margin: 0; }
.settings-panel > .btn + .btn { margin-top: 10px; }
.settings-panel .hint { margin: 14px 0 0; }
