/* =========================================================
   Habillage commun : chargement, curseur, barre de navigation,
   menu, rideau de transition, palette Ctrl K, rail, notifications,
   bandeaux, pied de page. Repris du site vitrine et adapté à l'application.
   ========================================================= */

/* =========================================================
   LOADER
   ========================================================= */
.loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--ink);
  display: grid; place-items: center;
}
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.loader-lockup { position: relative; display: flex; align-items: center; gap: clamp(14px, 2.4vw, 28px); }
.loader-lockup::before { content: ''; position: absolute; left: -12%; top: 50%; width: 60%; aspect-ratio: 1; translate: 0 -50%; background: radial-gradient(circle, rgba(242, 116, 23, 0.22), transparent 62%); pointer-events: none; }
.loader-fox { display: block; height: clamp(84px, 13vw, 140px); aspect-ratio: 100 / 102; }
.loader-word { display: flex; flex-direction: column; line-height: .82; will-change: transform, clip-path; }
.loader-word b { font-family: var(--f-display); font-weight: 800; font-size: clamp(54px, 8.6vw, 96px); letter-spacing: -0.03em; color: var(--paper); }
.loader-word i { font-style: normal; font-family: var(--f-body); font-weight: 600; font-size: clamp(14px, 2.3vw, 26px); letter-spacing: .5em; text-transform: uppercase; color: var(--muted); margin-top: .6em; }
.loader-foot {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 34px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; color: var(--muted);
}
.loader-count { font-size: clamp(48px, 9vw, 120px); line-height: .8; color: var(--paper); font-family: var(--f-display); font-weight: 300; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.loader-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.loader-bar span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.loader-fail { position: absolute; left: 50%; bottom: 120px; translate: -50% 0; width: min(520px, calc(100% - 32px)); }

/* =========================================================
   CURSEUR
   ========================================================= */
.cursor { display: none; }
.has-cursor .cursor { display: block; }
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor label, .has-cursor .isle, .has-cursor summary { cursor: none; }
.has-cursor input, .has-cursor textarea, .has-cursor select { cursor: text; }
.has-cursor select { cursor: pointer; }
.cursor-dot, .cursor-ring { position: fixed; top: 0; left: 0; z-index: 260; pointer-events: none; border-radius: 50%; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent); }
.cursor-ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid rgba(236, 234, 227, 0.4);
  display: grid; place-items: center;
  transition: width .45s var(--ease), height .45s var(--ease), margin .45s var(--ease), background-color .3s, border-color .3s;
}
.cursor-label { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); opacity: 0; transition: opacity .2s; white-space: nowrap; }
.cursor.is-hover .cursor-ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; border-color: var(--accent); background: var(--accent-soft); }
.cursor.is-label .cursor-ring { width: 88px; height: 88px; margin: -44px 0 0 -44px; background: var(--paper); border-color: var(--paper); }
.cursor.is-label .cursor-label { opacity: 1; }
.cursor.is-label .cursor-dot { opacity: 0; }
.cursor.is-drag .cursor-ring { width: 54px; height: 54px; margin: -27px 0 0 -27px; border-color: var(--c-ice); border-style: dashed; }
.cursor.is-hidden .cursor-ring, .cursor.is-hidden .cursor-dot { opacity: 0; }

/* =========================================================
   LE RENARD DU LOGO (facettes animables)
   ========================================================= */
.fox { display: block; width: 100%; height: 100%; overflow: visible; }
.fox polygon { stroke: var(--accent); stroke-width: 0; stroke-linejoin: miter; }
.fox .o { fill: var(--accent); }
.fox .k { fill: var(--fox-ink); }
.fox-tear { fill: #3DB8FF; opacity: 0; pointer-events: none; }
.fox-heart { fill: #FF6FA3; opacity: 0; pointer-events: none; }
.fox-z { fill: var(--accent); font-family: var(--f-mono); font-weight: 500; opacity: 0; pointer-events: none; }

/* =========================================================
   NAVIGATION
   ========================================================= */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 28px;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  transition: transform .6s var(--ease), background-color .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled, .nav.is-solid { background: rgba(12, 10, 9, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-color: var(--line); }
.nav.is-hidden { transform: translateY(-100%); }

.logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo-mark { display: block; height: 56px; aspect-ratio: 100 / 102; will-change: transform; filter: drop-shadow(0 0 calc(var(--glow, 0) * 16px) rgba(242, 116, 23, calc(var(--glow, 0) * 0.6))); }
.logo-mark img { width: 100%; height: 100%; }
.logo-text { font-family: var(--f-display); font-weight: 800; font-size: 24px; line-height: .95; letter-spacing: -0.01em; display: flex; flex-direction: column; }
.logo-text span { font-family: var(--f-body); font-weight: 600; font-size: 10px; letter-spacing: .44em; text-transform: uppercase; color: var(--muted); margin-top: 3px; transition: color .4s; }
.logo:hover .logo-text span { color: var(--accent); }
@media (max-width: 640px) { .logo-mark { height: 44px; } .logo-text { font-size: 20px; } }

.nav-current {
  margin-right: auto;
  display: flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 11px;
  padding-left: 18px; border-left: 1px solid var(--line-2);
  white-space: nowrap; min-width: 0;
}
.nav-current i { font-style: normal; color: var(--accent); }
.nav-current b { font-weight: 500; color: var(--paper); display: inline-block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

.nav-links { display: flex; gap: 28px; font-size: 14px; }
.nav-links a { display: block; overflow: hidden; height: 1.4em; line-height: 1.4em; color: rgba(236, 234, 227, 0.72); transition: color .3s, padding .5s var(--ease); background: radial-gradient(circle, var(--accent) 2.5px, transparent 3px) 0 50% / 0 0 no-repeat; }
.nav-links a span { display: block; position: relative; transition: transform .5s var(--ease); }
.nav-links a span::after { content: attr(data-text); position: absolute; left: 0; top: 100%; color: var(--accent); }
.nav-links a:hover span { transform: translateY(-100%); }
.nav-links a[aria-current="page"] { color: var(--paper); padding-left: 12px; background-size: 6px 6px; }

.nav-cmd {
  display: inline-flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 14px 0 8px;
  border-radius: 100px; border: 1px solid var(--line-2);
  color: var(--muted); font-size: 11px; white-space: nowrap;
  transition: border-color .3s, color .3s, background-color .3s;
}
.nav-cmd:hover { border-color: var(--paper); color: var(--paper); background: rgba(236, 234, 227, 0.04); }
.nav-cmd kbd { border-radius: 100px; padding: 4px 8px; }

.nav-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* puce du joueur : avatar, pseudo, niveau, barre d'XP */
.player-chip {
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 16px 0 4px;
  border-radius: 100px; border: 1px solid var(--line-2);
  background: rgba(12, 10, 9, 0.55);
  transition: border-color .3s, background-color .3s;
  max-width: 260px;
}
.player-chip:hover { border-color: var(--user-accent); background: rgba(236, 234, 227, 0.04); }
.player-chip .avatar { width: 40px; height: 40px; }
.player-chip-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.player-chip-text b { font-weight: 600; font-size: 14px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-chip-text small { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.xp-mini { display: block; width: 54px; height: 3px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.xp-mini i { display: block; height: 100%; background: var(--user-accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .8s var(--ease); }

.burger { display: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); position: relative; flex-shrink: 0; }
.burger span { position: absolute; left: 13px; right: 13px; height: 1.5px; background: var(--paper); transition: transform .5s var(--ease); }
.burger span:first-child { top: 18px; }
.burger span:last-child { top: 24px; }
.menu-open .burger span:first-child { transform: translateY(3px) rotate(45deg); }
.menu-open .burger span:last-child { transform: translateY(-3px) rotate(-45deg); }

@media (max-width: 1240px) { .nav-cmd span { display: none; } .nav-cmd { padding: 0 8px; } }
@media (max-width: 1100px) { .nav-links { gap: 18px; } .nav { gap: 18px; } .player-chip-text { display: none; } .player-chip { padding: 0 4px; } }
@media (max-width: 900px) {
  .nav-links, .nav-cmd, .nav-user .btn { display: none; }
  .burger { display: block; }
}
@media (max-width: 460px) { .nav-current { display: none; } .logo { margin-right: auto; } }

/* menu plein écran (mobile) */
.menu {
  position: fixed; inset: 0; z-index: 95;
  background: var(--ink-2);
  padding: calc(var(--nav-h) + 28px) var(--gutter) 32px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .8s var(--ease), visibility 0s .8s;
  visibility: hidden;
  overflow-y: auto;
}
.menu-open .menu { clip-path: inset(0 0 0 0); visibility: visible; transition: clip-path .8s var(--ease); }
.menu-links { display: flex; flex-direction: column; gap: 4px; }
.menu-links a {
  font-family: var(--f-display); font-weight: 600; font-size: clamp(2.2rem, 10vw, 4rem); letter-spacing: -0.04em; line-height: 1.08;
  display: flex; align-items: flex-start; gap: 14px;
  transform: translateY(40px); opacity: 0;
  transition: transform .8s var(--ease), opacity .8s var(--ease), color .3s;
}
.menu-links a small { color: var(--accent); margin-top: 0.7em; font-size: 12px; }
.menu-open .menu-links a { transform: none; opacity: 1; }
.menu-open .menu-links a:nth-child(2) { transition-delay: .05s; }
.menu-open .menu-links a:nth-child(3) { transition-delay: .1s; }
.menu-open .menu-links a:nth-child(4) { transition-delay: .15s; }
.menu-open .menu-links a:nth-child(5) { transition-delay: .2s; }
.menu-open .menu-links a:nth-child(6) { transition-delay: .25s; }
.menu-links a:hover, .menu-links a[aria-current="page"] { color: var(--accent); }
.menu-user { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.menu-foot { color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.menu-foot button { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); }

/* =========================================================
   BANDEAUX (annonce, maintenance, e-mail à vérifier)
   ========================================================= */
.banners { position: fixed; left: 0; right: 0; top: var(--nav-h); z-index: 99; display: flex; flex-direction: column; pointer-events: none; }
.banner {
  pointer-events: auto;
  display: flex; align-items: center; gap: 14px; justify-content: center;
  padding: 9px var(--gutter); font-size: 14px;
  background: rgba(20, 17, 16, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.banner .mono { color: var(--accent); flex-shrink: 0; }
@media (max-width: 640px) { .banner { font-size: 13px; padding: 7px 10px 7px var(--gutter); gap: 10px; justify-content: flex-start; } .banner .mono { font-size: 10px; } }
.banner p { min-width: 0; }
.banner--warn .mono { color: var(--warn); }
.banner button { flex-shrink: 0; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.banner button:hover { color: var(--paper); background: rgba(236, 234, 227, 0.08); }
.banner button svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }

/* =========================================================
   RIDEAU (transitions entre pages)
   ========================================================= */
.curtain {
  position: fixed; inset: 0; z-index: 140;
  background: var(--ink-2);
  clip-path: inset(100% 0 0 0);
  visibility: hidden;
  display: grid; place-items: center;
  pointer-events: none;
}
.curtain.is-on { visibility: visible; pointer-events: auto; }
.curtain-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(236, 234, 227, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 234, 227, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent);
}
.curtain::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.curtain-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 0 var(--gutter); }
.curtain-fox { display: block; height: clamp(76px, 11vw, 120px); aspect-ratio: 100 / 102; margin-bottom: 14px; filter: drop-shadow(0 0 40px rgba(242, 116, 23, 0.3)); }
.curtain-path { color: var(--muted); }
.curtain-path i { font-style: normal; color: var(--accent); }
.curtain-path b { color: var(--paper); font-weight: 500; }
.curtain-num { font-family: var(--f-mono); color: var(--accent); font-size: 14px; }
.curtain-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(2.6rem, 10vw, 8.5rem); line-height: .9; letter-spacing: -0.05em;
  overflow: hidden; padding-bottom: .06em;
}

/* =========================================================
   PALETTE DE COMMANDES
   ========================================================= */
.palette { position: fixed; inset: 0; z-index: 160; display: grid; place-items: start center; padding: 14vh var(--gutter) 24px; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(12, 10, 9, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.palette-box {
  position: relative;
  width: min(640px, 100%);
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--ink-2);
  box-shadow: 0 50px 120px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.palette-box::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent 70%); }
.palette-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-prompt { color: var(--accent); flex-shrink: 0; }
.palette-input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--paper); font-size: 17px; }
.palette-input::placeholder { color: rgba(236, 234, 227, 0.35); }
.palette-list { list-style: none; max-height: min(56vh, 460px); overflow-y: auto; padding: 8px; overscroll-behavior: contain; }
.palette-group { padding: 12px 10px 6px; color: var(--muted); font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.palette-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 12px; border-radius: 8px;
  cursor: pointer;
  color: rgba(236, 234, 227, 0.75);
  transition: background-color .2s, color .2s;
}
.palette-item i { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--line-2)); flex-shrink: 0; }
.palette-item b { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item small { font-family: var(--f-mono); font-size: 10px; color: var(--muted); text-transform: uppercase; flex-shrink: 0; }
.palette-item.is-sel { background: rgba(236, 234, 227, 0.07); color: var(--paper); }
.palette-item.is-sel small { color: var(--accent); }
.palette-item.is-sel::after { content: '↵'; font-family: var(--f-mono); font-size: 12px; color: var(--accent); }
.palette-empty { padding: 26px 12px; color: var(--muted); text-align: center; }
.palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
@media (max-width: 560px) { .palette { padding-top: 10vh; } .palette-foot { display: none; } }

/* =========================================================
   RAIL (sections de la page / îles de la carte)
   ========================================================= */
.rail {
  position: fixed; right: clamp(10px, 1.4vw, 22px); top: 50%; z-index: 80;
  translate: 0 -50%;
  display: flex; flex-direction: column; gap: 4px;
  opacity: 0; pointer-events: none;
  transition: opacity .6s var(--ease);
}
.rail.is-ready { opacity: 1; pointer-events: auto; }
.rail::before { content: ''; position: absolute; right: 5px; top: 10px; bottom: 10px; width: 1px; background: var(--line-2); }
.rail-fill { position: absolute; right: 5px; top: 10px; width: 1px; height: calc(100% - 20px); background: var(--accent); transform-origin: 50% 0; transform: scaleY(0); }
.rail a, .rail button {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  height: 22px;
}
.rail i {
  position: relative; z-index: 1;
  width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--ink);
  transition: transform .5s var(--ease), background-color .4s, border-color .4s;
}
.rail span {
  font-family: var(--f-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); white-space: nowrap;
  padding: 4px 8px; border-radius: 4px; background: rgba(12, 10, 9, 0.8);
  opacity: 0; transform: translateX(8px);
  transition: opacity .35s, transform .5s var(--ease), color .3s;
}
.rail span b { color: var(--accent); font-weight: 500; margin-right: 6px; }
.rail:hover span, .rail :focus-visible span { opacity: 1; transform: none; }
.rail a:hover span, .rail button:hover span { color: var(--paper); }
.rail a:hover i, .rail button:hover i { border-color: var(--paper); transform: scale(1.3); }
.rail .is-active i { background: var(--c, var(--accent)); border-color: var(--c, var(--accent)); transform: scale(1.25); box-shadow: 0 0 0 4px var(--accent-soft); }
.rail .is-active span { opacity: 1; transform: none; color: var(--paper); }
.rail.is-quiet .is-active span { opacity: 0; transform: translateX(8px); }
.rail.is-quiet:hover .is-active span { opacity: 1; transform: none; }
.rail [data-dim] i { border-style: dashed; }
@media (max-width: 1100px), (hover: none) { .rail { display: none; } }

/* =========================================================
   NOTIFICATIONS (toasts)
   ========================================================= */
.toasts { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 170; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(460px, calc(100% - 32px)); }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px 12px 16px; border-radius: 14px;
  background: var(--ink-3); border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.9);
  font-size: 14.5px; width: 100%;
  animation: toast-in .5s var(--ease);
}
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); }
.toast p { flex: 1; min-width: 0; }
.toast--ok { --c: var(--ok); }
.toast--error { --c: var(--danger); }
.toast--level { --c: var(--c-eg); border-color: rgba(255, 182, 39, 0.45); }
.toast button { color: var(--muted); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.toast button:hover { color: var(--paper); background: rgba(236, 234, 227, 0.08); }
.toast button svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.toast.is-out { animation: toast-out .35s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }

/* =========================================================
   PIED DE PAGE (pages de contenu)
   ========================================================= */
.foot { padding: 48px var(--gutter) 28px; border-top: 1px solid var(--line); margin-top: clamp(64px, 9vw, 120px); position: relative; overflow: hidden; }
.foot-big {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(3.6rem, 16vw, 15rem); line-height: 0.75; letter-spacing: -0.03em;
  text-align: center; color: transparent; user-select: none;
  background: linear-gradient(180deg, rgba(236, 234, 227, 0.12), rgba(236, 234, 227, 0.01) 90%);
  -webkit-background-clip: text; background-clip: text;
  margin-bottom: 28px; padding-top: .06em;
}
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 14px 24px; flex-wrap: wrap; color: var(--muted); }
.foot-row nav { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.foot-row a, .foot-row button { color: var(--muted); font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; transition: color .3s; display: inline-flex; align-items: center; gap: 8px; }
.foot-row a:hover, .foot-row button:hover { color: var(--paper); }
.foot-row b { color: var(--paper); font-weight: 500; }

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

/* =========================================================
   AVATARS (renards prédéfinis)
   ========================================================= */
.avatar { position: relative; display: block; width: 56px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 35%, var(--av-bg-1, #2A221D), var(--av-bg-2, #141110) 72%); box-shadow: inset 0 0 0 2px var(--ring, var(--user-accent)); overflow: hidden; flex-shrink: 0; }
.avatar svg { position: absolute; inset: 14% 12% 10%; width: 76%; height: 76%; overflow: visible; }
.avatar--lg { width: clamp(96px, 14vw, 148px); box-shadow: inset 0 0 0 3px var(--ring, var(--user-accent)), 0 0 0 6px rgba(12, 10, 9, 0.9), 0 0 50px -6px var(--ring, var(--user-accent)); }
