/* =============================================================================
   Oracle-9000 — the fortune machine in the Fun section.

   A coin-op cabinet: marquee with chasing bulbs, an LED sign, a glass booth
   with the Oracle (inline SVG) and his crystal ball, and a control deck with
   arcade buttons, a coin slot, a heat gauge, an odometer, a card printer and a
   cash box that fills with every coin.

   Prefix `of-`. The cabinet's state lives in attributes and classes set by
   fortune.js (`data-phase`, `is-trance`, `is-overheat`, …); everything that
   moves is driven from here, and stops under reduced motion.
   ========================================================================== */

/* Press Start 2P © 2012 The Press Start 2P Project Authors (cody@zone38.net),
   SIL Open Font License 1.1 — latin subset, self-hosted like the site's other fonts. */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/press-start-2p-latin.woff2') format('woff2');
}

/* The dialogs are mounted on <body> to clear the page's stacking context, so
   they carry the palette too. */
.of-page,
.of-dialog {
  --of-night: #07040f;
  --of-body-1: #2a1240;
  --of-body-2: #12081f;
  --of-gold: #ffd34d;
  --of-gold-2: #e5aa2a;
  --of-gold-3: #7d4f0d;
  --of-cyan: #3ee8ff;
  --of-magenta: #ff4fb8;
  --of-green: #59ff8a;
  --of-amber: #ff9a3c;
  --of-red: #ff3b3b;
  --of-pixel: 'Press Start 2P', var(--font-mono);
}

.gk-icon { display: inline-grid; place-items: center; flex: none; }
.gk-icon svg { inline-size: 1.2em; block-size: 1.2em; }

/* --- Hero ----------------------------------------------------------------- */
.of-page { padding-block-start: calc(var(--header-h) + var(--space-8)); }
.of-hero { padding-block: var(--space-4) var(--space-6); }
.of-hero .h1 {
  font-size: var(--text-5xl);
  font-weight: 900;
  color: #ffe9fb;
  text-shadow: 0 0 6px var(--of-magenta), 0 0 22px rgb(255 79 184 / 60%), 0 0 48px rgb(139 92 246 / 45%);
}
.of-hero .lede { margin-block-start: var(--space-4); color: var(--text-soft); }
.of-back { display: flex; inline-size: fit-content; align-items: center; gap: var(--space-2); margin-block-end: var(--space-5); color: var(--text-muted); font-size: var(--text-sm); }
.of-back:hover { color: var(--text); }
ul.of-badges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: var(--space-5); }
.of-noscript { margin-block-start: var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--of-magenta); border-radius: var(--r-md); color: var(--of-magenta); }

.of-game {
  /* The height the cabinet may use: the window minus the fixed header and the
     tool row. Full screen gives it the whole window (see below). */
  --of-fit-h: calc(100dvh - var(--header-h) - 6rem);
  /* Everything in the left column that is not the booth, measured. */
  --of-over: 17.5rem;
  --of-led-dot: 7.5;
  position: relative;
  display: grid;
  gap: var(--space-4);
  padding-block-end: var(--space-10);
}
.of-game::before {
  content: '';
  position: absolute;
  inset: 8% 0 -4%;
  z-index: -1;
  background: radial-gradient(50% 45% at 50% 55%, rgb(139 92 246 / 22%), transparent 70%),
    radial-gradient(30% 20% at 50% 98%, rgb(255 79 184 / 18%), transparent 70%);
  pointer-events: none;
}
.of-stage { display: grid; gap: var(--space-3); justify-items: center; min-inline-size: 0; }

/* --- Tools ---------------------------------------------------------------- */
.of-tools { display: flex; gap: var(--space-2); justify-content: flex-end; inline-size: min(100%, 36rem); }
.of-tool {
  position: relative;
  display: inline-grid;
  place-items: center;
  inline-size: 2.6rem;
  block-size: 2.6rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--text-soft);
  cursor: pointer;
}
.of-tool:hover { color: var(--text); border-color: rgb(255 211 77 / 45%); }
.of-tool:focus-visible { outline: 3px solid var(--of-gold); outline-offset: 2px; }
.of-tool[aria-pressed='false'], .of-tool.is-off { color: var(--text-dim); }
.of-tool.is-off::after { content: ''; position: absolute; inset-inline: 25%; inset-block-start: 50%; block-size: 2px; background: currentColor; transform: rotate(-35deg); }
.of-tool__count {
  position: absolute;
  inset-block-start: -0.45rem;
  inset-inline-end: -0.45rem;
  min-inline-size: 1.25rem;
  padding: 0 0.3rem;
  border-radius: var(--r-full);
  background: var(--of-gold);
  color: #2a1505;
  font-size: var(--text-2xs);
  font-weight: 900;
  line-height: 1.25rem;
}

/* --- Cabinet -------------------------------------------------------------- */
.of-cabinet {
  position: relative;
  inline-size: min(100%, 36rem);
  padding: clamp(0.6rem, 2.2vw, 1rem);
  border-radius: 2rem 2rem 1rem 1rem;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 6%), transparent 12%, transparent 88%, rgb(255 255 255 / 6%)),
    linear-gradient(180deg, var(--of-body-1), var(--of-body-2));
  box-shadow:
    0 0 0 3px var(--of-gold-3),
    0 0 0 5px #000,
    0 0 0 7px rgb(255 79 184 / 55%),
    0 0 42px -4px rgb(255 79 184 / 45%),
    0 40px 60px -30px #000;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.of-cabinet::after {
  /* the feet */
  content: '';
  position: absolute;
  inset-inline: 12%;
  inset-block-end: -1.1rem;
  block-size: 1.1rem;
  border-radius: 0 0 0.6rem 0.6rem;
  background: linear-gradient(#1a0b2a, #000);
  box-shadow: 0 0 0 2px var(--of-gold-3);
  z-index: -1;
}

/* Marquee */
.of-marquee {
  position: relative;
  display: grid;
  gap: 0.45rem;
  padding: 0.55rem 0.8rem;
  border-radius: 1.4rem 1.4rem 0.6rem 0.6rem;
  background: radial-gradient(120% 140% at 50% 0%, #4a1460, #190722 70%);
  box-shadow: inset 0 0 0 2px var(--of-gold-2), inset 0 0 22px rgb(0 0 0 / 70%);
  text-align: center;
}
.of-marquee__title {
  margin: 0;
  font-family: var(--of-pixel);
  font-size: clamp(1rem, 5.2vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: #fff3c4;
  text-shadow: 0 0 2px #fff, 0 0 8px var(--of-gold), 0 0 18px var(--of-gold-2), 0 3px 0 var(--of-gold-3);
  animation: of-flicker 6s steps(1) infinite;
}
.of-bulbs { display: flex; justify-content: space-between; padding-inline: 0.2rem; }
.of-bulb {
  inline-size: 0.6rem;
  block-size: 0.6rem;
  border-radius: 50%;
  background: #6b4a12;
  box-shadow: inset 0 -2px 2px rgb(0 0 0 / 40%);
  animation: of-bulb 1.2s steps(1) infinite;
}
.of-bulb:nth-child(even) { animation-delay: -0.6s; }
.of-cabinet:not([data-phase='idle']) .of-bulb { animation-duration: 0.5s; }
.of-cabinet:not([data-phase='idle']) .of-bulb:nth-child(even) { animation-delay: -0.25s; }
.of-cabinet.is-lucky .of-bulb { animation: of-rainbow 0.35s linear infinite; }
.of-cabinet.is-lucky .of-bulb:nth-child(3n) { animation-delay: -0.12s; }
.of-cabinet.is-lucky .of-bulb:nth-child(3n + 1) { animation-delay: -0.24s; }

@keyframes of-bulb {
  0% { background: #fff1b8; box-shadow: 0 0 6px 2px rgb(255 211 77 / 80%), 0 0 14px rgb(255 160 40 / 60%); }
  50% { background: #6b4a12; box-shadow: inset 0 -2px 2px rgb(0 0 0 / 40%); }
}
@keyframes of-rainbow {
  0% { background: var(--of-magenta); box-shadow: 0 0 10px var(--of-magenta); }
  33% { background: var(--of-cyan); box-shadow: 0 0 10px var(--of-cyan); }
  66% { background: var(--of-gold); box-shadow: 0 0 10px var(--of-gold); }
}
@keyframes of-flicker {
  0%, 41%, 44%, 100% { opacity: 1; }
  42% { opacity: 0.55; }
  43% { opacity: 0.9; }
}

/* LED sign */
.of-led {
  margin-block: 0.6rem;
  padding: 0.35rem;
  border-radius: 0.55rem;
  background: #000;
  box-shadow: inset 0 0 0 2px #2b1d3c, inset 0 0 14px #000, 0 0 0 2px #000;
}
.of-led__canvas { display: block; inline-size: 100%; block-size: auto; border-radius: 0.3rem; }

/* Booth */
.of-booth {
  position: relative;
  overflow: hidden;
  aspect-ratio: 400 / 320;
  border-radius: 1rem 1rem 0.4rem 0.4rem;
  background:
    radial-gradient(45% 40% at 50% 46%, rgb(139 92 246 / 45%), transparent 70%),
    radial-gradient(70% 60% at 50% 100%, rgb(34 211 238 / 18%), transparent 70%),
    linear-gradient(#1c0a35, #090314);
  box-shadow: inset 0 0 0 5px var(--of-gold-2), inset 0 0 0 7px var(--of-gold-3), inset 0 0 40px #000;
  transition: filter 0.4s;
}
.of-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 22% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 68% 22%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 80% 48%, #cfe9ff 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 40%, #ffd8f2 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 16%, #fff 50%, transparent 51%);
  opacity: 0.8;
  animation: of-twinkle 3.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes of-twinkle { 50% { opacity: 0.35; } }

.of-oracle { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; color: var(--of-cyan); }
.of-oracle .of-head { transform-box: fill-box; transform-origin: 50% 100%; animation: of-bob 4.5s ease-in-out infinite; }
.of-oracle .of-eye-glow { opacity: 0.35; transform-box: fill-box; transform-origin: center; animation: of-eyes 3s ease-in-out infinite; }
.of-oracle .of-eye { opacity: 0.85; }
.of-oracle .of-bolt { fill: #3a4a64; }
.of-oracle .of-hand__gem { fill: currentColor; opacity: 0.7; }
.of-oracle .of-mouth__bar { fill: currentColor; transform-box: fill-box; transform-origin: center; transform: scaleY(0.2); transition: transform 60ms linear; }
.of-oracle .of-jewel { cursor: pointer; }
.of-oracle .of-jewel path:first-child { transition: fill 0.2s; }
.of-oracle .of-jewel:hover path:first-child { fill: #8ff3ff; }
.of-oracle .of-hand { transform-box: fill-box; animation: of-hover 3.2s ease-in-out infinite; }
.of-oracle .of-hand--r { animation-delay: -1.6s; }
.of-oracle .of-feather { transform-box: fill-box; transform-origin: 0% 100%; animation: of-feather 2.6s ease-in-out infinite; }
.of-cabinet[data-phase='idle']:not(.is-awake) .of-oracle { color: #3d7f99; }
.of-cabinet[data-phase='idle']:not(.is-awake) .of-oracle .of-eye-glow { opacity: 0.12; }

@keyframes of-bob { 50% { transform: translateY(-3px) rotate(-1deg); } }
@keyframes of-eyes { 50% { opacity: 0.6; transform: scale(1.12); } }
@keyframes of-hover { 50% { transform: translateY(-4px); } }
@keyframes of-feather { 50% { transform: rotate(-6deg); } }

/* Crystal ball */
.of-stand {
  position: absolute;
  inset-block-end: 0;
  left: 50%;
  inline-size: 24%;
  block-size: 8%;
  transform: translateX(-50%);
  clip-path: polygon(14% 0, 86% 0, 100% 100%, 0 100%);
  background: linear-gradient(90deg, var(--of-gold-3), #fff0b0 40%, var(--of-gold-2) 60%, var(--of-gold-3));
}
.of-ball {
  --charge: 0;
  position: absolute;
  left: 50%;
  inset-block-end: 2.5%;
  inline-size: 26%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translateX(-50%);
  cursor: default;
  touch-action: none;
  -webkit-touch-callout: none;
}
.of-ball:not(:disabled) { cursor: pointer; }
.of-ball:focus-visible { outline: 3px solid var(--of-gold); outline-offset: 6px; }
.of-ball__core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgb(255 255 255 / 60%), transparent 20%),
    radial-gradient(circle at 50% 58%, rgb(120 220 255 / 35%), rgb(70 25 130 / 55%) 62%, rgb(10 5 30 / 92%) 100%);
  box-shadow:
    0 0 calc(18px + var(--charge) * 40px) rgb(62 232 255 / calc(0.25 + var(--charge) * 0.6)),
    inset 0 -12px 26px rgb(0 0 0 / 55%),
    inset 0 0 0 2px rgb(255 255 255 / 16%);
}
.of-ball__swirl {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--of-magenta), var(--of-cyan), #8b5cf6, var(--of-gold), var(--of-magenta));
  filter: blur(9px);
  opacity: calc(0.22 + var(--charge) * 0.7);
  mix-blend-mode: screen;
  animation: of-spin 7s linear infinite;
}
.of-ball__glint { position: absolute; inset-block-start: 14%; left: 22%; inline-size: 22%; block-size: 12%; border-radius: 50%; background: rgb(255 255 255 / 55%); filter: blur(1px); transform: rotate(-30deg); }
.of-ball__ring { position: absolute; inset: -7%; inline-size: 114%; max-inline-size: none; block-size: 114%; transform: rotate(-90deg); overflow: visible; }
.of-ball__ring circle { fill: none; stroke: var(--of-gold); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; filter: drop-shadow(0 0 calc(4px + var(--charge) * 6px) var(--of-gold)) drop-shadow(0 0 calc(9px + var(--charge) * 12px) rgb(255 211 77 / 55%)) drop-shadow(0 0 calc(14px + var(--charge) * 16px) rgb(62 232 255 / 45%)); }
.of-ball__hint {
  position: absolute;
  inset-block-start: -1.7em;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25em 0.6em;
  border-radius: var(--r-full);
  background: rgb(0 0 0 / 70%);
  color: var(--of-gold);
  font-size: var(--text-2xs);
  font-weight: 800;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}
.of-cabinet[data-phase='hold'] .of-ball__hint { opacity: 1; animation: of-blink 1s steps(1) infinite; }
.of-ball.is-pressed .of-ball__hint { animation: none; opacity: 0; }
.of-cabinet[data-phase='hold'] .of-ball:not(.is-pressed) .of-ball__core { animation: of-pulse 1.2s ease-in-out infinite; }
.of-ball.is-pressed .of-ball__swirl { animation-duration: calc(2.4s - var(--charge) * 2s); }

@keyframes of-spin { to { transform: rotate(1turn); } }
@keyframes of-pulse { 50% { transform: scale(1.05); box-shadow: 0 0 40px rgb(255 211 77 / 55%), inset 0 -12px 26px rgb(0 0 0 / 55%); } }
@keyframes of-blink { 50% { opacity: 0.25; } }

.of-glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgb(255 255 255 / 9%) 0 16%, transparent 16% 28%, rgb(255 255 255 / 5%) 28% 31%, transparent 31%);
  pointer-events: none;
}
.of-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.of-flash.legendary { background: var(--of-gold); }
.of-flash.glitch { background: var(--of-magenta); }
.of-flash.secret { background: var(--of-green); }
.of-flash.is-on { animation: of-flash 0.7s ease-out; }
@keyframes of-flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }

/* Captions: what the Oracle is saying */
.of-caption {
  display: grid;
  place-items: center;
  min-block-size: 2.9em;
  margin: 0.45rem 0 0;
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  background: rgb(0 0 0 / 45%);
  color: var(--of-cyan);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 0 10px rgb(62 232 255 / 55%);
  opacity: 0.35;
  transition: opacity 0.25s;
}
.of-caption.is-on { opacity: 1; }
.of-caption:empty::before { content: '· · ·'; color: rgb(62 232 255 / 40%); }

/* --- States --------------------------------------------------------------- */
.of-cabinet.is-trance .of-oracle { color: var(--of-magenta); }
.of-cabinet.is-trance .of-oracle .of-eye-glow { opacity: 0.95; animation-duration: 0.5s; }
.of-cabinet.is-trance .of-oracle .of-head { animation: of-sway 0.9s ease-in-out infinite; }
.of-cabinet.is-trance .of-oracle .of-hand--l { animation: of-reach-l 0.8s ease-in-out infinite; }
.of-cabinet.is-trance .of-oracle .of-hand--r { animation: of-reach-r 0.8s ease-in-out infinite; }
.of-cabinet.is-trance .of-oracle .of-hand__gem { opacity: 1; }
.of-cabinet.is-trance .of-ball__swirl { opacity: 1; animation-duration: 0.45s; }
.of-cabinet.is-trance .of-booth { animation: of-trance 1.6s ease-in-out infinite; }
.of-cabinet.is-revealed .of-booth { filter: brightness(1.3) saturate(1.3); }

@keyframes of-sway { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes of-reach-l { 50% { transform: translate(8px, -6px); } }
@keyframes of-reach-r { 50% { transform: translate(-8px, -6px); } }
@keyframes of-trance { 50% { filter: hue-rotate(-25deg) brightness(1.15); } }

.of-cabinet.is-overheat { box-shadow: 0 0 0 3px var(--of-gold-3), 0 0 0 5px #000, 0 0 0 7px var(--of-red), 0 0 50px -2px rgb(255 59 59 / 70%), 0 40px 60px -30px #000; animation: of-alarm 0.7s steps(1) infinite; }
.of-cabinet.is-overheat .of-oracle { color: var(--of-red); }
.of-cabinet.is-overheat .of-oracle .of-head { animation: of-shiver 0.12s linear infinite; }
.of-cabinet.is-overheat .of-booth { filter: sepia(0.5) hue-rotate(-30deg) saturate(1.8); }
.of-cabinet.is-overheat .of-marquee__title { color: #ffd0d0; text-shadow: 0 0 8px var(--of-red), 0 0 18px var(--of-red); }
.of-cabinet.is-hot .of-heat__arc { animation: of-blink 0.8s steps(1) infinite; }
@keyframes of-alarm { 50% { box-shadow: 0 0 0 3px var(--of-gold-3), 0 0 0 5px #000, 0 0 0 7px #7a0a0a, 0 0 20px -2px rgb(255 59 59 / 30%), 0 40px 60px -30px #000; } }
@keyframes of-shiver { 25% { transform: translate(-1px, 1px); } 75% { transform: translate(1px, -1px); } }

.of-cabinet.is-tilt { animation: of-tilt 0.6s ease-in-out 2; }
.of-cabinet.is-tilt .of-oracle { color: var(--of-red); }
.of-cabinet.is-bumped { animation: of-bump 0.18s ease-out; }
@keyframes of-tilt { 20% { transform: rotate(-2deg) translateX(-6px); } 40% { transform: rotate(2deg) translateX(6px); } 60% { transform: rotate(-1.5deg) translateX(-4px); } 80% { transform: rotate(1deg) translateX(3px); } }
@keyframes of-bump { 40% { transform: translateY(2px) rotate(0.3deg); } }

.of-cabinet.is-glitch .of-booth { animation: of-glitch 0.18s steps(2) 8; }
@keyframes of-glitch {
  0% { filter: hue-rotate(90deg) contrast(1.6); transform: translateX(-3px); }
  50% { filter: invert(0.15) hue-rotate(-60deg); transform: translateX(3px) skewX(2deg); }
  100% { filter: none; transform: none; }
}
.of-cabinet.is-secret .of-booth { filter: hue-rotate(80deg) saturate(1.4); }
.of-cabinet.is-lucky .of-marquee__title { animation: of-lucky 0.3s steps(1) infinite; }
@keyframes of-lucky { 50% { color: var(--of-magenta); text-shadow: 0 0 10px var(--of-magenta), 0 0 22px var(--of-cyan); } }

/* --- Particles ------------------------------------------------------------ */
.of-fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.of-p { position: absolute; inline-size: 12px; block-size: 12px; margin: -6px; opacity: 0; animation: of-pop 1.1s var(--d, 0s) ease-out forwards; }
.of-p--star { background: var(--of-gold); clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 62%, 50% 100%, 39% 62%, 0 50%, 39% 38%); filter: drop-shadow(0 0 4px var(--of-gold)); }
.of-p--coin { inline-size: 18px; block-size: 18px; margin: -9px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c8, var(--of-gold) 45%, #b77d12 80%); box-shadow: inset 0 0 0 2px #c58a17; animation: of-coinpop 1.3s var(--d, 0s) cubic-bezier(.2,.6,.4,1) forwards; }
.of-p--steam { inline-size: 46px; block-size: 46px; margin: -23px; border-radius: 50%; background: rgb(235 240 255 / 55%); filter: blur(8px); animation: of-steam 1.7s var(--d, 0s) ease-out forwards; }
.of-p--spark { inline-size: 4px; block-size: 14px; margin: -7px -2px; border-radius: 2px; background: #ffcf5a; box-shadow: 0 0 6px #ff8a00; }
@keyframes of-pop {
  0% { opacity: 1; transform: translate(0, 0) scale(var(--s, 1)); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(calc(var(--s, 1) * 0.3)) rotate(200deg); }
}
@keyframes of-coinpop {
  0% { opacity: 1; transform: translate(0, 0) rotateY(0); }
  45% { opacity: 1; transform: translate(calc(var(--dx) * 0.55), var(--dy)) rotateY(540deg); }
  100% { opacity: 0; transform: translate(var(--dx), 140px) rotateY(1080deg); }
}
@keyframes of-steam {
  0% { opacity: 0.8; transform: translate(0, 0) scale(0.5); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 0.5), -150px) scale(2.2); }
}

/* --- Control deck --------------------------------------------------------- */
.of-panel {
  display: grid;
  gap: 0.8rem;
  margin-block-start: 0.6rem;
  padding: 0.8rem;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #23103a, #120820);
  box-shadow: inset 0 0 0 2px rgb(255 211 77 / 35%), inset 0 10px 20px rgb(0 0 0 / 35%);
}

/* Arcade buttons */
.of-subjects { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem; }
.of-btn {
  --c: var(--of-cyan);
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0 0.2rem;
  border: 0;
  background: none;
  color: var(--text-soft);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 800;
  cursor: pointer;
}
.of-btn--love { --c: var(--of-magenta); }
.of-btn--work { --c: var(--of-cyan); }
.of-btn--money { --c: var(--of-gold); }
.of-btn--travel { --c: var(--of-green); }
.of-btn--code { --c: var(--of-amber); }
.of-btn__cap {
  inline-size: clamp(2.2rem, 9vw, 2.9rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, rgb(255 255 255 / 75%), var(--c) 32%, color-mix(in srgb, var(--c) 45%, #000) 100%);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 30%, #000), 0 7px 0 #000, inset 0 -3px 6px rgb(0 0 0 / 35%);
  transition: transform 80ms, box-shadow 80ms, filter 0.2s;
}
.of-btn:active:not(:disabled) .of-btn__cap { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 30%, #000), 0 3px 0 #000, inset 0 -3px 6px rgb(0 0 0 / 35%); }
.of-btn:disabled { cursor: default; color: var(--text-dim); }
.of-btn:disabled .of-btn__cap { filter: saturate(0.35) brightness(0.55); }
.of-btn:focus-visible { outline: none; }
.of-btn:focus-visible .of-btn__cap { outline: 3px solid #fff; outline-offset: 3px; }
.of-cabinet[data-phase='choose'] .of-btn:not(:disabled) .of-btn__cap { animation: of-cap 1.25s ease-in-out infinite; }
.of-cabinet[data-phase='choose'] .of-btn:nth-child(2) .of-btn__cap { animation-delay: 0.25s; }
.of-cabinet[data-phase='choose'] .of-btn:nth-child(3) .of-btn__cap { animation-delay: 0.5s; }
.of-cabinet[data-phase='choose'] .of-btn:nth-child(4) .of-btn__cap { animation-delay: 0.75s; }
.of-cabinet[data-phase='choose'] .of-btn:nth-child(5) .of-btn__cap { animation-delay: 1s; }
.of-btn.is-picked .of-btn__cap { filter: none; box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 30%, #000), 0 7px 0 #000, 0 0 22px var(--c); }
.of-btn.is-picked { color: var(--c); }
.of-cabinet[data-mode='hafez'] .of-subjects { opacity: 0.35; }
@keyframes of-cap { 50% { box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 30%, #000), 0 7px 0 #000, 0 0 20px var(--c); filter: brightness(1.25); } }

/* Mode switch (Persian page) */
.of-mode { display: grid; grid-template-columns: 1fr 1fr; padding: 0.25rem; border-radius: var(--r-full); background: rgb(0 0 0 / 40%); box-shadow: inset 0 0 0 1px rgb(255 211 77 / 30%); }
.of-mode__btn { padding: 0.45rem 0.6rem; border: 0; border-radius: var(--r-full); background: none; color: var(--text-muted); font: inherit; font-size: var(--text-sm); font-weight: 800; cursor: pointer; }
.of-mode__btn[aria-pressed='true'] { background: linear-gradient(180deg, #fff0b0, var(--of-gold-2)); color: #2a1505; box-shadow: 0 0 14px rgb(255 211 77 / 40%); }
.of-mode__btn:disabled { cursor: default; opacity: 0.6; }
.of-mode__btn:focus-visible { outline: 3px solid var(--of-gold); outline-offset: 2px; }

/* Coins */
.of-coinrow { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.of-purse {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.7rem;
  min-inline-size: 0;
  padding: 0.5rem 0.7rem;
  border: 1px dashed rgb(255 211 77 / 45%);
  border-radius: 0.8rem;
  background: rgb(255 255 255 / 4%);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: grab;
  touch-action: none;
}
.of-purse:hover { background: rgb(255 211 77 / 8%); }
.of-purse:active { cursor: grabbing; }
.of-purse:focus-visible { outline: 3px solid var(--of-gold); outline-offset: 2px; }
.of-purse[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.of-purse__bag {
  position: relative;
  flex: none;
  inline-size: 2.8rem;
  block-size: 2.6rem;
  margin-block-start: 0.5rem;
  border-radius: 42% 42% 46% 46% / 30% 30% 60% 60%;
  background: radial-gradient(circle at 35% 35%, #a5652f, #5c3415 70%);
  box-shadow: inset 0 -4px 8px rgb(0 0 0 / 40%);
}
.of-purse__bag::before { content: ''; position: absolute; inset-inline: 18%; inset-block-start: -2px; block-size: 6px; border-radius: 3px; background: #3a1f0b; }
.of-purse__coin { position: absolute; inset-block-start: -0.7rem; inline-size: 1rem; block-size: 1rem; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c8, var(--of-gold) 45%, #b77d12 80%); box-shadow: inset 0 0 0 1.5px #c58a17; }
.of-purse__coin:nth-child(1) { left: 12%; }
.of-purse__coin:nth-child(2) { left: 36%; inset-block-start: -0.95rem; }
.of-purse__coin:nth-child(3) { left: 58%; }
.of-cabinet[data-phase='idle'] .of-purse:not([aria-disabled='true']) .of-purse__coin:nth-child(2),
.of-cabinet[data-phase='card'] .of-purse:not([aria-disabled='true']) .of-purse__coin:nth-child(2) { animation: of-peek 1.6s ease-in-out infinite; }
@keyframes of-peek { 50% { transform: translateY(-5px); } }
.of-purse__inf { color: var(--of-gold); font-size: 1.6rem; font-weight: 900; line-height: 1; text-shadow: 0 0 10px rgb(255 211 77 / 50%); }
.of-purse__text { display: grid; gap: 0.1rem; min-inline-size: 0; }
.of-purse__name { font-size: var(--text-sm); font-weight: 800; }
.of-purse__hint { color: var(--text-muted); font-size: var(--text-2xs); }

.of-slot {
  display: grid;
  flex: none;
  justify-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem 0.45rem;
  border-radius: 0.6rem;
  background: linear-gradient(180deg, #d9e1ec, #7d8ba0 55%, #4a566a);
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 #1b2230, 0 0 0 2px #000;
  transition: box-shadow 0.15s;
}
.of-slot__mouth { inline-size: 0.6rem; block-size: 2.6rem; border-radius: 0.3rem; background: #000; box-shadow: inset 0 0 0 2px #2c3442, 0 0 0 3px #a7b3c4; }
.of-slot__label { padding: 0.2rem 0.35rem; border-radius: 0.2rem; background: #1a0505; color: #ff5a3c; font-family: var(--of-pixel); font-size: 0.5rem; line-height: 1.2; text-shadow: 0 0 6px #ff3b1f; white-space: nowrap; }
.of-page:lang(fa) .of-slot__label { font-family: var(--font-sans); font-size: var(--text-2xs); font-weight: 900; }
.of-cabinet[data-phase='idle'] .of-slot__label, .of-cabinet[data-phase='card'] .of-slot__label { animation: of-blink 0.9s steps(1) infinite; }
.of-cabinet[data-phase='overheat'] .of-slot__label { color: #555; text-shadow: none; }
.of-slot.is-target { box-shadow: inset 0 1px 0 #fff, 0 3px 0 #1b2230, 0 0 0 2px #000, 0 0 22px 4px var(--of-green); }
.of-slot.is-eating .of-slot__mouth { animation: of-eat 0.5s ease-out; }
.of-slot.is-refusing { animation: of-refuse 0.35s ease-in-out; }
@keyframes of-eat { 0% { box-shadow: inset 0 0 0 2px #2c3442, 0 0 0 3px #a7b3c4, 0 0 18px 6px var(--of-gold); } }
@keyframes of-refuse { 25% { transform: translateX(-4px); box-shadow: inset 0 1px 0 #fff, 0 3px 0 #1b2230, 0 0 0 2px #000, 0 0 18px 2px var(--of-red); } 75% { transform: translateX(4px); } }

.of-flycoin {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  inline-size: 2.4rem;
  block-size: 2.4rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8, var(--of-gold, #ffd34d) 42%, #b77d12 78%);
  box-shadow: inset 0 0 0 3px #c58a17, 0 4px 10px rgb(0 0 0 / 50%);
  pointer-events: none;
  will-change: transform;
}
.of-flycoin::after { content: 'R'; color: #8a5a12; font-family: 'Press Start 2P', monospace; font-size: 0.75rem; }
.of-flycoin.is-held { box-shadow: inset 0 0 0 3px #c58a17, 0 10px 22px rgb(0 0 0 / 60%), 0 0 18px rgb(255 211 77 / 55%); }

/* Gauges */
.of-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.of-heat, .of-odo { display: grid; justify-items: center; align-content: center; gap: 0.2rem; padding: 0.45rem; border-radius: 0.6rem; background: rgb(0 0 0 / 40%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%); }
.of-heat svg { inline-size: min(100%, 7.5rem); block-size: auto; }
.of-heat__needle { transform-box: view-box; transform-origin: 60px 62px; transform: rotate(-90deg); transition: transform 0.7s cubic-bezier(.3, 1.5, .5, 1); }
.of-gauge__label { color: var(--text-muted); font-size: var(--text-2xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.of-odo__wheels { display: flex; gap: 2px; padding: 3px; border-radius: 0.3rem; background: #000; box-shadow: inset 0 0 0 1px #444; }
.of-odo__wheel { overflow: hidden; inline-size: 1.35em; block-size: 1.7em; border-radius: 2px; background: linear-gradient(#0b0b0b, #2a2a2a 50%, #0b0b0b); color: #f2f2f2; font-family: var(--font-mono); font-size: clamp(1rem, 4vw, 1.3rem); font-weight: 800; }
.of-page:lang(fa) .of-odo__wheel { font-family: var(--font-sans); }
.of-odo__strip { display: flex; flex-direction: column; transition: transform 0.9s cubic-bezier(.3, 1.3, .5, 1); }
.of-odo__strip.is-still { transition: none; }
.of-odo__digit { display: block; block-size: 1.7em; line-height: 1.7em; text-align: center; }

/* Printer and cash box */
.of-tray { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0.6rem; align-items: start; }
.of-cardslot { position: relative; display: grid; justify-items: center; padding-block-start: 0.2rem; }
.of-cardslot__mouth { position: relative; z-index: 2; inline-size: 92%; block-size: 0.7rem; border-radius: 0.35rem; background: #000; box-shadow: inset 0 3px 4px rgb(255 255 255 / 10%), 0 0 0 3px #7d8ba0, 0 0 0 5px #000; }
.of-cardslot__hang { overflow: hidden; inline-size: 86%; min-block-size: 1.2rem; margin-block-start: -0.3rem; padding-block-end: 0.6rem; }
.of-paper { display: block; position: relative; inline-size: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: inherit; cursor: pointer; }
.of-paper .of-ticket { max-block-size: 9.5rem; overflow: hidden; -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent); }
.of-paper.is-printing { animation: of-print 1.5s steps(14) both; }
.of-paper.is-ready { animation: of-dangle 2.4s ease-in-out infinite; }
.of-paper.is-ready::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--of-gold), 0 0 18px rgb(255 211 77 / 45%);
  animation: of-blink 1.2s steps(1) infinite;
  pointer-events: none;
}
.of-paper:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.of-paper.is-dropping { animation: of-drop-card 0.6s ease-in forwards; }
@keyframes of-print { from { transform: translateY(-102%); } to { transform: translateY(0); } }
@keyframes of-dangle { 50% { transform: rotate(0.6deg) translateY(1px); } }
@keyframes of-drop-card { to { transform: translateY(60px) rotate(9deg); opacity: 0; } }

.of-cashbox {
  position: relative;
  overflow: hidden;
  min-block-size: 5.2rem;
  border-radius: 0.6rem;
  background: rgb(0 0 0 / 55%);
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 12%), inset 0 10px 18px #000;
}
.of-cashbox::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, rgb(255 255 255 / 10%) 0 22%, transparent 22%); pointer-events: none; }
.of-cashbox__label { position: absolute; inset-block-start: 0.3rem; inset-inline-start: 0.5rem; color: var(--text-dim); font-size: var(--text-2xs); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.of-pile { position: absolute; inset: 1.4rem 0.3rem 0.3rem; }
.of-pile__coin { position: absolute; inline-size: 1.15rem; block-size: 0.5rem; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff6c8, var(--of-gold) 45%, #a8700e 85%); box-shadow: 0 1px 0 #6d4708; transform: rotate(var(--r, 0deg)); }
.of-pile__coin.is-new { animation: of-coin-drop 0.55s cubic-bezier(.4, 1.6, .6, 1); }
.of-pile[data-more]::after { content: attr(data-more); position: absolute; inset-block-start: -1.15rem; inset-inline-end: 0.2rem; color: var(--of-gold); font-size: var(--text-2xs); font-weight: 900; }
@keyframes of-coin-drop { from { translate: 0 -70px; opacity: 0; } 60% { opacity: 1; } }

/* --- The card ------------------------------------------------------------- */
.of-ticket {
  --bg1: #0b1630; --bg2: #050a18; --ink: #e8eef8; --soft: #9bacc3; --accent: #3ee8ff; --frame: #2a4a7a;
  position: relative;
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--frame);
  border-radius: 6px;
  outline: 1px solid var(--frame);
  outline-offset: -6px;
  background: repeating-linear-gradient(0deg, rgb(255 255 255 / 2.5%) 0 2px, transparent 2px 6px), linear-gradient(160deg, var(--bg1), var(--bg2));
  color: var(--ink);
  font-size: var(--text-xs);
  text-align: center;
  overflow: hidden;
}
.of-ticket--rare { --bg1: #28344a; --bg2: #0d1320; --ink: #f3f6fb; --soft: #b7c4d6; --accent: #dfe8f6; --frame: #9fb2cb; }
.of-ticket--legendary { --bg1: #3a2606; --bg2: #120a02; --ink: #fff6dc; --soft: #e9cf8f; --accent: #ffd34d; --frame: #e5aa2a; }
.of-ticket--glitch { --bg1: #2b0a2c; --bg2: #09020c; --ink: #ffe2f6; --soft: #e58ac9; --accent: #ff4fb8; --frame: #ff4fb8; }
.of-ticket--secret { --bg1: #06200f; --bg2: #020a05; --ink: #dcffe6; --soft: #8de0a6; --accent: #59ff8a; --frame: #59ff8a; }
.of-ticket--hafez { --bg1: #f5ead2; --bg2: #e2cd9d; --ink: #2b1a08; --soft: #6b4b22; --accent: #8a2a1c; --frame: #a07a35; background: linear-gradient(160deg, var(--bg1), var(--bg2)); }
.of-ticket--legendary::before, .of-ticket--rare::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 22%) 48%, transparent 60%);
  background-size: 260% 100%;
  animation: of-shine 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes of-shine { from { background-position: 130% 0; } to { background-position: -130% 0; } }
.of-ticket--glitch .of-ticket__text { text-shadow: 2px 0 rgb(62 232 255 / 70%), -2px 0 rgb(255 79 184 / 70%); animation: of-jitter 1.6s steps(2) infinite; }
@keyframes of-jitter { 92% { transform: none; } 94% { transform: translateX(2px); } 96% { transform: translateX(-2px) skewX(4deg); } }

.of-ticket__head { display: grid; justify-items: center; gap: 0.2rem; }
.of-ticket__brand { color: var(--accent); font-family: var(--of-pixel); font-size: 0.6rem; letter-spacing: 0.05em; text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent); }
.of-ticket--hafez .of-ticket__brand { text-shadow: none; }
.of-ticket__tag { color: var(--soft); font-size: var(--text-2xs); font-weight: 800; }
.of-ticket__stars { color: var(--accent); font-size: 0.75rem; letter-spacing: 0.15em; }
.of-ticket__body { display: grid; gap: 0.5rem; padding-block: 0.4rem; border-block: 1px solid color-mix(in srgb, var(--frame) 60%, transparent); }
.of-ticket__text { margin: 0; font-size: var(--text-sm); font-weight: 700; line-height: 1.6; }
.of-ticket__text:lang(fa) { line-height: 1.95; }
.of-ticket__verse { display: grid; gap: 0.15rem; margin: 0; font-size: var(--text-sm); font-weight: 900; line-height: 2; }
.of-ticket--hafez .of-ticket__text { color: var(--soft); font-weight: 600; }
.of-ticket__foot { display: grid; gap: 0.4rem; }
.of-ticket__luck { display: flex; justify-content: space-around; gap: 0.6rem; margin: 0; }
.of-ticket__num, .of-ticket__col { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; justify-content: center; }
.of-ticket__k { color: var(--soft); font-size: var(--text-2xs); }
.of-ticket__luck strong { color: var(--accent); font-weight: 900; }
.of-ticket__swatch { inline-size: 0.8rem; block-size: 0.8rem; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--ink); }
.of-ticket__serial { display: flex; justify-content: space-between; gap: 0.5rem; margin: 0; color: var(--soft); font-size: 0.6rem; }

.of-ticket--big { gap: 0.9rem; padding: 1.4rem 1.3rem; font-size: var(--text-sm); }
.of-ticket--big .of-ticket__brand { font-size: 0.95rem; }
.of-ticket--big .of-ticket__tag { font-size: var(--text-xs); }
.of-ticket--big .of-ticket__stars { font-size: 1rem; }
.of-ticket--big .of-ticket__body { padding-block: 1rem; }
.of-ticket--big .of-ticket__text { font-size: var(--text-xl); }
.of-ticket--big .of-ticket__verse { font-size: var(--text-xl); }
.of-ticket--big.of-ticket--hafez .of-ticket__text { font-size: var(--text-base); }
.of-ticket--big .of-ticket__k { font-size: var(--text-xs); }
.of-ticket--big .of-ticket__luck strong { font-size: var(--text-lg); }
.of-ticket--big .of-ticket__swatch { inline-size: 1.1rem; block-size: 1.1rem; }
.of-ticket--big .of-ticket__serial { font-size: var(--text-2xs); }

/* --- Dialogs -------------------------------------------------------------- */
html.of-dialog-open { overflow: hidden; }
.of-dialog { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--space-4); }
.of-dialog[hidden] { display: none; }
.of-dialog__backdrop { position: absolute; inset: 0; background: rgb(4 2 10 / 78%); backdrop-filter: blur(4px); }
.of-dialog__box {
  position: relative;
  display: grid;
  gap: var(--space-4);
  inline-size: min(100%, 30rem);
  max-block-size: calc(100dvh - 2 * var(--space-4));
  overflow: auto;
  padding: var(--space-5);
  border-radius: 1rem;
  background: linear-gradient(180deg, #1d0d30, #0f0619);
  box-shadow: 0 0 0 2px rgb(255 211 77 / 40%), 0 0 40px -6px rgb(255 79 184 / 40%), 0 30px 60px -20px #000;
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}
.of-dialog.is-open .of-dialog__box { transform: none; opacity: 1; }
.of-book .of-dialog__box { inline-size: min(100%, 34rem); }
.of-dialog__title { margin: 0; color: var(--of-gold); font-size: var(--text-xl); font-weight: 900; text-align: center; }
.of-dialog__title:lang(en) { font-family: var(--of-pixel); font-size: var(--text-base); line-height: 1.5; }
.of-dialog__content { display: grid; gap: var(--space-4); }
.of-dialog__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.of-viewer .of-dialog__box[data-rarity='legendary'] { box-shadow: 0 0 0 2px var(--of-gold), 0 0 60px -4px rgb(255 211 77 / 55%), 0 30px 60px -20px #000; }

.of-book__intro { margin: 0; color: var(--text-muted); font-size: var(--text-sm); text-align: center; }
.of-book__grid { display: grid; gap: 0.55rem; }
.of-book__row { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 0.5rem; background: rgb(255 255 255 / 4%); }
.of-book__name { font-size: var(--text-sm); font-weight: 800; }
.of-book__count { color: var(--text-muted); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.of-book__dots { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.of-book__dot { inline-size: 0.7rem; block-size: 0.7rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 25%); }
.of-book__dot--rare { box-shadow: inset 0 0 0 1.5px #b7c4d6; }
.of-book__dot--legendary { box-shadow: inset 0 0 0 1.5px var(--of-gold); }
.of-book__dot.is-found { background: var(--of-cyan); box-shadow: 0 0 6px rgb(62 232 255 / 60%); }
.of-book__dot--rare.is-found { background: #dfe8f6; box-shadow: 0 0 6px rgb(223 232 246 / 60%); }
.of-book__dot--legendary.is-found { background: var(--of-gold); box-shadow: 0 0 8px rgb(255 211 77 / 80%); }
.of-book__bar { position: relative; block-size: 0.5rem; border-radius: var(--r-full); background: rgb(255 255 255 / 8%); overflow: hidden; }
.of-book__bar::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--of-magenta), var(--of-gold)); }
.of-book__legends { display: grid; gap: 0.5rem; padding: 0.7rem 0.9rem; border-radius: 0.6rem; background: rgb(255 211 77 / 7%); box-shadow: inset 0 0 0 1px rgb(255 211 77 / 25%); }
.of-book__legends h3 { margin: 0; color: var(--of-gold); font-size: var(--text-sm); font-weight: 900; }
.of-book__legends ul { display: grid; gap: 0.4rem; margin: 0; padding-inline-start: 1.1rem; color: var(--text-soft); font-size: var(--text-sm); list-style: '★ '; }
.of-book__none { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
.of-book__reset { color: var(--text-dim); }

/* --- How it works --------------------------------------------------------- */
.of-method { display: grid; gap: var(--space-5); padding-block: var(--space-8) var(--space-12); }
.of-method__title { font-size: var(--text-2xl); font-weight: 900; color: var(--of-gold); }
.of-method__intro { max-inline-size: 46rem; color: var(--text-muted); }
ol.of-method__steps { display: grid; gap: var(--space-3); max-inline-size: 52rem; padding-inline-start: 1.4rem; color: var(--text-soft); line-height: var(--leading-normal); list-style: decimal; }
.of-method__steps li::marker { color: var(--of-magenta); font-weight: 900; }
.of-method__basis { max-inline-size: 52rem; padding: var(--space-4) var(--space-5); border-inline-start: 3px solid var(--of-magenta); background: rgb(255 79 184 / 7%); color: var(--text-soft); font-size: var(--text-sm); line-height: var(--leading-normal); }

/* --- Wide screens: the control deck stands beside the booth -------------- */
/*
  The cabinet is as wide as the window's height allows, so the whole machine
  — marquee to printer — is on screen at once. The booth is 3/5 of what is
  left after the frame and the gutter (3rem), at 4:5, so it stands 0.48 of
  that tall; the rest of the left column is --of-over. Solving for the width
  gives the 2.083 (1 / 0.48) below.
*/
@media (min-width: 64rem) {
  .of-cabinet {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-areas: 'marquee marquee' 'led led' 'booth panel' 'caption panel';
    grid-template-rows: auto auto auto 1fr;
    column-gap: 1rem;
    inline-size: min(100%, 64rem, max(46rem, (var(--of-fit-h) - var(--of-over)) * 2.083 + 3rem));
  }
  .of-tools { inline-size: min(100%, 64rem, max(46rem, (var(--of-fit-h) - var(--of-over)) * 2.083 + 3rem)); }
  .of-marquee { grid-area: marquee; }
  .of-led { grid-area: led; }
  .of-booth { grid-area: booth; }
  .of-caption { grid-area: caption; align-self: start; }
  .of-fx { grid-area: 1 / 1 / -1 / -1; }

  /* The deck packs into one column: gauges and the cash box share a row. */
  .of-panel {
    grid-area: panel;
    zoom: var(--of-zoom, 1);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: 'subjects subjects subjects' 'mode mode mode' 'coin coin coin' 'heat odo cash' 'card card card';
    align-content: start;
    margin-block-start: 0;
  }
  .of-panel:not(:has(.of-mode)) {
    grid-template-areas: 'subjects subjects subjects' 'coin coin coin' 'heat odo cash' 'card card card';
  }
  .of-gauges, .of-tray { display: contents; }
  .of-subjects { grid-area: subjects; }
  .of-mode { grid-area: mode; }
  .of-coinrow { grid-area: coin; }
  .of-heat { grid-area: heat; }
  .of-odo { grid-area: odo; }
  .of-odo__wheel { font-size: 0.85rem; inline-size: 1.2em; }
  .of-cashbox { grid-area: cash; min-block-size: 0; }
  /* Room for a printed card is kept whether or not one is hanging, so a
     card coming out never makes the machine taller. */
  .of-cardslot { grid-area: card; min-block-size: 10.6rem; align-content: start; }
  .of-marquee__title { font-size: calc(1.9rem * var(--of-zoom, 1)); }
  .of-purse { overflow: hidden; gap: 0.5rem; padding-inline: 0.5rem; }
  .of-purse__name { font-size: var(--text-xs); overflow-wrap: anywhere; }
  .of-purse__inf { font-size: 1.3rem; }
}

/* Short windows (a laptop with the browser chrome showing): a tighter deck. */
@media (min-width: 64rem) and (max-height: 52rem) {
  .of-game { --of-led-dot: 5.5; --of-over: 13.5rem; }
  .of-marquee { padding-block: 0.35rem; gap: 0.3rem; }
  .of-marquee__title { font-size: 1.2rem; }
  .of-led { margin-block: 0.4rem; }
  .of-panel { gap: 0.55rem; padding: 0.6rem; }
  .of-btn__cap { inline-size: 2.2rem; }
  .of-btn { gap: 0.25rem; }
  .of-purse { padding-block: 0.35rem; }
  .of-purse__hint { display: none; }
  .of-slot__mouth { block-size: 2rem; }
  .of-heat svg { inline-size: 5.5rem; }
  .of-paper .of-ticket { max-block-size: 7rem; }
  .of-cardslot { min-block-size: 8.1rem; }
  .of-paper .of-ticket__stars { display: none; }
  .of-paper .of-ticket { gap: 0.35rem; padding-block: 0.5rem; }
  .of-caption { min-block-size: 2.4em; }
}

/* --- Full screen ---------------------------------------------------------- */
.of-game:fullscreen {
  --of-fit-h: calc(100dvh - 6rem);
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: var(--space-3) var(--space-4);
  background:
    radial-gradient(50% 45% at 50% 50%, rgb(139 92 246 / 22%), transparent 70%),
    radial-gradient(30% 20% at 50% 100%, rgb(255 79 184 / 16%), transparent 70%),
    var(--of-night);
}
.of-game:fullscreen::before { display: none; }
.of-game:fullscreen .of-stage { gap: var(--space-2); margin-block: auto; padding-block-end: 1.2rem; } /* auto margins centre it without cutting off the top when it is taller than the screen */
@media (min-width: 64rem) {
  /* No site header to make room for: the machine may grow past 64rem. */
  .of-game:fullscreen .of-cabinet,
  .of-game:fullscreen .of-tools { inline-size: min(100%, 92rem, max(46rem, (var(--of-fit-h) - var(--of-over)) * 2.083 + 3rem)); }
  .of-game:fullscreen { --of-led-dot: 8.5; }
}
@media (min-width: 64rem) and (max-height: 52rem) {
  .of-game:fullscreen { --of-led-dot: 6; }
}

/* --- Narrow screens ------------------------------------------------------- */
@media (max-width: 30rem) {
  .of-panel { padding: 0.6rem; gap: 0.65rem; }
  .of-btn { font-size: var(--text-2xs); }
  .of-purse__hint { display: none; }
  .of-tray { grid-template-columns: minmax(0, 1fr); }
  .of-cashbox { min-block-size: 3.6rem; }
  .of-book__row { grid-template-columns: 4.2rem minmax(0, 1fr) auto; }
}

@media (prefers-reduced-motion: reduce) {
  .of-cabinet, .of-cabinet *, .of-ticket, .of-ticket::before, .of-ticket *, .of-p { animation: none !important; transition: none !important; }
  .of-p { opacity: 0; }
}
