/* ==========================================================================
   CORAZEN — Jeux symboliques
   ========================================================================== */
:root {
  --night: #07061a;
  --night-2: #110d2c;
  --violet: #2a1f55;
  --plum: #4a2350;
  --gold: #d9b46a;
  --gold-2: #f3dca2;
  --gold-deep: #a07a36;
  --rose: #e9a7a0;
  --rose-deep: #b8656a;
  --cream: #f6efe2;
  --dim: rgba(246, 239, 226, 0.68);
  --line: rgba(217, 180, 106, 0.28);
  --glass: rgba(18, 14, 44, 0.62);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --f-title: "Cinzel", "Times New Roman", serif;
  --f-deco: "Cinzel Decorative", "Cinzel", serif;
  --f-body: "Cormorant Garamond", Georgia, serif;
  --f-ui: "Jost", "Segoe UI", system-ui, sans-serif;
  --topbar: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: #07061a; }
body {
  background: var(--night);
  color: var(--cream);
  font-family: var(--f-body);
  font-size: 18px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.theme-memoires {
  background:
    radial-gradient(ellipse 80% 60% at 50% 38%, rgba(74, 35, 80, 0.55), transparent 70%),
    radial-gradient(ellipse 60% 50% at 15% 90%, rgba(42, 31, 85, 0.6), transparent 70%),
    linear-gradient(180deg, #05041a 0%, #0c0a28 55%, #120b26 100%);
  background-attachment: fixed;
}
body.theme-peurs {
  background:
    radial-gradient(ellipse 70% 45% at 50% 105%, rgba(233, 167, 92, 0.32), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 38%, rgba(42, 31, 85, 0.55), transparent 70%),
    linear-gradient(180deg, #06051a 0%, #120e30 55%, #2a1730 100%);
  background-attachment: fixed;
}
body.theme-home {
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(233, 167, 160, 0.18), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 45%, rgba(74, 35, 80, 0.45), transparent 70%),
    linear-gradient(180deg, #06051a 0%, #0f0b2a 60%, #160c28 100%);
  background-attachment: fixed;
}

#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#fx  { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

a { color: inherit; }
button { font: inherit; color: inherit; }

/* ---------- Wordmark ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name {
  font-family: var(--f-title); font-weight: 600; letter-spacing: 0.32em;
  font-size: 15px; text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Top bar ---------- */
.topbar {
  position: relative; z-index: 20; height: var(--topbar);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 20px; gap: 12px;
  border-bottom: 1px solid rgba(217, 180, 106, 0.12);
  background: linear-gradient(180deg, rgba(7, 6, 26, 0.85), rgba(7, 6, 26, 0.35));
  backdrop-filter: blur(6px);
  transition: opacity .4s, transform .4s;
}
.topbar .left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar .right { display: flex; justify-content: flex-end; gap: 8px; }
.back {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-family: var(--f-ui); font-size: 13px; letter-spacing: .08em; color: var(--dim);
  padding: 6px 10px; border-radius: 999px; border: 1px solid transparent; transition: .25s;
}
.back:hover { color: var(--gold-2); border-color: var(--line); }
.game-title { text-align: center; line-height: 1.05; }
.game-title .eyebrow {
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .38em; text-transform: uppercase; color: var(--rose);
}
.game-title h1 {
  margin: 2px 0 0; font-family: var(--f-title); font-weight: 600; font-size: 22px; letter-spacing: .12em;
  background: linear-gradient(180deg, #fff6dd, var(--gold) 70%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); cursor: pointer;
  color: var(--gold-2); transition: background .2s, transform .2s, border-color .2s;
}
.icon-btn:hover { background: rgba(217, 180, 106, 0.12); border-color: var(--gold); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn[aria-pressed="false"] .on, .icon-btn[aria-pressed="true"] .off { display: none; }

/* ---------- Stage ---------- */
.stage {
  position: relative; z-index: 5;
  min-height: calc(100vh - var(--topbar));
  min-height: calc(100dvh - var(--topbar));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 16px 18px; gap: 6px;
}
.wheel-zone { position: relative; display: flex; flex-direction: column; align-items: center; }
.wheel-wrap {
  --size: min(calc(100vh - var(--topbar) - 200px), calc(100vw - 32px), 900px);
  --size: min(calc(100dvh - var(--topbar) - 200px), calc(100vw - 32px), 900px);
  position: relative; width: var(--size); height: var(--size); min-width: 260px; min-height: 260px;
  filter: drop-shadow(0 40px 60px rgba(0, 0, 0, 0.6));
  -webkit-tap-highlight-color: transparent;
}
.wheel-wrap::before { /* halo */
  content: ""; position: absolute; inset: -9%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(217, 180, 106, 0.22), rgba(233, 167, 160, 0.08) 45%, transparent 68%);
  animation: halo 6s ease-in-out infinite;
}
.is-spinning .wheel-wrap::before { animation-duration: 1.2s; }
@keyframes halo { 50% { transform: scale(1.05); opacity: .75; } }
#wheel { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; border-radius: 50%; }

/* Pointer (aiguille) */
.pointer {
  position: absolute; left: 50%; top: -3.2%; width: 8.5%; height: 13%;
  transform-origin: 50% 18%; transform: translateX(-50%) rotate(0deg);
  z-index: 6; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .55));
}
.pointer svg { width: 100%; height: 100%; display: block; overflow: visible; }

/* Hub (centre animé, ne tourne pas) */
.hub {
  position: absolute; left: 50%; top: 50%; width: var(--hub, 34%); height: var(--hub, 34%);
  transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden; z-index: 5; cursor: pointer;
  box-shadow: 0 0 0 3px rgba(20, 12, 4, .7), 0 0 30px rgba(0, 0, 0, .8) inset, 0 0 40px rgba(217, 180, 106, .25);
  isolation: isolate;
}

/* Stand (pied de la roue verticale) */
.stand {
  position: relative; z-index: -1; width: calc(var(--size, 600px) * 0.42); height: calc(var(--size, 600px) * 0.11);
  margin-top: calc(var(--size, 600px) * -0.06);
}
.stand svg { width: 100%; height: 100%; display: block; }

/* ---------- Controls ---------- */
.controls { position: relative; z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.spin-btn {
  position: relative; min-width: 280px; padding: 16px 38px 15px; border: 0; cursor: pointer; border-radius: 999px;
  font-family: var(--f-title); font-weight: 700; font-size: 19px; letter-spacing: .22em; text-transform: uppercase;
  color: #2a1606;
  background: linear-gradient(180deg, #fff1c4 0%, var(--gold-2) 18%, var(--gold) 55%, var(--gold-deep) 100%);
  box-shadow: 0 0 0 1px rgba(255, 240, 200, .5) inset, 0 -3px 0 rgba(0, 0, 0, .25) inset,
              0 10px 30px rgba(217, 180, 106, .35), 0 0 0 6px rgba(217, 180, 106, .12);
  transition: transform .15s, box-shadow .3s, filter .3s;
  overflow: hidden;
}
.spin-btn::after { /* reflet */
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .6), transparent);
  transform: skewX(-20deg); animation: shine 3.8s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.spin-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.spin-btn:active { transform: translateY(1px) scale(.98); }
.spin-btn .label-stop { display: none; }
.is-spinning .spin-btn {
  color: #fff; background: linear-gradient(180deg, #f2a39b 0%, var(--rose-deep) 55%, #7b3040 100%);
  box-shadow: 0 0 0 1px rgba(255, 210, 200, .45) inset, 0 -3px 0 rgba(0, 0, 0, .25) inset,
              0 10px 34px rgba(233, 120, 120, .45), 0 0 0 6px rgba(233, 167, 160, .16);
  animation: pulseStop 1s ease-in-out infinite;
}
.is-spinning .spin-btn .label-go { display: none; }
.is-spinning .spin-btn .label-stop { display: inline; }
.is-stopping .spin-btn { animation: none; filter: saturate(.4) brightness(.8); cursor: wait; }
@keyframes pulseStop { 50% { box-shadow: 0 0 0 1px rgba(255, 210, 200, .45) inset, 0 10px 44px rgba(233, 120, 120, .7), 0 0 0 12px rgba(233, 167, 160, .08); } }
.spin-btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.hint { margin: 0; font-family: var(--f-ui); font-size: 12px; letter-spacing: .14em; color: var(--dim); text-transform: uppercase; }
.hint kbd {
  font-family: var(--f-ui); font-size: 11px; padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--gold-2);
}

/* Last result badge */
.last {
  font-family: var(--f-ui); font-size: 13px; color: var(--dim); letter-spacing: .06em;
  display: flex; align-items: center; gap: 8px; min-height: 20px;
}
.last b { color: var(--gold-2); font-weight: 500; }

/* ---------- Clean screen (mode visio) ---------- */
body.clean .topbar { opacity: 0; transform: translateY(-100%); pointer-events: none; }
body.clean .hint, body.clean .last { opacity: 0; }
body.clean .stage { min-height: 100vh; min-height: 100dvh; margin-top: calc(var(--topbar) * -1); }
body.clean .wheel-wrap {
  --size: min(calc(100vh - 150px), calc(100vw - 32px), 1100px);
  --size: min(calc(100dvh - 150px), calc(100vw - 32px), 1100px);
}
.clean-exit {
  position: fixed; top: 14px; right: 14px; z-index: 30; opacity: 0; pointer-events: none; transition: opacity .3s;
}
body.clean .clean-exit { opacity: .35; pointer-events: auto; }
body.clean .clean-exit:hover { opacity: 1; }

/* ---------- Side panel ---------- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 40;
  background: linear-gradient(180deg, rgba(17, 13, 44, .97), rgba(12, 8, 30, .98));
  border-left: 1px solid var(--line); box-shadow: -30px 0 80px rgba(0, 0, 0, .5);
  transform: translateX(105%); transition: transform .45s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column;
}
.panel.open { transform: none; }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid rgba(217, 180, 106, .14); }
.panel h2 { margin: 0; font-family: var(--f-title); font-size: 16px; letter-spacing: .18em; color: var(--gold-2); font-weight: 600; }
.panel .body { padding: 6px 20px 24px; overflow-y: auto; flex: 1; }
.panel h3 { margin: 22px 0 10px; font-family: var(--f-ui); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--rose); font-weight: 500; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed rgba(217, 180, 106, .12); }
.opt label { font-family: var(--f-ui); font-size: 14px; color: var(--cream); cursor: pointer; }
.opt small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 2; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line); transition: .25s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--dim); transition: .25s; }
.switch input:checked + span { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); }
.switch input:checked + span::after { left: 23px; background: #fff7e0; }
.switch input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 11px; font-family: var(--f-ui); font-size: 12px; cursor: pointer; color: var(--dim); }
.seg button.active { background: rgba(217, 180, 106, .2); color: var(--gold-2); }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history li {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid rgba(217, 180, 106, .1);
  font-family: var(--f-ui); font-size: 14px; cursor: pointer; transition: background .2s;
}
.history li:hover { background: rgba(217, 180, 106, .08); }
.history .num { font-family: var(--f-title); color: var(--gold); text-align: center; font-size: 15px; }
.history time { color: var(--dim); font-size: 12px; }
.history li.empty { display: block; cursor: default; background: none; border: 0; padding: 4px 0; }
.empty { color: var(--dim); font-family: var(--f-ui); font-size: 13px; font-style: italic; }
.text-btn {
  margin-top: 12px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  font-family: var(--f-ui); font-size: 12px; letter-spacing: .1em; color: var(--dim); cursor: pointer;
}
.text-btn:hover { color: var(--gold-2); border-color: var(--gold); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-family: var(--f-ui); font-size: 13px; color: var(--dim); align-items: center; }
.keys kbd { font-family: var(--f-ui); font-size: 11px; padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line); color: var(--gold-2); text-align: center; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.show { opacity: 1; pointer-events: auto; }

/* ---------- Reveal modal ---------- */
.reveal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% 45%, rgba(40, 24, 70, .9), rgba(4, 3, 14, .97));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .5s;
}
.reveal.show { opacity: 1; pointer-events: auto; }
.reveal-inner {
  display: grid; grid-template-columns: auto minmax(0, 440px); gap: clamp(20px, 4vw, 56px); align-items: center;
  max-width: 980px; width: 100%;
}
.card-scene { perspective: 1400px; }
.tcard {
  --w: min(300px, 34vh, 70vw);
  position: relative; width: var(--w); aspect-ratio: 7 / 12; transform-style: preserve-3d;
  transform: rotateY(180deg) scale(.6); opacity: 0;
  transition: transform 1.1s cubic-bezier(.2, .9, .25, 1.15), opacity .5s;
}
.reveal.show .tcard { transform: rotateY(0) scale(1); opacity: 1; }
.tcard .face, .tcard .back-face {
  position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
}
.tcard .back-face {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, rgba(217, 180, 106, .18) 0 2px, transparent 2px 14px),
    repeating-linear-gradient(-45deg, rgba(217, 180, 106, .18) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #2a1f55, #120b2a);
  border: 2px solid var(--gold);
}
.tcard .face {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 236, 190, .9), rgba(243, 220, 162, .2) 38%, transparent 62%),
    linear-gradient(170deg, #f9f0dc, #ecdcb8 60%, #dcc595);
  color: #2a1606; box-shadow: 0 0 0 2px var(--gold-deep), 0 0 0 7px #f4e7c8, 0 0 0 9px var(--gold-deep), var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 7% 7% 6%;
}
.tcard .face::before {
  content: ""; position: absolute; inset: 9px; border: 1.5px solid rgba(160, 122, 54, .7); border-radius: 10px; pointer-events: none;
}
.tcard .c-num { font-family: var(--f-title); font-weight: 700; font-size: calc(var(--w) * .1); letter-spacing: .08em; color: #6b2a2a; }
.tcard .c-art {
  width: 74%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle, #fff8e6, #f0dcac 70%);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 0 0 6px rgba(160, 122, 54, .25), 0 0 40px rgba(217, 180, 106, .7);
}
.tcard .c-art::before {
  content: ""; position: absolute; inset: -14%; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(160, 122, 54, .35) 0 2deg, transparent 2deg 15deg);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%, #000 70%, transparent 72%);
          mask: radial-gradient(circle, transparent 58%, #000 60%, #000 70%, transparent 72%);
  animation: spinSlow 30s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.tcard .c-glyph { font-size: calc(var(--w) * .3); line-height: 1; color: #6b2a2a; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Noto Sans Symbols", "OpenSymbol", var(--f-body); }
.tcard .c-emoji { font-size: calc(var(--w) * .33); line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.tcard .c-name {
  width: 100%; text-align: center; font-family: var(--f-title); font-weight: 700; font-size: calc(var(--w) * .078);
  letter-spacing: .1em; text-transform: uppercase; padding: 8px 4px; border-top: 1.5px solid rgba(160, 122, 54, .6); color: #2a1606;
}
.reveal-text { text-align: left; }
.reveal-text .eyebrow { font-family: var(--f-ui); font-size: 12px; letter-spacing: .4em; text-transform: uppercase; color: var(--rose); }
.reveal-text h2 {
  margin: 8px 0 4px; font-family: var(--f-title); font-weight: 600; font-size: clamp(32px, 5vw, 58px); line-height: 1.05; letter-spacing: .04em;
  background: linear-gradient(180deg, #fff6dd, var(--gold) 70%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.reveal-text .numline { font-family: var(--f-title); color: var(--gold); letter-spacing: .2em; font-size: 15px; }
.keywords { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; padding: 0; list-style: none; }
.keywords li {
  font-family: var(--f-ui); font-size: 13px; letter-spacing: .08em; padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(217, 180, 106, .08); color: var(--gold-2);
}
.reveal-text p.msg { font-size: clamp(20px, 2.2vw, 26px); line-height: 1.4; font-style: italic; color: var(--cream); margin: 0 0 24px; }
.reveal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.reveal-text > * { opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; }
.reveal.show .reveal-text > * { opacity: 1; transform: none; }
.reveal.show .reveal-text > *:nth-child(2) { transition-delay: .55s; }
.reveal.show .reveal-text > *:nth-child(3) { transition-delay: .7s; }
.reveal.show .reveal-text > *:nth-child(4) { transition-delay: .85s; }
.reveal.show .reveal-text > *:nth-child(5) { transition-delay: 1s; }
.reveal.show .reveal-text > *:nth-child(6) { transition-delay: 1.15s; }
.reveal.show .reveal-text > *:first-child { transition-delay: .4s; }
.btn-ghost, .btn-gold {
  border-radius: 999px; padding: 12px 22px; font-family: var(--f-ui); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; cursor: pointer;
}
.btn-ghost { background: none; border: 1px solid var(--line); color: var(--gold-2); }
.btn-ghost:hover { border-color: var(--gold); background: rgba(217, 180, 106, .08); }
.btn-gold { border: 0; color: #2a1606; background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, var(--gold-deep)); font-weight: 600; }
.btn-gold:hover { filter: brightness(1.08); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); z-index: 70; opacity: 0;
  padding: 12px 20px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px);
  font-family: var(--f-ui); font-size: 14px; color: var(--gold-2); transition: .35s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.powered {
  position: relative; z-index: 5; text-align: center; padding: 6px 0 14px;
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: rgba(246, 239, 226, .45);
}
.powered b { color: var(--gold); font-weight: 500; }
body.clean .powered { position: fixed; bottom: 4px; left: 0; right: 0; }

/* ==========================================================================
   CENTRE 1 — La porte qui s'ouvre (22 Mémoires)
   ========================================================================== */
.portal { position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, #1b1745, #070617 75%); }
.portal .stars { position: absolute; inset: 0; background-image:
  radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent),
  radial-gradient(1.5px 1.5px at 85% 60%, #fff8d0, transparent), radial-gradient(1px 1px at 12% 70%, #fff, transparent),
  radial-gradient(1px 1px at 40% 12%, #fff, transparent), radial-gradient(1.5px 1.5px at 60% 85%, #ffeec0, transparent),
  radial-gradient(1px 1px at 30% 88%, #fff, transparent), radial-gradient(1px 1px at 90% 35%, #fff, transparent);
  animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .45; } }
.portal .moon {
  position: absolute; width: 13%; aspect-ratio: 1; top: 9%; right: 17%; border-radius: 50%;
  box-shadow: inset -5px 3px 0 0 #f6e7b8; filter: drop-shadow(0 0 6px rgba(246, 231, 184, .8)); transform: rotate(-20deg);
}
.portal .mist {
  position: absolute; left: -20%; right: -20%; bottom: 4%; height: 22%;
  background: radial-gradient(ellipse at 50% 60%, rgba(180, 170, 230, .35), transparent 70%);
  filter: blur(4px); animation: mist 9s ease-in-out infinite alternate;
}
@keyframes mist { to { transform: translateX(8%); opacity: .7; } }
.portal .ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 17%;
  background: linear-gradient(180deg, #1a1336, #09071a);
}
.doorway {
  position: absolute; left: 50%; top: 17%; width: 44%; height: 66%; transform: translateX(-50%);
  border-radius: 50% 50% 4% 4% / 32% 32% 4% 4%;
  box-shadow: 0 0 0 6px #3b2a18, 0 0 0 9px #a07a36, 0 0 0 11px #2a1d10, 0 0 24px 10px rgba(0, 0, 0, .7);
  overflow: hidden; perspective: 600px; background: #000;
}
.doorway .beyond {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 55%, #fffbe8 0%, #ffe9a8 22%, #f0b867 45%, #7d3f6a 80%, #2a1440 100%);
  animation: beyondPulse 3s ease-in-out infinite;
}
@keyframes beyondPulse { 50% { filter: brightness(1.18); } }
.doorway .rays {
  position: absolute; inset: -40%;
  background: repeating-conic-gradient(from 0deg at 50% 55%, rgba(255, 250, 220, .5) 0 4deg, transparent 4deg 18deg);
  animation: spinSlow 24s linear infinite; mix-blend-mode: screen; opacity: .7;
}
.key {
  position: absolute; left: 50%; top: 52%; width: 80%; transform: translate(-50%, -50%) rotate(-8deg);
  filter: drop-shadow(0 0 6px rgba(255, 230, 160, 1)) drop-shadow(0 0 16px rgba(255, 190, 90, .8));
  animation: keyFloat 3.2s ease-in-out infinite;
}
@keyframes keyFloat { 50% { transform: translate(-50%, -58%) rotate(8deg); } }
.leaf {
  position: absolute; top: 0; bottom: 0; width: 50%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .35), transparent 18%, transparent 82%, rgba(0, 0, 0, .35)),
    repeating-linear-gradient(90deg, #3a2414 0 6px, #43291a 6px 9px, #321e10 9px 15px),
    #3a2414;
  transition: transform 1.6s cubic-bezier(.6, .05, .25, 1);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .6);
}
.leaf::before, .leaf::after { /* panneaux moulurés */
  content: ""; position: absolute; left: 18%; right: 18%; border: 2px solid rgba(217, 180, 106, .55);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .4); border-radius: 3px;
}
.leaf::before { top: 22%; height: 30%; }
.leaf::after { top: 60%; height: 28%; }
.leaf.l { left: 0; transform-origin: 0 50%; border-right: 1px solid #1b0f06; transform: rotateY(-7deg); }
.leaf.r { right: 0; transform-origin: 100% 50%; border-left: 1px solid #1b0f06; transform: rotateY(7deg); }
.leaf .knob {
  position: absolute; top: 55%; width: 9%; aspect-ratio: 1; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 35% 35%, #fff2c0, var(--gold) 50%, #6b4c1d);
  box-shadow: 0 0 6px rgba(255, 220, 140, .7);
}
.leaf.l .knob { right: 9%; }
.leaf.r .knob { left: 9%; }
.leaf .keyhole {
  position: absolute; top: 63%; width: 5%; height: 7%; z-index: 2;
  background: radial-gradient(circle at 50% 30%, #ffdd88 30%, transparent 34%), linear-gradient(#ffdd88, #ffdd88) 50% 100% / 34% 60% no-repeat;
  filter: drop-shadow(0 0 4px #ffcc66); opacity: .85; animation: beyondPulse 2s ease-in-out infinite;
}
.leaf.l .keyhole { right: 11%; }
.leaf.r { display: block; }
.leaf.r .keyhole { display: none; }
.door-glow { /* lumière qui filtre entre les battants */
  position: absolute; left: 50%; top: 0; bottom: 0; width: 6%; transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(255, 240, 190, .95) 30%, rgba(255, 240, 190, .95) 70%, transparent);
  filter: blur(3px); animation: beyondPulse 2.4s ease-in-out infinite; z-index: 1; transition: opacity .6s;
}
.light-spill {
  position: absolute; left: 50%; bottom: 0; width: 120%; height: 30%; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 220, 150, .35), transparent 65%); opacity: .4; transition: opacity 1.4s;
}
.hub.open .leaf.l { transform: rotateY(-108deg); }
.hub.open .leaf.r { transform: rotateY(108deg); }
.hub.open .door-glow { opacity: 0; }
.hub.open .light-spill { opacity: 1; }
.hub.open .key { animation: keyReveal 1.8s .5s cubic-bezier(.2, .9, .3, 1.2) both, keyFloat 3.2s 2.3s ease-in-out infinite; }
@keyframes keyReveal { 0% { transform: translate(-50%, -50%) scale(.6) rotate(-30deg); } 100% { transform: translate(-50%, -50%) scale(1.15) rotate(-8deg); } }
.is-spinning .leaf.l { transform: rotateY(-14deg); }
.is-spinning .leaf.r { transform: rotateY(14deg); }

/* ==========================================================================
   CENTRE 2 — La grille de prison qui s'ouvre sur le champ de blé (12 Peurs)
   ========================================================================== */
.field { position: absolute; inset: 0; transition: filter 1.6s; filter: brightness(.42) saturate(.55); }
.hub.open .field { filter: none; }
.field svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.field .sun-rays { transform-origin: 50% 36%; animation: spinSlow 40s linear infinite; }
.field .wheat-row { animation: sway 3.6s ease-in-out infinite alternate; transform-origin: 50% 100%; transform-box: fill-box; }
.field .wheat-row.r2 { animation-duration: 4.4s; animation-delay: -1s; }
.field .wheat-row.r3 { animation-duration: 5.2s; animation-delay: -2s; }
@keyframes sway { from { transform: skewX(-3deg); } to { transform: skewX(4deg); } }
.field .bird { animation: fly 14s linear infinite; }
.field .bird.b2 { animation-delay: -6s; }
@keyframes fly { from { transform: translateX(-30px); } to { transform: translateX(260px); } }
.cell-shadow { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, transparent 30%, rgba(0, 0, 0, .55) 80%); transition: opacity 1.6s; }
.hub.open .cell-shadow { opacity: 0; }
.gate { position: absolute; inset: 0; perspective: 700px; }
.gate .half {
  position: absolute; top: 0; bottom: 0; width: 50%;
  transition: transform 1.7s cubic-bezier(.65, .05, .25, 1);
}
.gate .half svg { width: 100%; height: 100%; display: block; }
.gate .half.l { left: 0; transform-origin: 0 50%; }
.gate .half.r { right: 0; transform-origin: 100% 50%; }
.hub.open .gate .half.l { transform: rotateY(-115deg); }
.hub.open .gate .half.r { transform: rotateY(115deg); }
.is-spinning .gate .half.l { animation: rattle .18s linear infinite; }
.is-spinning .gate .half.r { animation: rattle .18s linear infinite reverse; }
@keyframes rattle { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(1.5px); } }
.gate .lock {
  position: absolute; left: 50%; top: 50%; width: 15%; aspect-ratio: 1 / 1.2; transform: translate(-50%, -50%); z-index: 3;
  transition: transform .8s, opacity .8s;
}
.hub.open .gate .lock { transform: translate(-50%, 160%) rotate(35deg); opacity: 0; }

/* ==========================================================================
   ACCUEIL
   ========================================================================== */
.home { position: relative; z-index: 5; max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }
.home-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; }
.home-top nav { font-family: var(--f-ui); font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--dim); }
.hero { text-align: center; padding: clamp(30px, 7vh, 80px) 0 clamp(30px, 6vh, 60px); }
.hero .eyebrow { font-family: var(--f-ui); font-size: 12px; letter-spacing: .5em; text-transform: uppercase; color: var(--rose); }
.hero h1 {
  font-family: var(--f-deco); font-weight: 700; font-size: clamp(38px, 7vw, 86px); line-height: 1.02; margin: 14px 0 18px; letter-spacing: .02em;
  background: linear-gradient(180deg, #fff6dd 10%, var(--gold) 65%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { max-width: 640px; margin: 0 auto; font-size: clamp(19px, 2vw, 23px); line-height: 1.5; color: var(--dim); font-style: italic; }
.ornament { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 26px auto 0; color: var(--gold); }
.ornament::before, .ornament::after { content: ""; width: 90px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { transform: scaleX(-1); }
.games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 3vw, 34px); }
.game-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none;
  padding: 34px 28px 30px; border-radius: 28px; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, rgba(42, 31, 85, .55), rgba(17, 13, 44, .75));
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), border-color .4s, box-shadow .4s;
}
.game-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .5s;
  background: radial-gradient(circle at 50% 30%, rgba(217, 180, 106, .25), transparent 60%);
}
.game-card:hover { transform: translateY(-6px); border-color: var(--gold); box-shadow: 0 40px 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(217, 180, 106, .3); }
.game-card:hover::before { opacity: 1; }
.game-card .mini { width: min(300px, 70%); aspect-ratio: 1; position: relative; margin-bottom: 26px; }
.game-card .mini canvas { width: 100%; height: 100%; display: block; animation: spinSlow 60s linear infinite; }
.game-card:hover .mini canvas { animation-duration: 8s; }
.game-card .mini .hub { width: 34%; height: 34%; cursor: inherit; }
.game-card .tag { font-family: var(--f-ui); font-size: 11px; letter-spacing: .4em; text-transform: uppercase; color: var(--rose); }
.game-card h2 {
  margin: 8px 0 10px; font-family: var(--f-title); font-weight: 600; font-size: clamp(26px, 3vw, 36px); letter-spacing: .08em;
  background: linear-gradient(180deg, #fff6dd, var(--gold) 70%, var(--gold-deep)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.game-card p { margin: 0 0 22px; color: var(--dim); font-size: 19px; line-height: 1.45; max-width: 400px; }
.game-card .cta { pointer-events: none; }
.howto { margin-top: clamp(40px, 8vh, 80px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.howto > div { padding: 22px; border-radius: 20px; border: 1px solid rgba(217, 180, 106, .16); background: rgba(255, 255, 255, .02); }
.howto .n { font-family: var(--f-deco); font-size: 30px; color: var(--gold); }
.howto h3 { margin: 6px 0 6px; font-family: var(--f-title); font-size: 17px; letter-spacing: .1em; color: var(--cream); font-weight: 600; }
.howto p { margin: 0; color: var(--dim); font-size: 17px; line-height: 1.45; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .games, .howto { grid-template-columns: 1fr; }
  .reveal-inner { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .reveal-text { text-align: center; }
  .keywords, .reveal-actions { justify-content: center; }
  .tcard { --w: min(220px, 30vh, 60vw); }
}
@media (max-width: 640px) {
  :root { --topbar: 56px; }
  .topbar { padding: 0 10px; grid-template-columns: auto 1fr auto; }
  .back span, .topbar .brand-name { display: none; }
  .game-title h1 { font-size: 15px; white-space: nowrap; letter-spacing: .06em; }
  .game-title .eyebrow { font-size: 9px; letter-spacing: .25em; }
  .icon-btn { width: 34px; height: 34px; }
  .topbar .right { gap: 4px; }
  .spin-btn { min-width: 0; width: 100%; max-width: 340px; font-size: 16px; padding: 14px 20px; }
  .hint { display: none; }
  .wheel-wrap { --size: min(calc(100vw - 24px), calc(100dvh - var(--topbar) - 170px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; }
}

/* ---------- Accessibilité ---------- */
.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; }

/* ---------- Filtres de l'accueil ---------- */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 28px; }
.filters:empty { display: none; }
.chip {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: var(--dim); cursor: pointer;
  padding: 9px 18px; border-radius: 999px; font-family: var(--f-ui); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  transition: .25s;
}
.chip:hover { color: var(--gold-2); border-color: var(--gold); }
.chip[aria-selected="true"] { background: linear-gradient(180deg, rgba(243, 220, 162, .25), rgba(160, 122, 54, .25)); color: var(--gold-2); border-color: var(--gold); }
.chip .count { opacity: .6; margin-left: 6px; }
.game-card.soon { cursor: default; opacity: .7; }
.game-card.soon:hover { transform: none; }
.game-card .icon-preview {
  width: min(300px, 70%); aspect-ratio: 1; margin-bottom: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: clamp(70px, 9vw, 120px); border: 1px solid var(--line);
  background: radial-gradient(circle, rgba(217, 180, 106, .18), rgba(42, 31, 85, .4) 60%, transparent 72%);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.badge-soon {
  position: absolute; top: 18px; right: 18px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--rose);
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--rose);
}
.games.single { grid-template-columns: minmax(0, 560px); justify-content: center; }
.game-card { animation: cardIn .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px); } }

/* ---------- Menu « Tous les jeux » (pages de jeu) ---------- */
.menu {
  position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 50% 40%, rgba(40, 24, 70, .94), rgba(4, 3, 14, .98));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .4s;
}
.menu.show { opacity: 1; pointer-events: auto; }
.menu-inner { width: min(980px, 100%); max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.menu-head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.menu-head .eyebrow { font-family: var(--f-ui); font-size: 11px; letter-spacing: .4em; text-transform: uppercase; color: var(--rose); }
.menu-head h2 {
  margin: 4px 0 0; font-family: var(--f-title); font-weight: 600; font-size: clamp(24px, 3vw, 34px); letter-spacing: .1em;
  background: linear-gradient(180deg, #fff6dd, var(--gold) 70%, var(--gold-deep)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.menu-grid { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 280px)); justify-content: center; gap: 16px; }
.menu-item {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 20px; text-decoration: none;
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(42, 31, 85, .5), rgba(17, 13, 44, .7));
  transform: translateY(14px); opacity: 0; transition: transform .5s, opacity .5s, border-color .3s, background .3s;
}
.menu.show .menu-item { transform: none; opacity: 1; }
.menu-item:hover, .menu-item:focus-visible { border-color: var(--gold); background: linear-gradient(180deg, rgba(74, 35, 80, .6), rgba(17, 13, 44, .8)); outline: none; }
.menu-item .mi-icon { font-size: 34px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.menu-item .mi-tag { font-family: var(--f-ui); font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: var(--rose); }
.menu-item .mi-title { font-family: var(--f-title); font-size: 20px; letter-spacing: .06em; color: var(--gold-2); font-weight: 600; }
.menu-item .mi-cat { font-family: var(--f-ui); font-size: 12px; color: var(--dim); }
.menu-item.current { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(217, 180, 106, .4), 0 0 30px rgba(217, 180, 106, .15); }
.menu-item.current::after {
  content: "En cours"; position: absolute; top: 14px; right: 14px; font-family: var(--f-ui); font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: #2a1606; background: var(--gold); padding: 3px 9px; border-radius: 999px;
}
.menu-item.soon { opacity: .55; cursor: default; }
.menu-home { text-decoration: none; }
.cta-link { display: inline-block; margin-top: 28px; text-decoration: none; font-style: normal; }
