/* ============ STACK RUSH — Tactile Toy-Box Arcade UI ============ */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 500 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/fredoka-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 500 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/fredoka-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/lilita-one-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Lilita One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/lilita-one-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #1e1633;
  --cream: #fff7e8;
  --sand: #f1e2c5;
  --card: #ffffff;
  --muted: #6b5f80;
  --green: #24c96b;
  --green-lip: #148a46;
  --gold: #ffd13b;
  --gold-lip: #c78500;
  --orange: #ff7b29;
  --orange-lip: #bf4d0e;
  --blue: #2b95ff;
  --blue-lip: #155db8;
  --coral: #ff4275;
  --coral-lip: #b81c4b;
  --teal: #1dc4a8;
  --teal-lip: #0f8773;
  --purple: #8f5cff;
  --purple-lip: #5c2cc7;
  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-ui: "Fredoka", "Segoe UI", system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --banner: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; overflow: hidden; background: #16102b; color: var(--ink);
  font-family: var(--font-ui); font-weight: 600;
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none;
}
canvas#game { position: fixed; inset: 0; display: block; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.center { text-align: center; }
.grow { flex: 1; }
.ver { margin-top: 14px; font-size: 12px; }

/* ---------- Icônes SVG ---------- */
.svg-ico { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -.24em; flex-shrink: 0; }
.svg-ico.inline { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
.svg-ico.xs { width: 14px; height: 14px; vertical-align: -.15em; }
.svg-ico.sm { width: 18px; height: 18px; vertical-align: middle; }
.svg-ico.md { width: 24px; height: 24px; vertical-align: -.22em; }
.svg-ico.lg { width: 38px; height: 38px; vertical-align: middle; }
.svg-ico.xl { width: 66px; height: 66px; vertical-align: middle; }
.ico svg { width: 28px; height: 28px; display: block; }
.ico-med svg { width: 23px; height: 23px; display: block; }
.ico-xs svg { width: 13px; height: 13px; vertical-align: -.14em; }

.modal-body { scrollbar-width: thin; scrollbar-color: rgba(30, 22, 51, .25) transparent; }
.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(30, 22, 51, .25); border-radius: 5px; }

/* ---------- HUD ---------- */
.hud {
  position: fixed; top: calc(var(--st) + 12px); left: 12px; right: 12px; z-index: 20;
  display: flex; gap: 8px; align-items: center;
}
body.playing .hud { display: none; }
.spacer { flex: 1; }

.pill {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 99px;
  background: var(--cream); color: var(--ink); border: 2.5px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink); font-family: var(--font-display); font-size: 16px; letter-spacing: .3px;
  transition: transform .08s;
}
.pill:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.pill .plus {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green); color: #fff; border: 2px solid var(--ink); font-size: 14px; line-height: 1;
}
.icon-btn {
  width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center;
  background: var(--cream); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  transition: transform .08s;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }

/* ---------- Écran d'accueil ---------- */
.screen { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.screen button { pointer-events: auto; }

.title {
  position: absolute; top: calc(var(--st) + 9.5vh); width: 100%; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--font-display); font-weight: 400; line-height: .88; letter-spacing: 2px;
  font-size: clamp(50px, 15.5vw, 86px); transform: rotate(-2.5deg);
}
.title span:first-child {
  color: #ffffff;
  -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink), 0 10px 18px rgba(0, 0, 0, .35);
}
.title span:last-child {
  color: var(--gold);
  -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink), 0 10px 18px rgba(0, 0, 0, .35);
}

.best {
  position: absolute; top: calc(var(--st) + 9.5vh + clamp(100px, 28vw, 156px)); left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 99px;
  background: var(--cream); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
.best .ico svg { width: 18px; height: 18px; }
.best b { font-family: var(--font-display); font-size: 16px; color: var(--coral); }

.tap-hint {
  position: absolute; bottom: calc(var(--sb) + var(--banner) + 102px); width: 100%; text-align: center;
  animation: bounceTap 1.4s ease-in-out infinite;
}
.tap-hint span {
  display: inline-block; padding: 8px 22px; border-radius: 99px;
  background: var(--gold); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  font-family: var(--font-display); font-size: 18px; letter-spacing: .6px;
}
@keyframes bounceTap { 50% { transform: translateY(-4px) scale(1.03); } }

/* Boutons latéraux façon badges émaillés */
.side { position: absolute; top: calc(var(--st) + 68px); display: flex; flex-direction: column; gap: 10px; }
.side.left { left: 12px; }
.side.right { right: 12px; }

.side-btn {
  position: relative; width: 62px; height: 62px; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--cream); color: var(--ink); border: 2.5px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .75), 0 4px 0 var(--ink);
  transition: transform .08s;
}
.side-btn span:last-of-type { font-size: 11px; font-weight: 700; line-height: 1; }
.side-btn.c-gift { background: #ffe4ec; }
.side-btn.c-free { background: #dff2ff; }
.side-btn.c-noads { background: #fff5e0; }
.side-btn.offer {
  background: linear-gradient(170deg, #ffe259, #ff8a2b); color: var(--ink);
  animation: wiggle 2.8s infinite;
}
@keyframes wiggle { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(-7deg); } 93% { transform: rotate(7deg); } 97% { transform: rotate(-4deg); } }

.badge {
  position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px;
  background: var(--coral); color: #fff; border: 2px solid var(--ink);
  font-family: var(--font-display); font-style: normal; font-size: 12px; display: grid; place-items: center;
  box-shadow: 0 2px 0 var(--ink);
}

/* Barre de navigation basse — touches arcade colorées */
.nav {
  position: absolute; left: 10px; right: 10px; bottom: calc(var(--sb) + var(--banner) + 12px);
  max-width: 460px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.nav button {
  position: relative; height: 68px; border-radius: 20px; color: #fff;
  border: 2.5px solid var(--ink); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .38), 0 5px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: transform .08s, box-shadow .08s;
}
.nav button span:last-of-type {
  font-family: var(--font-display); font-size: 12.5px; letter-spacing: .4px;
  text-shadow: 0 1.5px 0 rgba(30, 22, 51, .55);
}
.nav-skins    { background: linear-gradient(180deg, #2ee0c0, #16a88f); }
.nav-pass     { background: linear-gradient(180deg, #ffd84d, #f59e0b); color: var(--ink) !important; }
.nav-pass span:last-of-type { text-shadow: none; }
.nav-missions { background: linear-gradient(180deg, #ff9947, #ff641a); }
.nav-shop     { background: linear-gradient(180deg, #ff638d, #e82c61); }
.nav button:active, .side-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

/* ---------- Score en jeu ---------- */
#score {
  position: absolute; top: calc(var(--st) + 6.5vh); width: 100%; text-align: center;
  font-family: var(--font-display); font-size: clamp(66px, 20vw, 112px); color: #fff;
  -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink);
}
#score.pop { animation: pop .25s ease-out; }
@keyframes pop { 40% { transform: scale(1.2); } }
#perfect {
  position: absolute; top: calc(var(--st) + 6.5vh + clamp(78px, 23vw, 126px)); width: 100%; text-align: center;
  font-family: var(--font-display); font-size: 28px; letter-spacing: 1px; color: var(--gold);
  -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--ink); opacity: 0;
}
#perfect.show { animation: perfect .9s ease-out; }
@keyframes perfect { 0% { opacity: 0; transform: scale(.5); } 20% { opacity: 1; transform: scale(1.15); } 70% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: translateY(-20px); } }

/* ---------- Bannière ---------- */
#banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: calc(var(--banner) + var(--sb)); padding-bottom: var(--sb);
  background: #231b3d; border-top: 2.5px solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: rgba(255, 255, 255, .72);
}
#cg-banner {
  width: 100%; max-width: 728px; height: var(--banner);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.banner-mock { display: flex; align-items: center; justify-content: center; gap: 8px; }
#banner .ad-tag { background: var(--gold); color: var(--ink); font-family: var(--font-display); padding: 2px 6px; border-radius: 5px; font-size: 10px; border: 1.5px solid var(--ink); }
body:has(#banner.hidden) { --banner: 0px; }
@media (min-width: 760px) and (min-height: 620px) {
  :root { --banner: 90px; }
}

/* ---------- Boutons tactiles ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 0 16px; border-radius: 16px;
  font-family: var(--font-display); font-size: 17px; letter-spacing: .3px;
  background: var(--sand); color: var(--ink); border: 2.5px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), 0 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 12px; border-radius: 12px; }
.btn.primary { background: linear-gradient(180deg, #34de7c, var(--green)); color: #fff; text-shadow: 0 1.5px 0 var(--green-lip); }
.btn.ad      { background: linear-gradient(180deg, #ffe259, #ff9f1c); color: var(--ink); }
.btn.gem     { background: linear-gradient(180deg, #4db5ff, var(--blue)); color: #fff; text-shadow: 0 1.5px 0 var(--blue-lip); }
.btn.buy     { background: linear-gradient(180deg, #34de7c, var(--green)); color: #fff; min-width: 86px; text-shadow: 0 1.5px 0 var(--green-lip); }
.btn.premium { background: linear-gradient(135deg, #a66bff, #ff4275); color: #fff; text-shadow: 0 1.5px 0 var(--purple-lip); }
.btn.danger  { background: #ffe0e8; color: #b81c4b; }
.btn.icon    { width: 54px; padding: 0; background: var(--card); }
.btn.ghost   { background: transparent; border: 0; box-shadow: none; color: #007aff; font-family: var(--font-ui); }
.link { display: block; margin: 14px auto 0; color: var(--muted); font-weight: 700; text-decoration: underline; padding: 6px; font-size: 14px; }
.row { display: flex; gap: 10px; margin-top: 10px; }

/* ---------- Modales (corps crème chaud + bandeau coloré) ---------- */
#modal-root { position: relative; z-index: 30; }
.modal-bg {
  position: fixed; inset: 0; background: rgba(16, 10, 34, .72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: calc(var(--st) + 14px) 12px calc(var(--sb) + 14px);
  animation: fade .18s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; width: 100%; max-width: 420px; max-height: 100%; display: flex; flex-direction: column;
  background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 26px; overflow: hidden;
  box-shadow: 0 8px 0 var(--ink), 0 22px 50px rgba(0, 0, 0, .55);
  animation: up .28s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes up { from { transform: translateY(36px) scale(.95); opacity: 0; } }

.m-head {
  position: relative; flex-shrink: 0; padding: 13px 52px 12px 18px;
  border-bottom: 3px solid var(--ink); color: #fff;
  background: linear-gradient(180deg, #ff638d, #e82c61);
}
.m-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .1) 0 10px, transparent 10px 20px);
}
.m-head h2 {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-size: 23px; font-weight: 400; letter-spacing: .5px;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 0 2.5px 0 var(--ink);
}
.m-shop .m-head     { background: linear-gradient(180deg, #ff638d, #e82c61); }
.m-pass .m-head     { background: linear-gradient(180deg, #8f5cff, #6833db); }
.m-skins .m-head    { background: linear-gradient(180deg, #2ee0c0, #12a189); }
.m-missions .m-head { background: linear-gradient(180deg, #ff9947, #f25f16); }
.m-daily .m-head    { background: linear-gradient(180deg, #ff7096, #e02863); }
.m-starter .m-head  { background: linear-gradient(180deg, #ffd84d, #f59e0b); }
.m-settings .m-head { background: linear-gradient(180deg, #5c7cfa, #3b5bdb); }
.m-continue .m-head { background: linear-gradient(180deg, #ffaa3b, #e86f0c); }
.m-results .m-head  { background: linear-gradient(180deg, #34de7c, #18a855); }

.modal-x {
  position: absolute; top: 50%; right: 12px; transform: translateY(-50%); z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--cream); color: var(--coral); border: 2.5px solid var(--ink);
  box-shadow: 0 2.5px 0 var(--ink);
}
.modal-x:active { transform: translateY(calc(-50% + 2px)); box-shadow: none; }

.modal-body { overflow-y: auto; padding: 16px 16px 18px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.section-title { margin: 16px 0 8px; font-family: var(--font-display); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.section-title:first-child { margin-top: 2px; }

/* Boutique */
.offer {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 13px 12px; border-radius: 18px; margin-bottom: 10px;
  border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); overflow: hidden;
}
.offer:has(.ribbon-s) { padding-top: 25px; }
.offer.gold   { background: linear-gradient(135deg, #fff1b8, #ffd966); }
.offer.purple { background: linear-gradient(135deg, #efe5ff, #d9c2ff); }
.offer.blue   { background: linear-gradient(135deg, #dcf2ff, #b3e0ff); }
.offer-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--card); border: 2px solid var(--ink); display: grid; place-items: center; flex-shrink: 0; }
.offer-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.offer-info b { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.offer-info span { font-size: 12.5px; color: #4a3f61; line-height: 1.25; }
.ribbon-s { position: absolute; top: 0; left: 0; background: var(--coral); color: #fff; font-family: var(--font-display); font-size: 9.5px; letter-spacing: .5px; padding: 2px 8px; border-bottom-right-radius: 10px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 14px 6px 10px; border-radius: 18px;
  background: var(--card); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.card b { font-size: 15px; font-weight: 700; }
.card em {
  position: absolute; top: -10px; background: var(--coral); color: #fff; border: 2px solid var(--ink);
  font-family: var(--font-display); font-style: normal; font-size: 10.5px; padding: 2px 9px; border-radius: 99px;
}
.price {
  margin-top: 3px; background: var(--green); color: #fff; border: 2px solid var(--ink);
  padding: 4px 12px; border-radius: 11px; font-family: var(--font-display); font-size: 14px; white-space: nowrap;
  box-shadow: 0 2px 0 var(--ink);
}
.free-row {
  width: 100%; display: flex; align-items: center; gap: 11px; margin-top: 12px; padding: 11px 13px; border-radius: 18px; text-align: left;
  background: #fff1b8; border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font-weight: 700;
}
.free-row b { font-family: var(--font-display); font-size: 16px; white-space: nowrap; }
.free-row small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.ad-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--blue); border: 2px solid var(--ink); display: grid; place-items: center; }

/* Barres de progression */
.bar { position: relative; height: 22px; border-radius: 99px; background: var(--sand); border: 2px solid var(--ink); overflow: hidden; margin: 6px 0 4px; }
.bar div { height: 100%; background: linear-gradient(180deg, #34de7c, var(--green)); transition: width .4s; }
.bar.xp div { background: linear-gradient(90deg, #8f5cff, #ff4275); }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 12px; color: var(--ink); }
.bar.xp span { color: #fff; text-shadow: 0 1px 0 var(--ink), 0 -1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink); }

/* Pass */
.pass-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; }
.pass-head .bar { flex: 1; height: 26px; }
.lvl {
  width: 48px; height: 48px; border-radius: 15px; background: linear-gradient(135deg, #ffd13b, #ff7b29);
  border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 22px; color: var(--ink);
}
.pass-cols { display: grid; grid-template-columns: 1fr 44px 1fr; text-align: center; font-family: var(--font-display); font-size: 12.5px; color: var(--muted); margin: 14px 0 6px; }
.prow { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 6px; align-items: center; margin-bottom: 7px; }
.tnum {
  width: 34px; height: 34px; margin: auto; border-radius: 50%; background: var(--sand); border: 2px solid var(--ink);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 14px; color: var(--ink);
}
.prow.reached .tnum { background: var(--gold); }
.pcell {
  position: relative; height: 64px; border-radius: 15px; background: var(--card); border: 2px solid var(--ink);
  box-shadow: 0 3px 0 rgba(30, 22, 51, .2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; font-size: 13px;
}
.pcell .p-ico { font-style: normal; display: grid; place-items: center; }
.pcell.premium { background: #efe5ff; }
.pcell.skin { background: linear-gradient(135deg, #fff1b8, #ffd6e6); }
.pcell.can { border: 2.5px solid var(--ink); background: #fff0a6; box-shadow: 0 0 0 3px var(--gold), 0 3px 0 var(--ink); animation: pulseCard 1s infinite alternate; }
@keyframes pulseCard { to { transform: scale(1.02); } }
.pcell.claimed > :not(.tick) { opacity: .38; }
.pcell .tick { position: absolute; display: grid; place-items: center; }
.pcell.locked > :not(.lock) { opacity: .65; }
.pcell .lock { position: absolute; top: 3px; right: 4px; }

/* Skins */
.skin-art { width: 64px; height: 64px; display: grid; place-items: center; }
.skin-art.mini { width: 32px; height: 32px; }
.skin-art .skin-svg { width: 100%; height: 100%; }
.skin-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 10px; border-radius: 18px;
  background: var(--card); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); font-size: 14px;
  transition: transform .08s, box-shadow .08s;
}
.skin-card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.skin-card.equipped { background: #dcfae8; box-shadow: 0 0 0 3px var(--green), 0 4px 0 var(--ink); }
.skin-card.locked .skin-art { filter: saturate(.75) brightness(.95); }
.skin-card b { font-family: var(--font-display); font-size: 16px; }
.skin-sub { font-size: 11.5px; color: var(--muted); font-weight: 700; margin-top: -3px; }
.st { font-family: var(--font-display); font-size: 11.5px; padding: 3px 10px; border-radius: 99px; background: var(--sand); border: 1.5px solid var(--ink); white-space: nowrap; }
.st.eq { background: var(--green); color: #fff; }
.st.price { background: #fff0a6; color: var(--ink); }
.st.lockd { background: #ece3f7; color: #4a3f61; }

/* Missions */
.mission {
  display: flex; gap: 10px; align-items: center; padding: 12px; margin-top: 10px; border-radius: 18px;
  background: var(--card); border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
}
.mission b { font-size: 15px; font-weight: 700; }
.mission small { color: #9c5d00; font-weight: 700; font-size: 12.5px; }
.mission.claimed { opacity: .6; background: var(--sand); }
.m-done { padding: 0 8px; }

/* Cadeau quotidien */
.days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 6px; }
.day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 15px;
  background: var(--card); border: 2px solid var(--ink); box-shadow: 0 3px 0 rgba(30, 22, 51, .2);
}
.day small { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.day .d-ico { display: grid; place-items: center; height: 28px; }
.day b { font-family: var(--font-display); font-size: 15px; }
.day.big { grid-column: span 2; background: linear-gradient(135deg, #efe5ff, #ffd6e6); }
.day.today { background: #fff0a6; box-shadow: 0 0 0 3px var(--gold), 0 3px 0 var(--ink); }
.day.claimed > :not(i) { opacity: .35; }
.day > i { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; }

/* Offre de démarrage */
.ribbon {
  background: var(--coral); color: #fff; margin: -16px -16px 12px; padding: 7px; text-align: center;
  font-family: var(--font-display); letter-spacing: 2px; font-size: 13px; border-bottom: 2.5px solid var(--ink);
}
.starter-icon { text-align: center; animation: pop 1.6s infinite; margin: 4px 0; }
.starter-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.starter-items > div {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 4px; border-radius: 16px;
  background: var(--card); border: 2px solid var(--ink); font-family: var(--font-display); font-size: 14px;
}

/* Réglages */
.toggle {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; margin-bottom: 8px;
  border-radius: 16px; background: var(--card); border: 2px solid var(--ink); font-weight: 700;
}
.toggle span { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toggle input { width: 22px; height: 22px; accent-color: var(--green); }
.toggle.is-muted { opacity: .75; }
.plat-mute { font-size: 11px; font-weight: 700; color: var(--coral); background: #ffe4ec; padding: 2px 7px; border-radius: 99px; border: 1.5px solid var(--ink); }
.lang-row { display: flex; gap: 6px; }
.lang-btn {
  min-width: 44px; height: 32px; padding: 0 10px; border-radius: 10px;
  background: var(--sand); color: var(--ink); border: 2px solid var(--ink);
  font-family: var(--font-display); font-size: 13px; box-shadow: 0 2px 0 var(--ink);
}
.lang-btn.active { background: var(--green); color: #fff; }
.lang-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--ink); }

/* Seconde chance */
.ring { position: relative; width: 120px; height: 120px; margin: 8px auto 12px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--sand); }
.ring-fg { stroke: var(--orange); stroke-linecap: round; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 46px; color: var(--ink); }

/* Résultats */
.res-label { text-align: center; color: var(--muted); font-family: var(--font-display); letter-spacing: 2.5px; font-size: 13px; }
.res-score {
  text-align: center; font-family: var(--font-display); font-size: 76px; line-height: 1; color: var(--gold);
  -webkit-text-stroke: 3.5px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink);
  margin: 2px 0 6px;
}
.new-best { text-align: center; color: var(--coral); font-family: var(--font-display); font-size: 17px; animation: pop 1s infinite; margin-bottom: 4px; }
.res-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 10px; }
.res-stats div { display: flex; flex-direction: column; align-items: center; padding: 10px; border-radius: 16px; background: var(--card); border: 2px solid var(--ink); }
.res-stats b { font-family: var(--font-display); font-size: 24px; }
.res-stats span { font-size: 12px; color: var(--muted); font-weight: 700; }
.res-reward { display: flex; justify-content: center; gap: 18px; font-family: var(--font-display); font-size: 18px; margin: 4px 0; }
.pass-mini { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 14px; margin: 8px 0 4px; }
.pass-mini .bar { flex: 1; height: 14px; margin: 0; }

/* Toasts */
#toasts { position: fixed; top: calc(var(--st) + 64px); left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  padding: 9px 16px; border-radius: 99px; background: var(--cream); color: var(--ink);
  border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  font-family: var(--font-display); font-size: 14px; animation: up .28s; transition: .35s; max-width: 90%; text-align: center;
}
.toast.green  { background: var(--green); color: #fff; }
.toast.gold   { background: var(--gold); color: var(--ink); }
.toast.purple { background: var(--purple); color: #fff; }
.toast.out    { opacity: 0; transform: translateY(-10px); }

/* Pastille de défi (?challenge=N) */
.challenge-pill {
  position: fixed; top: calc(var(--st) + 62px); left: 50%; transform: translateX(-50%); z-index: 19;
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 99px;
  background: var(--coral); color: #fff; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  font-family: var(--font-display); font-size: 13.5px; letter-spacing: .3px; pointer-events: none; white-space: nowrap;
}
body.playing .challenge-pill { top: calc(var(--st) + 12px); }
.challenge-pill.beaten { background: var(--green); }

/* ---------- Pubs simulées ---------- */
#overlay-root { position: relative; z-index: 100; }
.ad-overlay { position: fixed; inset: 0; background: linear-gradient(160deg, #1d3b6e, #0b1530); color: #fff; display: flex; flex-direction: column; animation: fade .2s; }
.ad-top { display: flex; justify-content: space-between; align-items: center; padding: calc(var(--st) + 12px) 14px 12px; }
.ad-label { font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, .16); padding: 4px 9px; border-radius: 8px; }
.ad-close { min-width: 38px; height: 38px; padding: 0 12px; border-radius: 19px; background: rgba(0, 0, 0, .45); font-weight: 700; font-size: 13px; color: rgba(255, 255, 255, .7); border: 2px solid rgba(255, 255, 255, .25); }
.ad-close.ready { color: var(--ink); background: var(--cream); border-color: var(--ink); }
.ad-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; text-align: center; }
.ad-icon { animation: pop 1.5s infinite; }
.ad-title { font-family: var(--font-display); font-size: 30px; }
.ad-sub { color: rgba(255, 255, 255, .72); }
.ad-hint { margin-top: 20px; font-size: 13px; }
.ad-cta { margin-top: 14px; background: var(--blue); padding: 12px 36px; border-radius: 16px; font-family: var(--font-display); font-size: 18px; border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.ad-bar { height: 6px; background: rgba(255, 255, 255, .15); margin-bottom: var(--sb); }
.ad-bar div { height: 100%; width: 0; background: var(--gold); }

/* ---------- Feuille d'achat App Store simulée ---------- */
.iap-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.iap-sheet {
  width: 100%; max-width: 480px; background: #f2f2f7; color: #000; border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(var(--sb) + 18px); animation: sheet .3s ease-out; font-family: -apple-system, "Segoe UI", sans-serif;
}
@keyframes sheet { from { transform: translateY(100%); } }
.iap-store { font-weight: 800; font-size: 18px; margin-bottom: 14px; }
.iap-store small { font-weight: 500; font-size: 12px; color: #888; }
.iap-row { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.iap-icon { width: 54px; height: 54px; border-radius: 14px; background: var(--cream); border: 2px solid var(--ink); display: grid; place-items: center; }
.iap-info { flex: 1; display: flex; flex-direction: column; }
.iap-info span, .iap-info small { color: #777; font-size: 13px; }
.iap-price { font-weight: 800; }
.iap-sheet .btn.primary { background: #007aff; border: 0; box-shadow: none; color: #fff; border-radius: 12px; font-family: inherit; text-shadow: none; }
.iap-sheet .btn.ghost { color: #007aff; }
.iap-done { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px; font-weight: 800; font-size: 18px; }
.iap-done span { width: 60px; height: 60px; border-radius: 50%; background: #007aff; color: #fff; display: grid; place-items: center; }
