/* Unboxd — styles communs.
   Design « cozy » (2026-10-03) : une pièce chaleureuse, chaque élément posé dans un cadre (bord net, ombre pleine
   dessous) plutôt que flottant dans la lumière. Quatre thèmes au choix du joueur (js/theme.js, en-tête et Profil) :
   Crème & pêche et Chambre lilas (clairs), Cacao et Ardoise & miel (sombres). */
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Michroma&family=Bagel+Fat+One&family=Patrick+Hand&family=Nunito:wght@400;600;700;800&display=swap');

/* ---- Thèmes ------------------------------------------------------------------------------------ */
/* Crème & pêche (par défaut) : papier crème, encre brun chaud, accent corail. */
:root {
  --wall: #F3E8D8; --wall-2: #EADAC4;           /* mur de la pièce et son motif */
  --surface: #FFFAF2; --surface-2: #F8EEDF;      /* panneaux, et zones creuses dans les panneaux */
  --ink: #45302A; --ink-soft: #77604F;
  --line: #DCC7AE;                              /* filets intérieurs */
  --frame: #45302A;                             /* cadre des panneaux et boutons */
  --drop: #D8BFA2;                              /* ombre pleine sous les panneaux */
  --edge: var(--frame);                         /* ombre pleine sous les boutons */
  --accent: #E98E6B; --accent-ink: #3A2219;     /* bouton principal */
  --bar: #FFFAF2; --bar-ink: var(--ink);        /* en-tête et pied de page */
  --scrim: rgba(69, 48, 42, .45);               /* voile derrière les fenêtres */
  --danger-bg: #F6D0D2; --danger-ink: #7A1F2C;
  --gold-ink: #8A5D0C; --ok-ink: #2F7A4E;       /* textes « or » (jetons, prix) et « réussi » */
  /* Pastels : raretés, étiquettes, boîtes. Ils restent clairs dans tous les thèmes. */
  --peach: #F6C3A4; --butter: #F5DD98; --mint: #C6DDB4; --sky: #BFD6E4; --rose: #F0BAC0; --lilac: #D8C6E4;
  /* Couleurs d'interface (onglets des panneaux, pastilles) : les pastels en clair, des pastels « éteints » en sombre. */
  --t-peach: var(--peach); --t-mint: var(--mint); --t-sky: var(--sky); --t-lilac: var(--lilac); --t-rose: var(--rose); --t-butter: var(--butter);
  /* Encre des éléments posés sur un pastel (boîtes, étiquettes de rareté…), la même dans tous les thèmes. */
  --ink-dark: #3A2C30; --ink-dark-soft: #66545A;
  /* (Anciens noms encore utilisés par les pages.) */
  --paper: var(--wall); --paper-deep: var(--wall-2);
  /* Carton */
  --kraft: #C9A374; --kraft-dark: #A8834F; --kraft-light: #DDBE92;
  --tape: rgba(236, 226, 190, .88);

  --font-display: 'Bagel Fat One', 'Trebuchet MS', sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
  --font-hand: 'Patrick Hand', 'Comic Sans MS', cursive;

  --radius: 18px; --radius-s: 12px; --frame-w: 2.5px;
  --shadow: 0 5px 0 var(--drop);
  --shadow-s: 0 3px 0 var(--drop);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --lift: 3px 4px 0 rgba(58, 44, 64, .9);
  color-scheme: light;
}
/* Chambre lilas : la couleur d'origine du site, réchauffée (lilas rosé, encre prune, accent rose). */
:root[data-theme="lilas"] {
  --wall: #EFE3EA; --wall-2: #E5D4E0;
  --surface: #FFF8F8; --surface-2: #F8EBEF;
  --ink: #45304A; --ink-soft: #725E76;
  --line: #DCC5D4; --frame: #45304A; --drop: #D6B9CC;
  --accent: #E58FA8; --accent-ink: #3A1E2C;
  --bar: #FFF8F8; --scrim: rgba(69, 48, 74, .45);
  --peach: #F7C9B0; --butter: #F4E3A4; --mint: #BFE0CC; --sky: #C3D6EE; --rose: #F2B8C8; --lilac: #D6C3EE;
}
/* Thèmes sombres : tout s'assombrit ensemble (mur, panneaux, onglets, boutons) ; seuls les pastels des raretés et des
   boîtes restent clairs. Cadre un peu plus clair que le panneau, ombre pleine très sombre dessous. */
/* Cacao : brun chaud, accent pêche. */
:root[data-theme="cacao"] {
  --wall: #241B18; --wall-2: #2D221E;
  --surface: #342823; --surface-2: #2B211D;
  --ink: #F4E6D6; --ink-soft: #CDB8A6;
  --line: #4E3D34; --frame: #6E5647; --drop: #110B09;
  --accent: #EFA27C; --accent-ink: #2A160E;
  --bar: #1C1512;
  --t-peach: #5E3B2F; --t-mint: #3B4A37; --t-sky: #3A4652; --t-lilac: #4A3D58; --t-rose: #5A3640; --t-butter: #5E4B2B;
}
/* Ardoise & miel : gris-bleu, réchauffé par un accent miel. */
:root[data-theme="ardoise"] {
  --wall: #1F2126; --wall-2: #272A31;
  --surface: #2E3139; --surface-2: #272930;
  --ink: #EFEBE3; --ink-soft: #C1BCB2;
  --line: #454953; --frame: #646974; --drop: #0D0E11;
  --accent: #E8B864; --accent-ink: #2A1D06;
  --bar: #17181C;
  --t-peach: #57412F; --t-mint: #354A3D; --t-sky: #34445A; --t-lilac: #463F5E; --t-rose: #563840; --t-butter: #5A4C28;
}
:root.dark {
  color-scheme: dark;
  --edge: var(--drop);
  --scrim: rgba(6, 4, 4, .66);
  --danger-bg: #5A2A31; --danger-ink: #F8CDD3;
  --gold-ink: #F5D88C; --ok-ink: #8FE0B0;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font: 400 1rem/1.6 var(--font-body); color: var(--ink);
  /* Mur : un papier peint très discret (petits losanges), sans halo. */
  background:
    repeating-linear-gradient(45deg, transparent 0 13px, color-mix(in srgb, var(--wall-2) 55%, transparent) 13px 14px),
    repeating-linear-gradient(-45deg, transparent 0 13px, color-mix(in srgb, var(--wall-2) 55%, transparent) 13px 14px),
    var(--wall);
  background-attachment: fixed;
}
/* Grain de papier par-dessus tout le site. */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .12; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .42 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.dark body::after { opacity: .3; mix-blend-mode: soft-light; }
img { max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); }
p { margin: 0; }
.muted { color: var(--ink-soft); }

/* ---- En-tête : une barre pleine largeur, posée en haut -------------------------------------------- */
.skip-link { position: absolute; left: 16px; top: -60px; background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 200; }
.skip-link:focus { top: 12px; }
.site-header {
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; width: 100%;
  padding: 12px max(24px, calc((100% - 1200px) / 2 + 24px)); margin-bottom: 12px;
  background: var(--bar); color: var(--bar-ink); border-bottom: var(--frame-w) solid var(--frame); box-shadow: var(--shadow);
  position: relative; z-index: 20;
}
.logo { text-decoration: none; display: flex; flex-direction: column; line-height: 1; margin-right: auto; }
.logo-word { font-family: var(--font-display); font-size: 2rem; letter-spacing: .01em; color: var(--bar-ink); text-shadow: 2px 2px 0 var(--accent); }
.logo-sub { font-family: var(--font-hand); font-size: 1.1rem; color: color-mix(in srgb, var(--bar-ink) 70%, transparent); margin-top: 2px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a {
  text-decoration: none; font-weight: 700; padding: 8px 12px; border-radius: 999px; color: color-mix(in srgb, var(--bar-ink) 78%, transparent);
  transition: background-color .2s, color .2s;
}
.site-nav a:hover { color: var(--bar-ink); background: color-mix(in srgb, var(--bar-ink) 9%, transparent); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--t-butter); box-shadow: inset 0 0 0 2px var(--frame); }
/* Pastilles de l'en-tête : jetons, compte, aide, thème. */
.tokens {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; color: var(--ink);
  padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--frame);
}
.tokens svg { width: 22px; height: 22px; fill: var(--butter); stroke: var(--ink-dark); stroke-width: 1.6; }
.nav-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  font: 800 .75rem/1 var(--font-body); color: var(--ink-dark); background: var(--butter); vertical-align: 1px; }
/* Compte joueur (js/cloud.js) : « Connexion », puis le pseudo une fois connecté. */
.account-link { text-decoration: none; font-weight: 800; padding: 8px 14px; border-radius: 999px; color: var(--ink); background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--frame); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-link:hover, .account-link[aria-current="page"] { background: var(--t-butter); }
.account-link.signed-in::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%;
  background: #5BC489; vertical-align: 1px; }
/* Icône du compte : seulement sur téléphone (à la place du texte). */
.account-link svg { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.menu-toggle { display: none; }
.menu-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
/* Lien « Comment ça marche » : un point d'interrogation dans une pastille. */
.help-link { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; text-decoration: none; flex: none;
  font-family: var(--font-display); font-size: 1.25rem; line-height: 1; color: var(--ink); background: var(--t-butter);
  box-shadow: inset 0 0 0 2px var(--frame), 2px 3px 0 var(--accent); transform: rotate(-6deg); transition: transform .2s var(--ease), box-shadow .2s; }
.help-link:hover { transform: rotate(4deg) translateY(-1px); box-shadow: inset 0 0 0 2px var(--frame), 3px 4px 0 var(--accent); }
.help-link[aria-current="page"] { background: var(--t-mint); }
.help-link span[aria-hidden] { transform: translateY(1px); }
/* Choix du thème (js/theme.js) : une pastille, et une petite liste qui s'ouvre dessous. */
.theme-pick { position: relative; flex: none; }
.theme-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 2px var(--frame); }
.theme-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn:hover, .theme-btn[aria-expanded="true"] { background: var(--t-butter); }
.theme-menu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; width: 230px; padding: 8px; display: grid; gap: 4px;
  background: var(--surface); color: var(--ink); border: var(--frame-w) solid var(--frame); border-radius: 16px; box-shadow: var(--shadow); }
.theme-menu p { font-weight: 800; font-size: .8rem; color: var(--ink-soft); padding: 4px 8px 0; }
.theme-menu button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; cursor: pointer;
  font: 700 .95rem var(--font-body); color: var(--ink); background: none; text-align: left; }
.theme-menu button:hover { background: var(--surface-2); }
.theme-menu button[aria-checked="true"] { background: var(--t-butter); box-shadow: inset 0 0 0 2px var(--frame); }
/* Son (js/sound.js) : haut-parleur (couper / remettre), curseur du volume général, lien vers les réglages de chaque son.
   (Avant : un bouton .sound-toggle « Sons activés / coupés ».) */
.sound-row { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 0; }
.theme-menu .sound-mute { flex: none; width: 40px; min-height: 40px; padding: 0; justify-content: center; }
.sound-mute svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound-val { flex: none; min-width: 3.2em; text-align: right; font-weight: 800; font-size: .85rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.sound-more { padding: 8px 10px; font-weight: 800; font-size: .9rem; color: var(--ink); border-radius: 10px; text-decoration: none; }
.sound-more:hover { background: var(--surface-2); text-decoration: underline; }
/* Curseur (menu et page reglages.html) : piste creuse remplie jusqu'au pouce (--fill), pouce rond cerclé du cadre. */
.sound-range { flex: 1; min-width: 0; height: 28px; margin: 0; background: none; cursor: pointer; -webkit-appearance: none; appearance: none; --fill: 66%; }
.sound-range::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; box-shadow: inset 0 0 0 2px var(--frame);
  background: linear-gradient(90deg, var(--accent) var(--fill), var(--surface-2) var(--fill)); }
.sound-range::-moz-range-track { height: 8px; border-radius: 99px; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--frame); }
.sound-range::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--accent); }
.sound-range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -6px; border-radius: 50%;
  background: var(--t-butter); border: 2px solid var(--frame); box-shadow: 1px 2px 0 var(--frame); }
.sound-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--t-butter); border: 2px solid var(--frame); box-shadow: 1px 2px 0 var(--frame); }
.sound-range:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 99px; }
.sound-range:disabled { opacity: .45; cursor: default; }
/* Échantillon d'un thème : trois pastilles (mur, panneau, accent). */
.theme-swatch { display: inline-flex; flex: none; }
.theme-swatch i { width: 16px; height: 16px; border-radius: 50%; margin-left: -5px; box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px rgba(0, 0, 0, .15); }
.theme-swatch i:first-child { margin-left: 0; }

/* ---- Structure ----------------------------------------------------------------------------------- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 16px 24px 64px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin: 16px 0 28px; }
.page-head p { max-width: 60ch; margin-top: 8px; color: var(--ink-soft); }

/* Panneau : la brique de base. Un cadre net, une ombre pleine, un onglet de titre coloré (--tab). */
.panel { --tab: var(--t-butter); background: var(--surface); color: var(--ink);
  border: var(--frame-w) solid var(--frame); border-radius: var(--radius); box-shadow: var(--shadow); overflow: clip; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--tab); border-bottom: var(--frame-w) solid var(--frame); }
.panel-head h2 { font-size: 1.35rem; }
.panel-head small { font-weight: 700; color: color-mix(in srgb, var(--ink) 75%, transparent); }
.panel-body { padding: 20px; }
/* Zone creuse dans un panneau (plateau, tiroir) : un ton plus bas, bord intérieur. */
.well { background: var(--surface-2); border-radius: var(--radius-s); padding: 16px;
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--drop) 60%, transparent), inset 0 0 0 2px var(--line); }

/* ---- Boutons « jouets » : cadre, ombre pleine, ils s'enfoncent au clic ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 24px;
  font: 800 1rem var(--font-body); text-decoration: none; cursor: pointer; border-radius: 14px;
  border: var(--frame-w) solid var(--frame); background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 var(--edge);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s; touch-action: manipulation;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--edge); filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn-soft { background: var(--surface); color: var(--ink); }
.btn-danger { background: var(--danger-bg); color: var(--danger-ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 0 4px 0 var(--edge); filter: grayscale(.4); }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: .92rem; }

select, input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], input:not([type]), textarea {
  font: 600 1rem var(--font-body); color: var(--ink); background: var(--surface); min-height: 44px;
  border: 2px solid var(--frame); border-radius: var(--radius-s); padding: 8px 12px;
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--drop) 55%, transparent);
}
select:focus-visible, input:focus-visible, textarea:focus-visible { outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .92rem; color: var(--ink-soft); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Étiquette écrite au feutre, sur un morceau de scotch. */
.tape-label {
  display: inline-block; font-family: var(--font-hand); font-weight: 700; font-size: 1.35rem; line-height: 1.2; color: var(--ink);
  padding: 4px 14px; background: var(--t-butter); border: 2px solid var(--frame); box-shadow: 2px 3px 0 var(--drop); transform: rotate(-2deg);
}

.progress { height: 14px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--frame); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; box-shadow: inset -2px 0 0 var(--frame);
  background: repeating-linear-gradient(-45deg, var(--mint) 0 8px, color-mix(in srgb, var(--mint) 75%, #7FA86A) 8px 16px); }
.dark .progress > span { background: repeating-linear-gradient(-45deg, #8DB487 0 8px, #7BA275 8px 16px); }

/* ---- Boîtes : couleurs des raretés et gabarit commun (.card gbox, js/gamebox.js) ---------------- */
[data-rarity="commune"]     { --r: #E6DED6; --r-edge: #9C8F84; }
[data-rarity="peu-commune"] { --r: var(--mint); --r-edge: #5E9E80; }
[data-rarity="rare"]        { --r: var(--sky); --r-edge: #5B86B3; }
[data-rarity="epique"]      { --r: var(--lilac); --r-edge: #8466BE; }
[data-rarity="legendaire"]  { --r: var(--butter); --r-edge: #BF952A; }
[data-rarity="mythique"]    { --r: var(--rose); --r-edge: #C0668A; }
[data-rarity="culte"]       { --r: #F2D67A; --r-edge: #A9822A; } /* étagère, albums… (les boîtes Culte gardent data-rarity="mythique") */
.card { --w: 220px; position: relative; width: var(--w); aspect-ratio: 5 / 7; perspective: 1000px; container-type: inline-size; }
.card.flipped { --flip: 0deg; }
.pips { display: inline-flex; gap: 1.2cqw; }
.pips i { width: 3.2cqw; height: 3.2cqw; border-radius: 50%; box-shadow: inset 0 0 0 .6cqw var(--ink); }
.pips i.on { background: var(--ink); }

/* Pastilles collées sur la carte */
.card-count, .card-new {
  position: absolute; z-index: 2; font-family: var(--font-display); line-height: 1; pointer-events: none;
  padding: .45em .7em; border-radius: 999px; box-shadow: 0 0 0 2px var(--ink), 2px 3px 0 rgba(58, 44, 64, .35);
}
.card-count { top: -8px; right: -8px; background: var(--butter); font-size: .95rem; transform: rotate(8deg); }
.card-new { top: -10px; left: -8px; background: var(--mint); font-size: .85rem; transform: rotate(-8deg); }

/* Éléments posés sur un pastel clair (boîtes, étiquettes de rareté…) : toujours l'encre foncée et les couleurs claires,
   quel que soit le thème. */
.dark :is(.card, .gbox, .slot-lock span, .to-find, .card-count, .card-new, .soon-tape, .guide-num, .guide-formula .chip, .badge) {
  --ink: var(--ink-dark); --ink-soft: var(--ink-dark-soft);
  --surface: #FFFAF2; --surface-2: #F8EEDF; --line: #DCC7AE; --frame: var(--ink-dark); --paper: #F3E8D8; --paper-deep: #EADAC4;
}
.dark :is(.card, .gbox, .slot-lock span, .to-find, .card-count, .card-new, .soon-tape, .guide-num, .guide-formula .chip, .badge) { color: var(--ink-dark); }

/* ---- Grilles, états vides, notifications ----------------------------------------------------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 28px 20px; }
.card-grid .card { --w: 100%; }
.card-grid .card-button { all: unset; display: block; cursor: pointer; border-radius: 12px; }
.card-grid .card-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }

.empty { text-align: center; padding: 56px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.empty p { max-width: 46ch; color: var(--ink-soft); }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 150; pointer-events: none; }
.toast { background: var(--surface); color: var(--ink); padding: 12px 20px; border-radius: 14px; font-weight: 700;
  border: var(--frame-w) solid var(--frame); box-shadow: 0 4px 0 var(--edge);
  animation: toast-in .3s var(--ease); max-width: min(90vw, 460px); }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* Fenêtres : le même cadre que les panneaux. */
dialog { border: 0; border-radius: var(--radius); padding: 28px; background: var(--surface); color: var(--ink); max-width: min(92vw, 720px);
  box-shadow: 0 0 0 var(--frame-w) var(--frame), 0 8px 0 var(--edge); }
dialog::backdrop { background: var(--scrim); }

/* ---- Pied de page : la même barre qu'en haut ------------------------------------------------------- */
.site-footer { width: 100%; margin-top: 24px; padding: 20px max(24px, calc((100% - 1200px) / 2 + 24px));
  background: var(--bar); color: color-mix(in srgb, var(--bar-ink) 75%, transparent); border-top: var(--frame-w) solid var(--frame);
  font-size: .92rem; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.test-flag { font-family: var(--font-hand); font-size: 1.15rem; color: var(--bar-ink); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.test-flag small { font: 600 .8rem var(--font-body); color: color-mix(in srgb, var(--bar-ink) 70%, transparent); }
.footer-links a { color: inherit; }

/* ---- Petits écrans ------------------------------------------------------------------------------- */
/* Menu replié derrière un bouton dès que les liens ne tiennent plus sur une ligne à côté du logo. */
@media (max-width: 1380px) {
  .menu-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; font: 800 1rem var(--font-body); color: var(--ink);
    background: var(--surface); border: 2px solid var(--frame); border-radius: 999px; cursor: pointer; order: 2; }
  .help-link, .theme-pick, .tokens, .account-link { order: 1; }
  .site-nav { order: 3; width: 100%; display: none; flex-direction: column; background: var(--surface); border-radius: 16px; padding: 8px;
    box-shadow: inset 0 0 0 2px var(--line); }
  .nav-open .site-nav { display: flex; }
  .site-nav a { padding: 12px 16px; color: var(--ink-soft); }
}
@media (max-width: 860px) {
  .site-header { gap: 12px; padding: 12px 16px; }
  main { padding: 8px 16px 48px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 14px; }
  .panel-body { padding: 16px; }
}
@media (max-width: 480px) {
  /* En-tête sur une seule ligne : logo plus petit ; compte, thème et menu en pastilles rondes à icône. */
  .site-header { gap: 6px; padding: 10px 12px; }
  .logo-word { font-size: 1.45rem; }
  .logo-sub { font-size: .8rem; }
  .tokens-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tokens { padding: 5px 10px 5px 6px; gap: 5px; min-height: 40px; }
  .help-link, .theme-btn { width: 38px; height: 38px; }
  .account-link { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; position: relative; overflow: visible; }
  .account-link svg { display: block; }
  .account-link .account-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .account-link.signed-in::before { position: absolute; top: 1px; right: 1px; margin: 0; width: 10px; height: 10px; box-shadow: 0 0 0 2px var(--surface); }
  .menu-toggle { width: 42px; height: 42px; padding: 0; justify-content: center; }
  .menu-toggle .menu-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .theme-menu { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  /* iPhone : un champ en dessous de 16 px fait zoomer la page quand on le touche. */
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: max(16px, 1em); }
  /* Fenêtres : plus de place pour le contenu ; « Fermer » reste visible en haut quand on fait défiler. */
  dialog { padding: 20px 16px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 24px); }
  dialog .dialog-close { position: sticky; top: -8px; z-index: 5; display: block; width: max-content; margin: -8px -4px 6px auto;
    box-shadow: 0 0 0 4px var(--surface), 0 4px 0 var(--edge); }
  /* Toujours deux boîtes par ligne sur téléphone (les boîtes PS1, plus larges, imposaient une seule colonne). */
  html .card-grid, html .card-grid:has(.gbox--ps1) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
}
@media (max-width: 370px) {
  .logo-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Séparation des infos (2026-10-08) : le système de la fiche du jeu, réutilisé sur tout le site ---------------------
   .ui-section    : une section de page posée sur une carte (fond du panneau, cadre, ombre), son titre dedans.
   .ui-group      : un groupe d'infos dans une carte ou une fenêtre, sur un fond un peu plus creux (--surface-2).
   .ui-group-title: petit titre discret en capitales d'un groupe.
   .ui-rows       : liste « libellé / valeur » (dl) ; un filet pointillé entre deux lignes visibles.

   RÈGLES DE DESIGN DU SITE (2026-10-08, à suivre sur toute page, existante ou nouvelle) :
   1. Pas d'explication de mécanique sur les pages : elle va dans la page « ? » (comment-ca-marche.html, un onglet par
      thème, une ancre par sujet) ; sur la page, seulement un lien <a class="help-chip" href="comment-ca-marche.html#…">.
   2. Chaque section de page sur une carte .ui-section, titre dedans (pas de titre ni de grille posés sur le fond).
   3. Dans une carte ou une fenêtre : groupes .ui-group + .ui-group-title, infos « libellé / valeur » en dl.ui-rows.
   4. Grilles de boîtes en vue en cases : .trade-grid--cells (tuiles) ou .card-grid--cells (collection), css/pages.css.
   5. Fiche ou fenêtre riche : colonne gauche teintée (visuel + boutons empilés), onglets si beaucoup d'infos
      (modèle : fiche du jeu, js/detail.js).
   6. Un seul bouton plein (.btn) par zone, les autres en .btn-soft.
   7. 6 points de rareté partout ; couleurs par jetons du thème (clair et sombre) ; téléphone 375 px sans débordement. */
.ui-section { margin: 0 0 22px; padding: 6px 20px 18px; border-radius: 18px; background: var(--surface); color: var(--ink);
  border: var(--frame-w) solid var(--frame); box-shadow: var(--shadow-s); }
.ui-section[hidden] { display: none; }
.ui-section > :is(h2, .trade-h, .profile-section-head):first-child { margin-top: 14px; }
.ui-group { padding: 4px 16px 6px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line); }
.ui-group[hidden] { display: none; }
.ui-group-title { margin: 10px 0 2px; font: 800 .74rem/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.ui-rows { display: grid; grid-template-columns: max-content 1fr; column-gap: 18px; margin: 0; font-size: .95rem; }
.ui-rows > dt, .ui-rows > dd { margin: 0; padding: 9px 0; }
.ui-rows > dt { color: var(--ink-soft); font-weight: 700; }
.ui-rows > dt:not([hidden]) ~ dt:not([hidden]), .ui-rows > dd:not([hidden]) ~ dd:not([hidden]) { border-top: 1px dashed var(--line); }
@media (max-width: 480px) { .ui-section { padding: 4px 14px 14px; } .ui-rows { column-gap: 12px; } }
