/* POD Forge — feuille de style, pensée pour le téléphone d'abord. */

:root {
  --fond: #0f1115;
  --fond-2: #171a21;
  --fond-3: #1e222b;
  --bord: #2a2f3a;
  --texte: #e7e9ee;
  --texte-2: #99a0b0;
  --accent: #f0b429;
  --accent-2: #ffd166;
  --ok: #3ddc97;
  --orange: #f2994a;
  --rouge: #ef5b5b;
  --rayon: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --fond: #f6f7f9; --fond-2: #ffffff; --fond-3: #eef0f4;
    --bord: #dcdfe6; --texte: #1a1d24; --texte-2: #5f6675;
    --accent: #b8860b; --accent-2: #8a6508;
  }
}

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

/* `display: grid` sur .apercu / .jauge / .actions écrase la règle par défaut
   de [hidden]. Sans ce rappel, les blocs masqués restent visibles. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 0 92px;
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
}

/* ─────────────────────────────────── entête ─────────────────────────────── */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px calc(14px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--fond) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bord);
}
.marque { display: flex; align-items: center; gap: 12px; }
.logo {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 11px; background: linear-gradient(135deg, var(--accent), #d97706);
  color: #1a1204; font-size: 18px; font-weight: 700;
}
.entete h1 { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.entete p { margin: 0; font-size: 12px; color: var(--texte-2); }

/* ─────────────────────────────────── atelier ────────────────────────────── */
.atelier { padding: 16px; }

.scene {
  border: 1px solid var(--bord); border-radius: var(--rayon);
  background: var(--fond-2); overflow: hidden;
}

.depot { padding: 34px 18px; text-align: center; cursor: pointer; }
.depot.survol { background: var(--fond-3); }
.depot-contenu { display: grid; gap: 6px; justify-items: center; }
.depot-icone {
  display: grid; place-items: center; width: 46px; height: 46px;
  border-radius: 50%; border: 1.5px dashed var(--bord);
  color: var(--accent); font-size: 20px;
}
.petit { font-size: 12.5px; color: var(--texte-2); }

.apercu { display: grid; }
.damier {
  min-height: 210px; max-height: 46vh; display: grid; place-items: center;
  padding: 14px;
  background-image:
    linear-gradient(45deg, var(--fond-3) 25%, transparent 25%),
    linear-gradient(-45deg, var(--fond-3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--fond-3) 75%),
    linear-gradient(-45deg, transparent 75%, var(--fond-3) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  transition: background-color .2s;
}
.damier.uni { background-image: none; }
.damier img, .damier svg { max-width: 100%; max-height: 42vh; display: block; }

.apercu-barre {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 12px; border-top: 1px solid var(--bord);
}
.fonds { display: flex; gap: 7px; flex-wrap: wrap; }
.pastille {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--bord); cursor: pointer; padding: 0;
}
.pastille.actif { border-color: var(--accent); transform: scale(1.12); }

.jauge {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px;
}
.jauge-item {
  background: var(--fond-2); border: 1px solid var(--bord);
  border-radius: 11px; padding: 9px 6px; text-align: center;
}
.jauge-item span { display: block; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.jauge-item label { font-size: 10.5px; color: var(--texte-2); text-transform: uppercase; letter-spacing: .4px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

/* ─────────────────────────────────── boutons ────────────────────────────── */
button {
  font: inherit; border-radius: 11px; border: 1px solid var(--bord);
  padding: 12px 16px; cursor: pointer; background: var(--fond-3); color: var(--texte);
  transition: transform .08s, filter .15s;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; }
.primaire { background: var(--accent); color: #1a1204; border-color: transparent; font-weight: 650; }
.secondaire { background: var(--fond-3); }
.fantome { background: transparent; }
.petit-bouton { padding: 7px 12px; font-size: 13px; }

/* ─────────────────────────────────── outils ─────────────────────────────── */
main { padding: 0 16px; display: grid; gap: 14px; }

.outil {
  border: 1px solid var(--bord); border-radius: var(--rayon);
  background: var(--fond-2); overflow: hidden;
}
.outil > summary {
  list-style: none; cursor: pointer; padding: 15px 16px;
  display: flex; align-items: center; gap: 11px;
}
.outil > summary::-webkit-details-marker { display: none; }
.outil > summary::after { content: "▾"; margin-left: auto; color: var(--texte-2); transition: transform .2s; }
.outil[open] > summary::after { transform: rotate(180deg); }
.numero {
  flex: none; display: grid; place-items: center; min-width: 26px; height: 26px;
  padding: 0 6px; border-radius: 8px; background: var(--fond-3);
  font-size: 12px; font-weight: 650; color: var(--accent);
}
.outil h3 { margin: 0; font-size: 15px; font-weight: 600; }
.outil .desc { margin: 2px 0 0; font-size: 12.5px; color: var(--texte-2); }
.corps { padding: 0 16px 16px; display: grid; gap: 13px; }

label.champ { display: grid; gap: 6px; font-size: 13px; color: var(--texte-2); }
label.champ > span { display: flex; justify-content: space-between; gap: 8px; }
label.champ b { color: var(--texte); font-variant-numeric: tabular-nums; font-weight: 600; }

input[type=text], input[type=number], select, textarea {
  font: inherit; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--bord); background: var(--fond); color: var(--texte);
  width: 100%;
}
textarea { resize: vertical; min-height: 76px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 100%; height: 42px; padding: 3px; border-radius: 10px;
  border: 1px solid var(--bord); background: var(--fond); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.case { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--texte); }
.case input { width: 20px; height: 20px; accent-color: var(--accent); }

.aide { font-size: 12.5px; color: var(--texte-2); background: var(--fond-3);
  border-left: 2px solid var(--accent); padding: 9px 11px; border-radius: 0 8px 8px 0; }

/* ────────────────────────────────── résultats ───────────────────────────── */
.resultat { display: grid; gap: 9px; font-size: 13.5px; }
.ligne { display: flex; gap: 9px; align-items: flex-start;
  padding: 10px 11px; border-radius: 10px; background: var(--fond-3); }
.ligne .pastille-etat { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; }
.etat-ok .pastille-etat { background: var(--ok); }
.etat-orange .pastille-etat { background: var(--orange); }
.etat-rouge .pastille-etat { background: var(--rouge); }
.ligne small { display: block; color: var(--texte-2); margin-top: 3px; }

.gain { display: flex; align-items: baseline; gap: 8px; padding: 12px;
  border-radius: 11px; background: color-mix(in srgb, var(--ok) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.gain strong { font-size: 22px; color: var(--ok); }

.grille-vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; }
.vignette { border: 1px solid var(--bord); border-radius: 10px; overflow: hidden;
  background: var(--fond-3); text-align: center; font-size: 11px; }
.vignette img { width: 100%; display: block; }
.vignette span { display: block; padding: 5px 3px; color: var(--texte-2); }

.puces { display: flex; flex-wrap: wrap; gap: 7px; }
.puce { padding: 7px 11px; border-radius: 20px; border: 1px solid var(--bord);
  background: var(--fond-3); font-size: 12.5px; cursor: pointer; }
.puce.actif { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }

a.lien { color: var(--accent-2); }

/* ──────────────────────────────────── divers ────────────────────────────── */
.message {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 40;
  max-width: min(92vw, 460px); padding: 12px 16px; border-radius: 12px;
  background: var(--fond-3); border: 1px solid var(--bord); font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.message.erreur { border-color: var(--rouge); color: var(--rouge); }
.message.succes { border-color: var(--ok); }

.barre-onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: color-mix(in srgb, var(--fond-2) 96%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--bord);
  padding-bottom: env(safe-area-inset-bottom);
}
.barre-onglets button {
  border: 0; background: none; border-radius: 0; padding: 9px 2px 10px;
  display: grid; gap: 3px; justify-items: center;
  font-size: 10px; color: var(--texte-2); letter-spacing: -.1px;
}
.barre-onglets button span { font-size: 17px; line-height: 1; }
.barre-onglets button.actif { color: var(--accent); }

dialog {
  border: 1px solid var(--bord); border-radius: var(--rayon); background: var(--fond-2);
  color: var(--texte); max-width: min(92vw, 440px); padding: 20px;
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin: 0 0 12px; font-size: 17px; }
dialog ol { padding-left: 20px; margin: 0 0 12px; font-size: 14px; }
dialog li { margin-bottom: 7px; }

.chargement { position: relative; pointer-events: none; opacity: .6; }
.chargement::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid var(--bord); border-top-color: var(--accent);
  animation: tourne .7s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

@media (min-width: 760px) {
  body { padding-bottom: 24px; max-width: 940px; margin: 0 auto; }
  .barre-onglets { position: sticky; top: 66px; bottom: auto; border-radius: 12px;
    margin: 16px 16px 0; border: 1px solid var(--bord); }
  main { padding-top: 14px; }
  .atelier { padding-bottom: 0; }
}
