/* Histoires de la forêt — thème partagé */

:root {
  --night: #050806;
  --pine: #0c1311;
  --pine-2: #131c18;
  --line: #25322c;
  --ember: #ff7a1a;
  --ember-soft: #ffb36b;
  --lamp: #f1dcae;
  --lamp-dim: #b3a37f;
  --moss: #93e85f;
  --blood: #e0533c;
  --font-display: 'UnifrakturCook', 'Old English Text MT', 'Palatino Linotype', Georgia, serif;
  --font-body: 'Spectral', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  color-scheme: dark;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--night);
  color: var(--lamp);
  font: 400 1.0625rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ember-soft); text-underline-offset: 3px; }
a:hover { color: var(--ember); }

:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page { position: relative; z-index: 1; }

/* ---------- Décor : forêt de nuit ---------- */

.scene {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(120% 80% at 75% 6%, #15231d 0%, #0a110e 45%, #040605 100%);
}
.scene-stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-stars circle { fill: #f4e7c6; }
.scene-moon {
  position: absolute; top: 7%; right: 11%;
  width: clamp(54px, 7vw, 92px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4d6, #e8cf9b 60%, #b99d6a 100%);
  box-shadow: 0 0 60px 14px rgba(255, 226, 160, .16), 0 0 160px 60px rgba(255, 226, 160, .06);
  opacity: .9;
}
.scene-trees { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 48vh; }
.scene-trees.back path { fill: #0a110e; }
.scene-trees.front path { fill: #030504; }
.scene-fog {
  position: absolute; left: -20%; width: 140%; height: 32vh; bottom: 7vh;
  background:
    radial-gradient(50% 60% at 30% 50%, rgba(170, 200, 185, .10), transparent 70%),
    radial-gradient(40% 50% at 72% 55%, rgba(170, 200, 185, .08), transparent 70%);
  animation: drift 40s linear infinite alternate;
}
.scene-fog.two { bottom: 0; animation-duration: 58s; animation-direction: alternate-reverse; opacity: .8; }
@keyframes drift { from { transform: translateX(-6%); } to { transform: translateX(6%); } }

/* La lanterne : un halo orange qui suit le doigt ou le curseur. */
.scene-glow {
  position: absolute; inset: 0; mix-blend-mode: screen;
  background: radial-gradient(circle 24rem at var(--gx, 62%) var(--gy, 36%),
    rgba(255, 136, 40, .30), rgba(255, 100, 20, .09) 55%, transparent 76%);
  animation: flicker 4.6s infinite;
}
@keyframes flicker {
  0%, 100% { opacity: .96; } 8% { opacity: .78; } 12% { opacity: 1; }
  40% { opacity: .88; } 44% { opacity: 1; } 70% { opacity: .9; }
}
.scene.is-static .scene-fog, .scene.is-static .scene-glow { animation: none; }
.scene.is-dim { opacity: .55; }

@media (prefers-reduced-motion: reduce) {
  .scene-fog, .scene-glow, .portrait::before { animation: none !important; }
}

/* ---------- En-tête ---------- */

.bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
}
.brand { display: flex; align-items: center; gap: .75rem; color: var(--lamp); text-decoration: none; }
.brand:hover { color: var(--ember-soft); }
.brand img {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--ember); box-shadow: 0 0 16px rgba(255, 122, 26, .45);
}
.brand span { font-family: var(--font-display); font-size: 1.85rem; line-height: 1; }
.bar nav { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .7rem 1.15rem;
  font: 600 1rem/1.2 var(--font-body); text-decoration: none; color: var(--lamp);
  background: var(--pine-2); border: 1px solid var(--line); border-radius: 3px; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ember-soft); color: var(--lamp); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ember); border-color: var(--ember); color: #1d0e00; }
.btn-primary:hover { background: #ff9440; border-color: #ff9440; color: #1d0e00; }
.btn-ok { border-color: #3d6b27; color: var(--moss); }
.btn-ok:hover { background: rgba(147, 232, 95, .12); border-color: var(--moss); color: var(--moss); }
.btn-no { border-color: #6b2a22; color: #ff8f7a; }
.btn-no:hover { background: rgba(224, 83, 60, .12); border-color: var(--blood); color: #ff8f7a; }
.btn-ghost { background: transparent; }
.btn-small { min-height: 38px; padding: .45rem .8rem; font-size: .95rem; }

/* ---------- Formulaires ---------- */

.field { display: grid; gap: .35rem; margin-bottom: 1.25rem; }
.field > label, .field > .label { font-weight: 600; }
.hint { color: var(--lamp-dim); font-size: .93rem; }
.error-text { color: #ff8f7a; font-size: .95rem; min-height: 1.2em; }

input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: .65rem .85rem;
  font: inherit; color: var(--lamp);
  background: #090e0c; border: 1px solid var(--line); border-radius: 3px;
}
input[type=text], input[type=password], input[type=search], select { height: 3rem; }
input::placeholder, textarea::placeholder { color: #6f6a58; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px rgba(255, 122, 26, .22);
}
[aria-invalid=true] { border-color: var(--blood); }

/* ---------- Notifications ---------- */

.toasts {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  display: grid; gap: .5rem; z-index: 200; width: min(92vw, 28rem); pointer-events: none;
}
.toast {
  background: #101a15; border: 1px solid var(--line); border-left: 4px solid var(--ember);
  padding: .75rem 1rem; border-radius: 3px; box-shadow: 0 8px 30px rgba(0, 0, 0, .6);
}
.toast.ok { border-left-color: var(--moss); }
.toast.err { border-left-color: var(--blood); }

/* ---------- Connexion ---------- */

.login {
  max-width: 24rem; margin: 12vh auto 0; padding: 1.5rem;
  background: linear-gradient(180deg, #0f1714, #0b110f);
  border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.login h1 { font-size: 2.2rem; margin-bottom: .4rem; }
.login p { margin: 0 0 1.2rem; color: var(--lamp-dim); }

/* ---------- Niveau de flippe ---------- */

.fear { display: inline-flex; gap: 2px; align-items: center; }
.fear-skull { font-size: 1.05rem; line-height: 1; color: #46564e; }
.fear-skull.on { color: var(--ember); }
button.fear-skull {
  background: none; border: 0; padding: .35rem .2rem; cursor: pointer; font-size: 1.3rem; min-width: 34px; min-height: 40px;
}
button.fear-skull:hover { color: var(--ember-soft); }
