/* Fédération 3200 — générateur de personnages
   Thème : nuit spatiale de la fiche officielle, rouge et or du drapeau fédéral. */

:root {
  --bg: #070d18;
  --bg-2: #0d1829;
  --panel: rgba(15, 26, 44, 0.9);
  --panel-solid: #111e33;
  --panel-2: #172842;
  --line: rgba(160, 188, 230, 0.18);
  --line-strong: rgba(160, 188, 230, 0.34);
  --text: #e8eef8;
  --muted: #9fb0c8;
  --faint: #6d7f99;
  --red: #e5352b;
  --red-2: #ff5a4f;
  --gold: #f3b93a;
  --blue: #3d8bff;
  --cyan: #52d1ff;
  --green: #3ecf8e;
  --amber: #f5a524;
  --danger: #ff6b6b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --font: "Avenir Next", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg) url("../img/background.jpg") center top / cover fixed no-repeat;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7, 13, 24, 0.72), rgba(7, 13, 24, 0.94) 55%, #070d18);
}
a { color: var(--cyan); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.6rem; letter-spacing: 0.01em; }
h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; color: var(--gold); }
small { color: var(--muted); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(5, 11, 22, 0.75);
}
textarea { min-height: 7rem; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--red); margin: 0; }
label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.92rem; }
label small { font-weight: 400; }

.primary-button, .ghost-button, .danger-button, .chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.primary-button { background: linear-gradient(180deg, var(--red-2), var(--red)); color: #fff; box-shadow: 0 6px 18px rgba(229, 53, 43, 0.35); }
.primary-button:hover { transform: translateY(-1px); }
.ghost-button { background: rgba(255, 255, 255, 0.04); border-color: var(--line-strong); color: var(--text); }
.ghost-button:hover { border-color: var(--gold); }
.danger-button { background: transparent; border-color: rgba(255, 107, 107, 0.55); color: var(--danger); }
.chip-button { min-height: 36px; padding: 0.3rem 0.8rem; font-size: 0.85rem; background: rgba(255, 255, 255, 0.05); border-color: var(--line); }
.chip-button:hover { border-color: var(--gold); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-weight: 600; min-height: 44px; }
.link-button:hover { color: var(--text); }
.pill { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; background: rgba(243, 185, 58, 0.15); color: var(--gold); border: 1px solid rgba(243, 185, 58, 0.35); }
.pill.blue { background: rgba(61, 139, 255, 0.14); color: #8fbcff; border-color: rgba(61, 139, 255, 0.4); }
.pill.red { background: rgba(229, 53, 43, 0.16); color: #ff8b84; border-color: rgba(229, 53, 43, 0.45); }
.pill.green { background: rgba(62, 207, 142, 0.14); color: #7de3b5; border-color: rgba(62, 207, 142, 0.4); }
.pill.muted { background: rgba(255, 255, 255, 0.05); color: var(--muted); border-color: var(--line); }

/* Messages ---------------------------------------------------------- */
.flash-stack { position: fixed; top: 0.8rem; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 0.5rem; width: min(640px, calc(100% - 2rem)); }
.flash { padding: 0.8rem 1rem; border-radius: var(--radius-sm); background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.flash-error { border-color: var(--danger); }
.flash-success { border-color: var(--green); }
.flash-invitation { border-color: var(--gold); user-select: all; }
.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; padding: 0.75rem 1.1rem; border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow); max-width: calc(100% - 2rem); text-align: center; }
.toast.error { border-color: var(--danger); }

/* Authentification --------------------------------------------------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: min(420px, 100%); padding: 2rem 1.6rem; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px); text-align: center; }
.auth-card-wide { width: min(520px, 100%); }
.auth-card form { text-align: left; }
.auth-logo { width: 120px; height: auto; margin-bottom: 0.8rem; border-radius: 8px; }
.auth-kicker { color: var(--muted); }
.form-stack { display: grid; gap: 1rem; margin-top: 1.2rem; }
.quiet-link { display: inline-block; margin-top: 1.2rem; color: var(--muted); }
.credits-card { text-align: left; }
.credits-card .auth-logo { display: block; margin-inline: auto; }
.field-note { color: var(--muted); font-size: 0.9rem; margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0.4rem 0; }

/* Barre du haut ------------------------------------------------------ */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.55rem clamp(0.8rem, 3vw, 2rem); background: rgba(7, 13, 24, 0.86); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 0.7rem; color: var(--text); text-decoration: none; min-width: 0; }
.brand img { width: 46px; height: auto; border-radius: 4px; flex: none; }
.brand span { display: grid; line-height: 1.1; }
.brand strong { font-size: 1.02rem; letter-spacing: 0.04em; text-transform: uppercase; }
.brand small { font-size: 0.75rem; }
.topnav { display: flex; align-items: center; gap: 0.2rem 1rem; flex-wrap: wrap; justify-content: flex-end; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem; min-height: 44px; display: inline-flex; align-items: center; }
.topnav a:hover { color: var(--text); }
.inline-logout { margin: 0; }
.topnav .account-link-sm { display: none; }
.topnav .short { display: none; }

/* Application ------------------------------------------------------- */
.app-shell { width: min(1360px, 100%); margin: 0 auto; padding: 1.2rem clamp(0.8rem, 3vw, 2rem) 5rem; }
.boot { display: grid; place-items: center; gap: 1rem; padding: 5rem 1rem; color: var(--muted); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--red); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head p { margin: 0.2rem 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.roster-card { position: relative; display: grid; grid-template-columns: 76px 1fr; gap: 0.9rem; align-items: center; padding: 0.9rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color 0.15s ease, transform 0.12s ease; }
.roster-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.roster-card img { width: 76px; height: 96px; object-fit: cover; object-position: top; border-radius: 10px; background: var(--bg-2); }
.roster-card h2 { font-size: 1.05rem; margin: 0 0 0.2rem; overflow-wrap: anywhere; }
.roster-card p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.empty-state { padding: 3rem 1.5rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(15, 26, 44, 0.6); }
.empty-state p { color: var(--muted); max-width: 520px; margin: 0.4rem auto 1.2rem; }

/* Boîte de dialogue ------------------------------------------------- */
dialog { width: min(520px, calc(100% - 1.5rem)); padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(3, 7, 14, 0.7); backdrop-filter: blur(3px); }
.dialog-body { padding: 1.3rem; display: grid; gap: 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }

/* Assistant --------------------------------------------------------- */
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.2rem; align-items: start; }
.wizard-main { min-width: 0; }
.wizard-title { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.wizard-title h1 { margin: 0; overflow-wrap: anywhere; }
.save-state { font-size: 0.82rem; color: var(--muted); }
.save-state.dirty { color: var(--amber); }
.save-state.error { color: var(--danger); }

.stepper { position: relative; display: flex; gap: 0.35rem; overflow-x: auto; padding-bottom: 0.4rem; margin-bottom: 1rem; scrollbar-width: thin; }
.stepper button { flex: none; display: inline-flex; align-items: center; gap: 0.45rem; min-height: 42px; padding: 0.4rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--muted); font-weight: 700; font-size: 0.86rem; cursor: pointer; }
.stepper button[aria-current="step"] { color: #fff; border-color: var(--red); background: rgba(229, 53, 43, 0.18); }
.stepper .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.stepper .dot.todo { background: var(--amber); }
.stepper .dot.error { background: var(--danger); }
.stepper .num { color: var(--faint); font-variant-numeric: tabular-nums; }

.panel { padding: clamp(1rem, 2.5vw, 1.4rem); border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(8px); margin-bottom: 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.panel-head h2 { margin: 0; }
.panel-head p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; max-width: 70ch; }
.ref { color: var(--faint); font-size: 0.8rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; }
.panel-gap { margin-top: 0.9rem; }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.issues { display: grid; gap: 0.4rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.issues li { display: flex; gap: 0.5rem; align-items: baseline; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.04); border-left: 3px solid var(--amber); font-size: 0.9rem; }
.issues li.error { border-left-color: var(--danger); background: rgba(255, 107, 107, 0.08); }
.issues li.warning { border-left-color: var(--blue); }
.step-nav { display: flex; justify-content: space-between; gap: 0.6rem; margin-top: 0.4rem; }

/* Cartes de choix */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.8rem; }
.choice-card { position: relative; display: grid; gap: 0.35rem; align-content: start; padding: 0.85rem; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); text-align: left; cursor: pointer; color: var(--text); min-height: 44px; }
.choice-card:hover { border-color: var(--line-strong); }
.choice-card[aria-pressed="true"], .choice-card.selected { border-color: var(--gold); background: rgba(243, 185, 58, 0.09); box-shadow: inset 0 0 0 1px rgba(243, 185, 58, 0.35); }
.choice-card[disabled] { cursor: not-allowed; opacity: 0.45; }
.choice-card strong { font-size: 0.98rem; }
.choice-card small { line-height: 1.35; }
.choice-card .check { position: absolute; top: 0.6rem; right: 0.6rem; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 0.8rem; }
.choice-card[aria-pressed="true"] .check { background: var(--gold); color: #1a1204; border-color: var(--gold); }
.species-card { padding: 0; overflow: hidden; }
.species-card img { width: 100%; height: 190px; object-fit: cover; object-position: top; display: block; }
.species-card .species-body { padding: 0.75rem 0.85rem 0.9rem; display: grid; gap: 0.3rem; }
.flag { width: 40px; height: 27px; object-fit: contain; flex: none; }

/* Caractéristiques */
.ability-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ability-table th, .ability-table td { padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); text-align: center; }
.ability-table th:first-child, .ability-table td:first-child { text-align: left; }
.ability-table thead th { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ability-table select, .ability-table input { min-width: 4.6rem; width: 5rem; text-align: center; }
.ability-table .score { font-size: 1.2rem; font-weight: 800; }
.ability-table .mod { color: var(--gold); font-weight: 800; }
.stepper-input { display: inline-flex; align-items: center; gap: 0.3rem; }
.stepper-input button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-weight: 800; }
.stepper-input output { min-width: 2ch; font-weight: 800; }
.dice { display: inline-flex; gap: 0.2rem; }
.die { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: #f1f4fa; color: #0d1829; font-weight: 800; font-size: 0.85rem; }
.die.dropped { opacity: 0.35; text-decoration: line-through; }
.roll-line { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.45rem 0; border-bottom: 1px dashed var(--line); }
.roll-line strong { font-size: 1.1rem; min-width: 2ch; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.25rem; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.segmented button { min-height: 38px; padding: 0.3rem 0.9rem; border-radius: 999px; border: 0; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--red); color: #fff; }

/* Compétences */
.skill-table { width: 100%; border-collapse: collapse; }
.skill-table th, .skill-table td { padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.skill-table thead th { font-size: 0.76rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; text-align: left; }
.skill-table td.center { text-align: center; }
.skill-table .value { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; text-align: right; }
.skill-table select { min-height: 36px; padding: 0.2rem 1.8rem 0.2rem 0.5rem; width: auto; }
.skill-group th { background: rgba(255, 255, 255, 0.03); color: var(--gold); font-size: 0.85rem; }
.skill-name { display: grid; gap: 0.15rem; }
.skill-name small { font-size: 0.78rem; }
.check-cell { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.budget { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.budget .meter { padding: 0.45rem 0.8rem; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-weight: 700; font-size: 0.9rem; }
.budget .meter.ok { border-color: rgba(62, 207, 142, 0.5); }
.budget .meter.over { border-color: var(--danger); color: var(--danger); }

/* Inventaire */
.catalog-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; margin-bottom: 0.8rem; }
.catalog { display: grid; gap: 0.45rem; max-height: min(78vh, 900px); overflow: auto; padding-right: 0.2rem; }
.catalog-item, .inventory-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; padding: 0.6rem 0.75rem; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.catalog-item p, .inventory-item p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.83rem; }
.catalog-item .price { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inventory { display: grid; gap: 0.45rem; }
.inventory-item .controls { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }
.inventory-item .controls input[type="number"] { width: 5.5rem; min-height: 36px; }
.qty { display: inline-flex; align-items: center; gap: 0.2rem; }
.qty button, .icon-button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-weight: 800; display: inline-grid; place-items: center; }
.icon-button.remove { color: var(--danger); border-color: rgba(255, 107, 107, 0.4); }
.credits-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.credits-bar .big { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.credits-bar .big.negative { color: var(--danger); }
.tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.8rem; }

/* Héritage */
.heritage-roll { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; align-items: center; padding: 0.7rem 0.8rem; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); margin-bottom: 0.5rem; }
.heritage-roll .d20 { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(160deg, var(--red-2), #8f1b14); font-weight: 900; font-size: 1.25rem; }
.heritage-roll .d20.chain { background: linear-gradient(160deg, #4a5e80, #1d2a42); }

/* Résumé latéral */
.summary { position: sticky; top: 76px; display: grid; gap: 0.8rem; }
.summary-card { padding: 1rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.summary-id { display: grid; grid-template-columns: 64px 1fr; gap: 0.8rem; align-items: center; }
.summary-id img { width: 64px; height: 80px; object-fit: cover; object-position: top; border-radius: 10px; }
.summary-id h2 { font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.summary-id p { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.85rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; margin-top: 0.8rem; }
.stat { padding: 0.45rem 0.3rem; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ability-mini { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.3rem; margin-top: 0.6rem; }
.ability-mini div { text-align: center; padding: 0.35rem 0; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.ability-mini span { display: block; font-size: 0.66rem; color: var(--muted); font-weight: 700; }
.ability-mini b { font-size: 0.98rem; }
.ability-mini small { display: block; font-size: 0.72rem; color: var(--gold); }
.summary-actions { display: grid; gap: 0.5rem; }
.summary-toggle { display: none; }

/* Fiche terminée */
.export-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.8rem; }
.export-card { display: grid; gap: 0.4rem; padding: 1rem; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); text-decoration: none; }
.export-card:hover { border-color: var(--gold); }
.export-card strong { font-size: 1rem; }
.export-card p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.language-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.language-list .pill button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 0 0 0.2rem; }
.special-list { display: grid; gap: 0.4rem; }
.special-list .row input { flex: 1; min-width: 0; }

/* Fiche web imprimable ---------------------------------------------- */
.sheet-page { background: #0b111c; }
.sheet-page::before { display: none; }
.sheet-toolbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.6rem 1rem; background: rgba(7, 13, 24, 0.92); border-bottom: 1px solid var(--line); }
.toolbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sheet-warning { margin: 0.8rem auto 0; width: min(900px, calc(100% - 1.5rem)); padding: 0.6rem 0.9rem; border-radius: 10px; border: 1px solid var(--amber); background: rgba(245, 165, 36, 0.08); }
.sheet-wrap { padding: 1rem 0.75rem 3rem; }
.sheet-svg { display: block; width: min(900px, 100%); height: auto; margin: 0 auto; box-shadow: var(--shadow); background: #0d1320; }
.sheet-svg text { font-family: Helvetica, Arial, sans-serif; fill: #0c111b; }

/* Page des règles ---------------------------------------------------- */
.rules-shell { width: min(1180px, 100%); margin: 0 auto; padding: 1.2rem clamp(0.8rem, 3vw, 2rem) 4rem; }
.rules-hero p { color: var(--muted); max-width: 75ch; }
.rules-toc { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 1.4rem; }
.rules-toc a { padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 0.88rem; min-height: 36px; display: inline-flex; align-items: center; }
.rules-card { padding: clamp(1rem, 2.5vw, 1.5rem); border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); margin-bottom: 1rem; scroll-margin-top: 80px; }
.rules-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.45rem; }
.table-scroll { overflow-x: auto; margin: 0.4rem 0 1rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
table th, table td { padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table thead th { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
.system-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.6rem; }
.system-chip { display: flex; gap: 0.7rem; align-items: center; padding: 0.6rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.system-chip img { width: 48px; height: 32px; object-fit: contain; }
.planet-list { columns: 2 320px; padding-left: 1.1rem; }
.planet-list li { break-inside: avoid; margin-bottom: 0.3rem; }
.skill-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.skill-columns ul { padding-left: 1.1rem; margin: 0; }
.feat-list dt { font-weight: 800; margin-top: 0.6rem; }
.feat-list dd { margin: 0.2rem 0 0; color: var(--muted); }

/* Administration ----------------------------------------------------- */
.simple-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.8rem clamp(0.8rem, 3vw, 2rem); background: rgba(7, 13, 24, 0.9); border-bottom: 1px solid var(--line); }
.simple-header h1 { margin: 0; font-size: 1.2rem; }
.simple-header a { min-height: 44px; display: inline-flex; align-items: center; }
.admin-shell { width: min(1100px, 100%); margin: 0 auto; padding: 1.2rem clamp(0.8rem, 3vw, 2rem) 3rem; display: grid; gap: 1rem; }
.admin-panel { padding: 1.2rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.inline-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 0.8rem; align-items: end; }
.row-form { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.row-form select { width: auto; min-width: 9rem; }
.row-form button { min-height: 40px; padding: 0.3rem 0.8rem; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; }
.check-inline { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; }
.audit-list { max-height: 360px; overflow: auto; font-size: 0.85rem; }
.audit-list p { margin: 0 0 0.35rem; }
.audit-list time { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; }

/* Réactivité --------------------------------------------------------- */
@media (max-width: 1120px) {
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .summary { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 25; padding: 0 0.6rem calc(0.6rem + env(safe-area-inset-bottom)); gap: 0; pointer-events: none; }
  .summary > * { pointer-events: auto; }
  .summary-toggle { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; width: 100%; min-height: 50px; padding: 0.5rem 1rem; border-radius: 14px 14px 0 0; border: 1px solid var(--line-strong); border-bottom: 0; background: #0d1829; color: var(--text); font-weight: 800; cursor: pointer; box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45); }
  .summary-toggle .quick { display: flex; gap: 0.8rem; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
  .summary-toggle .quick b { color: var(--text); }
  .summary .summary-panel { display: none; max-height: 62vh; overflow: auto; background: #0d1829; border: 1px solid var(--line-strong); border-top: 0; padding: 0.8rem; gap: 0.8rem; }
  .summary.open .summary-panel { display: grid; }
  .summary-card { box-shadow: none; }
  .app-shell { padding-bottom: 7rem; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; }
  .topbar { padding-block: 0.35rem; row-gap: 0; }
  .topnav { width: 100%; justify-content: flex-start; gap: 0 0.75rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .topnav > * { flex: none; }
  .topnav a, .topnav .link-button { font-size: 0.85rem; min-height: 38px; }
  .topnav .account-link { display: none; }
  .topnav .account-link-sm { display: inline-flex; }
  .topnav .long { display: none; }
  .topnav .short { display: inline; }
  .brand small { display: none; }
  .inline-form { grid-template-columns: 1fr; }
  .species-card img { height: 150px; }
  .skill-table .hide-sm { display: none; }
  .catalog-tools { grid-template-columns: 1fr; }
  .step-nav .primary-button, .step-nav .ghost-button { flex: 1; }
  .ability-table select, .ability-table input { width: 4.2rem; min-width: 0; padding-inline: 0.3rem; }
  .ability-table th, .ability-table td { padding: 0.35rem 0.15rem; }
  .ability-table .hide-sm { display: none; }
}
@media (max-width: 400px) {
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media print {
  @page { size: letter; margin: 0; }
  body { background: #fff; }
  body::before { display: none; }
  .no-print, .topbar, .flash-stack { display: none !important; }
  .sheet-wrap { padding: 0; }
  .sheet-svg { width: 100%; height: auto; max-height: 100vh; box-shadow: none; page-break-inside: avoid; }
}
