/* Polices hébergées sur le serveur (SIL Open Font License) : aucun appel à un service tiers */
@font-face { font-family: "Big Shoulders Display"; font-weight: 700 900; font-display: swap; src: url("/assets/big-shoulders-display-latin-943bd82a.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: "Big Shoulders Display"; font-weight: 700 900; font-display: swap; src: url("/assets/big-shoulders-display-latin-ext-63d40dc4.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: "Instrument Sans"; font-weight: 400 700; font-display: swap; src: url("/assets/instrument-sans-latin-265d6ea6.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: "Instrument Sans"; font-weight: 400 700; font-display: swap; src: url("/assets/instrument-sans-latin-ext-83c16217.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 {
  --ground: #121419;
  --surface: #1C1F27;
  --surface-raised: #252935;
  --line: #2B2F3B;
  --line-strong: #3A3F4E;
  --text: #EDEFF4;
  --text-soft: #D0D4DE;
  --text-muted: #A3A9B7;
  --text-faint: #6B7285;
  --good: #69DB7C;
  --warn: #FF8A3D;
  --electron: #FCC419;

  --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-text: "Instrument Sans", system-ui, sans-serif;

  --radius: 12px;
  --card-w: 248px;
  --gutter: clamp(16px, 4vw, 52px);
  color-scheme: dark;
}

/* Raretés : pastille et cadre */
.rar-commune { --rar: #8A919E; }
.rar-peu_commune { --rar: #51CF66; }
.rar-rare { --rar: #4DABF7; }
.rar-super_rare { --rar: #9775FA; }
.rar-ultra_rare { --rar: #FF8A3D; }
.rar-legendaire { --rar: #FCC419; }

/* Familles : fond du panneau et teinte claire du symbole */
.fam-non-metal { --fam: #1F3B5C; --fam-ink: #A5D8FF; }
.fam-gaz-noble { --fam: #3D2A55; --fam-ink: #EEBEFA; }
.fam-metal-alcalin { --fam: #5A2E18; --fam-ink: #FFC078; }
.fam-metal-alcalino-terreux { --fam: #4D3F12; --fam-ink: #FFEC99; }
.fam-metal-de-transition { --fam: #5A2323; --fam-ink: #FFC9C9; }
.fam-metal-pauvre { --fam: #33373D; --fam-ink: #CED4DA; }
.fam-metalloide { --fam: #17473C; --fam-ink: #96F2D7; }
.fam-halogene { --fam: #34461A; --fam-ink: #C0EB75; }
.fam-lanthanide { --fam: #1E4A4A; --fam-ink: #99E9F2; }
.fam-actinide { --fam: #3A2F25; --fam-ink: #E9C9A0; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
/* La zone principale occupe toute la hauteur ; les pages se calent en haut */
main { flex: 1; display: flex; flex-direction: column; }

a { color: var(--text-soft); }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
p { margin: 0; }

.display { font-family: var(--font-display); font-weight: 900; }
.muted { color: var(--text-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- mise en page */

.site-header {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  min-height: 72px; padding: 10px var(--gutter);
  border-bottom: 1px solid #22262F;

  .brand { font-family: var(--font-display); font-weight: 900; font-size: 28px; color: var(--text); text-decoration: none; }
  nav { display: flex; flex-wrap: wrap; gap: 6px; }
  nav a {
    padding: 12px 16px; border-radius: var(--radius);
    font-size: 14px; font-weight: 600; text-decoration: none; color: var(--text-muted);
    &[aria-current="page"] { background: var(--surface-raised); color: var(--text); }
  }
  .wallet { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
}

.page { padding: 56px var(--gutter) 64px; width: 100%; max-width: 1440px; margin: 0 auto; }
.page-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(40px, 6vw, 56px); }

.flash {
  position: fixed; left: 50%; bottom: 32px; translate: -50% 0; z-index: 20;
  max-width: min(640px, calc(100vw - 32px));
  padding: 14px 20px; border-radius: 14px;
  background: var(--text); color: var(--ground); font-weight: 700; text-align: center;
  animation: flash-out 400ms ease 4s forwards;
  &.flash-alert { background: var(--warn); }
}
@keyframes flash-out { to { opacity: 0; visibility: hidden; } }

/* ---------------------------------------------------------------- boutons et formulaires */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: var(--radius);
  background: var(--text); color: var(--ground);
  font: inherit; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer;
  &:hover { color: var(--ground); filter: brightness(0.92); }
  &:disabled, &[aria-disabled="true"] { background: #4A5061; cursor: default; filter: none; }
}
.button-secondary {
  background: none; color: var(--text); border: 1px solid var(--line-strong);
  &:hover { color: var(--text); background: var(--surface); }
  &:disabled { background: none; color: var(--text-faint); border-color: var(--line); }
}
.link-button {
  min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

.form { display: flex; flex-direction: column; gap: 22px; width: min(440px, 100%); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 600; }
.field input[type="text"], .field input[type="password"], .field input[type="email"], .field input[type="number"], .field select {
  height: 50px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
  &:focus { outline: none; border-color: var(--text); }
  &[aria-invalid="true"] { border-color: var(--warn); }
}
.field .hint { font-size: 13px; color: var(--text-muted); }
.field .error { font-size: 13px; color: var(--warn); }
.checkbox { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--text-soft); }
.checkbox input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--text); flex-shrink: 0; }
.panel { padding: 16px 18px; border-radius: 14px; background: var(--surface); }

/* ---------------------------------------------------------------- inscription et connexion */

.auth {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); align-items: center;
  gap: clamp(48px, 7vw, 120px); width: 100%; max-width: 1180px;
  margin: auto; padding: 48px var(--gutter);

  .auth-showcase { display: flex; flex-direction: column; gap: 20px; }
  .auth-pitch { font-family: var(--font-display); font-weight: 900; font-size: clamp(48px, 5vw, 72px); line-height: 0.95; max-width: 14ch; }
  .auth-lead { font-size: 19px; color: var(--text-soft); max-width: 34ch; }
}
/* Éventail : la carte du milieu passe devant, les cartes inclinées ne débordent pas de la colonne */
.auth-fan { position: relative; width: 560px; max-width: 100%; height: 420px; margin-top: 28px; }
.auth-fan > :nth-child(n) { position: absolute; border-radius: 18px; box-shadow: 0 24px 48px rgb(0 0 0 / 0.35); }
.auth-fan > :nth-child(1) { left: 16px; top: 34px; rotate: -9deg; }
.auth-fan > :nth-child(2) { left: 296px; top: 34px; rotate: 9deg; }
.auth-fan > :nth-child(3) { left: 156px; top: 0; }
@media (width < 1000px) {
  .auth { grid-template-columns: minmax(0, 440px); justify-content: center; align-items: start; }
  .auth .auth-showcase { display: none; }
}
/* Écran peu haut : l'éventail rétrécit pour que tout tienne sans défiler */
@media (width >= 1000px) and (height < 920px) {
  .auth .auth-fan { zoom: 0.8; }
}

/* ---------------------------------------------------------------- carte */

.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  width: var(--card-w); aspect-ratio: 248 / 348;
  border: 1.5px solid var(--rar); border-radius: 18px; background: var(--surface);
  &.rar-legendaire { border-width: 2.5px; }

  .card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px 10px; }
  .card-type { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
  .rarity-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--rar); color: var(--ground); white-space: nowrap; }
  .card-panel { position: relative; margin: 0 10px; height: calc(var(--card-w) * 176 / 248); border-radius: var(--radius); background: var(--fam); overflow: hidden; }
  .card-symbol {
    position: absolute; left: 14px; bottom: 6px;
    font-family: var(--font-display); font-weight: 900; font-size: calc(var(--card-w) * 0.516); line-height: 1;
    color: var(--fam-ink); white-space: nowrap;
  }
  .card-name { padding: 10px 14px 0; font-family: var(--font-display); font-weight: 800; font-size: 28px; line-height: 1.05; }
  .card-meta { display: flex; justify-content: space-between; padding: 2px 14px 0; font-size: 12px; color: var(--text-muted); }
  .card-state { margin-top: auto; height: 32px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--warn); }
}
.rarity-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--rar); color: var(--ground); white-space: nowrap; }

/* Mini-carte du tableau périodique */
.locator {
  position: absolute; top: 10px; right: 10px; width: 43%;
  display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, 4px); gap: 2px;
  transition: opacity 1100ms ease-in-out;
  span { border-radius: 1px; background: color-mix(in srgb, var(--fam-ink) 20%, transparent); }
  .here { background: var(--fam-ink); }
  .empty { background: none; }
}

/* Couches d'électrons, dessinées en SVG et révélées au survol */
.orbits {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1100ms ease-in-out;
  circle.shell { fill: none; stroke: color-mix(in srgb, var(--fam-ink) 33%, transparent); stroke-width: 1; }
  circle.electron { fill: var(--fam-ink); }
  circle.nucleus { fill: var(--fam-ink); }
  &.radioactive circle.nucleus { fill: var(--warn); }
}

/* Inclinaison : la vue passe du tableau aux électrons selon la distance au centre (--reveal entre 0 et 1) */
.tilt {
  display: block; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left;
  border-radius: 18px; cursor: pointer; perspective: 900px;
  .card { transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--scale, 1)); transition: transform 900ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  &.is-tilting .card { transition: transform 260ms cubic-bezier(0.25, 0.8, 0.25, 1); }
  .locator { opacity: clamp(0, calc((0.6 - var(--reveal, 0)) / 0.6), 1); }
  .orbits { opacity: clamp(0, calc((var(--reveal, 0) - 0.4) / 0.6), 1); }
  &.is-tilting .locator, &.is-tilting .orbits { transition-duration: 160ms; transition-timing-function: linear; }
  .sheen {
    position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1100ms ease-in-out;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgb(255 255 255 / 0.09), transparent 60%);
  }
  &.is-tilting .sheen { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tilt .card { transform: none !important; }
  .tilt .sheen { display: none; }
}

/* Dos de carte */
.card-back {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  width: var(--card-w); aspect-ratio: 248 / 348; border: 1.5px solid var(--line-strong); border-radius: 18px; background: var(--surface);
  .card-back-name { font-family: var(--font-display); font-weight: 900; font-size: 34px; }
}
.table-dots {
  display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 3px; width: 86%;
  span { height: 9px; border-radius: 2px; }
  span.on { background: color-mix(in srgb, var(--fam-ink) 67%, transparent); }
}

/* ---------------------------------------------------------------- boosters */

/* Exception : l'ouverture de booster reste centrée verticalement */
.booster-stage, .reveal { margin-block: auto; }
.booster-stage { display: flex; flex-direction: column; align-items: center; gap: 28px; padding-top: 24px; }
.booster-pack {
  position: relative; width: 280px; height: 392px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  .pack-strip {
    position: absolute; inset: 0 0 auto; height: 44px; border: 1.5px solid var(--line-strong); border-bottom: 0; border-radius: 18px 18px 0 0;
    background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-faint);
    transition: translate 700ms cubic-bezier(0.3, 0.6, 0.2, 1), rotate 700ms, opacity 700ms ease;
  }
  .pack-body {
    position: absolute; inset: 44px 0 0; border: 1.5px solid var(--line-strong); border-top: 1.5px dashed #4A5061; border-radius: 0 0 18px 18px;
    background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
    transition: translate 800ms cubic-bezier(0.4, 0, 0.2, 1) 250ms, scale 800ms 250ms, opacity 800ms ease 250ms;
  }
  &.is-opening .pack-strip { translate: 60px -90px; rotate: 12deg; opacity: 0; }
  &.is-opening .pack-body { translate: 0 40px; scale: 0.94; opacity: 0; }
}
.pips { display: flex; gap: 6px; }
.pips span { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.pips span.full { background: var(--text); }
/* Le booster en cours de recharge se remplit au fil du compte à rebours */
.pips span.next { overflow: hidden; }
.pips span.next i { display: block; height: 100%; background: var(--text-muted); transform-origin: left; transition: transform 1s linear; }
.booster-refill { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.booster-refill p { font-size: 14px; }
.refill-clock { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.reveal { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.reveal-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px; }
.reveal-slot {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  opacity: 0; translate: 0 40px; transition: opacity 800ms ease, translate 1000ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: calc(var(--i) * 260ms);
  &.is-dealt { opacity: 1; translate: 0 0; }
}
.reveal-tag {
  height: 26px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; opacity: 0; transition: opacity 700ms ease;
  &.is-new { background: var(--text); color: var(--ground); }
  &.is-unlock { background: #99E9F2; color: var(--ground); }
  &.is-shown { opacity: 1; }
}
.flip {
  position: relative; width: var(--card-w); aspect-ratio: 248 / 348; perspective: 1200px;
  translate: 0 0; transition: translate 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
  &.is-raised { translate: 0 -10px; }
  .flip-inner {
    position: absolute; inset: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left;
    border-radius: 18px; cursor: default; transform-style: preserve-3d;
    transition: transform var(--flip-ms, 1100ms) cubic-bezier(0.45, 0, 0.2, 1);
  }
  &.is-next .flip-inner { cursor: pointer; }
  &.is-flipped .flip-inner { transform: rotateY(180deg); }
  .flip-face { position: absolute; inset: 0; backface-visibility: hidden; }
  .flip-front { transform: rotateY(180deg); }
  /* L'inclinaison ne joue qu'une fois la carte retournée */
  &:not(.is-flipped) .tilt .card { transform: none; }
}
.reveal-actions { min-height: 110px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.reveal-summary { display: none; flex-direction: column; align-items: center; gap: 14px; }
.reveal.is-done .reveal-summary { display: flex; }
.reveal.is-done .reveal-hint { display: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
@media (prefers-reduced-motion: reduce) {
  .reveal-slot, .flip, .flip .flip-inner, .booster-pack * { transition: none !important; }
}

/* ---------------------------------------------------------------- album */

.album { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.album-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.progress { width: 220px; height: 6px; border-radius: 3px; background: #22262F; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--text); }
.periodic {
  display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, minmax(40px, 48px)) 12px repeat(2, minmax(40px, 48px)); gap: 4px;
  .cell {
    position: relative; display: flex; align-items: center; justify-content: center; border-radius: 8px;
    border: 1.5px dashed var(--line); color: #4A5061; text-decoration: none;
    font-family: var(--font-display); font-weight: 800; font-size: clamp(14px, 1.5vw, 20px);
    &.owned { border: 1.5px solid var(--fam); background: var(--fam); color: var(--fam-ink); }
    &[aria-current="true"] { box-shadow: 0 0 0 2px var(--text); }
    .z { position: absolute; left: 4px; top: 2px; font-family: var(--font-text); font-size: 9px; font-weight: 500; opacity: 0.8; }
    .count { position: absolute; right: 3px; bottom: 2px; font-family: var(--font-text); font-size: 9px; font-weight: 700; opacity: 0.85; }
  }
  .series { display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--text-faint); }
}
.families { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 16px; margin-top: 20px; }
.family-progress {
  display: flex; flex-direction: column; gap: 5px; font-size: 12px;
  .bar { height: 5px; border-radius: 3px; background: #22262F; overflow: hidden; }
  .bar span { display: block; height: 100%; background: var(--fam-ink); }
}
.album-side { position: sticky; top: 24px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ghost-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: var(--card-w); aspect-ratio: 248 / 348; border: 1.5px dashed var(--line-strong); border-radius: 18px; color: var(--text-faint);
}
@media (width < 1100px) {
  .album { grid-template-columns: 1fr; }
  .album-side { position: static; }
  .periodic-scroll { overflow-x: auto; }
  .periodic { min-width: 760px; }
}

/* ---------------------------------------------------------------- quiz */

.quiz { display: flex; flex-direction: column; gap: 26px; }
.quiz-progress { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.dots { display: flex; gap: 6px; }
.dots span { width: 28px; height: 6px; border-radius: 3px; background: var(--line); }
.dots .current { background: var(--text); }
.dots .right { background: var(--good); }
.dots .wrong { background: var(--warn); }
.timer { height: 4px; border-radius: 2px; background: #22262F; overflow: hidden; }
.timer span { display: block; height: 100%; width: 100%; background: var(--text-muted); transform-origin: left; }
.quiz-question { font-size: clamp(24px, 3vw, 32px); font-weight: 600; line-height: 1.25; min-height: 80px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(280px, calc(50% - 6px)), 1fr)); gap: 12px; }
.choice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 68px; padding: 14px 20px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 19px; font-weight: 600; text-align: left; cursor: pointer;
  &:hover:not(:disabled) { border-color: var(--line-strong); }
  &:disabled { cursor: default; opacity: 0.45; }
  &.is-right { opacity: 1; border-color: var(--good); background: rgb(105 219 124 / 0.10); }
  &.is-wrong { opacity: 1; border-color: var(--warn); background: rgb(255 138 61 / 0.10); }
}
.explanation { padding: 16px 18px; border-radius: 14px; background: var(--surface); color: var(--text-soft); strong { color: var(--warn); } }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.level-option {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 168px; padding: 20px;
  border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface); cursor: pointer;
  &:has(input:checked) { border-color: var(--text); background: var(--surface-raised); }
  &:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 3px; }
  input { position: absolute; opacity: 0; }
  .level-name { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1; }
  .level-desc { font-size: 14px; color: var(--text-muted); }
  .level-example { margin-top: auto; font-size: 13px; color: var(--text-soft); }
}
.packs-won { display: flex; gap: 8px; }
.packs-won span { width: 44px; height: 62px; border: 1.5px solid var(--line-strong); border-top-style: dashed; border-radius: 6px 6px 8px 8px; background: var(--surface); }

/* ---------------------------------------------------------------- synthèse */

.kind-molecule { --fam: #173F47; --fam-ink: #99E9F2; }
.kind-cristal { --fam: #2C2A52; --fam-ink: #D0BFFF; }
.molecule-card {
  .card-formula {
    position: absolute; left: 14px; right: 14px; bottom: 10px;
    font-family: var(--font-display); font-weight: 900; line-height: 1; white-space: nowrap; color: var(--fam-ink);
    font-size: min(calc(var(--card-w) * 0.45), calc(var(--card-w) * 1.6 / var(--chars)));
    sub { font-size: 0.5em; vertical-align: baseline; position: relative; top: 0.12em; }
  }
  .card-name { font-size: 24px; }
  .card-fact { margin-top: auto; padding: 0 14px 14px; font-size: 12px; line-height: 1.35; color: var(--text-soft); }
}
.recipes { --card-w: 220px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 40px 24px; margin-top: 12px; }
.recipe {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  /* Sur le support et pas sur la carte, pour ne pas écraser la transition de l'inclinaison */
  .tilt { transition: opacity 600ms ease, filter 600ms ease; }
  &:not(.is-owned) .tilt { opacity: 0.55; filter: saturate(0.4); }
  /* Juste synthétisée : la carte se matérialise dans un éclair de la couleur du type */
  &.just-synthesized .tilt { animation: synthesize-in 1600ms cubic-bezier(0.2, 0.8, 0.2, 1) 300ms both; }
  &.just-synthesized .card { animation: synthesize-glow 2200ms ease-out 300ms both; }
  .recipe-count { font-size: 13px; color: var(--text-muted); }
  .button { width: var(--card-w); }
}
@keyframes synthesize-in {
  from { opacity: 0; transform: scale(0.6); filter: blur(10px) brightness(2.5); }
  55% { opacity: 1; filter: blur(0) brightness(1.5); }
  to { transform: none; filter: none; }
}
@keyframes synthesize-glow {
  from { box-shadow: 0 0 0 0 var(--fam-ink); }
  40% { box-shadow: 0 0 48px 12px color-mix(in srgb, var(--fam-ink) 45%, transparent); }
  to { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .recipe.just-synthesized .tilt, .recipe.just-synthesized .card { animation: none; }
}
.ingredients {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: var(--card-w); margin: 0; padding: 0; list-style: none;
  li { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; }
  .ingredient-symbol { min-width: 28px; padding: 2px 6px; border-radius: 999px; background: var(--fam); color: var(--fam-ink); text-align: center; font-family: var(--font-display); font-size: 15px; }
  .is-missing { color: var(--text-faint); }
}

/* ---------------------------------------------------------------- accueil */

.home { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter) 96px; }
/* Le haut de page laisse toujours dépasser le début de la suite, pour inviter à défiler */
.home-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 48px;
  min-height: calc(100svh - 72px - 150px); padding: 32px 0;
}
.home-hero + .home-feature { padding-top: 40px; }
.home-copy { display: flex; flex-direction: column; gap: 20px; }
.home-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(48px, min(7vw, 11vh), 92px); line-height: 0.92; max-width: 12ch; }
.home-lead { font-size: 20px; color: var(--text-soft); max-width: 34ch; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.home-heading { font-family: var(--font-display); font-weight: 900; font-size: clamp(36px, 4.4vw, 56px); line-height: 0.95; max-width: 14ch; }
.home-copy p { font-size: 18px; color: var(--text-soft); max-width: 40ch; }

.home-feature {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: clamp(40px, 6vw, 96px);
  padding: 96px 0; border-top: 1px solid var(--line);
  &.is-reversed .home-visual { order: 2; }
}
.home-visual { display: flex; align-items: center; justify-content: center; min-height: 340px; }
.home-pack { padding-right: 210px; }

/* Booster : une pile de dos de carte, et la légendaire qui en sort */
.home-pack {
  zoom: 0.72;
  > * { flex-shrink: 0; box-shadow: 0 20px 40px rgb(0 0 0 / 0.35); }
  > * + * { margin-left: -248px; }
  > :nth-child(1) { rotate: -9deg; }
  > :nth-child(2) { rotate: -5deg; }
  > :nth-child(3) { rotate: -2deg; }
  > :nth-child(4) { rotate: 1deg; }
  > :nth-child(5) { rotate: 8deg; translate: 210px -12px; }
}

/* Synthèse : H + H + O = H2O */
.home-equation { gap: 24px; zoom: 0.56; }
.home-ingredients {
  display: flex;
  > * { flex-shrink: 0; box-shadow: 0 20px 40px rgb(0 0 0 / 0.35); }
  > * + * { margin-left: -130px; }
  > :nth-child(1) { rotate: -8deg; }
  > :nth-child(2) { translate: 0 -16px; }
  > :nth-child(3) { rotate: 8deg; }
}
.home-equals { font-family: var(--font-display); font-weight: 900; font-size: 120px; color: var(--text-muted); }
.home-equation > .tilt { flex-shrink: 0; box-shadow: 0 24px 48px rgb(0 0 0 / 0.4); }

span.tilt { cursor: inherit; }
/* La carte survolée passe devant ses voisines */
.home .tilt:hover { z-index: 1; }

/* Quiz : une question déjà répondue */
.home-quiz {
  flex-direction: column; align-items: stretch; gap: 16px; padding: 28px; border-radius: 22px; background: var(--surface);
  .home-quiz-question { font-size: 24px; font-weight: 600; }
  .home-quiz-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .choice { min-height: 56px; font-size: 17px; cursor: default; opacity: 0.45; }
  .choice.is-right { opacity: 1; }
  .explanation { background: var(--ground); }
}

.home-trust {
  display: flex; flex-direction: column; gap: 40px; padding: 96px 0; border-top: 1px solid var(--line);
  dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin: 0; }
  dt { font-family: var(--font-display); font-weight: 800; font-size: 28px; }
  dd { margin: 8px 0 0; color: var(--text-soft); }
}
.home-final {
  display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 96px 0 32px; border-top: 1px solid var(--line); text-align: center;
  .home-title { max-width: none; font-size: clamp(44px, 6vw, 72px); }
}

@media (width < 1000px) {
  .home-hero { grid-template-columns: 1fr; gap: 24px; min-height: 0; justify-items: center; text-align: center; }
  .home-hero .home-copy { align-items: center; }
  .home-hero .auth-fan { zoom: 0.5; max-width: none; margin-top: 0; }
  .home-feature { grid-template-columns: 1fr; padding: 64px 0; }
  .home-feature.is-reversed .home-visual { order: 0; }
  .home-pack { zoom: 0.5; }
  .home-equation { zoom: 0.4; }
  .home-trust dl { grid-template-columns: 1fr; }
}
/* Petit téléphone : sans l'éventail, la section suivante reste visible en bas de l'écran */
@media (width < 1000px) and (height < 800px) {
  .home-hero .auth-fan { display: none; }
}
@media (width >= 1000px) and (height < 820px) {
  .home-hero .auth-fan { zoom: 0.75; }
}
@media (width >= 1000px) and (height < 680px) {
  .home-hero .auth-fan { zoom: 0.6; }
}

/* ---------------------------------------------------------------- enchères */

.auctions { display: flex; flex-direction: column; gap: 24px; }
.auctions h2 { font-size: 18px; font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a {
  padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; text-decoration: none; color: var(--text-muted);
  &[aria-current="page"] { background: var(--surface-raised); color: var(--text); border-color: var(--line-strong); }
}
.lots { display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.lot {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto 72px; gap: 14px; align-items: center;
  padding: 10px 14px; border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none;
  &:hover { background: var(--surface-raised); }
  &.is-ended { opacity: .6; }
}
.lot-symbol {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px;
  background: var(--fam); color: var(--fam-ink); font-family: var(--font-display); font-weight: 900; font-size: 22px;
}
.lot-main { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.lot-tag { font-size: 13px; font-weight: 600; color: var(--text-soft); &.is-good { color: var(--good); } &.is-warn { color: var(--warn); } }
.lot-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.lot-time { font-size: 14px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.auction { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.auction-side { display: flex; flex-direction: column; gap: 16px; width: min(400px, 100%); }
.auction-price { font-size: 48px; }
.auction-time { font-weight: 600; }
.bid-form { display: flex; gap: 12px; align-items: flex-end; .field { flex: 1; } }
.bid-history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.bid-history li { display: flex; justify-content: space-between; color: var(--text-muted); &:first-child { color: var(--text); } }
.durations { border: 0; padding: 0; margin: 0; flex-direction: row; flex-wrap: wrap; gap: 8px 16px; legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; } label { font-weight: 400; } }

@media (max-width: 560px) {
  .lot { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .lot-symbol { width: 40px; height: 40px; }
  .lot-tag { grid-column: 2; }
  .lot-time { grid-column: 3; }
}

/* ---------------------------------------------------------------- vente rapide */

.quick-sale { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.sale-table { border-collapse: collapse; font-size: 14px; max-width: 760px; width: 100%; }
.sale-table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 8px; }
.sale-table td { padding: 8px; border-top: 1px solid var(--line); }
.sale-table td:first-child { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.sale-table .lot-symbol { width: 36px; height: 36px; font-size: 17px; }
.sale-table input { width: 72px; height: 38px; padding: 0 8px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.sale-summary { position: sticky; bottom: 0; display: flex; gap: 16px; align-items: center; padding: 14px 0; background: var(--ground); font-weight: 600; }
@media (max-width: 560px) { .sale-table th:nth-child(2), .sale-table td:nth-child(2) { display: none; } }
