:root {
  --bg: #0f1117;
  --surface: #181b24;
  --text: #e8eaf0;
  --muted: #9aa1b2;
  --accent: #f5a524;
  --border: #262a36;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.brand img { border-radius: 8px; }
/* La commande en cours, sur deux lignes à droite du logo : sur une ligne, elle
   chevauchait « speedFM » à largeur de téléphone (21 octobre 2026). */
#who { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; margin-left: 12px; font-size: .85rem; line-height: 1.3; text-align: right; }
#who strong { color: var(--text); }
#who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--text); }

main { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

.hero { text-align: center; padding: 48px 0 64px; }
.hero-logo { border-radius: 24px; max-width: 40vw; height: auto; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.2; margin: 24px 0 12px; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto 12px; }
.servers { font-size: .9rem; letter-spacing: .05em; text-transform: uppercase; }

.cta {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 28px;
  border-radius: 10px;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  text-decoration: none;
}
.cta.disabled { opacity: .5; cursor: not-allowed; }

.steps h2 { text-align: center; }
.steps ol {
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 0;
}
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.steps li::before { content: counter(step); color: var(--accent); font-weight: 800; font-size: 1.5rem; }
.steps li span { color: var(--muted); }

footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 48px 16px 24px; }

/* --- Formulaire de commande (/c/<jeton>) ---------------------------------- */
:root { --exo: #4ea1ff; --danger: #ff6b6b; }
.muted { color: var(--muted); }
.order { max-width: 640px; padding-bottom: 32px; }
.order h1 { font-size: 1.4rem; line-height: 1.3; margin: 8px 0 12px; }
.order h2 { font-size: 1.05rem; margin: 0 0 8px; }
button { font: inherit; color: inherit; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.notice.error { border-color: var(--danger); color: var(--danger); }

.progress { display: flex; gap: 6px; list-style: none; padding: 0; margin: 8px 0 16px; font-size: .8rem; }
.progress li { flex: 1; text-align: center; padding: 6px 0; border-bottom: 3px solid var(--border); color: var(--muted); }
.progress li.done { border-color: var(--accent); }
.progress li.current { border-color: var(--accent); color: var(--text); font-weight: 700; }

/* Première étape : une carte par serveur de jeu, 2 × 2 sur téléphone. */
.servers-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.server { position: relative; overflow: hidden; aspect-ratio: 240 / 284; padding: 0 0 10px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.server-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Un dégradé sous le nom : lisible sur les quatre illustrations, claires ou sombres. */
.server::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); }
.server-name, .server small { position: relative; z-index: 1; text-shadow: 0 1px 3px #000; }
.server-name { font-weight: 700; font-size: 1.1rem; }
.server small { color: var(--muted); font-size: .78rem; }
.server:hover:not(:disabled), .server.picked { border-color: var(--accent); }
.server.disabled { cursor: not-allowed; }
.server.disabled .server-art { filter: grayscale(1); opacity: .35; }

/* Accueil : une tuile par type d'objet, icône en fond et nom par-dessus (le style
   des cases vides du simulateur de stuff de Touch Manager) — en couleur si le
   type est disponible, en silhouette grise sinon. */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.cat { position: relative; aspect-ratio: 1; overflow: hidden; padding: 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.cat-ghost { position: absolute; inset: 8% 8% 16%; width: 84%; height: 76%; object-fit: contain; opacity: .85; pointer-events: none; transition: opacity .15s; }
.cat-name { position: relative; font-weight: 700; font-size: .95rem; line-height: 1.2; text-shadow: 0 1px 3px #000, 0 0 8px #000; }
.cat small { position: relative; color: var(--muted); font-size: .72rem; text-shadow: 0 1px 3px #000; }
.cat:hover:not(:disabled) { border-color: var(--accent); }
.cat:hover:not(:disabled) .cat-ghost { opacity: 1; }
.cat.disabled { opacity: .45; cursor: not-allowed; }
.cat.disabled .cat-ghost { opacity: .3; }

.search { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; position: sticky; top: 0; }
.items { list-style: none; padding: 0; margin: 10px 0; }
.items button { width: 100%; text-align: left; padding: 12px 14px; background: none; border: 0; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 12px; align-items: baseline; }
.items button:hover { background: var(--surface); }
.items li.muted { padding: 12px 14px; }
.lvl { color: var(--muted); font-size: .85rem; min-width: 60px; }

.lines { display: flex; flex-direction: column; gap: 4px; }
/* Une ligne = une rangée (propriétaire, 21 octobre 2026) : icône et nom, plage,
   saisie, puis l'over ou le bouton de l'exo. Compacte pour voir toutes les stats. */
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto 60px 34px; gap: 8px; align-items: center; padding: 5px 8px 5px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: .92rem; }
.line .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line .range { color: var(--muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.line input { width: 100%; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; text-align: right; }
.line .tag, .line > button { font-size: .78rem; justify-self: end; white-space: nowrap; }
.line.over { border-color: var(--accent); }
.line.over .tag { color: var(--accent); font-weight: 700; }
.line.exo { border-color: var(--exo); }
.line.exo .name { color: var(--exo); }
.line.exo > button { padding: 2px 8px; }
/* Les malus en rouge, saisis en négatif (« -4 » = pas pire que −4). */
.line.malus { border-color: rgba(255, 107, 107, .35); }
.line.malus .name, .line.malus .range, .line.malus .tag { color: var(--danger); }
.line.malus input { color: var(--danger); border-color: rgba(255, 107, 107, .35); }

.exo-box { margin: 10px 0; }
.exo-box select { width: 100%; padding: 10px; border-radius: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--exo); font: inherit; }
.ghost { background: none; border: 1px dashed var(--exo); color: var(--exo); padding: 10px 14px; border-radius: 10px; cursor: pointer; width: 100%; }
.ghost.small { width: auto; padding: 4px 10px; border-style: solid; }
.hint { font-size: .85rem; }

fieldset { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 12px; padding: 8px 14px 12px; }
legend { padding: 0 6px; font-weight: 700; }
.choice { display: flex; gap: 10px; align-items: center; padding: 6px 0; cursor: pointer; }
.choice.disabled { opacity: .45; cursor: not-allowed; }
.recap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 12px 0; }
.recap ul { margin: 0; padding-left: 18px; }

.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.order .cta { border: 0; cursor: pointer; margin: 0; }
.order .cta:disabled { opacity: .5; cursor: not-allowed; }
.back { background: none; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; cursor: pointer; color: var(--muted); }

/* --- Simulation et choix du serveur ---------------------------------------- */
.bar { height: 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; margin: 24px 0 12px; }
#bar-fill { height: 100%; width: 2%; background: linear-gradient(90deg, var(--accent), #ffd27a); border-radius: inherit; transition: width .8s ease; position: relative; overflow: hidden; }
#bar-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); animation: shine 1.6s linear infinite; }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { #bar-fill { transition: none; } #bar-fill::after { animation: none; } }
.sim-phase { font-weight: 600; margin: 0 0 4px; }

.result { background: var(--surface); border: 1px solid var(--accent); border-radius: 14px; padding: 18px; }
.result.impossible { border-color: var(--danger); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.figures > div { display: flex; flex-direction: column; gap: 2px; background: var(--bg); border-radius: 10px; padding: 12px; }
.figures strong { font-size: 1.15rem; }


.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 6px; }
.counters > div { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.counters strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; color: var(--accent); }

/* --- Icônes : objets, caractéristiques ---------------------------- */

.item-icon { flex: none; object-fit: contain; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #262b38, var(--bg) 75%); }
.items button { align-items: center; }
.items .item-name { flex: 1; min-width: 0; }
.items .lvl { min-width: 0; text-align: right; }

#item-title, .recap-head { display: flex; align-items: center; gap: 14px; }
#item-title small, .recap-head small { display: block; color: var(--muted); font-size: .85rem; font-weight: 400; }

.stat-icon { width: 22px; height: 22px; flex: none; display: inline-block; }
.line .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.line .name .stat-icon { width: 20px; height: 20px; }
.line .name .label { overflow: hidden; text-overflow: ellipsis; }
.recap ul { list-style: none; padding: 0; }
.recap li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
