/* Livre des missions — D.Majin */

.lm-page {
  --lm-cyan: #00f5d4;
  --lm-gold: #fee440;
  --lm-parchment: #1a1814;
  --lm-parchment-light: #252018;
  --lm-ink: #f5f0e6;
  --lm-muted: #9ca3af;
  background-color: #060608;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -5%, rgba(0, 245, 212, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 40% at 100% 80%, rgba(254, 228, 64, 0.06), transparent 50%),
    linear-gradient(180deg, #0c1018 0%, #060608 40%, #030304 100%);
  min-height: 100vh;
}

.lm-main {
  position: relative;
  z-index: 1;
  padding-bottom: var(--space-2xl);
  font-family: var(--font-body);
  overflow-x: clip;
  overflow-y: visible;
}

/* --- Ambiance --- */
.lm-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.lm-ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  animation: lm-glow-drift 14s ease-in-out infinite;
}

.lm-ambient-glow--cyan {
  width: 50vmax;
  height: 50vmax;
  left: -10%;
  top: 10%;
  background: rgba(0, 245, 212, 0.14);
}

.lm-ambient-glow--gold {
  width: 40vmax;
  height: 40vmax;
  right: -5%;
  bottom: 5%;
  background: rgba(254, 228, 64, 0.08);
  animation-delay: -5s;
}

@keyframes lm-glow-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(3%, -2%) scale(1.05); }
}

.lm-ambient-dust {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  animation: lm-dust-float 20s linear infinite;
}

@keyframes lm-dust-float {
  from { background-position: 0 0; }
  to { background-position: 48px 96px; }
}

.lm-ambient-runes span {
  position: absolute;
  font-size: 0.65rem;
  color: rgba(0, 245, 212, 0.15);
  letter-spacing: 0.2em;
  animation: lm-rune-pulse 4s ease-in-out infinite;
}

.lm-ambient-runes span:nth-child(1) { left: 8%; top: 18%; }
.lm-ambient-runes span:nth-child(2) { right: 12%; top: 22%; animation-delay: 0.6s; }
.lm-ambient-runes span:nth-child(3) { left: 15%; bottom: 30%; animation-delay: 1.2s; }
.lm-ambient-runes span:nth-child(4) { right: 20%; bottom: 25%; animation-delay: 1.8s; }
.lm-ambient-runes span:nth-child(5) { left: 45%; top: 8%; animation-delay: 0.3s; }
.lm-ambient-runes span:nth-child(6) { right: 40%; bottom: 12%; animation-delay: 2.4s; }

.lm-ambient-runes span::before { content: '✦'; }

@keyframes lm-rune-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.9); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

/* --- Hero --- */
.lm-hero {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto var(--space-lg);
  padding: 0 max(var(--space-md), 1rem) 0.25rem;
  overflow: visible;
}

.lm-hero-kicker {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--lm-cyan);
  margin: 0 0 0.35rem;
  text-shadow: 0 0 16px rgba(0, 245, 212, 0.4);
}

.lm-hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.06em;
  margin: 0 0 0.5rem;
  padding-top: 0.05em;
  color: #fff;
  text-shadow: 0 0 30px rgba(0, 245, 212, 0.2);
}

.lm-hero-lead {
  font-family: var(--font-body);
  color: var(--gris, var(--lm-muted));
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 auto 1.1rem;
  max-width: 34rem;
  padding: 0 0.25rem;
  overflow-wrap: break-word;
}

.lm-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.lm-stat-pill {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.lm-stat-pill--gold {
  border-color: rgba(254, 228, 64, 0.35);
}

.lm-stat-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lm-muted);
}

.lm-stat-pill strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--lm-cyan);
  letter-spacing: 0.04em;
}

.lm-stat-pill--gold strong {
  color: var(--lm-gold);
}

.lm-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0.85rem;
}

.lm-hero-actions .btn {
  font-size: 0.8rem;
  padding: 0.45rem 0.9rem;
}

/* --- Livre 3D --- */
.lm-book-scene {
  perspective: 1400px;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 var(--space-md) var(--space-lg);
}

.lm-book {
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  animation: lm-book-open 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}

.lm-page.lm-ready .lm-book,
.lm-book.lm-book--open {
  opacity: 1;
}

@keyframes lm-book-open {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lm-book-shadow {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: -12px;
  height: 28px;
  background: radial-gradient(ellipse 80% 100% at 50% 0%, rgba(0, 0, 0, 0.65), transparent 70%);
  filter: blur(8px);
  transform: translateZ(-20px);
}

/* Couverture 3D désactivée : chevauchait le contenu sur desktop */
.lm-book-spine,
.lm-book-cover--left,
.lm-page--left {
  display: none !important;
}

.lm-cover-emblem {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 12px rgba(254, 228, 64, 0.5));
}

.lm-cover-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--lm-gold);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.lm-book-pages {
  position: relative;
  margin-left: 0;
  min-height: 320px;
  display: block;
  border-radius: 10px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 4px 0 0 rgba(254, 228, 64, 0.35);
}

.lm-page--right {
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(254, 228, 64, 0.04), transparent 50%),
    linear-gradient(180deg, var(--lm-parchment-light) 0%, var(--lm-parchment) 100%);
  border: 1px solid rgba(254, 228, 64, 0.12);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.lm-page--right::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 27px,
    rgba(0, 0, 0, 0.04) 27px,
    rgba(0, 0, 0, 0.04) 28px
  );
  pointer-events: none;
}

.lm-page-inner {
  position: relative;
  z-index: 1;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.lm-page-chapter {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(0, 245, 212, 0.85);
  margin: 0 0 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(0, 245, 212, 0.2);
}

.lm-page-chapter--future {
  margin-top: 1.25rem;
  color: rgba(254, 228, 64, 0.75);
  border-bottom-color: rgba(254, 228, 64, 0.2);
}

.lm-book-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(254, 228, 64, 0.4);
  pointer-events: none;
}

.lm-book-corner--tl { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.lm-book-corner--br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

/* --- Cartes mission --- */
.lm-missions-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.lm-mission {
  position: relative;
  padding: 1rem 1rem 1rem 3.6rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
  opacity: 1;
  transform: translateY(0);
}

/* Animation optionnelle (un seul passage, pas de opacity:0 permanent) */
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission {
  animation: lm-mission-in 0.45s ease backwards;
}

.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(1) { animation-delay: 0.05s; }
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(2) { animation-delay: 0.1s; }
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(3) { animation-delay: 0.15s; }
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(4) { animation-delay: 0.2s; }
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(5) { animation-delay: 0.25s; }
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(6) { animation-delay: 0.3s; }
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(7) { animation-delay: 0.35s; }
.lm-missions-scroll.lm-missions-animate .lm-missions-list-inner > .lm-mission:nth-child(8) { animation-delay: 0.4s; }

@keyframes lm-mission-in {
  from {
    opacity: 0.35;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lm-mission--done {
  border-color: rgba(110, 231, 183, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.lm-mission--locked {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.4);
  filter: saturate(0.5);
}

.lm-mission-rank {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--lm-gold);
  border: 1px solid rgba(254, 228, 64, 0.4);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 14px rgba(254, 228, 64, 0.15);
}

.lm-mission-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.lm-mission-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--lm-ink);
}

.lm-mission-badge {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 245, 212, 0.4);
  color: var(--lm-cyan);
  white-space: nowrap;
}

.lm-mission-badge--done {
  border-color: rgba(110, 231, 183, 0.5);
  color: #6ee7b7;
}

.lm-mission-badge--soon {
  border-color: rgba(254, 228, 64, 0.45);
  color: var(--lm-gold);
}

.lm-mission-badge--locked {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--lm-muted);
}

.lm-mission-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: #c4c8d0;
  margin: 0 0 0.65rem;
}

.lm-mission-desc strong {
  color: var(--lm-gold);
  font-weight: 600;
}

/* Barre d'avancement par quête */
.lm-quest-progress {
  margin: 0 0 0.75rem;
}

.lm-quest-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.lm-quest-progress-kicker {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--lm-muted);
}

.lm-quest-progress-value {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--lm-cyan);
}

.lm-quest-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

.lm-quest-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #00f5d4 0%, #5eead4 45%, #fee440 100%);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.35);
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.lm-quest-progress--active .lm-quest-progress-fill {
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.45);
}

.lm-quest-progress--complete .lm-quest-progress-value {
  color: #6ee7b7;
}

.lm-quest-progress--complete .lm-quest-progress-fill {
  background: linear-gradient(90deg, #34d399 0%, #6ee7b7 100%);
  box-shadow: 0 0 14px rgba(110, 231, 183, 0.4);
}

.lm-quest-progress--info .lm-quest-progress-fill {
  background: linear-gradient(90deg, rgba(254, 228, 64, 0.5) 0%, rgba(254, 228, 64, 0.85) 100%);
  box-shadow: 0 0 10px rgba(254, 228, 64, 0.25);
}

.lm-quest-progress--info .lm-quest-progress-value {
  color: var(--lm-gold);
}

/* Anneau de progression (legacy) */
.lm-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.lm-progress-ring {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  transform: rotate(-90deg);
}

.lm-progress-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 4;
}

.lm-progress-ring-fill {
  fill: none;
  stroke: url(#lm-ring-gradient);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 126;
  stroke-dashoffset: 126;
  transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.lm-progress-label {
  font-size: 0.82rem;
  color: var(--lm-muted);
  margin: 0;
}

.lm-progress-label strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--lm-cyan);
  letter-spacing: 0.03em;
}

.lm-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.65rem;
  padding: 0;
  list-style: none;
}

.lm-step {
  font-size: 0.72rem;
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #b8bcc4;
}

.lm-step--done {
  border-color: rgba(110, 231, 183, 0.4);
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.1);
}

.lm-step--locked {
  opacity: 0.45;
}

.lm-step a {
  color: inherit;
  text-decoration: none;
}

.lm-step a:hover {
  color: var(--lm-cyan);
}

.lm-mission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lm-mission-actions .btn {
  font-size: 0.78rem;
  padding: 0.4rem 0.75rem;
}

.lm-mission--locked .lm-mission-desc {
  color: var(--lm-muted);
  font-style: italic;
}

.lm-seal {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px dashed rgba(254, 228, 64, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(254, 228, 64, 0.7);
  transform: rotate(-12deg);
  animation: lm-seal-pulse 2.5s ease-in-out infinite;
}

@keyframes lm-seal-pulse {
  0%, 100% { opacity: 0.6; transform: rotate(-12deg) scale(1); }
  50% { opacity: 1; transform: rotate(-8deg) scale(1.04); }
}

.lm-onsite-steps {
  margin: 0 0 0.65rem;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  color: #b8bcc4;
}

.lm-onsite-steps a {
  color: var(--lm-cyan);
}

.lm-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 0 var(--space-md);
  margin-top: var(--space-lg);
}

.lm-loading {
  text-align: center;
  color: var(--lm-muted);
  padding: 2rem;
  font-size: 0.9rem;
}

.lm-missions-scroll {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.lm-chapter {
  margin-bottom: 0.25rem;
}

.lm-chapter + .lm-chapter {
  margin-top: 0.5rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(254, 228, 64, 0.12);
}

.lm-chapter-title {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.8vw, 1.15rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(254, 228, 64, 0.9);
  margin: 0 0 0.75rem;
  padding-left: 0.15rem;
  text-shadow: 0 0 20px rgba(254, 228, 64, 0.15);
}

.lm-missions-list-inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.lm-guest-prompt {
  text-align: center;
  padding: 2rem 1.25rem;
  border-radius: 12px;
  border: 1px dashed rgba(0, 245, 212, 0.35);
  background: rgba(0, 0, 0, 0.35);
}

.lm-guest-prompt p {
  margin: 0 0 1rem;
  color: #c4c8d0;
  font-size: 0.92rem;
  line-height: 1.55;
}

.lm-mission-icon {
  font-size: 1.35rem;
  line-height: 1;
  margin-right: 0.35rem;
  filter: drop-shadow(0 0 8px rgba(0, 245, 212, 0.25));
}

.lm-mission-head {
  align-items: center;
}

.lm-mission-head .lm-mission-title {
  flex: 1;
  min-width: 8rem;
}

.lm-mission-badge--info {
  border-color: rgba(254, 228, 64, 0.45);
  color: var(--lm-gold);
  background: rgba(254, 228, 64, 0.06);
}

.lm-mission--info {
  border-color: rgba(254, 228, 64, 0.2);
  background: rgba(254, 228, 64, 0.04);
}

.lm-mission--info.lm-mission--done {
  border-color: rgba(110, 231, 183, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.lm-mission-cta {
  margin: 0.35rem 0 0;
}

.lm-mission--highlight {
  animation: lm-mission-highlight 2.4s ease;
}

@keyframes lm-mission-highlight {
  0%, 100% {
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.1);
  }
  15%, 55% {
    box-shadow: 0 0 0 2px rgba(0, 245, 212, 0.45), 0 0 28px rgba(0, 245, 212, 0.2);
    border-color: rgba(0, 245, 212, 0.55);
  }
}

@media (max-width: 720px) {
  .lm-book-pages {
    min-height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lm-book,
  .lm-book-cover--left,
  .lm-mission,
  .lm-missions-scroll.lm-missions-animate .lm-mission,
  .lm-ambient-glow,
  .lm-ambient-dust,
  .lm-ambient-runes span,
  .lm-seal,
  .lm-mission--highlight {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .lm-progress-ring-fill,
  .lm-quest-progress-fill {
    transition: none;
  }
}
