/* =========================================================
   LMDB Games Hub — socle du design system
   Repris du site vitrine (web-games/assets/css/style.css) : mêmes jetons,
   mêmes boutons, même grain ; complété pour une application (formulaires,
   panneaux, puces d'état, messages).
   ========================================================= */

:root {
  --ink: #0C0A09;
  --ink-2: #141110;
  --ink-3: #1C1815;
  --ink-4: #26201C;
  --paper: #ECEAE3;
  --paper-dim: rgba(236, 234, 227, 0.72);
  --muted: #A39A90;
  --line: rgba(236, 234, 227, 0.09);
  --line-2: rgba(236, 234, 227, 0.18);
  --line-3: rgba(236, 234, 227, 0.32);
  --accent: #F27417;
  --accent-2: #FF8F3D;
  --accent-soft: rgba(242, 116, 23, 0.16);
  --fox-ink: #3A322C;

  /* couleurs de jeu / d'état (reprises des jeux du site vitrine) */
  --c-eg: #FFB627;
  --c-green: #3DDC84;
  --c-ice: #A9E3D3;
  --c-blue: #3DB8FF;
  --c-violet: #9B8CFF;
  --c-pink: #FF6FA3;
  --c-red: #FF5A4E;
  --ok: #3DDC84;
  --warn: #FFB627;
  --danger: #FF6B5E;

  /* la mer de LMDB World */
  --sea-0: #071012;
  --sea-1: #0B1716;
  --sea-2: #10221F;
  --sea-line: rgba(169, 227, 211, 0.1);

  --user-accent: var(--accent);

  --f-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --f-body: 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --nav-h: 84px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --radius: 14px;
  --radius-s: 10px;
  color-scheme: dark;
}
@media (max-width: 640px) { :root { --nav-h: 68px; } }

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

html {
  background: var(--ink);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  background: var(--ink);
  color: var(--paper);
  overflow-x: hidden;
  min-height: 100svh;
}
body.is-loading { overflow: hidden; }
body.is-locked { overflow: hidden; }

::selection { background: var(--accent); color: var(--ink); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
img, svg { display: block; }
input, textarea, select { font: inherit; color: inherit; }
ul[class], ol[class] { list-style: none; }
[hidden] { display: none !important; }

.mono {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.eyebrow { color: var(--muted); display: inline-block; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hide-sm { }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
.only-sm { display: none !important; }
@media (max-width: 640px) { .only-sm { display: initial !important; } }

kbd { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .04em; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: rgba(236, 234, 227, 0.04); color: var(--paper); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 300;
  padding: 10px 16px; border-radius: 100px; background: var(--paper); color: var(--ink); font-weight: 600;
  transition: top .3s var(--ease);
}
.skip:focus { top: 12px; }

/* ---------- découpage de texte (animations de titres) ---------- */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.wi { display: inline-block; will-change: transform; }
.c { display: inline-block; will-change: transform; }

/* ---------- grain ---------- */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 90;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -2%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* =========================================================
   BOUTONS (identiques au site vitrine)
   ========================================================= */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 26px;
  border-radius: 100px;
  font-weight: 500; font-size: 15px; line-height: 1;
  overflow: hidden; isolation: isolate;
  transition: color .4s var(--ease), opacity .3s;
  white-space: nowrap;
  text-align: center;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease); }
.btn:hover svg { transform: translateX(4px); }
.btn::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit;
  transform: translateY(101%);
  transition: transform .5s var(--ease);
}
.btn:hover::before { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn-accent { background: var(--accent); color: var(--ink); }
.btn-accent::before { background: var(--paper); }
.btn-ghost { border: 1px solid var(--line-2); color: var(--paper); }
.btn-ghost::before { background: var(--paper); }
.btn-ghost:hover { color: var(--ink); }
.btn-light { background: var(--paper); color: var(--ink); }
.btn-light::before { background: var(--accent); }
.btn-game { background: var(--game, var(--accent)); color: var(--ink); }
.btn-game::before { background: var(--paper); }
.btn-danger { border: 1px solid rgba(255, 107, 94, 0.5); color: var(--danger); }
.btn-danger::before { background: var(--danger); }
.btn-danger:hover { color: var(--ink); }
.btn-small { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-tiny { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-wide { width: 100%; height: 56px; font-size: 16px; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.btn.is-busy { pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.link { color: var(--paper); text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 3px; transition: color .3s, text-decoration-color .3s; }
.link:hover { color: var(--accent); text-decoration-color: var(--accent); }
.link-mono { font-family: var(--f-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); transition: color .3s; }
.link-mono:hover { color: var(--paper); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(12, 10, 9, 0.6);
  color: var(--paper);
  transition: border-color .3s, background-color .3s, color .3s, transform .4s var(--ease);
}
.icon-btn:hover { border-color: var(--paper); background: rgba(236, 234, 227, 0.08); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* =========================================================
   PUCES, BADGES
   ========================================================= */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 100px;
  border: 1px solid var(--line-2);
  font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--paper); white-space: nowrap;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); flex-shrink: 0; }
.chip.is-live i { animation: blink-dot 2.4s ease-in-out infinite; box-shadow: 0 0 10px var(--c, var(--accent)); }
.chip.is-dim { color: var(--muted); border-style: dashed; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
@keyframes blink-dot { 50% { opacity: .35; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 132, .5); } 70% { box-shadow: 0 0 0 8px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }

.status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.status--open { --c: var(--c-blue); }
.status--answered { --c: var(--c-eg); }
.status--closed { --c: var(--muted); }

/* =========================================================
   FORMULAIRES
   ========================================================= */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.field { position: relative; display: flex; flex-direction: column; gap: 8px; }
.field > label, .field-label {
  font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--paper-dim);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.field-label small, .field > label small { color: var(--muted); text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 12px; }
.input, .select, .textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: rgba(236, 234, 227, 0.03);
  color: var(--paper);
  font-size: 16px;
  transition: border-color .25s, background-color .25s, box-shadow .25s;
}
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 42px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23A39A90' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }
.select option { background: var(--ink-2); color: var(--paper); }
.input::placeholder, .textarea::placeholder { color: rgba(236, 234, 227, 0.32); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); background: rgba(242, 116, 23, 0.04); box-shadow: 0 0 0 4px var(--accent-soft); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
.field-error::before { content: '!'; flex-shrink: 0; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; background: var(--danger); color: var(--ink); font-family: var(--f-mono); font-size: 10px; font-weight: 500; }
.field-hint { color: var(--muted); font-size: 13px; }
.input-wrap { position: relative; display: flex; }
.input-wrap .input { padding-right: 52px; }
.input-wrap .reveal { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); transition: color .2s, background-color .2s; }
.input-wrap .reveal:hover { color: var(--paper); background: rgba(236, 234, 227, 0.06); }
.input-wrap .reveal svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 15px; color: var(--paper-dim); }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box { flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; border-radius: 6px; border: 1px solid var(--line-3); display: grid; place-items: center; transition: background-color .2s, border-color .2s; }
.check .box svg { width: 14px; height: 14px; stroke: var(--ink); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .3s var(--ease); }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: none; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 3px; }
.field.has-error .check .box { border-color: var(--danger); }

/* pot de miel : hors écran, jamais visible ni lu */
.hp-field { position: absolute !important; left: -10000px !important; top: auto !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

/* jauge de mot de passe */
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter i { height: 4px; border-radius: 4px; background: var(--line-2); transition: background-color .3s; }
.pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: var(--c-ice); }
.pw-meter[data-score="4"] i { background: var(--ok); }

/* =========================================================
   MESSAGES / ALERTES
   ========================================================= */
.alert {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--ink-2);
  font-size: 15px; color: var(--paper);
}
.alert::before { content: ''; flex-shrink: 0; width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); }
.alert b { font-weight: 600; }
.alert p + p { margin-top: 6px; }
.alert--error { --c: var(--danger); border-color: rgba(255, 107, 94, 0.35); background: rgba(255, 107, 94, 0.06); }
.alert--ok { --c: var(--ok); border-color: rgba(61, 220, 132, 0.3); background: rgba(61, 220, 132, 0.05); }
.alert--warn { --c: var(--warn); border-color: rgba(255, 182, 39, 0.3); background: rgba(255, 182, 39, 0.05); }
.alert--info { --c: var(--c-blue); border-color: rgba(61, 184, 255, 0.28); background: rgba(61, 184, 255, 0.05); }
.alert .alert-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.alert .alert-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* état de chargement : squelettes */
.skel { position: relative; overflow: hidden; border-radius: 10px; background: rgba(236, 234, 227, 0.05); }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(236, 234, 227, 0.06), transparent); animation: skel 1.4s ease-in-out infinite; }
@keyframes skel { to { transform: translateX(100%); } }
.skel-line { height: 14px; margin: 8px 0; }
.skel-block { height: 120px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 40px 20px; color: var(--muted); }
.empty b { color: var(--paper); font-family: var(--f-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -0.01em; }

/* =========================================================
   MOUVEMENT RÉDUIT
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .grain { animation: none; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }

/* case à cocher dans un champ : texte courant, pas d'étiquette « mono » */
.field > label.check { font-family: var(--f-body); font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--paper-dim); justify-content: flex-start; align-items: flex-start; }
