/* Polices hébergées chez nous (licence SIL OFL 1.1, voir fonts/) : aucun appel à un service tiers. */
@font-face {
  font-family: 'Silkscreen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/silkscreen-latin-400.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: 'Silkscreen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/silkscreen-latin-ext-400.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/pixelify-sans-latin-400.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: 'Pixelify Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/pixelify-sans-latin-ext-400.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/pixelify-sans-latin-600.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: 'Pixelify Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/pixelify-sans-latin-ext-600.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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ───────────── KIWABU — refonte « rétro arcade cartoon » (2026-11-12) ─────────────
   Nuit violette autour, panneaux crème/ivoire, contours violet sombre épais, accents rose et or.
   Mobile portrait d'abord ; sur ordinateur, une colonne de téléphone au centre. */
:root {
  --night: #241645;
  --night-2: #3b2470;
  --night-3: #6b3fc8;
  --ink: #2a1f3d;
  --ivory: #fffaf0;
  --cream: #f6ecd8;
  --cream-2: #e6d6b8;
  --muted: #7a6b8f;
  --pink: #ff7aa8;
  --pink-2: #ffb3c7;
  --gold: #ffd23f;
  --gold-2: #f2b51d;
  --gold-3: #b8820f;
  --green: #6fcf4f;
  --blue: #5cc8ff;
  --red: #ff6b6b;
  --r-common: #4fbf4a;
  --r-uncommon: #3d9bff;
  --r-rare: #a56bff;
  --r-epic: #f2b51d;
  --r-legendary: #ff4d5e;
  --rainbow: linear-gradient(90deg, #ff6b6b, #ffa94d, #ffd23f, #6fcf4f, #5cc8ff, #a56bff, #ff7aa8);
  --edge: 3px solid var(--ink);
  --lift: 0 4px 0 var(--ink);
  --font: 'Pixelify Sans', ui-rounded, system-ui, sans-serif;
  --title: 'Silkscreen', 'Pixelify Sans', monospace;
  /* marges sûres (encoche, Dynamic Island, coins arrondis, barre d'accueil) : env() du navigateur, ou les variables
     --safe-area-inset-* que l'app Android (Capacitor) pose quand son WebView ne renseigne pas env() */
  --sa-t: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sa-r: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --sa-b: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sa-l: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --safe-b: var(--sa-b);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 9%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 40% 70%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 52%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 88%, #fff6 50%, transparent 51%),
    linear-gradient(180deg, #1a0f35 0%, var(--night) 45%, #3b2470 100%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
img.ico, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

#app {
  position: relative;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 8px 10px calc(64px + var(--safe-b));
}
@media (min-width: 700px) {
  #app { margin-top: 16px; min-height: calc(100dvh - 32px); border-radius: 28px; border: 4px solid #120a26;
    box-shadow: 0 0 0 3px #4b3080, 0 20px 60px #0008; background: #1d1239; overflow: hidden; }
}

/* ── Barre du haut ── */
.hud { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chip, .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ivory); border: var(--edge); border-radius: 12px; box-shadow: 0 3px 0 var(--ink);
  padding: 4px 10px 4px 6px; font-weight: 600; min-height: 36px;
}
.chip { flex: 1; min-width: 0; }
.chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.chip .sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip canvas { width: 28px; height: 28px; }
.pill.coins { background: linear-gradient(180deg, #fff3c4, var(--gold)); }
.pill .ico { width: 22px; height: 22px; }
.place-tag { font-family: var(--title); font-size: 11px; color: var(--ivory); letter-spacing: 1px; text-shadow: 0 2px 0 var(--ink); }

/* ── La scène (maison / jardin) ── */
.stage {
  position: relative; width: min(100%, calc((100dvh - 372px) * 0.8036)); min-width: 240px; margin: 0 auto; aspect-ratio: 90 / 112;
  border: 4px solid var(--ink); border-radius: 18px; overflow: hidden;
  box-shadow: 0 5px 0 var(--ink), inset 0 0 0 3px #ffffff40;
  background: var(--cream); touch-action: manipulation;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .corner { position: absolute; top: 8px; display: flex; gap: 6px; }
.stage .corner.left { left: 8px; }
.stage .corner.right { right: 8px; }
.round {
  width: 42px; height: 42px; border-radius: 12px; border: var(--edge); background: var(--ivory);
  box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; padding: 0;
}
.round .ico { width: 24px; height: 24px; }
.round.on { background: var(--gold); }
.bubble {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none;
  background: var(--ivory); border: var(--edge); border-radius: 14px; padding: 4px 8px;
  font-size: 13px; font-weight: 600; white-space: nowrap; box-shadow: 0 3px 0 var(--ink);
  animation: pop .25s ease-out;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 10px; height: 10px; margin-left: -5px;
  background: var(--ivory); border-right: var(--edge); border-bottom: var(--edge); transform: rotate(45deg); }
.bubble .ico { width: 18px; height: 18px; vertical-align: -4px; }
@keyframes pop { from { transform: translate(-50%, -80%) scale(.6); opacity: 0; } }

.build-bar {
  position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; justify-content: center; align-items: center;
  background: #fffaf0e6; border: var(--edge); border-radius: 14px; padding: 6px; box-shadow: 0 3px 0 var(--ink);
}
.build-bar .hint { flex: 1; font-size: 12px; text-align: center; }

/* ── Besoins ── */
.needs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 10px 0 8px; }
.need {
  background: var(--ivory); border: var(--edge); border-radius: 10px; padding: 3px 6px 4px; box-shadow: 0 2px 0 var(--ink);
  font-size: 11px; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden;
}
.need .bar { height: 7px; border-radius: 4px; background: #e6d6b8; border: 2px solid var(--ink); margin-top: 3px; overflow: hidden; }
.need .bar i { display: block; height: 100%; background: var(--green); transition: width .4s; }
.need.low .bar i { background: var(--red); }
.need.mid .bar i { background: var(--gold); }

/* ── Soins ── */
.care { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.act {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 5px;
  background: linear-gradient(180deg, #fff, var(--cream)); border: var(--edge); border-radius: 14px;
  box-shadow: var(--lift); font-size: 12px; font-weight: 600; min-height: 52px;
  transition: transform .06s;
}
.act .ico { width: 26px; height: 26px; }
.act:active, .btn:active, .round:active, .tile:active, .card button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.act:disabled { opacity: .45; }
.act.alert { background: linear-gradient(180deg, #fff, var(--pink-2)); animation: nudge 1.6s infinite; }
@keyframes nudge { 0%, 85%, 100% { transform: none; } 90% { transform: translateY(-3px); } }

/* ── Tiroir du menu ── */
.drawer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; pointer-events: none; }
.drawer .shade { position: fixed; inset: 0; background: #12082699; opacity: 0; transition: opacity .25s; }
.drawer.open .shade { opacity: 1; pointer-events: auto; }
.drawer .sheet {
  position: relative; max-width: 440px; margin: 0 auto; pointer-events: auto;
  background: var(--cream); border: 4px solid var(--ink); border-bottom: 0; border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 0 #ffffff60 inset; transform: translateY(calc(100% - 54px - var(--safe-b)));
  transition: transform .28s cubic-bezier(.2, .9, .3, 1.1); padding: 0 14px calc(16px + var(--safe-b)); touch-action: none;
}
.drawer.open .sheet { transform: none; }
.drawer .handle {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 50px;
  border: 0; background: none; gap: 2px; font-family: var(--title); font-size: 11px; letter-spacing: 1px;
}
.drawer .handle::before { content: ''; width: 44px; height: 6px; border-radius: 3px; background: var(--ink); opacity: .5; }
.drawer .chev { width: 14px; height: 14px; border-left: 3px solid var(--ink); border-top: 3px solid var(--ink); transform: rotate(45deg) translate(3px, 3px); transition: transform .25s; }
.drawer.open .chev { transform: rotate(225deg) translate(3px, 3px); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding-top: 4px; max-height: 50dvh; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px;
  background: linear-gradient(180deg, #fff, var(--ivory)); border: var(--edge); border-radius: 16px; box-shadow: var(--lift);
  font-weight: 600; font-size: 14px; position: relative;
}
.tile .ico { width: 36px; height: 36px; }
.tile .dot { position: absolute; top: 6px; right: 8px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--pink); border: 2px solid var(--ink); font-size: 11px; line-height: 16px; color: #fff; }

/* ── Pages plein écran (boutique, inventaire, collection, caisses, journal, réglages) ── */
.page {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, #2b1a52, var(--night) 30%);
  animation: slideIn .22s ease-out;
}
@keyframes slideIn { from { transform: translateY(24px); opacity: 0; } }
.page .inner { max-width: 440px; margin: 0 auto; padding: 10px 12px calc(28px + var(--safe-b)); }
.page-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 8px 0 12px;
  background: linear-gradient(180deg, #2b1a52 70%, #2b1a5200); }
.banner {
  flex: 1; text-align: center; font-family: var(--title); font-size: 18px; color: var(--ink);
  background: linear-gradient(180deg, #fff3c4, var(--gold)); border: var(--edge); border-radius: 12px; box-shadow: var(--lift); padding: 8px 6px;
}
.page h3 { font-family: var(--title); font-size: 13px; color: var(--ivory); letter-spacing: 1px; margin: 18px 4px 8px; text-shadow: 0 2px 0 var(--ink); }
.panel { background: var(--cream); border: var(--edge); border-radius: 16px; box-shadow: var(--lift); padding: 12px; margin-bottom: 12px; }
.panel p { margin: 6px 0; line-height: 1.35; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.tabs button { flex: none; border: var(--edge); border-radius: 10px; background: var(--ivory); padding: 6px 10px; font-weight: 600; box-shadow: 0 3px 0 var(--ink); font-size: 13px; }
.tabs button[aria-selected="true"] { background: var(--gold); }

/* Catégories (grandes tuiles) */
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat { min-height: 120px; font-size: 16px; }
.cat .ico { width: 48px; height: 48px; }
.cat small { font-size: 11px; color: var(--muted); font-weight: 400; }

/* Cartes illustrées */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  --rc: var(--r-common);
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px;
  background: var(--ivory); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink), inset 0 0 0 3px var(--rc);
  text-align: center; font-weight: 600;
}
.card .art { width: 100%; aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #fff 0 30%, color-mix(in srgb, var(--rc) 22%, #fff) 70%); }
.card .art canvas, .card .art img { width: 80%; height: 80%; object-fit: contain; }
.card .nm { font-size: 14px; line-height: 1.15; min-height: 2.3em; display: flex; align-items: center; }
.card .own { position: absolute; top: 8px; right: 8px; font-size: 11px; background: var(--ink); color: var(--ivory); border-radius: 8px; padding: 1px 6px; }
.card button { width: 100%; }
.card.locked .art { filter: grayscale(1) brightness(.4); }
.rar { display: inline-block; font-size: 11px; color: #fff; background: var(--rc); border: 2px solid var(--ink); border-radius: 8px; padding: 0 7px; text-shadow: 0 1px 0 #0006; }
.r-common { --rc: var(--r-common); }
.r-uncommon { --rc: var(--r-uncommon); }
.r-rare { --rc: var(--r-rare); }
.r-epic { --rc: var(--r-epic); }
.r-legendary { --rc: var(--r-legendary); }
.r-mythic { --rc: #a56bff; }
.r-mythic .rar, .r-mythic.card { background-image: var(--rainbow); background-size: 300% 100%; animation: rainbow 3s linear infinite; }
.r-mythic.card { background: var(--ivory); box-shadow: 0 4px 0 var(--ink), inset 0 0 0 3px #ff7aa8; animation: glow 2s ease-in-out infinite; }
@keyframes rainbow { to { background-position: 300% 0; } }
@keyframes glow { 50% { box-shadow: 0 4px 0 var(--ink), inset 0 0 0 3px #5cc8ff; } }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 14px;
  border: var(--edge); border-radius: 12px; background: linear-gradient(180deg, #fff3c4, var(--gold)); box-shadow: var(--lift);
  font-weight: 600; font-size: 15px; color: var(--ink);
}
.btn .ico { width: 20px; height: 20px; }
.btn.pink { background: linear-gradient(180deg, #ffd6e3, var(--pink)); }
.btn.plain { background: var(--ivory); }
.btn.violet { background: linear-gradient(180deg, #c9a6ff, #8b5cf6); color: #fff; text-shadow: 0 2px 0 var(--ink); }
.btn.big { width: 100%; min-height: 54px; font-size: 18px; }
.btn:disabled { filter: grayscale(.8); opacity: .55; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.center { text-align: center; }
.fine { font-size: 12px; color: var(--muted); }
.ivory { color: var(--ivory); }

/* Accueil */
.welcome { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 4vh; text-align: center; color: var(--ivory); }
.logo { font-family: var(--title); font-size: clamp(34px, 11vw, 48px); color: var(--gold); letter-spacing: 2px;
  text-shadow: 0 3px 0 #ff7aa8, 0 6px 0 var(--ink); }
.welcome .tag { font-size: 16px; background: var(--pink); color: #fff; border: var(--edge); border-radius: 10px; padding: 4px 12px; text-shadow: 0 2px 0 var(--ink); }
.welcome canvas.egg-big { width: 160px; height: 192px; }
.welcome .panel { color: var(--ink); text-align: left; width: 100%; }

/* Caisses et roulette */
.crate-row { display: flex; align-items: center; gap: 10px; }
.crate-row canvas { width: 72px; height: 64px; }
.crate-row .grow { flex: 1; }
.qty { display: flex; gap: 6px; margin: 8px 0; }
.qty button { flex: 1; min-height: 40px; border: var(--edge); border-radius: 10px; background: var(--ivory); font-weight: 600; box-shadow: 0 3px 0 var(--ink); }
.qty button[aria-pressed="true"] { background: var(--gold); }
.reels { display: flex; flex-direction: column; gap: 8px; }
.reel { position: relative; height: 84px; overflow: hidden; border: var(--edge); border-radius: 12px; background: #1d1239; box-shadow: inset 0 0 18px #000a; }
.reel .strip { position: absolute; top: 6px; left: 0; display: flex; gap: 6px; will-change: transform; }
.reel .cell { width: 72px; height: 70px; border-radius: 10px; display: grid; place-items: center; background: var(--ivory); box-shadow: inset 0 0 0 3px var(--rc); }
.reel .cell canvas { width: 56px; height: 56px; }
.reel::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; background: var(--gold); box-shadow: 0 0 10px var(--gold); }

/* Collection */
.dex { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dex button { aspect-ratio: 1; border: var(--edge); border-radius: 12px; background: var(--ivory); box-shadow: 0 3px 0 var(--ink), inset 0 0 0 3px var(--rc); padding: 4px; position: relative; display: grid; place-items: center; }
.dex button canvas { width: 86%; height: 86%; }
.dex button .q { position: absolute; font-family: var(--title); font-size: 22px; color: var(--ivory); text-shadow: 0 2px 0 var(--ink); }
.dex button small { position: absolute; bottom: 2px; left: 0; right: 0; font-size: 10px; }
.evo { display: flex; justify-content: space-between; align-items: flex-end; gap: 2px; }
.evo canvas { width: 18%; }

/* Liste de compagnons */
.mates { display: flex; flex-direction: column; gap: 8px; }
.mate { display: flex; align-items: center; gap: 10px; background: var(--ivory); border: var(--edge); border-radius: 14px; padding: 8px; box-shadow: 0 3px 0 var(--ink); }
.mate canvas { width: 56px; height: 56px; }
.mate .grow { flex: 1; min-width: 0; }
.mate b { display: block; font-size: 16px; }
.mate.active { box-shadow: 0 3px 0 var(--ink), inset 0 0 0 3px var(--gold); }

/* Journal */
.mem { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mem li { background: var(--ivory); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px; font-size: 14px; }
.mem time { display: block; font-size: 11px; color: var(--muted); }

/* Fenêtres, messages */
#modal-root .modal, .modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: #120826b3; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog, .pbox { width: min(400px, 100%); max-height: 90dvh; overflow-y: auto; background: var(--cream); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); padding: 16px; }
.dlg-title { font-family: var(--title); font-size: 16px; text-align: center; margin-bottom: 8px; }
.dlg-btns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.dlg-btns > * { flex: 1; }
.pbtn { min-height: 44px; border: var(--edge); border-radius: 12px; background: var(--ivory); box-shadow: var(--lift); font-weight: 600; padding: 6px 12px; }
.pbtn.primary { background: linear-gradient(180deg, #fff3c4, var(--gold)); }
.toast { position: fixed; left: 50%; top: 14px; z-index: 80; transform: translateX(-50%); max-width: 92vw;
  background: var(--ivory); border: var(--edge); border-radius: 12px; box-shadow: var(--lift); padding: 8px 14px; font-weight: 600;
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }
label.field { display: block; margin: 8px 0; font-size: 14px; }
label.field input, input.text { width: 100%; min-height: 44px; border: var(--edge); border-radius: 10px; padding: 6px 10px; font: inherit; background: #fff; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 2px dashed var(--cream-2); }
.switch:last-child { border-bottom: 0; }
.keybox { font-family: var(--title); font-size: 16px; text-align: center; background: #fff; border: var(--edge); border-radius: 10px; padding: 10px; word-break: break-all; user-select: all; }
a { color: var(--night-3); }

/* Mini-jeux (js/minigames.js) */
.game-box { text-align: center; }
.game-hud { display: flex; justify-content: space-between; font-weight: 600; margin: 6px 0; }
.game-area { position: relative; margin: 0 auto; }
.game-area canvas { width: 100%; border: var(--edge); border-radius: 12px; background: #fff; touch-action: none; }
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mem-card, .rh-pad { aspect-ratio: 1; border: var(--edge); border-radius: 12px; background: var(--ivory); box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; }
.mem-card .ico, .rh-pad .ico { width: 60%; }
.mem-card.up { background: #fff3c4; }
.mem-card.done { background: #d3ebc9; }
.rhythm-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rh-pad.lit { background: var(--gold); transform: translateY(2px); }
.lr-pick { display: flex; gap: 10px; margin-top: 10px; }
.lr-pick button { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.chip .txt { min-width: 0; }
canvas.dlg-art { width: 96px; height: 96px; }
canvas.dlg-art.big { width: 120px; height: 120px; }
.tabs button, .qty button { min-height: 44px; }
.theme-pair { display: flex; gap: 6px; width: 88%; }
.theme-pair canvas { flex: 1; min-width: 0; height: auto; }
.reel .cell.win { transform: scale(1.08); box-shadow: inset 0 0 0 3px var(--rc), 0 0 14px var(--gold); }
.dex-big { width: 128px; height: 128px; }
.evo span { width: 18%; text-align: center; font-size: 10px; }
.err, [role="alert"] { color: #c0283c; font-weight: 600; }
.build-bar { flex-wrap: wrap; }
.build-bar .hint { flex-basis: 100%; order: -1; }

/* ═════════════ Habillage arcade, passe 2 (2026-11-12) ═════════════
   Fond de nuit en pixel art (img/backdrop.png, tools/art/backdrop.mjs) + pétales animés (js/art/ambience.js),
   panneaux violets bordés de lumière, cartes à la couleur de leur rareté, tuiles de menu colorées. */
:root {
  --deep: #120826;
  --pane-1: #4b2c8a;
  --pane-2: #2c1859;
  --pane-line: #8f6ae0;
  --soft: #cdbcf2;
}
body { background: #1a0d38 url('../img/backdrop.png') center top / cover no-repeat fixed; image-rendering: pixelated; }
#ambience { position: fixed; inset: 0; width: 100vw; height: 100dvh; z-index: 0; pointer-events: none; image-rendering: pixelated; object-fit: cover; }
#app { z-index: 1; }
@media (min-width: 700px) {
  #app { background: #1d123980; }
}
.page { background: #1a0d38 url('../img/backdrop.png') center top / cover no-repeat; }
.page-head { background: linear-gradient(180deg, #170b33 0 72%, #170b3300); }

/* Panneaux violets à double bordure (sombre + liseré lumineux). */
.panel, .page .mate, .page .mem li {
  background: linear-gradient(180deg, var(--pane-1), var(--pane-2));
  color: var(--ivory);
  border: 3px solid var(--deep);
  box-shadow: inset 0 0 0 2px var(--pane-line), 0 4px 0 var(--deep), 0 0 18px #6b3fc840;
}
.panel .fine, .page .mate .fine, .page .fine { color: var(--soft); }
.page h3 { color: var(--gold); }
.mem time { color: var(--soft); }
.page .mate.active { box-shadow: inset 0 0 0 2px var(--gold), 0 4px 0 var(--deep), 0 0 18px #ffd23f55; }

/* Bannière de titre : plaque dorée à rubans roses. */
.banner {
  position: relative; color: #3b1d06; letter-spacing: 2px;
  background: linear-gradient(180deg, #fff6cf 0 18%, var(--gold) 19% 78%, var(--gold-2) 79%);
  border: 3px solid var(--deep); box-shadow: 0 4px 0 var(--deep), 0 0 16px #ffd23f66; text-shadow: 0 1px 0 #fff8;
}

/* Onglets : pastilles violettes, sélection dorée. */
.tabs button { background: linear-gradient(180deg, #5d39a3, #3a2172); color: var(--ivory); border-color: var(--deep); box-shadow: 0 3px 0 var(--deep); }
.tabs button[aria-selected="true"] { background: linear-gradient(180deg, #fff3c4, var(--gold)); color: var(--ink); }

/* Tuiles (menu du tiroir, catégories de la boutique) : une couleur par tuile, comme une borne d'arcade. */
.tile { color: var(--ivory); text-shadow: 0 2px 0 var(--deep); border-color: var(--deep); box-shadow: 0 4px 0 var(--deep), inset 0 3px 0 #ffffff40, inset 0 -4px 0 #00000030;
  background: linear-gradient(180deg, var(--t1, #8b5cf6), var(--t2, #5b2fc0)); }
.tile:nth-child(6n+1) { --t1: #b06cff; --t2: #7a3fd8; }
.tile:nth-child(6n+2) { --t1: #4fd1a5; --t2: #23977a; }
.tile:nth-child(6n+3) { --t1: #ff8fc0; --t2: #e0507f; }
.tile:nth-child(6n+4) { --t1: #ffbf4d; --t2: #e08a12; }
.tile:nth-child(6n+5) { --t1: #63b3ff; --t2: #2f73d8; }
.tile:nth-child(6n+6) { --t1: #9a7bff; --t2: #6040c8; }
.tile small, .cat small { color: #ffffffd0; }
.tile .ico { filter: drop-shadow(0 2px 0 #0006); }

/* Tiroir : feuille violette à poignée dorée. */
.drawer .sheet { background: linear-gradient(180deg, #4b2c8a, #2c1859 60%); border-color: var(--deep); box-shadow: inset 0 0 0 2px var(--pane-line), 0 -6px 24px #0008; }
.drawer .handle { color: var(--gold); text-shadow: 0 2px 0 var(--deep); }
.drawer .handle::before { background: var(--gold); opacity: 1; box-shadow: 0 2px 0 var(--deep); }
.drawer .chev { border-color: var(--gold); }

/* Cartes d'objets : 3 par ligne, fond sombre, cadre et lueur de la rareté ; on touche la carte pour le détail. */
.cards { grid-template-columns: repeat(3, 1fr); gap: 9px; }
.card {
  padding: 6px 5px 7px; gap: 4px; color: var(--ivory);
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 28%, #3a2172), #23124a);
  border: 3px solid var(--deep);
  box-shadow: inset 0 0 0 2px var(--rc), 0 4px 0 var(--deep), 0 0 12px color-mix(in srgb, var(--rc) 45%, transparent);
}
.card .art { position: relative; border-radius: 9px; border: 2px solid var(--deep);
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rc) 35%, #fff) 0 22%, color-mix(in srgb, var(--rc) 55%, #3a2172) 62%, #2a1656 100%); }
.card .art canvas { width: 92%; height: 92%; }
.card .nm { font-size: 12px; min-height: 2.4em; justify-content: center; text-shadow: 0 1px 0 var(--deep); }
.card .rar { font-size: 9px; padding: 0 5px; }
.card .fine { font-size: 10px; line-height: 1.15; }
.card .own { top: 4px; right: 4px; z-index: 1; background: var(--gold); color: var(--ink); border: 2px solid var(--deep); font-size: 10px; }
.card .own.on { background: var(--pink); color: #fff; }
.card .tag-price { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; color: var(--gold); text-shadow: 0 1px 0 var(--deep); }
.card .tag-price .ico { width: 16px; height: 16px; }
.card .tag-price.no { color: #ff9a9a; }
.card .tag-state { font-size: 11px; color: var(--soft); }
button.card { font: inherit; cursor: pointer; width: 100%; }
button.card:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px var(--rc), 0 1px 0 var(--deep); }
.card.r-mythic { background: linear-gradient(180deg, #4a2a8a, #23124a); }
.cards.wide { grid-template-columns: 1fr 1fr; }

/* Détail d'un objet (fenêtre) : grand aperçu. */
.item-hero { position: relative; margin: 0 auto 8px; width: 176px; aspect-ratio: 1; border-radius: 16px; border: 3px solid var(--deep);
  display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--rc), 0 0 20px color-mix(in srgb, var(--rc) 55%, transparent);
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rc) 30%, #fff) 0 25%, color-mix(in srgb, var(--rc) 55%, #3a2172) 65%, #2a1656 100%); }
.item-hero canvas { width: 92%; height: 92%; }
.item-hero.wide { width: 100%; aspect-ratio: auto; padding: 10px; }
.item-hero .theme-pair { width: 100%; }
.dialog .meta { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.dialog .meta .r-common, .dialog .rar { color: #fff; }
.try-row { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.try-row canvas { width: 48px; height: 48px; border-radius: 10px; border: 2px solid var(--deep); background: #2c1859; }

/* Fenêtres. */
.dialog, .pbox { border-color: var(--deep); box-shadow: 0 6px 0 var(--deep), 0 0 30px #6b3fc866; }

/* Messages en bas, au-dessus du tiroir : ne cachent plus les titres. */
.toast { top: auto; bottom: calc(72px + var(--safe-b)); transform: translateX(-50%) translateY(8px);
  background: linear-gradient(180deg, #fff6cf, var(--gold)); border-color: var(--deep); box-shadow: 0 4px 0 var(--deep), 0 0 16px #ffd23f66; }
.toast.show { transform: translateX(-50%); }

/* Écran principal : HUD, besoins en icônes, soins colorés, scène plus grande. */
.chip { background: linear-gradient(180deg, #fff, var(--cream)); border-color: var(--deep); }
.place-tag { color: var(--gold); }
.stage { width: min(100%, calc((100dvh - 346px) * 0.8036)); border-color: var(--deep);
  box-shadow: 0 5px 0 var(--deep), inset 0 0 0 3px #ffffff40, 0 0 0 3px var(--gold-2), 0 0 26px #ffd23f40; }
.needs { gap: 5px 6px; margin: 12px 0 8px; }
.need { display: flex; align-items: center; gap: 4px; padding: 3px 5px; background: linear-gradient(180deg, #4b2c8a, #2c1859); border-color: var(--deep);
  box-shadow: inset 0 0 0 1px var(--pane-line), 0 2px 0 var(--deep); }
.need .ico { width: 18px; height: 18px; flex: none; }
.need .bar { flex: 1; margin: 0; height: 9px; background: #1a0d38; border-color: var(--deep); }
.need .bar i { background: linear-gradient(180deg, #a5f28a, var(--green)); }
.need.mid .bar i { background: linear-gradient(180deg, #ffe58a, var(--gold)); }
.need.low .bar i { background: linear-gradient(180deg, #ff9a9a, var(--red)); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.act { color: var(--ivory); text-shadow: 0 2px 0 var(--deep); border-color: var(--deep); box-shadow: 0 4px 0 var(--deep), inset 0 3px 0 #ffffff40;
  background: linear-gradient(180deg, var(--a1, #8b5cf6), var(--a2, #5b2fc0)); }
.act[data-act="feed"] { --a1: #ffad5c; --a2: #e0701f; }
.act[data-act="drink"] { --a1: #6cc4ff; --a2: #2c7fd8; }
.act[data-act="wash"] { --a1: #5fe0c2; --a2: #1f9c86; }
.act[data-act="heal"] { --a1: #ff8a8a; --a2: #d8414f; }
.act[data-act="sleep"] { --a1: #8f8cff; --a2: #4d48c8; }
.act[data-act="talk"] { --a1: #c9a6ff; --a2: #8b5cf6; }
.act[data-act="play"] { --a1: #b06cff; --a2: #7a3fd8; }
.act[data-act="pat"] { --a1: #ff9cc6; --a2: #e0507f; }
.act.alert { background: linear-gradient(180deg, #fff3c4, var(--gold)); color: var(--ink); text-shadow: none; }
.act .ico { filter: drop-shadow(0 2px 0 #0006); }
.round { border-color: var(--deep); box-shadow: 0 3px 0 var(--deep); }

/* Mode construction : une rangée compacte en bas de la scène, la consigne en étiquette en haut. */
.build-bar { left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100% - 12px); flex-wrap: nowrap; gap: 5px; padding: 5px;
  background: #2c1859e6; border-color: var(--deep); box-shadow: inset 0 0 0 2px var(--pane-line), 0 3px 0 var(--deep); }
.build-bar .round { width: 38px; height: 38px; }
.build-bar .btn { min-height: 38px; font-size: 14px; }
.build-hint { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 86%; text-align: center; pointer-events: none;
  background: #2c1859e6; color: var(--ivory); border: 2px solid var(--deep); border-radius: 10px; padding: 3px 8px; font-size: 11px; box-shadow: inset 0 0 0 1px var(--pane-line); }

/* Accueil et éclosion : halo derrière l'œuf. */
.welcome .tag { border-color: var(--deep); }
.welcome .panel { color: var(--ivory); }
.welcome .panel .fine { color: var(--soft); }
.egg-halo { position: relative; display: grid; place-items: center; }
.egg-halo::before { content: ''; position: absolute; width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle, #ffe9a8bb 0, #ff9ec455 38%, #8b5cf600 70%); animation: halo 2.4s ease-in-out infinite; }
.egg-halo canvas { position: relative; }
@keyframes halo { 50% { transform: scale(1.12); opacity: .75; } }
.logo { text-shadow: 0 3px 0 #ff7aa8, 0 6px 0 var(--deep), 0 0 24px #ffd23f88; }

/* Roulette des caisses : caisse qui tremble, cadre néon, flèches, gagnant mis en avant. */
.spin-head { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 2px 0 12px; }
.spin-head canvas { width: 104px; height: 104px; }
.spin-head .shake { animation: shake .18s linear infinite; }
@keyframes shake { 25% { transform: rotate(-4deg) translateY(-1px); } 75% { transform: rotate(4deg); } }
.spin-progress { width: 70%; height: 14px; border: 3px solid var(--deep); border-radius: 8px; background: #1a0d38; overflow: hidden; box-shadow: inset 0 0 0 1px var(--pane-line); }
.spin-progress i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--pink) 0 8px, #ffc2da 8px 10px); }
.spin-label { color: var(--ivory); font-family: var(--title); font-size: 12px; letter-spacing: 1px; text-shadow: 0 2px 0 var(--deep); }
.reels { gap: 10px; }
.reel { height: 92px; border: 3px solid var(--deep); background: linear-gradient(180deg, #1d0f3f, #2c1859 50%, #1d0f3f);
  box-shadow: inset 0 0 0 2px #ff7aa8, 0 0 18px #ff7aa880, inset 0 0 22px #000c; }
.reel .strip { top: 8px; }
.reel .cell { border: 2px solid var(--deep); transition: transform .25s, filter .25s;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc) 35%, #fff) 0 20%, color-mix(in srgb, var(--rc) 50%, #3a2172) 75%); }
.reel::before { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, #120826 0, #12082600 24%, #12082600 76%, #120826 100%); }
.reel::after { z-index: 2; width: 2px; margin-left: -1px; background: #fff1b8; box-shadow: 0 0 6px var(--gold), 0 0 14px var(--gold); opacity: .8; }
.reel .pin { position: absolute; left: 50%; z-index: 3; width: 0; height: 0; margin-left: -9px; border-left: 9px solid transparent; border-right: 9px solid transparent; }
.reel .pin.top { top: 0; border-top: 11px solid var(--gold); filter: drop-shadow(0 2px 0 var(--deep)); }
.reel .pin.bot { bottom: 0; border-bottom: 11px solid var(--gold); filter: drop-shadow(0 -2px 0 var(--deep)); }
.reel.stopped .cell { filter: brightness(.42) saturate(.6); }
.reel.stopped .cell.win { filter: none; transform: scale(1.1); box-shadow: 0 0 0 3px var(--gold), 0 0 22px var(--gold); position: relative; z-index: 2; animation: winPulse 1s ease-in-out infinite; }
.reel.stopped::after { opacity: 0; }
@keyframes winPulse { 50% { box-shadow: 0 0 0 3px #fff1b8, 0 0 32px var(--gold); } }
.reel-tag { text-align: center; margin: -4px 0 2px; font-weight: 600; color: var(--ivory); text-shadow: 0 2px 0 var(--deep); min-height: 1.2em; font-size: 14px; }
.reel-tag .rar { margin-left: 4px; font-size: 10px; }
.sparkles { position: fixed; inset: 0; z-index: 70; pointer-events: none; image-rendering: pixelated; width: 100vw; height: 100dvh; }

/* Collection : progression et filtres par rareté. */
.dex-progress { height: 14px; border: 3px solid var(--deep); border-radius: 8px; background: #1a0d38; overflow: hidden; margin: 8px 0 2px; }
.dex-progress i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--gold) 0 8px, #fff1b8 8px 10px); }
.dex button { border-color: var(--deep); box-shadow: 0 3px 0 var(--deep), inset 0 0 0 2px var(--rc);
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rc) 25%, #fff) 0 30%, color-mix(in srgb, var(--rc) 45%, #3a2172) 88%); }
.dex button[data-unknown] { background: linear-gradient(180deg, #3a2172, #23124a); }
.dex button small { color: var(--ivory); font-size: 10px; text-shadow: 0 1px 0 var(--deep), 1px 0 0 var(--deep), -1px 0 0 var(--deep), 0 -1px 0 var(--deep); }
.dex button .stars { position: absolute; top: 2px; left: 4px; font-size: 9px; color: var(--gold); text-shadow: 0 1px 0 var(--deep); letter-spacing: -1px; }
.dex button .num { position: absolute; top: 2px; right: 5px; font-size: 9px; color: var(--ivory); text-shadow: 0 1px 0 var(--deep); }
.pips { display: flex; gap: 8px; }
.pips i { width: 14px; height: 14px; border: 3px solid var(--deep); border-radius: 4px; background: #2c1859; box-shadow: inset 0 0 0 1px var(--pane-line); transition: background .15s, transform .15s; }
.pips i.on { background: var(--gold); transform: scale(1.15); box-shadow: 0 0 10px var(--gold); }

.qty button { color: var(--ink); }
.cat canvas.ico { width: 64px; height: 64px; }
.tiles .tile { min-height: 76px; }
.spin-head.compact { flex-direction: row; justify-content: center; gap: 10px; margin-bottom: 8px; }
.spin-head.compact canvas { width: 64px; height: 64px; }
.spin-head.compact .col { display: flex; flex-direction: column; gap: 6px; flex: 1; max-width: 220px; }
.spin-head.compact .spin-progress { width: 100%; }
.spin-head .col { display: contents; }
.spin-head.compact .col { display: flex; }

/* Choix du jeu : trois grandes cartes (une couleur par jeu), puis les petits jeux. */
.game-cards { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 10px; }
.game-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; text-align: left; color: var(--ivory); text-shadow: 0 2px 0 var(--deep);
  border: 3px solid var(--deep); border-radius: 16px; box-shadow: 0 4px 0 var(--deep), inset 0 3px 0 #ffffff40; background: linear-gradient(180deg, var(--g1), var(--g2)); }
.game-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep); }
.game-card:disabled { filter: grayscale(.7); opacity: .6; }
.g-arena { --g1: #ff7a8a; --g2: #c2305a; }
.g-dream { --g1: #9a7bff; --g2: #4d3aa8; }
.g-shift { --g1: #4fd1c5; --g2: #237a8a; }
.gc-ico { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; background: #ffffff30; border: 2px solid var(--deep); }
.gc-ico .ico { width: 34px; height: 34px; }
.gc-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.gc-txt b { font-family: var(--title); font-size: 14px; letter-spacing: 1px; }
.gc-txt small { font-size: 12px; opacity: .95; }
.gc-prize { flex: none; display: flex; align-items: center; gap: 2px; font-size: 13px; }
.gc-prize .ico { width: 18px; height: 18px; }
.small-games { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.small-games .btn { font-size: 13px; min-height: 44px; }
.reward-coins { font-size: 24px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.reward-coins .ico { width: 30px; height: 30px; }
.rar-reel { position: relative; height: 72px; overflow: hidden; border: 3px solid var(--deep); border-radius: 12px; background: #1d0f3f; box-shadow: inset 0 0 0 2px #ff7aa8, inset 0 0 18px #000c; margin: 8px 0; }
.rar-reel::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff1b8; box-shadow: 0 0 10px var(--gold); }
.rr-strip { position: absolute; top: 6px; left: 0; display: flex; gap: 8px; will-change: transform; }
.rr-cell { width: 56px; height: 56px; flex: none; display: grid; place-items: center; border-radius: 10px; border: 2px solid var(--deep);
  background: radial-gradient(circle, color-mix(in srgb, var(--rc) 45%, #fff) 0 30%, color-mix(in srgb, var(--rc) 60%, #2c1859) 80%); }
.rr-cell canvas { width: 48px; height: 48px; }
.rr-cell.win { box-shadow: 0 0 0 3px var(--gold), 0 0 18px var(--gold); }
.rr-label { font-weight: 600; }
.egg-halo.burst::before { animation: haloBurst .5s ease-in-out infinite; }
@keyframes haloBurst { 50% { transform: scale(1.35); opacity: 1; } }

/* Journal : fiche du compagnon, ligne de vie, frise des souvenirs. */
.profile { display: flex; align-items: center; gap: 12px; }
.portrait { flex: none; width: 96px; height: 96px; border-radius: 16px; border: 3px solid var(--deep); display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px var(--rc), 0 0 16px color-mix(in srgb, var(--rc) 50%, transparent);
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rc) 30%, #fff) 0 25%, color-mix(in srgb, var(--rc) 55%, #3a2172) 70%, #2a1656); }
.portrait canvas { width: 88px; height: 88px; }
.pname { display: block; font-family: var(--title); font-size: 18px; letter-spacing: 1px; color: var(--gold); text-shadow: 0 2px 0 var(--deep); }
.traits { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip-s { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; background: #ffffff22; border: 2px solid var(--deep); border-radius: 8px; padding: 1px 7px; }
.chip-s .ico { width: 14px; height: 14px; }
.lifeline { display: flex; align-items: flex-end; justify-content: space-between; gap: 2px; }
.ll-step { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; width: 17%; }
.ll-step canvas { width: 100%; aspect-ratio: 1; }
.ll-step.next { opacity: .55; }
.ll-step.now span { color: var(--gold); font-weight: 600; }
.ll-step.now canvas { filter: drop-shadow(0 0 4px var(--gold)); }
.ll-arrow { font-style: normal; color: var(--soft); align-self: center; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; position: relative; display: flex; flex-direction: column; gap: 8px; }
.timeline::before { content: ''; position: absolute; left: 30px; top: 6px; bottom: 6px; width: 3px; background: var(--pane-line); border-radius: 2px; }
.timeline li { position: relative; display: flex; align-items: center; gap: 10px; }
.tl-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--deep); background: #2c1859; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--pane-line); z-index: 1; }
.tl-ico canvas, .tl-ico .ico { width: 28px; height: 28px; }
.tl-txt { flex: 1; background: linear-gradient(180deg, var(--pane-1), var(--pane-2)); color: var(--ivory); border: 2px solid var(--deep); border-radius: 10px; padding: 5px 9px; font-size: 14px; box-shadow: inset 0 0 0 1px var(--pane-line); }
.tl-txt time { display: block; font-size: 11px; color: var(--soft); }
.memorial-empty .portrait { margin: 4px auto 8px; }
.flash { position: fixed; inset: 0; z-index: 90; pointer-events: none; background: radial-gradient(circle at 50% 35%, #fffef5, #fff3c4cc 40%, #ffd23f00 80%); animation: flashOut .7s ease-out forwards; }
@keyframes flashOut { from { opacity: 1; } to { opacity: 0; } }
.ll-step.next canvas { filter: brightness(2.6) saturate(0); opacity: .7; }
body:has(#modal-root > *) .toast { top: 14px; bottom: auto; }

/* Objectifs du jour */
.round.ready { background: linear-gradient(180deg, #fff3c4, var(--gold)); animation: nudge 1.6s infinite; }
.round.ready::after { content: ''; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--pink); border: 2px solid var(--deep); }
.round { position: relative; }
.stage .corner.left { flex-direction: column; }
.quests { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.quest { display: flex; align-items: center; gap: 8px; background: #fff; border: 3px solid var(--deep); border-radius: 12px; padding: 8px; box-shadow: 0 3px 0 var(--deep); }
.quest.ready { background: #fff6cf; box-shadow: 0 3px 0 var(--deep), inset 0 0 0 2px var(--gold); }
.quest.done { opacity: .6; }
.q-ico { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--cream); border: 2px solid var(--deep); }
.q-ico .ico { width: 24px; height: 24px; }
.quest b { font-size: 14px; }
.quest .fine .ico { width: 14px; height: 14px; vertical-align: -2px; }
.q-bar { height: 10px; border: 2px solid var(--deep); border-radius: 6px; background: var(--cream-2); overflow: hidden; margin: 4px 0 2px; }
.q-bar i { display: block; height: 100%; background: linear-gradient(180deg, #a5f28a, var(--green)); }
.q-ok { font-size: 22px; color: var(--green); font-weight: 700; }
.q-all { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.q-all .q-bar { flex: 1; }
.q-all .q-bar i { background: linear-gradient(180deg, #fff1b8, var(--gold)); }
.q-all .ico { width: 20px; height: 20px; }
.stage { min-width: 150px; }
@media (max-height: 600px) { .needs { margin: 8px 0 6px; gap: 4px; } .act { min-height: 46px; padding: 5px 2px 4px; } .care { gap: 6px; } }

/* ═════════════ Passe 3 : interface (2026-11-17) ═════════════
   La scène d'abord : barre du haut fine, jauges en surimpression sur le mur, une seule rangée de soins,
   tiroir à languette. Échelle d'espacement 4 / 6 / 8 / 12 / 16 ; cibles tactiles ≥ 44 px. */
:root { --tap: 44px; --gap: 6px; --r-s: 10px; --r-m: 14px; --r-l: 20px; --tab-h: 44px; --safe-t: var(--sa-t); }
#screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ── Écran principal : hauteur fixe, la scène prend toute la place restante ── */
#app:has(> #screen > .home) { height: 100dvh; min-height: 0; padding: calc(6px + var(--safe-t)) 8px calc(var(--tab-h) + 8px + var(--safe-b)); }
@media (min-width: 700px) { #app:has(> #screen > .home) { height: calc(100dvh - 32px); } }
.home { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--gap); }

.hud { flex: none; margin: 0; gap: var(--gap); height: var(--tap); }
.hud .chip { height: var(--tap); min-height: 0; padding: 3px 10px 3px 4px; gap: 6px; border-radius: var(--r-m); text-align: left; box-shadow: 0 3px 0 var(--deep); }
.hud .chip canvas { flex: none; width: 34px; height: 34px; border-radius: 9px; border: 2px solid var(--deep);
  background: radial-gradient(circle at 50% 40%, #fff 0 30%, #f3e3ff 75%); }
.chip .txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.chip .name { font-size: 15px; }
.chip .sub { font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.hud-tools { display: flex; gap: var(--gap); flex: none; }
.hud .round { width: var(--tap); height: var(--tap); border-radius: var(--r-m); background: linear-gradient(180deg, #fff, var(--cream)); }
.hud .round .ico { width: 24px; height: 24px; }
.hud .round.on { background: linear-gradient(180deg, #fff3c4, var(--gold)); }
.hud .pill.coins { flex: none; height: var(--tap); min-height: 0; padding: 0 10px 0 6px; border-radius: var(--r-m); font-size: 16px; border-color: var(--deep); box-shadow: 0 3px 0 var(--deep); }
.hud .pill.coins .n { font-variant-numeric: tabular-nums; }
.hud .round, .hud .chip, .hud .pill { transition: transform .08s, box-shadow .08s; }
.hud .round:active, .hud .chip:active, .hud .pill:active { transform: translateY(3px); box-shadow: 0 0 0 var(--deep); }

.stage-wrap { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; }
.stage { width: min(calc(100cqw - 6px), calc((100cqh - 8px) * 0.80357)); min-width: 0; margin: 0; border-width: 3px; border-radius: var(--r-l); }
.stage .corner { display: none; }

/* Jauges en surimpression : une barre de verre sombre sur le haut du mur ; on la touche pour tout voir. */
.stage .needs {
  position: absolute; z-index: 2; top: 6px; left: 6px; right: 6px; margin: 0; display: flex; align-items: center; gap: 4px;
  min-height: 36px; padding: 4px 6px; border: 2px solid var(--deep); border-radius: 12px; cursor: pointer;
  background: #1a0d38c4; box-shadow: inset 0 0 0 1px #8f6ae099, 0 2px 0 #12082680; color: var(--ivory);
  transition: transform .08s;
}
.stage .needs:active { transform: translateY(2px); }
.stage .needs:focus-visible, .act:focus-visible, .round:focus-visible, .tile:focus-visible, .btn:focus-visible, .pbtn:focus-visible, .chip:focus-visible, .pill:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.stage .need { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; padding: 0; border: 0; background: none; box-shadow: none; border-radius: 0; }
.stage .need .ico { width: 16px; height: 16px; flex: none; filter: drop-shadow(0 1px 0 #000a); }
.stage .need .bar { flex: 1; min-width: 10px; height: 8px; margin: 0; border: 2px solid var(--deep); border-radius: 3px; background: #0d0620; box-shadow: 0 0 0 1px #8f6ae055; }
.stage .need.low .ico { animation: needPulse 1s ease-in-out infinite; }
.stage .need.sick { flex: none; padding: 1px; border-radius: 6px; background: var(--red); box-shadow: 0 0 0 2px var(--deep); animation: needPulse 1s ease-in-out infinite; }
@keyframes needPulse { 50% { transform: scale(1.25); } }
.stage:has(.build-bar) .needs { display: none; }
.stage[data-place="garden"] { box-shadow: 0 5px 0 var(--deep), inset 0 0 0 3px #ffffff40, 0 0 0 3px #6fcf4f, 0 0 26px #6fcf4f40; }

/* Rangée de soins : six grandes touches (la 3e change : Laver ou Soigner), la dernière ouvre tous les soins. */
.home .care { flex: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.act { min-height: 58px; padding: 6px 1px 5px; gap: 2px; font-size: 11px; border-radius: var(--r-m); transition: transform .08s, box-shadow .08s; }
.act .ico { width: 26px; height: 26px; }
.act > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep), inset 0 3px 0 #ffffff40; }
.act.on { box-shadow: 0 4px 0 var(--deep), inset 0 0 0 2px var(--gold), inset 0 3px 0 #ffffff40; }
.act.more { --a1: #fffaf0; --a2: #e6d6b8; color: var(--ink); text-shadow: none; }
.act.more.alert { --a1: #ffe0ec; --a2: var(--pink-2); }
.dots { display: flex; gap: 3px; height: 26px; align-items: center; }
.dots i { width: 6px; height: 6px; background: var(--ink); box-shadow: 0 2px 0 #0003; }
.act.alert { animation: nudge 1.6s infinite; }
@media (max-height: 600px) { .act { min-height: 50px; padding: 4px 1px 3px; } .act .ico { width: 22px; height: 22px; } .dots { height: 22px; } }
@media (max-width: 340px) { .act { font-size: 10px; } }

/* Tous les soins (fenêtre « Plus ») : 4 × 2 tuiles. */
.care.care-all { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 4px 0; }
.care-all .act { min-height: 72px; font-size: 12px; }
.care-all .act .ico { width: 30px; height: 30px; }

/* Choix du repas. */
.foods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.food { position: relative; flex-direction: column; min-height: 84px; padding: 8px 4px; font-size: 14px; }
.food .ico { width: 30px; height: 30px; }
.food.fav { background: linear-gradient(180deg, #fff6cf, #ffe58a); box-shadow: var(--lift), inset 0 0 0 2px var(--gold-2); }
.food .star { position: absolute; top: 3px; right: 6px; color: var(--gold-3); font-size: 14px; }

/* ── Tiroir : languette de 44 px, feuille qui monte avec un petit rebond, suit le doigt ── */
.drawer .sheet { transform: translateY(calc(100% - var(--tab-h) - var(--safe-b))); transition: transform .42s cubic-bezier(.22, 1.25, .36, 1); padding: 0 12px calc(14px + var(--safe-b)); border-width: 3px; border-radius: 22px 22px 0 0; }
.drawer .sheet.drag { transition: none; }
.drawer .handle { flex-direction: row; gap: 8px; height: var(--tab-h); font-size: 12px; position: relative; }
.drawer .handle::before { position: absolute; top: 5px; left: 50%; width: 40px; height: 5px; margin-left: -20px; }
.drawer .handle > span:last-child { margin-top: 6px; }
.drawer .chev { width: 10px; height: 10px; border-width: 3px; margin-top: 10px; }
.drawer .tiles { gap: 8px; padding: 2px 0 4px; }
.drawer .tiles .tile { min-height: 74px; border-radius: var(--r-m); font-size: 13px; gap: 3px; padding: 4px 2px; transition: transform .08s, box-shadow .08s; }
.drawer .tile .ico { width: 32px; height: 32px; }
.drawer .tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .tiles .tile .dot { top: 4px; right: 6px; }
.drawer:not(.open) .tiles { visibility: hidden; transition: visibility 0s .42s; }
.drawer.open .tiles { visibility: visible; }
.drawer .sheet.drag .tiles { visibility: visible; }

/* ── Fenêtres : apparition « pop », variante feuille du bas ── */
#modal-root .modal { animation: fade .16s ease-out; }
.dialog { animation: dlgPop .24s cubic-bezier(.2, 1.35, .4, 1); padding: 14px; border-width: 3px; border-radius: var(--r-l); }
@keyframes dlgPop { from { transform: scale(.86); opacity: 0; } }
.modal.as-sheet { place-items: end center; padding: 0; }
.modal.as-sheet .dialog { width: min(440px, 100%); max-height: 86dvh; border-radius: 22px 22px 0 0; border-bottom: 0; padding: 12px 14px calc(14px + var(--safe-b));
  animation: sheetUp .32s cubic-bezier(.22, 1.2, .36, 1); }
.modal.as-sheet .dialog::before { content: ''; display: block; width: 40px; height: 5px; margin: -4px auto 10px; border-radius: 3px; background: var(--cream-2); box-shadow: 0 1px 0 #fff; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.dlg-title { display: block; width: fit-content; max-width: 100%; margin: 0 auto 10px; padding: 5px 14px; font-size: 14px; letter-spacing: 1px; color: #3b1d06;
  background: linear-gradient(180deg, #fff6cf 0 18%, var(--gold) 19% 78%, var(--gold-2) 79%); border: 3px solid var(--deep); border-radius: 10px; box-shadow: 0 3px 0 var(--deep); text-shadow: 0 1px 0 #fff8; overflow-wrap: anywhere; }
.dlg-btns { gap: 8px; margin-top: 12px; }
.dlg-btns > * { flex: 1 1 120px; }
.pbtn { border-color: var(--deep); box-shadow: 0 4px 0 var(--deep); transition: transform .08s, box-shadow .08s; font-size: 15px; }
.pbtn:active, .btn:active, .qty button:active, .tabs button:active, .dex button:active, .game-card:active, .food:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--deep); }
.pbtn:disabled { opacity: .5; filter: grayscale(.7); }
.dialog p { line-height: 1.35; }
.dialog .fine { color: var(--muted); }
.dialog h4 { margin: 12px 0 6px; }

/* Fiche des besoins. */
.n-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.n-head .portrait { width: 76px; height: 76px; }
.n-head .portrait canvas { width: 68px; height: 68px; }
.dialog .pname { color: var(--ink); text-shadow: none; font-size: 17px; overflow-wrap: anywhere; }
.dialog .chip-s { background: #fff; border-color: var(--deep); font-size: 12px; }
.dialog .chip-s.bad { background: #ffd0d6; }
.nlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.nrow { display: grid; grid-template-columns: 20px 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 5px; row-gap: 2px;
  background: #fff; border: 2px solid var(--deep); border-radius: var(--r-s); padding: 5px 7px; }
.nrow .n-ico { grid-row: 1 / 3; display: grid; place-items: center; }
.nrow .n-ico .ico { width: 18px; height: 18px; }
.nrow .n-lbl { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nrow .n-val { font-size: 11px; color: var(--muted); white-space: nowrap; }
.nrow .bar { grid-column: 2 / 4; height: 8px; border: 2px solid var(--deep); border-radius: 3px; background: var(--cream-2); overflow: hidden; }
.nrow .bar i { display: block; height: 100%; background: linear-gradient(180deg, #a5f28a, var(--green)); }
.nrow.mid .bar i { background: linear-gradient(180deg, #ffe58a, var(--gold)); }
.nrow.low { background: #fff0f2; }
.nrow.low .bar i { background: linear-gradient(180deg, #ff9a9a, var(--red)); }
.nrow.low .n-val { color: #c0283c; font-weight: 600; }

/* ── Pages : entrée en glissant depuis la droite, sortie inverse ── */
.page { animation: pageIn .26s cubic-bezier(.2, .9, .3, 1); }
.page.leaving { animation: pageOut .2s ease-in forwards; pointer-events: none; }
@keyframes pageIn { from { transform: translateX(28%); opacity: 0; } }
@keyframes pageOut { to { transform: translateX(28%); opacity: 0; } }
.page .inner { padding: calc(4px + var(--safe-t)) 12px calc(28px + var(--safe-b)); }
.page-head { gap: 8px; padding: 6px 0 10px; }
.page-head .round { flex: none; width: var(--tap); height: var(--tap); background: linear-gradient(180deg, #fff, var(--cream)); }
.page-head .pill.coins { flex: none; min-height: var(--tap); border-color: var(--deep); box-shadow: 0 3px 0 var(--deep); }
.banner { min-width: 0; font-size: clamp(13px, 4.4vw, 17px); padding: 9px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--r-s); }
.panel { border-radius: var(--r-m); }
.page h3 { margin: 16px 4px 8px; }
.empty { padding: 18px 12px; }
.empty p { color: var(--soft); }

/* Onglets (inventaire, journal, collection) : défilement horizontal, sans barre. */
.tabs { gap: 6px; padding: 2px 2px 10px; margin: 0 -2px; scroll-snap-type: x proximity; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { scroll-snap-align: start; white-space: nowrap; border-radius: var(--r-s); padding: 6px 12px; transition: transform .08s, box-shadow .08s; }

/* Boutique : rail de catégories à icône + filtre de rareté + grille 3 colonnes. */
.tabs.rail { gap: 6px; padding-bottom: 8px; }
.tabs.rail button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 70px; padding: 5px 6px 4px; font-size: 12px; }
.rail-ico { width: 30px; height: 30px; display: grid; place-items: center; }
.rail-ico canvas, .rail-ico .ico { width: 30px; height: 30px; }
.rfilter { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 0 2px 10px; }
.rfilter::-webkit-scrollbar { display: none; }
.rfilter button { position: relative; flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 2px 10px; border-radius: 18px; font-size: 12px; font-weight: 600;
  color: var(--ivory); background: #2c1859; border: 2px solid var(--deep); box-shadow: inset 0 0 0 1px var(--pane-line); }
.rfilter button i { width: 10px; height: 10px; border-radius: 2px; background: var(--rc); border: 2px solid var(--deep); }
.rfilter .r-mythic i { background: var(--rainbow); }
.rfilter button[aria-pressed="true"] { background: linear-gradient(180deg, #fff3c4, var(--gold)); color: var(--ink); box-shadow: 0 2px 0 var(--deep); }
.rfilter button::after { content: ''; position: absolute; inset: -5px 0; }

/* Cartes : hauteur régulière, nom sur deux lignes au plus. */
.card { border-radius: var(--r-m); }
.card .nm { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; line-height: 1.2em; overflow-wrap: anywhere; }
.card .tag-state { line-height: 1.15; overflow-wrap: anywhere; }
.card .rar { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Caisses. */
.crate-row b { font-size: 15px; }
.crate-row .pill { flex: none; }
.qty button { border-color: var(--deep); box-shadow: 0 3px 0 var(--deep); }

/* Collection : numéros et étoiles lisibles. */
.dex { gap: 7px; }
.dex button { border-radius: var(--r-s); }
.dex button small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }

/* Choix du jeu : deux grands jeux + quatre petits. */
.game-card { min-height: 76px; }
.gc-txt small { line-height: 1.2; }
.small-games .btn { justify-content: flex-start; padding: 6px 10px; }
.dialog h4.fine { font-family: var(--title); letter-spacing: 1px; font-size: 11px; color: var(--muted); margin: 12px 0 6px; }

/* Objectifs. */
.quest b { display: block; line-height: 1.2; }
.quest .btn { min-height: 40px; padding: 4px 10px; font-size: 13px; flex: none; }

/* Messages : pastille dorée au-dessus de la rangée de soins. */
.toast { bottom: calc(var(--tab-h) + 74px + var(--safe-b)); max-width: min(92vw, 400px); text-align: center; border-width: 3px; }
body:has(.page) .toast { bottom: calc(18px + var(--safe-b)); }

/* Chargement et erreur réseau. */
.welcome .loading { width: 48px; height: 12px; display: flex; gap: 6px; justify-content: center; }
.welcome .loading i { width: 10px; height: 10px; background: var(--gold); box-shadow: 0 2px 0 var(--deep); animation: dotHop 0.9s ease-in-out infinite; }
.welcome .loading i:nth-child(2) { animation-delay: .15s; }
.welcome .loading i:nth-child(3) { animation-delay: .3s; }
@keyframes dotHop { 50% { transform: translateY(-6px); } }

/* Accueil et éclosion : tout tient sur un petit écran. */
.welcome { gap: 12px; padding: 3vh 4px 12px; }
.welcome .panel p { margin: 4px 0; }
.welcome .btn.big { max-width: 360px; }
@media (max-height: 600px) { .welcome canvas.egg-big { width: 120px; height: 144px; } .egg-halo::before { width: 170px; height: 170px; } .welcome { gap: 8px; } }

@media (prefers-reduced-motion: reduce) {
  .page, .page.leaving, .dialog, .modal.as-sheet .dialog { animation: none !important; }
  .drawer .sheet { transition: none; }
}

/* Passe 3, retouches après essai dans le navigateur. */
.stage { width: min(100%, calc((100dvh - 346px) * 0.8036)); }
.stage-wrap > .stage { width: min(calc(100cqw - 6px), calc((100cqh - 8px) * 0.80357)); }
.visit-stage { width: min(100%, calc((100dvh - 250px) * 0.8036)); margin: 0 auto 12px; }
.stage .round.gift { position: absolute; z-index: 2; top: 52px; right: 8px; width: var(--tap); height: var(--tap); border-radius: var(--r-m);
  background: linear-gradient(180deg, #fff3c4, var(--gold)); animation: giftHop 1.4s ease-in-out infinite; }
.stage .round.gift::after { content: ''; position: absolute; top: -4px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--pink); border: 2px solid var(--deep); }
@keyframes giftHop { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-5px) rotate(-6deg); } 90% { transform: translateY(-2px) rotate(5deg); } }
.stage .needs.more-low::after { content: ''; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); border: 2px solid var(--deep); animation: needPulse 1s ease-in-out infinite; }
.pill { color: var(--ink); text-shadow: none; }
.banner { white-space: normal; overflow-wrap: anywhere; line-height: 1.15; letter-spacing: 1px; }
.drawer .sheet { transform: translateY(calc(100% - var(--tab-h) - 3px - var(--safe-b))); }
.drawer.open .sheet { transform: none; }
body:has(.drawer.open) .toast { top: 14px; bottom: auto; }
@media (max-height: 760px) {
  .welcome canvas.egg-big { width: 120px; height: 144px; }
  .egg-halo::before { width: 180px; height: 180px; }
  .welcome .logo { font-size: clamp(30px, 10vw, 42px); }
  .welcome .panel { padding: 10px 12px; font-size: 15px; }
}
.toast { width: max-content; }
.stage .needs { min-height: 40px; }
/* Grands téléphones (écran très allongé) : la scène est limitée par la largeur ; on agrandit les commandes. */
@media (max-aspect-ratio: 1/1.9) and (min-height: 760px) {
  .home { gap: 10px; }
  .home .care { gap: 7px; }
  .act { min-height: 72px; font-size: 12px; gap: 4px; }
  .act .ico { width: 32px; height: 32px; }
  .dots { height: 32px; }
  .stage .needs { min-height: 44px; }
  .stage .need .ico { width: 20px; height: 20px; }
  .stage .need .bar { height: 10px; }
}
.card .nm { font-size: clamp(10px, 3.3vw, 12px); overflow-wrap: normal; word-break: normal; hyphens: auto; }
@media (max-width: 340px) {
  .hud .pill.coins { font-size: 14px; padding: 0 7px 0 4px; gap: 3px; }
  .hud .pill.coins .ico { width: 18px; height: 18px; }
  .hud .chip { padding-right: 6px; }
  .hud .chip .sub { display: none; }
}

/* ═════════════ Passe 4 : pixel art cohérent, mise en page des grands écrans, effets (2026-11-12) ═════════════
   1 pixel du jeu = 3 px CSS. Cadres en pixels (SVG 9 tranches, servis en data:, compatibles CSP) :
     --fr-bevel : contour sombre + biseau (lumière en haut à gauche), coins arrondis d'un pixel ;
     --fr-ring  : contour sombre seul, l'anneau intérieur laisse voir la couleur de bordure (--ring, rareté…) ;
     --fr-thin  : contour d'un pixel, coins coupés (petites pastilles, jauges, bulles).
   Le « pied » (ombre portée) est une ombre nette sans flou ; plus aucune lueur floue ni verre dépoli. */
:root {
  --u: 3px;
  --deep: #120826;
  --fr-bevel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='5' shape-rendering='crispEdges'%3E%3Cpath fill='%23120826' d='M1 0h3v1H1zM0 1h1v4H0zM4 1h1v4H4zM1 4h3v1H1zM1 1h1v1H1zM3 1h1v1H3zM1 3h1v1H1zM3 3h1v1H3z'/%3E%3Cpath fill='%23fff' fill-opacity='.42' d='M2 1h1v1H2zM1 2h1v1H1z'/%3E%3Cpath fill='%23000' fill-opacity='.24' d='M3 2h1v1H3zM2 3h1v1H2z'/%3E%3C/svg%3E");
  --fr-ring: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='5' shape-rendering='crispEdges'%3E%3Cpath fill='%23120826' d='M1 0h3v1H1zM0 1h1v4H0zM4 1h1v4H4zM1 4h3v1H1zM1 1h1v1H1zM3 1h1v1H3zM1 3h1v1H1zM3 3h1v1H3z'/%3E%3C/svg%3E");
  --fr-thin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='3' height='3' shape-rendering='crispEdges'%3E%3Cpath fill='%23120826' d='M1 0h1v1H1zM0 1h1v1H0zM2 1h1v1H2zM1 2h1v1H1z'/%3E%3C/svg%3E");
  --clip-lip: polygon(3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% 100%, calc(100% - 3px) 100%, calc(100% - 3px) calc(100% + 3px), 3px calc(100% + 3px), 3px 100%, 0 100%, 0 3px, 3px 3px);
  --clip-notch: polygon(3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px), 0 3px, 3px 3px);
  --clip-top: polygon(3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% 100%, 0 100%, 0 3px, 3px 3px);
  --lip: drop-shadow(0 3px 0 #120826);
  --plinth-h: 50px;
}

/* ── Cadres : biseau + pied (boutons et touches) ── */
:is(.btn, .pbtn, .act, .tile, .round, .hud .chip, .pill.coins, .tabs button, .qty button, .game-card, .mem-card, .rh-pad, .lr-pick button, .toast, .banner, .dlg-title, .panel, .quest, .mate, .seg-part button) {
  border: 6px solid transparent !important; border-image: var(--fr-bevel) 2 / 6px / 0 stretch !important;
  border-radius: 0 !important; clip-path: var(--clip-lip); filter: var(--lip); box-shadow: none !important;
}
/* Pied plus discret pour les éléments posés dans un panneau. */
:is(.tabs button, .qty button, .quest, .mate) { filter: drop-shadow(0 3px 0 #12082699); }
/* Appui : la touche descend sur son pied. */
:is(.btn, .pbtn, .act, .tile, .round, .hud .chip, .pill.coins, .tabs button, .qty button, .game-card, .mem-card, .rh-pad, .lr-pick button, .seg-part button, button.card, .dex button):active:not(:disabled) {
  transform: translateY(3px) !important; filter: none !important;
}
:is(.btn, .pbtn, .act, .game-card, .qty button, .tabs button):disabled { filter: grayscale(.8) var(--lip); opacity: .55; }
/* Focus clavier : un liseré doré À L'INTÉRIEUR du cadre (le cadre découpe tout ce qui dépasse). */
:is(.btn, .pbtn, .act, .tile, .round, .chip, .pill, .tabs button, .qty button, .game-card, button.card, .dex button, .needs):focus-visible { outline: 3px solid var(--gold) !important; outline-offset: -9px !important; }

/* ── Cadres à anneau coloré (cartes, scène, portraits) : l'anneau prend la couleur --ring ── */
:is(.card, .dex button, .stage, .item-hero, .portrait, .rv-face) {
  --ring: var(--rc, var(--pane-line));
  border: 6px solid transparent !important; border-image: var(--fr-ring) 2 / 6px / 0 stretch !important;
  border-radius: 0 !important; clip-path: var(--clip-lip); filter: var(--lip); box-shadow: none !important;
  background-clip: padding-box, border-box !important; background-origin: padding-box, border-box;
}
.card { background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 26%, #3a2172), #23124a) padding-box, linear-gradient(var(--ring), var(--ring)) border-box !important; }
.card.r-mythic { animation: mythRing 2.4s steps(6) infinite; }
@keyframes mythRing { 0% { --ring: #ff6b6b; } 17% { --ring: #ffa94d; } 33% { --ring: #ffd23f; } 50% { --ring: #6fcf4f; } 67% { --ring: #5cc8ff; } 83% { --ring: #a56bff; } }
.dex button { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rc) 25%, #fff) 0 30%, color-mix(in srgb, var(--rc) 45%, #3a2172) 88%) padding-box, linear-gradient(var(--ring), var(--ring)) border-box !important; }
.dex button[data-unknown] { background: linear-gradient(180deg, #3a2172, #23124a) padding-box, linear-gradient(var(--ring), var(--ring)) border-box !important; }
.item-hero, .portrait, .rv-face { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rc) 30%, #fff) 0 25%, color-mix(in srgb, var(--rc) 55%, #3a2172) 65%, #2a1656 100%) padding-box, linear-gradient(var(--ring), var(--ring)) border-box !important; }
.item-hero, .portrait { filter: none; clip-path: var(--clip-notch); }
.card .art { border: 0; border-radius: 0; box-shadow: inset 0 0 0 3px #12082666; }
.card .own { top: 3px; right: 3px; border-radius: 0; border-width: 3px; }
.card .nm { min-height: 2.4em; }
button.card:active { box-shadow: none !important; }
.page .mate.active { background: linear-gradient(180deg, #5a3a1a, #3a2410) !important; }
.mate.active { outline: 3px solid var(--gold); outline-offset: -9px; }

/* ── Cadres fins (pastilles, jauges, bulles) : coins coupés, pas de pied ── */
:is(.chip-s, .nrow, .tl-ico, .tl-txt, .mem li, .q-ico, .gc-ico, .keybox, input.text, label.field input, .rfilter button, .rr-cell, .reel .cell, .try-row canvas, .bubble, .build-hint, .spin-progress, .dex-progress, .q-bar, .need .bar, .nrow .bar, .pips i, .tile .dot, .round.ready::after, .stage .round.gift::after) {
  border: 3px solid transparent !important; border-image: var(--fr-thin) 1 / 3px / 0 stretch !important;
  border-radius: 0 !important; background-clip: padding-box !important; box-shadow: none !important;
}
.need .bar i, .nrow .bar i, .q-bar i, .dex-progress i, .spin-progress i { border-radius: 0; }
.rar { border-radius: 0; border-width: 2px; }
.tile .dot { top: 4px; right: 4px; min-width: 22px; height: 22px; line-height: 16px; padding: 0 3px; background: var(--pink) !important; }
.round.ready::after, .stage .round.gift::after { top: 1px; right: 1px; width: 12px; height: 12px; background: var(--pink) !important; border-radius: 0; }

/* ── Couleurs et tailles après l'épaississement des cadres (6 px) ── */
.btn { padding: 3px 11px; }
.pbtn { padding: 3px 9px; }
.panel { padding: 9px 10px; }
.quest { padding: 5px; }
.mate { padding: 5px; }
.dialog, .pbox { border-width: 6px; padding: 10px 11px; }
.dialog { border: 6px solid transparent !important; border-image: var(--fr-bevel) 2 / 6px / 0 stretch !important; border-radius: 0 !important; clip-path: var(--clip-lip); filter: var(--lip); box-shadow: none !important; }
.modal.as-sheet .dialog { border-image-width: 6px 6px 0 6px !important; border-bottom-width: 0 !important; clip-path: var(--clip-top); filter: none; padding-bottom: calc(12px + var(--safe-b)); }
.modal.as-sheet .dialog::before { border-radius: 0; height: 6px; width: 42px; background: var(--cream-2); box-shadow: 0 3px 0 #fff; }
.dlg-title { padding: 2px 11px; }
.banner { padding: 4px 4px; }
.toast { padding: 4px 11px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.toast .t-ico .ico { width: 32px; height: 32px; display: block; }
.toast.bad { background: linear-gradient(180deg, #ffe0e4, #ff9aa6); }
.toast.show { animation: toastIn .3s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes toastIn { from { transform: translateX(-50%) translateY(18px); opacity: 0; } }
.chip-s { border-width: 3px; }

/* Icônes : grille 16 × 16, affichées à 1, 2 ou 3 fois leur taille (jamais entre deux). */
img.ico { width: 32px; height: 32px; }
.need .ico, .stage .need .ico, .nrow .n-ico .ico, .chip-s .ico, .quest .fine .ico, .q-all .ico, .card .tag-price .ico, .gc-prize .ico, .btn .ico, .small-games .btn .ico, .pill:not(.coins) .ico, .rr-label .ico, .fine .ico { width: 16px; height: 16px; }
.act .ico, .round .ico, .hud .round .ico, .tile .ico, .drawer .tile .ico, .care-all .act .ico, .food .ico, .q-ico .ico, .gc-ico .ico, .rail-ico .ico, .hud .pill.coins .ico, .page-head .pill.coins .ico, .toast .ico, .tl-ico .ico { width: 32px; height: 32px; }
.btn.big .ico, .reward-coins .ico { width: 32px; height: 32px; }
.cat .ico { width: 48px; height: 48px; }
.tile .ico, .act .ico { filter: none; }

/* ── HUD ── */
.hud .chip { padding: 0 8px 0 0; gap: 6px; background: linear-gradient(180deg, #fff, var(--cream)); }
.hud .chip canvas { width: 32px; height: 32px; border: 0; border-radius: 0; background: #f3e3ff; box-shadow: inset -3px 0 0 #12082633; }
.hud .round { background: linear-gradient(180deg, #fff, var(--cream)); }
.hud .pill.coins, .page-head .pill.coins { padding: 0 8px 0 2px; gap: 4px; background: linear-gradient(180deg, #fff3c4, var(--gold)); font-size: 16px; }
.pill.bump { animation: pillBump .32s steps(4); }
.pill.drop { animation: pillDrop .32s steps(4); }
@keyframes pillBump { 40% { transform: translateY(-3px); } 70% { transform: translateY(1px); } }
@keyframes pillDrop { 40% { transform: translateY(3px); } }

/* ── Écran principal : scène + socle des jauges + soins ── */
#app:has(> #screen > .home) { padding: calc(6px + var(--safe-t)) 8px calc(var(--tab-h) + 6px + var(--safe-b)); }
.home { gap: var(--home-gap, 6px); }
.stage-wrap { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; }
.stage-col { position: relative; display: flex; flex-direction: column; }
.stage-wrap .stage-col > .stage { width: min(calc(100cqw - 4px), calc((100cqh - 6px) * 0.80357)); min-width: 0; margin: 0; aspect-ratio: 90 / 112; }
.home.plinth .stage-wrap .stage-col > .stage { width: min(calc(100cqw - 4px), calc((100cqh - var(--plinth-h) - 6px) * 0.80357)); }
.stage { --ring: var(--gold-2); background-color: var(--cream); }
.stage, .stage[data-place="garden"] { background: var(--cream) padding-box, linear-gradient(var(--ring), var(--ring)) border-box !important; }
.stage[data-place="garden"] { --ring: #6fcf4f; }
.stage canvas { image-rendering: pixelated; }

/* Jauges : sur le mur (petits écrans), ou sur un socle sous la scène (grands écrans). */
.stage-col > .needs {
  position: absolute; z-index: 2; top: 9px; left: 9px; right: 9px; margin: 0; display: flex; align-items: center; gap: 5px;
  min-height: 38px; padding: 3px 7px; color: var(--ivory); cursor: pointer;
  background: #241645 padding-box; border: 3px solid transparent; border-image: var(--fr-thin) 1 / 3px / 0 stretch; border-radius: 0; box-shadow: none;
  background-clip: padding-box;
}
.stage-col > .needs:active { transform: translateY(2px); }
.stage-col .need { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; padding: 0; border: 0; background: none; box-shadow: none; border-radius: 0; }
.stage-col .need .ico { width: 16px; height: 16px; flex: none; }
.stage-col .need .bar { flex: 1; min-width: 10px; height: 12px; margin: 0; background: #0d0620 padding-box; }
.stage-col .need .bar i { background: linear-gradient(180deg, #b8f07a 0 33%, var(--green) 33%); }
.stage-col .need.mid .bar i { background: linear-gradient(180deg, #ffe680 0 33%, var(--gold) 33%); }
.stage-col .need.low .bar i { background: linear-gradient(180deg, #ff9a9a 0 33%, var(--red) 33%); animation: blink 1s steps(2) infinite; }
.stage-col .need.low .ico { animation: needHop 1s steps(2) infinite; }
@keyframes needHop { 50% { transform: translateY(-3px); } }
.stage-col .need.sick { flex: none; padding: 0; background: var(--red); animation: needHop 1s steps(2) infinite; }
.stage-col > .needs.more-low::after { content: ''; flex: none; width: 9px; height: 9px; border-radius: 0; background: var(--pink); box-shadow: 0 0 0 3px var(--deep); animation: blink 1s steps(2) infinite; }
.stage-col:has(.build-bar) > .needs { visibility: hidden; }
.home.plinth .stage-col > .needs {
  position: relative; top: auto; left: auto; right: auto; height: var(--plinth-h); margin: 0 6px; padding: 0 12px 3px;
  gap: 8px; border: 6px solid transparent; border-top-width: 3px; border-image: var(--fr-bevel) 2 / 3px 6px 6px 6px / 0 stretch;
  clip-path: var(--clip-lip); filter: var(--lip);
  background: linear-gradient(180deg, #8a5430 0 3px, #b5743f 3px 60%, #a8693d 60%) padding-box;
}
.home.plinth .stage-col[data-place="garden"] > .needs { background: linear-gradient(180deg, #2d6b2a 0 3px, #5aa83f 3px 60%, #4a9436 60%) padding-box; }
.home.plinth .stage-col .need .bar { height: 15px; border-image: var(--fr-thin) 1 / 3px / 0 stretch; }
.home.plinth .stage-col .need .ico { width: 32px; height: 32px; margin: -6px -3px -6px -6px; }
.home.plinth .stage-col .need { gap: 4px; }
.home.plinth .stage .round.gift { top: 12px; }
.home.plinth .build-hint { top: 12px; }
.stage .round.gift { top: 56px; right: 9px; }
.build-hint { top: 56px; }

/* Rangée de soins : une rangée de six (le « Plus » ouvre le reste) ou, sur les grands écrans, les huit soins sur deux rangées. */
.home .care { gap: 6px; }
.home .care .act { min-height: 0; height: var(--act-h, 58px); padding: 0 1px; gap: 1px; justify-content: center; font-size: 11px; line-height: 12px; }
.home:not(.care2) .care [data-x] { display: none; }
.home.care2 .care { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
.home.care2 .care .more { display: none; }
.home.care2 .care .act { font-size: 13px; line-height: 14px; gap: 3px; }
.act.on { outline: 3px solid var(--gold); outline-offset: -9px; }
.act { color: var(--ivory); text-shadow: 0 3px 0 #12082699; }
.act.alert { color: var(--ink); text-shadow: none; }
.act.more { color: var(--ink); text-shadow: none; }
.dots i { width: 6px; height: 6px; box-shadow: none; }

/* ── Tiroir du menu : feuille en pixels, tuiles qui arrivent en cascade ── */
.drawer .sheet { border: 6px solid transparent !important; border-bottom: 0 !important; border-image: var(--fr-bevel) 2 / 6px 6px 0 6px / 0 stretch !important;
  border-radius: 0 !important; clip-path: var(--clip-top); box-shadow: none !important; background: linear-gradient(180deg, #4b2c8a, #2c1859 60%) padding-box, #4b2c8a; }
.drawer .shade { background: #120826a6; }
.drawer .handle.has-dot::after { content: ''; position: absolute; top: 15px; left: calc(50% + 48px); width: 9px; height: 9px; background: var(--pink); box-shadow: 0 0 0 3px var(--deep); animation: blink 1.2s steps(2) infinite; }
.drawer.open .tile { animation: tileIn .34s cubic-bezier(.2, 1.35, .4, 1) backwards; }
.drawer.open .tile:nth-child(2) { animation-delay: 25ms; } .drawer.open .tile:nth-child(3) { animation-delay: 50ms; }
.drawer.open .tile:nth-child(4) { animation-delay: 60ms; } .drawer.open .tile:nth-child(5) { animation-delay: 85ms; }
.drawer.open .tile:nth-child(6) { animation-delay: 110ms; } .drawer.open .tile:nth-child(7) { animation-delay: 120ms; }
.drawer.open .tile:nth-child(8) { animation-delay: 145ms; } .drawer.open .tile:nth-child(9) { animation-delay: 170ms; }
@keyframes tileIn { from { transform: translateY(18px); opacity: 0; } }
.tile { text-shadow: 0 3px 0 #12082699; }

/* ── Fenêtres : apparition, fermeture ── */
.modal.closing { animation: fadeOut .15s ease-in forwards; pointer-events: none; }
.modal.closing .dialog { animation: dlgOut .15s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes dlgOut { to { transform: scale(.94); opacity: 0; } }
.modal.as-sheet.closing .dialog { animation: sheetDown .15s ease-in forwards; }
@keyframes sheetDown { to { transform: translateY(40%); opacity: 0; } }

/* ── Pages : contenu qui glisse en douceur à chaque changement d'onglet ── */
.page { animation: pageIn .26s cubic-bezier(.2, .9, .3, 1); }
.pg-body > * { animation: bodyIn .22s ease-out backwards; }
.pg-body > *:nth-child(2) { animation-delay: 30ms; }
.pg-body > *:nth-child(3) { animation-delay: 60ms; }
.pg-body > *:nth-child(n+4) { animation-delay: 80ms; }
@keyframes bodyIn { from { transform: translateY(8px); opacity: 0; } }
.page-head { background: linear-gradient(180deg, #170b33 0 80%, #170b3300); }
.seg-part { margin: 0 0 10px; }
.seg-part button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; }
.seg-part button[aria-pressed="true"] { background: linear-gradient(180deg, #fff3c4, var(--gold)); }
.tabs small { font-size: 11px; opacity: .8; }

/* Collection d'objets : ce qu'on n'a pas encore est en ombre, avec la façon de l'obtenir. */
.card.unowned .art canvas { filter: brightness(0); opacity: .5; }
.card.unowned .nm { color: var(--soft); }
.card.unowned { --ring: #5d4a86; }
.card .tag-state.how { font-size: 10px; line-height: 1.15; color: #ffe680; text-shadow: 0 1px 0 var(--deep); }
.item-hero .q, .dex button .q { position: absolute; font-family: var(--title); font-size: 30px; color: var(--ivory); text-shadow: 0 3px 0 var(--deep); }
.item-hero { position: relative; }

/* ── Pièces qui volent, confettis, révélation de récompense ── */
.fly-coin { position: fixed; left: 0; top: 0; z-index: 95; width: 16px; height: 16px; pointer-events: none; image-rendering: pixelated; will-change: transform; }
.fly-origin { position: fixed; width: 2px; height: 2px; pointer-events: none; }
.sparkles { z-index: 94; }
.reveal-modal .dialog { width: min(380px, 100%); overflow: visible; }
.rv-stage { position: relative; display: grid; place-items: center; min-height: 200px; margin: 2px 0 6px; }
.rv-rays { position: absolute; inset: -6px -11px; width: calc(100% + 22px); height: calc(100% + 12px); opacity: .5; pointer-events: none; }
.rv-cards { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.rv-card { position: relative; width: 118px; height: 156px; transform-style: preserve-3d; animation: rvFlip .62s cubic-bezier(.3, 1.3, .45, 1) backwards; }
.rv-cards.n3 .rv-card { width: 100px; height: 140px; }
@keyframes rvFlip { 0% { transform: translateY(30px) rotateY(180deg) scale(.7); opacity: 0; } 25% { opacity: 1; } 100% { transform: none; } }
.rv-back, .rv-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rv-back { transform: rotateY(180deg); border: 6px solid transparent; border-image: var(--fr-ring) 2 / 6px / 0 stretch; clip-path: var(--clip-notch);
  background: repeating-linear-gradient(45deg, #5b2fc0 0 9px, #4b2c8a 9px 18px) padding-box, var(--gold) border-box; }
.rv-face { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 4px; text-align: center; color: var(--ivory); }
.rv-art { width: 72px; height: 72px; display: grid; place-items: center; }
.rv-art canvas { width: 72px; height: 72px; }
.rv-art .ico { width: 48px; height: 48px; }
.rv-name { font-size: 14px; line-height: 1.1; text-shadow: 0 2px 0 var(--deep); overflow-wrap: anywhere; }
.rv-card.is-coins .rv-name { font-size: 22px; color: var(--gold); }
.rv-face .fine { color: var(--ivory); }
.rv-card.shown .rv-face::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 0 40%, #ffffff66 40% 46%, transparent 46% 52%, #ffffff40 52% 55%, transparent 55%) no-repeat;
  background-size: 300% 100%; animation: shine 1.1s ease-out forwards; }
.rv-card.shown.r-epic .rv-face::after, .rv-card.shown.r-legendary .rv-face::after, .rv-card.shown.r-mythic .rv-face::after { animation: shine 1.1s ease-out, shine 1.1s ease-out 1.8s infinite; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.rv-card.shown.r-legendary, .rv-card.shown.r-mythic { animation: rvFlip .62s cubic-bezier(.3, 1.3, .45, 1) backwards, rvHop 1.6s steps(3) .8s infinite; }
@keyframes rvHop { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-6px); } }
.rv-face.r-mythic, .rv-card.r-mythic .rv-face { animation: mythRing 2.4s steps(6) infinite; }
.rv-note { margin-top: 2px; }
.rv-note p { margin: 4px 0; }

/* Fin de la roulette des jeux : la case gagnante ressort, les autres s'assombrissent. */
.rar-reel { border: 6px solid transparent; border-image: var(--fr-ring) 2 / 6px / 0 stretch; border-radius: 0; clip-path: var(--clip-notch);
  background: #1d0f3f padding-box, #ff7aa8 border-box; box-shadow: none; }
.rar-reel::after { box-shadow: none; width: 3px; background: #fff1b8; }
.rar-reel.stopped .rr-cell:not(.win) { filter: brightness(.45) saturate(.6); }
.rr-cell.win { background: var(--gold) padding-box !important; animation: needHop .8s steps(2) 3; }
.reward-coins b { font-variant-numeric: tabular-nums; }

/* ── Roulettes des caisses (js/shop.js) : sans lueur floue ── */
.reel { border-radius: 0; box-shadow: inset 0 0 0 3px #ff7aa8; }
.reel::after { box-shadow: none; }
.reel.stopped .cell.win { box-shadow: none !important; outline: 3px solid var(--gold); outline-offset: 0; animation: needHop .8s steps(2) 3; }
.reel-tag .rar { margin-left: 4px; }

/* ── Bulles du compagnon : cadre fin et queue en escalier ── */
.bubble { padding: 3px 8px; background: var(--ivory) padding-box; animation: pop .22s cubic-bezier(.2, 1.4, .4, 1); }
.bubble::after { left: 50%; bottom: -9px; width: 9px; height: 6px; margin-left: -4px; transform: none; border: 0; background: var(--ivory);
  box-shadow: -3px 0 0 var(--deep), 3px 0 0 var(--deep), 0 3px 0 var(--deep); clip-path: none; }

/* ── Divers : plus de coins arrondis lisses ni de lueurs ── */
.welcome .tag { border-radius: 0; border: 3px solid transparent; border-image: var(--fr-thin) 1 / 3px / 0 stretch; background-clip: padding-box; }
.logo { text-shadow: 0 3px 0 #ff7aa8, 0 6px 0 var(--deep); }
.egg-halo::before { border-radius: 0; background: none; width: 0; height: 0; }
.spin-head .shake { animation: shake .18s steps(2) infinite; }
.pips i.on { transform: none; box-shadow: none; }
.lifeline, .timeline { gap: 6px; }
.timeline::before { border-radius: 0; width: 3px; }
.q-ok { color: var(--green); text-shadow: 0 2px 0 var(--deep); }
.build-bar { border: 3px solid transparent !important; border-image: var(--fr-thin) 1 / 3px / 0 stretch !important; border-radius: 0 !important; background: #2c1859 padding-box !important; box-shadow: none !important; }
.build-hint { background: #2c1859 padding-box !important; }
.flash { background: #fffef5; animation: flashOut .5s steps(5) forwards; }
.sparkles { width: 100vw; height: 100dvh; }
.rfilter button { min-height: 40px; }
.rfilter button[aria-pressed="true"] { box-shadow: none; }
@media (min-width: 700px) {
  #app { border-radius: 0; border: 6px solid transparent; border-image: var(--fr-ring) 2 / 6px / 0 stretch; box-shadow: none; background: #1d1239cc padding-box; clip-path: var(--clip-notch); }
}

@media (prefers-reduced-motion: reduce) {
  .rv-card, .rv-card.shown, .drawer.open .tile, .pg-body > *, .toast.show, .pill.bump, .pill.drop, .modal.closing, .modal.closing .dialog { animation: none !important; }
  .rv-card.shown .rv-face::after { display: none; }
}.drawer .sheet { transform: translateY(calc(100% - var(--tab-h) - 6px - var(--safe-b))); }
.drawer.open .sheet { transform: none; }.mem-card .ico, .rh-pad .ico { height: auto; aspect-ratio: 1; }
.stage-col .stage, .visit-stage.stage { --ring: var(--gold-2); }
.stage-col .stage[data-place="garden"] { --ring: #6fcf4f; }
.drawer .handle.has-dot::after { left: calc(50% + 50px); top: 18px; }
.act .l-long, .act .l-short { max-width: none; white-space: nowrap; font-size: var(--act-fs, inherit); flex: none; overflow: visible !important; text-overflow: clip !important; }
.home.care2 .act.fit-short .l-long { display: none; }
.home.care2 .act.fit-short .l-short { display: inline; }
.home:not(.care2) .act .l-long, .home.care2 .act .l-short { display: none; }
@media (max-width: 340px) { .home .care { gap: 4px; } .home .care .act { font-size: 10px; } }
.rv-cards.n3 .rv-card { width: min(100px, calc((100% - 20px) / 3)); }
.rv-cards.n3 .rv-name { font-size: 12px; }.rv-cards { width: 100%; }
.rv-cards.n3 { flex-wrap: nowrap; gap: 8px; }
.rv-name { overflow-wrap: normal; hyphens: auto; }
.stage-col > .needs { min-height: 42px; }

/* Finitions après assemblage : badge mythique arc-en-ciel partout, point d'interrogation lisible dans la collection. */
.r-mythic .rar, .rar.r-mythic { background-image: var(--rainbow) !important; background-size: 300% 100%; animation: rainbow 3s linear infinite; }
.dex button .q { font-family: var(--font); font-weight: 600; font-size: 24px; line-height: 1; }
.danger-zone { margin-top: -4px; }
.danger-zone .btn { color: #c0283c; }

/* ═════════════ KIWABU — finition avant lancement (2026-11-12) ═════════════ */

/* ── iPhone : jamais de zoom involontaire ──
   1. iOS zoome sur tout champ de saisie dont le texte fait moins de 16 px (nom de l'œuf, e-mail, clé) et ne
      revient pas en arrière : c'était le « jeu trop zoomé » du premier essai. 16 px minimum partout.
   2. Le double-tap (caresses répétées sur le compagnon, boutons) déclenchait le zoom intelligent : désactivé
      par touch-action, le pincement reste permis (accessibilité). */
html, body { touch-action: manipulation; }
input, textarea, select { font-size: 16px !important; }
html, body { overflow-x: hidden; max-width: 100%; }

/* ── Pages plein écran : l'en-tête reste sous l'heure / la Dynamic Island, même pendant le défilement ── */
.page .inner { padding-top: 0; }
.page-head { top: 0; padding-top: calc(8px + var(--safe-t)); padding-left: max(0px, var(--sa-l)); padding-right: max(0px, var(--sa-r)); }
.modal .dialog { max-height: calc(100dvh - 24px - var(--safe-t) - var(--safe-b)); overflow-y: auto; }

/* ── Nourriture : trois cartes nettes, une couleur et un vrai dessin par aliment ── */
.foods { gap: 10px; padding: 2px 0 4px; }
.food { min-height: 112px; padding: 10px 4px 8px; gap: 6px; justify-content: center; border-radius: 0 !important;
  transition: transform .08s, filter .12s; }
.food .ico, .care-all .food .ico { width: 48px !important; height: 48px !important; }
.food span { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.food[data-f="rice"]   { background: linear-gradient(180deg, #ffffff, #e7f6e0) !important; }
.food[data-f="carrot"] { background: linear-gradient(180deg, #fff6ea, #ffd9ad) !important; }
.food[data-f="snack"]  { background: linear-gradient(180deg, #fff3f7, #ffcfe0) !important; }
.food .ico { filter: drop-shadow(0 2px 0 #2a1f3d40); }
.food:hover .ico { transform: translateY(-2px); }
.food.picked { filter: brightness(1.08); transform: scale(1.05) !important; }
.food.fav { box-shadow: inset 0 0 0 3px var(--gold) !important; }
.food .star { top: 4px; right: 6px; }
.food .star .ico { width: 16px !important; height: 16px !important; }
.food .fav-tag { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); font-family: var(--title); font-size: 9px;
  letter-spacing: .5px; background: var(--gold); color: var(--ink); padding: 1px 6px; border: 2px solid var(--deep, #120826); white-space: nowrap; }
@keyframes foodHop { 40% { transform: translateY(-6px) scale(1.06); } }
.food.picked .ico { animation: foodHop .3s ease-out; }

/* ── Mythique : un vrai anneau arc-en-ciel (toutes les couleurs à la fois), qui tourne, avec des étincelles ── */
@property --myth-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
:root { --myth-ring: conic-gradient(from var(--myth-a), #ff5e7e, #ffa94d, #ffe14d, #6fe06a, #4fd8ff, #7a8cff, #c47bff, #ff5e7e); }
:is(.card, .dex button, .item-hero, .portrait, .rv-face).r-mythic, .rv-card.r-mythic .rv-face {
  --myth-ring: conic-gradient(from var(--myth-a), #ff5e7e, #ffa94d, #ffe14d, #6fe06a, #4fd8ff, #7a8cff, #c47bff, #ff5e7e);
  position: relative; animation: mythSpin 3s linear infinite !important;
  filter: var(--lip) drop-shadow(0 0 6px #ff7aa880) drop-shadow(0 0 10px #4fd8ff60);
}
.card.r-mythic { background: radial-gradient(circle at 50% 28%, #7d4ac8, #3a1d74 55%, #23124a) padding-box, var(--myth-ring) border-box !important; }
.card.r-mythic.unowned { background: radial-gradient(circle at 50% 28%, #4e2d8c, #23124a 70%) padding-box, var(--myth-ring) border-box !important; }
.dex button.r-mythic { background: radial-gradient(circle at 50% 42%, #fff 0 20%, #f3dcff 38%, #b07cf0 70%, #5a2f9a) padding-box, var(--myth-ring) border-box !important; }
.dex button.r-mythic[data-unknown] { background: radial-gradient(circle at 50% 45%, #6a3bb0, #2b1458 80%) padding-box, var(--myth-ring) border-box !important; }
:is(.item-hero, .portrait, .rv-face).r-mythic, .rv-card.r-mythic .rv-face {
  background: radial-gradient(circle at 50% 42%, #fff 0 18%, #f0d4ff 40%, #8d5ad6 75%, #2a1656) padding-box, var(--myth-ring) border-box !important; }
@keyframes mythSpin { to { --myth-a: 360deg; } }
/* étincelles : quatre petites croix qui scintillent à tour de rôle */
:is(.card, .dex button, .item-hero, .portrait).r-mythic::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(circle, #fff 0 1.5px, transparent 2px) 12% 16% / 10px 10px no-repeat,
    radial-gradient(circle, #fff6b0 0 1.5px, transparent 2px) 86% 22% / 10px 10px no-repeat,
    radial-gradient(circle, #fff 0 1px, transparent 1.5px) 80% 84% / 8px 8px no-repeat,
    radial-gradient(circle, #c9f4ff 0 1.5px, transparent 2px) 18% 78% / 10px 10px no-repeat;
  animation: mythTwinkle 1.6s steps(4) infinite;
}
@keyframes mythTwinkle { 0% { opacity: 1; } 25% { opacity: .25; } 50% { opacity: .9; } 75% { opacity: .4; } }
.dex button.r-mythic .stars { color: #fff; text-shadow: 0 0 4px #ff7aa8, 0 0 6px #4fd8ff, 0 1px 0 var(--deep); }
.r-mythic .nm { background: linear-gradient(90deg, #ffb0c4, #ffe39a, #b5f5b0, #a8e8ff, #d8b8ff); -webkit-background-clip: text; background-clip: text; color: transparent !important; text-shadow: none !important; filter: drop-shadow(0 1px 0 #120826); }
@media (prefers-reduced-motion: reduce) {
  :is(.card, .dex button, .item-hero, .portrait, .rv-face).r-mythic, .rv-card.r-mythic .rv-face, :is(.card, .dex button, .item-hero, .portrait).r-mythic::before { animation: none !important; }
}
/* Réglages audio : curseurs de volume */
.vol { display: flex; align-items: center; gap: 10px; padding: 4px 0 10px; font-size: 13px; color: var(--soft, #7a6b8f); }
.vol span { flex: none; min-width: 9.5em; }
.vol input[type="range"] { flex: 1; min-width: 0; height: 32px; accent-color: var(--pink); background: transparent; }
.vol input:disabled { opacity: .4; }
/* Cartes : les étincelles restent sur l'illustration, jamais sur le texte. */
.card.r-mythic::before { inset: 0 0 42% 0; }

/* KIWABU 2.5 — cadrage fixe : touch-action ne s'hérite pas, on le pose donc sur CHAQUE élément
   (les règles plus précises « none » de la scène et des jeux gardent la priorité). Voir js/zoom-guard.js. */
*, *::before, *::after { touch-action: manipulation; }
.stage canvas, .game-area canvas, .drawer .sheet { touch-action: none; }

/* Conditions d’utilisation acceptées au premier lancement (js/terms-gate.js). */
.terms-gate .terms-list { margin: 6px 0; padding-left: 1.2em; display: grid; gap: 4px; }
.terms-gate a { color: inherit; text-decoration: underline; }
