/* ============ OMEN ============ */
:root {
  --bg: #050307;
  --ink: #ece3d0;
  --muted: #8d8396;
  --gold: #d9b56c;
  --gold-dim: rgba(217, 181, 108, .35);
  --blood: #c4122f;
  --violet: #6b46c1;
  --display: 'Cinzel Decorative', 'Cinzel', serif;
  --caps: 'Cinzel', serif;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --mx: 50vw;
  --my: 40vh;
  --card-w: 180px;
  --fcw: clamp(50px, 7.6vw, 92px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- atmosphere layers ---------- */
#fog { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; filter: blur(8px); }
.torch {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(circle 280px at var(--mx) var(--my), rgba(217, 181, 108, .07), transparent 70%);
}
.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(0, 0, 0, .75) 100%);
}
.grain {
  position: fixed; inset: -50%; z-index: 3; pointer-events: none; opacity: .09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -2%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.flash { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0; }

#whispers { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.whisper {
  position: absolute; font-family: var(--mono); font-size: 12px; letter-spacing: .2em;
  color: rgba(196, 18, 47, .75); text-transform: lowercase; white-space: nowrap;
  animation: whisper 6s ease-in-out forwards; filter: blur(.3px);
}
@keyframes whisper {
  0% { opacity: 0; transform: translateY(6px); letter-spacing: .5em; }
  20%, 70% { opacity: .8; letter-spacing: .2em; }
  100% { opacity: 0; transform: translateY(-10px); filter: blur(4px); }
}

/* ---------- layout ---------- */
main { position: relative; z-index: 5; }
.screen {
  display: none; flex-direction: column; align-items: center; text-align: center;
  min-height: 100vh; min-height: 100dvh;
  padding: max(72px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(64px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  max-width: 1100px; margin: 0 auto;
}
.screen.active { display: flex; animation: screen-in 1.1s cubic-bezier(.2, .7, .2, 1) both; }
.screen.leaving { display: flex; animation: screen-out .55s ease-in forwards; }
@keyframes screen-in { from { opacity: 0; filter: blur(14px); transform: scale(1.03); } }
@keyframes screen-out { to { opacity: 0; filter: blur(14px); transform: scale(.97); } }

.eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: .35em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 14px;
}
.h2 {
  font-family: var(--caps); font-weight: 400; font-size: clamp(26px, 4.6vw, 44px);
  line-height: 1.15; margin: 0 0 22px; color: var(--ink); letter-spacing: .04em;
  text-shadow: 0 0 24px rgba(217, 181, 108, .2);
}

/* ---------- buttons ---------- */
.btn {
  position: relative; overflow: hidden; cursor: pointer;
  font-family: var(--caps); font-size: 13px; letter-spacing: .28em; text-transform: uppercase;
  padding: 16px 30px; border: 1px solid var(--gold-dim); border-radius: 2px;
  background: rgba(10, 6, 14, .6); color: var(--gold);
  transition: color .3s, border-color .3s, box-shadow .4s, background .3s, transform .2s;
}
.btn::after {
  content: ''; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(217, 181, 108, .25), transparent);
  transition: left .8s;
}
.btn:hover::after { left: 140%; }
.btn:hover { border-color: var(--gold); box-shadow: 0 0 30px rgba(217, 181, 108, .25), inset 0 0 20px rgba(217, 181, 108, .08); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .spread-opt:focus-visible, .fan-card:focus-visible, .card:focus-visible, .question:focus-visible {
  outline: 1px solid var(--gold); outline-offset: 4px;
}
.btn-primary { border-color: var(--gold); box-shadow: 0 0 22px rgba(196, 18, 47, .25); }
.btn-primary:hover { background: var(--gold); color: #120a06; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--gold); }

.sound-toggle {
  position: fixed; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 40; cursor: pointer;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 44px;
  background: rgba(5, 3, 7, .6); border: 1px solid var(--gold-dim); border-radius: 2px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.sound-toggle:hover { color: var(--gold); border-color: var(--gold); }
.sound-toggle .bars { display: flex; gap: 2px; align-items: flex-end; height: 12px; }
.sound-toggle .bars i { width: 2px; height: 3px; background: currentColor; }
.sound-toggle[aria-pressed="true"] { color: var(--gold); }
.sound-toggle[aria-pressed="true"] .bars i { animation: bar 1s ease-in-out infinite; }
.sound-toggle[aria-pressed="true"] .bars i:nth-child(2) { animation-delay: .2s; }
.sound-toggle[aria-pressed="true"] .bars i:nth-child(3) { animation-delay: .45s; }
@keyframes bar { 50% { height: 12px; } }

/* ---------- I. gate ---------- */
#gate { justify-content: center; gap: 4px; }
.gate-eye { width: min(320px, 78vw); height: auto; overflow: visible; filter: drop-shadow(0 0 30px rgba(196, 18, 47, .35)); }
.gate-eye .lid { transform-box: fill-box; transform-origin: center; animation: blink 7s infinite; }
.gate-eye #iris { transition: transform .25s ease-out; }
.gate-eye #pupil { transition: rx .4s; }
.gate-eye .tear { opacity: 0; animation: tear 11s 4s infinite; }
#eye-rays line { animation: ray 4s ease-in-out infinite alternate; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.04); } 97% { transform: scaleY(1); } }
@keyframes tear { 0%, 70% { opacity: 0; transform: translateY(0); } 74% { opacity: 1; } 100% { opacity: 0; transform: translateY(70px); } }
@keyframes ray { from { stroke-opacity: .15; } to { stroke-opacity: .6; } }

.glitch {
  position: relative; margin: 6px 0 0;
  font-family: var(--display); font-weight: 700; font-size: clamp(64px, 15vw, 150px);
  line-height: 1; letter-spacing: .14em; padding-left: .14em;
  color: var(--gold); text-shadow: 0 0 40px rgba(217, 181, 108, .35), 0 0 2px rgba(255, 230, 180, .8);
  animation: flicker 6s infinite;
}
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; padding-left: .14em; opacity: 0;
}
.glitch::before { color: #ff1f3d; animation: glitch-a 5s infinite steps(1); }
.glitch::after { color: #3ef0ff; animation: glitch-b 5s infinite steps(1); }
@keyframes glitch-a {
  0%, 89%, 100% { opacity: 0; transform: none; clip-path: none; }
  90% { opacity: .8; transform: translate(-6px, 2px); clip-path: inset(10% 0 60% 0); }
  92% { opacity: .8; transform: translate(5px, -2px); clip-path: inset(55% 0 20% 0); }
  94% { opacity: .8; transform: translate(-3px, 0); clip-path: inset(30% 0 45% 0); }
}
@keyframes glitch-b {
  0%, 89%, 100% { opacity: 0; transform: none; clip-path: none; }
  91% { opacity: .7; transform: translate(6px, -1px); clip-path: inset(65% 0 5% 0); }
  93% { opacity: .7; transform: translate(-5px, 2px); clip-path: inset(5% 0 70% 0); }
}
@keyframes flicker { 0%, 100% { opacity: 1; } 41% { opacity: 1; } 42% { opacity: .55; } 43% { opacity: 1; } 77% { opacity: 1; } 78% { opacity: .7; } 79% { opacity: 1; } }

.tagline {
  margin: 4px 0 6px; font-family: var(--mono); font-size: clamp(11px, 2.6vw, 14px);
  letter-spacing: .4em; text-transform: lowercase; color: var(--muted);
}
.returning { min-height: 1.6em; margin: 18px 0 26px; font-style: italic; color: var(--blood); font-size: 18px; text-shadow: 0 0 12px rgba(196, 18, 47, .5); }
.fine { margin-top: 26px; max-width: 34ch; font-size: 14px; color: var(--muted); font-style: italic; }

/* ---------- II. ask ---------- */
#ask { justify-content: center; }
.question {
  width: min(560px, 100%); margin: 0 0 46px; padding: 12px 4px;
  background: transparent; border: 0; border-bottom: 1px solid var(--gold-dim);
  color: var(--ink); font-family: var(--serif); font-style: italic; font-size: clamp(19px, 3vw, 24px); text-align: center;
  transition: border-color .3s, box-shadow .3s;
}
.question::placeholder { color: #5f5768; }
.question:focus { outline: none; border-color: var(--gold); box-shadow: 0 12px 24px -18px rgba(217, 181, 108, .6); }
.spreads { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; width: min(980px, 100%); }
.spread-opt {
  cursor: pointer; text-align: left; padding: 22px 22px 20px; position: relative;
  background: linear-gradient(160deg, rgba(30, 14, 34, .75), rgba(8, 5, 12, .85));
  border: 1px solid rgba(217, 181, 108, .18); border-radius: 3px;
  transition: border-color .3s, transform .3s, box-shadow .4s;
}
.spread-opt:hover { border-color: var(--gold); transform: translateY(-4px); box-shadow: 0 18px 40px -20px rgba(196, 18, 47, .6), 0 0 0 1px rgba(217, 181, 108, .15) inset; }
.spread-opt:hover .so-pips i { background: var(--blood); box-shadow: 0 0 8px var(--blood); }
.so-pips { display: flex; gap: 5px; margin-bottom: 14px; }
.so-pips i { width: 10px; height: 16px; border: 1px solid var(--gold-dim); border-radius: 1px; transition: background .3s, box-shadow .3s; }
.so-name { display: block; font-family: var(--caps); font-size: 17px; letter-spacing: .08em; color: var(--gold); margin-bottom: 6px; }
.so-blurb { display: block; font-size: 16px; color: #b7adbf; font-style: italic; line-height: 1.4; }

/* ---------- III. draw ---------- */
#draw { justify-content: flex-start; padding-top: 64px; }
.prompt { min-height: 1.2em; margin-bottom: 6px; }
.count { font-family: var(--mono); font-size: 12px; letter-spacing: .3em; color: var(--muted); min-height: 1.4em; margin: 0 0 22px; }

.slots { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 34px 14px; margin-bottom: 26px; width: 100%; }
.slots[data-count="1"] { --card-w: min(230px, 62vw); }
.slots[data-count="3"] { --card-w: min(200px, calc((100vw - 60px) / 3)); }
.slots[data-count="5"] { --card-w: min(160px, calc((100vw - 60px) / 3)); }
.slot { width: var(--card-w); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.slot-label { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); min-height: 2.6em; line-height: 1.3; display: flex; align-items: flex-end; }
.slot-place {
  width: var(--card-w); aspect-ratio: 200 / 340; border-radius: calc(var(--card-w) * .06);
  border: 1px dashed rgba(217, 181, 108, .22); position: relative;
  background: radial-gradient(ellipse at center, rgba(217, 181, 108, .05), transparent 70%);
}
.slot-place.filled { border-color: transparent; background: none; }

/* cards */
.card { position: absolute; inset: 0; perspective: 1200px; cursor: default; border-radius: inherit; }
.card-inner {
  position: absolute; inset: 0; transform-style: preserve-3d; border-radius: inherit;
  transition: transform 1.1s cubic-bezier(.3, 1.4, .4, 1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #0a0710;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .6);
}
.card-front { transform: rotateY(180deg); }
.card-front.reversed { transform: rotateY(180deg) rotate(180deg); }
.card-svg { display: block; width: 100%; height: 100%; }
.card.arrive { animation: arrive .6s cubic-bezier(.2, .8, .3, 1.2); }
@keyframes arrive { from { transform: scale(.92); filter: brightness(2); } }
.card.ready { cursor: pointer; }
.card.ready .card-back { animation: beckon 2.4s ease-in-out infinite; }
.card.ready:hover .card-inner { transform: translateY(-8px) rotateX(6deg); }
@keyframes beckon {
  0%, 100% { box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .9), 0 0 0 1px rgba(217, 181, 108, .2); }
  50% { box-shadow: 0 20px 40px -12px rgba(0, 0, 0, .9), 0 0 28px 2px rgba(196, 18, 47, .55), 0 0 0 1px rgba(217, 181, 108, .6); }
}
.card.flipped .card-front { box-shadow: 0 24px 50px -14px rgba(0, 0, 0, .95), 0 0 40px -6px var(--accent, var(--gold)); }
.card.flipped .card-front .pupil { animation: pupil-glow 2.5s ease-in-out infinite; }
@keyframes pupil-glow { 50% { opacity: .35; } }
.card .card-front::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 240, 210, .18) 50%, transparent 65%);
  background-size: 250% 100%; background-position: 120% 0;
}
.card.flipped .card-front::after { animation: sheen 1.8s .6s ease-out; }
@keyframes sheen { to { background-position: -40% 0; } }
.rev-tag {
  position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: .25em; color: var(--blood); opacity: 0; transition: opacity .6s 1s;
}
.card.flipped + .rev-tag { opacity: 1; }

/* shuffle stack */
.shuffle { position: relative; width: var(--fcw); aspect-ratio: 200 / 340; margin: 30px auto 0; display: none; }
.shuffle.on { display: block; }
.stack-card { position: absolute; inset: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .8); }
.shuffle.on .stack-card { animation: riffle .9s cubic-bezier(.5, 0, .5, 1) infinite; }
.shuffle.on .stack-card:nth-child(odd) { --dir: -1; }
.shuffle.on .stack-card:nth-child(even) { --dir: 1; }
@keyframes riffle {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  45% { transform: translate(calc(var(--dir) * 70%), -8%) rotate(calc(var(--dir) * 14deg)); }
  55% { transform: translate(calc(var(--dir) * 70%), -8%) rotate(calc(var(--dir) * 14deg)); z-index: 9; }
}

/* fan */
.fan { position: relative; width: 100%; max-width: 980px; height: 0; transition: opacity .8s, height .8s; }
.fan.gone { opacity: 0; pointer-events: none; }
.fan-card {
  position: absolute; left: 50%; top: 24px; width: var(--fcw); aspect-ratio: 200 / 340;
  margin-left: calc(var(--fcw) / -2); border-radius: calc(var(--fcw) * .06); overflow: hidden;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% var(--r, 600px);
  transform: rotate(0deg); opacity: 0;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1), opacity .5s, filter .3s, box-shadow .3s;
  transition-delay: calc(var(--i) * 22ms);
  box-shadow: 0 10px 22px -6px rgba(0, 0, 0, .9);
}
.fan.spread .fan-card { transform: rotate(var(--a)); opacity: 1; }
.fan.spread .fan-card:hover, .fan.spread .fan-card:focus-visible {
  transform: rotate(var(--a)) translateY(-22px); transition-delay: 0s;
  filter: brightness(1.25); box-shadow: 0 0 26px rgba(196, 18, 47, .65), 0 0 0 1px var(--gold);
}
.fan-card.taken { opacity: 0 !important; pointer-events: none; transition-delay: 0s; }
.fan-card svg { pointer-events: none; }
.ghost { position: fixed; z-index: 30; pointer-events: none; border-radius: 6px; overflow: hidden; box-shadow: 0 0 40px rgba(196, 18, 47, .6); }

/* interpretations */
.interps { width: min(720px, 100%); display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.interp {
  text-align: left; padding: 26px 26px 22px; position: relative;
  background: linear-gradient(170deg, rgba(24, 12, 28, .82), rgba(6, 4, 10, .9));
  border: 1px solid rgba(217, 181, 108, .16); border-left: 2px solid var(--accent);
  animation: interp-in 1s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes interp-in { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }
.interp-pos { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.interp-name { font-family: var(--caps); font-weight: 400; font-size: clamp(24px, 4vw, 32px); margin: 0 0 10px; color: var(--accent); text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 50%, transparent); letter-spacing: .05em; }
.interp-name .rev { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; color: var(--blood); vertical-align: middle; margin-left: 10px; border: 1px solid currentColor; padding: 3px 7px; }
.omen-line { font-style: italic; font-size: clamp(22px, 3.6vw, 28px); line-height: 1.3; margin: 0 0 14px; color: #fff4dc; min-height: 1.3em; }
.omen-line .caret { display: inline-block; width: .5ch; color: var(--blood); animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.meaning { margin: 0 0 16px; color: #cfc4d6; font-size: 18px; }
.keywords { display: flex; flex-wrap: wrap; gap: 8px; }
.keywords span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold-dim); padding: 4px 9px; }

/* verdict */
.verdict { width: min(720px, 100%); margin-top: 46px; padding: 36px 26px 32px; border-top: 1px solid var(--gold-dim); animation: interp-in 1.2s both; }
.verdict[hidden] { display: none; }
.verdict-title { font-family: var(--display); font-size: clamp(34px, 7vw, 58px); font-weight: 700; margin: 0 0 22px; color: var(--gold); letter-spacing: .06em; text-shadow: 0 0 30px rgba(196, 18, 47, .6); }
.doom { margin: 0 auto 22px; max-width: 460px; }
.doom-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .3em; color: var(--muted); margin-bottom: 8px; }
.doom-num { color: var(--blood); font-size: 14px; }
.doom-meter { height: 6px; background: rgba(255, 255, 255, .06); position: relative; overflow: hidden; }
.doom-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #6b46c1, #c4122f 60%, #ff3b1f); box-shadow: 0 0 16px #c4122f; transition: width 2.6s cubic-bezier(.3, 0, .2, 1); }
.verdict-text { font-size: clamp(20px, 3vw, 24px); font-style: italic; margin: 0 0 12px; }
.verdict-shadow { color: #cfc4d6; margin: 0 0 12px; }
.verdict-echo { color: var(--muted); font-size: 16px; margin: 0 0 30px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 20px; background: #120a14; border: 1px solid var(--gold-dim);
  width: max-content; max-width: calc(100% - 32px); bottom: max(28px, env(safe-area-inset-bottom));
  font-family: var(--mono); font-size: 12px; letter-spacing: .15em; color: var(--gold); transition: opacity .4s, transform .4s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- screen effects (fired on card reveal) ---------- */
body.fx-quake main { animation: quake .7s cubic-bezier(.36, .07, .19, .97); }
@keyframes quake {
  10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-7px, 3px) rotate(-.4deg); } 40%, 60% { transform: translate(7px, -3px) rotate(.4deg); }
}
body.fx-quake .flash { background: #ff5a1f; animation: flash 1s ease-out; mix-blend-mode: overlay; }
body.fx-blood .flash { background: radial-gradient(ellipse at center, rgba(196, 18, 47, .2), rgba(120, 0, 15, .85)); animation: flash 2.2s ease-out; }
/* Filter effects live on the overlay (as backdrop-filter): a filter on <main> would flatten the 3D card flips. */
.fx-layer { position: fixed; inset: 0; z-index: 49; pointer-events: none; }
body.fx-blood .fx-layer { animation: throb 2.2s ease-out; }
@keyframes throb { 15% { backdrop-filter: saturate(1.8) contrast(1.25); -webkit-backdrop-filter: saturate(1.8) contrast(1.25); } }
body.fx-light .flash { background: radial-gradient(circle at center, #fff8e0, rgba(255, 210, 120, .4) 60%, transparent); animation: flash 1.8s ease-out; }
body.fx-warp main { animation: warp 1.8s ease-in-out; }
body.fx-warp .fx-layer { animation: warp-filter 1.8s ease-in-out; }
@keyframes warp { 30% { transform: skewX(2deg) scale(1.01); } 60% { transform: skewX(-1.5deg); } }
@keyframes warp-filter {
  30% { backdrop-filter: blur(2px) hue-rotate(60deg); -webkit-backdrop-filter: blur(2px) hue-rotate(60deg); }
  60% { backdrop-filter: blur(1px) hue-rotate(-40deg); -webkit-backdrop-filter: blur(1px) hue-rotate(-40deg); }
}
body.fx-invert main { animation: invert 2.6s cubic-bezier(.7, 0, .3, 1); }
@keyframes invert { 30%, 65% { transform: rotate(180deg); } }
body.fx-pulse .flash { background: radial-gradient(circle at center, rgba(217, 181, 108, .25), transparent 60%); animation: flash 1.2s ease-out; }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  body { font-size: 17px; }
  .screen { padding-top: 64px; }
  .slots { gap: 18px 10px; }
  .interp { padding: 20px 18px 18px; }
  .meaning { font-size: 17px; }
  .btn { padding: 14px 22px; font-size: 12px; letter-spacing: .22em; }
  .actions .btn { width: 100%; }
  .tagline { letter-spacing: .22em; max-width: 100%; }
  .btn { min-height: 48px; max-width: 100%; }
  .verdict { padding: 28px 4px; }
  .interp, .verdict, .slot-label { overflow-wrap: anywhere; }
  .interp-name .rev { display: inline-block; margin: 6px 0 0 6px; }
  .slots[data-count="3"], .slots[data-count="5"] { --card-w: min(180px, calc((100% - 10px) / 2)); }
  .slot { width: min(180px, calc((100% - 10px) / 2)); }
  .slots[data-count="1"] .slot { width: var(--card-w); }
  .slot-place { width: 100%; }
  .slot-label { font-size: 11px; letter-spacing: .1em; }
  .screen { padding-top: max(76px, env(safe-area-inset-top)); }
  #draw { padding-top: max(76px, env(safe-area-inset-top)); }
}

/* Every card has its own generous touch target instead of an overlapping fan. */
@media (max-width: 600px), (pointer: coarse) {
  .fan { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 480px; }
  .fan.gone { display: none; }
  .fan-card { position: relative; left: auto; top: auto; width: 100%; margin: 0; min-height: 44px; }
  .fan.spread .fan-card, .fan.spread .fan-card:hover, .fan.spread .fan-card:focus-visible { transform: none; }
  .slots { order: 1; }
  .slots, .interp, .verdict { scroll-margin-top: 80px; }
  .interps { order: 2; }
  .verdict { order: 3; }
  .torch { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .glitch::before, .glitch::after, .grain { display: none; }
}
