/* Beyond the Stars — thème spatial sombre */

/* Police de lecture : Inter (licence OFL, fichiers dans /fonts) */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-italic.woff') format('woff');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-semibold.woff') format('woff');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #04061a;
  --bg-2: #0a0e2a;
  --panel: rgba(16, 21, 56, 0.62);
  --panel-border: rgba(160, 175, 255, 0.14);
  --text: #e9e7f3;
  --muted: #9aa1c7;
  --faint: #5d6491;
  --gold: #f4c86a;
  --gold-soft: rgba(244, 200, 106, 0.16);
  --violet: #b9a2ff;
  --cyan: #9fd8ff;
  --danger: #ff8a8a;
  --success: #8fe3b4;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  /* Les titres gardent une police à empattement pour l'ambiance ;
     tout le texte courant est sans empattement pour la lecture sur écran. */
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --reading: var(--sans);
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 60% at 75% 10%, rgba(120, 80, 220, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 50% at 10% 90%, rgba(40, 120, 200, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

a {
  color: var(--gold);
  text-underline-offset: 3px;
}
a:hover {
  color: #ffe0a0;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--gold);
  color: var(--bg);
  border-radius: 999px;
  z-index: 10;
}
.skip-link:focus {
  top: 1rem;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.brand-mark {
  width: 22px;
  height: 22px;
  fill: var(--gold);
  filter: drop-shadow(0 0 6px rgba(244, 200, 106, 0.7));
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.95rem;
}
.nav-link:hover,
.nav-link.is-current {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.banner {
  margin: 0 auto 0.5rem;
  max-width: 60rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(159, 216, 255, 0.25);
  background: rgba(159, 216, 255, 0.07);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- Mise en page ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 4rem;
}

.site-footer {
  text-align: center;
  color: var(--faint);
  font-size: 0.85rem;
  padding: 2rem 1rem;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0.2rem 0 0.6rem;
}
h2 {
  font-size: 1.5rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--violet);
}
.lead {
  font-family: var(--reading);
  font-size: 1.15rem;
  color: var(--muted);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}

.page-head {
  margin-bottom: 2rem;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--faint);
  margin-bottom: 1.5rem;
}
.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--text);
}

.section-title {
  margin-top: 3rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.notice {
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-size: 1.08rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--gold);
  color: #12142c;
  font: 600 0.98rem var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover {
  color: #12142c;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(244, 200, 106, 0.35);
}
.btn-large {
  padding: 0.95rem 2rem;
  font-size: 1.05rem;
}
.btn-small {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}
.btn-block {
  width: 100%;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: rgba(255, 138, 138, 0.45);
}
.btn-danger:hover {
  color: #fff;
  background: rgba(255, 138, 138, 0.18);
  box-shadow: none;
}
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--gold);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.inline-form {
  display: inline;
}

/* ---------- Messages ---------- */

.flash-stack {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1rem;
}
.flash {
  margin: 0.5rem 0;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(8px);
  text-align: center;
  animation: rise 0.5s ease both;
}
.flash-success {
  border-color: rgba(143, 227, 180, 0.4);
}
.flash-error {
  border-color: rgba(255, 138, 138, 0.5);
  color: #ffd0d0;
}
.flash-unlock {
  border-color: rgba(244, 200, 106, 0.55);
  background: linear-gradient(90deg, rgba(244, 200, 106, 0.08), rgba(185, 162, 255, 0.12));
  color: #ffe6b0;
}
.flash-unlock::before {
  content: '✦ ';
}
.flash-xp {
  border-color: rgba(159, 216, 255, 0.45);
  color: var(--cyan);
}
.flash-rank {
  border-color: rgba(185, 162, 255, 0.6);
  background: linear-gradient(90deg, rgba(185, 162, 255, 0.16), rgba(244, 200, 106, 0.12));
  color: #efe6ff;
  font-weight: 600;
}
.flash-rank::before {
  content: '★ ';
  color: var(--gold);
}

.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 20;
  max-width: min(24rem, calc(100vw - 2rem));
}
.toast {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  background: rgba(14, 18, 48, 0.94);
  border: 1px solid rgba(244, 200, 106, 0.5);
  box-shadow: var(--shadow);
  animation: rise 0.4s ease both;
}
.toast strong {
  display: block;
  color: var(--gold);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.1rem;
}
.toast p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.4s ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.hero {
  text-align: center;
  padding: clamp(3rem, 12vh, 8rem) 0 2rem;
  max-width: 42rem;
  margin: 0 auto;
}
.hero-title {
  font-size: clamp(3rem, 10vw, 6rem);
  margin: 0.5rem 0;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #fff 30%, #c8bfff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 60px rgba(185, 162, 255, 0.25);
}
.hero-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--gold);
  margin: 0 0 2rem;
}
.hero-intro {
  text-align: left;
  margin: 0 auto 2.5rem;
}
.hero-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Formulaires ---------- */

.auth-card,
.panel {
  max-width: 28rem;
  margin: 2rem auto;
  padding: 2rem;
  border-radius: calc(var(--radius) + 6px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-size: 2rem;
  margin-top: 0;
}
.panel {
  max-width: 36rem;
  margin: 1.5rem 0;
}
.panel h2 {
  margin-top: 0;
}
.panel-danger {
  border-color: rgba(255, 138, 138, 0.25);
}
.panel-danger form + form {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--panel-border);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field label {
  font-size: 0.9rem;
  color: var(--muted);
}
input[type='text'],
input[type='email'],
input[type='password'],
input:not([type]) {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(160, 175, 255, 0.22);
  background: rgba(4, 6, 26, 0.6);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(159, 216, 255, 0.15);
}
.has-error input,
input[aria-invalid='true'] {
  border-color: var(--danger);
}
.hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--faint);
}
.error {
  margin: 0;
  font-size: 0.88rem;
  color: var(--danger);
}
.form-alt {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

/* ---------- Carte stellaire ---------- */

.map-section .page-head {
  text-align: center;
  margin-bottom: 1rem;
}
.stats {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.95rem;
}

.star-map {
  position: relative;
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  background:
    radial-gradient(circle at 50% 50%, rgba(80, 70, 180, 0.12), transparent 70%),
    rgba(6, 9, 30, 0.5);
  overflow: hidden;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.6), var(--shadow);
}
.star-map svg {
  display: block;
  width: 100%;
  height: auto;
}

.route {
  stroke: rgba(160, 175, 255, 0.25);
  stroke-width: 1.5;
  stroke-dasharray: 3 7;
}
.route.is-lit {
  stroke: rgba(244, 200, 106, 0.55);
  stroke-dasharray: none;
}

.node {
  cursor: default;
}
a.node {
  cursor: pointer;
}
.node .halo {
  fill: url(#halo);
  opacity: 0.5;
  transition: opacity 0.3s ease;
}
.node .core {
  filter: drop-shadow(0 0 8px currentColor);
  transition: transform 0.25s ease;
}
.node .progress-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 2;
}
.node .progress-ring {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.5;
  stroke-linecap: round;
}
.node .label {
  fill: var(--text);
  font: 400 22px var(--serif);
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(4, 6, 26, 0.85);
  stroke-width: 5px;
}
.node .sub {
  fill: var(--muted);
  font: 500 14px var(--sans);
  text-anchor: middle;
  letter-spacing: 0.04em;
  paint-order: stroke;
  stroke: rgba(4, 6, 26, 0.85);
  stroke-width: 4px;
}
.node .glyph {
  fill: #12142c;
  font: 700 16px var(--sans);
  text-anchor: middle;
}
a.node:hover .halo,
a.node:focus .halo {
  opacity: 1;
}
a.node:hover .core,
a.node:focus .core {
  transform: scale(1.25);
}
a.node:focus {
  outline: none;
}
a.node:focus-visible .label {
  fill: var(--cyan);
}
.node-verrouille {
  opacity: 0.4;
}
.node-verrouille .core {
  fill: #6b7199;
}
.node-bientot .core {
  opacity: 0.55;
}
.node-enigme .core {
  fill: var(--violet);
  animation: pulse 2.4s ease-in-out infinite;
}
.node.is-complete .progress-ring {
  stroke: var(--success);
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

.map-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
  font-size: 0.92rem;
}
.map-list .is-locked {
  color: var(--faint);
}

/* ---------- Lieu ---------- */

.chapter-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.chapter-item {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
}
.chapter-num {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--faint);
  min-width: 2.2rem;
}
.chapter-info {
  flex: 1;
  min-width: 0;
}
.chapter-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}
a.chapter-title:hover {
  color: var(--gold);
}
a.chapter-title::after {
  content: '';
  position: absolute;
  inset: 0;
}
.chapter-item {
  position: relative;
}
.chapter-resume {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.status-verrouille {
  opacity: 0.55;
}
.status-verrouille .chapter-title {
  letter-spacing: 0.3em;
}
.is-read .chapter-num {
  color: var(--success);
}

.badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--muted);
}
.badge-new {
  color: var(--gold);
  border-color: rgba(244, 200, 106, 0.5);
}
.badge-done {
  color: var(--success);
  border-color: rgba(143, 227, 180, 0.4);
}
.badge-riddle {
  color: var(--violet);
  border-color: rgba(185, 162, 255, 0.5);
}

/* ---------- Lecture ---------- */

.chapter-page,
.lieu-page {
  max-width: 42rem;
  margin: 0 auto;
}
.chapter-page .page-head {
  text-align: center;
  margin: 2rem 0 3rem;
}

.prose {
  font-family: var(--reading);
  font-size: 1.125rem;
  line-height: 1.75;
  color: #dcd9eb;
  font-feature-settings: 'ss01', 'calt';
}
.prose p {
  margin: 0 0 1.3em;
}
/* Texte justifié, avec césure française pour éviter les grands blancs entre les mots
   (surtout sur mobile, où les lignes sont courtes). */
.prose p,
.prose li {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 7 3 3;
  -webkit-hyphenate-limit-before: 3;
  -webkit-hyphenate-limit-after: 3;
}
.chapter-text > p:first-child::first-letter {
  float: left;
  font-family: var(--serif);
  font-size: 3.6em;
  line-height: 0.85;
  padding: 0.08em 0.12em 0 0;
  color: var(--gold);
}
.prose blockquote {
  margin: 1.6em 0;
  padding: 0.4em 0 0.4em 1.3em;
  border-left: 2px solid var(--cyan);
  color: var(--cyan);
}
.prose blockquote p {
  margin: 0.2em 0;
}
.prose em {
  color: #f0e9ff;
}
.prose hr {
  border: 0;
  text-align: center;
  margin: 2.5em 0;
}
.prose hr::after {
  content: '✦   ✦   ✦';
  color: var(--faint);
  white-space: pre;
}
.prose img {
  max-width: 100%;
  border-radius: var(--radius);
}

/* Indices cachés dans le texte */
.clue {
  cursor: pointer;
  color: inherit;
  background-image: linear-gradient(90deg, transparent, rgba(244, 200, 106, 0.35), transparent);
  background-size: 200% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  animation: shimmer 4s linear infinite;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}
.clue:hover,
.clue:focus-visible {
  color: #fff3d6;
  text-shadow: 0 0 12px rgba(244, 200, 106, 0.6);
}
.clue:focus-visible {
  outline: 1px dashed var(--gold);
  outline-offset: 2px;
}
.clue.is-found {
  color: var(--gold);
  animation: none;
  background-image: none;
}
.clue.is-found::after {
  content: ' ✦';
  font-size: 0.7em;
  vertical-align: super;
}
.clue.is-catching {
  animation: catch 0.7s ease;
}

@keyframes shimmer {
  from {
    background-position: 200% 100%;
  }
  to {
    background-position: -200% 100%;
  }
}
@keyframes catch {
  40% {
    text-shadow: 0 0 24px #fff, 0 0 40px var(--gold);
    color: #fff;
  }
}

.chapter-end {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--panel-border);
  text-align: center;
}
.clue-count {
  color: var(--muted);
  font-size: 0.92rem;
}
.done-mark {
  color: var(--success);
  font-family: var(--serif);
  font-size: 1.2rem;
}
.done-mark::before {
  content: '✓ ';
}
.chapter-nav {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Énigmes ---------- */

.riddle {
  text-align: center;
  padding: 2.5rem 2rem;
  border-radius: 24px;
  border: 1px solid rgba(185, 162, 255, 0.35);
  background: radial-gradient(circle at 50% 0%, rgba(185, 162, 255, 0.16), transparent 70%), var(--panel);
  box-shadow: var(--shadow);
}
.riddle-question {
  font-size: 1.3rem;
  line-height: 1.5;
  margin: 1rem auto 1.5rem;
  max-width: 32rem;
}
.riddle-form {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 26rem;
  margin: 0 auto;
}
.riddle-form input {
  flex: 1;
  min-width: 12rem;
  text-align: center;
}
.riddle-form .error {
  width: 100%;
}
.riddle-help {
  color: var(--muted);
  margin-bottom: 1.2rem;
}
.riddle-help summary {
  cursor: pointer;
  font-size: 0.9rem;
}

/* ---------- Journal ---------- */

.clue-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}
.clue-card {
  padding: 1.2rem 1.3rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid rgba(244, 200, 106, 0.25);
}
.clue-card h3 {
  margin: 0 0 0.5rem;
  color: var(--gold);
  font-size: 1.2rem;
}
.clue-card p {
  margin: 0.3rem 0;
}
.read-list {
  padding-left: 1.2rem;
}
.read-list li {
  margin: 0.3rem 0;
}

/* ---------- Fenêtre « indice trouvé » ---------- */

.clue-dialog {
  width: min(26rem, calc(100vw - 2rem));
  padding: 2.2rem 2rem 1.8rem;
  border: 1px solid rgba(244, 200, 106, 0.45);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(244, 200, 106, 0.18), transparent 65%),
    #0c1032;
  color: var(--text);
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 60px rgba(244, 200, 106, 0.12);
}
.clue-dialog[open] {
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.clue-dialog::backdrop {
  background: rgba(2, 3, 14, 0.7);
  backdrop-filter: blur(4px);
}
.clue-dialog-star {
  font-size: 2.6rem;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(244, 200, 106, 0.8);
}
.clue-dialog.is-new .clue-dialog-star {
  animation: spin-in 0.9s ease both;
}
.clue-dialog-kicker {
  margin-top: 0.8rem;
}
.clue-dialog-title {
  margin: 0.4rem 0 0.8rem;
  font-size: 1.7rem;
  color: #fff3d6;
}
.clue-dialog-desc {
  margin: 0 0 1rem;
  color: #d6d3e8;
  line-height: 1.6;
}
.clue-dialog-xp {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  background: rgba(159, 216, 255, 0.12);
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.9rem;
}
.clue-dialog-unlocks {
  list-style: none;
  padding: 0.8rem 1rem;
  margin: 0 0 1.2rem;
  border-radius: var(--radius);
  background: rgba(244, 200, 106, 0.07);
  color: #ffe6b0;
  font-size: 0.95rem;
}
.clue-dialog-unlocks li::before {
  content: '✦ ';
}
.clue-dialog-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
}
@keyframes spin-in {
  from {
    transform: rotate(-180deg) scale(0.2);
    opacity: 0;
  }
}

/* ---------- Expérience ---------- */

.xp {
  margin: 0.5rem 0 1.5rem;
}
.xp-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.xp-level {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--violet);
  color: #12142c;
  font-weight: 600;
  font-size: 0.8rem;
}
.xp-rank {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: #fff;
}
.xp-points {
  margin-left: auto;
  color: var(--cyan);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.xp-bar,
.stat-bar {
  appearance: none;
  display: block;
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}
.xp-bar::-webkit-progress-bar,
.stat-bar::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}
.xp-bar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--violet), var(--cyan), var(--gold));
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(159, 216, 255, 0.6);
}
.xp-bar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--violet), var(--cyan), var(--gold));
  border-radius: 999px;
}
.stat-bar {
  height: 6px;
}
.stat-bar::-webkit-progress-value {
  background: var(--gold);
  border-radius: 999px;
}
.stat-bar::-moz-progress-bar {
  background: var(--gold);
  border-radius: 999px;
}
.xp-next {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.xp-link {
  display: block;
  max-width: 26rem;
  margin: 1rem auto 0;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  text-decoration: none;
  color: inherit;
  text-align: left;
  transition: border-color 0.2s ease;
}
.xp-link:hover {
  color: inherit;
  border-color: rgba(185, 162, 255, 0.45);
}
.xp-compact {
  margin: 0;
}
.xp-compact .xp-rank {
  font-size: 1.05rem;
}
.xp-compact .xp-bar {
  height: 8px;
}
.xp-compact .xp-next {
  font-size: 0.8rem;
}

.panel-xp {
  border-color: rgba(185, 162, 255, 0.3);
}
.exploration-total {
  margin: 1.5rem 0 0.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--panel-border);
}
.exploration-total strong {
  font-size: 1.5rem;
  color: var(--gold);
}
.stat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.9rem;
}
.stat-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}
.stat-list .hint {
  margin-top: 0.25rem;
}

/* ---------- Illustrations ---------- */

.cover {
  margin: 0 0 2rem;
}
.cover img {
  display: block;
  width: 100%;
  max-height: 26rem;
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}
.cover-chapter {
  margin: -1rem 0 2.5rem;
}
.cover figcaption {
  margin-top: 0.6rem;
  text-align: center;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
}
.chapter-thumb {
  width: 3.4rem;
  height: 3.4rem;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
}

/* ---------- Pied de page et pages légales ---------- */

.footer-links {
  display: flex;
  gap: 0.4rem 1.2rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}
.footer-links a {
  color: var(--faint);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--muted);
  text-decoration: underline;
}
.legal-page {
  max-width: 46rem;
  margin: 0 auto;
}
.legal-prose {
  font-size: 1rem;
  line-height: 1.7;
}
.legal-prose h2 {
  margin-top: 2.2rem;
  font-size: 1.4rem;
  scroll-margin-top: 1rem;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.92rem;
}
.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--panel-border);
}
.prose th {
  color: var(--muted);
  font-weight: 600;
}
.prose code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
}
.legal-missing {
  background: rgba(255, 138, 138, 0.2);
  color: #ffd0d0;
  padding: 0 0.3em;
  border-radius: 4px;
}
.check-terms {
  align-items: flex-start;
  font-size: 0.9rem;
  line-height: 1.5;
}
.check-terms input {
  margin-top: 0.25rem;
  flex-shrink: 0;
}

/* ---------- Histoires interactives ---------- */

.choice {
  display: inline-block;
  margin: 0.15rem 0;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(185, 162, 255, 0.5);
  border-radius: 12px;
  background: rgba(185, 162, 255, 0.1);
  color: #efe9ff;
  font: 500 1rem var(--sans);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.choice::before {
  content: '→ ';
  color: var(--violet);
}
.choice:hover,
.choice:focus-visible {
  background: rgba(185, 162, 255, 0.22);
  border-color: var(--violet);
  transform: translateX(3px);
}
.prose p:has(> .choice:only-child) {
  margin: 0 0 0.7rem;
}
.prose p > .choice:only-child {
  display: block;
  width: 100%;
}
.story {
  scroll-margin-top: 1rem;
}
.choice-hint {
  text-align: center;
  margin-top: 1rem;
}
.ending {
  margin: 2rem 0 0;
  padding: 1.4rem;
  border-radius: var(--radius);
  text-align: center;
}
.ending-title {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: 1.4rem;
}
.ending-good {
  border: 1px solid rgba(143, 227, 180, 0.4);
  background: rgba(143, 227, 180, 0.07);
}
.ending-good .ending-title {
  margin: 0;
  color: var(--success);
}
.ending-bad {
  border: 1px solid rgba(255, 138, 138, 0.4);
  background: rgba(255, 138, 138, 0.07);
}
.ending-bad .ending-title {
  color: #ffc4c4;
}
.replay {
  margin-top: 1.8rem;
  padding-top: 1.4rem;
  border-top: 1px dashed var(--panel-border);
}
.path {
  margin-top: 1rem;
  text-align: left;
  color: var(--muted);
}
.path summary {
  cursor: pointer;
  text-align: center;
}
.path ol {
  margin: 0.8rem auto 0;
  max-width: 24rem;
}

/* ---------- Audio ---------- */

.audio-player {
  margin: 0 0 2rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(159, 216, 255, 0.3);
  background: rgba(159, 216, 255, 0.06);
}
.audio-player .eyebrow {
  margin-bottom: 0.6rem;
  color: var(--cyan);
}
.audio-player audio {
  display: block;
  width: 100%;
}
.finish-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- Tableau de bord ---------- */

.page-admin main {
  max-width: 72rem;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}
.kpi {
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
}
.kpi-value {
  margin: 0;
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 1.1;
  color: #fff;
}
.kpi-label {
  margin: 0.2rem 0 0;
  color: var(--muted);
}
.kpi-sub {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--faint);
}
.panel-wide {
  max-width: none;
}
.panel-wide h3 {
  margin: 1.2rem 0 0.3rem;
  font-size: 1.15rem;
}
.table-wrap {
  overflow-x: auto;
}
.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.data th,
.data td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--panel-border);
  text-align: left;
  white-space: nowrap;
}
.data td:first-child {
  white-space: normal;
}
.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.data .stat-bar {
  display: inline-block;
  width: 7rem;
  vertical-align: middle;
}
.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
.tag {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(185, 162, 255, 0.4);
  color: var(--violet);
  font-size: 0.72rem;
  vertical-align: middle;
}
.tag-bad {
  border-color: rgba(255, 138, 138, 0.4);
  color: var(--danger);
}
.bars {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.6rem;
}
.bars li {
  display: grid;
  grid-template-columns: minmax(10rem, 1.2fr) 2fr 3rem;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.92rem;
}
.chart {
  display: block;
  width: 100%;
  height: auto;
}
.chart .bar {
  fill: var(--violet);
}
.chart .bar-empty {
  fill: rgba(255, 255, 255, 0.08);
}
.chart-label {
  fill: var(--faint);
  font: 12px var(--sans);
}
.riddle-stat {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--panel-border);
}
.riddle-stat:last-child {
  border-bottom: 0;
}
.riddle-stat h3 {
  margin-top: 0;
}
.riddle-stat p {
  margin: 0.3rem 0;
}
.warn {
  color: var(--danger);
}

/* ---------- Carte galactique ---------- */

.page-galaxy main {
  max-width: 96rem;
  padding-top: 0.5rem;
}
.galaxy-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.galaxy-head h1 {
  margin-bottom: 0.2rem;
}
.galaxy-head .stats {
  justify-content: flex-start;
  margin: 0;
}
.galaxy-head .xp-link {
  margin: 0;
  min-width: 18rem;
}
.galaxy-wrap {
  display: grid;
  grid-template-columns: 1fr 19rem;
  gap: 1rem;
}
.galaxy-map {
  --g-stroke: 2px;
  position: relative;
  height: max(30rem, calc(100vh - 15rem));
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  background: #070a14;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#galaxie-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#galaxie-svg.is-dragging {
  cursor: grabbing;
}
#galaxie-svg.is-pointing {
  cursor: pointer;
}
.galaxy-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted);
}
.g-lbl-fac {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.12em;
  fill: #e6eaf2;
  paint-order: stroke;
  stroke: #070a14;
  stroke-width: var(--g-stroke);
  stroke-linejoin: round;
  pointer-events: none;
}
.g-lbl-sec {
  font-family: var(--sans);
  fill: #9aa3b5;
  paint-order: stroke;
  stroke: #070a14;
  stroke-width: var(--g-stroke);
  pointer-events: none;
}
.g-danger {
  fill: #f08a6f;
}
.is-dim {
  opacity: 0.12;
}
.is-hidden,
.no-labels text {
  display: none;
}
.g-dest-halo {
  fill: rgba(244, 200, 106, 0.18);
}
.g-dest-ring {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}
.g-dest-core {
  fill: var(--gold);
  filter: url(#lueur);
}
.g-dest-lbl {
  font-family: var(--sans);
  font-weight: 600;
  fill: #ffe6b0;
  paint-order: stroke;
  stroke: #070a14;
  stroke-width: var(--g-stroke);
  stroke-linejoin: round;
}
.g-dest-a-lire .g-dest-halo {
  animation: g-pulse 2.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.g-dest-partiel .g-dest-ring,
.g-dest-partiel .g-dest-core {
  stroke: var(--violet);
  fill: var(--violet);
}
.g-dest-partiel .g-dest-ring {
  fill: none;
}
.g-dest-partiel .g-dest-halo {
  fill: rgba(185, 162, 255, 0.18);
}
.g-dest-verrouille {
  opacity: 0.55;
}
.g-dest-verrouille .g-dest-ring {
  stroke: #9aa1c7;
  stroke-dasharray: 2 2;
}
.g-dest-verrouille .g-dest-core,
.g-dest-verrouille .g-dest-halo {
  fill: #6b7199;
}
.g-dest-verrouille .g-dest-lbl {
  fill: #9aa1c7;
}
.g-dest-lu .g-dest-ring {
  stroke: var(--success);
}
.g-dest-lu .g-dest-core {
  fill: var(--success);
}
.g-dest-lu .g-dest-halo {
  fill: rgba(143, 227, 180, 0.12);
}
.g-dest-lu .g-dest-lbl {
  fill: #cfeedd;
  font-weight: 500;
}
.g-dest-badge circle {
  fill: var(--gold);
  stroke: #070a14;
  stroke-width: 0.8;
}
.g-dest-badge text {
  fill: #12142c;
  font-family: var(--sans);
  font-weight: 700;
}
.g-dest-lu .g-dest-badge circle {
  fill: var(--success);
}
.g-card-sysname {
  color: var(--gold);
}
.g-card-open {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: 600;
}
@keyframes g-pulse {
  50% {
    transform: scale(1.5);
    opacity: 0.4;
  }
}
.galaxy-zoom {
  position: absolute;
  right: 0.8rem;
  top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.galaxy-zoom .btn {
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  font-size: 1.2rem;
  background: rgba(10, 14, 28, 0.85);
}
.galaxy-info,
.galaxy-fiche {
  position: absolute;
  min-width: 13rem;
  max-width: 18rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(10, 14, 28, 0.94);
  font-size: 0.85rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
.galaxy-info {
  pointer-events: none;
}
.galaxy-info p,
.galaxy-fiche p {
  margin: 0.15rem 0;
}
.galaxy-fiche {
  left: 0.8rem;
  bottom: 0.8rem;
  padding-right: 2rem;
}
.galaxy-fiche-x {
  position: absolute;
  right: 0.4rem;
  top: 0.2rem;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
}
.g-card-title strong {
  font-size: 0.95rem;
}
.g-card-dest {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0 0;
  list-style: none;
  border-top: 1px solid var(--panel-border);
}
.fac-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  vertical-align: baseline;
  flex-shrink: 0;
}
.galaxy-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: max(30rem, calc(100vh - 15rem));
  overflow-y: auto;
}
.galaxy-panel details {
  padding: 0.8rem 1rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
}
.galaxy-panel summary {
  cursor: pointer;
  list-style: none;
}
.galaxy-panel summary::-webkit-details-marker {
  display: none;
}
.galaxy-panel summary h2 {
  display: inline;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.galaxy-panel summary::after {
  content: '▾';
  float: right;
  color: var(--faint);
}
.galaxy-panel details:not([open]) summary::after {
  content: '▸';
}
.dest-list {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  display: grid;
  gap: 0.4rem;
}
.dest {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(244, 200, 106, 0.3);
  background: rgba(244, 200, 106, 0.06);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.dest:hover {
  border-color: var(--gold);
}
.dest-nom {
  font-weight: 600;
}
.dest-sub {
  font-size: 0.8rem;
  color: var(--muted);
}
.fac-list {
  display: grid;
  gap: 0.1rem;
}
.fac {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}
.fac:hover {
  background: rgba(255, 255, 255, 0.04);
}
.fac.is-active {
  border-color: var(--panel-border);
  background: rgba(255, 255, 255, 0.07);
}
.layers {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.layers label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  cursor: pointer;
}

@media (max-width: 900px) {
  .galaxy-wrap {
    grid-template-columns: 1fr;
  }
  .galaxy-map {
    height: 65vh;
  }
  .galaxy-panel {
    max-height: none;
  }
  .galaxy-head .xp-link {
    min-width: 0;
    width: 100%;
  }
}

/* ---------- Ce qui reste à lire ---------- */

.continue-btn {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  margin-top: 1rem;
  border-radius: 14px;
  text-align: left;
}
.continue-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.7;
}
.continue-title {
  font-size: 1rem;
}
.continue-sub {
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0.75;
}
.count-badge {
  margin-left: 0.4rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: var(--gold);
  color: #12142c;
  font-size: 0.72rem;
  font-weight: 700;
}
.only-unread {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.dest-item {
  position: relative;
}
.dest-list.only-unread-on .dest-item:not(.dest-a-lire) {
  display: none;
}
.dest {
  gap: 0.25rem;
  padding-right: 2.2rem;
}
.dest-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.dest .stat-bar {
  height: 4px;
  margin-top: 0.2rem;
}
.dest-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--gold);
  color: #12142c;
  font-size: 0.75rem;
  font-weight: 700;
}
.dest-check {
  color: var(--success);
  font-weight: 700;
}
.dest-a-lire .dest {
  border-color: rgba(244, 200, 106, 0.6);
  background: rgba(244, 200, 106, 0.1);
  box-shadow: 0 0 18px rgba(244, 200, 106, 0.12);
}
.dest-lu .dest {
  border-color: rgba(143, 227, 180, 0.25);
  background: rgba(143, 227, 180, 0.04);
}
.dest-lu .dest-nom {
  color: var(--muted);
  font-weight: 500;
}
.dest-autre .dest {
  border-color: rgba(185, 162, 255, 0.3);
  background: rgba(185, 162, 255, 0.05);
}
.dest-open {
  position: absolute;
  right: 0.6rem;
  top: 0.55rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 1.1rem;
}
.dest-open:hover {
  color: var(--gold);
}

/* ---------- Vue d'un système ---------- */

.page-system main {
  max-width: 80rem;
}
.system-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.system-head h1 {
  margin-bottom: 0.2rem;
}
.system-lead {
  margin: 0.2rem 0;
  font-size: 1rem;
}
.system-map svg {
  display: block;
  width: 100%;
  height: auto;
}
.sys-orbits circle {
  fill: none;
  stroke: rgba(180, 195, 240, 0.14);
  stroke-width: 1;
  stroke-dasharray: 2 6;
}
.sys-star-core {
  filter: drop-shadow(0 0 16px rgba(255, 210, 122, 0.9));
}
.sys-star-label {
  fill: #ffe3a6;
  font: 500 14px var(--sans);
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(4, 6, 26, 0.85);
  stroke-width: 4px;
}
.node-badge circle {
  fill: var(--gold);
  stroke: #070a1e;
  stroke-width: 2;
}
.node-badge text {
  fill: #12142c;
  font: 700 12px var(--sans);
}
.node-badge-done circle {
  fill: var(--success);
}
.etat-a-lire .halo {
  animation: g-pulse 2.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.body-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.8rem;
}
.body-item {
  display: flex;
  gap: 0.8rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
}
.body-item.etat-a-lire {
  border-color: rgba(244, 200, 106, 0.55);
}
.body-item.etat-lu {
  border-color: rgba(143, 227, 180, 0.3);
}
.body-dot {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.body-name {
  margin: 0 0 0.3rem;
  font-family: var(--serif);
  font-size: 1.2rem;
}
.body-lieux {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.3rem;
}
.body-lieux .dest-badge {
  margin-left: 0.35rem;
  min-width: 1.2rem;
  height: 1.2rem;
  font-size: 0.7rem;
}

/* ---------- Petits écrans ---------- */

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    gap: 0.6rem;
  }
  .prose {
    font-size: 1.06rem;
  }
  .auth-card,
  .panel {
    padding: 1.4rem;
  }
  .node .label {
    font-size: 36px;
    transform: translateY(14px);
  }
  .node .sub {
    display: none; /* détail repris dans la liste sous la carte */
  }
  .bars li {
    grid-template-columns: 1fr 3rem;
  }
  .bars li progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Profil, atlas et badges ---------- */

.profile,
.atlas {
  max-width: 60rem;
  margin: 0 auto;
}
.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.profile-head h1 {
  margin: 0.2rem 0;
}
.profile-stats {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.8rem;
}
.profile-stats li {
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}
.profile-stats strong {
  display: block;
  font-size: 1.8rem;
  color: var(--gold);
}
.profile-stats span {
  color: var(--muted);
  font-size: 0.9rem;
}
.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.panel-title-row a {
  color: var(--cyan);
  font-size: 0.9rem;
}
.badge-row {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}
.badge-tile {
  width: 9rem;
  text-align: center;
}
.badge-tile p {
  margin: 0.2rem 0;
}
.badge-name {
  font-weight: 600;
}
.badge-img {
  display: block;
  width: 100%;
  max-width: 8rem;
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto 0.5rem;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}
.badge-img-vide {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.badge-img.is-grey {
  filter: grayscale(1) brightness(0.75);
  opacity: 0.55;
}
.badge-img.is-silhouette {
  filter: brightness(0) drop-shadow(0 0 1px rgba(160, 175, 255, 0.5));
  opacity: 0.6;
}
.next-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0.6rem 0 0;
}
.next-badge .stat-bar {
  flex: 1 1 8rem;
  max-width: 14rem;
}
.atlas-cta {
  display: grid;
  gap: 0.3rem;
  margin-top: 1.2rem;
  padding: 1.3rem 1.5rem;
  border: 1px solid rgba(244, 200, 106, 0.35);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(244, 200, 106, 0.1), rgba(185, 162, 255, 0.08));
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}
.atlas-cta:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}
.atlas-cta strong {
  font-size: 1.15rem;
}
.atlas-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.atlas-nav a {
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.atlas-nav a:hover {
  color: var(--text);
  border-color: var(--violet);
}
.atlas-section {
  margin: 2.5rem 0;
  scroll-margin-top: 5rem;
}
.atlas-sub {
  margin: 1.4rem 0 0.6rem;
  color: var(--violet);
  font-size: 1.05rem;
}
.badge-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 1rem;
}
.badge-card {
  padding: 1.2rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}
.badge-card h3 {
  margin: 0.3rem 0;
  font-size: 1.05rem;
}
.badge-card p {
  margin: 0.3rem 0;
  font-size: 0.9rem;
}
.badge-card.is-earned {
  border-color: rgba(244, 200, 106, 0.4);
}
.badge-card.is-mystery h3 {
  color: var(--faint);
  letter-spacing: 0.2em;
}
.badge-card .stat-bar {
  width: 100%;
}
.story-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.story-list li {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--panel-border);
}
.story-code {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--faint);
}
.story-list .is-done .story-code {
  color: var(--gold);
}
.story-title {
  flex: 1;
}
.character-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.8rem;
}
.character-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
}
.character-card h4 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}
.character-card p {
  margin: 0.3rem 0;
  font-size: 0.92rem;
  line-height: 1.5;
}
.character-faction {
  color: var(--muted);
}

/* Fenêtre « nouveau badge » (reprend le style des indices) */
.badge-dialog {
  width: min(24rem, calc(100vw - 2rem));
  padding: 2rem 2rem 1.6rem;
  border: 1px solid rgba(244, 200, 106, 0.45);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 30%, rgba(244, 200, 106, 0.2), transparent 65%),
    #0c1032;
  color: var(--text);
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6), 0 0 60px rgba(244, 200, 106, 0.12);
}
.badge-dialog[open] {
  animation: pop 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.badge-dialog::backdrop {
  background: rgba(2, 3, 14, 0.7);
  backdrop-filter: blur(4px);
}
.badge-dialog-img {
  width: 11rem;
  height: auto;
  margin: 0.5rem auto;
  display: block;
  filter: drop-shadow(0 0 30px rgba(244, 200, 106, 0.35));
  animation: spin-in 0.9s ease both;
}
.badge-dialog h2 {
  margin: 0.4rem 0;
  color: #fff3d6;
}

@media (max-width: 600px) {
  .profile-head {
    flex-direction: column;
  }
  .badge-tile {
    width: 7rem;
  }
}
.ident {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.2rem;
  margin: 0;
}
.ident dt {
  color: var(--muted);
}
.ident dd {
  margin: 0;
}

/* La lettrine ne déborde pas sur le paragraphe suivant quand la première phrase est courte. */
.chapter-text > p:first-child::after {
  content: '';
  display: block;
  clear: both;
}

/* Panneau « Destinations » : suite de l'histoire / histoires annexes */
.dest-group {
  margin: 1rem 0 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet);
}
.dest-group + .hint {
  margin: 0.2rem 0 0;
}
