/* ==========================================================================
   Nihokaï — Création de personnage
   Palette et ornements repris des documents de jeu (parchemin, sumi-e, sakura)
   ========================================================================== */

:root {
  color-scheme: light;

  --paper:      #efe7d6;
  --paper-warm: #e9dfc9;
  --paper-card: #f4eee0;
  --paper-deep: #ddd0b4;

  --ink:    #1c1a17;
  --ink-2:  #4b423a;
  --ink-3:  #7d7365;
  --rule:   #c6b99e;

  --accent:      #8e1c26;
  --accent-deep: #6b1119;
  --accent-tint: rgba(142, 28, 38, .10);
  --accent-mist: rgba(142, 28, 38, .04);

  --gold: #a98b57;
  --plus: #3f6b46;
  --minus:#9a3220;

  --shadow-card: 0 1px 0 rgba(255,255,255,.6), 0 8px 22px -14px rgba(40,28,16,.55);

  --corner-tl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23000' stroke-width='2'%3E%3Cpath d='M1 40V1h39'/%3E%3Cpath d='M7 34V7h27'/%3E%3Cpath d='M13 28V13h15v9h-9v-4h5'/%3E%3C/g%3E%3C/svg%3E");
  --corner-tr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23000' stroke-width='2' transform='rotate(90 20 20)'%3E%3Cpath d='M1 40V1h39'/%3E%3Cpath d='M7 34V7h27'/%3E%3Cpath d='M13 28V13h15v9h-9v-4h5'/%3E%3C/g%3E%3C/svg%3E");
  --corner-br: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23000' stroke-width='2' transform='rotate(180 20 20)'%3E%3Cpath d='M1 40V1h39'/%3E%3Cpath d='M7 34V7h27'/%3E%3Cpath d='M13 28V13h15v9h-9v-4h5'/%3E%3C/g%3E%3C/svg%3E");
  --corner-bl: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23000' stroke-width='2' transform='rotate(270 20 20)'%3E%3Cpath d='M1 40V1h39'/%3E%3Cpath d='M7 34V7h27'/%3E%3Cpath d='M13 28V13h15v9h-9v-4h5'/%3E%3C/g%3E%3C/svg%3E");

  --sakura: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cg fill='%23000'%3E%3Ccircle cx='16' cy='7' r='5.4'/%3E%3Ccircle cx='24.6' cy='13.2' r='5.4'/%3E%3Ccircle cx='21.3' cy='23.4' r='5.4'/%3E%3Ccircle cx='10.7' cy='23.4' r='5.4'/%3E%3Ccircle cx='7.4' cy='13.2' r='5.4'/%3E%3C/g%3E%3C/svg%3E");

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.30'/%3E%3C/svg%3E");

  --seigaiha: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='40' viewBox='0 0 80 40'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cpath d='M0 40a20 20 0 0 1 40 0 20 20 0 0 1 40 0'/%3E%3Cpath d='M0 40a13.3 13.3 0 0 1 26.7 0M26.7 40a13.3 13.3 0 0 1 26.6 0M53.3 40a13.3 13.3 0 0 1 26.7 0'/%3E%3Cpath d='M0 40a6.7 6.7 0 0 1 13.3 0M13.3 40a6.7 6.7 0 0 1 13.4 0M26.7 40a6.7 6.7 0 0 1 13.3 0M40 40a6.7 6.7 0 0 1 13.3 0M53.3 40a6.7 6.7 0 0 1 13.4 0M66.7 40a6.7 6.7 0 0 1 13.3 0'/%3E%3C/g%3E%3C/svg%3E");
}

html[data-monde="empire"]    { --accent:#8e1c26; --accent-deep:#671018; --accent-tint:rgba(142,28,38,.10); --accent-mist:rgba(142,28,38,.045); }
html[data-monde="yokai"]     { --accent:#1c3c72; --accent-deep:#132a52; --accent-tint:rgba(28,60,114,.10); --accent-mist:rgba(28,60,114,.045); }
html[data-monde="shinobi"]   { --accent:#2b4f47; --accent-deep:#1c3831; --accent-tint:rgba(43,79,71,.11);  --accent-mist:rgba(43,79,71,.05); }
html[data-monde="rebellion"] { --accent:#8a3a14; --accent-deep:#63280d; --accent-tint:rgba(138,58,20,.10); --accent-mist:rgba(138,58,20,.045); }
html[data-monde="inconnu"]   { --accent:#6b5636; --accent-deep:#4c3d25; --accent-tint:rgba(107,86,54,.11);  --accent-mist:rgba(107,86,54,.05); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(18px, 3.4vw, 42px) clamp(14px, 3.4vw, 42px) 0;
  font-family: "EB Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(16px, .45vw + 15px, 18.5px);
  line-height: 1.62;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 90% at 50% -10%, rgba(255,252,244,.85), transparent 60%),
    radial-gradient(90% 70% at 10% 100%, rgba(196,176,140,.30), transparent 65%),
    radial-gradient(90% 70% at 95% 25%, rgba(196,176,140,.22), transparent 60%),
    linear-gradient(#efe7d6, #e8ddc7);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: var(--grain);
  opacity: .5;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 180px;
  background-image: var(--seigaiha);
  background-repeat: repeat-x;
  background-position: bottom left;
  opacity: .10;
  pointer-events: none;
  z-index: 0;
}

/* ---------- Cadre de page ------------------------------------------------ */

.frame {
  position: fixed;
  inset: clamp(8px, 1.4vw, 18px);
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px rgba(198,185,158,.62);
  pointer-events: none;
  z-index: 1;
}
.frame-corner {
  position: absolute;
  width: 34px; height: 34px;
  background: var(--accent);
  opacity: .5;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  transition: background .5s ease;
}
.frame-corner.tl { top:-1px; left:-1px;  -webkit-mask-image: var(--corner-tl); mask-image: var(--corner-tl); }
.frame-corner.tr { top:-1px; right:-1px; -webkit-mask-image: var(--corner-tr); mask-image: var(--corner-tr); }
.frame-corner.bl { bottom:-1px; left:-1px;  -webkit-mask-image: var(--corner-bl); mask-image: var(--corner-bl); }
.frame-corner.br { bottom:-1px; right:-1px; -webkit-mask-image: var(--corner-br); mask-image: var(--corner-br); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- En-tête ------------------------------------------------------ */

.masthead, .stepper, .stage, .colophon { position: relative; z-index: 2; }

.masthead { text-align: center; padding: clamp(10px, 2vw, 26px) 0 6px; }

.brand {
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  text-decoration: none; color: inherit;
  padding: 6px 30px;
}
.enso {
  position: absolute;
  width: clamp(64px, 8vw, 92px); aspect-ratio: 1;
  left: 50%; top: 50%; transform: translate(-50%,-52%);
  border: 3px solid var(--accent);
  border-radius: 50%;
  border-right-color: transparent;
  opacity: .26;
  rotate: -28deg;
  transition: border-color .5s ease;
}
.brand-name {
  position: relative;
  font-family: Cinzel, serif;
  font-weight: 500;
  font-size: clamp(2.5rem, 7vw, 4.2rem);
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--ink);
}
.brand-sub {
  margin: .55rem 0 0;
  font-family: Cinzel, serif;
  font-size: clamp(.72rem, 1.5vw, .86rem);
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--accent);
}
.brand-sub::before, .brand-sub::after { content: "—"; margin: 0 .7em; color: var(--rule); }

/* ---------- Fil des étapes ---------------------------------------------- */

.stepper {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: clamp(6px, 1.4vw, 20px);
  margin: clamp(14px, 2.4vw, 26px) auto 0;
  max-width: 900px;
  padding: 0 8px;
}
.step {
  display: inline-flex; align-items: center; gap: .5em;
  border: 0; background: none; padding: 4px 2px;
  font-family: Cinzel, serif;
  font-size: clamp(.6rem, 1.15vw, .74rem);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3);
  cursor: default;
}
.step + .step::before {
  content: ""; width: clamp(10px, 3vw, 34px); height: 1px;
  background: var(--rule); margin-right: .5em;
}
.step-num {
  display: grid; place-items: center;
  width: 1.85em; height: 1.85em;
  border: 1px solid var(--rule); border-radius: 50%;
  font-size: .95em;
}
.step.is-done { color: var(--ink-2); cursor: pointer; }
.step.is-done .step-num { border-color: var(--accent); color: var(--accent); }
.step.is-done:hover .step-num { background: var(--accent-tint); }
.step.is-current { color: var(--ink); }
.step.is-current .step-num { background: var(--accent); border-color: var(--accent); color: var(--paper-card); }
.step-label { display: none; }
@media (min-width: 720px) { .step-label { display: inline; } }

/* ---------- Scène ------------------------------------------------------- */

.stage {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(20px, 3.5vw, 44px) 4px clamp(40px, 6vw, 80px);
  outline: none;
}
.stage > * { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  .stage > * { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Titres de section ------------------------------------------- */

.section-head { text-align: center; margin: 0 auto clamp(22px, 3.4vw, 40px); max-width: 760px; }
.section-kicker {
  font-family: Cinzel, serif;
  font-size: .68rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .6rem;
}
.section-title {
  font-family: "Cormorant Garamond", Cinzel, serif; font-weight: 500;
  font-size: clamp(1.85rem, 4.6vw, 3rem);
  line-height: 1.1; margin: 0; color: var(--ink);
}
.section-note { margin: .9rem 0 0; color: var(--ink-2); }

.divider {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 1.1rem auto 0; max-width: 520px;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 40%, var(--accent));
}
.divider::after { background: linear-gradient(270deg, transparent, var(--accent) 40%, var(--accent)); }
.divider span {
  width: 15px; height: 15px; background: var(--accent);
  -webkit-mask: var(--sakura) center/contain no-repeat; mask: var(--sakura) center/contain no-repeat;
}

/* ---------- Ornements de carte ------------------------------------------ */

.orn { position: relative; }
.orn::before {
  content: "";
  position: absolute; inset: 5px; z-index: 3;
  background: var(--accent);
  opacity: .55;
  pointer-events: none;
  -webkit-mask-image: var(--corner-tl), var(--corner-tr), var(--corner-bl), var(--corner-br);
  mask-image: var(--corner-tl), var(--corner-tr), var(--corner-bl), var(--corner-br);
  -webkit-mask-position: top left, top right, bottom left, bottom right;
  mask-position: top left, top right, bottom left, bottom right;
  -webkit-mask-size: 26px 26px; mask-size: 26px 26px;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  transition: opacity .25s ease, background .5s ease;
}

/* ---------- Boutons ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .7em;
  font-family: Cinzel, serif; font-size: clamp(.78rem, 1.5vw, .92rem);
  letter-spacing: .16em; text-transform: uppercase;
  padding: .95em 2.1em;
  border: 1px solid var(--accent);
  background: var(--accent); color: #f6f1e5;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 10px 24px -16px rgba(40,22,10,.9);
  transition: background .18s, color .18s, transform .18s, box-shadow .18s, opacity .18s;
}
.btn:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .34; cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  background: transparent; color: var(--accent);
  box-shadow: none; border-color: var(--rule);
}
.btn-ghost:hover:not(:disabled) { background: var(--accent-tint); color: var(--accent-deep); border-color: var(--accent); transform: none; }
.btn-lg { padding: 1.15em 2.6em; font-size: clamp(.84rem, 1.8vw, 1rem); }

:where(.btn, .card, .chip-btn, input, .step.is-done):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Accueil ------------------------------------------------------ */

.hero { text-align: center; max-width: 900px; margin: 0 auto; }
.hero-art {
  position: relative;
  margin: 0 auto clamp(18px, 3vw, 34px);
  max-width: 820px;
  aspect-ratio: 21 / 9;
  max-height: 46vh;
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 0 4px var(--paper-card), var(--shadow-card);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 42%; display: block; }
.hero-art::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 120% at 50% 20%, transparent 40%, rgba(233,223,201,.55) 88%),
    linear-gradient(to bottom, transparent 55%, rgba(233,223,201,.9));
}
.hero-lead { font-size: 1.12em; color: var(--ink-2); max-width: 620px; margin: 0 auto 2rem; }
.hero-lead strong { color: var(--ink); font-weight: 600; }
.hero-actions { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.hero-meta {
  font-family: Cinzel, serif; font-size: .68rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-3);
}

/* ---------- Grilles de choix -------------------------------------------- */

.grid { display: grid; gap: clamp(14px, 1.9vw, 22px); }
.grid-worlds  { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
.grid-races   { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.grid-classes { grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }

.card {
  position: relative;
  display: flex; flex-direction: column;
  text-align: left;
  padding: 0;
  border: 1px solid var(--rule);
  background: linear-gradient(var(--paper-card), var(--paper-warm));
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font: inherit; color: inherit;
  transition: border-color .2s, box-shadow .2s, transform .2s, background .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 1px 0 rgba(255,255,255,.6), 0 18px 30px -20px rgba(40,28,16,.7); }
.card.is-selected { border-color: var(--accent); background: linear-gradient(var(--paper-card), var(--paper-card)); box-shadow: 0 0 0 1px var(--accent), var(--shadow-card); }
.card.is-selected::before { opacity: 1; }
.card.is-selected .card-title { color: var(--accent-deep); }

.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule);
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 22%;
  display: block; filter: saturate(.94);
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.card:hover .card-media img { transform: scale(1.035); }
.card-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 55%, rgba(233,223,201,.92));
}
.grid-worlds .card-media { aspect-ratio: 3 / 4; }

.card-body { padding: clamp(16px, 2vw, 22px) clamp(16px, 2vw, 22px) clamp(18px, 2.2vw, 24px); display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.card-title {
  font-family: "Cormorant Garamond", Cinzel, serif; font-weight: 600;
  font-size: clamp(1.12rem, 2vw, 1.32rem);
  line-height: 1.2; margin: 0; color: var(--ink);
  display: flex; align-items: center; gap: .6em;
}
.card-kicker {
  font-family: Cinzel, serif; font-size: .62rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent); margin: 0;
}
.card-desc { margin: 0; font-size: .94em; color: var(--ink-2); }
.card-check {
  position: absolute; top: 12px; right: 12px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #f6f1e5;
  font-size: 15px; line-height: 1;
  opacity: 0; transform: scale(.7);
  transition: opacity .2s, transform .2s;
  z-index: 2;
}
.card.is-selected .card-check { opacity: 1; transform: scale(1); }

.class-emblem {
  flex: none;
  width: 2.05em; height: 2.05em; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: var(--paper-card);
}
.class-emblem svg { width: 60%; height: 60%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Puces de modificateurs -------------------------------------- */

.mods { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: .5rem; }
.mod {
  font-family: Cinzel, serif; font-size: .6rem; letter-spacing: .07em;
  padding: .35em .6em; border: 1px solid var(--rule);
  background: rgba(255,253,247,.6); white-space: nowrap;
}
.mod.up   { color: var(--plus);  border-color: rgba(63,107,70,.45); }
.mod.down { color: var(--minus); border-color: rgba(154,50,32,.45); }
.mod.none { color: var(--ink-3); font-style: italic; letter-spacing: .04em; }

/* ---------- Sous-choix (variantes) -------------------------------------- */

.variant {
  border-top: 1px dashed var(--rule);
  margin: .3rem -.2rem 0; padding: .85rem .2rem 0;
}
.variant-label {
  font-family: Cinzel, serif; font-size: .6rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .55rem;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  font: inherit; font-size: .82em;
  padding: .34em .8em;
  border: 1px solid var(--rule); background: rgba(255,253,247,.7);
  color: var(--ink-2); cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }
.chip-btn.is-on { background: var(--accent); border-color: var(--accent); color: #f6f1e5; }

/* ---------- Formulaire nom ---------------------------------------------- */

.panel {
  position: relative;
  max-width: 640px; margin: 0 auto;
  padding: clamp(26px, 4vw, 46px);
  border: 1px solid var(--rule);
  background: linear-gradient(var(--paper-card), var(--paper-warm));
  box-shadow: var(--shadow-card);
}
.field { margin: 1.6rem 0 .4rem; }
.field label {
  display: block;
  font-family: Cinzel, serif; font-size: .66rem; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .6rem;
}
.field input {
  width: 100%;
  font: inherit; font-size: 1.22em;
  padding: .62em .8em;
  color: var(--ink);
  background: rgba(255,253,247,.75);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  transition: border-color .18s, background .18s;
}
.field input:focus { border-color: var(--accent); background: #fffdf7; outline: none; }
.field-help { margin: .6rem 0 0; font-size: .88em; color: var(--ink-3); font-style: italic; }
.field-error { margin: .6rem 0 0; font-size: .9em; color: var(--minus); }

/* ---------- Barre d'action ---------------------------------------------- */

.actionbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 18px;
  margin: clamp(24px, 3.4vw, 40px) 0 0;
  padding: clamp(12px, 1.8vw, 18px) clamp(14px, 2.2vw, 24px);
  border: 1px solid var(--rule);
  background: rgba(243,237,224,.94);
  backdrop-filter: blur(6px);
  box-shadow: 0 -10px 26px -22px rgba(40,28,16,.9);
}
.actionbar-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.actionbar-label { font-family: Cinzel, serif; font-size: .6rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.actionbar-value { font-family: Cinzel, serif; font-size: clamp(.9rem, 1.9vw, 1.05rem); color: var(--ink); }
.actionbar-value em { font-style: normal; color: var(--accent); }
.actionbar-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }

/* ---------- Récapitulatif ------------------------------------------------ */

.recap {
  display: flex; flex-wrap: wrap; gap: 10px 26px;
  padding: clamp(14px, 2vw, 20px) clamp(16px, 2.2vw, 24px);
  margin: 0 0 clamp(20px, 3vw, 30px);
  border: 1px solid var(--rule);
  background: var(--accent-mist);
}
.recap-item { display: flex; flex-direction: column; gap: 1px; }
.recap-key { font-family: Cinzel, serif; font-size: .58rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.recap-val { font-family: Cinzel, serif; font-size: .95rem; color: var(--accent-deep); }

/* ---------- Compétences -------------------------------------------------- */

.skills { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .skills { grid-template-columns: 1fr 1fr; gap: 10px 26px; } }

.skill {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name ctrl" "bar bar";
  align-items: center;
  gap: 6px 14px;
  padding: 11px 14px;
  border: 1px solid var(--rule);
  background: linear-gradient(var(--paper-card), var(--paper-warm));
}
.skill.is-boosted { border-color: rgba(63,107,70,.4); }
.skill.is-hindered { border-color: rgba(154,50,32,.35); }

.skill-name { grid-area: name; display: flex; align-items: baseline; flex-wrap: wrap; gap: .45em; min-width: 0; }
.skill-label { font-family: Cinzel, serif; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.skill-mod { font-family: Cinzel, serif; font-size: .6rem; letter-spacing: .06em; }
.skill-mod.up { color: var(--plus); }
.skill-mod.down { color: var(--minus); }

.skill-ctrl { grid-area: ctrl; display: flex; align-items: center; gap: 6px; }
.step-btn {
  width: 2em; height: 2em; flex: none;
  display: grid; place-items: center;
  font-family: Cinzel, serif; font-size: 1rem; line-height: 1;
  border: 1px solid var(--rule); background: rgba(255,253,247,.8);
  color: var(--accent); cursor: pointer;
  transition: background .14s, color .14s, border-color .14s, opacity .14s;
}
.step-btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #f6f1e5; }
.step-btn:disabled { opacity: .25; cursor: not-allowed; }
.skill-value {
  min-width: 2.6em; text-align: center;
  font-family: Cinzel, serif; font-size: 1.16rem; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.skill-value.at-cap { color: var(--accent); }

.skill-bar { grid-area: bar; position: relative; height: 5px; background: rgba(150,132,100,.24); overflow: hidden; }
.skill-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); transition: width .18s ease; }
.skill-bar u {
  position: absolute; top: -3px; bottom: -3px; width: 1px;
  background: var(--ink-3); opacity: .55;
}

.budget {
  display: flex; align-items: baseline; gap: .5em;
  font-family: Cinzel, serif;
}
.budget b { font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.budget.is-done b { color: var(--plus); }
.budget span { font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Fin ---------------------------------------------------------- */

.done { text-align: center; max-width: 720px; margin: 0 auto; }
.done-seal {
  width: clamp(84px, 14vw, 116px); aspect-ratio: 1; margin: 0 auto clamp(18px, 3vw, 28px);
  display: grid; place-items: center;
  border: 3px solid var(--accent); border-radius: 50%;
  color: var(--accent);
}
.done-seal span { width: 46%; height: 46%; background: var(--accent); -webkit-mask: var(--sakura) center/contain no-repeat; mask: var(--sakura) center/contain no-repeat; }
.sheet {
  text-align: left; margin: clamp(24px, 4vw, 36px) 0 0;
  border: 1px solid var(--rule); background: linear-gradient(var(--paper-card), var(--paper-warm));
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow-card);
}
.sheet h3 {
  font-family: Cinzel, serif; font-weight: 600; font-size: .74rem;
  letter-spacing: .22em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 .9rem; padding-bottom: .5rem; border-bottom: 1px solid var(--rule);
}
.sheet h3 + h3,
.sheet dl + h3 { margin-top: 1.9rem; }
.sheet dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 22px; margin: 0; }
.sheet dt { font-family: Cinzel, serif; font-size: .58rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); }
.sheet dd { margin: 0 0 .3rem; font-size: 1.02em; }
.sheet-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 4px 22px; margin: 0; }
.sheet-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: .3em 0; border-bottom: 1px dotted var(--rule); }
.sheet-stat span { font-family: Cinzel, serif; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.sheet-stat b { font-family: Cinzel, serif; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.notice {
  margin: clamp(20px, 3vw, 28px) 0 0;
  padding: 14px 18px;
  border: 1px solid var(--rule);
  background: rgba(255,253,247,.7);
  font-size: .92em; color: var(--ink-2); text-align: left;
}
.notice.warn { border-color: rgba(154,50,32,.45); background: rgba(154,50,32,.06); }

.spinner {
  width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center; padding: clamp(30px, 6vw, 60px) 20px;
  border: 1px dashed var(--rule); color: var(--ink-3); font-style: italic;
}

/* ---------- Pied --------------------------------------------------------- */

.colophon {
  text-align: center;
  padding: clamp(20px, 3vw, 34px) 0 clamp(24px, 3vw, 38px);
  border-top: 1px solid var(--rule);
  max-width: 1180px; margin: 0 auto;
}
.colophon .sakura {
  display: block; width: 13px; height: 13px; margin: -7px auto 12px;
  background: var(--accent);
  -webkit-mask: var(--sakura) center/contain no-repeat; mask: var(--sakura) center/contain no-repeat;
  box-shadow: 0 0 0 7px var(--paper);
}
.colophon p { margin: 0; font-size: .8em; color: var(--ink-3); }

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

.stepper[hidden] { display: none; }

/* ---------- Variantes de barre d'action ---------------------------------- */

.actionbar.is-static {
  position: static;
  justify-content: center;
  backdrop-filter: none;
  box-shadow: none;
}
.actionbar.is-static .actionbar-buttons { margin: 0; }

@media (max-width: 560px) {
  .actionbar { padding: 12px 14px; }
  .actionbar-buttons { width: 100%; }
  .actionbar-buttons .btn { flex: 1 1 auto; padding-inline: 1.1em; }
}

/* ---------- Impression ---------------------------------------------------- */

@media print {
  :root { --paper: #fff; --paper-card: #fff; --paper-warm: #fff; --rule: #999; }
  body {
    background: #fff; padding: 0; color: #000;
    font-size: 11pt;
  }
  body::before, body::after { display: none; }
  .frame, .stepper, .colophon, .actionbar, .done-seal, .divider, .notice { display: none !important; }
  .masthead { padding: 0 0 8pt; }
  .brand-name { font-size: 26pt; }
  .enso { display: none; }
  .stage { padding: 0; max-width: none; }
  .stage > * { animation: none; }
  .section-title { font-size: 18pt; }
  .section-note { font-size: 10pt; }
  .sheet { border: 1px solid #999; box-shadow: none; page-break-inside: avoid; }
  .sheet-stat { border-bottom: 1px solid #ddd; }
  .orn::before { display: none; }
}

/* ---------- Adaptations mobiles ------------------------------------------ */

@media (max-width: 560px) {
  .grid-worlds .card { flex-direction: row; }
  .grid-worlds .card-media {
    aspect-ratio: auto;
    flex: 0 0 112px;
    border-bottom: 0; border-right: 1px solid var(--rule);
  }
  .grid-worlds .card-body { padding: 15px; gap: .4rem; }
  .grid-worlds .card-desc { font-size: .88em; }
  .grid-worlds .card-media img { object-position: center 18%; }
  .grid-worlds .card-media::after {
    background: linear-gradient(to right, transparent 45%, rgba(233,223,201,.75));
  }
  .grid-worlds .card-body { flex: 1; justify-content: center; }
  .grid-races .card-media { aspect-ratio: 1 / 1; }
  .skill { padding: 10px 12px; }
  .step-btn { width: 2.3em; height: 2.3em; }
}
