:root {
  --bg: #120a08;
  --panel: rgba(28, 16, 13, 0.92);
  --panel-solid: #1c100d;
  --line: rgba(255, 170, 130, 0.14);
  --line-strong: rgba(255, 170, 130, 0.3);
  --text: #f3e6de;
  --muted: #a88f84;
  --accent: #ff7a3d;
  --accent-2: #ffb347;
  --ok: #6fdc8c;
  --warn: #ffc857;
  --danger: #ff5a5f;
  --info: #7cc6ff;
  --ore: #d9a27a;
  --energy: #ffd84d;
  --water: #7fd3ff;
  --credits: #b99cff;
  --hud-h: 56px;
  --side-w: 340px;
  --radius: 10px;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-display: 'Chakra Petch', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font-ui); overflow: hidden; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
kbd { border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; font-size: 11px; }

.brand { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.08em; font-size: 16px; white-space: nowrap; }
.brand span { color: var(--accent); margin: 0 2px; }
.brand.big { font-size: 30px; text-align: center; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.45); backdrop-filter: blur(8px); }

.btn { background: rgba(255,255,255,.05); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 14px; cursor: pointer; transition: background .15s, border-color .15s; }
.btn:hover:not(:disabled) { background: rgba(255,122,61,.14); border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0b05; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.danger { border-color: rgba(255,90,95,.5); color: #ffb3b5; }
.btn.danger:hover:not(:disabled) { background: rgba(255,90,95,.18); border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .btn { flex: 1; }

input { background: rgba(0,0,0,.3); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

/* Connexion */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 50;
  background: radial-gradient(ellipse at 30% 20%, #5a2415 0%, #1a0b07 55%, #0b0504 100%); }
.auth-card { width: min(400px, 100%); padding: 28px; display: grid; gap: 14px; }
.auth-card p { margin: 0; text-align: center; }

/* HUD */
#hud { position: fixed; top: 0; left: 0; right: 0; height: var(--hud-h); display: flex; align-items: center; gap: 18px; padding: 0 14px;
  background: linear-gradient(180deg, rgba(30,14,10,.97), rgba(22,11,8,.94)); border-bottom: 1px solid var(--line); z-index: 20; }
.resources { display: flex; gap: 6px; flex: 1; min-width: 0; }
.res { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; padding: 3px 10px; border-radius: 8px; background: rgba(0,0,0,.25); border: 1px solid var(--line); min-width: 112px; }
.res .ic { grid-row: span 2; font-size: 17px; }
.res .val { font-family: var(--font-display); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.res .rate { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.res .rate.neg { color: var(--danger); }
.res.full { border-color: var(--warn); box-shadow: inset 0 0 0 1px rgba(255, 200, 87, .35); }
.res.full .rate { color: var(--warn); }
.army-full { color: var(--warn); }
.res.ore .val { color: var(--ore); } .res.energy .val { color: var(--energy); }
.res.water .val { color: var(--water); } .res.credits .val { color: var(--credits); }
.hud-units { display: flex; gap: 12px; white-space: nowrap; }
.hud-units b { font-family: var(--font-display); }
.hud-right { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.me { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.me::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--me-color, var(--accent)); }

.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .03em; border: 1px solid; }
.badge.active { color: var(--ok); border-color: rgba(111,220,140,.4); background: rgba(111,220,140,.08); }
.badge.pending { color: var(--warn); border-color: rgba(255,200,87,.4); background: rgba(255,200,87,.08); }
.badge.protected { color: #bfe9ff; border-color: rgba(127,211,255,.55); background: rgba(127,211,255,.14); }
.protect-note { color: #bfe9ff !important; }
.badge.hibernating { color: var(--info); border-color: rgba(124,198,255,.4); background: rgba(124,198,255,.1); }

/* Carte */
#game { position: fixed; top: var(--hud-h); left: 0; right: 0; bottom: 0; }
#map { position: absolute; inset: 0; width: calc(100% - var(--side-w)); height: 100%; cursor: grab; touch-action: none; display: block; }
#map.dragging { cursor: grabbing; }
/* Lumière d'ambiance : soleil chaud en haut à gauche, vignette sur les bords (composée par le navigateur, sans coût de dessin) */
#map-ambient { position: absolute; inset: 0; width: calc(100% - var(--side-w)); height: 100%; pointer-events: none;
  background: radial-gradient(ellipse 75% 75% at 50% 50%, rgba(12,5,3,0) 60%, rgba(12,5,3,.42) 100%),
              radial-gradient(circle at -10% -20%, rgba(255,196,140,.13), rgba(255,196,140,0) 70%); }
#minimap { position: absolute; left: 12px; bottom: 12px; width: 192px; height: 192px; border: 1px solid var(--line-strong); border-radius: 8px; background: #000; cursor: pointer; image-rendering: pixelated; }
#map-help { position: absolute; left: 216px; bottom: 14px; font-size: 12px; pointer-events: none; text-shadow: 0 1px 2px #000; }

/* Pop-up de case */
.pop { position: absolute; width: 300px; padding: 14px; z-index: 10; max-height: calc(100% - 24px); overflow-y: auto; }
.pop h3 { margin: 0 0 2px; font-family: var(--font-display); font-size: 17px; }
.pop .sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.pop .close { position: absolute; top: 8px; right: 8px; }
.stars { color: var(--accent-2); letter-spacing: 1px; }
.opt { display: grid; grid-template-columns: 52px 1fr; gap: 2px 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; cursor: pointer; text-align: left; width: 100%; background: rgba(255,255,255,.02); }
.opt:hover:not(:disabled) { border-color: var(--accent); background: rgba(255,122,61,.1); }
.opt:disabled { opacity: .45; cursor: not-allowed; }
.opt .ic { grid-row: span 3; align-self: center; display: grid; place-items: center; }
.opt .t { font-weight: 600; }
.opt .d { font-size: 12px; color: var(--muted); }
.cost { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.cost .short { color: var(--danger); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; margin: 8px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; }
.range { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.range input[type=range] { flex: 1; padding: 0; accent-color: var(--accent); }

/* Panneau latéral */
#side { position: absolute; top: 0; right: 0; bottom: 0; width: var(--side-w); background: var(--panel-solid); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; padding: 12px 6px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; position: relative; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.tab { flex: 1; overflow-y: auto; padding: 14px; }
.tab h4 { font-family: var(--font-display); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.tab h4:first-child { margin-top: 0; }
.empty { color: var(--muted); font-size: 13px; font-style: italic; }

.job { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; font-size: 13px; cursor: pointer; }
.job:hover { border-color: var(--line-strong); }
.job .top { display: flex; justify-content: space-between; gap: 8px; }
.job .eta { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.bar { height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.job.incoming { border-color: rgba(255,90,95,.5); background: rgba(255,90,95,.08); }
.job.incoming .bar i { background: var(--danger); }
.job.attack .bar i { background: var(--danger); } .job.explore .bar i { background: var(--info); }
.job.train .bar i { background: var(--ok); } .job.return .bar i { background: var(--warn); }

.unit-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.unit-row .ic { font-size: 20px; }
.unit-row .qty { display: flex; gap: 4px; }
.unit-row .recycle { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; vertical-align: middle; }
.unit-row .recycle:hover { color: var(--text, #fff); border-color: rgba(255, 255, 255, 0.35); }
.unit-row .recycle .i { width: 11px; height: 11px; }
.unit-row .qty input { width: 52px; padding: 4px 6px; }

.stasis-box { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }

.chat { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; font-size: 13px; padding-right: 4px; }
.msg .who { font-weight: 600; color: var(--accent-2); margin-right: 6px; }
.msg .when { color: var(--muted); font-size: 11px; margin-left: 4px; }
.msg.log { color: var(--muted); font-style: italic; font-size: 12px; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }
.chat-form input { flex: 1; }
.msg.mine .who { color: var(--accent); }
/* Diplomatie : traités de paix */
.treaty { display: flex; align-items: center; gap: 8px; padding: 7px 9px; margin-bottom: 6px; border-radius: 8px; font-size: 13px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08); }
.treaty > span { flex: 1; }
.treaty .i { width: 16px; height: 16px; flex: none; }
.treaty.active { border-color: rgba(120, 220, 160, 0.45); background: rgba(120, 220, 160, 0.08); color: #bff0d2; }
.treaty-form { display: flex; gap: 6px; margin: 8px 0 4px; flex-wrap: wrap; }
.treaty-form input { flex: 1; min-width: 120px; }
.member { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.member .sw { width: 10px; height: 10px; border-radius: 3px; }
.member .meta { margin-left: auto; color: var(--muted); font-size: 12px; }
form.stack { display: grid; gap: 8px; }

.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.log li { font-size: 13px; padding: 8px 10px; border-left: 3px solid var(--line-strong); background: rgba(255,255,255,.02); border-radius: 0 6px 6px 0; }
.log li time { display: block; font-size: 11px; color: var(--muted); }
.log li.success { border-color: var(--ok); } .log li.warning { border-color: var(--warn); }
.log li.danger { border-color: var(--danger); } .log li.info { border-color: var(--info); }

/* Notifications : dans le coin bas-droit de la carte (à côté du panneau), jamais au milieu du jeu */
#toasts { position: fixed; right: calc(var(--side-w) + 12px); bottom: 12px; display: grid; gap: 6px; z-index: 60; pointer-events: none; width: min(300px, calc(100% - 32px)); align-content: end; }
.toast { padding: 7px 11px; border-radius: 8px; background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 6px 18px rgba(0,0,0,.45); animation: toast-in .2s ease-out; font-size: 12px; opacity: .95; }
.toast.error, .toast.danger { border-color: var(--danger); } .toast.success { border-color: var(--ok); }
.toast.warning { border-color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* Écrans étroits : HUD compact, panneau en bas */
/* Écrans moyens : la barre passe sur deux lignes (ressources en haut, unités et statut en dessous) */
/* Barre du haut sur deux lignes : unités et réglages en haut, les 6 ressources en dessous */
:root { --hud-h: 96px; }
#hud { flex-wrap: wrap; height: auto; min-height: var(--hud-h); padding: 6px 12px; row-gap: 6px; }
.resources { order: 3; flex-basis: 100%; }
.res { flex: 1 1 0; min-width: 0; }
.hud-right { margin-left: auto; }
@media (max-width: 1100px) {
  #map-help, .brand:not(.big) { display: none; }
  .hud-units { gap: 8px; }
  .res { padding: 3px 7px; }
  .res .rate { display: none; }
}
@media (max-width: 760px) {
  :root { --side-w: 0px; --hud-h: 96px; }
  #hud { flex-wrap: wrap; height: auto; min-height: var(--hud-h); padding: 6px 10px; gap: 6px; }
  /* Trois rangées qui défilent horizontalement si besoin : statut, unités et objectifs, ressources */
  .hud-right { order: 1; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; justify-content: flex-start !important; }
  .hud-units { order: 2; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
  .hud-right::-webkit-scrollbar, .hud-units::-webkit-scrollbar { display: none; }
  .era-pill .era-name { display: none; }
  #btn-stasis { font-size: 12px; }
  .resources { flex-basis: 100%; order: 3; }
  .res { flex: 1; grid-template-columns: auto 1fr; }
  .hud-right { flex: 1; justify-content: flex-end; }
  .me { display: none; }
  #side { top: auto; left: 0; width: 100%; height: 42%; border-left: 0; border-top: 1px solid var(--line); }
  #map, #map-ambient { width: 100%; height: 58%; }
  #minimap { width: 110px; height: 110px; bottom: calc(42% + 10px); }
  .pop { width: calc(100% - 24px); left: 12px !important; top: 12px !important; max-height: calc(58% - 24px); }
}

/* Icônes vectorielles et vignettes 3D */
.i { width: 1.1em; height: 1.1em; vertical-align: -0.2em; flex-shrink: 0; }
.res .ic .i { width: 20px; height: 20px; display: block; }
.btn .i { margin-right: 2px; }
#btn-logout .i { margin: 0; }
.m3d { width: 52px; height: 52px; object-fit: contain; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.m3d.sm { width: 26px; height: 26px; display: inline-block; vertical-align: middle; }
.m3d.xs { width: 18px; height: 18px; display: inline-block; vertical-align: -4px; }
.unit-row .m3d { width: 42px; height: 42px; }
.unit-ic { width: 26px; height: 26px; object-fit: contain; vertical-align: middle; margin-right: 2px; }
.hud-units span { display: inline-flex; align-items: center; gap: 3px; }
.job .lbl { display: inline-flex; align-items: center; gap: 6px; }
.tag-ia { font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,.1); color: var(--muted); vertical-align: 1px; }
.landing { position: absolute; top: 14px; left: 50%; transform: translateX(calc(-50% - var(--side-w) / 2)); width: min(460px, calc(100% - var(--side-w) - 24px)); padding: 16px 18px; z-index: 9; }
.landing h3 { margin: 0 0 6px; font-family: var(--font-display); color: var(--accent-2); }
.landing p { margin: 0 0 10px; font-size: 13px; }
.landing .row { justify-content: flex-end; }
.landing .row .btn { flex: 0 0 auto; }
@media (max-width: 760px) {
  .landing { transform: translateX(-50%); width: calc(100% - 24px); }
  .landing p { display: none; }
  body.has-selection .landing { display: none; }
}

/* Ressources rares */
.res.rare { min-width: 86px; background: rgba(125,255,138,.04); }
.res.titanium .val { color: #dfe8f0; }
.res[hidden] { display: none; }
.rare-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 999px; margin: 0 0 6px;
  border: 1px solid rgba(223,232,240,.35); background: rgba(223,232,240,.08); }
.rare-chip.crystal { border-color: rgba(199,125,255,.45); background: rgba(199,125,255,.1); }
.rare-chip.relic { border-color: rgba(255,200,87,.55); background: rgba(255,200,87,.1); }
.stock { font-family: var(--font-display); font-size: 12px; padding: 0 6px; border-radius: 4px; background: rgba(255,255,255,.08); }

/* Frappe de missiles */
.strike { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.seg { display: flex; gap: 4px; margin-bottom: 6px; }
.seg-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: 12px; padding: 6px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: rgba(255,255,255,.03); cursor: pointer; }
.seg-btn.on { border-color: var(--accent); background: rgba(255,122,61,.16); }
.seg-btn:disabled { opacity: .4; cursor: not-allowed; }
.tech { padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.tech .lbl { display: flex; align-items: center; gap: 6px; }

/* Menu contextuel */
.ctx { position: fixed; z-index: 70; min-width: 250px; max-width: min(340px, calc(100vw - 16px)); padding: 6px; }
.ctx-head { display: flex; flex-direction: column; padding: 6px 8px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; }
.ctx-head .muted { font-size: 12px; }
.ctx-item { display: grid; grid-template-columns: 20px 1fr; column-gap: 8px; align-items: center; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 6px; padding: 7px 8px; cursor: pointer; font-size: 13px; }
.ctx-item small { grid-column: 2; color: var(--muted); font-size: 11px; }
.ctx-item:hover:not(:disabled), .ctx-item:focus-visible { background: rgba(255,122,61,.14); outline: none; }
.ctx-item:disabled { opacity: .45; cursor: not-allowed; }
.ctx-item.danger { color: #ffb3b5; }
.ctx-item .i { width: 16px; height: 16px; }

/* Pipelines entre alliés */
.pipe-card { margin: 6px 0; padding: 9px 10px; border: 1px solid rgba(111,220,140,.3); border-radius: 8px; background: rgba(111,220,140,.04); }
.pipe-card.proposed { border-style: dashed; }
.pipe-card.building { border-color: rgba(255,200,87,.4); background: rgba(255,200,87,.04); }
.pipe-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.pipe-card .lbl { display: inline-flex; align-items: center; gap: 6px; }
.pipe-status { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.pipe-card.active .pipe-status { color: var(--ok); }
.pipe-flow { font-size: 13px; margin: 6px 0 4px; display: flex; align-items: center; gap: 5px; }
.pipe-form { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.pipe-form select, .pipe-form input { background: rgba(0,0,0,.3); border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 6px; color: inherit; font: inherit; }
.pipe-form input { width: 64px; }
.pipe-form select { flex: 1; min-width: 0; }
.pipe-del { margin-top: 6px; font-size: 11px; opacity: .75; }
.pipe-bonus { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--credits); margin: 0 0 6px; }
.job.pipe .bar i { background: var(--ok); }

/* Défense d'une case ennemie */
.defense-box { margin: 8px 0; padding: 9px 10px; border: 1px solid rgba(255,90,95,.35); border-radius: 8px; background: rgba(255,90,95,.06); font-size: 13px; }
.def-total { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.def-total b { margin-left: auto; font-family: var(--font-display); font-size: 17px; color: #ffb3b5; }
.def-parts { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 2px; font-size: 12px; }
.def-parts li { display: flex; justify-content: space-between; color: var(--muted); }
.def-parts b { color: var(--text, #f4e9e2); font-variant-numeric: tabular-nums; }
.def-note { font-size: 11px; margin-top: 3px; }
.odds { font-size: 12px; padding: 5px 8px; border-radius: 6px; margin-bottom: 4px; }
.odds.ok { background: rgba(111,220,140,.12); color: var(--ok); }
.odds.warn { background: rgba(255,200,87,.12); color: var(--warn); }
.odds.ko { background: rgba(255,90,95,.12); color: var(--danger); }

/* Assaut multi-troupes */
.army-row { display: grid; grid-template-columns: 26px 88px 1fr auto auto; gap: 6px; margin: 4px 0; font-size: 12px; }
.army-row .army-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.army-row b { font-family: var(--font-display); min-width: 18px; text-align: right; }
.unit-stats { font-size: 11px; margin: 1px 0 2px; }
.unit-row.locked .ic { filter: grayscale(1) brightness(.7); }

/* Jour et nuit */
.daynight { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  border: 1px solid rgba(255,216,77,.35); background: rgba(255,216,77,.08); color: #ffe89a; }
.daynight small { color: var(--muted); font-variant-numeric: tabular-nums; }
.daynight.night { border-color: rgba(124,198,255,.35); background: rgba(40,60,140,.25); color: #bfe0ff; }
.res.food .val { color: #8fe07a; } .res.crystal .val { color: #d9a6ff; }
.res.crystal { background: rgba(199,125,255,.06); }

/* Bâtiments avancés et marché orbital */
.opt .tier { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; margin-left: 4px;
  background: rgba(255,179,71,.15); color: var(--accent-2); vertical-align: 1px; }
.opt.locked .ic { filter: grayscale(1) brightness(.7); }
.market { padding: 10px; border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 6px; }
.market-row { display: flex; gap: 6px; align-items: end; }
.market-row label { flex: 1; }
.market select { background: rgba(0,0,0,.3); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 8px; color: inherit; font: inherit; }

/* Réglages son / notifications */
#btn-sound, #btn-music, #btn-notif { padding: 5px 7px; }
#btn-music.off { opacity: .4; }
.rare-chip.meteorite { border-color: rgba(255,154,61,.55); background: rgba(255,154,61,.12); }

/* Guide */
.guide-steps { margin: 0 0 6px; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
.guide-item { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.guide-item p { margin: 2px 0 4px; font-size: 12px; color: var(--muted); }
.guide-res { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); }
.tabs button { padding: 9px 4px; font-size: 12.5px; }
.hq-note { color: #ffb3b5; font-weight: 600; }

/* Écran de fin de saison */
.endgame { z-index: 250; background: radial-gradient(ellipse at 50% 30%, rgba(90,30,15,.95), rgba(5,2,2,.97)); }
.endgame-card { width: min(520px, 100%); padding: 26px; text-align: center; display: grid; gap: 10px; }
.endgame-card h2 { font-family: var(--font-display); font-size: 28px; margin: 4px 0 0; color: var(--accent-2); }
.endgame-card p { margin: 0; }
.endgame-card .row { justify-content: center; }
.endgame-card .row .btn { flex: 0 0 auto; }
.ranking { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.ranking th, .ranking td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ranking th { color: var(--muted); font-weight: 600; }
.ranking tr.win td { color: var(--accent-2); font-weight: 700; }

/* Objectif, ères, missions, classement */
.score-pill, .era-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
  border: 1px solid rgba(255,200,87,.45); background: rgba(255,200,87,.1); color: #ffe3a3; }
.score-pill b { font-family: var(--font-display); font-size: 14px; }
.score-pill small { color: var(--muted); }
.era-pill { cursor: default; border-color: var(--line-strong); background: rgba(255,255,255,.04); color: var(--text, #f4e9e2); }
.mission { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; border: 1px solid rgba(255,200,87,.45); background: linear-gradient(135deg, rgba(255,200,87,.12), rgba(255,122,61,.06)); display: grid; gap: 3px; }
.mission.done { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mission-top { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-2); }
.mission-top .bar { flex: 1; height: 4px; }
.score-box { padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,200,87,.4); background: rgba(255,200,87,.06); display: grid; gap: 6px; }
.score-big { font-size: 13px; } .score-big b { font-family: var(--font-display); font-size: 24px; color: #ffd07a; }
.score-box .bar i { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.score-how { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; font-size: 12px; }
.score-how li { display: flex; align-items: center; gap: 8px; }
.score-how .ic-wrap { width: 26px; display: grid; place-items: center; }
.donate { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.donate input { width: 70px; background: rgba(0,0,0,.3); border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 6px; color: inherit; font: inherit; }
.site-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.site-row:hover { background: rgba(255,255,255,.04); }
.site-row span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.ranking tr.me td { color: #ffd07a; font-weight: 700; }
.tier.pts { background: rgba(255,200,87,.2); color: #ffd07a; }
.pts-note { font-size: 12px; color: #ffe3a3; }
.guide-goal { font-size: 13px; margin: 0 0 6px; }

/* Rythme : chantiers libres, délai avant de pouvoir payer */
.builds-pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; color: var(--muted); }
.builds-pill.idle { color: #ffd07a; border-color: rgba(255,200,87,.5); background: rgba(255,200,87,.1); animation: idle-pulse 1.6s ease-in-out infinite; }
@keyframes idle-pulse { 50% { box-shadow: 0 0 10px rgba(255,200,87,.45); } }
.cost .afford { color: var(--muted); font-style: italic; }
.cost .afford.ready { color: var(--ok); font-style: normal; }
.cost .afford.never { color: var(--danger); }

/* Missions guidées */
.mission-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.mission-foot .btn { white-space: nowrap; flex-shrink: 0; }
.opt.suggest, .unit-row.suggest { border-color: #ffd07a !important; box-shadow: 0 0 0 2px rgba(255,208,122,.35), 0 0 16px rgba(255,200,87,.35); animation: idle-pulse 1.4s ease-in-out infinite; }
.unit-row.suggest { border-radius: 8px; }

/* Rapports de combat */
.toast.clickable { pointer-events: auto; cursor: pointer; }
.toast small { display: block; margin-top: 4px; color: var(--accent-2); font-weight: 600; }
.log li.report details summary { cursor: pointer; list-style: none; }
.log li.report details summary::-webkit-details-marker { display: none; }
.log li.report details summary::after { content: ' ▸ rapport'; color: var(--accent-2); font-size: 11px; font-weight: 600; }
.log li.report details[open] summary::after { content: ' ▾'; }
.rep { margin-top: 8px; display: grid; gap: 8px; font-size: 12px; }
.rep-head { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .04em; }
.rep-head.win { color: var(--ok); } .rep-head.loss { color: var(--danger); }
.rep-bars { display: grid; grid-template-columns: 58px 1fr auto; gap: 4px 8px; align-items: center; }
.rep-bars i { height: 8px; border-radius: 4px; display: block; }
.rep-bars i.att { background: linear-gradient(90deg, #ff7a3d, #ffb347); } .rep-bars i.def { background: linear-gradient(90deg, #3f9ee0, #7fd3ff); }
.rep-table { width: 100%; border-collapse: collapse; }
.rep-table th, .rep-table td { padding: 3px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.rep-table th:first-child, .rep-table td:first-child { text-align: left; }
.rep-table th { color: var(--muted); font-weight: 600; }
.rep-table td.loss { color: var(--danger); }
.rep-grid { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.rep-grid span { color: var(--muted); } .rep-grid b { text-align: right; font-weight: 600; }
.rep .btn { justify-self: start; }

/* Résumé d'absence */
.away { z-index: 240; background: rgba(8,4,3,.72); }
.away-card { width: min(460px, 100%); padding: 22px; display: grid; gap: 10px; }
.away-card h2 { margin: 0; font-family: var(--font-display); color: var(--accent-2); }
.away-card p { margin: 0; }
.away-res { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--font-display); font-size: 15px; }
.away-res .neg, .away-list .neg { color: var(--danger); }
.away-list, .away-hl { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 13px; }
.away-list li { display: flex; align-items: center; gap: 6px; }
.away-hl li { font-size: 12px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--warn); }
.away-card h4 { margin: 4px 0 0; }
.away-card .row { justify-content: flex-end; }
.away-card .row .btn { flex: 0 0 auto; }

/* Téléphones : ressources sur une grille de 3 colonnes (les nombres ne débordent plus sous l'icône voisine) */
@media (max-width: 520px) {
  .resources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .res, .res.rare { min-width: 0; padding: 2px 7px; column-gap: 5px; }
  .res .val { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .res .ic .i { width: 18px; height: 18px; }
  .res .ic { grid-row: auto; }
}

/* Connexion : acceptation des CGU, mention d'information, liens légaux */
#auth { align-content: center; gap: 14px; overflow-y: auto; }
h1.brand { margin: 0; }
.auth-card label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.4; }
.auth-card label.check input { margin-top: 2px; flex: none; width: auto; accent-color: var(--accent); }
.auth-card a, .legal-links a, #tab-guide a { color: var(--accent-2); }
.auth-card .auth-note { font-size: 11px; text-align: left; line-height: 1.45; }
.req { color: var(--accent-2); }
.legal-links { font-size: 12px; color: var(--muted); text-align: center; }
.danger-zone summary { cursor: pointer; color: #ffb3b5; font-size: 13px; margin: 6px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Focus clavier visible sur tous les éléments interactifs */
.btn:focus-visible, a:focus-visible, summary:focus-visible, input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
/* Tutoriel des nouveaux colons */
#tuto { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; width: min(440px, calc(100vw - 32px));
  background: var(--panel-solid); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.55); animation: tuto-in .25s ease-out; }
#tuto .tuto-top { font: 600 12px var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
#tuto p { margin: 6px 0 10px; font-size: 14px; line-height: 1.45; }
#tuto .tuto-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tuto-focus { outline: 2px solid var(--accent) !important; outline-offset: 3px; border-radius: 8px; animation: tuto-pulse 1.4s ease-in-out infinite; }
@keyframes tuto-pulse { 50% { box-shadow: 0 0 0 6px rgba(255,122,61,.25); } }
@keyframes tuto-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.catchup-note { margin: 8px 0; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,216,77,.35); background: rgba(255,216,77,.07); font-size: 13px; }
/* Téléphone : le panneau est en bas, les notifications passent en haut à droite de la carte, en petit */
@media (max-width: 760px) {
  #toasts { right: 8px; bottom: auto; top: calc(var(--hud-h) + 8px); width: min(240px, 65%); }
}
/* Onglet Stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 4px; }
.stat { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.stat-v { font: 600 18px var(--font-display); font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12px; color: var(--text); }
.stat-s { font-size: 11px; color: var(--muted); }
.stat-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stat-table th { text-align: right; font-weight: 600; color: var(--muted); font-size: 11px; padding: 4px; }
.stat-table td { padding: 4px; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
.stat-table td:first-child { text-align: left; display: flex; align-items: center; gap: 6px; }
.stat-table tr.total td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.stat-table .pos, .stat-chips .pos { color: var(--ok); } .stat-table .neg, .stat-chips .neg { color: var(--danger); }
.stat-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.stat-chips { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 11.5px; margin: 6px 0; }
.stat-warn { color: var(--warn); font-size: 12px; margin: 6px 0; }
.m3d.xs { width: 26px; height: 26px; }
/* Casino Olympus */
.casino-btn { border-color: #ff4fd8; color: #ffd1f5; box-shadow: 0 0 10px rgba(255,79,216,.35); }
.casino-enter { border-color: #ff4fd8 !important; }
/* Casino orbital : espace étoilé, Mars qui tourne, navette au décollage */
.overlay.casino { background: #05030a; z-index: 70; overflow: hidden; }
.casino .space { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.casino .stars { position: absolute; inset: -50%; background-image:
  radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 120px 80px, #fff, transparent),
  radial-gradient(1.5px 1.5px at 200px 160px, #ffe8c8, transparent), radial-gradient(1px 1px at 60px 200px, #cfe6ff, transparent),
  radial-gradient(1px 1px at 260px 40px, #fff, transparent), radial-gradient(2px 2px at 300px 230px, #fff, transparent);
  background-size: 320px 260px; animation: stars-drift 120s linear infinite; opacity: .9; }
.casino .stars.far { background-size: 180px 150px; opacity: .45; animation-duration: 220s; }
@keyframes stars-drift { to { transform: translate(-320px, 120px); } }
.casino .mars { position: absolute; width: min(90vh, 95vw); aspect-ratio: 1; border-radius: 50%; right: -18%; bottom: -38%;
  background: var(--mars) 0 0 / 200% 100% repeat-x; animation: mars-spin 90s linear infinite;
  box-shadow: 0 0 60px 10px rgba(255,120,60,.25), inset -60px -40px 120px rgba(0,0,0,.85), inset 18px 12px 40px rgba(255,200,160,.25); }
@keyframes mars-spin { to { background-position: -200% 0; } }
.casino .mars::after { content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,225,195,.22), transparent 30%, rgba(0,0,0,.25) 58%, rgba(0,0,0,.85) 80%); }
.casino .launch { position: absolute; inset: 0; display: grid; place-items: center; }
.casino .launch p { position: absolute; bottom: 14%; width: 100%; text-align: center; color: #f7e9ff; font: 600 15px var(--font-display); letter-spacing: .08em; animation: fade-blink 1.2s ease-in-out infinite; }
.casino .ground { position: absolute; left: -10%; right: -10%; bottom: -30%; height: 55%; border-radius: 50% 50% 0 0;
  background: var(--mars) 0 50% / 100% 260%; box-shadow: inset 0 30px 60px rgba(255,170,120,.35); animation: ground-fall 2.6s ease-in forwards; }
@keyframes ground-fall { to { transform: translateY(85%) scale(1.15); } }
.casino .ship { position: absolute; left: 50%; bottom: 20%; width: 54px; margin-left: -27px; animation: ship-launch 2.6s cubic-bezier(.5,0,.75,0) forwards; filter: drop-shadow(0 0 10px rgba(255,180,90,.6)); }
.casino .ship .flame { transform-origin: 50% 0; animation: flame 90ms ease-in-out infinite alternate; }
@keyframes ship-launch { 0% { transform: translateY(0); } 15% { transform: translateY(-4px); } 100% { transform: translateY(-110vh) scale(.5); } }
@keyframes flame { to { transform: scaleY(1.35); } }
@keyframes fade-blink { 50% { opacity: .45; } }
.casino.launching .stars { animation-duration: 6s; }
.casino-card { position: relative; animation: card-in .5s ease-out; }
@keyframes card-in { from { opacity: 0; transform: scale(.94) translateY(12px); } }
/* Célébration de fin de saison */
.endgame { overflow: hidden; display: block; padding: 0; background: radial-gradient(ellipse at 50% 35%, #1b0c22 0%, #05030a 70%); }
.endgame canvas.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.endgame .victory { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; text-align: center; z-index: 2;
  animation: victory-out 1s ease-in 7.2s forwards; }
.endgame .planet { width: min(46vh, 70vw); aspect-ratio: 1; border-radius: 50%; position: relative; margin-bottom: -6vh;
  background: var(--mars) 0 0 / 200% 100% repeat-x; animation: mars-spin 40s linear infinite, planet-in 1.6s cubic-bezier(.2,.8,.2,1) both;
  box-shadow: inset -40px -30px 90px rgba(0,0,0,.85), 0 0 50px rgba(255,120,60,.3); }
/* Terraformation : océans et forêts qui s'étendent, l'atmosphère vire au bleu */
.endgame .terra { position: absolute; inset: 0; border-radius: 50%; mix-blend-mode: color; opacity: 0; filter: blur(3px);
  background: radial-gradient(circle at 30% 45%, #1f6fd0 0 18%, transparent 19%), radial-gradient(circle at 68% 60%, #1f6fd0 0 14%, transparent 15%),
    radial-gradient(circle at 50% 25%, #2f9e44 0 22%, transparent 23%), radial-gradient(circle at 40% 75%, #2f9e44 0 20%, transparent 21%),
    radial-gradient(circle at 75% 35%, #3aa655 0 13%, transparent 14%), radial-gradient(circle at 22% 22%, #2f9e44 0 9%, transparent 10%);
  animation: terraform 2.4s ease-out 1.2s forwards; }
.endgame .atmo { position: absolute; inset: -4%; border-radius: 50%; box-shadow: 0 0 0 0 rgba(120,200,255,0); animation: atmo 2s ease-out 1.6s forwards; }
@keyframes planet-in { from { transform: scale(.3) translateY(30vh); opacity: 0; } }
@keyframes terraform { to { opacity: .85; } }
@keyframes atmo { to { box-shadow: 0 0 60px 18px rgba(120,200,255,.55), inset 0 0 30px rgba(160,220,255,.4); } }
.endgame .trophy { width: min(120px, 22vw); z-index: 2; filter: drop-shadow(0 0 22px rgba(255,194,61,.7)); animation: trophy-drop 1s cubic-bezier(.3,1.6,.5,1) 2.6s both, trophy-glow 2s ease-in-out 3.6s infinite alternate; }
@keyframes trophy-drop { from { transform: translateY(-70vh) rotate(-20deg); opacity: 0; } }
@keyframes trophy-glow { to { filter: drop-shadow(0 0 36px rgba(255,194,61,1)); } }
.endgame .victory-title { font: 800 clamp(34px, 8vw, 72px) var(--font-display); letter-spacing: .14em; color: #ffc23d;
  background: linear-gradient(100deg, #ffe9a3 20%, #fff 40%, #ffc23d 60%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; animation: title-in .7s ease-out 3.2s both, shine 2.5s linear 4s infinite; }
.endgame .victory-names { font: 700 clamp(20px, 4.5vw, 34px) var(--font-display); animation: title-in .7s ease-out 3.7s both; text-shadow: 0 0 18px currentColor; }
.endgame .victory-names i { color: #f3e6de; font-style: normal; opacity: .7; text-shadow: none; }
.endgame .victory-sub { color: #cfe8ff; font-size: 15px; animation: title-in .7s ease-out 4.1s both; }
@keyframes title-in { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes shine { to { background-position: -250% 0; } }
@keyframes victory-out { to { opacity: .18; transform: scale(.96); } }
.endgame .endgame-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 4; overflow: auto; animation: card-in .7s ease-out 7.6s both; }
.endgame .endgame-card { background: rgba(28,16,13,.88); backdrop-filter: blur(4px); border: 1px solid rgba(255,194,61,.45); box-shadow: 0 0 40px rgba(255,194,61,.2); }
/* Déjà vue (ou « réduire les animations ») : tout est en place tout de suite */
.endgame.calm .victory { animation: none; opacity: .18; }
.endgame.calm .endgame-wrap, .endgame.calm .trophy, .endgame.calm .victory-title, .endgame.calm .victory-names, .endgame.calm .victory-sub, .endgame.calm .planet { animation-delay: 0s; animation-duration: .01s; }
.endgame.calm .terra { animation: none; opacity: .85; } .endgame.calm .atmo { animation: none; box-shadow: 0 0 60px 18px rgba(120,200,255,.55); }
/* Casino orbital — grande salle : scène de jeu à gauche, mise à droite */
.casino-card { width: min(1120px, 96vw); max-height: 94vh; overflow: auto; border-radius: 22px; padding: 20px 24px;
  background: radial-gradient(130% 90% at 50% -10%, rgba(92,24,96,.95) 0%, rgba(34,10,40,.95) 55%, rgba(14,6,14,.97) 100%);
  border: 2px solid transparent; background-clip: padding-box; color: #f7e9ff; backdrop-filter: blur(4px);
  box-shadow: 0 0 0 1px rgba(255,194,61,.55), 0 0 60px rgba(255,79,216,.28), 0 30px 80px rgba(0,0,0,.7); }
.casino-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.casino-sign { position: relative; padding: 10px 26px; border-radius: 14px; border: 2px solid #ffc23d; background: rgba(0,0,0,.35);
  box-shadow: 0 0 22px rgba(255,194,61,.35), inset 0 0 18px rgba(255,79,216,.25); }
.casino-sign .bulbs { position: absolute; inset: 4px; border-radius: 10px; pointer-events: none;
  background: radial-gradient(circle, #fff6c8 0 2px, transparent 3px) 0 0 / 16px 16px; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; padding: 3px; animation: bulbs 1.2s steps(2) infinite; opacity: .9; }
@keyframes bulbs { 50% { background-position: 8px 0; } }
.casino-title { font: 800 clamp(26px, 4vw, 40px) var(--font-display); letter-spacing: .16em; color: #ffc23d; text-shadow: 0 0 14px rgba(255,194,61,.7); }
.casino-title span { color: #ff6fe0; text-shadow: 0 0 16px rgba(255,79,216,.9); }
.casino-sub { font-size: 13px; color: #d9b8e6; letter-spacing: .04em; }
.casino-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); color: #fff; cursor: pointer; display: grid; place-items: center; }
.casino-x:hover { border-color: #ff6fe0; }
.casino-tabs { display: flex; gap: 10px; margin: 14px 0 12px; }
.casino-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-radius: 14px; cursor: pointer;
  font: 700 17px var(--font-display); letter-spacing: .04em; color: #e6d0f0; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.14); transition: .15s; }
.casino-tabs button span { font-size: 24px; }
.casino-tabs button:hover { background: rgba(255,255,255,.09); }
.casino-tabs button.active { color: #fff; background: linear-gradient(180deg, rgba(255,79,216,.35), rgba(120,20,110,.35)); border-color: #ff6fe0; box-shadow: 0 0 20px rgba(255,79,216,.35); }
.casino-main { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
.casino-stage { min-height: 400px; border-radius: 18px; padding: 22px; display: grid; place-items: center;
  background: radial-gradient(120% 100% at 50% 0%, #1b5e3a 0%, #0f3a24 60%, #0a2418 100%); border: 3px solid #6b4a1a;
  box-shadow: inset 0 0 50px rgba(0,0,0,.65), inset 0 0 0 6px rgba(255,194,61,.12); }
.casino-side { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: rgba(0,0,0,.32); border: 1px solid rgba(255,255,255,.1); }
.side-title { font: 700 12px var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: #ffc23d; }
.casino-res { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.casino-res button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.05); color: #f0e0f8; border: 1px solid rgba(255,255,255,.14); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.casino-res button.active { border-color: #ffc23d; background: rgba(255,194,61,.16); box-shadow: 0 0 12px rgba(255,194,61,.3); }
.casino-res svg { width: 22px; height: 22px; }
.bet-box { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; }
.bet-box > button { border-radius: 10px; cursor: pointer; font: 700 18px var(--font-display); color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); }
.bet-input { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px; background: #0b0610; border: 2px solid #ffc23d; }
.bet-input svg { width: 22px; height: 22px; flex: none; }
.bet-input input { width: 100%; background: none; border: 0; color: #fff; font: 700 24px var(--font-display); padding: 8px 0; outline: none; font-variant-numeric: tabular-nums; }
.casino-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.chip { aspect-ratio: 1; border-radius: 50%; cursor: pointer; display: grid; place-content: center; text-align: center; line-height: 1.05; color: #fff;
  border: 4px dashed rgba(255,255,255,.7); box-shadow: 0 0 0 3px rgba(0,0,0,.35), 0 4px 10px rgba(0,0,0,.5); transition: transform .12s; }
.chip:hover { transform: translateY(-3px) rotate(-8deg); }
.chip b { font: 700 11px var(--font-display); } .chip small { font-size: 9px; opacity: .85; }
.chip.c0 { background: #2d6fd0; } .chip.c1 { background: #2f9e44; } .chip.c2 { background: #c0322f; } .chip.c3 { background: #1b1b22; }
.chip.allin { background: radial-gradient(#ffe48a, #c98a00); color: #3a1f00; border-color: rgba(255,255,255,.9); }
.casino-play { padding: 16px; border-radius: 14px; cursor: pointer; border: 0; font: 800 20px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: #3a1f00;
  background: linear-gradient(180deg, #ffe48a, #ffc23d 45%, #d18d00); box-shadow: 0 0 24px rgba(255,194,61,.55), inset 0 -4px 0 rgba(0,0,0,.25); transition: transform .1s, filter .1s; }
.casino-play:hover { filter: brightness(1.08); transform: translateY(-1px); }
.casino-play:active { transform: translateY(2px); }
.casino-play[disabled] { filter: grayscale(.6) brightness(.8); cursor: wait; }
.casino-result { text-align: center; font: 600 17px var(--font-ui); min-height: 46px; margin: 0; display: grid; place-items: center; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.3); }
.casino-result .win { color: #6fdc8c; font-size: 19px; text-shadow: 0 0 12px rgba(111,220,140,.6); } .casino-result .lose { color: #ff8a8d; }
.casino-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 12.5px; max-height: 170px; overflow: auto; }
.casino-history li { padding: 4px 8px; border-radius: 6px; background: rgba(255,255,255,.04); }
.casino-history li.win { color: #8ff0ab; } .casino-history li.lose { color: #ffaaad; }
.casino-legal { font-size: 11.5px; color: #a98bb8; text-align: center; margin: 12px 0 0; }
/* Machine à sous */
.slots { display: grid; gap: 18px; justify-items: center; }
.slot-machine { position: relative; padding: 18px; border-radius: 22px; background: linear-gradient(180deg, #e8e8ee, #9aa3ad 50%, #6b7380);
  box-shadow: 0 0 0 4px #ffc23d, 0 0 40px rgba(255,194,61,.4), 0 18px 40px rgba(0,0,0,.6); }
.reels { display: flex; gap: 14px; padding: 16px; border-radius: 14px; background: #0b0610; box-shadow: inset 0 0 26px rgba(0,0,0,.9); }
.reel { width: clamp(90px, 11vw, 150px); height: clamp(110px, 13vw, 180px); display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(#bfb6ac, #fff 30%, #fff 70%, #bfb6ac); box-shadow: inset 0 0 14px rgba(0,0,0,.35); }
.reel svg { width: 62%; height: 62%; }
.reel.spin { filter: blur(2px); }
.payline { position: absolute; left: 22px; right: 22px; top: 50%; height: 3px; background: rgba(255,90,95,.75); box-shadow: 0 0 10px #ff5a5f; pointer-events: none; }
.paytable { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 14px; color: #e9f5ea; }
.paytable svg { width: 18px; height: 18px; vertical-align: -3px; }
/* Roulette */
.roulette { display: grid; gap: 16px; justify-items: center; }
.wheel-wrap { position: relative; width: clamp(260px, 30vw, 380px); height: clamp(260px, 30vw, 380px); }
.wheel { width: 100%; height: 100%; border-radius: 50%; border: 10px solid #b87a14; position: relative;
  box-shadow: 0 0 0 4px #ffc23d, 0 0 40px rgba(255,194,61,.45), inset 0 0 30px rgba(0,0,0,.6); }
.wheel span { position: absolute; left: 50%; top: 0; height: 50%; width: 22px; margin-left: -11px; transform-origin: 50% 100%; text-align: center; font: 700 12px var(--font-ui); color: #fff; padding-top: 5px; }
.wheel i { position: absolute; inset: 33%; border-radius: 50%; background: radial-gradient(#ffe48a, #b87a14 70%); box-shadow: 0 0 16px rgba(0,0,0,.7), inset 0 0 10px rgba(255,255,255,.4); }
.wheel-pointer { position: absolute; top: -14px; left: 50%; margin-left: -13px; width: 0; height: 0; border: 13px solid transparent; border-top: 24px solid #fff; z-index: 2; filter: drop-shadow(0 3px 3px rgba(0,0,0,.7)); }
.roulette-bets { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 7px; }
.roulette-bets button { padding: 9px 14px; border-radius: 10px; cursor: pointer; font: 600 14px var(--font-ui); background: rgba(0,0,0,.35); color: #f0f6f1; border: 1px solid rgba(255,255,255,.22); }
.roulette-bets button.active { border-color: #ffc23d; background: rgba(255,194,61,.22); box-shadow: 0 0 12px rgba(255,194,61,.35); }
.roulette-bets button.red { color: #ff8a8d; } .roulette-bets button.black { color: #d6d9e0; }
.roulette-bets label { font-size: 14px; } .roulette-bets label.dim { opacity: .5; } .roulette-bets input { width: 64px; }
.ball { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 50%; font-weight: 800; color: #fff; margin-right: 6px; }
.ball.red { background: #c0322f; } .ball.black { background: #15151b; border: 1px solid #666; } .ball.green { background: #1f8a4c; }
/* Dés */
.dice { display: grid; gap: 20px; justify-items: center; }
.dice-table { padding: 30px 46px; border-radius: 22px; background: radial-gradient(#2a7a4c, #134a2c); box-shadow: inset 0 0 30px rgba(0,0,0,.6), 0 0 0 4px #6b4a1a; }
.dice-row { display: flex; gap: 30px; }
.die { width: clamp(90px, 10vw, 130px); height: clamp(90px, 10vw, 130px); border-radius: 22px; background: linear-gradient(145deg, #fff, #d9d2ca);
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 16%; gap: 6%; box-shadow: 0 10px 22px rgba(0,0,0,.55), inset 0 -4px 0 rgba(0,0,0,.12); }
.die i { border-radius: 50%; } .die i.on { background: #c0322f; box-shadow: inset 0 -3px 0 rgba(0,0,0,.3); }
@media (max-width: 860px) {
  .casino-main { grid-template-columns: 1fr; }
  .casino-stage { min-height: 0; padding: 14px; }
  .casino-card { padding: 14px; }
  .casino-tabs button { font-size: 14px; padding: 10px 6px; gap: 6px; } .casino-tabs button span { font-size: 20px; }
}
.casino-limit { margin: 0; font-size: 12px; color: #e9d6f3; padding: 7px 9px; border-radius: 8px; background: rgba(168,85,247,.14); border: 1px solid rgba(199,125,255,.35); }
.casino-limit svg { width: 14px; height: 14px; vertical-align: -2px; }
/* Récit de la saison : écran de chapitre */
.overlay.story { z-index: 240; overflow: hidden; display: block; padding: 0; background: linear-gradient(#0b0612 0%, #2a0f12 55%, #4a1a12 100%); animation: fade-in .6s ease-out; }
.story .story-sky { position: absolute; inset: 0; background-image: radial-gradient(1.4px 1.4px at 30px 40px, #fff, transparent), radial-gradient(1px 1px at 140px 90px, #fff, transparent), radial-gradient(1px 1px at 220px 30px, #ffe8c8, transparent);
  background-size: 260px 160px; opacity: .6; -webkit-mask: linear-gradient(#000 40%, transparent 70%); mask: linear-gradient(#000 40%, transparent 70%); }
.story .story-volcano { position: absolute; left: 50%; bottom: 22%; width: min(120vh, 160vw); height: 56vh; transform: translateX(-50%);
  background: linear-gradient(100deg, #8a3a22 0%, #6b2c1a 45%, #3a170e 55%, #2a100a 100%); clip-path: polygon(0 100%, 34% 30%, 44% 8%, 56% 8%, 66% 30%, 100% 100%); animation: rise 1.6s cubic-bezier(.2,.8,.2,1) both; }
.story .story-volcano i { position: absolute; left: 44%; right: 44%; top: 7%; height: 4%; border-radius: 50%; background: radial-gradient(#ffb35a, #ff4d1a 60%, transparent 70%); filter: blur(2px); }
.story .story-volcano.awake i { background: radial-gradient(#fff, #ff5ae0 50%, transparent 70%); box-shadow: 0 0 60px 30px rgba(255,90,224,.6); animation: pulse-heart 1.4s ease-in-out infinite alternate; }
.story .story-volcano b { position: absolute; left: 47%; width: 6%; top: -40%; height: 50%; border-radius: 50% 50% 0 0; background: radial-gradient(ellipse at 50% 100%, rgba(200,190,180,.35), transparent 70%); filter: blur(8px); animation: smoke 4s ease-in-out infinite; }
@keyframes rise { from { transform: translate(-50%, 30%); } }
@keyframes smoke { 50% { transform: translateY(-12%) scaleX(1.4); opacity: .6; } }
@keyframes pulse-heart { to { box-shadow: 0 0 90px 50px rgba(255,90,224,.8); } }
.story .story-ground { position: absolute; left: -10%; right: -10%; bottom: -8%; height: 34%; border-radius: 50% 50% 0 0; background: var(--mars) 0 50% / 100% 300%; box-shadow: inset 0 40px 80px rgba(0,0,0,.6); }
.story .story-card { position: absolute; left: 50%; bottom: 5vh; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); padding: 24px 26px; border-radius: 16px; text-align: center;
  background: rgba(18,8,10,.82); backdrop-filter: blur(4px); border: 1px solid rgba(255,140,90,.45); box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: story-card .8s ease-out .9s both; }
@keyframes story-card { from { opacity: 0; transform: translate(-50%, 20%); } }
.story-eyebrow { font: 700 12px var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.story-card h2 { font: 800 clamp(26px, 5vw, 38px) var(--font-display); margin: 8px 0 10px; color: #ffe3d2; }
.story-card p { font-size: 15px; line-height: 1.55; margin: 0 0 18px; color: #f3e6de; }
@keyframes fade-in { from { opacity: 0; } }
.log li.story { border-left-color: #ff5ae0; }
.heart-chip { border-color: rgba(255,90,224,.6) !important; }
.stat-res { display: grid; gap: 5px; }
.stat-res-row { display: grid; grid-template-columns: 22px 78px 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; }
.stat-res-row .ic svg { width: 18px; height: 18px; }
.stat-res-row .bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.stat-res-row .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--warn)); border-radius: 4px; }
.stat-res-row.full .bar i { background: var(--danger); }
.stat-res-row.full .nb { color: var(--warn); }
.stat-res-row .nb { font-variant-numeric: tabular-nums; white-space: nowrap; }
.power-box { margin-top: 6px; border-color: rgba(255,194,61,.45); background: rgba(255,194,61,.08); }
.power-box .stat-v { color: #ffc23d; font-size: 22px; }


/* Bouton d'annulation d'un chantier */
.job .top .job-cancel { margin-left: 2px; width: 20px; height: 20px; padding: 0; display: inline-grid; place-items: center; border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.15); background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.job .top .job-cancel:hover { color: #ff8a80; border-color: rgba(255, 138, 128, 0.6); }
.job .top .job-cancel .i { width: 12px; height: 12px; }
