/* ═══════════════════ Livre des Ombres — encre d'or sur nuit ═══════════════════ */

:root {
  --nuit: #110d16;
  --nuit-2: #17111f;
  --encre: #1b1422;
  --encre-2: #221933;
  --or: #c9a35c;
  --or-pale: #e8d5a8;
  --or-sombre: #8f7340;
  --ivoire: #e6dcc3;
  --ivoire-dim: rgba(230, 220, 195, 0.62);
  --lavande: #8d7ba8;
  --ligne: rgba(201, 163, 92, 0.30);
  --ligne-faible: rgba(201, 163, 92, 0.16);
  --rouge-cire: #8e3b3b;

  --f-display: "Cinzel Decorative", "Times New Roman", serif;
  --f-caps: "Cinzel", "Times New Roman", serif;
  --f-main: "Caveat", "Segoe Script", cursive;
  --f-plume: "La Belle Aurore", "Segoe Script", cursive;
}

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

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

body {
  min-height: 100dvh;
  background-color: var(--nuit);
  color: var(--ivoire);
  font-family: var(--f-main);
  font-size: 20px;
  line-height: 1.45;
}

/* Ciel étoilé sur un calque fixe (background-attachment: fixed est fragile sur mobile) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(232, 213, 168, 0.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 9%,  rgba(232, 213, 168, 0.40) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 89% 34%, rgba(141, 123, 168, 0.50) 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 52%, rgba(232, 213, 168, 0.30) 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 71%, rgba(232, 213, 168, 0.38) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 83%, rgba(141, 123, 168, 0.40) 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 88%, rgba(232, 213, 168, 0.35) 50%, transparent 51%),
    radial-gradient(ellipse 120% 90% at 50% -10%, #1d1526 0%, var(--nuit) 60%);
}

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 12px) 16px max(env(safe-area-inset-bottom), 24px);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.view { animation: apparition 480ms ease both; }
[hidden] { display: none !important; }
@keyframes apparition {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

svg { display: block; }

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

/* ─────────────── Entrée anonyme ─────────────── */

#view-login {
  min-height: calc(100dvh - 48px);
  display: grid;
  place-items: center;
}

.gate {
  display: grid;
  gap: 24px;
  width: min(300px, 84vw);
  justify-items: center;
}
.gate #login-code {
  width: 100%;
  font-family: var(--f-main);
  font-size: 1.4rem;
  text-align: center;
  color: var(--ivoire);
  background: rgba(27, 20, 34, 0.75);
  border: 1px solid var(--ligne);
  border-radius: 8px;
  padding: 14px 16px;
  letter-spacing: 0.35em;
  box-shadow: 0 0 0 4px rgba(201, 163, 92, 0.05), 0 10px 30px rgba(0, 0, 0, 0.45);
}
.gate #login-code::placeholder { color: rgba(230, 220, 195, 0.5); }
.gate #login-code:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 4px rgba(201, 163, 92, 0.10), 0 0 22px rgba(201, 163, 92, 0.18);
}
.gate-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(27, 20, 34, 0.6);
  border: 1px solid var(--ligne);
  color: var(--or);
  font-size: 1.15rem;
  cursor: pointer;
  transition: color 250ms ease, border-color 250ms ease, box-shadow 250ms ease;
}
.gate-btn:hover, .gate-btn:focus-visible {
  color: var(--or-pale);
  border-color: var(--or);
  box-shadow: 0 0 18px rgba(201, 163, 92, 0.22);
}

.cover {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 44px 36px 56px;
  text-align: center;
  border: 1px solid var(--ligne);
  box-shadow:
    inset 0 0 0 4px var(--nuit),
    inset 0 0 0 5px var(--ligne-faible),
    0 24px 60px rgba(0, 0, 0, 0.55);
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(141, 123, 168, 0.08), transparent 70%),
    var(--nuit-2);
}

.corner {
  position: absolute;
  width: 44px; height: 44px;
  color: var(--or-sombre);
}
.c-tl { top: 10px; left: 10px; transform: scaleY(-1) rotate(90deg); }
.c-tr { top: 10px; right: 10px; transform: rotate(180deg); }
.c-bl { bottom: 10px; left: 10px; }
.c-br { bottom: 10px; right: 10px; transform: scaleX(-1); }

.cover-emblem {
  width: 150px; height: 55px;
  margin: 0 auto 28px;
  color: var(--or);
  filter: drop-shadow(0 0 14px rgba(201, 163, 92, 0.35));
}

/* La planche de couverture, montée comme dans un livre ancien */
.cover-art {
  width: min(250px, 76%);
  margin: 0 auto 24px;
}
.cover-art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55), 0 0 24px rgba(201, 163, 92, 0.10);
  opacity: 0.97;
}

.cover-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 2.1rem;
  line-height: 1.22;
  letter-spacing: 0.06em;
  color: var(--or-pale);
  text-shadow: 0 0 24px rgba(201, 163, 92, 0.25);
}

.cover-motto {
  font-family: var(--f-plume);
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ivoire-dim);
  margin: 20px 0 40px;
}

#login-form { display: grid; gap: 18px; }

#login-code {
  font-family: var(--f-main);
  font-size: 1.3rem;
  text-align: center;
  color: var(--ivoire);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ligne);
  padding: 8px 4px;
  letter-spacing: 0.2em;
}
#login-code::placeholder { color: rgba(230, 220, 195, 0.35); letter-spacing: 0.05em; }
#login-code:focus { outline: none; border-bottom-color: var(--or); }

.form-error {
  font-family: var(--f-plume);
  color: #c98a8a;
  font-size: 1.05rem;
}

/* ─────────────── Boutons ─────────────── */

.btn-seal {
  font-family: var(--f-caps);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--or-pale);
  background: linear-gradient(180deg, rgba(201, 163, 92, 0.14), rgba(201, 163, 92, 0.05));
  border: 1px solid var(--or-sombre);
  padding: 14px 22px;
  cursor: pointer;
  transition: box-shadow 300ms ease, border-color 300ms ease;
}
.btn-seal:hover, .btn-seal:focus-visible {
  border-color: var(--or);
  box-shadow: 0 0 22px rgba(201, 163, 92, 0.25);
}

.btn-ghost {
  font-family: var(--f-caps);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ivoire-dim);
  background: none;
  border: none;
  padding: 10px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--or-pale); }

.btn-feather {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-caps);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--nuit);
  background: linear-gradient(180deg, var(--or-pale), var(--or));
  border: none;
  padding: 13px 20px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(201, 163, 92, 0.28);
}
.btn-feather svg { width: 20px; height: 20px; }

.btn-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--or);
  background: var(--nuit-2);
  border: 1px solid var(--ligne);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 250ms ease;
}
.btn-icon svg { width: 22px; height: 22px; }
.btn-icon:hover { border-color: var(--or); }

/* ─────────────── Sommaire ─────────────── */

.index-header {
  text-align: center;
  padding: 30px 0 8px;
}
.index-emblem { width: 96px; height: 35px; margin: 0 auto 12px; color: var(--or); }
.index-art { width: min(185px, 52vw); margin: 0 auto 16px; }
.index-art img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(201, 163, 92, 0.08);
  opacity: 0.97;
}
.index-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--or-pale);
}
.index-count {
  font-family: var(--f-plume);
  font-size: 1rem;
  color: var(--ivoire-dim);
  margin-top: 6px;
}

.sabbat-notice {
  font-family: var(--f-caps);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--or-pale);
  margin-top: 14px;
  text-shadow: 0 0 16px rgba(201, 163, 92, 0.35);
  animation: apparition 900ms ease both;
}

/* Chapitres du grimoire — une ligne discrète, dépliable */
.chapters {
  margin: 10px 0 0;
  text-align: center;
}
.chapters-toggle {
  font-family: var(--f-caps);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--or-sombre);
  background: none;
  border: none;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 200ms ease;
}
.chapters-toggle::before, .chapters-toggle::after { content: " — "; color: var(--ligne); }
.chapters-toggle:hover { color: var(--or-pale); }
.chapters.open .chapters-toggle { color: var(--or); }
.chapters.open .chapters-grid {
  margin-top: 10px;
  border: 1px solid var(--ligne-faible);
  padding: 14px 20px;
  background: rgba(27, 20, 34, 0.45);
  text-align: left;
}
.chapters-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 24px;
}
@media (min-width: 560px) {
  .chapters-grid { grid-template-columns: 1fr 1fr; }
}
.chapters-grid button {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 2px;
  text-align: left;
  color: var(--ivoire);
  font-family: var(--f-main);
  font-size: 1.28rem;
  font-weight: 600;
}
.chapters-grid button svg { width: 14px; height: 14px; color: var(--or-sombre); flex: none; }
.chapters-grid button:hover { color: var(--or-pale); }
.chapters-grid button:hover svg { color: var(--or); }

.index-tools { margin: 22px 0 10px; display: grid; gap: 16px; }

.search-line {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--ligne);
  padding: 4px 2px;
}
.search-icon { width: 19px; height: 19px; color: var(--or-sombre); flex: none; }
#search {
  flex: 1;
  font-family: var(--f-main);
  font-size: 1.2rem;
  color: var(--ivoire);
  background: none;
  border: none;
}
#search::placeholder { color: rgba(230, 220, 195, 0.35); }
#search:focus { outline: none; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-caps);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ivoire-dim);
  background: none;
  border: 1px solid var(--ligne-faible);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease;
}
.chip svg { width: 15px; height: 15px; }
.chip:hover { border-color: var(--or-sombre); color: var(--ivoire); }
.chip[aria-pressed="true"] {
  color: var(--or-pale);
  border-color: var(--or);
  background: rgba(201, 163, 92, 0.10);
}

/* Frontispices illustrés — fondus dans la nuit */
.frontispiece {
  margin: 14px auto 6px;
  max-width: 640px;
  list-style: none;
}
.frontispiece img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 2;
  object-fit: cover;
  object-position: center;
  -webkit-mask-image: radial-gradient(ellipse 88% 92% at 50% 50%, #000 50%, transparent 98%);
  mask-image: radial-gradient(ellipse 88% 92% at 50% 50%, #000 50%, transparent 98%);
  opacity: 0.94;
}
.spell-page .frontispiece { margin-top: 4px; }

/* Index à points de conduite */
.spell-list { list-style: none; margin: 18px 0 28px; }
.spell-entry { border-bottom: none; }
.spell-entry button {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 13px 4px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.spell-entry .entry-title {
  font-family: var(--f-main);
  font-size: 1.42rem;
  font-weight: 600;
  color: var(--ivoire);
  transition: color 200ms ease;
}
.spell-entry button:hover .entry-title { color: var(--or-pale); }
.spell-entry .leader {
  flex: 1;
  border-bottom: 2px dotted rgba(201, 163, 92, 0.35);
  transform: translateY(-5px);
  min-width: 24px;
}
.spell-entry .entry-cat {
  width: 24px; height: 24px;
  color: var(--or);
  flex: none;
  align-self: center;
}

.empty-state {
  text-align: center;
  font-family: var(--f-plume);
  font-size: 1.2rem;
  color: var(--ivoire-dim);
  padding: 60px 20px;
}

.index-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 10px 0 30px;
}

/* ─────────────── Page de sortilège ─────────────── */

.page-actions {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(180deg, var(--nuit) 65%, transparent);
}
.page-actions-spacer { flex: 1; }

.spell-page {
  position: relative;
  border: 1px solid var(--ligne);
  background:
    radial-gradient(ellipse 100% 50% at 50% 0%, rgba(141, 123, 168, 0.06), transparent 70%),
    var(--nuit-2);
  padding: 46px 26px 40px;
  margin-bottom: 40px;
  box-shadow: inset 0 0 0 4px var(--nuit-2), inset 0 0 0 5px var(--ligne-faible);
}
.spell-page .corner { width: 36px; height: 36px; }

.spell-title {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--or-pale);
  margin-bottom: 14px;
}

.spell-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 18px;
  font-family: var(--f-caps);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivoire-dim);
  margin-bottom: 10px;
}
.spell-meta .meta-item { display: inline-flex; align-items: center; gap: 7px; }
.spell-meta svg { width: 18px; height: 18px; color: var(--or); }

.spell-intent {
  font-family: var(--f-main);
  font-size: 1.22rem;
  text-align: center;
  color: var(--lavande);
  margin: 14px auto 4px;
  max-width: 46ch;
}

.divider {
  width: min(260px, 80%);
  height: 26px;
  margin: 26px auto;
  color: var(--or-sombre);
}

.spell-section-title {
  font-family: var(--f-caps);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--or);
  margin: 30px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.spell-section-title::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--ligne-faible);
}

.incantation {
  font-family: var(--f-main);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.6;
  text-align: center;
  color: var(--or-pale);
  white-space: pre-line;
  padding: 6px 10px;
}

.ingredients { list-style: none; }
.ingredients li {
  font-size: 1.32rem;
  padding: 5px 0 5px 30px;
  position: relative;
}
.ingredients li::before {
  content: "✦";
  position: absolute;
  left: 6px;
  color: var(--or);
  font-size: 0.85rem;
  top: 11px;
}

.steps { list-style: none; counter-reset: etape; }
.steps li {
  counter-increment: etape;
  font-size: 1.32rem;
  padding: 7px 0 7px 42px;
  position: relative;
}
.steps li::before {
  content: counter(etape);
  position: absolute;
  left: 4px;
  top: 7px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  font-family: var(--f-main);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--or-pale);
  border: 1px solid var(--or-sombre);
  border-radius: 50% 46% 48% 50% / 48% 50% 46% 52%;
}

.correspondences { list-style: none; }
.correspondences li {
  font-size: 1.28rem;
  padding: 4px 0;
  border-bottom: 1px dotted var(--ligne-faible);
}
.correspondences li:last-child { border-bottom: none; }

/* Pages de doctrine */
.epigraph {
  font-family: var(--f-main);
  font-weight: 600;
  font-size: 1.4rem;
  text-align: center;
  color: var(--or-pale);
  margin-top: 10px;
}
.epigraph-tr {
  font-family: var(--f-main);
  font-size: 1.05rem;
  text-align: center;
  color: var(--ivoire-dim);
  margin-top: 2px;
}
.chapter-para {
  font-size: 1.3rem;
  margin: 10px 0;
  color: var(--ivoire);
}
.chapter-list { list-style: none; margin: 8px 0; }
.chapter-list li {
  font-size: 1.28rem;
  padding: 6px 0 6px 28px;
  position: relative;
}
.chapter-list li::before {
  content: "✶";
  position: absolute;
  left: 4px;
  top: 12px;
  color: var(--or);
  font-size: 0.8rem;
}
.moon-guide { display: grid; gap: 20px; margin: 14px 0; }
.moon-row { display: flex; gap: 16px; align-items: flex-start; }
.moon-row-icon { width: 40px; height: 40px; flex: none; color: var(--or); margin-top: 4px; }
.moon-row-body { flex: 1; }
.moon-row-name {
  font-family: var(--f-caps);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--or-pale);
}
.moon-row-body .chapter-para { margin: 4px 0 6px; }
.moon-do { font-size: 1.2rem; color: var(--ivoire); padding-left: 4px; }
.moon-do::first-letter { color: var(--or); }
.moon-dont { font-size: 1.2rem; color: var(--lavande); padding-left: 4px; }

.spell-notes {
  font-size: 1.28rem;
  color: var(--ivoire-dim);
  white-space: pre-line;
}

.spell-dates {
  font-family: var(--f-plume);
  font-size: 0.95rem;
  color: rgba(230, 220, 195, 0.4);
  text-align: center;
  margin-top: 34px;
}

/* Photos façon polaroïds glissés dans le livre */
.spell-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  padding: 8px 0;
}
.polaroid {
  background: #efe8d8;
  padding: 8px 8px 26px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transform: rotate(-2deg);
  position: relative;
  border: none;
  cursor: zoom-in;
}
.polaroid:nth-child(even) { transform: rotate(2.2deg); }
.polaroid::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  width: 56px;
  height: 18px;
  background: rgba(201, 163, 92, 0.30);
  border-left: 1px dashed rgba(17, 13, 22, 0.2);
  border-right: 1px dashed rgba(17, 13, 22, 0.2);
}
.polaroid img {
  display: block;
  width: 132px;
  height: 132px;
  object-fit: cover;
}
.polaroid.zoomed {
  transform: none;
  cursor: zoom-out;
}
.polaroid.zoomed img { width: 100%; height: auto; max-height: 70vh; }
.spell-photos:has(.polaroid.zoomed) { display: block; }
.spell-photos:has(.polaroid.zoomed) .polaroid:not(.zoomed) { display: none; }

/* ─────────────── Écriture ─────────────── */

.edit-form {
  display: grid;
  gap: 24px;
  padding-bottom: 60px;
}

.edit-heading {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.05em;
  color: var(--or-pale);
  text-align: center;
  margin-top: 4px;
}

.field { display: grid; gap: 8px; border: none; }
.field-label {
  font-family: var(--f-caps);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--or);
}
.field-label small {
  font-family: var(--f-plume);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ivoire-dim);
  margin-left: 6px;
}

.field input, .field textarea {
  font-family: var(--f-main);
  font-size: 1.3rem;
  color: var(--ivoire);
  background: rgba(27, 20, 34, 0.6);
  border: 1px solid var(--ligne-faible);
  border-radius: 2px;
  padding: 10px 12px;
  width: 100%;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 16px rgba(201, 163, 92, 0.12);
}
.field ::placeholder { color: rgba(230, 220, 195, 0.30); }

.pick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--f-caps);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ivoire-dim);
  border: 1px solid var(--ligne-faible);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease;
}
.pick svg { width: 17px; height: 17px; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) {
  color: var(--or-pale);
  border-color: var(--or);
  background: rgba(201, 163, 92, 0.10);
}
.pick:has(input:focus-visible) { outline: 2px solid var(--or); outline-offset: 2px; }

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.photo-thumb {
  position: relative;
  width: 86px; height: 86px;
}
.photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  border: 1px solid var(--ligne);
}
.photo-thumb .thumb-x {
  position: absolute;
  top: -8px; right: -8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--rouge-cire);
  color: var(--ivoire);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.photo-thumb .thumb-x svg { width: 12px; height: 12px; }

.btn-photo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-caps);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ivoire-dim);
  border: 1px dashed var(--ligne);
  padding: 11px 16px;
  cursor: pointer;
  width: fit-content;
}
.btn-photo svg { width: 20px; height: 20px; color: var(--or); }
.btn-photo:hover { color: var(--or-pale); border-color: var(--or-sombre); }

/* ─────────────── Toast ─────────────── */

.toast {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom), 18px);
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  background: var(--encre-2);
  border: 1px solid var(--or-sombre);
  color: var(--ivoire);
  font-family: var(--f-plume);
  font-size: 1.05rem;
  padding: 12px 22px;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: apparition 300ms ease both;
}

/* ─────────────── Dédicace — pour elle seule ─────────────── */

.lien-dedicace {
  display: block;
  margin: 26px auto 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--or-sombre);
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.7;
  transition: color 500ms ease, opacity 500ms ease, transform 500ms ease;
  animation: coeur-bat 3.4s ease-in-out infinite;
}
.lien-dedicace:hover, .lien-dedicace:focus-visible {
  color: var(--rouge-cire);
  opacity: 1;
  transform: scale(1.15);
}
@keyframes coeur-bat {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}

.dedicace {
  position: relative;
  max-width: 560px;
  margin: 10px auto 50px;
  padding: 54px 30px 44px;
  text-align: center;
  border: 1px solid var(--ligne);
  background:
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(142, 59, 59, 0.10), transparent 70%),
    var(--nuit-2);
  box-shadow: inset 0 0 0 4px var(--nuit-2), inset 0 0 0 5px var(--ligne-faible), 0 20px 50px rgba(0, 0, 0, 0.5);
}
.dedicace .corner { width: 36px; height: 36px; color: var(--or-sombre); }
.dedicace-gemme {
  width: 40px; height: 40px;
  margin: 0 auto 26px;
  color: var(--or);
  filter: drop-shadow(0 0 12px rgba(201, 163, 92, 0.35));
}
.dedicace-texte {
  font-family: var(--f-main);
  font-size: 1.42rem;
  line-height: 1.6;
  color: var(--ivoire);
  margin: 0 auto 18px;
  max-width: 46ch;
}
.dedicace-texte:first-of-type {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: var(--or-pale);
  margin-bottom: 26px;
}
.dedicace-aveu {
  font-family: var(--f-plume);
  font-size: 1.35rem;
  color: var(--or-pale);
  margin-top: 26px;
}
.dedicace-divider { width: min(220px, 70%); height: 24px; margin: 10px auto 14px; color: var(--or-sombre); }
.dedicace-signature {
  font-family: var(--f-plume);
  font-size: 1.7rem;
  color: var(--or-pale);
  text-shadow: 0 0 18px rgba(201, 163, 92, 0.3);
}

/* ─────────────── Le ciel en direct ─────────────── */

.sky-now {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--f-caps);
  font-size: 0.63rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ivoire-dim);
  margin-top: 10px;
}
.sky-moon { width: 18px; height: 18px; color: var(--or); flex: none; }

/* Étoiles scintillantes (seconde couche du ciel) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 22% 30%, rgba(232, 213, 168, 0.8) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 68% 15%, rgba(232, 213, 168, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 80%, rgba(141, 123, 168, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 60%, rgba(232, 213, 168, 0.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 12% 55%, rgba(232, 213, 168, 0.5) 50%, transparent 51%);
  animation: scintille 5s ease-in-out infinite alternate;
}
@keyframes scintille {
  from { opacity: 0.15; }
  to { opacity: 0.85; }
}

/* ─────────────── Le tirage des runes ─────────────── */

.tirage-choix {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 24px 0;
}

.tirage-aire {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px;
  margin: 26px 0;
  min-height: 20px;
}

.pierre { perspective: 700px; text-align: center; }
.pierre-int {
  position: relative;
  width: 96px;
  height: 122px;
  transform-style: preserve-3d;
  transition: transform 900ms cubic-bezier(0.3, 0.9, 0.3, 1);
}
.pierre.flip .pierre-int { transform: rotateY(180deg); }
.pierre-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid var(--or-sombre);
  border-radius: 48% 52% 50% 50% / 44% 44% 56% 56%;
  background:
    radial-gradient(ellipse at 35% 30%, rgba(201, 163, 92, 0.14), transparent 60%),
    var(--encre-2);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
.pierre-dos svg { width: 26px; height: 26px; color: var(--or-sombre); }
.pierre-avers {
  transform: rotateY(180deg);
  grid-template-rows: 1fr auto;
  padding: 12px 6px 10px;
}
.pierre-rune { display: block; }
.pierre-rune svg { width: 52px; height: 52px; color: var(--or-pale); filter: drop-shadow(0 0 8px rgba(201, 163, 92, 0.4)); }
.pierre-rune.renversee svg { transform: rotate(180deg); }
.pierre-nom {
  font-family: var(--f-caps);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--or);
}
.pierre-etiquette {
  display: block;
  margin-top: 10px;
  font-family: var(--f-plume);
  font-size: 0.9rem;
  color: var(--ivoire-dim);
  max-width: 110px;
}

.tirage-registre { list-style: none; }
.tirage-registre li {
  font-size: 1.15rem;
  padding: 5px 0;
  border-bottom: 1px dotted var(--ligne-faible);
}
.tirage-registre li:last-child { border-bottom: none; }
.registre-date {
  font-family: var(--f-caps);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--or-sombre);
  margin-right: 10px;
}
.registre-vide { color: var(--ivoire-dim); font-family: var(--f-plume); }
.tirage-note {
  font-family: var(--f-plume);
  font-size: 0.95rem;
  color: rgba(230, 220, 195, 0.45);
  text-align: center;
  margin-top: 18px;
}

/* ─────────────── Ouverture cinématique ─────────────── */

#ouverture {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #0a070e;
  display: grid;
  place-items: center;
  opacity: 1;
  transition: opacity 650ms ease;
}
#ouverture.fin { opacity: 0; }
#ouverture img {
  width: min(300px, 68vw);
  height: auto;
  border-radius: 3px;
  opacity: 0;
  transform: scale(0.9);
  filter: brightness(0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}
#ouverture.joue img { animation: livre-souvre 2.2s ease forwards; }
@keyframes livre-souvre {
  0% { opacity: 0; transform: scale(0.9); filter: brightness(0.15); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: scale(1); filter: brightness(1); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 60px rgba(201, 163, 92, 0.25); }
}
#poussiere { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#poussiere i {
  position: absolute;
  bottom: 30%;
  border-radius: 50%;
  background: var(--or-pale);
  opacity: 0;
  animation-name: poussiere-monte;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}
@keyframes poussiere-monte {
  0% { opacity: 0; transform: translateY(30px); }
  30% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-90px); }
}

/* ─────────────── Mode veillée ─────────────── */

#veillee-voile {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  transition: opacity 900ms ease;
  background:
    radial-gradient(ellipse 120% 90% at 50% 110%, rgba(255, 147, 41, 0.10), transparent 60%),
    rgba(20, 8, 0, 0.28);
  mix-blend-mode: multiply;
}
body.veillee #veillee-voile { opacity: 1; animation: voile-tremble 4s ease-in-out infinite alternate; }
@keyframes voile-tremble {
  from { opacity: 0.92; }
  to { opacity: 1; }
}

#veillee-flamme {
  position: fixed;
  right: 26px;
  bottom: 84px;
  z-index: 81;
  width: 16px;
  height: 26px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms ease;
  background: radial-gradient(ellipse at 50% 80%, #ffd9a0 0%, #f0a848 45%, rgba(201, 100, 30, 0.6) 70%, transparent 75%);
  border-radius: 50% 50% 46% 54% / 68% 68% 32% 32%;
  filter: blur(0.6px);
}
#veillee-flamme::after {
  content: "";
  position: absolute;
  inset: -22px;
  background: radial-gradient(circle, rgba(255, 160, 60, 0.22), transparent 65%);
  border-radius: 50%;
}
body.veillee #veillee-flamme { opacity: 1; animation: flamme-danse 900ms ease-in-out infinite alternate; }
@keyframes flamme-danse {
  from { transform: scaleY(1) rotate(-2deg); }
  to { transform: scaleY(1.12) rotate(2.5deg); }
}

#btn-veillee {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 82;
  opacity: 0.55;
  transition: opacity 250ms ease, border-color 250ms ease;
}
#btn-veillee:hover, #btn-veillee.active { opacity: 1; border-color: var(--or); }
#btn-veillee.active { color: var(--or-pale); box-shadow: 0 0 16px rgba(255, 150, 50, 0.25); }

/* ─────────────── Recherche & pages cornées ─────────────── */

mark.hl {
  background: rgba(201, 163, 92, 0.28);
  color: var(--or-pale);
  border-radius: 2px;
  padding: 0 2px;
}

.entry-tag {
  font-family: var(--f-caps);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lavande);
  border: 1px solid rgba(141, 123, 168, 0.4);
  border-radius: 999px;
  padding: 3px 9px;
  align-self: center;
  flex: none;
}

.cornees-titre {
  font-family: var(--f-caps);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--or);
  text-align: center;
  margin: 18px 0 6px;
  list-style: none;
}

#btn-corner.active {
  color: var(--or-pale);
  border-color: var(--or);
  background: rgba(201, 163, 92, 0.12);
}

/* ─────────────── Divers ─────────────── */

@media (min-width: 560px) {
  .spell-page { padding: 54px 56px 48px; }
  .cover-title { font-size: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
