:root {
  --acid: #39ff14;
  --acid-dim: #2aa810;
  --acid-muted: rgba(57, 255, 20, 0.65);
  --bg: #101410;
  --panel: #181c18;
  --panel-solid: #1a1e1a;
  --line: rgba(57, 255, 20, 0.14);
  --line-strong: rgba(57, 255, 20, 0.32);
  --text: #d0d4d0;
  --text-bright: #eceeec;
  --muted: #6a746a;
  --font: 'Barlow Condensed', 'Segoe UI', sans-serif;
  --mono: 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  font-weight: 400;
  overflow-x: hidden;
}

/* ── Fond vidéo (atténué, non « IA showcase ») ── */
.bg-media {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  filter: grayscale(0.15) brightness(0.68) contrast(1.05) saturate(0.9);
  transform: scale(1.02);
}

.bg-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 20, 16, 0.28) 0%, rgba(16, 20, 16, 0.42) 55%, rgba(16, 20, 16, 0.58) 100%),
    linear-gradient(90deg, rgba(16, 20, 16, 0.38) 0%, transparent 35%, transparent 65%, rgba(16, 20, 16, 0.32) 100%);
}

/* ── Intro mission ── */
.intro-splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #121612;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.intro-splash.intro-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-stage {
  position: relative;
  width: min(92vw, 420px);
  text-align: center;
}

.intro-code {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: intro-fade-in 0.5s ease 0.2s forwards;
}

.intro-code span { color: var(--acid-muted); }

.intro-ratel {
  position: relative;
  margin: 0 auto 1.25rem;
  width: min(80vw, 300px);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px);
  animation: intro-ratel-in 0.7s ease 0.5s forwards;
}

.intro-ratel img {
  display: block;
  width: 100%;
  height: auto;
}

.intro-weapon {
  position: absolute;
  bottom: 22%;
  left: 18%;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--acid-dim), var(--acid));
  transform: rotate(-8deg);
  transform-origin: left center;
  opacity: 0;
  animation: intro-weapon 0.45s ease 1.15s forwards;
}

.intro-status {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0;
  animation: intro-fade-in 0.4s ease 1.35s forwards;
}

.intro-trail {
  position: absolute;
  left: -10%;
  bottom: 38%;
  width: 120%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  opacity: 0;
  animation: intro-trail 1.1s ease 1.85s forwards;
}

.intro-splash.intro-out .intro-ratel {
  animation: intro-ratel-exit 0.9s ease forwards;
}

.app-shell--hidden {
  opacity: 0;
  visibility: hidden;
}

.app-shell--in {
  animation: app-shell-in 0.65s ease forwards;
}

@keyframes intro-fade-in {
  to { opacity: 1; }
}

@keyframes intro-ratel-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes intro-weapon {
  0% { width: 0; opacity: 0; }
  100% { width: 58%; opacity: 1; }
}

@keyframes intro-trail {
  0% { opacity: 0; transform: scaleX(0.3); }
  40% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1.1); }
}

@keyframes intro-ratel-exit {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  100% { opacity: 0.6; transform: translateX(115vw) scale(0.92); }
}

@keyframes app-shell-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); visibility: visible; }
}

/* ── Header ── */
.top {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.85rem 2rem;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-solid);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand > div {
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  object-fit: cover;
  flex-shrink: 0;
}

.brand strong {
  display: block;
  font-family: var(--mono);
  letter-spacing: 0.18em;
  color: var(--text-bright);
  font-size: 0.82rem;
  font-weight: 400;
}

.brand .sub {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav { display: flex; gap: 0.15rem; flex-wrap: wrap; flex: 1; }

.nav-link {
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--acid-muted);
  border-color: var(--line);
  background: rgba(57, 255, 20, 0.04);
}

.nav-link.dim { opacity: 0.45; font-size: 0.72rem; }

.user-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.user-box img {
  border-radius: 2px;
  border: 1px solid var(--line-strong);
}

.hidden { display: none !important; }

/* ── Boutons (sobres, corporate) ── */
.btn, .btn-sm {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn {
  background: transparent;
  color: var(--acid);
  border: 1px solid var(--acid-dim);
  padding: 0.65rem 1.35rem;
}

.btn:hover {
  background: rgba(57, 255, 20, 0.08);
  border-color: var(--acid);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.65rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn-sm:hover { color: var(--acid-muted); border-color: var(--line-strong); }

.btn-ghost {
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.03);
}

.btn-discord {
  background: rgba(88, 101, 242, 0.15);
  border: 1px solid rgba(88, 101, 242, 0.45);
  color: #b8c0ff;
}

.btn-discord:hover {
  background: rgba(88, 101, 242, 0.28);
  border-color: #5865f2;
}

/* ── Layout ── */
main {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) calc(5.5rem + env(safe-area-inset-bottom, 0px));
  width: 100%;
}

.view { display: none; }
.view.active { display: block; }

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 340px);
  gap: 2.5rem;
  align-items: end;
  padding: 3.5rem 0 3rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 2rem 0 2.25rem;
    gap: 1.5rem;
  }

  .hero-emblem { order: -1; max-width: 100%; }

  .hero-tagline {
    letter-spacing: 0.1em;
    font-size: 0.82rem;
  }

  .kicker {
    font-size: 0.62rem;
    line-height: 1.5;
  }

  .kicker-id {
    display: block;
    margin-bottom: 0.25rem;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    min-width: min(100%, 12rem);
    text-align: center;
  }
}

.kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 1rem;
  letter-spacing: 0.08em;
}

.kicker-id {
  color: var(--acid-muted);
  margin-right: 0.75rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 600;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.05;
  margin-bottom: 0.5rem;
}

.hero-tagline {
  font-size: 0.95rem;
  color: var(--acid-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  font-weight: 500;
}

.lead {
  font-size: 1rem;
  color: var(--muted);
  max-width: 32rem;
  margin-bottom: 1.75rem;
  line-height: 1.6;
  font-weight: 400;
}

.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.hero-emblem {
  border: 1px solid var(--line-strong);
  background: var(--panel);
  overflow: hidden;
  position: relative;
}

.hero-emblem::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(57, 255, 20, 0.08);
  pointer-events: none;
}

.hero-emblem img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.92;
  filter: saturate(0.85) contrast(1.05);
}

/* ── Capabilities ── */
.cap-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.cap-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.cap-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.tile {
  background: var(--panel);
  padding: 1.35rem 1.25rem 1.5rem;
  position: relative;
}

.tile-num {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--acid-muted);
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 0.65rem;
}

.tile h3 {
  color: var(--text-bright);
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.tile p {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ── Sections ── */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.35rem;
  padding-top: 2rem;
}

.section-id {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--acid-muted);
  letter-spacing: 0.15em;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-desc {
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  max-width: 40rem;
}

/* ── Cards ── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.card {
  background: var(--panel);
  padding: 1.1rem 1.15rem;
  position: relative;
}

.card .live {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--acid);
  display: block;
  margin-bottom: 0.4rem;
}

.card h3 {
  color: var(--text-bright);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  letter-spacing: 0.04em;
}

.card .meta, .card .plat {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.card a {
  color: var(--acid-muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card a:hover { color: var(--acid); }

/* ── Gallery ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.gallery figure {
  background: var(--panel-solid);
  overflow: hidden;
}

.gallery img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  display: block;
  filter: grayscale(0.2) contrast(1.05);
}

.gallery figcaption {
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.gallery .mission {
  color: var(--acid-muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  display: block;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Leaderboard ── */
.leaderboard { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); }

.lb-card {
  display: grid;
  grid-template-columns: 3rem 3rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: var(--panel);
  padding: 0.8rem 1rem;
  transition: background 0.15s;
}

.lb-card:hover { background: rgba(12, 16, 12, 0.95); }

.lb-card.lb-top-1 { border-left: 2px solid var(--acid-dim); }
.lb-card.lb-top-2 { border-left: 2px solid rgba(57, 255, 20, 0.35); }
.lb-card.lb-top-3 { border-left: 2px solid rgba(57, 255, 20, 0.2); }

.lb-rank { display: flex; align-items: center; justify-content: center; }
.lb-rank-medal { width: 2rem; height: 2rem; object-fit: contain; }
.lb-rank-num { font-family: var(--mono); color: var(--muted); font-size: 0.95rem; }

.lb-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  object-fit: cover;
}

.lb-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080a08;
  color: var(--muted);
  font-size: 0.85rem;
}

.lb-body { min-width: 0; }

.lb-name {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-bright);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.lb-lvl-medal { width: 1.1rem; height: 1.1rem; object-fit: contain; }

.lb-meta {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  letter-spacing: 0.04em;
}

.lb-bar-track {
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.lb-bar-fill {
  height: 100%;
  background: var(--acid-dim);
}

.lb-xp {
  text-align: right;
  font-family: var(--mono);
  color: var(--acid-muted);
  line-height: 1.1;
}

.lb-xp span { display: block; font-size: 1rem; font-weight: 400; }
.lb-xp small { font-size: 0.58rem; color: var(--muted); }

/* ── Forum gate ── */
.forum-gate {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 2.5rem 2rem;
  text-align: center;
}

.forum-gate p {
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

/* ── Footer ── */
.foot {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 2rem;
  background: var(--panel-solid);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.foot-status { display: flex; align-items: center; gap: 0.5rem; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acid-dim);
  box-shadow: 0 0 8px var(--acid-dim);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.foot .acid { color: var(--acid-muted); }

.empty {
  color: var(--muted);
  padding: 1.5rem;
  font-size: 0.88rem;
  background: var(--panel);
  border: 1px solid var(--line);
}

/* Legacy forum styles (onglet forum embarqué) */
.forum-layout { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; }
@media (max-width: 640px) { .forum-layout { grid-template-columns: 1fr; } }

.forum-cats button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.85rem;
}

.forum-cats button.active, .forum-cats button:hover {
  border-color: var(--line-strong);
  color: var(--acid-muted);
  background: rgba(57, 255, 20, 0.04);
}

.topic-row {
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.topic-row:hover { background: rgba(57, 255, 20, 0.03); }
.topic-row h4 { color: var(--text-bright); font-size: 0.95rem; }
.topic-row .meta { font-size: 0.75rem; color: var(--muted); font-family: var(--mono); }

.forum-form, .thread-box {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1rem;
  margin-top: 1rem;
}

.forum-form input, .forum-form textarea, .forum-form select {
  width: 100%;
  background: #080a08;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  font-family: var(--font);
}

.reply {
  border-left: 2px solid var(--line-strong);
  padding: 0.5rem 0 0.5rem 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

.reply .who { font-family: var(--mono); font-size: 0.75rem; color: var(--acid-muted); }

@media (prefers-reduced-motion: reduce) {
  .bg-video { display: none; }
  .status-dot { animation: none; }
  .intro-splash { display: none !important; }
  .app-shell--hidden { opacity: 1; visibility: visible; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .top {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand auth"
      "nav nav";
    align-items: center;
    gap: 0.65rem 0.75rem;
    padding: 0.75rem clamp(1rem, 4vw, 1.5rem);
  }

  .brand { grid-area: brand; }

  .brand strong {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand .sub {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    white-space: normal;
    line-height: 1.3;
  }

  .nav {
    grid-area: nav;
    flex: none;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0.25rem;
    padding-bottom: 0.15rem;
    mask-image: linear-gradient(90deg, black 92%, transparent);
  }

  .nav-link {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: 0.35rem 0.6rem;
  }

  #user-box,
  #btn-login {
    grid-area: auth;
    justify-self: end;
  }

  #user-name {
    max-width: 6rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  .section-head {
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
  }

  .section-title {
    font-size: 1.1rem;
    flex: 1 1 100%;
  }

  .tiles,
  .cards,
  .gallery {
    grid-template-columns: 1fr;
  }

  .gallery img {
    height: 140px;
  }

  .forum-gate {
    padding: 1.75rem 1.25rem;
  }

  .foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding: 0.5rem clamp(1rem, 4vw, 1.5rem);
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  }

  .foot-meta {
    font-size: 0.55rem;
  }
}

@media (max-width: 560px) {
  .lb-card {
    grid-template-columns: 2.25rem 2.75rem 1fr;
    grid-template-areas:
      "rank av body"
      "xp xp xp";
    gap: 0.5rem 0.65rem;
    padding: 0.75rem;
  }

  .lb-card > :nth-child(1) { grid-area: rank; }
  .lb-card > :nth-child(2) { grid-area: av; }
  .lb-card > :nth-child(3) { grid-area: body; min-width: 0; }
  .lb-card > :nth-child(4) { grid-area: xp; }

  .lb-xp {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    text-align: left;
    padding-top: 0.45rem;
    margin-top: 0.15rem;
    border-top: 1px solid var(--line);
  }

  .lb-xp span {
    display: inline;
    font-size: 0.92rem;
  }

  .lb-name {
    flex-wrap: wrap;
    word-break: break-word;
  }

  .lb-meta {
    font-size: 0.58rem;
    line-height: 1.45;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .hero h1 {
    font-size: 1.75rem;
    letter-spacing: 0.04em;
  }
}