:root {
  /* Alias : anciens noms du thème, branchés sur les jetons Alpage (shared/ds/tokens.css, chargé avant).
     À supprimer au fil de la migration des pages vers les nouveaux noms. */
  --bg2: var(--bg);
  --card: var(--surface);
  --card-hi: var(--surface-2);
  --text: var(--ink);
  --muted: var(--ink-2);
  --accent: var(--action);
  --accent-ink: var(--action-ink);
  --radius: var(--r-card);
  /* Ancien vert / rouge « vifs » (texte, bordures, pastilles). Le feedback Alpage (--good, --bad…) est réservé aux composants DS. */
  --accent-text: oklch(0.50 0.11 78); /* l'accent est un fond : pour du texte ou des icônes, utiliser cette teinte plus foncée */
  --ok: #1e9a55;
  --ko: #e04452;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 1.2rem; white-space: nowrap; margin: 0; letter-spacing: .2px; }
h2 { font-size: .8rem; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.badges { display: flex; align-items: center; gap: 8px; }
.coins { background: var(--card); padding: 8px 14px; border-radius: 999px; font-weight: 800; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 14px; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform .08s ease, filter .15s ease, background .15s ease;
}
button:active { transform: scale(.96); }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.icon-btn { background: var(--card); width: 44px; height: 44px; font-size: 1.1rem; border-radius: 14px; }
.big { width: 100%; min-height: 58px; font-size: 1.15rem; font-weight: 800; margin-top: 10px; }
.primary { background: linear-gradient(180deg, #ffd54f, #ffb300); color: var(--accent-ink); box-shadow: 0 5px 0 #b57f00; }
.primary:active { box-shadow: 0 2px 0 #b57f00; transform: translateY(3px); }
.ghost { background: var(--card); padding: 12px 14px; font-weight: 700; min-height: 48px; }
.big.ghost { margin-top: 10px; }
.pill { background: var(--ko); border-radius: 999px; padding: 1px 8px; font-size: .8rem; margin-left: 4px; }
.pill:empty { display: none; }


a.icon-btn { display: inline-grid; place-items: center; text-decoration: none; color: inherit; }

.coins { white-space: nowrap; }
.top { gap: 8px; }
.top h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; flex: 1; }
.badges { flex: none; }

/* Ton par cycle (attribut posé par shared/tone.js) : rayons, marches et tailles viennent de shared/ds/tones.css. */
html[data-tone="gymnase"] .primary { box-shadow: none; }
html[data-tone="gymnase"] .primary:active { transform: scale(.98); box-shadow: none; }
html[data-tone="gymnase"] .game, html[data-tone="gymnase"] .game:active { box-shadow: none; border-radius: 14px; }

/* Badges (partagés : menu et résultats de partie) */
.badge-chip { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: var(--radius); padding: 10px 12px; border: 3px solid var(--tier, var(--card-hi)); text-align: left; }
.badge-chip .bi { font-size: 1.8rem; width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--bg); }
.badge-chip .bt { font-weight: 800; min-width: 0; }
.badge-chip .bt small { display: block; font-weight: 600; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.badge-chip.tier1 { --tier: #cd7f32; }
.badge-chip.tier2 { --tier: #b9c3d8; }
.badge-chip.tier3 { --tier: #ffca28; }
.badge-chip.locked { opacity: .55; --tier: var(--card-hi); }
.badge-chip.locked .bi { filter: grayscale(1); }
.badge-row { display: grid; gap: 8px; margin-bottom: 8px; }
.res-badges { display: grid; gap: 8px; margin: 0 0 12px; }
.res-badges[hidden] { display: none; }
.res-badges .bn { font-weight: 900; color: var(--accent-text); text-align: center; }

/* Icônes Phosphor (shared/ds/phosphor) */
.icon-btn { font-size: 1.35rem; }
.coins .ph-coin, .counter .ph-coin { color: var(--coin); }
.coins .ph-coin { font-size: 1.1em; vertical-align: -0.15em; }
.counter .ph-fire { color: var(--streak); }
.ti .ph-bold, .ti .ph-fill { font-size: 1.5rem; }
button .ph-bold, button .ph-fill, a .ph-bold, a .ph-fill { pointer-events: none; }

/* Thème sombre : les textes d'accent et l'ancien vert / rouge s'éclaircissent */
[data-theme="dark"] { --accent-text: oklch(0.88 0.10 88); --ok: #4cd08a; --ko: #ff7a85; }
