:root {
  --bg: #0d0b1a;
  --bg-2: #1a1533;
  --ink: #f1ecff;
  --muted: #a69ec7;
  --accent: #f5c96a;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.1);
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: radial-gradient(ellipse at top, var(--bg-2), var(--bg) 70%) fixed;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  font-size: 1.1rem;
}
.logo span { color: var(--accent); }

.back { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.back:hover { color: var(--ink); }

main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px;
}
.site-footer a {
  color: inherit;
}

/* ---------- Home ---------- */

.hero { text-align: center; padding: 40px 0 32px; }
.hero h1 {
  font-size: clamp(2.2rem, 7vw, 3.6rem);
  margin: 0 0 12px;
  line-height: 1.05;
}
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.1rem; margin: 0; }

.methods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.method {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-border);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
a.method:hover, a.method:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: rgba(245, 201, 106, 0.07);
  outline: none;
}
.method .icon { font-size: 2.2rem; line-height: 1; }
.bouncy-balls { display: block; height: 2.2rem; width: auto; overflow: visible; }
.bouncy-balls .bb { animation: bb-bounce 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite; }
.bouncy-balls .bb:nth-of-type(2) { animation-delay: -0.37s; }
.bouncy-balls .bb:nth-of-type(3) { animation-delay: -0.73s; }
.bouncy-balls .bb-shadow { fill: #000; opacity: 0.35; }
@keyframes bb-bounce {
  0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
  50% { transform: translateY(-18px); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4); }
}
@media (prefers-reduced-motion: reduce) {
  .bouncy-balls .bb { animation: none; }
}
.method h2 { font-size: 1.2rem; margin: 6px 0 0; }
.method p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.method.soon { opacity: 0.5; }
.badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  color: var(--muted);
}

/* ---------- Shake a Ball ---------- */

/* Rotating squares (the wheels) can poke past the screen edge; don't let them
   cause sideways scrolling on phones. */
.game-page main { overflow-x: clip; }

.game-page main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 24px;
}

.game-page h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.2rem); }

.status {
  color: var(--muted);
  min-height: 1.5em;
  margin: 0;
  font-size: 1.05rem;
}

.ball-wrap {
  --size: min(78vw, 340px);
  width: var(--size);
  height: var(--size);
  perspective: 800px;
}

.ball {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,0.35), rgba(255,255,255,0) 22%),
    radial-gradient(circle at 50% 55%, #2a2a33 0%, #0a0a0f 62%, #000 100%);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.6),
    inset -18px -24px 50px rgba(0, 0, 0, 0.9),
    inset 10px 10px 30px rgba(255, 255, 255, 0.05);
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) rotate(var(--rot, 0deg));
  transition: transform 0.25s ease-out;
  touch-action: manipulation;
}
.ball:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }

.ball.shaking { transition: transform 0.06s linear; }

.ball.sim-shake { animation: sim-shake 1.1s ease-in-out; }

@keyframes sim-shake {
  0%   { transform: translate(0, 0) rotate(0); }
  10%  { transform: translate(-18px, 8px) rotate(-8deg); }
  20%  { transform: translate(16px, -10px) rotate(7deg); }
  30%  { transform: translate(-20px, -4px) rotate(-9deg); }
  40%  { transform: translate(18px, 10px) rotate(8deg); }
  50%  { transform: translate(-14px, 6px) rotate(-6deg); }
  60%  { transform: translate(14px, -8px) rotate(6deg); }
  70%  { transform: translate(-10px, 4px) rotate(-4deg); }
  80%  { transform: translate(6px, -2px) rotate(2deg); }
  100% { transform: translate(0, 0) rotate(0); }
}

/* The viewing window */
.window {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52%;
  height: 52%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #0b1f5c 0%, #06103a 55%, #020617 100%);
  box-shadow:
    inset 0 0 0 6px #111,
    inset 0 0 0 8px #2b2b35,
    inset 0 10px 30px rgba(0, 0, 0, 0.9);
}

/* Idle face shown before the first shake */
.idle-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--size) * 0.16);
  color: rgba(245, 201, 106, 0.85);
  text-shadow: 0 0 18px rgba(245, 201, 106, 0.5);
  transition: opacity 0.4s ease;
}

/* The floating answer die */
.die {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76%;
  height: 64%;
  transform: translate(-50%, -54%) scale(0.6) rotate(var(--die-rot, 0deg));
  opacity: 0;
  filter: blur(8px);
  transition: opacity 1.4s ease, transform 1.6s cubic-bezier(.2,.8,.2,1), filter 1.4s ease;
}
.die-shape {
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  background: linear-gradient(180deg, #2f5bff 0%, #1b3fd6 60%, #142fa8 100%);
}
.die-text {
  position: absolute;
  left: 20%;
  right: 20%;
  top: 42%;
  bottom: 4%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--size) * 0.036);
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #e8eeff;
  text-shadow: 0 0 6px rgba(160, 190, 255, 0.8);
}

.ball.revealed .die {
  opacity: 0.95;
  filter: blur(0);
  transform: translate(-50%, -54%) scale(1) rotate(var(--die-rot, 0deg));
}
.ball.revealed .idle-face,
.ball.shaking .idle-face,
.ball.sim-shake .idle-face { opacity: 0; }

/* Murky liquid swirl while shaking */
.murk {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(80,110,255,0.35), transparent 45%),
              radial-gradient(circle at 70% 70%, rgba(40,70,200,0.35), transparent 45%);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.ball.shaking .murk,
.ball.sim-shake .murk { opacity: 1; animation: swirl 0.9s linear infinite; }
@keyframes swirl { to { transform: rotate(360deg); } }

.controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #1a1306;
  cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--accent); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn[hidden] { display: none; }

/* ---------- Spin the Wheel ---------- */

.wheel-stage {
  --size: min(86vw, 380px);
  --spin-ms: 4800ms;
  position: relative;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  font: inherit;
}
.wheel-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 8px; }
.wheel-stage[aria-busy="true"] { cursor: progress; }

.wheel-layer,
.wheel-window {
  position: absolute;
  inset: 0;
  display: block;
}
.wheel-layer { transform-origin: 50% 50%; will-change: transform; }
.wheel-stage.spinning .wheel-layer {
  transition: transform var(--spin-ms) cubic-bezier(0.12, 0.67, 0.1, 1);
}

.wheel-layer.blurred {
  filter: blur(7px) brightness(0.55) saturate(0.8);
}

.wheel-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.wheel-svg .rim { fill: #120f22; stroke: rgba(245, 201, 106, 0.6); stroke-width: 3; }
.wheel-svg .segment { stroke: rgba(0, 0, 0, 0.35); stroke-width: 1.5; }
.wheel-svg .peg { fill: var(--accent); }
.wheel-svg text {
  fill: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 2px;
}
.wheel-svg text.big { font-size: 24px; }

/* Gold outline of the clear window; it stays put while the wheel turns. */
.window-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.window-frame path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(245, 201, 106, 0.6));
}
.wheel-stage.landed .window-frame path { animation: frame-glow 1.2s ease-out 2; }
@keyframes frame-glow {
  0%, 100% { stroke-width: 3; }
  40% { stroke-width: 6; }
}

.pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 30px;
  height: 34px;
  transform: translateX(-50%);
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5));
}

.hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  height: 22%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fbe3a6, var(--accent) 45%, #a67a1c);
  color: #1a1306;
  font-weight: 800;
  font-size: calc(var(--size) * 0.045);
  letter-spacing: 0.08em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), inset 0 -3px 6px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.wheel-stage:not([aria-busy]):hover .hub,
.wheel-stage:not([aria-busy]):active .hub { transform: translate(-50%, -50%) scale(1.06); }

/* ---------- Draw a Card ---------- */

.card-table {
  --cw: min(24vw, 104px);              /* card width; height is 1.5× */
  position: relative;
  width: 100%;
  max-width: 440px;
  height: calc(var(--cw) * 4.3);
}

.tarot {
  position: absolute;
  left: 50%;
  top: calc(100% - var(--cw) * 1.95);
  width: var(--cw);
  height: calc(var(--cw) * 1.5);
  margin-left: calc(var(--cw) * -0.5);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  perspective: 1000px;
  touch-action: manipulation;
  transform:
    translate(calc(var(--fx) * var(--cw)), calc(var(--fy) * var(--cw) + var(--lift, 0px)))
    rotate(var(--r));
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
}
.tarot:disabled { cursor: default; }
.tarot:not(:disabled):hover,
.tarot:not(:disabled):focus-visible { --lift: calc(var(--cw) * -0.2); }
.tarot:focus-visible { outline: none; }
.tarot:focus-visible .tarot-back { box-shadow: 0 0 0 3px var(--accent), 0 6px 14px rgba(0, 0, 0, 0.5); }

.card-table .tarot.gathered { transform: translate(0, 0) rotate(0deg); }
.card-table.riffle .tarot.gathered:nth-child(odd) {
  transform: translate(calc(var(--cw) * -0.35), 0) rotate(-5deg);
  transition-duration: 0.22s;
}
.card-table.riffle .tarot.gathered:nth-child(even) {
  transform: translate(calc(var(--cw) * 0.35), 0) rotate(5deg);
  transition-duration: 0.22s;
}

.card-table.drawn .tarot:not(.chosen) {
  opacity: 0;
  transform:
    translate(calc(var(--fx) * var(--cw)), calc(var(--fy) * var(--cw) + var(--cw) * 0.8))
    rotate(var(--r));
}
.card-table .tarot.chosen {
  z-index: 50 !important;
  transform: translate(0, calc(var(--cw) * -1.55)) rotate(0deg) scale(1.8);
}

.tarot-inner {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.3, 0.7, 0.3, 1);
}
.tarot.flipped .tarot-inner { transform: rotateY(180deg); }

.tarot-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--cw) * 0.09);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.tarot-back {
  background:
    repeating-linear-gradient(45deg, rgba(245, 201, 106, 0.13) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, rgba(245, 201, 106, 0.13) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, #3d1f73, #1b1240);
  border: 2px solid rgba(245, 201, 106, 0.75);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.5);
}
.back-mark {
  display: grid;
  place-items: center;
  width: calc(var(--cw) * 0.5);
  height: calc(var(--cw) * 0.5);
  border-radius: 50%;
  background: #1b1240;
  border: 2px solid rgba(245, 201, 106, 0.75);
  color: var(--accent);
  font-size: calc(var(--cw) * 0.26);
}

.tarot-front {
  transform: rotateY(180deg);
  gap: calc(var(--cw) * 0.06);
  padding: calc(var(--cw) * 0.08);
  background: linear-gradient(170deg, #fdf8ea, #eddfb9);
  border: 2px solid #c9a24a;
  box-shadow: inset 0 0 0 calc(var(--cw) * 0.035) #fdf8ea, inset 0 0 0 calc(var(--cw) * 0.045) #c9a24a,
              0 10px 30px rgba(0, 0, 0, 0.6);
  color: #2a1d0a;
  text-align: center;
}
.front-symbol {
  font-size: calc(var(--cw) * 0.48);
  line-height: 1;
  font-variant-emoji: text;
  color: #4b2a83;
}
.front-name {
  font-size: calc(var(--cw) * 0.095);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.15;
}
.front-verdict {
  font-size: calc(var(--cw) * 0.15);
  font-weight: 800;
}
.tarot[data-tone="yes"] .front-verdict { color: #15803d; }
.tarot[data-tone="maybe"] .front-verdict { color: #a16207; }
.tarot[data-tone="no"] .front-verdict { color: #b91c1c; }

.reading {
  margin: 0;
  min-height: 1.5em;
  max-width: 32ch;
  font-size: 1.2rem;
  line-height: 1.4;
}
.reading strong[data-tone="yes"] { color: #4ade80; }
.reading strong[data-tone="maybe"] { color: var(--accent); }
.reading strong[data-tone="no"] { color: #f87171; }

/* ---------- Face My Fortune ---------- */

.face-page main { gap: 16px; }

.face-stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 3 / 4;
  max-height: 68vh;
  max-height: 68dvh;
  border-radius: 24px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #241d45, #07060f);
  border: 1px solid var(--card-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.face-stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);              /* selfie mirror */
  /* Never hide the video (opacity 0 / display none): mobile Safari may stall
     muted autoplay video it considers invisible. */
}

.face-stage.no-face::before {
  content: "Center your face in the frame";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font-size: 0.85rem;
  white-space: nowrap;
}

.face-bubble {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  max-width: 82%;
  pointer-events: none;
  will-change: transform;
}
.face-bubble[hidden] { display: none; }

.face-answer {
  position: relative;
  display: block;
  padding: 10px 18px;
  border-radius: 18px;
  background: rgba(13, 11, 26, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 2px solid rgba(245, 201, 106, 0.8);
  color: var(--ink);
  font-size: clamp(1.1rem, 5vw, 1.5rem);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
}
/* Little tail pointing down at the head. */
.face-answer::after {
  content: "";
  position: absolute;
  left: calc(50% + var(--tail-x, 0px));
  bottom: -11px;
  width: 18px;
  height: 18px;
  transform: translateX(-50%) rotate(45deg);
  background: inherit;
  border-right: 2px solid rgba(245, 201, 106, 0.8);
  border-bottom: 2px solid rgba(245, 201, 106, 0.8);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(13, 11, 26, 0.78);
}
.face-bubble { padding-bottom: 12px; }

.face-bubble.shuffling .face-answer { color: rgba(241, 236, 255, 0.85); }
.face-bubble.final .face-answer {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(245, 201, 106, 0.55);
  animation: answer-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes answer-pop {
  0% { transform: scale(0.7); }
  100% { transform: scale(1); }
}

.face-go,
.face-start {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.face-go { bottom: 18px; }
.face-go:disabled { opacity: 0.55; cursor: default; }
.face-start { top: 50%; transform: translate(-50%, -50%); }

.fine-print { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* ---------- Crack a Cookie ---------- */

.cookie-stage {
  --w: min(86vw, 380px);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 0.95);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.cookie-stage:disabled { cursor: default; }
.cookie-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: 16px; }

.cookie-svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.5));
}
.cookie-svg .half {
  transform-box: fill-box;
  transition: transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.cookie-svg .half.left { transform-origin: 100% 100%; }
.cookie-svg .half.right { transform-origin: 0% 100%; }
.cookie-svg .shell { fill: url(#cookie-fill); stroke: #9a6420; stroke-width: 2.5; stroke-linejoin: round; }
.cookie-svg .fold { fill: none; stroke: rgba(120, 70, 15, 0.45); stroke-width: 4; stroke-linecap: round; }
.cookie-svg .shine { fill: none; stroke: rgba(255, 245, 215, 0.7); stroke-width: 5; stroke-linecap: round; }

.cookie-stage:not(:disabled):hover .cookie-svg { transform: translateY(-3px); }
.cookie-svg { transition: transform 0.2s ease; }

.cookie-stage.wobble .cookie-svg { animation: cookie-wobble 0.65s ease-in-out; }
@keyframes cookie-wobble {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-6deg) scale(1.03); }
  40% { transform: rotate(5deg) scale(1.05); }
  60% { transform: rotate(-4deg) scale(1.06); }
  80% { transform: rotate(3deg) scale(1.07); }
}

.cookie-stage.cracked .half.left { transform: translate(-16%, 6%) rotate(-24deg); }
.cookie-stage.cracked .half.right { transform: translate(16%, 6%) rotate(24deg); }

/* Crumbs burst out of the crack once. */
.crumbs { position: absolute; left: 50%; top: 42%; width: 0; height: 0; }
.crumbs i {
  position: absolute;
  width: 7px;
  height: 6px;
  border-radius: 40%;
  background: #d39a45;
  opacity: 0;
}
.cookie-stage.cracked:not(.no-anim) .crumbs i { animation: crumb 0.8s ease-out forwards; }
.crumbs i:nth-child(1) { --dx: -70px; --dy: -50px; }
.crumbs i:nth-child(2) { --dx: 60px;  --dy: -60px; width: 5px; }
.crumbs i:nth-child(3) { --dx: -40px; --dy: 70px; }
.crumbs i:nth-child(4) { --dx: 80px;  --dy: 40px; height: 4px; }
.crumbs i:nth-child(5) { --dx: -90px; --dy: 10px; width: 4px; }
.crumbs i:nth-child(6) { --dx: 20px;  --dy: -80px; }
.crumbs i:nth-child(7) { --dx: 35px;  --dy: 85px; width: 5px; }
.crumbs i:nth-child(8) { --dx: -15px; --dy: -75px; height: 5px; }
@keyframes crumb {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 40px)) rotate(180deg); }
}

/* The paper slip unrolls from the crack. */
.slip {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 88%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 12px;
  background: linear-gradient(180deg, #fffdf6, #f6efdc);
  color: #3a2a12;
  border-radius: 3px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -20%) scale(0.05, 0.3);
  opacity: 0;
  transition: transform 0.85s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.3s ease;
  z-index: 2;
}
.slip::before, .slip::after {    /* faint printed border lines */
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 1px;
  background: rgba(190, 60, 40, 0.35);
}
.slip::before { top: 6px; }
.slip::after { bottom: 6px; }
.cookie-stage.revealed .slip { transform: translate(-50%, 0) scale(1, 1); opacity: 1; }

.slip-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 4.6vw, 1.3rem);
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  transition: opacity 0.5s ease 0.45s;
}
.slip-lucky {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #9b3a24;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease 0.7s;
}
.cookie-stage.revealed .slip-text,
.cookie-stage.revealed .slip-lucky { opacity: 1; }

/* Returning visitors: show the opened cookie with no animation. */
.cookie-stage.no-anim *,
.cookie-stage.no-anim .cookie-svg .half { transition: none !important; animation: none !important; }

/* ---------- Fortune Wheel (prize wheel) ---------- */

.prize-stage {
  --size: min(90vw, 420px);
  position: relative;
  width: var(--size);
  height: var(--size);
  margin-top: 14px;
}

.prize-wheel {
  position: absolute;
  inset: 0;
  cursor: pointer;
  will-change: transform;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
}
.prize-svg { display: block; width: 100%; height: 100%; }
.prize-rim { fill: #1d1838; stroke: #f5c96a; stroke-width: 3; }
.prize-wedge { stroke: rgba(0, 0, 0, 0.35); stroke-width: 1.2; }
.prize-label text {
  fill: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.4);
  stroke-width: 2.5px;
}
.prize-label.dark text { fill: #2a1d0a; stroke: rgba(255, 255, 255, 0.35); }
.prize-peg { fill: #fdf3d4; stroke: #8a6a1c; stroke-width: 1.5; }
.prize-light { fill: #fff6d0; }
.prize-hub-ring { fill: #1d1838; stroke: #f5c96a; stroke-width: 4; }

.prize-flapper {
  position: absolute;
  top: -22px;
  left: 50%;
  z-index: 3;
  width: 40px;
  height: 56px;
  transform-origin: 50% 25%;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}
.prize-flapper path { fill: var(--accent); stroke: #8a6a1c; stroke-width: 2; }
.prize-flapper circle { fill: #8a6a1c; }

.prize-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 26%;
  height: 26%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 0;
  background: radial-gradient(circle at 35% 30%, #fbe3a6, var(--accent) 45%, #a67a1c);
  color: #1a1306;
  font: inherit;
  font-weight: 900;
  font-size: calc(var(--size) * 0.06);
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6), inset 0 -4px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, opacity 0.2s ease;
}
.prize-hub:not(:disabled):hover,
.prize-hub:not(:disabled):active { transform: translate(-50%, -50%) scale(1.06); }
.prize-hub:disabled { opacity: 0.8; cursor: default; }
.prize-hub:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

.prize-result {
  margin: 0;
  min-height: 1.2em;
  font-size: clamp(2.4rem, 12vw, 3.6rem);
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(245, 201, 106, 0.45);
  line-height: 1.1;
}
.prize-result.win { animation: prize-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes prize-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Roll the Dice ---------- */

.dice-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(86vw, 380px);
}
.dice-count-label { font-weight: 700; font-size: 1.1rem; }
.dice-count-label output { color: var(--accent); font-variant-numeric: tabular-nums; }
.dice-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 28px;
  cursor: pointer;
}
.dice-controls input[type="range"]:disabled { opacity: 0.5; cursor: default; }
.dice-controls .btn { margin-top: 4px; min-width: 150px; }

.dice-table {
  position: relative;
  width: min(92vw, 560px, 50vh);
  width: min(92vw, 560px, 50dvh);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 22px;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.07), transparent 60%),
    radial-gradient(circle at 50% 50%, #17604a, #0b3a2d 75%);
  border: 6px solid #6b4520;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.55), 0 18px 40px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(245, 201, 106, 0.35);
}
.dice-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 20px;
  color: rgba(241, 236, 255, 0.6);
  text-align: center;
}
.dice-hint[hidden] { display: none; }

.die6 {
  position: absolute;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: calc(var(--s) * 0.12);
  border-radius: calc(var(--s) * 0.2);
  background: linear-gradient(145deg, #ffffff 0%, #f1ecfb 55%, #d9d1ea 100%);
  box-shadow:
    inset 0 calc(var(--s) * -0.06) calc(var(--s) * 0.08) rgba(0, 0, 0, 0.18),
    inset 0 calc(var(--s) * 0.04) calc(var(--s) * 0.05) rgba(255, 255, 255, 0.9),
    calc(var(--s) * 0.06) calc(var(--s) * 0.1) calc(var(--s) * 0.14) rgba(0, 0, 0, 0.45);
  transform: rotate(var(--rot));
}
.die6 .pip {
  place-self: center;
  width: calc(var(--s) * 0.19);
  height: calc(var(--s) * 0.19);
  border-radius: 50%;
}
.die6 .pip.on {
  background: radial-gradient(circle at 40% 35%, #4a3f6b, #17122a 70%);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5);
}
.die6[data-value="1"].landed .pip.on { background: radial-gradient(circle at 40% 35%, #ff6b6b, #b3171f 70%); }

.dice-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dice-total[hidden] { display: none; }
.dice-total.pop { animation: prize-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.dice-total-label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; }
.dice-total-value {
  font-size: clamp(2.6rem, 13vw, 3.8rem);
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 22px rgba(245, 201, 106, 0.4);
  font-variant-numeric: tabular-nums;
}
/* Portrait: controls, table, total stacked. Landscape: table on the left,
   controls and total side by side with it on the right. */
.dice-layout {
  display: grid;
  grid-template-areas: "controls" "table" "total";
  justify-items: center;
  align-items: center;
  gap: 20px;
  width: 100%;
}
.dice-layout .dice-controls { grid-area: controls; }
.dice-layout .dice-table { grid-area: table; }
.dice-layout .dice-total { grid-area: total; }

@media (orientation: landscape) and (min-width: 600px) {
  .dice-layout {
    grid-template-areas: "table controls" "table total";
    grid-template-columns: auto minmax(220px, 340px);
    grid-template-rows: auto 1fr;
    justify-content: center;
    align-items: start;
    column-gap: clamp(20px, 4vw, 48px);
    row-gap: 28px;
  }
  .dice-page main { max-width: 1100px; }
  .dice-layout .dice-table {
    /* Size the table from the screen height so it fills the left column. */
    width: min(58vw, 640px, calc(100vh - 190px));
    width: min(58vw, 640px, calc(100dvh - 190px));
    min-width: 220px;
  }
  .dice-layout .dice-controls { width: 100%; align-self: end; }
  .dice-layout .dice-total { align-self: start; }
  .dice-layout .dice-total-value { font-size: clamp(3rem, 8vw, 5rem); }
  .dice-layout .dice-breakdown { max-width: 100%; }
}

/* Short landscape screens (phones on their side): drop the title for room. */
@media (orientation: landscape) and (min-width: 600px) and (max-height: 520px) {
  .dice-page h1 { display: none; }
  .dice-page main { gap: 12px; padding-bottom: 16px; }
  .dice-layout .dice-table {
    width: min(58vw, 640px, calc(100vh - 96px));
    width: min(58vw, 640px, calc(100dvh - 96px));
  }
}

.dice-breakdown {
  max-width: min(90vw, 520px);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Flip a Coin ---------- */

.coin-stage {
  --c: min(56vw, 220px);
  position: relative;
  width: var(--c);
  height: calc(var(--c) + 28px);
  margin-top: 12px;
}

.coin-toss {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: var(--c);
  height: var(--c);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  font: inherit;
  cursor: pointer;
  perspective: 900px;
  touch-action: manipulation;
}
.coin-toss:disabled { cursor: default; }
.coin-toss:focus-visible { outline: 3px solid var(--accent); outline-offset: 6px; }

.coin {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.coin-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--c) * 0.02);
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 250, 225, 0.85), rgba(255, 250, 225, 0) 32%),
    radial-gradient(circle at 50% 50%, #f7d77e 0%, #e2b04a 55%, #b9832a 100%);
  box-shadow:
    inset 0 0 0 calc(var(--c) * 0.035) #c9952f,
    inset 0 0 0 calc(var(--c) * 0.05) #f3d07a,
    inset 0 0 0 calc(var(--c) * 0.058) #a87422,
    inset 0 calc(var(--c) * -0.04) calc(var(--c) * 0.08) rgba(120, 70, 10, 0.45),
    0 calc(var(--c) * 0.025) 0 #8f611c;
  color: #7a4f12;
}
.coin-face.tails { transform: rotateX(180deg); }
.coin-emblem {
  font-size: calc(var(--c) * 0.42);
  line-height: 1;
  font-variant-emoji: text;
  text-shadow: 0 2px 0 rgba(255, 240, 200, 0.7), 0 -1px 0 rgba(110, 65, 10, 0.5);
}
.coin-word {
  font-size: calc(var(--c) * 0.085);
  font-weight: 900;
  letter-spacing: 0.22em;
  margin-left: 0.22em;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.7);
}

.coin-shadow {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 70%;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent);
  opacity: 0.55;
  transform: translateX(-50%);
}

.coin-result {
  margin: 0;
  min-height: 1.15em;
  font-size: clamp(2.4rem, 12vw, 3.4rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--accent);
  text-shadow: 0 0 22px rgba(245, 201, 106, 0.4);
}
.coin-result.show { animation: prize-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }
.coin-result.tails { color: #cfd8ff; text-shadow: 0 0 22px rgba(160, 180, 255, 0.4); }

.coin-tally {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 0.95rem;
}
.coin-tally[hidden] { display: none; }
.coin-tally strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.coin-history { display: flex; gap: 4px; }
.coin-chip {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
  color: #3a2608;
  background: #e2b04a;
}
.coin-chip.tails { background: #cfd8ff; color: #1b2148; }
.coin-chip:first-child { box-shadow: 0 0 0 2px var(--ink); }
.coin-reset {
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
}
.coin-reset:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- Lottery Balls ---------- */

.lotto-machine {
  position: relative;
  width: min(74vw, 330px, 38vh);
  width: min(74vw, 330px, 38dvh);
  aspect-ratio: 1;
  margin-bottom: 18px;
}
.lotto-globe {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.5));
}
.lotto-chute {
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 22%;
  height: 22px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #8a6a1c, #f5c96a 40%, #8a6a1c);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
  border-radius: 0 0 6px 6px;
}

.lotto-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  max-width: min(94vw, 560px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.lotto-ball {
  --b: 42px;
  position: relative;
  display: grid;
  place-items: center;
  width: var(--b);
  height: var(--b);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #fff 0, var(--ball) 30%, color-mix(in srgb, var(--ball), #000 40%) 100%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.45);
  color: #1a1530;
  font-weight: 900;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  animation: lotto-in 0.55s cubic-bezier(0.25, 1.4, 0.45, 1) both;
  isolation: isolate;
}
.lotto-ball::before {               /* white number disc */
  content: "";
  position: absolute;
  inset: 22%;
  z-index: -1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
}
@keyframes lotto-in {
  0% { transform: translate(0, -70px) scale(0.6) rotate(-180deg); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: translate(0, 0) scale(1) rotate(0); opacity: 1; }
}

.lotto-sorted {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Crystal Ball ---------- */

.crystal-page {
  touch-action: none;           /* finger drags move the wand, not the page */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
@media (pointer: fine) {
  .crystal-page, .crystal-page a, .crystal-page button { cursor: none; }   /* the wand is the cursor */
}

.crystal-stage {
  --size: min(74vw, 320px, 44vh);
  --size: min(74vw, 320px, 44dvh);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.crystal {
  --charge: 0;
  position: relative;
  z-index: 1;
  width: var(--size);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 calc(18px + 60px * var(--charge)) calc(4px * var(--charge)) rgba(190, 140, 255, calc(0.25 + 0.5 * var(--charge))),
    0 18px 30px rgba(0, 0, 0, 0.5);
}
.crystal-clouds {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.crystal-answer {
  position: absolute;
  inset: 20%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: clamp(1.05rem, calc(var(--size) * 0.075), 1.6rem);
  line-height: 1.15;
  color: #fff;
  text-shadow:
    0 0 4px rgba(20, 8, 50, 0.9),
    0 0 12px rgba(220, 180, 255, 0.95),
    0 0 26px rgba(160, 110, 255, 0.8);
  opacity: 0;
  filter: blur(8px);
  transform: scale(0.85);
  transition: opacity 0.9s ease, filter 0.9s ease, transform 0.9s ease;
}
.crystal.revealed .crystal-answer { opacity: 1; filter: none; transform: none; }
.crystal-glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.6) 0 3%, rgba(255, 255, 255, 0.14) 10%, transparent 28%),
    radial-gradient(circle at 68% 82%, rgba(255, 255, 255, 0.1), transparent 35%);
  box-shadow:
    inset 0 -14px 34px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.crystal-stand {
  width: calc(var(--size) * 0.62);
  height: calc(var(--size) * 0.2);
  margin-top: calc(var(--size) * -0.08);
  background: linear-gradient(90deg, #5e420e, #c99a3a 22%, #fff1c4 42%, #f5c96a 55%, #8a6a1c 80%, #5e420e);
  clip-path: polygon(16% 0, 84% 0, 100% 100%, 0 100%);
  border-radius: 0 0 10px 10px;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.5));
}

.btn:disabled { opacity: 0.5; cursor: default; }

.wand-sparkles {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 20;
}
.wand {
  position: fixed;
  left: 0;
  top: 0;
  margin: -16px 0 0 -16px;      /* puts the star tip at the transform's translate point */
  transform-origin: 16px 16px;
  pointer-events: none;
  z-index: 21;
  will-change: transform;
}
.wand svg { display: block; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5)); }
.wand-star { filter: drop-shadow(0 0 4px #fff3b0) drop-shadow(0 0 8px #f5c96a); }

@media (prefers-reduced-motion: reduce) {
  .ball, .ball.shaking { transition: none; }
  .ball.sim-shake { animation-duration: 0.4s; }
  .ball.shaking .murk, .ball.sim-shake .murk { animation: none; }
  .die { transition: opacity 0.4s ease, filter 0.4s ease; }
  .tarot, .tarot-inner { transition-duration: 0.2s; }
  .face-bubble.final .face-answer { animation: none; }
  .lotto-ball { animation-duration: 0.01s; }
}

/* ---------- Home groups ---------- */
.group-title {
  margin: 28px 0 4px;
  font-size: 1.4rem;
  color: var(--accent);
}
.group-sub { margin: 0 0 16px; color: var(--muted); }

/* ---------- Bingo ---------- */
a.btn { display: inline-block; text-decoration: none; text-align: center; }
.bingo-ball {
  display: grid; place-items: center; align-content: center;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, #f5e3a6 30%, var(--accent) 100%);
  color: #1a1306; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.bingo-ball.empty { opacity: 0.35; }
.bingo-ball.pop { animation: bingo-pop 0.4s ease-out; }
@keyframes bingo-pop { from { transform: scale(0.4) rotate(-90deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .bingo-ball.pop { animation: none; } }
.bingo-letter { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.bingo-num { font-size: 4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.bingo-recent-label { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }
.bingo-recent { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; min-height: 34px; flex-wrap: wrap; justify-content: center; }
.bingo-recent li { padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--card-border); font-weight: 700; }
.bingo-board { display: grid; gap: 4px; width: min(100%, 760px); }
.bingo-row { display: grid; grid-template-columns: 1.6em repeat(15, 1fr); gap: 3px; align-items: center; }
.bingo-row-letter { font-weight: 800; color: var(--accent); text-align: center; }
.bingo-cell {
  text-align: center; padding: 6px 0; border-radius: 6px; font-size: clamp(0.6rem, 2.2vw, 0.95rem);
  font-variant-numeric: tabular-nums; background: var(--card); color: var(--muted); border: 1px solid var(--card-border);
}
.bingo-cell.called { background: var(--accent); color: #1a1306; font-weight: 700; border-color: var(--accent); }
.bingo-cell.latest { outline: 2px solid var(--ink); }
.bingo-print { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.bingo-print h2 { margin: 0; }
.bingo-confirm { border: 1px solid var(--accent); border-radius: var(--radius); background: #1a1630; color: var(--ink); padding: 24px; max-width: 340px; text-align: center; }
.bingo-confirm::backdrop { background: rgba(0, 0, 0, 0.6); }
.bingo-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 16px; }
.bingo-qr h2 { margin: 0; }
.qr-box { width: 200px; background: #fff; border-radius: 12px; padding: 4px; line-height: 0; }
.qr-box svg { width: 100%; height: auto; }
.bingo-qr-link { color: var(--muted); font-size: 0.8rem; word-break: break-all; text-align: center; }
.bingo-card { width: min(94vw, 420px); border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.bingo-card th { font-size: 1.6rem; color: var(--accent); padding: 4px 0; }
.bingo-card td { aspect-ratio: 1; padding: 0; text-align: center; vertical-align: middle; }
.bingo-card td.free { background: var(--card); border: 1px solid var(--card-border); border-radius: 10px; color: var(--accent); font-weight: 800; font-size: 0.8rem; }
.bingo-card button {
  font: inherit; font-size: clamp(1.1rem, 6vw, 1.7rem); font-weight: 700; width: 100%; height: 100%;
  border-radius: 10px; background: var(--card); color: var(--ink); border: 1px solid var(--card-border);
  cursor: pointer; position: relative; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.bingo-card button.marked::after {
  content: ""; position: absolute; inset: 10%; border: 4px solid #e5252a; border-radius: 50%; background: rgba(229, 37, 42, 0.18);
}
.buzz-card { width: min(96vw, 520px); border-spacing: 4px; }
.buzz-card button { font-size: clamp(0.6rem, 2.7vw, 0.95rem); line-height: 1.15; padding: 2px; display: flex; align-items: center; justify-content: center; }
.buzz-card button span { display: block; width: 100%; height: 3.45em; display: flex; align-items: center; justify-content: center; text-align: center; overflow-wrap: anywhere; hyphens: auto; overflow: hidden; }
.buzz-card button.marked::after { border-width: 3px; }
.bingo-card button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- Magic Mirror ---------- */
.mirror-page { touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
.mirror {
  --w: min(74vw, 300px, 40dvh);
  position: relative;
  width: var(--w);
  aspect-ratio: 3 / 4;
  padding: calc(var(--w) * 0.06);
  border-radius: 50% / 46%;
  background: linear-gradient(135deg, #5e420e, #c99a3a 20%, #fff1c4 38%, #f5c96a 55%, #8a6a1c 80%, #5e420e);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 60px rgba(245, 201, 106, 0.18);
}
.mirror::before {
  content: "";
  position: absolute;
  inset: calc(var(--w) * 0.025);
  border-radius: inherit;
  border: 2px solid rgba(94, 66, 14, 0.7);
  pointer-events: none;
}
.mirror-glass {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50% / 46%;
  overflow: hidden;
  cursor: pointer;
  background:
    linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.22) 44%, rgba(255, 255, 255, 0.05) 52%, transparent 58%),
    radial-gradient(ellipse at 50% 35%, #46567a 0%, #232b45 55%, #12162a 100%);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.45), inset 0 0 30px rgba(0, 0, 0, 0.6);
}
.mirror-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.12) 30%, transparent 40%);
  background-size: 250% 100%;
  animation: mirror-glint 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes mirror-glint { from { background-position: 120% 0; } to { background-position: -60% 0; } }
@media (prefers-reduced-motion: reduce) { .mirror-glass::after { animation: none; } }
.mirror-fog, .mirror-view { position: absolute; inset: 0; width: 100%; height: 100%; }
.mirror-view[hidden] { display: none; }
/* In camera mode the fog canvas only holds the fog's shape; the view canvas draws it. */
.mirror.camera-on .mirror-fog { display: none; }

/* ---------- Slot machine ---------- */

.slots-page main { max-width: 560px; }
.slots-layout { display: flex; flex-direction: column; gap: 20px; align-items: stretch; }
.slot-machine {
  position: relative;
  padding: 18px 16px 0;
  border-radius: 26px;
  background: linear-gradient(160deg, #7c1d2e, #4a0f1c 60%, #2d0911);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px #2d0911, 0 20px 50px rgba(0, 0, 0, 0.55), inset 0 0 30px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.3s;
}
.slot-machine.win { box-shadow: 0 0 0 4px #2d0911, 0 0 40px rgba(245, 201, 106, 0.55), 0 20px 50px rgba(0, 0, 0, 0.55); }
.slot-machine.jackpot { animation: slot-jackpot 0.5s linear infinite alternate; }
@keyframes slot-jackpot {
  from { box-shadow: 0 0 0 4px #2d0911, 0 0 70px rgba(255, 90, 90, 0.8); }
  to   { box-shadow: 0 0 0 4px #2d0911, 0 0 90px rgba(255, 230, 90, 0.95); }
}
.slot-marquee {
  text-align: center; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  font-size: 0.95rem; color: var(--accent);
  background: #170509; border-radius: 10px; padding: 10px 8px; margin-bottom: 14px;
  min-height: 2.6em; display: flex; align-items: center; justify-content: center;
}
.slot-marquee.win { color: #fff; }
.slot-marquee.jackpot { color: #ff5a5a; animation: slot-blink 0.4s steps(2) infinite; }
@keyframes slot-blink { 50% { color: #ffe65a; } }

.slot-window {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding: 8px; background: #170509; border-radius: 14px;
}
.slot-reel {
  --cell: clamp(64px, 20vw, 96px);
  position: relative; height: calc(var(--cell) * 3); overflow: hidden; border-radius: 8px;
  background: linear-gradient(#cfc7b5, #fffaf0 25%, #fffaf0 75%, #cfc7b5);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.55);
}
.slot-reel::after { /* barrel shading */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,0.5), transparent 28%, transparent 72%, rgba(0,0,0,0.5));
}
.slot-cell {
  position: absolute; left: 0; top: 0; width: 100%; height: var(--cell);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cell) * 0.62); line-height: 1; user-select: none;
}
.slot-reel.spinning .slot-cell { filter: blur(2.5px); }
.slot-reel.thunk { animation: slot-thunk 0.16s ease-out; }
@keyframes slot-thunk { 40% { transform: translateY(3px); } }
.slot-reel.hit { box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.55), 0 0 0 3px var(--accent), 0 0 18px var(--accent); }
.slot-payline {
  position: absolute; left: 4px; right: 4px; top: 50%; height: 3px; margin-top: -1.5px;
  background: rgba(255, 60, 60, 0.7); pointer-events: none; border-radius: 2px;
}
.slot-payline.on { animation: slot-blink-line 0.35s steps(2) infinite; }
@keyframes slot-blink-line { 50% { opacity: 0.1; } }

.slot-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.slot-readout { background: #170509; border-radius: 10px; padding: 8px; text-align: center; }
.slot-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.slot-value { font-size: 1.3rem; font-weight: 800; color: #7dffa0; font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, Consolas, monospace; }
.slot-readout:first-child .slot-value { color: var(--accent); }

.slot-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.slot-spin { font-size: 1.2rem; padding: 14px 34px; min-width: 190px; }

.slot-tray {
  height: 46px; margin: 0 -16px; border-radius: 0 0 22px 22px;
  background: linear-gradient(#0a0204, #1c0709); border-top: 3px solid #000;
  display: flex; justify-content: center; align-items: center;
}
.slot-chute { width: 44%; height: 20px; border-radius: 6px; background: #000; box-shadow: inset 0 3px 6px rgba(255,255,255,0.08), 0 0 0 3px #3a1a1f; }

.slot-coins { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 50; }

.slot-paytable { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 12px 18px; }
.slot-paytable summary { cursor: pointer; font-weight: 700; }
.slot-paytable table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.slot-paytable th { text-align: left; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.slot-paytable td, .slot-paytable th { padding: 6px 0; border-bottom: 1px solid var(--card-border); }
.slot-paytable td:last-child, .slot-paytable th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.slot-paytable tr.jackpot td { color: var(--accent); font-weight: 800; }
.slot-note { color: var(--muted); font-size: 0.85rem; margin: 10px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .slot-machine.jackpot, .slot-marquee.jackpot, .slot-payline.on { animation: none; }
}

/* ---------- Scratch-off ticket ---------- */
.scratch-page main { max-width: 560px; }
.scratch-layout { display: flex; flex-direction: column; gap: 20px; align-items: stretch; }
.ticket {
  padding: 16px 16px 4px; border-radius: 18px;
  background: linear-gradient(160deg, #ffd66b, #f0a93c 55%, #d98a22);
  border: 3px dashed #7a4a08; color: #3b2203;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: box-shadow 0.3s;
}
.ticket.win { box-shadow: 0 0 40px rgba(245, 201, 106, 0.7), 0 20px 50px rgba(0, 0, 0, 0.5); }
.ticket.jackpot { animation: slot-jackpot 0.5s linear infinite alternate; }
.ticket-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.ticket-title { font-weight: 900; font-size: 1.5rem; letter-spacing: 0.04em; text-transform: uppercase; }
.ticket-sub { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.ticket-marquee {
  text-align: center; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; font-size: 0.9rem;
  background: #3b2203; color: #ffd66b; border-radius: 10px; padding: 10px 8px; margin-bottom: 12px;
  min-height: 2.6em; display: flex; align-items: center; justify-content: center;
}
.ticket-marquee.win { color: #fff; }
.ticket-marquee.jackpot { color: #ff5a5a; animation: slot-blink 0.4s steps(2) infinite; }
.ticket-play { position: relative; border-radius: 12px; overflow: hidden; background: #fffaf0; box-shadow: inset 0 0 0 3px #7a4a08; }
.ticket-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; background: #7a4a08; }
.ticket-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: clamp(2.4rem, 14vw, 4.2rem); line-height: 1; background: #fffaf0; user-select: none;
}
.ticket-cell.hit { background: #fff1a8; box-shadow: inset 0 0 0 4px var(--accent); }
.ticket-foil {
  position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair;
  transition: opacity 0.4s;
}
.ticket-foil.gone { opacity: 0; pointer-events: none; }
.ticket .slot-panel { margin-top: 14px; }
.ticket .slot-readout { background: #3b2203; }
.ticket .slot-label { color: #e8c27a; }
@media (prefers-reduced-motion: reduce) {
  .ticket.jackpot, .ticket-marquee.jackpot { animation: none; }
  .ticket-foil { transition: none; }
}

/* ---------- Wishbone ---------- */
.wishbone-page main { max-width: 560px; text-align: center; }
.wishbone-canvas {
  display: block; width: 100%; aspect-ratio: 1 / 1; margin: 12px auto;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  border-radius: 20px; background: radial-gradient(ellipse at 50% 30%, #241d45, #130f27 75%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.wishbone-score { display: flex; justify-content: center; gap: 28px; color: var(--muted); margin-bottom: 12px; }
.wishbone-score b { color: var(--accent); font-size: 1.2em; margin-left: 4px; }

/* ---------- Falling stars (homepage) ---------- */
.stars {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.stars ~ * { position: relative; z-index: 1; }
.star {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 calc(var(--s) * 2) rgba(245, 201, 106, 0.8);
  opacity: 0;
  animation:
    star-fall var(--dur) linear var(--delay) infinite,
    star-twinkle var(--tw) ease-in-out var(--delay) infinite;
}
@keyframes star-fall {
  from { transform: translate3d(0, -5vh, 0); }
  to { transform: translate3d(var(--drift), 105vh, 0); }
}
@keyframes star-twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .stars { display: none; }
}
