:root {
  --bg: #020617;
  --fg: #e2e8f0;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;

  --amber-200: #fde68a;
  --amber-300: #fcd34d;
  --amber-400: #fbbf24;

  --emerald-300: #6ee7b7;
  --emerald-400: #34d399;
  --emerald-500: #10b981;

  /* Every reel dimension derives from this, so the machine scales as a unit. */
  --cell: 3.75rem;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

@media (min-width: 640px) {
  :root { --cell: 5rem; }
}

@media (min-width: 1024px) {
  :root { --cell: 5.75rem; }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, #1e293b 0%, transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ---------------------------------------------------------- outlined copy */

/*
 * Fixed copy ships as SVG glyph outlines (see tools/copy.mjs). Blocks are sized
 * in em and filled with currentColor, so font-size and colour inherit as they
 * would on text and only layout is left to do here.
 */

.svgt-block { display: block; }

.fill-slate-300 { fill: var(--slate-300); }

/*
 * Outlines cannot rewrap, so a paragraph is shaped once per column width and
 * the wrong ones hidden. `svgt-md-up` is for copy with no desktop variant: it
 * keeps the tablet shaping above 640px instead of disappearing at 1024px.
 */
.svgt-only-sm { display: block; }
.svgt-only-md,
.svgt-md-up,
.svgt-only-lg { display: none; }

@media (min-width: 640px) {
  .svgt-only-sm { display: none; }
  .svgt-only-md,
  .svgt-md-up { display: block; }
}

@media (min-width: 1024px) {
  .svgt-only-md { display: none; }
  .svgt-only-lg { display: block; }
}

/* ------------------------------------------------------------------ page */

.page {
  margin: 0 auto;
  width: 100%;
  max-width: 72rem;
  padding: 1.5rem 1rem;
}

@media (min-width: 640px) {
  .page { padding: 2.5rem 1.5rem; }
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.site-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: #fff;
}

@media (min-width: 640px) {
  .site-title { font-size: 1.875rem; }
}

.site-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--slate-400);
}

.compliance-chip {
  margin: 0;
  border-radius: 9999px;
  background: rgb(30 41 59 / 0.8);
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--slate-300);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1);
}

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

.machine {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .machine { grid-template-columns: minmax(0, 1fr) 20rem; }
}

.machine-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---------------------------------------------------------------- cabinet */

/*
 * The gilt rim shared by the reel cabinet and the meters. A gradient on a
 * padded outer element rather than a border, so the metal can catch light at
 * the top and bottom edges and go dark through the middle.
 */
.gilt {
  /* Vertical pass is the metal; horizontal adds the sheen across its face. */
  background:
    linear-gradient(
      90deg,
      rgb(0 0 0 / 0.28) 0%,
      rgb(255 255 255 / 0.16) 22%,
      rgb(255 255 255 / 0) 46%,
      rgb(0 0 0 / 0.22) 78%,
      rgb(255 255 255 / 0.1) 100%
    ),
    linear-gradient(
      180deg,
      #fff6d5 0%,
      #f2c14e 10%,
      #b57612 30%,
      #5f3a0b 50%,
      #a9690f 70%,
      #f0be45 90%,
      #fff8e1 100%
    );
  box-shadow:
    0 0 0 1px rgb(69 39 8 / 0.9),
    0 0 22px -6px rgb(251 191 36 / 0.35),
    0 24px 48px -22px rgb(0 0 0 / 0.95);
}

/* The recessed face that sits inside a .gilt rim. */
.gilt-well {
  background:
    radial-gradient(
      130% 90% at 50% -10%,
      rgb(70 116 186 / 0.5) 0%,
      rgb(38 63 105 / 0.22) 38%,
      transparent 70%
    ),
    radial-gradient(
      100% 60% at 50% 110%,
      rgb(180 119 18 / 0.28) 0%,
      transparent 65%
    ),
    linear-gradient(180deg, #16263f 0%, #060c18 60%, #03060d 100%);
  box-shadow:
    inset 0 2px 7px rgb(0 0 0 / 0.85),
    inset 0 -1px 0 rgb(255 255 255 / 0.07);
}

.cabinet {
  border-radius: 1rem;
  padding: 4px;
}

@media (min-width: 640px) {
  .cabinet { padding: 5px; }
}

.cabinet-inner {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  padding: 0.5rem;
}

@media (min-width: 640px) {
  .cabinet-inner { padding: 0.75rem; }
}

.reel-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.375rem;
}

@media (min-width: 640px) {
  .reel-row { gap: 0.5rem; }
}

/* The glass over the reel window; stops five channels reading as flat boxes. */
.glass-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    rgb(255 255 255 / 0.14) 0%,
    rgb(186 216 255 / 0.06) 16%,
    transparent 40%,
    transparent 82%,
    rgb(0 0 0 / 0.22) 100%
  );
}

/* ------------------------------------------------------------------ reels */

/* Paired inset shadows sell a turning drum rather than a scrolling list. */
.reel-well {
  background: linear-gradient(180deg, #1b3153 0%, #0a1424 45%, #03070e 100%);
  box-shadow:
    inset 0 7px 16px rgb(0 0 0 / 0.8),
    inset 0 -7px 16px rgb(0 0 0 / 0.8),
    0 0 0 1px rgb(251 191 36 / 0.14);
}

.reel-window {
  position: relative;
  overflow: hidden;
  border-radius: 0.125rem;
}

.reel-strip { will-change: transform; }

.reel-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--cell);
}

/* Near full-bleed: the artwork carries its own frame, so padding just shrinks it. */
.reel-sym {
  display: block;
  width: calc(var(--cell) * 0.92);
  height: calc(var(--cell) * 0.92);
  user-select: none;
  opacity: 1;
  transition: opacity 300ms, transform 300ms, filter 300ms;
}

.reel-sym img {
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  object-fit: contain;
  user-select: none;
}

.reel-sym.is-winner {
  transform: scale(1.1);
  filter: drop-shadow(0 0 18px rgb(250 204 21 / 0.9));
}

.reel-sym.is-dim {
  opacity: 0.25;
  filter: saturate(0.5);
}

/*
 * Shading over the symbols, which is what curves the drum — the channel's own
 * inset shadow sits behind them and only shows in the gaps.
 */
.reel-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgb(0 0 0 / 0.45) 0%,
    transparent 50%,
    rgb(0 0 0 / 0.55) 100%
  );
}

/* ----------------------------------------------------------------- meters */

.meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

/*
 * min-width: 0 — a grid item defaults to min-width:auto, so the icon plus the
 * digits would set a floor that scrolls a narrow viewport sideways.
 */
.meter {
  min-width: 0;
  border-radius: 1rem;
  padding: 3px;
}

.meter-inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 13px;
  padding: 0.625rem;
}

@media (min-width: 640px) {
  .meter-inner { gap: 0.75rem; padding: 0.625rem 1rem; }
}

/* Hidden on narrow screens: three icons squeeze the numbers that matter more. */
.meter-icon { display: none; }

@media (min-width: 640px) {
  .meter-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: rgb(251 191 36 / 0.1);
    box-shadow: inset 0 0 0 1px rgb(252 211 77 / 0.25);
  }
}

.meter-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.meter-text { min-width: 0; }

.meter-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: rgb(253 230 138 / 0.6);
}

/* Meter digits, lit like a cabinet readout. */
.readout {
  margin-top: 0.125rem;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 0 14px currentColor,
    0 1px 2px rgb(0 0 0 / 0.8);
}

@media (min-width: 640px) {
  .readout { font-size: 1.5rem; }
}

.accent-amber { color: var(--amber-300); }
.accent-slate { color: var(--slate-200); }

/* The third meter turns green while free spins are running. */
.meter.accent-emerald .accent-amber { color: var(--emerald-300); }

/* ----------------------------------------------------------------- banner */

.banner-row {
  display: flex;
  height: 3rem;
  align-items: center;
  justify-content: center;
}

.banner {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  text-align: center;
}

.banner-dynamic {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.banner-icon {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.banner-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.banner-muted { font-size: 0.875rem; color: var(--slate-500); }
.banner-win { font-size: 1.125rem; font-weight: 700; color: var(--amber-300); }
.banner-freeleft { font-size: 0.875rem; color: var(--emerald-300); }

.banner-free {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--emerald-300);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --------------------------------------------------------------- controls */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-radius: 1rem;
  background: rgb(15 23 42 / 0.6);
  padding: 1rem;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1);
}

.control-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--slate-400);
}

.bet-steps {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.bet-btn {
  height: 2.25rem;
  width: 2.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--slate-800);
  color: var(--slate-300);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms, color 150ms;
}

.bet-btn:hover:not(:disabled) { background: var(--slate-700); }

.bet-btn.is-active {
  background: var(--amber-400);
  color: var(--slate-900);
}

.bet-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.bet-summary {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--slate-500);
}

.btn-primary {
  display: flex;
  height: 4rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 1rem;
  padding: 0 2.5rem;
  background: var(--amber-400);
  color: var(--slate-900);
  font-family: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  cursor: pointer;
  transition: background-color 150ms, transform 100ms;
}

.btn-primary:hover:not(:disabled) { background: var(--amber-300); }
.btn-primary:active:not(:disabled) { transform: scale(0.95); }

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-primary.btn-free { background: var(--emerald-400); }
.btn-primary.btn-free:hover:not(:disabled) { background: var(--emerald-300); }

.btn-topup {
  padding: 0 2rem;
  background: var(--emerald-500);
}

.btn-topup:hover:not(:disabled) { background: var(--emerald-400); }

.broke-note {
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--slate-400);
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  border-radius: 1rem;
  background: rgb(15 23 42 / 0.6);
  padding: 1.25rem;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.1);
}

.panel-heading {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--amber-300);
}

.panel-intro {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--slate-400);
}

.panel-stake {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--slate-400);
}

.stake-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--slate-300);
}

/* --------------------------------------------------------------- paytable */

.paytable {
  margin-top: 1rem;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.paytable th {
  padding-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: right;
  color: var(--slate-400);
}

.paytable th.pt-th-symbol { text-align: left; }

.paytable tbody tr { border-top: 1px solid rgb(255 255 255 / 0.05); }

.pt-name { padding: 0.5rem 0; }

.pt-name-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pt-icon {
  display: block;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
}

.pt-label { color: var(--slate-300); }

.pt-pay {
  padding: 0.5rem 0;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--slate-200);
}

.terms {
  margin: 1rem 0 0;
  border-top: 1px solid rgb(255 255 255 / 0.05);
  padding-top: 1rem;
  font-size: 0.75rem;
  color: var(--slate-400);
}

.terms > div {
  display: flex;
  gap: 0.5rem;
}

.terms > div + div { margin-top: 0.5rem; }

.terms dt {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  color: var(--slate-300);
}

.terms dt img {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.terms dd {
  margin: 0;
  line-height: 1.5;
}

/* ----------------------------------------------------------- win breakdown */

.breakdown-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--amber-300);
  cursor: pointer;
}

.breakdown-sign { color: var(--slate-500); }

.breakdown-body {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.breakdown-body p { margin: 0; }

.muted { color: var(--slate-500); }

.wb-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wb-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.wb-list li + li { margin-top: 0.375rem; }

.wb-list .muted { color: var(--slate-400); }

.wb-icon {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  transform: translateY(0.125rem);
}

.wb-amount {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--amber-300);
}

/* -------------------------------------------------------------- info/footer */

.info {
  display: grid;
  gap: 1.5rem;
  margin-top: 3rem;
  border-top: 1px solid rgb(255 255 255 / 0.1);
  padding-top: 2rem;
}

@media (min-width: 1024px) {
  .info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.info-heading {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--amber-300);
}

/* Outline blocks carry their own leading, so this spaces between them. */
.info-p {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--slate-400);
}

.page-footer {
  margin-top: 2.5rem;
  border-top: 1px solid rgb(255 255 255 / 0.1);
  padding-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--slate-500);
}

.footer-help { margin-top: 0.5rem; }

/* An <a> inside the SVG; the shaper draws the underline, so only fill is left. */
.page-footer a { transition: fill 150ms; }
.page-footer a:hover { fill: var(--slate-300); }

[hidden] { display: none !important; }

/* Players who prefer reduced motion get the outcome without the long spin. */
@media (prefers-reduced-motion: reduce) {
  .reel-window * {
    transition-duration: 1ms !important;
  }
  .banner-free { animation: none; }
}
