/* Layout : plein écran, parking de nuit vu du dessus ; HUD aux coins, écrans en surimpression centrée. */
:root {
  --night: #0f1210;
  --hazard: #f2a516;
  --blood: #b42a22;
  --bone: #ebe6d6;
  --muted: #9a9d88;
  --ice: #8fd0ff;
  --display: 'Russo One', 'Arial Black', system-ui, sans-serif;
  --body: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--night); color: var(--bone); font-family: var(--body);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--bone); outline-offset: 4px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.hud-block { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); display: grid; }
.hud-l { left: calc(14px + env(safe-area-inset-left, 0px)); }
.hud-r { right: calc(14px + env(safe-area-inset-right, 0px)); text-align: right; justify-items: end; }
.label { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.big { font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.small { font-size: 15px; font-weight: 600; color: var(--hazard); font-variant-numeric: tabular-nums; }
.combo { font-family: var(--display); font-size: 20px; color: var(--hazard); text-shadow: 0 2px 0 #000; }
.combo.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(1.5); } to { transform: scale(1); } }
#pauseBtn {
  pointer-events: auto; margin-top: 8px; width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center; background: rgba(15,18,16,.6); border: 1px solid rgba(235,230,214,.3); cursor: pointer;
}
#pauseBtn span { display: flex; gap: 5px; }
#pauseBtn span i { width: 4px; height: 14px; background: var(--bone); }
#boss {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top, 0px));
  width: min(42vw, 260px); display: grid; gap: 4px; text-align: center;
}
#boss .label { color: var(--blood); }
#boss .bar { height: 8px; background: rgba(0,0,0,.6); border: 1px solid rgba(180,42,34,.7); }
#bossFill { display: block; height: 100%; width: 100%; background: var(--blood); transition: width .1s; }

#bottom {
  position: absolute; left: calc(14px + env(safe-area-inset-left, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 6px; justify-items: start;
}
#weapon {
  pointer-events: auto; cursor: pointer; touch-action: none; text-align: left;
  display: grid; gap: 4px; padding: 6px 16px 7px 12px;
  border: 1px solid rgba(242,165,22,.45); background: rgba(15,18,16,.5); color: var(--bone);
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
#weapon.has-alt { border-color: var(--hazard); }
#wAlt { font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; }
#wName { font-family: var(--display); font-size: 16px; letter-spacing: .03em; white-space: nowrap; transform-origin: left center; }
#wName.flash { animation: pop .3s ease-out; color: var(--hazard); }
#wPips { display: flex; gap: 2px; }
#wPips i { width: 5px; height: 8px; background: rgba(235,230,214,.16); transform: skewX(-14deg); }
#wPips i.on { background: var(--hazard); }
#fx { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px;
  background: rgba(15,18,16,.8); border: 1px solid currentColor; font-variant-numeric: tabular-nums;
}
.chip.freeze { color: var(--ice); }
.chip.rage { color: #ff6a4a; }

#dashBtn {
  --cd: 0;
  pointer-events: auto; position: absolute; cursor: pointer; padding: 0;
  right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--hazard); color: var(--hazard);
  background: conic-gradient(rgba(0,0,0,.4) calc(var(--cd) * 360deg), rgba(242,165,22,.07) 0);
  touch-action: none;
}
#dashBtn svg { width: 34px; height: 34px; fill: currentColor; filter: drop-shadow(0 1px 2px rgba(0,0,0,.85)); }
#dashBtn.cooling { border-color: rgba(242,165,22,.35); color: rgba(242,165,22,.45); }
#dashBtn.ready { animation: ready .4s ease-out; }
@keyframes ready { 50% { transform: scale(1.12); box-shadow: 0 0 18px rgba(242,165,22,.7); } }

#tip {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  width: max-content; max-width: calc(100% - 40px); text-align: center;
  font-size: 18px; font-weight: 600; padding: 8px 14px; background: rgba(15,18,16,.85); border-left: 3px solid var(--hazard);
  animation: tip 1.6s ease-in-out infinite;
}
@keyframes tip { 50% { opacity: .65; } }

/* ---------- Bannière ---------- */
#banner { position: fixed; z-index: 1; left: 0; right: 0; top: 28%; text-align: center; pointer-events: none; padding-inline: 16px; opacity: 0; }
#banner.show { animation: banner 2.3s ease-out forwards; }
#bTitle { font-family: var(--display); font-size: clamp(32px, 10vw, 60px); line-height: 1; color: var(--bone); text-shadow: 0 3px 0 #000; }
#bTitle.danger { color: var(--blood); }
#bSub { margin-top: 6px; font-size: 18px; font-weight: 600; color: var(--hazard); letter-spacing: .04em; text-shadow: 0 2px 0 #000; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.15); } 12% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Écrans ---------- */
.screen {
  position: fixed; z-index: 2; inset: 0; display: grid; place-items: center; text-align: center; overflow-y: auto;
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  background: radial-gradient(ellipse at center, rgba(15,18,16,.5), rgba(15,18,16,.93));
}
.screen:not([hidden]) .panel { animation: rise .3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.panel { display: grid; gap: 16px; justify-items: center; width: 100%; max-width: 30rem; }
.kicker { font-size: 14px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: var(--hazard); }
h1 {
  margin: 0; font-family: var(--display); font-weight: 400; line-height: .9;
  font-size: clamp(50px, 16vw, 92px); text-wrap: balance; color: var(--bone);
  text-shadow: 0 4px 0 #000, 0 0 40px rgba(180,42,34,.35);
}
h1 em { font-style: normal; color: var(--blood); display: block; }
h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 9vw, 44px); line-height: 1; text-wrap: balance; text-shadow: 0 3px 0 #000; }
.rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 17px; font-weight: 500; line-height: 1.3; }
.rules b { color: var(--hazard); font-weight: 700; }
.tape { width: 100%; height: 12px; opacity: .85; background: repeating-linear-gradient(-45deg, var(--hazard) 0 12px, #111 12px 24px); }
.cta {
  font-family: var(--display); font-size: 24px; letter-spacing: .06em; color: #111;
  background: var(--hazard); border: 0; padding: 14px 44px; cursor: pointer;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  transition: transform .12s, filter .12s;
}
.cta:hover { filter: brightness(1.1); }
.cta:active { transform: scale(.96); }
.ghost {
  background: transparent; color: var(--bone); border: 1px solid rgba(235,230,214,.4);
  font-family: var(--body); font-size: 18px; font-weight: 600; padding: 10px 24px; cursor: pointer;
}
.ghost:active { transform: scale(.96); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid rgba(242,165,22,.5); }
.seg button {
  font-family: var(--body); font-size: 16px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 10px 8px; border: 0; background: transparent; color: var(--bone); cursor: pointer;
}
.seg button + button { border-left: 1px solid rgba(242,165,22,.5); }
.seg button[aria-checked="true"] { background: var(--hazard); color: #111; }
.diff { width: 100%; max-width: 22rem; }
.hint { font-size: 15px; color: var(--muted); }
.version { font-size: 12px; color: rgba(154,157,136,.6); letter-spacing: .1em; }
@media (hover: none) { .keys { display: none; } }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: center; }

.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; max-width: 24rem; text-align: left; font-size: 19px; font-weight: 600; }
.setting .seg { min-width: 12rem; }

.cards { display: grid; gap: 12px; width: 100%; }
@media (min-width: 760px) { .panel:has(.cards) { max-width: 52rem; } .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  display: grid; gap: 6px; text-align: left; padding: 16px 18px; cursor: pointer;
  background: rgba(30,34,28,.92); border: 1px solid rgba(242,165,22,.35); color: var(--bone);
  transition: transform .12s, border-color .12s;
}
.card:hover, .card:focus-visible { border-color: var(--hazard); }
.card:active { transform: scale(.97); }
.card:disabled { opacity: .6; }
.card-name { font-family: var(--display); font-size: 22px; color: var(--hazard); }
.card-desc { font-size: 17px; line-height: 1.3; }
.card-lvl { display: flex; gap: 3px; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.card-lvl i { width: 14px; height: 5px; background: rgba(235,230,214,.18); }
.card-lvl i.on { background: var(--hazard); }
.card-lvl i.new { background: var(--bone); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; width: 100%; max-width: 20rem; }
.stats div { display: grid; }
.stats .big { font-size: 32px; }
.record { color: var(--hazard); }
@media (prefers-reduced-motion: reduce) {
  #banner.show { animation-timing-function: steps(1); }
  .screen:not([hidden]) .panel, #tip, .combo.pop, #dashBtn.ready { animation: none; }
}

/* ---------- Pièces ---------- */
.coins { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 20px; color: #ffd04a; font-variant-numeric: tabular-nums; }
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe58a, #ffd04a 45%, #c98a12 75%); box-shadow: 0 0 0 2px #7a5208 inset; flex: none; }
.hud-coins { margin-top: 6px; font-size: 18px; }
.big-coins { font-size: 34px; }
.big-coins .coin { width: 24px; height: 24px; }
.topline { width: 100%; display: flex; justify-content: flex-end; }

/* ---------- Notifications en jeu ---------- */
#toast {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(64px + env(safe-area-inset-top, 0px));
  width: max-content; max-width: calc(100% - 140px); text-align: center; padding: 8px 14px;
  background: rgba(15,18,16,.9); border: 1px solid var(--hazard); animation: rise .3s ease-out;
}
#toastTitle { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--hazard); }
#toastSub { font-size: 16px; font-weight: 600; }
.attention { animation: attention 1s ease-in-out infinite !important; }
@keyframes attention { 50% { box-shadow: 0 0 0 4px rgba(242,165,22,.7), 0 0 24px rgba(242,165,22,.8); } }

/* ---------- Menu ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 24rem; }
.tile {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px; cursor: pointer;
  background: rgba(30,34,28,.85); border: 1px solid rgba(235,230,214,.18); color: var(--bone);
}
.tile:active { transform: scale(.97); }
.tile-label { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tile-value { font-size: 17px; font-weight: 700; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-daily { border-color: rgba(242,165,22,.55); }
.tile-daily .tile-value { color: var(--hazard); }
.tile.new::after { content: ''; justify-self: end; margin-top: -1.9em; width: 8px; height: 8px; border-radius: 50%; background: var(--blood); }

/* ---------- Écrans de liste ---------- */
.list-screen { place-items: start center; }
.list-screen .panel { margin-block: auto; }
.screen-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; }
.screen-head h2 { font-size: clamp(20px, 6vw, 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-head .coins { font-size: 18px; }
.back { padding: 8px 14px; font-size: 16px; }
.list { display: grid; gap: 8px; width: 100%; }
.item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left;
  padding: 12px; background: rgba(30,34,28,.92); border: 1px solid rgba(235,230,214,.14);
}
.item.selected { border-color: var(--hazard); }
.item.locked { opacity: .6; }
.item.done { border-color: rgba(127,194,74,.5); }
.item-body { display: grid; gap: 3px; min-width: 0; }
.item-name { font-family: var(--display); font-size: 18px; }
.item-desc { font-size: 15px; line-height: 1.25; color: #cfcab9; }
.item-meta { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.item canvas { width: 56px; height: 56px; background: rgba(0,0,0,.35); border-radius: 50%; }
.item .swatch { width: 56px; height: 56px; border-radius: 6px; border: 1px solid rgba(235,230,214,.2); }
.item-btn {
  font-family: var(--body); font-size: 15px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 9px 12px; border: 0; cursor: pointer; background: var(--hazard); color: #111; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.item-btn .coin { width: 12px; height: 12px; }
.item-btn:disabled { background: rgba(235,230,214,.12); color: var(--muted); cursor: default; }
.item-btn.ghosted { background: transparent; border: 1px solid rgba(242,165,22,.5); color: var(--hazard); }
.pips { display: flex; gap: 3px; }
.pips i { width: 14px; height: 5px; background: rgba(235,230,214,.18); }
.pips i.on { background: var(--hazard); }
.progress { height: 6px; background: rgba(0,0,0,.5); border: 1px solid rgba(235,230,214,.15); }
.progress i { display: block; height: 100%; background: var(--hazard); }
.item.done .progress i { background: #7fc24a; }
.check { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #7fc24a; color: #111; font-weight: 700; }
.reward { font-family: var(--display); font-size: 15px; color: #ffd04a; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.reward .coin { width: 12px; height: 12px; }

/* ---------- Défi du jour ---------- */
.daily-card { display: grid; gap: 12px; width: 100%; padding: 16px; text-align: left; background: rgba(30,34,28,.92); border: 1px solid rgba(242,165,22,.45); }
.daily-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.daily-val { font-family: var(--display); font-size: 20px; }
.daily-mod { display: grid; gap: 4px; padding: 10px 12px; background: rgba(242,165,22,.1); border-left: 3px solid var(--hazard); }
.daily-rules, .daily-reward { margin: 0; font-size: 16px; line-height: 1.35; }
.daily-reward { color: #ffd04a; font-weight: 600; }
.daily-history { display: grid; gap: 8px; width: 100%; text-align: left; }
.hist-row { display: flex; justify-content: space-between; padding: 6px 10px; background: rgba(30,34,28,.7); font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- Fin de partie ---------- */
.earned { display: grid; gap: 4px; justify-items: center; }
.over-chal { display: grid; gap: 6px; justify-items: center; width: 100%; max-width: 24rem; }
.over-chal div div { font-size: 16px; font-weight: 600; color: #7fc24a; }

/* ---------- Réglages ---------- */
.test-box { display: grid; gap: 8px; justify-items: center; margin-top: 8px; padding-top: 14px; border-top: 1px dashed rgba(235,230,214,.25); width: 100%; max-width: 24rem; }
.test-box .ghost { font-size: 15px; padding: 8px 14px; }

/* ---------- Style moderne : coins arrondis ---------- */
h1 { font-size: clamp(44px, 14vw, 84px); letter-spacing: -.01em; }
.kicker { letter-spacing: .2em; }
.label, .tile-label { letter-spacing: .1em; }
.cta { clip-path: none; border-radius: 999px; padding: 15px 52px; font-size: 22px; letter-spacing: .04em; box-shadow: 0 6px 20px rgba(242,165,22,.25); }
.ghost { border-radius: 999px; }
.seg { border-radius: 999px; overflow: hidden; }
.tile { border-radius: var(--radius); padding: 12px 14px; }
.tile.new::after { margin-right: -2px; }
.card, .item, .daily-card { border-radius: var(--radius); }
.item-btn { border-radius: 999px; padding: 9px 14px; }
.item canvas { border-radius: 50%; }
.item .swatch { border-radius: 12px; }
.daily-mod { border-radius: 10px; border-left-width: 0; }
.hist-row { border-radius: 10px; }
.progress, .progress i, .pips i, .card-lvl i, #boss .bar, #bossFill { border-radius: 999px; }
#weapon { clip-path: none; border-radius: 12px; }
#wPips i { transform: none; border-radius: 2px; }
#pauseBtn { border-radius: 12px; }
#pauseBtn span i { border-radius: 2px; }
.chip { border-radius: 999px; }
#tip { border-radius: 12px; border-left: 0; border: 1px solid rgba(242,165,22,.6); }
#toast { border-radius: 12px; }
.tape { border-radius: 999px; height: 8px; }
.seg button { font-size: 14px; letter-spacing: .03em; padding: 11px 4px; }

/* ---------- v0.5 : campagne, apparence, statistiques, récompense ---------- */
.play-row { width: 100%; max-width: 24rem; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.play-row .cta { padding: 14px 10px; font-size: 20px; display: grid; justify-items: center; gap: 2px; }
.cta-alt { background: var(--bone); box-shadow: 0 6px 20px rgba(235,230,214,.15); }
.cta-sub { font-family: var(--body); font-size: 13px; font-weight: 700; letter-spacing: .04em; color: #5a4a10; }
.chip.shield { color: #7fe0c0; }

/* Étoiles */
.star { display: inline-block; width: 16px; height: 16px; background: rgba(235,230,214,.2); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.star.on { background: #ffd04a; }
.stars-total { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-size: 18px; color: #ffd04a; }
.stars { display: inline-flex; gap: 3px; }
.over-stars { display: grid; gap: 8px; width: 100%; max-width: 22rem; }
.over-star { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; text-align: left; font-size: 16px; padding: 8px 12px; border-radius: 12px; background: rgba(30,34,28,.85); }
.over-star .star { width: 22px; height: 22px; }
.over-star.got { color: #ffe58a; }

/* Campagne */
.chapter-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; width: 100%; }
.chapter-tabs button { border-radius: 12px; border: 1px solid rgba(235,230,214,.2); background: rgba(30,34,28,.85); color: var(--bone); padding: 8px 2px; font-family: var(--display); font-size: 16px; cursor: pointer; display: grid; gap: 2px; justify-items: center; }
.chapter-tabs button small { font-family: var(--body); font-size: 11px; font-weight: 700; color: #ffd04a; }
.chapter-tabs button[aria-selected="true"] { border-color: var(--hazard); background: rgba(242,165,22,.18); }
.chapter-tabs button:disabled { opacity: .4; }
.level-num { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-size: 18px; background: rgba(242,165,22,.15); color: var(--hazard); }
.item.locked .level-num { background: rgba(235,230,214,.08); color: var(--muted); }

/* Apparence */
.section-label { justify-self: start; }
.skin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.skin { display: grid; gap: 6px; justify-items: center; padding: 10px 6px; border-radius: var(--radius); background: rgba(30,34,28,.92); border: 1px solid rgba(235,230,214,.14); }
.skin.selected { border-color: var(--hazard); }
.skin canvas { width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,.35); }
.skin-name { font-size: 14px; font-weight: 700; }
.skin .item-btn { font-size: 12px; padding: 6px 10px; }

/* Statistiques */
.stats-list { display: grid; gap: 6px; width: 100%; text-align: left; }
.stat-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 14px; border-radius: 12px; background: rgba(30,34,28,.85); font-size: 16px; }
.stat-row strong { font-family: var(--display); font-size: 17px; font-weight: 400; text-align: right; }
.stats-list .label { margin-top: 10px; }

/* Récompense de connexion */
.login-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; width: 100%; max-width: 24rem; }
.login-day { display: grid; gap: 3px; justify-items: center; padding: 8px 2px; border-radius: 10px; background: rgba(30,34,28,.85); border: 1px solid rgba(235,230,214,.14); font-size: 12px; font-weight: 700; }
.login-day b { font-family: var(--display); font-weight: 400; font-size: 14px; color: #ffd04a; }
.login-day.past { opacity: .5; }
.login-day.today { border-color: var(--hazard); background: rgba(242,165,22,.18); }

/* Option gaucher : esquive à gauche, arme à droite */
body.lefty #dashBtn { right: auto; left: calc(18px + env(safe-area-inset-left, 0px)); }
body.lefty #bottom { left: auto; right: calc(14px + env(safe-area-inset-right, 0px)); justify-items: end; }

/* ---------- v0.6 : niveau joueur, missions, coffres ---------- */
.player-bar { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.lvl-badge {
  min-width: 38px; height: 38px; padding: 0 8px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--display); font-size: 18px; color: #111; background: linear-gradient(160deg, #ffd04a, #f2a516);
  box-shadow: 0 4px 14px rgba(242,165,22,.3);
}
.xp-wrap { display: grid; gap: 3px; text-align: left; }
.xpbar { height: 8px; border-radius: 999px; background: rgba(0,0,0,.55); border: 1px solid rgba(235,230,214,.15); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #7fe0c0, #4fc3a1); transition: width .8s ease-out; }
.xp-text { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-line { width: 100%; padding: 8px 12px; border-radius: 12px; font-weight: 700; color: #111; background: linear-gradient(90deg, #ffd04a, #7fe0c0); animation: pulseglow 2s ease-in-out infinite; }
@keyframes pulseglow { 50% { box-shadow: 0 0 18px rgba(255,208,74,.55); } }
.tile-hot { border-color: rgba(127,224,192,.45); }
.tile-hot .tile-value { color: #7fe0c0; }

.quest-bonus { width: 100%; padding: 10px 14px; border-radius: 12px; background: rgba(127,224,192,.1); border: 1px dashed rgba(127,224,192,.4); font-size: 15px; font-weight: 600; text-align: left; }
.quest-bonus.done { color: #7fe0c0; border-style: solid; }

.chest-stage { position: relative; width: 100%; height: 170px; display: grid; place-items: center; }
.chest-box { position: relative; width: 110px; height: 90px; }
.chest-body { position: absolute; left: 0; right: 0; bottom: 0; height: 58px; border-radius: 10px; background: linear-gradient(180deg, #9a7340, #5e4322); border: 3px solid #3b2a14; }
.chest-lid { position: absolute; left: -4px; right: -4px; top: 0; height: 38px; border-radius: 18px 18px 6px 6px; background: linear-gradient(180deg, #b0864a, #7a5a2e); border: 3px solid #3b2a14; transform-origin: 50% 100%; transition: transform .35s ease-in; z-index: 1; }
.chest-lock { position: absolute; left: 50%; top: 26px; width: 22px; height: 26px; margin-left: -11px; border-radius: 6px; background: #f2a516; border: 2px solid #7a5208; z-index: 2; }
.chest-box.shake { animation: chestShake .7s ease-in-out; }
@keyframes chestShake { 20%, 60% { transform: rotate(-7deg) scale(1.05); } 40%, 80% { transform: rotate(7deg) scale(1.05); } }
.chest-box.open .chest-lid { transform: translateY(-30px) rotate(-25deg); }
.chest-box.open .chest-lock { opacity: 0; }
.chest-box.open::after { content: ''; position: absolute; left: 50%; top: 30%; width: 220px; height: 220px; margin: -110px; border-radius: 50%; background: radial-gradient(circle, rgba(255,208,74,.55), rgba(255,208,74,0) 65%); z-index: -1; animation: rise .4s ease-out; }
.chest-box.empty { opacity: .35; filter: grayscale(.8); }
.chest-result { position: absolute; inset: auto 0 0; display: grid; gap: 4px; justify-items: center; animation: rise .4s ease-out; }
.chest-result .coins { font-size: 30px; }
.chest-result .chest-skin { font-weight: 700; color: #7fe0c0; }
.free-chest { width: 100%; }

.over-xp { width: 100%; max-width: 22rem; display: grid; gap: 6px; }
.over-xp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.over-xp .xp-text { font-size: 14px; color: #7fe0c0; }
.over-ups { display: grid; gap: 4px; }
.over-ups div { padding: 8px 12px; border-radius: 12px; background: rgba(242,165,22,.15); border: 1px solid rgba(242,165,22,.5); font-weight: 700; animation: rise .4s ease-out; }
.tile-coins { font-size: 16px; }

/* v0.8 : invisibilité */
.chip.invis { color: #9fd8ff; }

/* ---------- v0.10 : menu en pages, icônes ---------- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
#menu svg { fill: currentColor; flex: none; }

/* Couleurs des icônes */
.c-orange { --c: #f7b733; --c2: #e8641b; }
.c-gold   { --c: #ffe07a; --c2: #d99a0b; }
.c-teal   { --c: #8ff0cf; --c2: #1f9e7a; }
.c-purple { --c: #d3a6ff; --c2: #7444e0; }
.c-blue   { --c: #a6dcff; --c2: #2f7fd8; }
.c-red    { --c: #ff8a72; --c2: #c12b25; }
.c-green  { --c: #c3ef7a; --c2: #4f9a2a; }

#menu.menu-screen {
  display: flex; flex-direction: column; place-items: stretch; padding: 0; overflow: hidden; text-align: center;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(242,165,22,.10), transparent 60%),
    linear-gradient(180deg, rgba(12,14,12,.94), rgba(15,18,16,.55) 28%, rgba(15,18,16,.6) 70%, rgba(10,12,10,.97));
}

/* En-tête : niveau, XP, pièces */
.menu-top {
  flex: none; display: grid; gap: 8px; width: 100%; max-width: 30rem; margin: 0 auto; box-sizing: border-box;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 6px max(16px, env(safe-area-inset-left, 0px));
}
.menu-top .lvl-badge {
  position: relative; display: grid; place-items: center; width: 46px; height: 46px; min-width: 0; padding: 0;
  background: none; box-shadow: none; border-radius: 0;
}
#menu .lvl-badge svg { grid-area: 1 / 1; width: 46px; height: 46px; fill: #f7b733; filter: drop-shadow(0 3px 8px rgba(242,165,22,.45)); }
.menu-top .lvl-badge b { position: relative; grid-area: 1 / 1; margin-top: 3px; font-family: var(--display); font-weight: 400; font-size: 14px; color: #1a1408; }
.menu-top .xpbar { height: 10px; background: rgba(0,0,0,.6); }
.menu-top .xpbar i { background: linear-gradient(180deg, #a6f5da, #2fb08a); box-shadow: 0 0 10px rgba(127,224,192,.5); }
.coin-pill { padding: 5px 12px 5px 7px; border-radius: 999px; font-size: 18px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,208,74,.35); }

/* Pages */
.pages {
  flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch;
}
.pages::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; width: 100%; scroll-snap-align: center; scroll-snap-stop: always; overflow-y: auto; overscroll-behavior: contain; display: grid; }
.page-inner {
  display: grid; gap: 16px; justify-items: center; align-content: center; width: 100%; max-width: 30rem; margin: 0 auto; box-sizing: border-box;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 22px max(16px, env(safe-area-inset-left, 0px));
}
.page-title { margin: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--display); font-weight: 400; font-size: clamp(28px, 9vw, 40px); letter-spacing: .02em; }
.page-title .t-ico { width: 32px; height: 32px; color: var(--hazard); filter: drop-shadow(0 0 12px rgba(242,165,22,.5)); }

/* Cartes génériques du menu */
.page .tiles { max-width: none; gap: 10px; }
.tile-wide { grid-column: 1 / -1; }
.page .tile {
  position: relative; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 1px; align-items: center; padding: 12px;
  background: linear-gradient(180deg, rgba(42,46,39,.94), rgba(24,27,22,.94)); border: 1px solid rgba(235,230,214,.12);
  box-shadow: 0 6px 18px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.05);
}
.page .tile-hot { border-color: rgba(127,224,192,.4); }
.page .tile-daily { border-color: rgba(242,165,22,.5); }
.page .tile .tile-label { align-self: end; font-size: 11px; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page .tile .tile-value { align-self: start; font-size: 16px; line-height: 1.15; white-space: normal; }
.page .tile.new::after { position: absolute; top: -4px; right: -4px; margin: 0; width: 10px; height: 10px; box-shadow: 0 0 0 2px rgba(24,27,22,.95), 0 0 10px rgba(180,42,34,.8); }
.ico {
  grid-row: span 2; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #1a1408;
  background: linear-gradient(145deg, var(--c), var(--c2)); box-shadow: 0 4px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.4);
}
.ico svg { width: 26px; height: 26px; }

/* Boutons Survie / Campagne avec icône */
.play-row { align-items: stretch; }
.play-row .cta { align-content: center; }
.cta-ico { width: 22px; height: 22px; }

/* Barre d'onglets */
.menu-tabs {
  flex: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; width: 100%; box-sizing: border-box;
  padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(22,25,20,.97), rgba(10,12,10,.99)); border-top: 1px solid rgba(235,230,214,.1); box-shadow: 0 -10px 26px rgba(0,0,0,.45);
}
.menu-tabs button {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 4px 0; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0; transition: color .2s;
}
.menu-tabs button > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.menu-tabs button > svg { width: 24px; height: 24px; padding: 4px 14px; border-radius: 999px; transition: background .2s, transform .2s; }
.menu-tabs button.on { color: var(--hazard); }
.menu-tabs button.on > svg { background: rgba(242,165,22,.16); transform: translateY(-1px); }
/* Bouton Jouer : rond doré posé dans un socle qui dépasse de la barre */
.menu-tabs .tab-play { padding-top: 42px; color: var(--hazard); }
.menu-tabs .tab-play::before {
  content: ''; position: absolute; left: 50%; top: -30px; width: 76px; height: 76px; margin-left: -38px; border-radius: 50%;
  background: rgb(22,25,20); border-top: 1px solid rgba(235,230,214,.1); box-shadow: 0 -8px 16px rgba(0,0,0,.3);
}
.play-orb {
  position: absolute; left: 50%; top: -24px; width: 62px; height: 62px; margin-left: -31px; z-index: 1;
  display: grid; place-items: center; border-radius: 50%; color: #2a1a04;
  background: radial-gradient(circle at 35% 25%, #fff0b8 0, #ffc94a 32%, #f29a16 70%, #c76a00 100%);
  box-shadow: inset 0 0 0 2px rgba(255,236,170,.6), inset 0 -4px 8px rgba(130,60,0,.4), 0 6px 18px rgba(242,140,22,.45);
  transition: transform .15s;
}
.play-orb svg { width: 30px; height: 30px; }
.tab-play > span:last-child { position: relative; z-index: 1; }
.tab-play:active .play-orb { transform: scale(.93); }
.tab-play.on .play-orb { animation: orb 2.2s ease-in-out infinite; }
@keyframes orb { 50% { box-shadow: inset 0 0 0 2px rgba(255,236,170,.6), inset 0 -4px 8px rgba(130,60,0,.4), 0 0 0 7px rgba(242,165,22,.16), 0 6px 26px rgba(242,140,22,.7); } }
.menu-tabs button.new::after { content: ''; position: absolute; top: 2px; left: calc(50% + 10px); width: 9px; height: 9px; border-radius: 50%; background: var(--blood); box-shadow: 0 0 0 2px rgba(16,18,15,.98); }

/* Profil */
.profile-card {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; box-sizing: border-box; text-align: left;
  border-radius: 18px; border: 1px solid rgba(242,165,22,.25);
  background: radial-gradient(120% 140% at 0% 0%, rgba(242,165,22,.18), transparent 55%), linear-gradient(180deg, rgba(42,46,39,.95), rgba(24,27,22,.95));
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.avatar-ring { padding: 3px; border-radius: 24px; background: conic-gradient(from 210deg, #f7b733, #ffe07a, #e8641b, #b42a22, #f7b733); box-shadow: 0 6px 18px rgba(242,165,22,.25); }
.avatar { display: block; width: 100px; height: 100px; border-radius: 21px; background: radial-gradient(circle at 50% 40%, #3b3d31, #111310 75%); }
.profile-id { display: grid; gap: 4px; min-width: 0; }
.profile-name { font-family: var(--display); font-size: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-level { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--hazard); }
.profile-level svg { width: 16px; height: 16px; }
.stat-grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-box {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 12px; text-align: left;
  border-radius: var(--radius); background: linear-gradient(180deg, rgba(42,46,39,.9), rgba(24,27,22,.9)); border: 1px solid rgba(235,230,214,.1);
}
.stat-box svg { grid-row: span 2; width: 30px; height: 30px; color: var(--c); filter: drop-shadow(0 0 8px rgba(0,0,0,.4)); }
.stat-box b { font-family: var(--display); font-weight: 400; font-size: 22px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-box span { font-size: 10.5px; line-height: 1.2; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* Récompenses */
.streak-card {
  width: 100%; display: grid; gap: 12px; padding: 14px; box-sizing: border-box; border-radius: 18px; border: 1px solid rgba(255,138,114,.3);
  background: radial-gradient(120% 120% at 0% 0%, rgba(255,106,74,.16), transparent 55%), linear-gradient(180deg, rgba(42,46,39,.95), rgba(24,27,22,.95));
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.streak-head { display: flex; align-items: center; gap: 12px; text-align: left; }
.streak-head .ico { grid-row: auto; }
.streak-titles { display: grid; gap: 2px; }
.streak-count { font-family: var(--display); font-size: 20px; color: #ff9a7a; }
.streak-card .login-track { max-width: none; }
.streak-card .login-day { background: rgba(0,0,0,.35); }
.streak-card .login-day.today { border-color: var(--hazard); background: linear-gradient(180deg, rgba(242,165,22,.35), rgba(242,165,22,.12)); box-shadow: 0 0 14px rgba(242,165,22,.35); }
.streak-card .hint { font-size: 13px; }

/* Boutique */
.wallet { display: grid; gap: 2px; justify-items: center; }
.wallet-coins { font-size: 36px; text-shadow: 0 0 18px rgba(255,208,74,.35); }
.shop-grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.shop-card {
  position: relative; overflow: hidden; display: grid; justify-items: center; gap: 6px; padding: 20px 10px 16px; cursor: pointer; color: var(--bone);
  border-radius: 18px; border: 1px solid rgba(235,230,214,.12);
  background: radial-gradient(90% 70% at 50% 0%, rgba(255,255,255,.07), transparent 70%), linear-gradient(180deg, rgba(42,46,39,.96), rgba(22,25,20,.96));
  box-shadow: 0 8px 22px rgba(0,0,0,.32);
}
.shop-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--c), var(--c2)); }
.shop-card:active { transform: scale(.97); }
.shop-ico {
  display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 4px; border-radius: 50%; color: #1a1408;
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.45), transparent 45%), linear-gradient(145deg, var(--c), var(--c2));
  box-shadow: 0 0 0 5px rgba(255,255,255,.04), 0 8px 20px rgba(0,0,0,.4);
}
.shop-ico svg { width: 34px; height: 34px; }
.shop-name { font-family: var(--display); font-size: 17px; }
.shop-meta { font-size: 12px; font-weight: 700; color: var(--c); }

/* Options */
.howto {
  width: 100%; display: grid; gap: 10px; padding: 14px; box-sizing: border-box; text-align: left;
  border-radius: 18px; background: linear-gradient(180deg, rgba(42,46,39,.9), rgba(24,27,22,.9)); border: 1px solid rgba(235,230,214,.1);
}
.howto-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; }
.howto .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-family: var(--display); font-size: 14px; color: #1a1408; background: linear-gradient(145deg, #f7b733, #e8641b); }
.howto p { margin: 0; font-size: 15px; line-height: 1.35; }
.howto b { color: var(--hazard); }

/* v0.11 : compteur de pièces qui saute au ramassage */
.hud-coins { transform-origin: left center; }
.hud-coins.bump { animation: coinbump .25s ease-out; }
@keyframes coinbump { 40% { transform: scale(1.3); color: #fff2b0; } }
