/* Séance: a rough cut-paper ouija board in midnight, violet and antique gold, lying on dark paper among
   tarot cards and loose stars, seen from above. */

body[data-game="seance"] {
  --se-ink: #d4ad55;      /* antique gold: the board's letters */
  --se-pale: #ecd391;
  --se-violet: #5b4398;
  background-color: #110d1d;
  background-image: radial-gradient(ellipse 55% 50% at 50% 46%, rgba(91, 67, 152, 0.3), transparent 72%), var(--noise);
  background-attachment: fixed;
}
body[data-game="seance"]::before { display: none; }
body[data-game="seance"] .topbar, body[data-game="seance"] .stage { position: relative; z-index: 2; }
body[data-game="seance"] .topbar { position: sticky; border-bottom-color: transparent; }   /* the lifting board sweeps over the nav for a moment, on purpose */
/* no dotted scissors line here: the table's near edge runs under the nav instead (.se-edge) */
body[data-game="seance"] .topbar::after { display: none; }
body[data-game="seance"] .icon-btn svg { stroke: var(--paper); }
body[data-game="seance"] .icon-btn:hover { background: rgba(241, 234, 216, 0.12); }
body[data-game="seance"] .game-tab:not(.active) { opacity: 0.7; }
body[data-game="seance"] .game-tab:not(.active):hover, body[data-game="seance"] .game-tab:not(.active):focus-visible { opacity: 1; filter: none; }

/* the paper the board lies on: candlelight printed as warm halftone, breathing gently */
.se-room { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.se-room::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(212, 173, 85, 0.2) 28%, transparent 31%);
  background-size: 9px 9px;
  -webkit-mask-image: radial-gradient(ellipse 50% 46% at 50% 48%, #000 0%, rgba(0, 0, 0, 0.4) 45%, transparent 75%);
  mask-image: radial-gradient(ellipse 50% 46% at 50% 48%, #000 0%, rgba(0, 0, 0, 0.4) 45%, transparent 75%);
  animation: se-breathe 7s ease-in-out infinite;
}
.se-room::after { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 48%, transparent 50%, rgba(0, 0, 0, 0.5) 100%); }
@keyframes se-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* the table, seen from above: dark wood below the edge, the floor in shadow above it */
.se-tabletop {
  position: absolute; left: 0; right: 0; top: var(--se-edge, 62px); bottom: var(--se-floor, 34px);
  background-color: #241812;
  background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 23px, rgba(255, 220, 170, 0.04) 23px 24px, transparent 24px 61px), var(--noise);
}
/* the near edge of the table: a rounded wooden lip with a lit top, cut from paper */
.se-edge {
  position: absolute; left: -10px; right: -10px; top: calc(var(--se-edge, 62px) - 9px); height: 20px;
  background-color: #3a2618;
  background-image: linear-gradient(#5c3d26 0 5px, #3a2618 5px 15px, #23160e 15px), repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 2px, transparent 2px 41px);
  clip-path: polygon(0 8%, 12% 0, 31% 10%, 52% 2%, 70% 9%, 88% 1%, 100% 7%, 100% 100%, 0 100%);
  filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.55));
}
/* the table's front face, seen just below its bottom lip: a band of darker wood above the floor */
.se-apron {
  position: absolute; left: -10px; right: -10px; bottom: calc(var(--se-floor, 34px) - 27px); height: 18px;
  background-color: #1d130d;
  background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.25) 0 2px, transparent 2px 53px), linear-gradient(rgba(0, 0, 0, 0.35), transparent 60%);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.5);
}
/* the far edge of the table along the bottom of the screen, the same lip turned the other way */
.se-edge.bottom {
  top: auto; bottom: calc(var(--se-floor, 34px) - 11px);
  background-image: linear-gradient(#23160e 0 5px, #3a2618 5px 15px, #5c3d26 15px), repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 2px, transparent 2px 41px);
  clip-path: polygon(0 0, 100% 0, 100% 93%, 86% 100%, 66% 91%, 47% 99%, 28% 90%, 10% 98%, 0 92%);
  filter: drop-shadow(0 -4px 4px rgba(0, 0, 0, 0.5));
}
/* the cloth, laid on the diagonal: it drapes over the table's lip and stops where the table does,
   darkening where it folds down over the edge */
.se-cloth-holder { position: absolute; left: 0; right: 0; top: calc(var(--se-edge, 62px) - 9px); bottom: calc(var(--se-floor, 34px) - 11px); overflow: hidden; }
.se-cloth-holder::before { content: ''; position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 22px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.15) 40%, rgba(0, 0, 0, 0.6)); pointer-events: none; }
.se-cloth-holder::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 22px; background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.15) 60%, transparent); pointer-events: none; }
.se-cloth { position: absolute; left: 50%; top: calc(46vh + 9px); width: min(118vmin, 1150px); height: auto; aspect-ratio: 1; transform: translate(-50%, -50%) rotate(45deg); }

/* tea lights on the table, seen from above: a tin cup, the wax, a small flame and its glow */
.se-tea { position: absolute; width: clamp(62px, 6.6vw, 100px); height: auto; aspect-ratio: 1; overflow: visible; }
.se-tea.t1 { left: 8vw; top: calc(var(--se-edge, 62px) + 1vh); }
.se-tea.t2 { left: 9vw; bottom: 1vh; }
.se-tea.t3 { right: 8vw; top: calc(var(--se-edge, 62px) + 1vh); }
.se-tea.t4 { right: 9vw; bottom: 1vh; }
.se-tea.t5 { display: none; }
.se-tea-glow { transform-box: fill-box; transform-origin: center; animation: se-tea-glow 2.4s ease-in-out infinite alternate; }
.se-tea-flame { transform-box: fill-box; transform-origin: 50% 85%; animation: se-tea-flicker 1.3s steps(1, end) infinite; }
.se-tea.t2 .se-tea-glow, .se-tea.t2 .se-tea-flame { animation-delay: -0.6s; }
.se-tea.t3 .se-tea-glow, .se-tea.t3 .se-tea-flame { animation-delay: -1.1s; }
.se-tea.t4 .se-tea-glow, .se-tea.t4 .se-tea-flame { animation-delay: -0.3s; }
.se-tea.t5 .se-tea-glow, .se-tea.t5 .se-tea-flame { animation-delay: -0.9s; }
@keyframes se-tea-glow { from { transform: scale(0.9); opacity: 0.75; } to { transform: scale(1.08); opacity: 1; } }
@keyframes se-tea-flicker { 0% { transform: rotate(-6deg) scale(1); } 30% { transform: rotate(5deg) scale(0.92, 1.08); } 60% { transform: rotate(-2deg) scale(1.05, 0.94); } 85% { transform: rotate(7deg) scale(0.95, 1.04); } }

/* flat paper things lying around the board */.se-tarot { position: absolute; width: clamp(90px, 10vw, 160px); height: auto; aspect-ratio: 150 / 250; }
.se-tarot.left { left: clamp(-40px, 1vw, 40px); top: 18vh; transform: rotate(-14deg); }
.se-tarot.left2 { left: clamp(-60px, -1vw, 10px); top: 52vh; transform: rotate(8deg); }
.se-tarot.right { right: clamp(-40px, 1vw, 40px); top: 30vh; transform: rotate(11deg); }
@media (max-width: 900px) { .se-tarot.left2 { display: none; } .se-tarot { opacity: 0.6; } }

/* the whole board fits on screen: no scrolling */
.se-stage { max-width: 980px; padding-top: 14px; padding-bottom: 12px; display: flex; justify-content: center; }
.se-table {
  position: relative; perspective: 1100px; perspective-origin: 50% 40%;
  width: min(900px, 100%, calc((100vh - 110px) * 1.515));
  width: min(900px, 100%, calc((100dvh - 110px) * 1.515));
}
/* the board has two sides and some thickness: it lifts off the table, turns over, and settles */
.se-lift { position: relative; transform-style: preserve-3d; }
.se-table.lifting .se-lift { animation: se-lift 1.15s cubic-bezier(.45, .05, .35, 1); }
@keyframes se-lift {
  0% { transform: translateZ(0) rotateX(0); }
  45% { transform: translateZ(110px) rotateX(6deg); }
  80% { transform: translateZ(30px) rotateX(2deg); }
  92% { transform: translateZ(-6px) rotateX(-0.5deg); }
  100% { transform: translateZ(0) rotateX(0); }
}
.se-flip { position: relative; transform-style: preserve-3d; transition: transform 1.05s cubic-bezier(.55, .05, .3, 1); transform: rotate(-0.6deg); }
.se-flip.flipped { transform: rotateY(180deg) rotate(0.6deg); }
.se-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.se-front { transform: translateZ(5px); }
.se-back { transform: rotateY(180deg) translateZ(5px) !important; }
/* the board's edges, seen side-on as it turns */
.se-side { position: absolute; top: 3%; bottom: 3%; width: 10px; background: #0c0913; box-shadow: inset 0 0 0 1px rgba(212, 173, 85, 0.35); opacity: 0; }
.se-side.left { left: 1.5%; margin-left: -5px; transform: rotateY(90deg); }
.se-side.right { right: 1.5%; margin-right: -5px; transform: rotateY(90deg); }
/* only while it turns: lying flat, the edges would peek out as slivers either side */
.se-table.lifting .se-side { opacity: 1; }
/* its shadow on the table: soft and spread out while the board is in the air */
.se-shadow { position: absolute; inset: 3% 2% 1% 2%; border-radius: 3%; background: rgba(0, 0, 0, 0.5); filter: blur(6px); transform: translate(8px, 12px); pointer-events: none; }
.se-table.lifting .se-shadow { animation: se-shadow 1.15s cubic-bezier(.45, .05, .35, 1); }
@keyframes se-shadow {
  0%, 100% { transform: translate(8px, 12px) scale(1); filter: blur(6px); opacity: 1; }
  45% { transform: translate(40px, 60px) scale(0.9); filter: blur(28px); opacity: 0.55; }
}
/* only the side facing up takes clicks (the planchette on the hidden front would otherwise swallow them) */
.se-flip.flipped .se-front, .se-flip.flipped .se-front * { pointer-events: none !important; }
.se-flip:not(.flipped) .se-back, .se-flip:not(.flipped) .se-back * { pointer-events: none !important; }
.se-front { position: relative; }
.se-back {
  position: absolute; inset: 0; transform: rotateY(180deg); display: flex; align-items: center; justify-content: center;
  color: #f6eed8; padding: 5% 7%;
  /* the board's back: plain dark paper with a gold frame */
  background-color: #150f26;
  background-image: var(--noise);
  border-radius: 2.4%;
  box-shadow: inset 0 0 0 10px #0c0913, inset 0 0 0 13px #d4ad55, inset 0 0 0 16px #150f26, inset 0 0 0 17px rgba(212, 173, 85, 0.6), 6px 8px 0 rgba(0, 0, 0, 0.6);
}
.se-back-inner { width: 100%; max-width: 640px; }
.se-back .se-step { opacity: 0.9; color: var(--se-ink); }
.se-back .se-tags li { border-color: rgba(212, 173, 85, 0.75); color: #f6eed8; }

.se-board { display: block; width: 100%; height: auto; overflow: visible; }
.se-l { font-family: 'Abril Fatface', Georgia, serif; font-size: 50px; fill: var(--se-ink); text-anchor: middle; dominant-baseline: middle; }
.se-d { font-family: 'Abril Fatface', Georgia, serif; font-size: 38px; fill: var(--se-ink); text-anchor: middle; dominant-baseline: middle; }
.se-word { font-family: 'Abril Fatface', Georgia, serif; font-size: 44px; fill: var(--se-ink); text-anchor: middle; letter-spacing: 3px; }
.se-word.small { font-size: 30px; letter-spacing: 5px; }
.se-table.spelling .se-board { filter: brightness(1.05); }

/* the planchette rides on its own layer: above the start text, below the question cards */
.se-pl-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; z-index: 2; pointer-events: none; }
.se-planchette { pointer-events: auto; cursor: default; outline: none; transition-property: transform; transition-timing-function: cubic-bezier(.45, .05, .3, 1); transition-duration: 500ms; }
/* while the board turns, the planchette stands off it with its edge showing: the front becomes 3D for that moment */
.se-pl-ghost-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; }
.se-pl-ghost { transition-property: transform; transition-timing-function: cubic-bezier(.45, .05, .3, 1); }
.se-table.lifting .se-front { transform-style: preserve-3d; }
.se-table.lifting .se-front > * { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.se-table.lifting .se-pl-ghost-layer { opacity: 1; transform: translateZ(var(--z)); }
.se-table.lifting .se-pl-layer { transform: translateZ(16px); }
.se-pl-depth { transition-property: transform; transition-timing-function: cubic-bezier(.45, .05, .3, 1); }
.se-halo { opacity: 0; transition: opacity 0.4s; }
.se-table.waiting .se-planchette { cursor: pointer; }
.se-table.waiting .se-halo { animation: se-halo 2.2s ease-in-out infinite; }
.se-table.waiting .se-planchette:hover .se-halo, .se-table.waiting .se-planchette:focus-visible .se-halo { animation-duration: 0.9s; }
@keyframes se-halo { 0%, 100% { opacity: 0.1; } 50% { opacity: 0.45; } }
/* the eyelid drops shut now and then */
.se-lid { animation: se-blink 6s infinite; }
@keyframes se-blink { 0%, 91%, 100% { transform: translateY(0); } 94%, 95% { transform: translateY(30px); } }

/* what the spirits have spelt so far: written across the top of the board */
.se-writing {
  position: absolute; left: 8%; right: 8%; top: 27.5%; margin: 0; text-align: center; pointer-events: none; z-index: 1;
  font-family: var(--font-hand); font-size: clamp(1.2rem, 3.4vw, 2.2rem); line-height: 1.05; color: var(--se-pale); letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(212, 173, 85, 0.55);
}

/* cards laid over the board while the spirits ask */
.se-overlay { position: absolute; left: 50%; transform: translateX(-50%); z-index: 1; text-align: center; }
.se-overlay.none { display: none; }
.se-overlay.hint { top: 22.5%; width: 56%; pointer-events: none; }
.se-overlay.question {
  z-index: 3; top: 50%; transform: translate(-50%, -50%); width: min(92%, 840px);
  padding: 20px 26px 22px; color: #efe4c8;
  background-color: rgba(14, 10, 26, 0.97);
  background-image: radial-gradient(rgba(138, 111, 214, 0.26) 28%, transparent 31%);
  background-size: 7px 7px;
  box-shadow: 4px 6px 0 rgba(0, 0, 0, 0.55); outline: 2px solid rgba(212, 173, 85, 0.5); outline-offset: -7px;
  clip-path: polygon(0 2%, 4% 0, 30% 1.5%, 58% 0, 84% 1.8%, 100% 0, 99.3% 34%, 100% 70%, 98.8% 100%, 70% 98.4%, 44% 100%, 18% 98.6%, 0 100%, 0.8% 62%);
}
.se-whisper { margin: 0 0 4px; font-family: var(--font-hand); font-size: clamp(1.2rem, 3vw, 1.9rem); color: var(--se-pale); text-shadow: 0 0 10px rgba(212, 173, 85, 0.45); }
.se-hint { margin: 0; font-family: var(--font-type); font-size: clamp(0.75rem, 1.6vw, 0.92rem); letter-spacing: 0.12em; text-transform: uppercase; color: var(--se-ink); animation: se-pulse 2.2s ease-in-out infinite; }
@keyframes se-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.se-step { font-family: var(--font-type); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.75; margin: 0 0 4px; }
.se-h { font-family: 'Abril Fatface', Georgia, serif; font-weight: 400; font-size: clamp(1.1rem, 2.4vw, 1.45rem); line-height: 1.15; margin: 2px 0 14px; color: var(--se-pale); }
.se-p { font-family: var(--font-type); font-size: clamp(0.85rem, 1.6vw, 1rem); line-height: 1.45; margin: 0 0 12px; }
.se-p.fine { font-size: 0.8rem; opacity: 0.7; }
.se-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 10px; }
.se-options + .se-options { margin-top: 9px; }
/* a button squeezed into a narrow row wraps its words onto two lines */
.se-options .btn-wrap.squeezed .btn { white-space: normal; line-height: 1.15; text-align: center; height: 100%; }
.se-options .btn-wrap.squeezed { display: inline-flex; }
.se-options + .se-stars-row { margin-top: 13px; }
/* answer and result buttons: plain, readable lettering rather than the display face */
.se-options .btn, .se-actions .btn { font-family: 'Courier Prime', 'Courier New', monospace; font-weight: 700; text-transform: none; letter-spacing: 0.01em; font-size: 0.92rem; padding: 8px 13px 7px; }
body[data-game="seance"] .se-options .btn { font-size: 0.86rem; padding: 7px 10px 6px; }
/* the four buttons under a film (Add to Watchlist, Ask again, Seen it already, Start over) sit in one row, at the
   answers' size; on a phone they wrap again */
body[data-game="seance"] .se-actions .btn { font-size: 0.86rem; padding: 7px 10px 6px; }
.se-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
/* off phones the four buttons under a film run along the bottom of the board's back, a size up, centred under
   the writing (which keeps clear of them) */
@media (min-width: 641px) {
  .se-back { padding-bottom: calc(5% + 64px); }
  .se-back .se-actions { position: absolute; left: 6%; right: 6%; bottom: 7%; margin: 0; flex-wrap: nowrap; justify-content: center; gap: 14px; }
  body[data-game="seance"] .se-actions .btn { font-size: 1rem; padding: 10px 18px 9px; }
}
/* a narrower window: a size down again, so the row still fits inside the gold frame */
@media (min-width: 641px) and (max-width: 860px) {
  .se-back .se-actions { left: 4%; right: 4%; gap: 9px; }
  body[data-game="seance"] .se-actions .btn { font-size: 0.82rem; padding: 8px 11px 7px; }
}
.se-title { font-family: 'Abril Fatface', Georgia, serif; font-weight: 400; font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.02; margin: 0 0 8px; color: var(--se-pale); }
.se-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.se-year { font-family: var(--font-hand); font-size: clamp(1.4rem, 3vw, 1.9rem); color: var(--se-ink); }
.se-meta .strip { font-size: 0.74rem; }
.se-tags { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.se-tags li { font-family: var(--font-type); font-size: 0.78rem; padding: 3px 8px 2px; border: 1.5px dashed rgba(212, 173, 85, 0.5); }
.se-tags li.se-genre { background: var(--se-ink); color: #150f26; border: 1.5px solid var(--se-ink); font-family: 'Archivo Black', sans-serif; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.7rem; padding: 4px 9px 3px; }
/* phones: the board takes the full width, and everything that would sit on top of it (instructions, questions,
   the spelled name, the result) moves into the space below it instead */
@media (max-width: 640px) {
  .se-stage { padding: 10px 4px 24px; }
  .se-table { width: 100%; }
  .se-overlay.hint { top: calc(100% + 18px); width: 100%; }
  .se-overlay.hint .se-whisper { font-size: 1.6rem; }
  .se-overlay.hint .se-hint { color: var(--se-pale); font-size: 0.85rem; }
  .se-writing { top: calc(100% + 18px); left: 4%; right: 4%; font-size: 1.7rem; }
  .se-overlay.question { top: calc(100% + 14px); transform: translateX(-50%); width: calc(100vw - 16px); padding: 22px 20px 22px; }
  body[data-game="seance"] .se-options .btn { font-size: 0.74rem; padding: 6px 8px 5px; }
  .se-options { gap: 8px 8px; }
  /* the result: the board's back grows as tall as it needs */
  .se-back { inset: 0 0 auto 0; min-height: 100%; padding: 26px 22px 24px; align-items: flex-start; }
  .se-back .se-title { font-size: 1.7rem; }
  .se-back .se-p { font-size: 0.82rem; }
  body[data-game="seance"] .se-actions .btn { font-size: 0.8rem; padding: 7px 10px 6px; }
}
