/* Brick ZR — la feuille de style du jeu. Le style « Brick ZR, les briques » (la skill .claude/skills/brikz-ui) :
   - le bouton est une brique : couleur pleine, face du haut plus claire, épaisseur en ombre pleine, une rangée de tenons ;
   - les fonds sont des plaques : la plaque nuit à tenons discrets, des tuiles lisses (liseré clair, épaisseur pleine) ;
   - Bungee pour les titres d'écran, Rubik pour tout le reste.
   Toutes les couleurs passent par les jetons de :root (social.css et objectifs.css aussi). */

/* ── Les polices, gardées avec le jeu (hors ligne) : Bungee et Rubik, licence SIL OFL 1.1 (fonts/OFL-*.txt) ── */
@font-face {
  font-family: 'Bungee'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/bungee-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bungee'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/bungee-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Rubik'; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(fonts/rubik-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rubik'; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(fonts/rubik-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* ── Les plaques et les tuiles ── */
  --plaque-nuit: #121a33;   /* le fond de page */
  --plaque: #1d2849;        /* une tuile, un panneau */
  --plaque-haut: #283662;   /* un ton plus clair : en-tête de fenêtre, ligne dans une tuile, onglet levé */
  --plaque-vive: #34457c;   /* encore un ton : ce qui est choisi dans une tuile */
  --plaque-bord: #0a1022;   /* l'épaisseur des tuiles, le fond des rainures et des champs */
  --plaque-barre: #0e1530;  /* la barre du bas, le bac de la ville, la palette du musée */
  --tenons-fond: radial-gradient(circle at 8px 8px, rgba(255,255,255,.035) 0 3.2px, transparent 3.7px) 0 0 / 16px 16px;
  --tenons-barre: radial-gradient(circle at 8px 8px, rgba(255,255,255,.05) 0 3.2px, transparent 3.7px) 0 0 / 16px 16px;
  --ombre-tuile: 0 4px 0 var(--plaque-bord), inset 0 1px 0 rgba(255,255,255,.07);
  --ombre-ligne: 0 3px 0 var(--plaque-bord), inset 0 1px 0 rgba(255,255,255,.06);

  /* ── Les briques, par rôle : la couleur, sa face du haut (3 px), le clair des tenons, l'épaisseur, le texte ── */
  --jaune: #ffc52e; --jaune-face: #ffd458; --jaune-clair: #ffe07a; --jaune-ombre: #b47f00; --jaune-txt: #2a1c00;  /* l'action principale */
  --bleu: #2b6be0;  --bleu-face: #538bf1;  --bleu-clair: #74a6ff;  --bleu-ombre: #173c8e;                          /* les actions secondaires */
  --vert: #1d8438;  --vert-face: #4ab461;  --vert-clair: #6fdb83;  --vert-ombre: #0f5a24;                          /* réussi, construit, poser */
  --rouge: #d63228; --rouge-face: #ec5a4d; --rouge-clair: #ff7a6b; --rouge-ombre: #8a1810;                         /* danger, alertes, pastilles */
  --eteint: #3a4566; --eteint-face: #49567b; --eteint-clair: #56638c; --eteint-ombre: #232c47; --eteint-txt: #a9b3cf; /* désactivé */

  /* ── Les textes (4,5:1 au moins sur --plaque-nuit, --plaque et --plaque-haut) ── */
  --texte: #f4f6fc;
  --texte-2: #aeb8d4;
  --texte-3: #9aa5c6;

  /* ── Formes, relief, mouvement ── */
  --r-brique: 5px;   /* jamais de pilule */
  --r-tuile: 10px;
  --r-fenetre: 12px;
  --relief: 4px;     /* l'épaisseur d'une brique : elle s'enfonce d'autant au toucher */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --appui: 110ms;

  /* ── Les polices ── */
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-titre: 'Bungee', 'Rubik', system-ui, sans-serif;
  --font-bold: 700;
  --font-semi: 600;

  /* ── Les anciens noms, gardés (le JS et les autres feuilles s'en servent) avec les valeurs du nouveau style ── */
  --bg: var(--plaque-nuit);
  --bg-card: var(--plaque);
  --bg-surface: var(--plaque-haut);
  --bg-elevated: var(--plaque-vive);
  --card-bg: var(--plaque);
  --primary: var(--jaune);
  --primary-dark: var(--jaune-ombre);
  --primary-btn: var(--jaune);     /* un fond jaune : son texte est --jaune-txt */
  --accent: var(--vert-clair);
  --accent-dark: var(--vert);
  --gold: var(--jaune);
  --gold-dark: var(--jaune-ombre);
  --purple: #b462e6;
  --purple-dark: #7d3c98;
  --blue: var(--bleu-clair);
  --green: var(--vert-clair);
  --success: var(--vert-clair);
  --gray: #8e8e93;
  --text: var(--texte);
  --text-dim: var(--texte-2);
  --text-muted: var(--texte-3);
  --danger: var(--rouge);          /* un fond ; un texte d'erreur est --rouge-clair */

  /* ── Les raretés (les mêmes teintes que data.js, un peu éclaircies pour la plaque nuit) ── */
  --rarity-c: #8e8e93;
  --rarity-pc: #34c759;
  --rarity-r: #2f8cff;
  --rarity-sr: #b462e6;
  --rarity-ur: #ffd700;

  /* ── Tailles ── */
  --tab-h: 64px;
  --status-h: 56px;
  /* iPhone notch / home indicator (viewport-fit=cover + translucent status bar) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: var(--r-tuile);
  --radius-lg: var(--r-fenetre);
  --radius-card: 14px;
  --gap: 10px;
  --pad: 16px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
/* la plaque nuit : un motif de tenons très discret, tous les 16 px */
body { background: var(--tenons-fond), var(--plaque-nuit); }
button, input, select, textarea { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tab, .ct-tab, .filter-btn, .btn, .btn-icon, .city-btn, .city-pill { -webkit-touch-callout: none; }

/* ══════════════════════════════════════════════════════════
   LES COMPOSANTS COMMUNS
   ══════════════════════════════════════════════════════════ */

/* ── Les titres : Bungee (déjà en capitales) pour le titre d'un écran, avec une ombre pleine ; Rubik pour le reste ── */
.screen-title, .sc-titre, #build-complete-content > h2 {
  font-family: var(--font-titre); font-weight: 400; letter-spacing: .5px; text-shadow: 0 3px 0 var(--plaque-bord);
}
.screen-title { font-size: 22px; line-height: 1.15; margin: 2px 0 4px; color: var(--texte); }
.screen-subtitle { font-size: 15px; line-height: 1.4; color: var(--texte-2); margin-bottom: 16px; }

/* ── La tuile : un panneau lisse, un liseré clair en haut, une épaisseur pleine en bas (pas d'ombre grise floue) ── */
.card-panel {
  background: var(--plaque); border-radius: var(--r-tuile); padding: 14px; margin-bottom: 18px;
  box-shadow: var(--ombre-tuile);
}
.card-panel > h3 { margin: 0 0 12px; font-size: 18px; font-weight: 800; line-height: 1.2; }

/* ── LA BRIQUE : le bouton à texte ──
   Une couleur pleine, la face du haut un peu plus claire (3 px), l'épaisseur en ombre pleine dessous et une petite ombre
   portée ; coins de 5 px. Les tenons : une rangée sur le haut (::before), un dégradé de cylindre découpé en dômes par un
   masque, répartis avec « space no-repeat » : aucun tenon coupé. Au toucher, la brique s'enfonce de son épaisseur. */
.btn {
  --c: var(--bleu); --c-face: var(--bleu-face); --c-clair: var(--bleu-clair); --c-ombre: var(--bleu-ombre); --c-txt: #fff;
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 8px 20px 6px;
  font: 700 16px/1.15 var(--font); color: var(--c-txt); text-align: center; text-decoration: none;
  border: 0; border-radius: var(--r-brique); cursor: pointer;
  background: linear-gradient(180deg, var(--c-face) 0 3px, var(--c) 3px);
  box-shadow: 0 var(--relief) 0 var(--c-ombre), 0 calc(var(--relief) + 4px) 6px rgba(0,0,0,.28);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out), filter var(--appui) var(--ease-out);
  -webkit-user-select: none; user-select: none;
}
.btn::before {
  content: ''; position: absolute; left: 4px; right: 4px; top: -6px; height: 6px; pointer-events: none;
  background: linear-gradient(90deg, transparent 5.5px, var(--c-clair) 5.5px 8.5px, var(--c) 8.5px 13.5px, var(--c-ombre) 13.5px 16.5px, transparent 16.5px) 0 0 / 22px 100% space no-repeat;
  -webkit-mask: radial-gradient(5.5px 6px at 50% 100%, #000 98%, transparent) 0 0 / 22px 100% space no-repeat;
          mask: radial-gradient(5.5px 6px at 50% 100%, #000 98%, transparent) 0 0 / 22px 100% space no-repeat;
}
.btn:active:not(:disabled):not(.fn-ferme) {
  transform: translateY(var(--relief));
  box-shadow: 0 0 0 var(--c-ombre), 0 2px 3px rgba(0,0,0,.25);
}
/* les couleurs, par rôle */
.btn-primary, .btn-gold {
  --c: var(--jaune); --c-face: var(--jaune-face); --c-clair: var(--jaune-clair); --c-ombre: var(--jaune-ombre); --c-txt: var(--jaune-txt);
}
.btn-accent, .btn-succes {
  --c: var(--vert); --c-face: var(--vert-face); --c-clair: var(--vert-clair); --c-ombre: var(--vert-ombre); --c-txt: #fff;
}
.btn-danger, .sc-btn-danger {
  --c: var(--rouge); --c-face: var(--rouge-face); --c-clair: var(--rouge-clair); --c-ombre: var(--rouge-ombre); --c-txt: #fff;
}
/* désactivée : une brique gris-bleu terne, sans appui (« trop cher » reste touchable : elle dit ce qui manque) */
.btn:disabled, .btn.btn-dim, .btn.fn-ferme {
  --c: var(--eteint); --c-face: var(--eteint-face); --c-clair: var(--eteint-clair); --c-ombre: var(--eteint-ombre); --c-txt: var(--eteint-txt);
}
.btn:disabled { cursor: default; opacity: 1; }
/* les tailles */
.btn-sm { --relief: 3px; min-height: 38px; padding: 6px 14px 4px; gap: 6px; font-size: 14px; }
.btn-sm::before {
  left: 3px; right: 3px; top: -5px; height: 5px;
  background: linear-gradient(90deg, transparent 4.5px, var(--c-clair) 4.5px 7px, var(--c) 7px 11px, var(--c-ombre) 11px 13.5px, transparent 13.5px) 0 0 / 18px 100% space no-repeat;
  -webkit-mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
          mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
}
.btn-lg { min-height: 54px; padding: 10px 24px 8px; font-size: 17px; width: 100%; }
.btn-block { width: 100%; }
/* « Discret » : un texte souligné, sans brique */
.btn-ghost, .btn.fen-discret, .btn-discret {
  min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--r-brique); background: none; box-shadow: none;
  color: var(--texte-2); font: 600 15px/1.25 var(--font); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-thickness: 1.5px; cursor: pointer;
}
.btn.fen-discret::before, .btn-discret::before { display: none; }
.btn.fen-discret:active:not(:disabled), .btn-discret:active { transform: none; box-shadow: none; color: var(--texte); }

/* ── Les boutons ronds à icône (retour, fermer, outils de la ville et du musée) : des tuiles rondes, sans tenons ── */
.btn-icon, .sc-retour, .fen-x, .legal-fermer, .city-btn, .ctt-x, .sandbox-back, .sandbox-zoom-btn {
  flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--plaque-haut); color: var(--texte); font: 700 19px/1 var(--font); cursor: pointer;
  box-shadow: 0 3px 0 var(--plaque-bord), inset 0 1px 0 rgba(255,255,255,.1);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.btn-icon .ico, .sc-retour .ico, .fen-x .ico, .legal-fermer .ico, .city-btn .ico, .ctt-x .ico, .sandbox-back .ico, .sandbox-zoom-btn .ico { width: 24px; height: 24px; }
.btn-icon:active, .sc-retour:active, .fen-x:active, .legal-fermer:active, .city-btn:active, .ctt-x:active, .sandbox-back:active, .sandbox-zoom-btn:active {
  transform: translateY(3px); box-shadow: 0 0 0 var(--plaque-bord), inset 0 1px 0 rgba(255,255,255,.1);
}

/* ── Les champs : enfoncés dans la plaque, bord jaune au focus ; 16 px (l'iPhone ne zoome pas) ── */
.auth-input, .sc-champ, #sort-select {
  border: 2px solid transparent; border-radius: 8px; outline: none;
  background-color: var(--plaque-bord); color: var(--texte); font-family: var(--font); font-size: 16px; font-weight: 500;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.4);
  transition: border-color var(--appui) var(--ease-out);
}
.auth-input::placeholder, .sc-champ::placeholder { color: var(--texte-3); opacity: 1; }
.auth-input:focus, .sc-champ:focus, #sort-select:focus-visible { border-color: var(--jaune); outline: none; }

/* ── Les onglets segmentés : une rainure sombre, l'onglet actif est une tuile levée ── */
.auth-tabs, .pg-onglets, .city-tabs {
  display: flex; gap: 6px; padding: 5px; border-radius: var(--r-tuile);
  background: var(--plaque-bord); box-shadow: inset 0 2px 0 rgba(0,0,0,.35);
}
.auth-tab, .pg-onglet, .ct-tab {
  flex: 1; min-width: 0; min-height: 38px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent;
  color: var(--texte-2); font: 700 14px/1.15 var(--font); cursor: pointer; white-space: nowrap;
  transition: background var(--appui) var(--ease-out), color var(--appui) var(--ease-out);
}
.auth-tab.active, .pg-onglet.actif, .ct-tab.on {
  background: var(--plaque-haut); color: var(--texte); box-shadow: 0 3px 0 #0f1730, inset 0 1px 0 rgba(255,255,255,.1);
}

/* ── Les pastilles : rouges, un chiffre blanc, une petite épaisseur ── */
.pastille, .social-badge, .obj-b-pastille {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--rouge); color: #fff; font: 800 12px/1 var(--font); font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 0 var(--rouge-ombre);
}

/* ── Les jauges : une rainure sombre, un remplissage plein à face claire ── */
.jauge, .coll-progress-bar, .obj-barre, .build-progress-bar {
  background: var(--plaque-bord); box-shadow: inset 0 2px 0 rgba(0,0,0,.35); border-radius: 3px; overflow: hidden;
}
.jauge > i, #coll-progress-fill, .obj-barre > span, #build-progress-fill {
  display: block; height: 100%; border-radius: 0;
  background: linear-gradient(180deg, var(--vert-clair) 0 3px, var(--vert) 3px);
}

/* ── Les toasts : une brique de la couleur du rôle (récompense jaune, info bleue, alerte rouge) ── */
#toast-container {
  position: fixed; z-index: 1000; top: calc(var(--status-h) + var(--safe-top) + 8px); left: 16px; right: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
}
.toast {
  max-width: 420px; padding: 11px 14px 10px; border-radius: var(--r-tuile); text-align: center;
  font: 700 14.5px/1.35 var(--font); color: #fff; overflow-wrap: anywhere;
  background: linear-gradient(180deg, var(--bleu-face) 0 3px, var(--bleu) 3px);
  box-shadow: 0 4px 0 var(--bleu-ombre), 0 10px 20px rgba(0,0,0,.32);
  opacity: 0; transform: translateY(-10px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
  pointer-events: auto;
}
.toast-visible { opacity: 1; transform: none; }
.toast-warning { background: linear-gradient(180deg, var(--rouge-face) 0 3px, var(--rouge) 3px); box-shadow: 0 4px 0 var(--rouge-ombre), 0 10px 20px rgba(0,0,0,.32); }
.toast-reward { background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px); color: var(--jaune-txt); box-shadow: 0 4px 0 var(--jaune-ombre), 0 10px 20px rgba(0,0,0,.32); }

/* ── Les animations partagées et les utilitaires ── */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.hidden { display: none !important; }

/* ── La structure : la barre du haut, les écrans, la barre du bas ── */
body { display: flex; flex-direction: column; }
/* la barre du haut : posée sur la plaque nuit ; le profil, le nom du jeu, les compteurs en tuiles.
   Fond opaque (le même que la page) : depuis iOS 26, l'appli posée sur l'écran d'accueil floute le haut de l'écran quand
   ce qui est sous l'heure est transparent (la barre du haut devenait floue partout). */
#top-bar {
  height: calc(var(--status-h) + var(--safe-top)); padding: var(--safe-top) 12px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--tenons-fond), var(--plaque-nuit); flex-shrink: 0; z-index: 50;
}
/* la même bande opaque sous l'heure de l'iPhone, sur les écrans sans barre du haut (Ma ville, Mode Libre…) */
#bande-statut { position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: var(--plaque-nuit);
  z-index: 60; pointer-events: none; }
#top-bar .logo-marque { display: block; height: 30px; width: auto; flex: none; }
#top-bar-right { display: flex; align-items: center; gap: 8px; }
#top-bar .currency {
  display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 8px; border-radius: var(--r-tuile); cursor: pointer;
  background: var(--plaque); box-shadow: var(--ombre-ligne); color: var(--texte);
  font: 700 15px/1 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap;
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
#top-bar .currency:active { transform: translateY(3px); box-shadow: 0 0 0 var(--plaque-bord); }
#top-bar .currency-icon { display: grid; place-items: center; }
/* l'or et, dessous, les éclats : le même compteur, sur deux lignes (l'or en grand, les éclats et leur gemme un peu plus petits) ;
   la barre tient ainsi à 360 px avec le bouton du son. Toucher les éclats ouvre la Boutique sur ses packs d'éclats (app.js). */
#top-bar .currency-or .cur-txt, #top-bar .currency-boosters .cur-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; line-height: 1; }
#top-bar .currency-or .cur-eclats, #top-bar .currency-boosters .cur-eclats { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; font-weight: 700; }
#top-bar .currency-or .cur-eclats .ico, #top-bar .currency-boosters .cur-eclats .ico { width: 14px; height: 14px; }
#shop-eclats, #shop-gemmes { scroll-margin-top: 72px; }
/* le bouton du son (booster.js) : une tuile ronde, au coin haut droit de tous les écrans qui ont la barre du haut (Ma ville a le
   même dans ses tuiles) ; coupé, l'icône barrée */
#top-bar .son-bouton {
  position: relative; flex: none; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; background: var(--plaque); color: var(--texte); box-shadow: var(--ombre-ligne);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
#top-bar .son-bouton:active { transform: translateY(3px); box-shadow: 0 0 0 var(--plaque-bord); }
#top-bar .son-bouton .ico { width: 24px; height: 24px; }
/* (le logo cède la place s'il le faut : il rapetisse, et sur un téléphone, à côté de « Connexion », il laisse la place au son) */
#top-bar .logo-marque { flex: 0 1 auto; min-width: 0; object-fit: contain; object-position: left center; }
@media (max-width: 420px) { #top-bar-left:has(.social-avatar.invite) .logo-marque { display: none; } }
@media (max-width: 340px) { #top-bar .logo-marque { display: none; } }
/* à 360 px, « Connexion » à côté de 99 999 pièces et de 112 boosters : les tuiles se serrent un peu (rien ne se chevauche) */
@media (max-width: 375px) {
  #top-bar-right { gap: 6px; }
  #top-bar .currency { gap: 5px; padding: 0 9px 0 7px; }
}
#top-bar .timer { font-size: 12px; font-weight: 600; color: var(--texte-2); margin-left: 1px; }
#screens { flex: 1; overflow: hidden; position: relative; }

/* la barre du bas : une plaque à tenons ; l'onglet actif est une petite brique jaune avec ses tenons, posée et levée */
#tab-bar {
  height: calc(var(--tab-h) + var(--safe-bottom)); padding: 6px 4px calc(4px + var(--safe-bottom));
  display: flex; align-items: stretch; justify-content: space-around; flex-shrink: 0; z-index: 50;
  background: var(--tenons-barre), var(--plaque-barre);
  box-shadow: 0 -1px 0 rgba(255,255,255,.06), 0 -4px 0 rgba(0,0,0,.18);
}
#tab-bar .tab {
  position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 0; border: 0; background: none; color: var(--texte-3); font: 600 11px/1.1 var(--font); cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
#tab-bar .tab .tab-icon {
  position: relative; width: 44px; height: 30px; border-radius: var(--r-brique); display: grid; place-items: center;
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
#tab-bar .tab .tab-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
#tab-bar .tab .tab-icon .ti-fill { fill: currentColor; fill-opacity: .14; }
#tab-bar .tab .tab-icon .ti-solid { fill: currentColor; stroke: none; }
#tab-bar .tab .tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#tab-bar .tab.active { color: var(--texte); }
#tab-bar .tab.active .tab-icon {
  color: var(--jaune-txt); transform: translateY(-3px);
  background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px);
  box-shadow: 0 3px 0 var(--jaune-ombre), 0 5px 6px rgba(0,0,0,.3);
}
#tab-bar .tab.active .tab-icon .ti-fill { fill-opacity: .22; }
#tab-bar .tab.active .tab-icon::before {
  content: ''; position: absolute; left: 4px; right: 4px; top: -5px; height: 5px; pointer-events: none;
  background: linear-gradient(90deg, transparent 4.5px, var(--jaune-clair) 4.5px 7px, var(--jaune) 7px 11px, var(--jaune-ombre) 11px 13.5px, transparent 13.5px) 0 0 / 18px 100% space no-repeat;
  -webkit-mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
          mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
}
#tab-bar .tab:active .tab-icon { transform: translateY(0); }

/* ── Les écrans ── */
.screen { display: none; flex-direction: column; height: 100%; overflow-y: auto; }
.screen.active { display: flex; }
.screen.overlay {
  position: fixed; inset: 0; z-index: 200; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom);
  align-items: stretch; justify-content: flex-start; background: var(--tenons-fond), var(--plaque-nuit);
}
.screen.overlay.active { animation: fade-in .2s var(--ease-out); }
.screen-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 40px; }

/* ── Les filtres (collection, musée) : de petites tuiles ; le filtre choisi est une brique jaune ── */
.filter-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 0; border-radius: 6px; cursor: pointer; white-space: nowrap;
  background: var(--plaque); color: var(--texte); font: 700 14px/1 var(--font);
  box-shadow: 0 3px 0 var(--plaque-bord), inset 0 1px 0 rgba(255,255,255,.07);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.filter-btn.active {
  background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px); color: var(--jaune-txt);
  box-shadow: 0 3px 0 var(--jaune-ombre);
}
.filter-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--plaque-bord); }

/* ── Les écrans qui sont des listes (la Collection, l'exposition, la Boutique, le profil) : la liste défile, leur haut (le titre,
   son bouton) reste en haut de l'écran, posé sur la plaque nuit, ses tenons alignés sur ceux du fond ── */
#collection-screen .coll-head, #showcase-screen .coll-head, #shop-screen .screen-scroll > .screen-title, .sc-tete {
  position: sticky; top: 0; z-index: 6;
  background: var(--tenons-fond), var(--plaque-nuit); background-position: 0 calc(0px - var(--status-h) - var(--safe-top)), 0 0;
}
#collection-screen .coll-head, #showcase-screen .coll-head { margin: -14px -16px 0; padding: 18px 16px 6px; }
#shop-screen .screen-scroll > .screen-title { margin: -14px -16px 4px; padding: 16px 16px 8px; }
/* collés contre le bord du haut, pas sous la marge intérieure de la liste : sinon ce qui défile passait dans le jour
   au-dessus (le profil : 12 px, les autres : 14 px) */
#collection-screen .coll-head, #showcase-screen .coll-head, #shop-screen .screen-scroll > .screen-title { top: -14px; }
.sc-tete { top: -12px; }

/* ── La collection ── */
.coll-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 8px; margin-top: 6px; }
.coll-head .screen-title { margin: 0; }
.coll-showcase-btn { flex: none; padding-left: 12px; padding-right: 12px; }
.coll-progress { display: flex; align-items: center; gap: 10px; margin: 12px 0 12px; font-size: 14px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.coll-progress b { color: var(--texte); }
.coll-progress-bar { flex: 1; height: 12px; }
#coll-progress-fill { width: 0; transition: width .4s var(--ease-out); }
#collection-filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 8px; padding: 2px 16px 7px; scrollbar-width: none; overscroll-behavior-x: contain; }
#collection-filters::-webkit-scrollbar { display: none; }
#collection-filters .filter-btn { flex: none; margin: 0; }
.chip-count { font-weight: 600; opacity: .78; font-variant-numeric: tabular-nums; }
#collection-recherche { margin-bottom: 10px; }
#collection-search {
  width: 100%; min-height: 44px; padding: 0 14px; box-sizing: border-box; font-size: 16px; /* 16 px : l'iPhone ne zoome pas la page */
  color: var(--texte, #fff); background: var(--plaque-bord); border: 2px solid transparent; border-radius: 12px;
}
#collection-search:focus { outline: none; border-color: var(--primary, #ffd23d); }
#collection-sort { display: flex; justify-content: flex-end; margin-bottom: 12px; }
#sort-select {
  -webkit-appearance: none; appearance: none; min-height: 44px; padding: 0 36px 0 12px; cursor: pointer;
  background: var(--plaque-bord) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1.5 1.5l4.5 4.5 4.5-4.5' fill='none' stroke='%23aeb8d4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 13px center;
}
.coll-empty {
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
  margin-bottom: 18px; padding: 16px 16px 20px; border-radius: var(--r-tuile); background: var(--plaque); box-shadow: var(--ombre-tuile);
  font-size: 15px; line-height: 1.4; color: var(--texte-2);
}
.coll-empty.hidden { display: none; }
#collection-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
/* « Mes cartes d'abord » : la ligne entre les cartes trouvées et celles qui restent à trouver */
.coll-separe {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; font-size: 14px; font-weight: 700; color: var(--texte-2);
}
.coll-separe::before, .coll-separe::after { content: ""; flex: 1; height: 3px; border-radius: 2px; background: var(--plaque); box-shadow: 0 1px 0 var(--plaque-bord); }
.coll-separe b { color: var(--texte); font-variant-numeric: tabular-nums; }
.credits { margin-top: 24px; text-align: center; font-size: 12px; line-height: 1.5; color: var(--texte-3); }
.credits a { color: var(--texte-2); }
.coll-cell { position: relative; aspect-ratio: 5 / 7; cursor: pointer; transition: transform var(--appui) var(--ease-out); }
.coll-cell:active { transform: scale(.97); }
.coll-cell .bp-tc { position: absolute; inset: 0; width: auto; height: auto; }
/* construite : un rond vert ; plusieurs exemplaires : une pastille rouge « ×2 » au coin */
.coll-built::after {
  content: ''; position: absolute; right: -5px; bottom: -5px; width: 22px; height: 22px; border-radius: 50%;
  background: url(art/icones/ok-blanc.svg) center / 15px 15px no-repeat, var(--vert); box-shadow: 0 2px 0 var(--vert-ombre), 0 0 0 2px var(--plaque-nuit);
}
.coll-nb {
  position: absolute; top: -9px; right: -9px; z-index: 2; min-width: 28px; height: 26px; padding: 0 7px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--rouge); color: #fff; border: 2px solid #fff; font-size: 13px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 0 var(--rouge-ombre); pointer-events: none;
}

/* ── L'exposition ── */
#showcase-3d-area { display: flex; justify-content: center; margin: 4px 0 16px; }
#showcase-canvas {
  display: block; width: min(80vw, 300px, 36vh); height: min(80vw, 300px, 36vh); border-radius: var(--r-fenetre); cursor: grab;
  background: radial-gradient(circle at 50% 58%, rgba(255,214,64,.16), transparent 68%);
}
#showcase-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
#showcase-items .showcase-item {
  aspect-ratio: auto; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
  padding: 8px 6px 10px; border: 2px solid transparent; border-radius: var(--r-tuile); text-align: center;
  background: var(--plaque); box-shadow: 0 3px 0 var(--plaque-bord);
}
#showcase-items .showcase-item:active { transform: translateY(2px); }
#showcase-items .showcase-item.active { outline: 3px solid var(--jaune); outline-offset: 2px; }
#showcase-items .showcase-thumb { width: 100%; height: auto; aspect-ratio: 1; margin: 0; }
#showcase-items .showcase-name { max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
.showcase-count {
  position: absolute; top: -8px; right: -8px; z-index: 1; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 11px;
  display: grid; place-items: center; background: var(--rouge); color: #fff; font-size: 12px; font-weight: 800; box-shadow: 0 2px 0 var(--rouge-ombre);
}
.showcase-thumb { width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; background: radial-gradient(circle, rgba(255,255,255,0.08), transparent 70%); border-radius: var(--r-tuile); margin: 0 auto 6px; }
.showcase-thumb img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 5px rgba(0,0,0,.45)); }
.showcase-name { font-size: 13px; font-weight: 700; }
.showcase-rarity { font-size: 11px; letter-spacing: 1px; }
#showcase-share { margin-top: 22px; }

/* ── La fiche d'une carte ── */
.detail-header { display: flex; align-items: center; gap: 12px; padding: 10px 14px 6px; }
.detail-header h2 { flex: 1; min-width: 0; font: 400 20px/1.15 var(--font-titre); letter-spacing: .4px; text-shadow: 0 3px 0 var(--plaque-bord); overflow-wrap: anywhere; }
#detail-card-info { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; padding: 10px 14px; font-size: 15px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
/* la rareté : une tuile, un carré de sa couleur et son nom (data.js garde les couleurs) */
.rarity-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px 5px 8px; border-radius: var(--r-brique);
  background: var(--plaque-haut); color: var(--texte); font: 700 14px/1 var(--font); box-shadow: 0 3px 0 var(--plaque-bord);
}
.rarity-badge::before { content: ''; flex: none; width: 12px; height: 12px; border-radius: 3px; background: var(--rc, var(--rarity-c)); box-shadow: inset 0 -2px 0 rgba(0,0,0,.28); }
.rar-C { --rc: var(--rarity-c); } .rar-PC { --rc: var(--rarity-pc); } .rar-R { --rc: var(--rarity-r); } .rar-SR { --rc: var(--rarity-sr); } .rar-UR { --rc: var(--rarity-ur); }
/* son rôle dans Ma ville (economie.js, roleHTML) : une ligne de petites tuiles, chacune son icône (« Fait gagner de l'or »,
   « 2 vendeurs », « Loge 4 habitants »…) ; rien pour une carte qui n'a pas de rôle */
.detail-role { flex: 1 1 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.detail-role:empty { display: none; }
.dr-puce {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 7px; border-radius: var(--r-brique);
  background: var(--plaque); color: var(--texte); font: 700 14px/1.2 var(--font); box-shadow: 0 3px 0 var(--plaque-bord);
}
.dr-puce .ico { width: 20px; height: 20px; }
.dr-puce.dr-or { color: var(--jaune); }
/* (le texte sous le modèle ne passe plus sur la rareté : la scène défile si elle est trop haute, au lieu de déborder) */
#detail-card-preview { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
#detail-3d-preview { width: 100%; flex: 1 0 auto; padding: 4px 0 8px; }
.detail-stage {
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 10px; padding: 0 20px;
  --stage: rgba(220,225,240,.12); --cv: min(86vw, 340px, 42vh);
}
.detail-stage.rarity-PC { --stage: rgba(76,217,100,.2); }
.detail-stage.rarity-R  { --stage: rgba(64,156,255,.24); }
.detail-stage.rarity-SR { --stage: rgba(190,110,255,.28); }
.detail-stage.rarity-UR { --stage: rgba(255,214,64,.3); }
/* Le halo (fond en dégradé, coins arrondis) est séparé du canevas : l'animation « fabrique » (objectifs.css) éclaircit le
   canevas tout entier (filter: brightness), et sur certains navigateurs ce filtre casse le découpage aux coins arrondis
   du canevas lui-même — on voyait le halo déborder en rectangle. Le halo ne porte jamais ce filtre : il reste doux. */
.detail-canvas-halo {
  display: inline-flex; border-radius: var(--r-fenetre); overflow: hidden;
  background: radial-gradient(circle at 50% 58%, var(--stage), transparent 68%);
}
.detail-canvas {
  touch-action: none; display: block; width: var(--cv); height: var(--cv); flex: none; cursor: grab;
}
.detail-desc { max-width: 330px; text-align: center; font-size: 15px; line-height: 1.4; color: var(--texte-2); }
.detail-hint { font-size: 13px; color: var(--texte-3); }
.detail-bundle { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 350px; }
.detail-bundle > span { font-size: 14px; font-weight: 700; color: var(--texte-2); }
.detail-bundle > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.odds { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.odds th, .odds td { padding: 8px 3px; text-align: center; border-bottom: 2px solid var(--plaque-bord); }
.odds tr:last-child th, .odds tr:last-child td { border-bottom: 0; }
.odds th { font-weight: 800; }
.odds th:first-child { text-align: left; color: var(--texte-2); font-weight: 600; }
.odds td { color: var(--texte); }
.odds-note { margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--texte-2); }
.detail-note { max-width: 320px; text-align: center; font-size: 15px; line-height: 1.35; font-weight: 700; color: var(--jaune); }
.detail-card-fallback { position: relative; width: 220px; height: 308px; }
.detail-card-fallback .bp-tc { position: absolute; inset: 0; }
#detail-actions { padding: 14px 16px calc(14px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; }
/* un écran bas : le modèle un peu plus petit, rien ne se chevauche */
@media (max-height: 780px) {
  .detail-stage { --cv: min(80vw, 300px, 33vh); gap: 7px; }
  .detail-desc { font-size: 14px; line-height: 1.35; }
  .detail-bundle { gap: 6px; }
  .detail-bundle > span { font-size: 13px; }
  #detail-card-info { padding: 8px 14px; }
  #detail-actions { gap: 12px; padding-top: 10px; }
}

/* ── La construction ── */
.build-header { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) 12px 10px; }
.build-header h2 { flex: 1; min-width: 0; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#build-progress { flex: none; padding: 8px 10px; border-radius: var(--r-tuile); background: var(--plaque); box-shadow: var(--ombre-ligne); font-size: 14px; font-weight: 700; color: var(--texte-2); font-variant-numeric: tabular-nums; }
#build-progress span { color: var(--texte); }
.build-progress-bar { height: 8px; margin: 0 12px 4px; }
#build-progress-fill { width: 0; transition: width .25s linear; background: linear-gradient(180deg, var(--jaune-clair) 0 2px, var(--jaune) 2px); }
#build-canvas { touch-action: none; cursor: grab; }
/* la vue du montage prend la place qui reste (min-height: 0) ; son canevas est posé dessus : il ne pousse jamais « Passer »
   hors de l'écran, et app.js le remet à la taille de la vue quand l'écran change */
#build-viewport { flex: 1; min-height: 0; position: relative; overflow: hidden; background: #0d1226; }
#build-viewport canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#build-instructions { position: absolute; bottom: 10px; left: 10px; right: 10px; margin: 0; padding: 10px 14px; }
#build-instruction-text { font-size: 15px; font-weight: 600; }

#build-action-bar { display: flex; gap: 10px; padding: 14px 16px calc(12px + var(--safe-bottom)); }
#build-action-bar .btn { flex: 1; }

/* ── « Bravo ! » ── */
#build-complete-content { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 24px 20px; text-align: center; gap: 14px; overflow-y: auto; }
#build-complete-content > h2 { font-size: 34px; line-height: 1; color: var(--jaune); text-shadow: 0 4px 0 var(--jaune-ombre), 0 8px 0 var(--plaque-bord); }
#build-complete-name { font-size: 18px; font-weight: 700; }
#build-complete-3d { width: min(78vw, 300px, 36vh); height: min(78vw, 300px, 36vh); border-radius: var(--r-fenetre); background: radial-gradient(circle at 50% 58%, rgba(255,214,64,.22), transparent 68%); }
#build-complete-3d .detail-canvas { width: 100%; height: 100%; background: none; }
#build-complete-stats { display: flex; gap: 16px; font-size: 15px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
#build-complete-content .btn { width: min(100%, 340px); }
#build-complete-content .btn-lg { margin-top: 6px; }

/* ── Les états vides ── */
.empty-state { text-align: center; padding: 28px 18px; color: var(--texte-2); font-size: 15px; line-height: 1.45; border-radius: var(--r-tuile); background: var(--plaque); box-shadow: var(--ombre-tuile); }
.empty-state p + p { margin-top: 4px; }
.empty-state .btn { margin: 20px auto 0; }

/* ── La boutique ── */
.shop-items { display: flex; flex-direction: column; gap: 10px; }
.shop-item {
  position: relative; display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 12px;
  background: var(--plaque-haut); border-radius: var(--r-tuile); box-shadow: var(--ombre-ligne);
}
.shop-item .btn { flex: none; }
.shop-item-icon { flex: none; width: 52px; height: 52px; margin: -6px 0; }
.shop-item-icon .ico-grande { width: 100%; height: 100%; }
.shop-item-icon .ico { width: 34px; height: 34px; margin: 9px; }
.shop-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shop-item-name { font-size: 15px; font-weight: 700; }
.shop-item-price { font-size: 14px; color: var(--jaune); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════
   SANDBOX / MODE LIBRE
   ══════════════════════════════════════════════════════════ */

/* ── Le musée en plein écran : une barre d'outils en haut, la palette en bas (des plaques à tenons) ── */
.sandbox-fullscreen {
  display: flex !important; flex-direction: column;
  position: fixed; inset: 0; z-index: 200;
  background: var(--tenons-fond), var(--plaque-nuit);
}
.sandbox-fullscreen:not(.active) { display: none !important; }

/* ── La barre d'outils ── */
#sandbox-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-top)) 10px 8px;
  background: var(--tenons-barre), var(--plaque-barre); box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 0 rgba(0,0,0,.18);
  z-index: 10; flex-shrink: 0;
}
.sandbox-btn {
  background: var(--plaque-haut); border: none; color: var(--texte);
  padding: 6px 12px; border-radius: var(--r-tuile); font-size: 14px;
  cursor: pointer; white-space: nowrap; box-shadow: 0 3px 0 var(--plaque-bord);
}
.sandbox-back { font-size: 20px; }
#sandbox-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sbx-title { font-weight: 800; font-size: 16px; color: var(--texte); }
.sbx-stats { font-size: 12.5px; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
#sandbox-pieces-count, #sandbox-coins-display { font-weight: 700; color: var(--jaune); }
#sandbox-tools-bar { display: flex; gap: 5px; flex-shrink: 0; }
/* un outil : une tuile ; l'outil en main : une brique jaune */
.sandbox-tool {
  width: 48px; height: 46px; padding: 2px 0 0; border: 0; border-radius: var(--r-brique);
  background: var(--plaque-haut); color: var(--texte); cursor: pointer; box-shadow: 0 3px 0 var(--plaque-bord);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.sandbox-tool .tool-icon { font-size: 17px; line-height: 1; }
.sandbox-tool .tool-label { font-size: 10.5px; font-weight: 700; color: var(--texte-2); }
.sandbox-tool.active { background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px); box-shadow: 0 3px 0 var(--jaune-ombre); }
.sandbox-tool.active .tool-label { color: var(--jaune-txt); }
.sandbox-tool:active { transform: translateY(3px); box-shadow: 0 0 0 var(--plaque-bord); }
@media (max-width: 380px) { #sandbox-tools-bar { gap: 4px; } .sandbox-tool { width: 44px; } }

/* ── La zone de construction ── */
#sandbox-canvas-wrap {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  touch-action: none;
}
#sandbox-canvas-wrap > canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#sandbox-plot-info {
  position: absolute; left: 10px; top: 10px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--plaque); box-shadow: var(--ombre-ligne);
  border-radius: var(--r-tuile); padding: 6px 6px 6px 12px;
  font-size: 13px; color: var(--texte-2);
}
#sandbox-plot-size { font-weight: 800; color: var(--texte); font-variant-numeric: tabular-nums; }
/* « Agrandir · 500 » et sa pièce : une petite brique jaune, avec ses tenons */
.sandbox-expand-btn, .sandbox-chip-btn {
  position: relative; border: none; padding: 3px 10px 0; height: 34px; border-radius: var(--r-brique);
  font: 700 13.5px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.sandbox-expand-btn {
  background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px); color: var(--jaune-txt); box-shadow: 0 3px 0 var(--jaune-ombre);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.sandbox-expand-btn::before {
  content: ''; position: absolute; left: 3px; right: 3px; top: -5px; height: 5px; pointer-events: none;
  background: linear-gradient(90deg, transparent 4.5px, var(--jaune-clair) 4.5px 7px, var(--jaune) 7px 11px, var(--jaune-ombre) 11px 13.5px, transparent 13.5px) 0 0 / 18px 100% space no-repeat;
  -webkit-mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
          mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
}
.sandbox-expand-btn:disabled { background: var(--eteint); color: var(--eteint-txt); box-shadow: 0 3px 0 var(--eteint-ombre); cursor: default; }
.sandbox-expand-btn:disabled::before { display: none; }

.sandbox-expand-btn:active:not(:disabled), .sandbox-chip-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--jaune-ombre); }
#sandbox-zoom-controls {
  position: absolute; right: 10px; top: 10px; z-index: 5;
  display: flex; flex-direction: column; gap: 9px;
}
.sandbox-zoom-btn { background: var(--plaque); font-size: 21px; }
#sandbox-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5;
  max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--plaque); color: var(--texte); box-shadow: var(--ombre-ligne);
  font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: var(--r-tuile);
  pointer-events: none;
}
#sandbox-place-bar {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 6px; padding: 10px 8px 8px;
  border-radius: var(--r-tuile); background: var(--plaque);
  box-shadow: var(--ombre-tuile), 0 8px 16px rgba(0,0,0,.3);
}
.sbx-pb-btn {
  width: 40px; height: 42px; padding: 0; border: none; border-radius: var(--r-brique);
  background: var(--plaque-haut); color: var(--texte); font-size: 17px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 var(--plaque-bord);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.sbx-pb-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--plaque-bord); }
.sbx-pb-pad { display: flex; gap: 4px; }
.sbx-arrow { width: 34px; font-size: 13px; }
/* « Poser » (et sa coche) : la brique jaune de l'action principale */
.sbx-pb-place {
  position: relative; height: 42px; padding: 3px 14px 0; border: none; border-radius: var(--r-brique);
  background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px); color: var(--jaune-txt);
  font: 800 15px/1 var(--font); cursor: pointer; white-space: nowrap; box-shadow: 0 3px 0 var(--jaune-ombre);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.sbx-pb-place::before {
  content: ''; position: absolute; left: 3px; right: 3px; top: -5px; height: 5px; pointer-events: none;
  background: linear-gradient(90deg, transparent 4.5px, var(--jaune-clair) 4.5px 7px, var(--jaune) 7px 11px, var(--jaune-ombre) 11px 13.5px, transparent 13.5px) 0 0 / 18px 100% space no-repeat;
  -webkit-mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
          mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
}
.sbx-pb-place:active { transform: translateY(3px); box-shadow: 0 0 0 var(--jaune-ombre); }
.sbx-pb-place.blocked { background: var(--eteint); color: var(--eteint-txt); box-shadow: 0 3px 0 var(--eteint-ombre); font-size: 13px; }
.sbx-pb-place.blocked::before { display: none; }

/* ── La palette : les familles de pièces (des filtres), les pièces, la couleur ── */
#sandbox-palette {
  background: var(--tenons-barre), var(--plaque-barre); box-shadow: 0 -1px 0 rgba(255,255,255,.06), 0 -4px 0 rgba(0,0,0,.18);
  padding: 10px 0 calc(8px + var(--safe-bottom));
  flex-shrink: 0; z-index: 10;
}
#sandbox-cats {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 10px 9px;
}
#sandbox-cats::-webkit-scrollbar { display: none; }
.sbx-cat {
  flex-shrink: 0; border: 0; min-height: 34px; padding: 0 12px; border-radius: 6px;
  background: var(--plaque); color: var(--texte); font: 700 13.5px/1 var(--font);
  box-shadow: 0 3px 0 var(--plaque-bord), inset 0 1px 0 rgba(255,255,255,.07);
  cursor: pointer; white-space: nowrap;
}
.sbx-cat.active { background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px); color: var(--jaune-txt); box-shadow: 0 3px 0 var(--jaune-ombre); }
#sandbox-pieces-scroll {
  overflow-x: auto; scrollbar-width: none; padding: 0 10px;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
#sandbox-pieces-scroll::-webkit-scrollbar { display: none; }
#sandbox-pieces-list { display: flex; gap: 8px; padding: 2px 0 8px; }
.sbx-piece {
  position: relative; flex-shrink: 0; width: 80px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 5px 4px 6px; border-radius: var(--r-tuile); border: 2px solid transparent;
  background: var(--plaque); color: var(--texte); cursor: pointer; box-shadow: 0 3px 0 var(--plaque-bord);
  transition: transform var(--appui) var(--ease-out);
}
.sbx-piece.selected { border-color: var(--jaune); background: var(--plaque-haut); }
.sbx-piece:active { transform: translateY(2px); }
.sbx-piece.empty .sbx-piece-img { opacity: 0.4; }
.sbx-piece.empty .sbx-piece-count { color: var(--rouge-clair); }
.sbx-piece-img {
  width: 64px; height: 64px; border-radius: 8px;
  background: radial-gradient(circle at 50% 38%, #f1f4fa 0%, #c3cbe0 78%);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.sbx-piece-img img { width: 100%; height: 100%; object-fit: contain; display: none; }
.sbx-piece-img.has-img img { display: block; }
.sbx-piece-img.has-img .sbx-piece-fallback { display: none; }
.sbx-piece-fallback { font-size: 1.6rem; }
.sbx-piece-fallback .ico { width: 34px; height: 34px; }
.sbx-piece-name {
  font-size: 11.5px; font-weight: 700; line-height: 1.15; text-align: center;
  min-height: 2.3em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sbx-piece-count {
  position: absolute; top: 3px; right: 3px; min-width: 22px; padding: 2px 5px;
  border-radius: 5px; background: var(--plaque-nuit); color: var(--jaune);
  font-size: 11px; font-weight: 800; text-align: center;
}
#sandbox-color-row { display: flex; align-items: center; gap: 8px; padding: 2px 10px 0; }
#sandbox-color-label { flex-shrink: 0; width: 70px; font-size: 12px; line-height: 1.2; color: var(--texte-2); }
#sandbox-color-label b { color: var(--texte); font-size: 13px; }
#sandbox-colors { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 6px 4px; }
#sandbox-colors::-webkit-scrollbar { display: none; }
/* les couleurs : des ronds, comme le dessus d'un tenon */
.sbx-color {
  flex-shrink: 0; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.2), 0 2px 0 rgba(0,0,0,.35);
}
.sbx-color.active { border-color: #fff; box-shadow: 0 0 0 3px var(--jaune), inset 0 -3px 0 rgba(0,0,0,.2); }
#sandbox-color-row.is-fixed .sbx-color { opacity: 0.35; }

/* ═══════════════════════════════════════════════════════
   LE DÉMARRAGE (splash) ET LA CONNEXION
   ═══════════════════════════════════════════════════════ */
#splash-screen.active {
  position: fixed; inset: 0; z-index: 200; padding: var(--safe-top) 0 var(--safe-bottom);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--tenons-fond), var(--plaque-nuit);
}
/* une lumière chaude sur les modèles qui tournent */
.splash-bg { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(70% 42% at 50% 34%, rgba(255,197,46,.11), transparent 72%); }
.splash-content {
  position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 0 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  animation: splash-fade-in .45s var(--ease-out) both;
}
@keyframes splash-fade-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
/* le nom du jeu : le logo dessiné (art/marque/logo.svg, fait par tools/design/marque.py : « Brick » en or et tenon sur le i, « ZR » en rouge, le R descendu) */
.splash-logo, .auth-logo { margin: 0; line-height: 0; }
.splash-logo img, .auth-logo img { display: block; height: auto; }
.splash-logo img { width: min(76vw, 300px); }
.splash-model { display: block; width: min(70vw, 280px, 34vh); height: min(70vw, 280px, 34vh); margin-bottom: -10px; touch-action: none; }
.splash-tagline { font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--texte-2); }
.splash-btn { width: min(100%, 300px); margin-top: 10px; }

#auth-screen.active {
  position: fixed; inset: 0; z-index: 200; padding: var(--safe-top) 0 var(--safe-bottom);
  display: flex; flex-direction: column; align-items: center; overflow-y: auto; overscroll-behavior: contain;
  background: var(--tenons-fond), var(--plaque-nuit);
}
/* margin: auto : centré quand il y a la place, et le haut ne se coupe jamais quand le formulaire est long */
.auth-wrap {
  width: 100%; max-width: 380px; margin: auto 0; padding: 20px 20px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.auth-logo { margin: 0 0 6px; }
.auth-logo img { width: min(60vw, 230px); }
.auth-tabs { width: 100%; }
.auth-tab { font-size: 15px; min-height: 42px; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.auth-input { width: 100%; min-height: 50px; padding: 0 14px; }
.auth-error, .auth-info {
  padding: 10px 12px; border-radius: var(--r-tuile); font-size: 14.5px; line-height: 1.4; font-weight: 600;
  box-shadow: 0 3px 0 var(--plaque-bord), inset 0 1px 0 rgba(255,255,255,.06);
}
.auth-error { background: #3b1a22; color: var(--rouge-clair); text-align: center; }
.auth-submit { width: 100%; margin-top: 12px; }
.auth-guest { color: var(--texte); font-size: 16px; }

/* ══ Ma ville (city.js) : la 3D en plein écran, des tuiles posées dessus ══ */
.city-fullscreen {
  display: block !important;
  position: fixed; inset: 0; z-index: 200;
  background: #a9daf7; overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.city-fullscreen:not(.active) { display: none !important; }
#city-view { position: absolute; inset: 0; }
.city-canvas { display: block; touch-action: none; }

/* en haut : retour, le titre (il ouvre la Mairie), annuler, tourner la vue — des tuiles rondes et une tuile */
.city-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  padding: calc(8px + var(--safe-top)) 10px 8px;
  pointer-events: none;
}
.city-top > * { pointer-events: auto; }
.city-btn { background: var(--plaque); font-size: 20px; }
.city-title {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 4px 12px; height: 44px; border-radius: var(--r-tuile);
  background: var(--plaque); color: var(--texte); box-shadow: var(--ombre-ligne);
  transition: transform var(--appui) var(--ease-out);
}
.city-title:active { transform: translateY(2px); }
.city-title b { font-size: 16px; line-height: 1.1; }
.city-title span { font-size: 12px; line-height: 1.2; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* le coach (premiers pas) : une brique jaune ; les messages : une tuile */
.city-coach {
  position: absolute; z-index: 3; left: 12px; right: 12px; top: calc(152px + var(--safe-top));
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px 10px; border-radius: var(--r-tuile);
  background: linear-gradient(180deg, var(--jaune-face) 0 3px, var(--jaune) 3px); color: var(--jaune-txt);
  font-size: 14.5px; font-weight: 700; line-height: 1.35;
  box-shadow: 0 4px 0 var(--jaune-ombre), 0 8px 14px rgba(0,0,0,.22);
}
.city-coach button { margin-left: auto; flex: none; border: 0; background: rgba(42,28,0,.14); color: inherit; width: 30px; height: 30px; border-radius: 50%; font-size: 13px; cursor: pointer; }
.city-flash {
  position: absolute; z-index: 4; left: 50%; top: calc(152px + var(--safe-top));
  transform: translate(-50%, -6px); opacity: 0; pointer-events: none;
  width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: var(--r-tuile);
  background: var(--plaque); color: var(--texte); font-size: 14.5px; font-weight: 600; line-height: 1.35; text-align: center;
  box-shadow: var(--ombre-tuile), 0 8px 14px rgba(0,0,0,.25);
  transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
}
.city-flash.show { opacity: 1; transform: translate(-50%, 0); }
/* un message à la place du coach : le coach se retire le temps des messages (city.js), rien ne se recouvre */
#city-screen.flash-montre .city-coach { display: none !important; }

/* en bas : la barre d'édition (une tuile) au-dessus du bac (une plaque à tenons) */
.city-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 0 8px calc(8px + var(--safe-bottom));
  pointer-events: none;
}
.city-bottom > * { pointer-events: auto; }
.city-bar {
  display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px 6px;
  margin: 0 2px 12px; padding: 12px 10px 10px 12px; border-radius: var(--r-tuile);
  background: var(--plaque); color: var(--texte); box-shadow: var(--ombre-tuile), 0 8px 16px rgba(0,0,0,.22);
}
.city-bar.hidden { display: none; }
.cb-text { flex: 1 1 0; min-width: 0; font-size: 14px; line-height: 1.3; color: var(--texte-2); }
/* beaucoup de boutons (modifier un bâtiment, les Berges) : le texte a toute sa ligne, les boutons en dessous */
.city-bar:has(> .cb-btn:nth-of-type(4)) .cb-text { flex-basis: 100%; }
.cb-text b { color: var(--texte); font-size: 15px; }
.cb-n { color: var(--jaune); font-weight: 700; }
/* les boutons de la barre : de petites briques (les tenons sur ceux qui ont un texte), le principal en jaune */
.cb-btn {
  --c: var(--bleu); --c-face: var(--bleu-face); --c-clair: var(--bleu-clair); --c-ombre: var(--bleu-ombre);
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center;
  height: 40px; min-width: 44px; padding: 3px 13px 0; border: 0; border-radius: var(--r-brique);
  background: linear-gradient(180deg, var(--c-face) 0 3px, var(--c) 3px); color: #fff;
  font: 700 15px/1 var(--font); cursor: pointer; white-space: nowrap;
  box-shadow: 0 3px 0 var(--c-ombre), 0 6px 6px rgba(0,0,0,.25);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.cb-btn:not([aria-label])::before {
  content: ''; position: absolute; left: 3px; right: 3px; top: -5px; height: 5px; pointer-events: none;
  background: linear-gradient(90deg, transparent 4.5px, var(--c-clair) 4.5px 7px, var(--c) 7px 11px, var(--c-ombre) 11px 13.5px, transparent 13.5px) 0 0 / 18px 100% space no-repeat;
  -webkit-mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
          mask: radial-gradient(4.5px 5px at 50% 100%, #000 98%, transparent) 0 0 / 18px 100% space no-repeat;
}
.cb-btn:active:not([disabled]) { transform: translateY(3px); box-shadow: 0 0 0 var(--c-ombre), 0 2px 3px rgba(0,0,0,.2); }
/* les boutons à icône (tourner, fermer) : des tuiles neutres, sans tenons */
.cb-btn[aria-label] { --c: var(--plaque-vive); --c-face: #415491; --c-clair: #5868a3; --c-ombre: var(--plaque-bord); width: 44px; padding: 3px 0 0; font-size: 18px; }
.cb-main { --c: var(--jaune); --c-face: var(--jaune-face); --c-clair: var(--jaune-clair); --c-ombre: var(--jaune-ombre); color: var(--jaune-txt); min-width: 64px; }
.cb-btn[disabled] { --c: var(--eteint); --c-face: var(--eteint-face); --c-clair: var(--eteint-clair); --c-ombre: var(--eteint-ombre); color: var(--eteint-txt); cursor: default; }

.city-tray {
  border-radius: var(--r-fenetre); padding: 8px;
  background: var(--tenons-barre), var(--plaque-barre);
  box-shadow: 0 4px 0 #060a18, inset 0 1px 0 rgba(255,255,255,.07), 0 10px 20px rgba(0,0,0,.25);
}
.city-tabs { margin: 0 0 8px; padding: 4px; }
/* quatre onglets (Routes, Décor, Mes modèles, Berges) : chacun la largeur de son nom, ils tiennent à 360 px (et moins) */
.city-tabs { gap: 4px; }
.ct-tab { flex: 1 1 auto; min-height: 34px; padding: 0 6px; font-size: 14px; }
@media (max-width: 340px) { .ct-tab { padding: 0 4px; font-size: 13px; } }
.city-items {
  display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; padding: 9px 2px 5px; scrollbar-width: none;
}
.city-items::-webkit-scrollbar { display: none; }
.ct-item {
  position: relative; flex: none; width: 84px; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px 5px; border: 2px solid transparent; border-radius: var(--r-tuile);
  background: var(--plaque-haut); color: var(--texte); cursor: pointer; font: inherit;
  box-shadow: 0 3px 0 var(--plaque-bord);
  transition: transform var(--appui) var(--ease-out);
}
.ct-item:active { transform: translateY(2px); }
.ct-item.on { border-color: var(--jaune); background: var(--plaque-vive); }
.ct-item.empty { opacity: 0.45; }
.ct-item.r-UR { box-shadow: 0 3px 0 var(--plaque-bord), inset 0 0 0 1px var(--rarity-ur); }
.ct-item.r-SR { box-shadow: 0 3px 0 var(--plaque-bord), inset 0 0 0 1px var(--rarity-sr); }
.ct-img { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--texte-2); }
.ct-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.ct-name { width: 100%; font-size: 11px; font-weight: 600; line-height: 1.15; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 2.3em; }
.ct-n {
  position: absolute; top: -8px; right: -6px; min-width: 22px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--rouge); color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center;
  box-shadow: 0 2px 0 var(--rouge-ombre); font-variant-numeric: tabular-nums;
}
.ct-item.empty .ct-n { background: var(--plaque-vive); color: var(--texte-2); box-shadow: 0 2px 0 var(--plaque-bord); }
/* un bâtiment qui fait gagner de l'or : le petit vendeur et le nombre qu'il lui faut, au coin bas droit de son image (les
   bâtisseurs qui manquent sont en haut à gauche, le compte en haut à droite : rien ne se recouvre) */
.ct-vendeurs {
  position: absolute; right: 3px; top: 41px; display: flex; align-items: center; gap: 1px; height: 19px; padding: 0 5px 0 2px;
  border-radius: 10px; background: var(--plaque-bord); color: var(--texte); font-size: 12px; font-weight: 800; line-height: 19px;
  box-shadow: 0 2px 0 #060a18, inset 0 0 0 1.5px var(--plaque-vive); font-variant-numeric: tabular-nums; pointer-events: none;
}
.ct-vendeurs .ico { width: 14px; height: 14px; }
.ct-more .ct-img { border: 2px dashed var(--texte-3); border-radius: var(--r-tuile); }
.ct-empty { flex: none; width: 200px; padding: 6px 8px; font-size: 13px; line-height: 1.35; color: var(--texte-2); align-self: center; }
/* l'onglet Décor : ses familles (Tout, Nature, Mobilier, Places), les filtres du musée (.sbx-cat) un peu plus serrés */
.city-filtres { display: flex; align-items: center; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 0 2px 3px; }
.city-filtres::-webkit-scrollbar { display: none; }
.ct-filtre { min-height: 30px; padding: 0 12px; font-size: 13px; }
/* « Mes modèles » : le tri (le choisi en jaune, comme une famille du décor) ; « Berges » : ce qu'on fait, en une ligne */
.ct-tri-titre { flex: none; padding: 0 2px 0 4px; color: var(--texte-2); font-size: 13px; font-weight: 700; }
.city-filtres.ct-tris .ct-filtre { padding: 0 10px; }
.ct-astuce { margin: 0; padding: 2px 4px 3px; color: var(--texte-2); font-size: 13px; font-weight: 600; line-height: 1.3; }
/* Herbe, Sable, Eau : la case touchée prend ce terrain ; le choisi bordé de jaune (comme une pièce choisie) */
.ct-brosse .ct-img img { border-radius: 8px; box-shadow: 0 3px 0 var(--plaque-bord); }
.ct-brosse .ct-name { font-size: 13px; }

/* Poser ou déplacer une pièce dans la ville : des flèches autour, une poignée pour tourner */
/* (au-dessus des étiquettes des chantiers et des bulles d'or : les flèches d'une pièce en main se voient et se touchent) */
.city-gizmo { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.city-gizmo.hidden { display: none; }
.cg-arrow, .cg-turn {
  position: absolute; left: 0; top: 0; pointer-events: auto; touch-action: none; cursor: pointer;
  border: 0; border-radius: 50%; color: var(--plaque-nuit); box-shadow: 0 3px 0 rgba(10,16,34,.35);
}
.cg-arrow { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.62); }
.cg-arrow svg { width: 22px; height: 22px; }
.cg-turn { width: 40px; height: 40px; font-size: 20px; font-weight: 800; line-height: 40px; text-align: center; padding: 0; background: var(--jaune); color: var(--jaune-txt); box-shadow: 0 3px 0 var(--jaune-ombre); }
.cg-arrow:active, .cg-turn:active { background: #fff; }
.cb-bad { color: var(--rouge-clair); font-weight: 700; }
.cb-hint { display: block; margin-top: 1px; color: var(--texte-2); font-size: 12.5px; }
/* terre ou eau, et les pinceaux des « Berges » : la brique choisie est bordée de blanc */
.cb-ground { padding: 3px 9px 0; }
.cb-ground.on { box-shadow: 0 3px 0 var(--c-ombre), inset 0 0 0 2px #fff; }
.cb-swatch { display: inline-block; flex: none; width: 13px; height: 13px; margin-right: 5px; border-radius: 3px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.55); }
.city-bar.bump { animation: cb-bump 0.32s; }
@keyframes cb-bump { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@media (prefers-reduced-motion: reduce) { .city-bar.bump { animation: none; box-shadow: var(--ombre-tuile), inset 0 0 0 2px var(--rouge-clair); } }

/* La connexion : les modèles tournent au-dessus du formulaire */
.auth-model { margin: 0 auto -6px; width: min(52vw, 210px, 26vh); height: min(52vw, 210px, 26vh); }

/* ══ Le musée : la note de bienvenue, les fenêtres ; l'écran des boosters (booster.js) ══ */
.sbx-museum-note {
  position: absolute; z-index: 4; left: 10px; right: 64px; top: 64px;
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--r-tuile);
  background: var(--plaque); color: var(--texte); font-size: 14px; line-height: 1.35;
  box-shadow: var(--ombre-tuile), inset 0 3px 0 var(--jaune), 0 8px 16px rgba(0,0,0,.25);
}
.sbx-museum-note b { color: var(--jaune); }
.sbx-museum-note.hidden { display: none; }
.sbx-museum-note button { margin-left: auto; flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--plaque-haut); color: var(--texte); cursor: pointer; box-shadow: 0 2px 0 var(--plaque-bord); }

.sbx-pop { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(5,8,20,.7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sbx-pop.hidden { display: none; }
.sbx-pop-card {
  width: 100%; max-width: 340px; padding: 22px 18px 18px; border-radius: var(--r-fenetre); text-align: center;
  background: var(--plaque); box-shadow: 0 5px 0 var(--plaque-bord), 0 18px 40px rgba(0,0,0,.45);
  animation: sbx-pop-in 0.2s var(--ease-out);
}
@keyframes sbx-pop-in { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.sbx-pop-icon { font-size: 42px; line-height: 1; margin-bottom: 8px; }
.sbx-pop-icon .ico { width: 48px; height: 48px; }
.sbx-pop-card h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; }
.sbx-pop-text { color: var(--texte-2); font-size: 15px; line-height: 1.45; }
.sbx-pop-text b { color: var(--texte); }
.sbx-pop-btns { display: flex; gap: 10px; margin-top: 20px; }
.sbx-pop-btns .btn { flex: 1; }

/* ── L'écran des boosters (booster.js injecte ses styles après cette feuille : #bp-container et #screens l'emportent) ──
   Le paquet, la scène 3D et les cartes ne changent pas ; les boutons deviennent des briques, les textes passent en Rubik. */
#bp-container .bp-counter { font-size: 16px; font-weight: 700; color: var(--texte-2); font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 var(--plaque-bord); }
#bp-container .bp-counter b { color: var(--texte); font-size: 20px; }
#bp-container .bp-counter .bp-plus { color: var(--jaune); font-size: 16px; }
#bp-container .bp-timer { margin-top: 3px; font-size: 13.5px; font-weight: 600; color: var(--jaune); }
#bp-container .bp-hint { max-width: 320px; font-size: 16px; font-weight: 700; color: var(--texte); text-shadow: 0 2px 0 var(--plaque-bord); }
#bp-container .bp-overlay-bottom { gap: 14px; padding-bottom: 6px; }
#bp-container .bp-empty { color: var(--texte-2); }
#bp-container .bp-empty-icon { width: 72px; height: 72px; }
#bp-container .bp-empty-icon .ico-grande { width: 100%; height: 100%; }
#bp-container .bp-empty-title { font: 400 24px/1.12 var(--font-titre); letter-spacing: .5px; color: var(--texte); text-shadow: 0 3px 0 var(--plaque-bord); }
#bp-container .bp-sub { margin-top: 8px; font-size: 15px; color: var(--texte-2); }
#bp-container .bp-empty-timer { font: 800 44px/1.1 var(--font); color: var(--jaune); letter-spacing: 0; text-shadow: 0 3px 0 var(--plaque-bord); }
#bp-container .bp-empty-actions { gap: 16px; max-width: 320px; margin-top: 18px; }
#bp-container .bp-stack-counter { font-size: 16px; font-weight: 800; color: var(--texte); letter-spacing: 0; font-variant-numeric: tabular-nums; }
#bp-container .bp-stack-hint { font-size: 14px; color: var(--texte-3); }
#bp-container .bp-summary-title { font: 400 24px/1.12 var(--font-titre); letter-spacing: .5px; color: var(--texte); text-shadow: 0 3px 0 var(--plaque-bord); }
#bp-container .bp-sum-sub { margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--jaune); }
#bp-container .bp-sum-label { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--texte-2); text-transform: none; letter-spacing: 0; }
/* les pièces gagnées pour la ville (récap d'un booster, fiche d'une carte) : de petites tuiles */
#screens .bp-sum-item { padding: 5px 9px; border-radius: var(--r-brique); background: var(--plaque-haut); color: var(--texte-2); font-size: 13.5px; font-weight: 600; box-shadow: 0 2px 0 var(--plaque-bord); }
#screens .bp-sum-item b { color: var(--texte); }
#screens .bp-sum-item.bp-pc-rare { background: #3a3220; box-shadow: 0 2px 0 var(--plaque-bord), inset 0 0 0 1.5px rgba(255,216,74,.55); }
/* le bouton « tout voir d'un coup » (l'icône avance) : une tuile, sans tenons */
#bp-container .bp-btn-hold {
  bottom: 16px; right: 16px; height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-tuile);
  background: var(--plaque); color: var(--texte); box-shadow: var(--ombre-ligne); -webkit-backdrop-filter: none; backdrop-filter: none;
}
#bp-container .bp-btn-hold.bp-hold-active { background: var(--plaque-haut); }
/* les boutons : des briques (la même recette que .btn) */
#bp-container .bp-btn {
  --c: var(--bleu); --c-face: var(--bleu-face); --c-clair: var(--bleu-clair); --c-ombre: var(--bleu-ombre); --relief: 4px;
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 8px 20px 6px;
  border: 0; border-radius: var(--r-brique); color: #fff; font: 700 16px/1.15 var(--font); letter-spacing: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--c-face) 0 3px, var(--c) 3px);
  box-shadow: 0 var(--relief) 0 var(--c-ombre), 0 calc(var(--relief) + 4px) 6px rgba(0,0,0,.28);
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out), opacity .3s;
}
#bp-container .bp-btn::before {
  content: ''; position: absolute; left: 4px; right: 4px; top: -6px; height: 6px; pointer-events: none;
  background: linear-gradient(90deg, transparent 5.5px, var(--c-clair) 5.5px 8.5px, var(--c) 8.5px 13.5px, var(--c-ombre) 13.5px 16.5px, transparent 16.5px) 0 0 / 22px 100% space no-repeat;
  -webkit-mask: radial-gradient(5.5px 6px at 50% 100%, #000 98%, transparent) 0 0 / 22px 100% space no-repeat;
          mask: radial-gradient(5.5px 6px at 50% 100%, #000 98%, transparent) 0 0 / 22px 100% space no-repeat;
}
#bp-container .bp-btn-open, #bp-container .bp-btn-primary {
  --c: var(--jaune); --c-face: var(--jaune-face); --c-clair: var(--jaune-clair); --c-ombre: var(--jaune-ombre); color: var(--jaune-txt);
}
#bp-container .bp-btn-open { min-width: 220px; min-height: 56px; padding: 10px 44px 8px; font-size: 19px; font-weight: 800; }
#bp-container .bp-btn:active { transform: translateY(var(--relief)); box-shadow: 0 0 0 var(--c-ombre), 0 2px 3px rgba(0,0,0,.25); }
#bp-container .bp-btn.bp-sum-next { min-height: 54px; font-size: 17px; font-weight: 800; transition: opacity .35s var(--ease-out), transform .35s var(--ease-out), box-shadow var(--appui) var(--ease-out); }
#bp-container .bp-btn.bp-sum-next.bp-on:active { transform: translateY(var(--relief)); }
#bp-container .bp-btn.bp-sum-share { min-height: 48px; font-size: 16px; }
/* le récap tient sur un écran sans défiler (375 × 667 compris) : les 8 cartes, les pièces pour la ville en petites tuiles,
   « Partager » et « Suivant » côte à côte */
#bp-container .bp-summary { gap: 12px; padding: 12px 16px; }
#bp-container .bp-summary-title { font-size: 22px; }
#bp-container .bp-sum-sub { margin-top: 4px; font-size: 14.5px; }
#bp-container .bp-sum-items { gap: 5px; }
#bp-container .bp-sum-items .bp-sum-label { margin: 0 0 1px; font-size: 13.5px; }
#screens #bp-container .bp-sum-items .bp-sum-item { padding: 3px 7px 2px; font-size: 12.5px; line-height: 1.35; }
#bp-container .bp-sum-actions { flex: none; display: flex; gap: 10px; width: 100%; max-width: 380px; padding-top: 6px; }
#bp-container .bp-sum-actions .bp-btn { flex: 1 1 0; width: auto; min-width: 0; max-width: none; min-height: 52px; padding: 8px 10px 6px; }
#bp-container .bp-sum-actions .bp-btn.bp-sum-share { flex-grow: 1.45; font-size: 15px; line-height: 1.15; }
@media (max-height: 700px) {
  #bp-container .bp-summary { gap: 9px; padding-top: 8px; padding-bottom: 8px; }
  #bp-container .bp-summary-title { font-size: 20px; }
  #bp-container .bp-sum-grid { gap: 8px; max-width: 336px; }
  #bp-container .bp-sum-items { gap: 4px; }
  #screens #bp-container .bp-sum-items .bp-sum-item { padding: 2px 6px 1px; font-size: 12px; }
  #bp-container .bp-sum-actions { padding-top: 4px; }
}
/* un écran bas (360 × 740…) : le bas de l'écran des boosters se resserre pour ne pas mordre sur le paquet */
@media (max-height: 780px) {
  #bp-container .bp-overlay { padding: 12px; }
  #bp-container .bp-overlay-bottom { gap: 9px; padding-bottom: 0; }
  #bp-container .bp-hint { font-size: 14.5px; line-height: 1.25; }
  #bp-container .bp-counter { font-size: 15px; }
  #bp-container .bp-counter b { font-size: 18px; }
  #bp-container .bp-timer { font-size: 12.5px; }
  #bp-container .bp-btn-open { min-height: 50px; font-size: 18px; }
}

/* ── La boutique : les packs, le bonus, la série gratuite ── */
.shop-item-sub { font-size: 13px; color: var(--texte-2); }
.shop-bonus { display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 4px; background: var(--plaque-bord); color: var(--vert-clair); font-size: 12px; font-weight: 800; vertical-align: 1px; }
/* « Le plus choisi », « Meilleur prix » : une étiquette jaune posée sur le bord (phrase normale, pas de capitales) */
.shop-tag {
  position: absolute; top: -10px; left: 12px; padding: 3px 8px; border-radius: 4px; white-space: nowrap;
  background: var(--jaune); color: var(--jaune-txt); font-size: 12px; font-weight: 800; box-shadow: 0 2px 0 var(--jaune-ombre);
}
.shop-item.shop-best { overflow: visible; margin-top: 10px; box-shadow: var(--ombre-ligne), inset 0 0 0 2px var(--jaune); }
.shop-note { margin: 12px 2px 0; font-size: 13.5px; color: var(--texte-2); line-height: 1.45; }
#daily-offer p, #daily-countdown { font-size: 15px; color: var(--texte-2); }
#daily-offer .btn { margin-top: 6px; }
.detail-header .detail-share { margin-left: auto; }
.detail-share svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Ma ville : le coffre, les équipes, Agrandir, Berges, Visite (des tuiles du tableau de bord, sans tenons) ── */
.city-tools { position: absolute; left: 10px; top: calc(60px + var(--safe-top)); z-index: 3; display: flex; gap: 8px 6px; }
.city-pill {
  height: 38px; padding: 0 12px 0 9px; border-radius: var(--r-tuile); border: 0;
  background: var(--plaque); color: var(--texte); font: 700 14px/1 var(--font);
  display: flex; align-items: center; gap: 6px; box-shadow: var(--ombre-ligne); cursor: pointer; white-space: nowrap;
  transition: transform var(--appui) var(--ease-out), box-shadow var(--appui) var(--ease-out);
}
.city-pill:active { transform: translateY(3px); box-shadow: 0 0 0 var(--plaque-bord); }
.city-pill svg { width: 18px; height: 18px; fill: none; stroke: var(--jaune); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.city-pill svg path[d^="M8 5.5"] { fill: var(--jaune); stroke: none; }
/* le son (le même bouton que dans la barre du haut, que Ma ville cache) : une tuile carrée, son icône seule */
.city-pill.city-son { width: 42px; padding: 0; justify-content: center; }
.city-pill.city-son svg { width: 24px; height: 24px; }
.city-touring .city-top, .city-touring .city-bottom, .city-touring .city-tools, .city-touring .city-gizmo,
.city-touring .city-coach, .city-touring .city-flash { display: none !important; }

/* ── La visite filmée : un film (bandes noires), le titre en Bungee ── */
.city-showcase { position: fixed; inset: 0; z-index: 600; background: #000; }
.city-showcase-view { position: absolute; inset: 0; }
.city-tour { position: absolute; inset: 0; z-index: 20; pointer-events: none; color: #fff; overflow: hidden; }
.ctt-band { position: absolute; left: 0; right: 0; height: 9vh; background: #000; transition: height .9s ease; }
.ctt-top { top: 0; }
.ctt-bottom { bottom: 0; }
.ctt-done .ctt-band { height: 0; }
.ctt-title {
  position: absolute; left: 16px; right: 16px; top: calc(9vh + 16px); text-align: center;
  text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 2px 12px rgba(0,0,0,.6); opacity: 0; animation: ctt-in 1s .5s forwards;
}
.ctt-done .ctt-title { top: calc(var(--safe-top) + 18px); }
.ctt-title span { display: block; font-size: 14px; font-weight: 700; opacity: .9; }
.ctt-title b { display: block; margin-top: 4px; font-family: var(--font-titre); font-weight: 400; font-size: 26px; line-height: 1.12; letter-spacing: .4px; text-shadow: 0 3px 0 rgba(10,16,34,.75), 0 2px 12px rgba(0,0,0,.5); }
.ctt-hero {
  position: absolute; left: 14px; bottom: calc(9vh + 20px); padding: 8px 14px; border-radius: var(--r-tuile);
  background: rgba(18,26,51,.78); box-shadow: 0 3px 0 rgba(10,16,34,.6);
  opacity: 0; transform: translateY(8px); transition: opacity .4s, transform .4s;
}
.ctt-hero.on { opacity: 1; transform: none; }
.ctt-hero b { display: block; font-size: 16px; line-height: 1.2; }
.ctt-hero span { font-size: 13px; font-weight: 800; }
/* le coffre secret dans la balade chez un ami (city.js) : la bulle « Un coffre secret ! », en haut au milieu */
.cb-coffre { position: absolute; left: 50%; top: calc(var(--safe-top) + 70px); transform: translate(-50%, -6px); max-width: calc(100% - 120px);
  padding: 8px 14px; border-radius: var(--r-tuile); background: var(--jaune); color: var(--jaune-txt); box-shadow: 0 3px 0 var(--jaune-ombre);
  font: 800 14px/1.3 var(--font); text-align: center; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
.cb-coffre.on { opacity: 1; transform: translate(-50%, 0); }
/* chaud ou froid (le coffre secret) : un rond qui passe du bleu glacial au rouge brûlant, et son mot (sous le titre) */
.cb-chaud { position: absolute; left: 50%; top: calc(var(--safe-top) + 112px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 8px; border-radius: var(--r-tuile); background: rgba(18,26,51,.82); box-shadow: 0 3px 0 rgba(10,16,34,.6);
  font: 800 15px/1 var(--font); color: var(--texte); pointer-events: none; white-space: nowrap; }
.cb-chaud[hidden] { display: none; }
.cb-rond { width: 26px; height: 26px; border-radius: 50%; background: rgb(116,166,255); border: 2px solid rgba(255,255,255,.75);
  animation: cb-bat 1.6s ease-in-out infinite; transition: background .4s, box-shadow .4s; }
@keyframes cb-bat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .cb-rond { animation: none; } }
.ctt-brand { position: absolute; right: 14px; bottom: calc(9vh + 24px); font-family: var(--font); font-weight: 900; font-size: 16px; color: var(--jaune); opacity: .85; text-shadow: 0 2px 0 var(--jaune-ombre); }
.ctt-done .ctt-brand { bottom: calc(92px + var(--safe-bottom)); }
.ctt-bar { position: absolute; left: 0; right: 0; bottom: 9vh; height: 4px; background: rgba(255,255,255,.18); }
.ctt-bar i { display: block; height: 100%; width: 0; background: var(--jaune); }
.ctt-x { pointer-events: auto; position: absolute; right: 12px; top: calc(9vh + 12px); width: 40px; height: 40px; font-size: 16px; background: rgba(18,26,51,.78); }
.ctt-done .ctt-x { top: calc(var(--safe-top) + 12px); }
.ctt-end { position: absolute; left: 16px; right: 16px; bottom: calc(24px + var(--safe-bottom)); display: none; justify-content: center; gap: 12px; pointer-events: auto; }
.ctt-end .btn { flex: 1; max-width: 170px; }
.ctt-done .ctt-end { display: flex; }
.ctt-done .ctt-bar, .ctt-done .ctt-hero { display: none; }
@keyframes ctt-in { to { opacity: 1; } }
/* ── La balade à hauteur de Briko : tout l'écran prend les doigts ; pouce gauche = marcher, pouce droit = regarder ── */
.city-balade { pointer-events: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.city-balade .ctt-title { top: calc(var(--safe-top) + 16px); transition: opacity .8s; }
.city-balade.cb-titre-parti .ctt-title { opacity: 0 !important; animation: none; }
.city-balade .ctt-x { top: calc(var(--safe-top) + 12px); }
.city-balade .ctt-hero { bottom: auto; top: calc(var(--safe-top) + 64px); }
.city-balade .ctt-brand { bottom: calc(14px + var(--safe-bottom)); }
.cb-aide {
  position: absolute; left: 16px; right: 16px; bottom: calc(150px + var(--safe-bottom)); margin: 0; text-align: center;
  font-size: 14px; font-weight: 800; text-shadow: 0 2px 6px rgba(0,0,0,.7); transition: opacity .6s;
}
.cb-parti .cb-aide, .cb-survol .cb-aide { opacity: 0; }
.cb-survol .cb-joy { display: none; }
.cb-joy {
  position: absolute; width: 104px; height: 104px; margin: -52px 0 0 -52px; border-radius: 50%;
  background: rgba(18,26,51,.32); border: 2px solid rgba(255,255,255,.55); box-shadow: 0 3px 0 rgba(10,16,34,.35);
  pointer-events: none; opacity: .6; transition: opacity .2s;
}
.cb-joy i {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: rgba(255,255,255,.85); box-shadow: 0 3px 0 rgba(10,16,34,.45);
}
.cb-gauche { left: 92px; top: calc(100% - 110px - var(--safe-bottom)); }
.cb-droite { left: calc(100% - 92px); top: calc(100% - 110px - var(--safe-bottom)); }
.cb-joy.on { opacity: 1; }
.cb-parti .cb-joy:not(.on) { opacity: .25; }
#top-bar .currency-icon .currency-svg { width: 22px; height: 22px; display: block; }

/* ── Comptes : règles du mot de passe, cases à cocher ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mdp-regles { list-style: none; margin: 0 0 2px; padding: 0 2px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 13px; line-height: 1.3; color: var(--texte-2); text-align: left; }
.mdp-regles li:last-child:nth-child(odd) { grid-column: 1 / -1; }
.mdp-regles li span[aria-hidden] { display: inline-block; width: 1.1em; font-weight: 800; }
.mdp-regles li span[aria-hidden] .ico { width: 1em; height: 1em; vertical-align: -.12em; }
.mdp-regles li.ok { color: var(--vert-clair); }
/* Champ mot de passe et son œil (afficher / masquer), à l'accueil et dans le profil */
.mdp-champ { position: relative; width: 100%; }
.mdp-champ > input { padding-right: 52px; }
.mdp-oeil {
  position: absolute; top: 0; right: 2px; bottom: 0; width: 46px; display: grid; place-items: center;
  padding: 0; border: 0; background: none; color: var(--texte-3); cursor: pointer;
}
.mdp-oeil svg { width: 22px; height: 22px; }
.mdp-oeil .barre { display: none; }
.mdp-oeil[aria-pressed="true"] { color: var(--texte); }
.mdp-oeil[aria-pressed="true"] .barre { display: inline; }
.mdp-oeil:focus-visible { outline: 3px solid var(--jaune); outline-offset: -6px; border-radius: 10px; }
.auth-cases { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.auth-case, .sc-case { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; line-height: 1.4; color: var(--texte-2); cursor: pointer; min-height: 44px; }
.auth-case input, .sc-case input { flex: none; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--jaune); }
.sc-case { margin: 4px 0; }
.sc-lien-texte { background: none; border: 0; padding: 0; font: inherit; color: var(--texte); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.auth-forgot { margin-top: -6px; }
.auth-legal { margin: 0; font-size: 13px; color: var(--texte-3); text-align: center; }
.auth-legal .sc-lien-texte { color: var(--texte-2); min-height: 44px; padding: 0 2px; }
/* L'accueil tient sans défiler (390 × 844 avec les zones sûres, 360 × 780, 375 × 667) : le modèle qui tourne suit la hauteur
   de l'écran ; l'inscription (4 champs, les règles, 2 cases) le laisse de côté, son logo rapetisse et tout se resserre.
   (Le clavier ouvert, la page défile : c'est le navigateur qui la fait monter vers le champ.) */
.auth-wrap { gap: 12px; padding: 14px 20px 14px; }
.auth-logo { margin: 0; }
.auth-logo img { width: min(50vw, 190px); }
.auth-model { width: min(52vw, 210px, 17vh); height: min(52vw, 210px, 17vh); }
.auth-submit { margin-top: 6px; }
/* (les écrans longs : l'inscription, le nouveau mot de passe avec ou sans code) */
#auth-screen[data-mode="signup"] .auth-model, #auth-screen[data-mode="nouveau"] .auth-model, #auth-screen[data-mode="recup-code"] .auth-model { display: none; }
#auth-screen[data-mode="signup"] .auth-wrap, #auth-screen[data-mode="nouveau"] .auth-wrap, #auth-screen[data-mode="recup-code"] .auth-wrap { gap: 10px; }
#auth-screen[data-mode="signup"] .auth-logo img, #auth-screen[data-mode="nouveau"] .auth-logo img, #auth-screen[data-mode="recup-code"] .auth-logo img { width: min(40vw, 150px); }
#auth-screen[data-mode="signup"] .auth-form, #auth-screen[data-mode="nouveau"] .auth-form, #auth-screen[data-mode="recup-code"] .auth-form { gap: 8px; }
#auth-screen[data-mode="signup"] .auth-input, #auth-screen[data-mode="nouveau"] .auth-input, #auth-screen[data-mode="recup-code"] .auth-input { min-height: 46px; }
#auth-screen[data-mode="signup"] .auth-case { gap: 9px; font-size: 14px; line-height: 1.35; }
#auth-screen[data-mode="signup"] .auth-cases { gap: 4px; }
/* le code de testeur de l'inscription (facultatif) : un lien discret qui déplie son champ (sa zone de toucher fait 44 px) */
.auth-code-test > summary {
  position: relative; list-style: none; cursor: pointer; padding: 1px 2px; text-align: left;
  font-size: 14.5px; font-weight: 700; color: var(--texte-2); text-decoration: underline; text-underline-offset: 3px;
}
.auth-code-test > summary::-webkit-details-marker { display: none; }
.auth-code-test > summary::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 44px; margin-top: -22px; }
.auth-code-test[open] > summary { margin-bottom: 8px; }
.auth-code-test .auth-input { display: block; width: 100%; box-sizing: border-box; }
@media (max-height: 700px) {
  .auth-model { display: none; }
  .auth-wrap { gap: 10px; }
  #auth-screen[data-mode="signup"] .auth-logo, #auth-screen[data-mode="recup-code"] .auth-logo { display: none; }
  #auth-screen[data-mode="signup"] .auth-form { gap: 6px; }
  #auth-screen[data-mode="signup"] .auth-input { min-height: 44px; }
}
.sc-actions-compte { display: flex; flex-wrap: wrap; gap: 14px 8px; margin: 14px 0 8px; }
.sc-actions-compte .btn { min-height: 44px; }
.sc-form-compte { margin: 12px 0; padding: 12px; border-radius: var(--r-tuile); background: var(--plaque); box-shadow: var(--ombre-ligne); }
.sc-form-compte h4 { margin-top: 0; }
.sc-legal { margin-top: 12px; font-size: 13px; color: var(--texte-3); line-height: 2; }

/* ── Pages légales (legal.js) : une page de texte posée sur la plaque nuit ── */
.legal-screen { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: var(--tenons-fond), var(--plaque-nuit); color: var(--texte);
  padding-top: var(--safe-top, env(safe-area-inset-top)); }
.legal-tete { display: flex; align-items: center; gap: 12px; padding: 12px 16px 8px; }
.legal-tete h2 { flex: 1; margin: 0; font: 400 21px/1.15 var(--font-titre); letter-spacing: .4px; text-shadow: 0 3px 0 var(--plaque-bord); outline: none; }
.legal-fermer { font-size: 17px; }
/* les trois pages : trois onglets sur une ligne (rien ne défile de côté) ; seul le texte de la page défile */
.legal-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 4px 16px 10px; padding: 5px; border-radius: var(--r-tuile); background: var(--plaque-bord); box-shadow: inset 0 2px 0 rgba(0,0,0,.35); }
.legal-nav button { min-width: 0; min-height: 44px; padding: 2px 6px; border-radius: 6px; border: 0; background: transparent; color: var(--texte-2); font: inherit; font-size: 13.5px; font-weight: 700; line-height: 1.15; cursor: pointer; }
.legal-nav button.on { background: var(--plaque-haut); color: var(--texte); box-shadow: 0 3px 0 #0f1730, inset 0 1px 0 rgba(255,255,255,.1); }
.legal-corps { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(28px + var(--safe-bottom)); font-size: 15px; line-height: 1.55; -webkit-user-select: text; user-select: text; }
.legal-corps h3 { margin: 20px 0 6px; font-size: 17px; font-weight: 800; }
.legal-corps ul { margin: 4px 0; padding-left: 20px; }
.legal-corps li { margin: 3px 0; }
.legal-corps a { color: var(--jaune); }
.legal-corps .lg-intro { color: var(--texte-2); }

/* ── Accessibilité ── */
/* Focus visible au clavier (et lecteurs d'écran) : un contour jaune, jamais au toucher */
:focus-visible { outline: 3px solid var(--jaune); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }
/* Toucher : 44 × 44 px au moins, sans changer l'apparence : les petits boutons ont une zone de toucher invisible autour
   d'eux. :where() ne pèse rien : une règle qui place déjà le bouton (absolute, fixed) garde la main. */
:where(.btn-sm, .filter-btn, .ct-tab, .city-coach button, .sc-lien, .social-avatar, .currency, .son-bouton, .fen-x, .ctt-x, .sbx-cat, .city-pill, .cb-btn,
  .sbx-pb-btn, .sandbox-expand-btn, .obj-evt-pilule, .legal-nav button, .pg-onglet, .auth-tab, .cg-turn, .sbx-museum-note button, .sbx-color) { position: relative; }
.btn-sm::after, .filter-btn::after, .ct-tab::after, .city-coach button::after, .sc-lien::after, .social-avatar::after, .currency::after, .son-bouton::after,
.fen-x::after, .ctt-x::after, .sbx-cat::after, .city-pill::after, .cb-btn::after, .sbx-pb-btn::after, .sandbox-expand-btn::after,
.obj-evt-pilule::after, .legal-nav button::after, .pg-onglet::after, .auth-tab::after, .cg-turn::after, .sbx-museum-note button::after, .sbx-color::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: max(100%, 44px); transform: translate(-50%, -50%);
}
#sort-select { min-height: 44px; }
/* Le zoom à deux doigts est permis sur la page (les vues 3D gardent leurs gestes) ; pas de zoom au double toucher */
html { touch-action: manipulation; }
/* Au survol d'une souris seulement (jamais collé au toucher) : la brique s'éclaire à peine */
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled):not(.fn-ferme), #bp-container .bp-btn:hover, .cb-btn:hover:not([disabled]), .sbx-pb-place:hover, .sandbox-expand-btn:hover:not(:disabled),
  .social-avatar.invite:hover { filter: brightness(1.06); }
  .btn-ghost:hover, .btn.fen-discret:hover, .sc-lien:hover, .sc-lien-texte:hover { color: var(--texte); }
  .filter-btn:hover:not(.active), .sbx-cat:hover:not(.active), .ct-item:hover, .theme-carte:hover, .sc-ligne-lien:hover,
  .city-pill:hover, .obj-bouton:hover, #top-bar .currency:hover, #top-bar .son-bouton:hover, .sandbox-tool:hover:not(.active) { filter: brightness(1.12); }
  .auth-tab:hover:not(.active), .pg-onglet:hover:not(.actif), .ct-tab:hover:not(.on), .legal-nav button:hover:not(.on), .fen-choix-b:hover:not(.actif) { color: var(--texte); }
}
/* « Réduire les animations » du téléphone : plus de mouvements ni de clignotements décoratifs ; une brique touchée ne se
   déplace plus : elle s'aplatit (son épaisseur disparaît) et fonce un peu */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .btn:active:not(:disabled):not(.fn-ferme), #bp-container .bp-btn:active, #bp-container .bp-btn.bp-sum-next.bp-on:active, .cb-btn:active:not([disabled]),
  .sbx-pb-place:active, .sandbox-expand-btn:active:not(:disabled), .social-avatar.invite:active, .btn-icon:active, .sc-retour:active, .fen-x:active,
  .legal-fermer:active, .city-btn:active, .ctt-x:active, .sandbox-back:active, .sandbox-zoom-btn:active, .filter-btn:active, .city-pill:active,
  .obj-bouton:active, #top-bar .currency:active, #top-bar .son-bouton:active, .sandbox-tool:active, .sbx-pb-btn:active, .theme-carte:active, .sc-ligne-lien:active,
  .ct-item:active, .sbx-piece:active, .coll-cell:active, .city-title:active, .sc-ville:active, .sc-carte[role="button"]:active, .ech-carte:active,
  #tab-bar .tab:active .tab-icon, .social-avatar:active {
    transform: none !important; filter: brightness(.9);
  }
  #tab-bar .tab.active .tab-icon { transform: none; }
  .toast, .ctt-hero { transform: none !important; }
  .city-flash { transform: translate(-50%, 0) !important; }
}
/* Accueil : « vérifie ta boîte mail », lien envoyé… */
.auth-info { background: #1b2f5e; color: var(--texte); text-align: left; font-weight: 500; }
/* L'offre du jour, en haut de la Boutique : bordée d'or tant qu'elle attend */
#shop-daily.pret { box-shadow: var(--ombre-tuile), inset 0 0 0 2px var(--jaune); }
#shop-daily .shop-daily-item { margin: 0; }

/* Le style des routes (city.js : le bouton du bac « Routes », la fenêtre « Style des routes ») */
.ct-style { display: inline-flex; align-items: center; gap: 6px; }
.ct-style .ct-style-ico { width: 16px; height: 16px; }
.fen-style .cs-titre { margin: 2px 2px 6px; font-size: 14px; font-weight: 800; color: var(--texte); }
.fen-style .cs-grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.fen-style .cs-trottoirs { grid-template-columns: repeat(4, 1fr); margin-bottom: 4px; }
.fen-style .cs-ech { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 44px; padding: 6px 4px;
  border-radius: var(--r-tuile); background: var(--plaque); box-shadow: var(--ombre-ligne); color: var(--texte-2); font: inherit; font-size: 12.5px; border: 0; }
.fen-style .cs-ech img { width: 52px; height: 52px; border-radius: 6px; }
.fen-style .cs-ech i { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.fen-style .cs-ech.on { box-shadow: var(--ombre-ligne), inset 0 0 0 3px var(--jaune); color: var(--texte); font-weight: 700; }
/* « Mes modèles » : les familles avant le tri, séparées d'un petit trait */
.ct-sep { flex: none; width: 2px; height: 22px; margin: 0 2px; border-radius: 1px; background: var(--plaque-bord); }
/* la fiche du modèle qu'on va poser, sur toute la largeur de la barre */
.cb-fiche { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
.cb-puce { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 6px; background: var(--fond-2, rgba(0,0,0,.18)); color: var(--texte); font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.cb-puce .ico { flex: none; }
