/* JACKPOT.EXE — base styles (ported from design handoff) */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=VT323&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg: #05120a;
  --bg-deep: #020806;
  --fg: #7dff9f;
  --fg-dim: #3d8a55;
  --fg-mute: #1f4a2e;
  --accent-1: #ffe169;
  --accent-2: #8be9fd;
  --accent-3: #ff79c6;
  /* accent-4 is the "win" color — pushed into lime-yellow so it
     reads as distinctly different from the base phosphor green (--fg).
     The old #50fa7b shared phosphor's hue and just looked like a more
     saturated version of an unwon symbol. */
  --accent-4: #d7ff3c;
  --warn: #ff5555;
  --glow: 0 0 8px currentColor;
  --scanline: rgba(125, 255, 159, 0.03);
  --font-size: 14px;
}

[data-palette="amber"] {
  --bg: #120a02; --bg-deep: #080402;
  --fg: #ffbf6a; --fg-dim: #a87337; --fg-mute: #4a3418;
  --accent-1: #ffe169; --accent-2: #ff9e3b; --accent-3: #ff5555; --accent-4: #ffd580;
  --scanline: rgba(255, 191, 106, 0.03);
}

[data-palette="noir"] {
  --bg: #0a0518; --bg-deep: #050210;
  --fg: #c4b5fd; --fg-dim: #7a6ea8; --fg-mute: #342a5a;
  --accent-1: #ff79c6; --accent-2: #8be9fd; --accent-3: #ff5555; --accent-4: #50fa7b;
  --scanline: rgba(196, 181, 253, 0.025);
}

[data-palette="hazmat"] {
  --bg: #0e0e05; --bg-deep: #060603;
  --fg: #e6e6b3; --fg-dim: #8a8a5a; --fg-mute: #3d3d24;
  --accent-1: #ffd400; --accent-2: #ff6b1a; --accent-3: #ff2e2e; --accent-4: #b8ff4a;
  --scanline: rgba(230, 230, 179, 0.025);
}

[data-palette="oceanic"] {
  --bg: #041018; --bg-deep: #020810;
  --fg: #9ee0ff; --fg-dim: #4a8aa8; --fg-mute: #1a3a4d;
  --accent-1: #7ee8cf; --accent-2: #ffd580; --accent-3: #ff77aa; --accent-4: #a8ff60;
  --scanline: rgba(158, 224, 255, 0.03);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--fg);
  font-family: 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace;
  font-size: var(--font-size);
  line-height: 1.4;
  min-height: 100vh;
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "zero" 1, "ss01" 1;
  overflow: hidden;
}

body {
  background:
    radial-gradient(ellipse at center, var(--bg) 0%, var(--bg-deep) 90%),
    var(--bg-deep);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 3px
  );
  z-index: 9999;
  mix-blend-mode: screen;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
  z-index: 9998;
}

.c-fg { color: var(--fg); }
.c-dim { color: var(--fg-dim); }
.c-mute { color: var(--fg-mute); }
.c-a1 { color: var(--accent-1); }
.c-a2 { color: var(--accent-2); }
.c-a3 { color: var(--accent-3); }
.c-a4 { color: var(--accent-4); }
.c-warn { color: var(--warn); }

.glow { text-shadow: 0 0 6px currentColor, 0 0 12px currentColor; }
.glow-soft { text-shadow: 0 0 4px currentColor; }

pre, .ascii {
  font-family: inherit;
  margin: 0;
  white-space: pre;
  line-height: 1;
}

.mono { font-family: 'IBM Plex Mono', monospace; }
.vt { font-family: 'VT323', monospace; }

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.2; }
}
.blink { animation: blink 1s steps(1) infinite; }

@keyframes blink-soft {
  0%, 70% { opacity: 1; }
  80%, 100% { opacity: 0.35; }
}
.blink-soft { animation: blink-soft 1.4s ease-in-out infinite; }

/* Reusable box-frame pattern. Flex column so .box-body can stretch to
   fill whatever height the box is given, and nested scrollable regions
   work. Title is absolute-positioned so it overlays the border and is
   out of the flex flow. */
.box {
  border: 1px solid var(--accent-1);
  position: relative;
  padding: 12px 12px 8px;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.box > .box-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.box.a2 { border-color: var(--accent-2); }
.box.a3 { border-color: var(--accent-3); }
.box.a4 { border-color: var(--accent-4); }
.box-title {
  position: absolute;
  top: -10px;
  left: 14px;
  background: var(--bg-deep);
  padding: 0 8px;
  font-size: 0.85em;
  letter-spacing: 0.12em;
  text-shadow: 0 0 6px currentColor;
  color: inherit;
  white-space: nowrap;
}
.box.a1 > .box-title { color: var(--accent-1); }
.box.a2 > .box-title { color: var(--accent-2); }
.box.a3 > .box-title { color: var(--accent-3); }
.box.a4 > .box-title { color: var(--accent-4); }

/* Reel styles */
.reelbank-wrap {
  position: relative;
  display: inline-block;
}
.payline-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.payline-overlay.win-lines {
  overflow: visible;
}
.win-line-under {
  opacity: 0.18;
}
.win-line {
  filter: drop-shadow(0 0 2px currentColor);
  opacity: 0.56;
  animation: win-line-pulse 1.6s ease-in-out infinite;
}
.win-line-dot {
  opacity: 0.4;
  filter: drop-shadow(0 0 2px currentColor);
  animation: win-line-pulse 1.6s ease-in-out infinite;
}
@keyframes win-line-pulse {
  0%, 100% { opacity: 0.52; }
  50% { opacity: 0.24; }
}
.reelbank {
  display: flex;
  gap: 4px;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.reel {
  border: 1px solid var(--accent-2);
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.4);
  text-align: center;
  width: 9ch;
  flex: 0 0 9ch;
  min-width: 7ch;
}
.reel.spinning {
  position: relative;
}
.reel.spinning .reel-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
}
.reel.spinning .reel-sizer {
  visibility: hidden;
}
.reel.spinning .reel-strip {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  will-change: transform;
}
.reel.spinning .spin-cell {
  padding: 2px 0;
}
.reel.spinning .sym + .sym {
  margin-top: 2px;
}
.reel.win { border-color: var(--accent-4); }
.reel .sym {
  line-height: 1;
  padding: 2px 0;
  text-shadow: 0 0 3px currentColor;
}
/* All three rows are valid paylines — don't dim top/bottom and don't
   privilege mid. Payline hints are drawn as an SVG overlay instead. */
.reel .sym + .sym { margin-top: 2px; }

/* Winning cells (any row) get the bright accent flash. */
.reel.win .sym.hit {
  color: var(--accent-4);
  text-shadow: 0 0 8px currentColor;
}

/* NULL scatter symbol renders in accent-3 (each palette's warn/urgent
   shade — phosphor pink, amber red, noir red, hazmat bright-red,
   oceanic hot-pink) with a stronger glow so it pops as "foreign /
   anomalous" next to the line-art symbols. */
.reel .sym.sym-nul {
  color: var(--accent-3);
  text-shadow: 0 0 10px currentColor, 0 0 4px currentColor;
}
/* If the reel has a NULL in it, tint the border too so it's obvious
   from a glance that something unusual is on that reel. */
.reel.has-nul {
  border-color: var(--accent-3);
}

@keyframes win-pulse {
  0%, 100% {
    border-color: var(--accent-4);
    box-shadow: 0 0 6px var(--accent-4), inset 0 0 6px rgba(215, 255, 60, 0.22);
  }
  50% {
    border-color: var(--accent-1);
    box-shadow: 0 0 16px var(--accent-4), inset 0 0 12px rgba(215, 255, 60, 0.38);
  }
}
.reel.win {
  animation: win-pulse 0.55s ease-in-out infinite;
}

@keyframes mid-flash {
  0%, 100% { opacity: 1; text-shadow: 0 0 8px currentColor; }
  50%      { opacity: 0.55; text-shadow: 0 0 16px currentColor; }
}
.reel.win .sym.hit {
  animation: mid-flash 0.45s ease-in-out infinite;
  transform-origin: center center;
}

/* Per-symbol win-flash motion. Each keyframe adds a small transform
   on top of the mid-flash color pulse so a winning reel reads with
   symbol-specific character — cherries bob, sevens wobble, bars
   pump, diamonds sparkle, bells ring. Kept subtle: duration ~0.55s,
   infinite so it loops while the win state is held, amplitudes small
   so the reel footprint doesn't visibly jump. */
@keyframes cherry-bob {
  0%, 100% { transform: translateY(0)   scale(1);    }
  50%      { transform: translateY(-2px) scale(1.08); }
}
@keyframes seven-wobble {
  0%, 100% { transform: rotate(0deg);   }
  25%      { transform: rotate(-4deg);  }
  75%      { transform: rotate(4deg);   }
}
@keyframes bar-pump {
  0%, 100% { transform: scaleY(1);    }
  50%      { transform: scaleY(1.12); }
}
@keyframes diamond-sparkle {
  0%, 100% { transform: scale(1);    filter: brightness(1);   }
  50%      { transform: scale(1.08); filter: brightness(1.4); }
}
@keyframes bell-ring {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-6deg); }
  50%      { transform: rotate(6deg); }
  80%      { transform: rotate(-3deg); }
}
.reel.win .sym.hit.sym-chr { animation: mid-flash 0.45s ease-in-out infinite, cherry-bob    0.55s ease-in-out infinite; }
.reel.win .sym.hit.sym-svn { animation: mid-flash 0.45s ease-in-out infinite, seven-wobble  0.6s  ease-in-out infinite; }
.reel.win .sym.hit.sym-bar { animation: mid-flash 0.45s ease-in-out infinite, bar-pump      0.5s  ease-in-out infinite; }
.reel.win .sym.hit.sym-dia { animation: mid-flash 0.45s ease-in-out infinite, diamond-sparkle 0.55s ease-in-out infinite; }
.reel.win .sym.hit.sym-bel { animation: mid-flash 0.45s ease-in-out infinite, bell-ring     0.65s ease-in-out infinite; }

/* ASCII progress bar */
.bar-track .fill { color: var(--accent-4); text-shadow: 0 0 6px currentColor; }
.bar-track .empty { color: var(--fg-mute); }

/* Button / command-bar chip */
.cmdbtn {
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
  padding: 8px 4px;
  text-align: center;
  background: rgba(0, 0, 0, 0.4);
  text-shadow: 0 0 4px currentColor;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  /* iOS: skip the 300ms double-tap-zoom delay and kill the gray flash.
     Without this, fast taps on BET+ / BET- trigger zoom-to-text. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 80ms ease, color 80ms ease;
}
/* Hover state only on devices that actually hover (mice / trackpads).
   On iOS, :hover sticks after tap until the user taps elsewhere,
   which reads as "button is still highlighted" flicker. Gating on
   @media (hover: hover) cleanly excludes touch. :focus-visible stays
   unwrapped so keyboard navigation still works. */
@media (hover: hover) {
  .cmdbtn:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}
.cmdbtn:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}
.cmdbtn:active { transform: translateY(1px); }
.cmdbtn.a1 { border-color: var(--accent-1); color: var(--accent-1); }
.cmdbtn.a3 { border-color: var(--accent-3); color: var(--accent-3); }
.cmdbtn.a4 { border-color: var(--accent-4); color: var(--accent-4); }
.cmdbtn[disabled] { opacity: 0.4; cursor: not-allowed; }
.cmdbtn .k {
  display: block;
  font-size: 0.75em;
  opacity: 0.7;
}
.cmdbtn .l {
  font-weight: 600;
  letter-spacing: 0.1em;
}

/* Bet ladder chip */
.bet-step {
  padding: 0 6px;
  color: var(--fg-dim);
}
.bet-step.active {
  color: var(--accent-1);
  border-bottom: 1px solid var(--accent-1);
  text-shadow: 0 0 6px currentColor;
}

/* Clickable palette indicator used in both layout headers */
.pal-chip {
  appearance: none;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--fg-mute);
  color: inherit;
  font: inherit;
  padding: 2px 8px;
  cursor: pointer;
  letter-spacing: 0.06em;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Equal-width digits so the claim-countdown label doesn't tick the
     chip's width every second (same flicker class we fixed on mobile
     PAL earlier). */
  font-variant-numeric: tabular-nums;
  transition: border-color 120ms ease, background 120ms ease;
}
@media (hover: hover) {
  .pal-chip:hover {
    border-color: var(--accent-1);
    background: rgba(255, 255, 255, 0.04);
  }
}
.pal-chip:focus-visible {
  border-color: var(--accent-1);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}
.pal-chip:active { transform: translateY(1px); }
/* Claim chip shows a changing countdown ("CLAIM" / "M:SS" / "H:MM:SS").
   Reserve enough width for the widest state so the chip never resizes
   as the label ticks. 7ch covers "1:00:00" at the top of the hour;
   "CLAIM" sits shorter and gets centered. */
.pal-chip[data-action="claim"] {
  min-width: 7ch;
  text-align: center;
}
/* Palette chip cycles through labels of different lengths:
   "PAL NOIR" (8), "PAL AMBER" (9), "PAL HAZMAT" (10), "PAL OCEANIC" (11),
   "PAL PHOSPHOR" (12). Without a min-width the chip resizes every tap,
   which in turn reshuffles the surrounding title-state inline flow. Lock
   it to the widest label so cycling is purely a color/text change. */
.pal-chip[data-action="palette"] {
  min-width: 12ch;
  text-align: center;
}

/* Boot card */
#boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(125, 255, 159, 0.06), transparent 35%),
    var(--bg-deep);
  z-index: 10000;
  transition: opacity 220ms ease, visibility 220ms ease;
}
#boot.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-card {
  width: min(92vw, 440px);
  border: 1px solid var(--accent-1);
  background: rgba(0, 0, 0, 0.4);
  padding: 28px 24px;
  text-align: center;
}
.boot-kicker {
  color: var(--accent-1);
  font-size: 12px;
  letter-spacing: 0.22em;
  margin-bottom: 10px;
  text-shadow: 0 0 8px currentColor;
}
.boot-title {
  color: var(--fg);
  font-size: clamp(22px, 4.5vw, 36px);
  letter-spacing: 0.06em;
  margin-bottom: 22px;
  text-shadow: 0 0 8px currentColor;
}
.boot-bar {
  width: 100%;
  height: 14px;
  border: 1px solid var(--accent-1);
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
#boot-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--fg-dim), var(--accent-4));
  transition: width 140ms linear;
}
#boot-text {
  margin-top: 14px;
  color: var(--fg-dim);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.boot-disclaimer {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px dashed var(--fg-mute);
  color: var(--fg-mute);
  font-size: 11px;
  letter-spacing: 0.14em;
}

/* Info / settings modal */
.info-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 6, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 10001;
}
.info-overlay.open { display: flex; }
.info-card {
  width: min(92vw, 560px);
  max-height: 86vh;
  border: 1px solid var(--accent-1);
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 24px rgba(255, 225, 105, 0.2);
}
.info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px dashed var(--fg-mute);
  letter-spacing: 0.1em;
  font-size: 13px;
}
.info-close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--fg-mute);
  color: var(--fg);
  font: inherit;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 12px;
  cursor: pointer;
  letter-spacing: 0.08em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
@media (hover: hover) {
  .info-close:hover {
    border-color: var(--accent-3);
    color: var(--accent-3);
  }
}
.info-close:focus-visible {
  border-color: var(--accent-3);
  color: var(--accent-3);
  outline: none;
}
.info-body {
  overflow-y: auto;
  padding: 14px 16px 18px;
  font-size: 13px;
  line-height: 1.5;
}
.info-section + .info-section { margin-top: 16px; }
.info-section-title {
  font-size: 12px;
  letter-spacing: 0.14em;
  margin-bottom: 6px;
  text-shadow: 0 0 6px currentColor;
}
.info-section-body {
  color: var(--fg-dim);
  font-size: 12.5px;
}
.info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  cursor: pointer;
}
.info-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-4);
  cursor: pointer;
}
.info-keys-row { font-family: inherit; letter-spacing: 0.04em; }

.app-hidden { opacity: 0; visibility: hidden; }

/* Brief screen flash on bonus enter / exit. .flash-in tints alarm
   (accent-3, pink/red), .flash-out tints calm (accent-4, green/lime).
   Both auto-clear via animationend handler in main.js. */
#bonus-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  opacity: 0;
  background: var(--accent-3);
  mix-blend-mode: screen;
}
#bonus-flash.flash-in  { background: var(--accent-3); animation: bonus-flash-pulse 360ms ease-out; }
#bonus-flash.flash-out { background: var(--accent-4); animation: bonus-flash-pulse 360ms ease-out; }
@keyframes bonus-flash-pulse {
  0%   { opacity: 0; }
  25%  { opacity: 0.55; }
  100% { opacity: 0; }
}

/* Subtle reelbank treatment while bonus is active — wraps the whole
   reel area in an accent-3 dashed frame so it's visually unambiguous
   from any glance that we're in an unusual mode. */
.reelbank-wrap.in-bonus {
  outline: 1px dashed var(--accent-3);
  outline-offset: 6px;
  box-shadow: 0 0 14px -4px var(--accent-3);
}
#app {
  width: 100%;
  height: 100vh;
  height: 100svh;
  display: flex;
  padding: 12px;
  overflow: hidden;
}
#layout-root {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}
.layout-stage {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
}
.layout-stage-inner {
  width: 100%;
  flex: 1;
  min-height: 0;
}
.layout-stage.is-scaled {
  flex: 0 0 auto;
  align-items: flex-start;
}
.layout-stage.is-scaled .layout-stage-inner {
  flex: 0 0 auto;
}
