/* Hoshi TCG — base : page, header, dock, boutons, formulaires, composants génériques. */
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: var(--track);
  min-height: 100svh;
}

/* ── Fond réactif « Afterglow » : canvas fixe, parallaxe à la souris (voir app.js) ── */
.bg-canvas {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; perspective: 1200px;
  background: linear-gradient(180deg, #0b101d 0%, #080c16 60%, #05070d 100%);
}
.bg-canvas > * { position: absolute; will-change: transform; }
.bg-glow {
  right: 8%; top: 6%; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(220, 235, 255, 0.26), rgba(220, 235, 255, 0.04) 60%, transparent 72%);
  filter: blur(10px);
}
.bg-glow.two { left: 4%; bottom: 22%; width: 180px; height: 180px; background: radial-gradient(circle, rgba(179, 148, 224, 0.16), transparent 70%); }
/* Fondu du fond (retour Noé 2026-07-28 : le trait du haut se voyait comme une ligne parasite
   pleine largeur sur toutes les pages — retiré, le dégradé seul suffit). */
.bg-band {
  left: 0; right: 0; bottom: 0; height: 19%;
  background: linear-gradient(180deg, transparent, rgba(188, 215, 255, 0.05) 55%, rgba(6, 8, 13, 0.9));
}
.bg-stars { inset: 0; color: var(--accent); }
.bg-stars i { position: absolute; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.18; font-weight: 500; letter-spacing: var(--track-wide); }
h1 { font-size: clamp(1.4rem, 3.6vw, 2rem); font-weight: 500; }
h2 { font-size: clamp(1.05rem, 2.6vw, 1.3rem); font-weight: 500; }
h3 { font-size: 0.98rem; font-weight: 500; letter-spacing: 0.08em; }
a { text-decoration: none; }
p a, .link { color: var(--accent); }
p a:hover, .link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: var(--s5) var(--s4) calc(96px + var(--s6)); }

/* ── Header : continuité du fond (pas de barre, juste un fondu haut) ── */
.site-head {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s5);
  background: linear-gradient(180deg, rgba(6, 9, 16, 0.9), rgba(6, 9, 16, 0.4) 60%, transparent);
}
.brand { font-family: var(--font-display); font-weight: 500; font-size: 1.05rem; letter-spacing: 0.22em; color: var(--ink); text-transform: uppercase; }
.brand em { color: var(--accent); font-style: normal; }
.head-season { font-size: 0.68rem; color: var(--ink-faint); letter-spacing: 0.16em; text-transform: uppercase; }
.head-spacer { flex: 1; }
/* Points + daily (header sobre : titre · saison | points · daily) */
.head-gems { display: flex; align-items: center; gap: 7px; font-size: 0.9rem; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0.03em; }
.gem { width: 10px; height: 10px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 7px rgba(188, 215, 255, 0.6); flex-shrink: 0; display: inline-block; }
.head-gems strong { font-weight: 500; }
.head-gems .plus { color: var(--ink-dim); }
.head-gems:hover .plus { color: var(--accent); }
.head-daily { font-size: 0.7rem; color: var(--accent); letter-spacing: 0.14em; text-transform: uppercase; border-bottom: 1px solid rgba(188, 215, 255, 0.3); padding-bottom: 2px; }
.head-daily.done { color: var(--ink-faint); border-bottom-color: transparent; }
.head-daily:hover:not(.done) { color: #fff; border-bottom-color: var(--accent); }
.head-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-md); color: var(--ink-dim);
  border: 1px solid var(--border); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.head-icon svg { width: 18px; height: 18px; }
.head-icon:hover { background: var(--accent-soft); color: var(--ink); border-color: var(--border-strong); }

/* ── Rail de navigation (pleine largeur, horizontal) ── */
/* Rail : posé sur la ligne du fond (.bg-band), fondu doux — pas de barre opaque ni de trait en plus */
.rail {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  padding: 8px max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(5, 7, 13, 0.96) 30%, rgba(6, 8, 13, 0.5) 75%, transparent);
}
.rail-track {
  max-width: 1180px; margin: 0 auto;
  display: flex; gap: 4px; align-items: flex-end; justify-content: center;
}
.rail-group { flex: 1 1 0; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.rail-group::-webkit-scrollbar { display: none; }
.rail-group.left { justify-content: flex-end; }
.rail-group.right { justify-content: flex-start; }
.rail-item {
  position: relative; flex: 0 0 auto; min-width: 62px; scroll-snap-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 6px 6px; border-radius: var(--r-sm);
  font-size: 0.58rem; font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim);
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
/* Pull — action reine, au centre, mis en avant */
.rail-item--hero { flex: 0 0 auto; margin: 0 var(--s3); color: var(--ink); }
.rail-item--hero .rail-ico {
  width: 48px; height: 48px; border-radius: 50%; margin-bottom: 2px;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 34%, rgba(188, 215, 255, 0.22), rgba(188, 215, 255, 0.05));
  border: 1px solid rgba(188, 215, 255, 0.4); box-shadow: 0 0 20px rgba(188, 215, 255, 0.22);
  transition: box-shadow var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.rail-item--hero .rail-ico svg { width: 24px; height: 24px; }
.rail-item--hero::before { display: none; }
.rail-item--hero:hover .rail-ico { box-shadow: 0 0 28px rgba(188, 215, 255, 0.35); }
.rail-item--hero[aria-current="page"] { color: var(--accent); }
.rail-item--hero[aria-current="page"] .rail-ico { border-color: var(--accent); box-shadow: 0 0 30px rgba(188, 215, 255, 0.45); }
.rail-item::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%) scaleX(0);
  width: 26px; height: 3px; border-radius: 3px; background: var(--gold);
  transition: transform 220ms var(--ease-spring); transform-origin: center;
}
.rail-ico { position: relative; display: flex; align-items: center; justify-content: center; }
.rail-ico svg { width: 22px; height: 22px; }
.rail-item:hover { color: var(--ink); background: rgba(237, 239, 247, 0.05); }
.rail-item:active { transform: scale(0.94); }
.rail-item[aria-current="page"] { color: var(--gold); }
.rail-item[aria-current="page"]::before { transform: translateX(-50%) scaleX(1); }
.rail-item[aria-current="page"] .rail-ico { filter: drop-shadow(0 0 8px rgba(245, 198, 79, 0.5)); }
.rail-badge {
  position: absolute; top: -5px; right: -8px;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: var(--r-pill);
  background: var(--danger); color: #fff; font-size: 0.58rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--bg);
}

/* ── Nav mobile (≤720px) : barre allégée (Menu + Pull + Profil) + tiroir ──
   Le rail complet (11 entrées) ne tient pas sur petit écran : mesuré à l'exécution, le
   groupe de droite avait un scrollWidth de 360px pour 130px visibles (flick horizontal
   dans une bande minuscule, à peine praticable). Caché sur mobile, remplacé par ce qui suit. */
.rail-mobile { display: none; }
.nav-drawer { position: fixed; inset: 0; z-index: 90; }
.nav-drawer-backdrop { position: fixed; inset: 0; background: rgba(5, 7, 13, 0.7); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.nav-drawer-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1;
  max-height: 78svh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-raised); border-top: 1px solid var(--border-strong);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--s3) var(--s4) max(var(--s5), env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform var(--t-med) var(--ease-spring);
}
.nav-drawer-sheet.dragging { transition: none; }
/* Poignée de glissement (pas de bouton croix — fermeture par glissé vers le bas ou tap en dehors). */
.nav-drawer-handle { width: 36px; height: 4px; border-radius: var(--r-pill); background: var(--border-strong); margin: 0 auto var(--s4); touch-action: none; padding: 10px 40px; background-clip: content-box; }
.nav-drawer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.drawer-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  padding: var(--s4) var(--s2); border-radius: var(--r-md); border: 1px solid var(--border);
  font-size: 0.72rem; color: var(--ink-soft); text-align: center;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.drawer-item:active { transform: scale(0.96); }
.drawer-item[aria-current="page"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.drawer-item .rail-ico svg { width: 22px; height: 22px; }

@media (max-width: 720px) {
  .rail--app { display: none; }
  .rail-mobile {
    display: flex; align-items: flex-end; justify-content: center; gap: var(--s7);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 8px max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(5, 7, 13, 0.96) 30%, rgba(6, 8, 13, 0.5) 75%, transparent);
  }
  .nav-drawer.open .nav-drawer-sheet { transform: translateY(0); }
}

/* ── Boutons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s5);
  border-radius: var(--r-sm); font-weight: 500; font-size: 0.9rem;
  letter-spacing: 0.14em; text-transform: uppercase;
  transition: transform 100ms ease-out, background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
/* Primaire Afterglow : bordé périwinkle + lueur interne, encre claire */
.btn-gold {
  color: var(--ink); border: 1px solid rgba(188, 215, 255, 0.5);
  box-shadow: 0 0 24px rgba(188, 215, 255, 0.14) inset;
}
.btn-gold:hover { border-color: rgba(220, 235, 255, 0.9); color: #fff; box-shadow: 0 0 30px rgba(188, 215, 255, 0.22) inset; }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--border-strong); color: var(--ink); }
.btn-danger { background: rgba(255, 143, 160, 0.12); color: var(--danger); border: 1px solid rgba(255, 143, 160, 0.4); }
.btn-sm { min-height: 34px; padding: 0 var(--s3); font-size: 0.76rem; letter-spacing: 0.1em; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ── Formulaires ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s4); }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--ink-dim); }
.input, select.input, textarea.input {
  background: var(--bg-raised); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); padding: 10px 14px; min-height: 44px; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease-out);
}
.input:focus { border-color: var(--gold); outline: none; }
.input::placeholder { color: var(--ink-faint); }
/* Curseur (slider quantité de packs, etc.) : la classe .input générique (pensée pour du texte)
   lui ajoutait un fond/bordure/padding qui casse le rendu natif sur PC et décale visuellement le
   bout de la piste — retour Noé 2026-07-28 : « le slider ne va pas jusqu'au bout ». Piste et
   curseur redessinés à la main, cohérents entre navigateurs. */
input[type="range"].input {
  -webkit-appearance: none; appearance: none; background: transparent; border: none;
  padding: 0; min-height: 0; height: 22px; width: 100%; cursor: pointer;
}
input[type="range"].input::-webkit-slider-runnable-track {
  height: 6px; border-radius: var(--r-pill); background: var(--bg-card); border: 1px solid var(--border-strong);
}
input[type="range"].input::-moz-range-track {
  height: 6px; border-radius: var(--r-pill); background: var(--bg-card); border: 1px solid var(--border-strong);
}
input[type="range"].input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; margin-top: -8px;
  background: var(--gold); border: 2px solid var(--bg); box-shadow: 0 0 8px rgba(245, 198, 79, 0.5); cursor: pointer;
}
input[type="range"].input::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg);
  box-shadow: 0 0 8px rgba(245, 198, 79, 0.5); cursor: pointer;
}
.hint { font-size: 0.78rem; color: var(--ink-faint); }
.error-text { color: var(--danger); font-size: 0.85rem; }

/* ── Panneaux, listes, états ── */
.panel { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s5); }
.panel + .panel { margin-top: var(--s4); }
.page-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head .sub { color: var(--ink-dim); font-size: 0.9rem; }
.empty {
  text-align: center; padding: var(--s7) var(--s4); color: var(--ink-dim);
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
}
.empty .big { font-size: 1.6rem; display: block; margin-bottom: var(--s2); }
.divider { border: none; border-top: 1px solid var(--border); margin: var(--s5) 0; }

/* ── Flash / toasts ── */
.toast-zone { position: fixed; top: 68px; right: var(--s4); z-index: 60; display: flex; flex-direction: column; gap: var(--s2); }
.toast {
  background: var(--bg-card); border: 1px solid var(--border-strong); border-left: 3px solid var(--gold);
  border-radius: var(--r-md); padding: var(--s3) var(--s4); max-width: 320px; font-size: 0.9rem;
  box-shadow: var(--shadow-2);
  animation: toast-in var(--t-med) var(--ease-spring);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.toast.out { opacity: 0; transition: opacity var(--t-fast) var(--ease-out); }

/* ── Pagination ── */
.pager { display: flex; align-items: center; justify-content: center; gap: var(--s2); margin-top: var(--s5); flex-wrap: wrap; }
.pager a, .pager .cur {
  min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px; border-radius: var(--r-sm); font-size: 0.88rem; font-variant-numeric: tabular-nums;
}
.pager a { border: 1px solid var(--border); color: var(--ink-dim); }
.pager a:hover { border-color: var(--gold); color: var(--ink); }
.pager .cur { background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.pager .dots { color: var(--ink-faint); }

/* ── Tables (classement) ── */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: center; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); padding: var(--s2) var(--s3); }
.table td { padding: var(--s3); border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; text-align: center; }
.table tr.me td { background: var(--gold-soft); }
/* Le nom du joueur reste lisible en lecture naturelle (gauche) ; tout le reste (rang, stats) est centré. */
.table th:nth-child(2), .table td:nth-child(2) { text-align: left; }

/* ── Responsive ── */
@media (max-width: 720px) {
  .wrap { padding-inline: var(--s3); }
  /* Header un peu large avant : brand + gems + 2 boutons daily/rente arrivaient presque bord à
     bord (mesuré : ~12px de marge restante sur 375px). Resserré (padding, gap, tailles). */
  .site-head { padding: var(--s3); gap: var(--s2); }
  .head-season { display: none; }
  .head-stat#hud-packs { display: none; }
  .brand { font-size: 0.92rem; letter-spacing: 0.16em; }
  .head-gems { font-size: 0.8rem; gap: 5px; }
  .head-daily { font-size: 0.62rem; letter-spacing: 0.1em; }
  .rail-item { min-width: 68px; }
  .rail-item .rail-label { font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .site-head, .rail { background: var(--bg-raised); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
