/* =========================================================================
   CYBER HEIST — game.css
   Every rule is scoped under .chs- so this file can't leak into, or be
   leaked into by, the shared site stylesheet (/css/styles.css).
   No image assets — all 11 symbols are emoji/CSS glyphs.
   ========================================================================= */

:root {
  --chs-black: #030704;
  --chs-black-2: #050d08;
  --chs-panel: #071a0f;
  --chs-panel-2: #0b2416;
  --chs-panel-3: #0f2e1c;
  --chs-green: #39ff88;
  --chs-green-bright: #7dffb0;
  --chs-green-dim: #1f6b42;
  --chs-cyan: #4df3ff;
  --chs-cyan-bright: #a6faff;
  --chs-ink: #dffbea;
  --chs-ink-dim: #8fc9a6;
  --chs-ink-faint: #4f7d63;
  --chs-win-glow: #b6ff5e;
  --chs-danger: #ff5d6c;
  --chs-line-glow: #6dffb8;
  --chs-border: rgba(57, 255, 136, 0.24);
  --chs-shadow: rgba(0, 0, 0, 0.65);

  --chs-radius-sm: 8px;
  --chs-radius-md: 14px;
  --chs-radius-lg: 22px;

  --chs-safe-top: env(safe-area-inset-top, 0px);
  --chs-safe-bottom: env(safe-area-inset-bottom, 0px);
  --chs-safe-left: env(safe-area-inset-left, 0px);
  --chs-safe-right: env(safe-area-inset-right, 0px);

  --chs-font: 'Consolas', 'SFMono-Regular', Menlo, 'Courier New', ui-monospace, monospace;
}

/* Hide the shared site chrome while a hand is actually in progress. */
body:has(.chs-root.is-playing) .chs-site-header,
body:has(.chs-root.is-playing) #footer {
  display: none;
}

.chs-root {
  font-family: var(--chs-font);
  color: var(--chs-ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(77, 243, 255, 0.10), transparent 55%),
    linear-gradient(180deg, var(--chs-black) 0%, var(--chs-black-2) 55%, #061309 100%);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  padding-left: var(--chs-safe-left);
  padding-right: var(--chs-safe-right);
  box-sizing: border-box;
}

.chs-root * {
  box-sizing: border-box;
}

.chs-screen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(1.25rem + var(--chs-safe-top)) 1rem calc(1.25rem + var(--chs-safe-bottom));
}

.chs-screen[hidden] {
  display: none !important;
}

.chs-btn[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Ambient scanline flicker — pure CSS, no per-frame JS.
   ------------------------------------------------------------------------- */
.chs-scanline-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    repeating-linear-gradient(0deg, rgba(57, 255, 136, 0.05) 0px, rgba(57, 255, 136, 0.05) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse 60% 40% at 70% 0%, rgba(77, 243, 255, 0.14), transparent 60%);
  opacity: 0.55;
  animation: chs-flicker 6s infinite ease-in-out;
}

@keyframes chs-flicker {
  0%, 92%, 100% { opacity: 0.55; }
  93% { opacity: 0.85; }
  93.6% { opacity: 0.3; }
  94.2% { opacity: 0.7; }
  95% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .chs-scanline-bg { animation: none; opacity: 0.4; }
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.chs-btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--chs-radius-md);
  border: 1px solid var(--chs-border);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  background: var(--chs-panel-2);
  color: var(--chs-ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chs-btn:hover { filter: brightness(1.12); }
.chs-btn:active { transform: scale(0.97); }

.chs-btn--primary {
  background: linear-gradient(180deg, var(--chs-green-bright), var(--chs-green));
  color: #04170c;
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(57, 255, 136, 0.35);
}

.chs-btn--ghost {
  background: transparent;
  border-color: var(--chs-border);
}

.chs-btn--disabled,
.chs-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.chs-btn:disabled:active { transform: none; }

.chs-btn--icon {
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
}

/* -------------------------------------------------------------------------
   Menu screen
   ------------------------------------------------------------------------- */
.chs-screen--menu { justify-content: center; }

.chs-menu-card {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--chs-panel), var(--chs-panel-2));
  border: 1px solid var(--chs-border);
  border-radius: var(--chs-radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--chs-shadow);
}

.chs-menu-glyphs {
  font-size: 3rem;
  margin-bottom: 0.25rem;
  filter: drop-shadow(0 0 18px rgba(57, 255, 136, 0.55));
}

.chs-title {
  font-size: 2.7rem;
  margin: 0;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, var(--chs-green-bright), var(--chs-green) 60%, #0f6b39);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(57, 255, 136, 0.25);
}

.chs-tagline {
  color: var(--chs-ink-dim);
  margin: 0.6rem 0 1.4rem;
  font-size: 0.98rem;
}

.chs-menu-jackpot {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(57, 255, 136, 0.08);
  border: 1px solid var(--chs-border);
  border-radius: var(--chs-radius-md);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
}

.chs-menu-jackpot-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--chs-ink-faint);
}

.chs-menu-jackpot-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--chs-green-bright);
  font-variant-numeric: tabular-nums;
}

.chs-menu-jackpot-unit {
  font-size: 0.78rem;
  color: var(--chs-ink-faint);
}

.chs-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.chs-fineprint {
  margin-top: 1.4rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--chs-ink-faint);
}

/* -------------------------------------------------------------------------
   Help / paytable screen
   ------------------------------------------------------------------------- */
.chs-screen--help { align-items: stretch; padding-left: 0; padding-right: 0; }

.chs-help-panel {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  background: var(--chs-panel);
  border: 1px solid var(--chs-border);
  border-radius: var(--chs-radius-lg);
  overflow: hidden;
}

.chs-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--chs-border);
  position: sticky;
  top: 0;
  background: var(--chs-panel);
  z-index: 2;
}

.chs-help-header h2 { margin: 0; font-size: 1.2rem; }

.chs-help-body { padding: 1.25rem; }

.chs-help-note {
  color: var(--chs-ink-dim);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-top: 0;
}

.chs-paytable-wrap {
  overflow-x: auto;
  border-radius: var(--chs-radius-md);
  border: 1px solid var(--chs-border);
  margin: 1rem 0 1.5rem;
}

.chs-paytable {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  font-size: 0.88rem;
}

.chs-paytable th, .chs-paytable td {
  padding: 0.55rem 0.7rem;
  text-align: center;
  border-bottom: 1px solid rgba(57, 255, 136, 0.08);
  white-space: nowrap;
}

.chs-paytable th {
  color: var(--chs-ink-faint);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.chs-paytable td:first-child, .chs-paytable th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--chs-panel);
}

.chs-paytable-glyph { font-size: 1.3rem; margin-right: 0.4rem; }
.chs-paytable-name { color: var(--chs-ink); font-weight: 600; }
.chs-paytable-sub { display: block; color: var(--chs-ink-faint); font-size: 0.72rem; font-weight: 400; }

.chs-help-rules h3 {
  font-size: 0.98rem;
  margin: 1.1rem 0 0.35rem;
  color: var(--chs-green-bright);
}
.chs-help-rules p {
  margin: 0 0 0.6rem;
  color: var(--chs-ink-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Play screen
   ------------------------------------------------------------------------- */
.chs-screen--play {
  position: relative;
  padding-top: calc(0.6rem + var(--chs-safe-top));
  gap: 0.6rem;
}

.chs-play-topbar {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: auto 1fr 1fr auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.chs-chip {
  background: var(--chs-panel-2);
  border: 1px solid var(--chs-border);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  min-width: 0;
}

.chs-chip-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--chs-ink-faint);
}

.chs-chip-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--chs-green-bright);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.chs-chip--jackpot .chs-chip-value { color: var(--chs-cyan-bright); }

.chs-status-strip {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--chs-ink-faint);
  margin-bottom: 0.4rem;
}

.chs-status-item strong { color: var(--chs-ink); }

#freeSpinsIndicator strong, #bonusIndicator strong { color: var(--chs-green-bright); }

.chs-reel-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  background: linear-gradient(180deg, var(--chs-panel), var(--chs-panel-2));
  border: 1px solid var(--chs-border);
  border-radius: var(--chs-radius-lg);
  padding: 0.6rem;
  box-shadow: 0 16px 50px var(--chs-shadow), inset 0 0 40px rgba(77, 243, 255, 0.05);
  /* Content-sized on purpose — flex:1 1 auto here would stretch this card
     to fill leftover viewport height inside .chs-screen's min-height:100vh
     column and center the (correctly sized) reel grid inside a much taller
     box, leaving dead space above/below. Let it size to its content. */
}

.chs-reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  width: 100%;
  aspect-ratio: 5 / 3;
  max-height: 52vh;
}

.chs-reel {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(15, 46, 28, 0.9), rgba(3, 7, 4, 0.95));
  border-radius: var(--chs-radius-sm);
  border: 1px solid rgba(57, 255, 136, 0.08);
}

.chs-reel--thud { animation: chs-thud 0.18s ease-out; }
@keyframes chs-thud {
  0% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

.chs-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.chs-cell {
  height: 0;
  flex: 0 0 auto;
  /* Padding-percentage resolves against the element's own WIDTH, not the
     strip's height — 100% keeps each cell square (matching one column's
     width) inside the 5:3 reel frame. Do not shrink this to a fraction
     like 33% — that would leave two-thirds of every reel empty at rest. */
  padding-top: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chs-cell .chs-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 6.4vw, 2.6rem);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

.chs-cell--wild .chs-glyph { filter: drop-shadow(0 0 10px rgba(57, 255, 136, 0.85)); }

/* The Kingpin (id 10) reads as visibly bigger and more gilded-green than
   the plain Access Granted wild, even though both lean on the same neon
   glow motif. */
.chs-cell--top .chs-glyph {
  font-size: clamp(1.6rem, 7.4vw, 3rem);
  filter: drop-shadow(0 0 16px rgba(125, 255, 176, 1)) drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px #fff);
}

.chs-cell--scatter .chs-glyph { filter: drop-shadow(0 0 8px rgba(77, 243, 255, 0.9)); }

.chs-cell--win::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 2px solid var(--chs-line-glow);
  box-shadow: 0 0 14px var(--chs-line-glow), inset 0 0 10px rgba(109, 255, 184, 0.4);
  pointer-events: none;
}

.chs-cell--win-pulse::after { animation: chs-win-pulse 0.9s ease-in-out infinite; }
@keyframes chs-win-pulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

.chs-win-banner {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translateX(-50%);
  background: rgba(3, 7, 4, 0.9);
  border: 1px solid var(--chs-green);
  color: var(--chs-green-bright);
  font-weight: 800;
  font-size: clamp(1rem, 4vw, 1.5rem);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  box-shadow: 0 0 26px rgba(57, 255, 136, 0.5);
  z-index: 3;
  animation: chs-banner-pop 0.35s ease-out;
  pointer-events: none;
}

@keyframes chs-banner-pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* -------------------------------------------------------------------------
   Controls
   ------------------------------------------------------------------------- */
.chs-controls {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.5rem 0.6rem;
  margin-top: 0.6rem;
  align-items: end;
}

.chs-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.chs-control-group--total { grid-column: 1 / 3; flex-direction: row; align-items: baseline; gap: 0.5rem; }

.chs-control-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--chs-ink-faint);
}

.chs-select {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--chs-panel-2);
  color: var(--chs-ink);
  border: 1px solid var(--chs-border);
  border-radius: var(--chs-radius-sm);
  padding: 0.5rem 0.6rem;
}

.chs-total-bet {
  font-weight: 800;
  color: var(--chs-green-bright);
  font-variant-numeric: tabular-nums;
}

.chs-btn--spin {
  grid-column: 3;
  grid-row: 1 / 3;
  min-width: 108px;
  min-height: 64px;
  border-radius: var(--chs-radius-lg);
  background: linear-gradient(180deg, var(--chs-green-bright), var(--chs-green));
  color: #04170c;
  border: none;
  box-shadow: 0 8px 26px rgba(57, 255, 136, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
}

.chs-spin-label { font-size: 1rem; letter-spacing: 0.06em; }
.chs-spin-glyph { font-size: 1.3rem; }

.chs-btn--spin.is-spinning .chs-spin-glyph { animation: chs-glyph-spin 0.6s linear infinite; }
@keyframes chs-glyph-spin {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

@media (min-width: 720px) {
  .chs-controls { grid-template-columns: 1fr 1fr 1fr auto; }
  .chs-control-group--total { grid-column: 3; flex-direction: column; align-items: flex-start; }
  .chs-btn--spin { grid-column: 4; }
}

/* -------------------------------------------------------------------------
   Bonus pick overlay
   ------------------------------------------------------------------------- */
.chs-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem calc(1rem + var(--chs-safe-right)) calc(1rem + var(--chs-safe-bottom)) calc(1rem + var(--chs-safe-left));
  background: rgba(1, 4, 2, 0.86);
  backdrop-filter: blur(2px);
}

.chs-overlay[hidden] {
  display: none;
}

.chs-bonus-panel {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--chs-panel), #082013);
  border: 1px solid var(--chs-border);
  border-radius: var(--chs-radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 20px 60px var(--chs-shadow);
}

.chs-bonus-title { margin: 0 0 0.2rem; color: var(--chs-green-bright); }
.chs-bonus-sub { margin: 0 0 1rem; color: var(--chs-ink-dim); font-size: 0.9rem; }

.chs-bonus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.chs-bonus-tile {
  aspect-ratio: 1;
  border-radius: var(--chs-radius-md);
  border: 1px solid var(--chs-border);
  background: radial-gradient(circle at 50% 30%, #123322, #061007);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--chs-ink);
  transition: transform 0.12s ease, filter 0.12s ease;
}

.chs-bonus-tile:hover:not(.is-revealed) { transform: translateY(-2px); filter: brightness(1.2); }
.chs-bonus-tile:active:not(.is-revealed) { transform: scale(0.96); }

.chs-bonus-tile.is-revealed {
  cursor: default;
  background: radial-gradient(circle at 50% 30%, #10401f, #052210);
  border-color: var(--chs-green);
  flex-direction: column;
  font-size: 1rem;
  font-weight: 800;
  color: var(--chs-green-bright);
  animation: chs-tile-reveal 0.35s ease-out;
}

.chs-bonus-tile.is-dim { opacity: 0.35; cursor: default; }

@keyframes chs-tile-reveal {
  0% { transform: scale(0.7) rotateY(90deg); }
  100% { transform: scale(1) rotateY(0); }
}

.chs-bonus-total { color: var(--chs-ink-dim); font-size: 0.95rem; }
.chs-bonus-total strong { color: var(--chs-green-bright); }

/* -------------------------------------------------------------------------
   Pause / menu overlay
   ------------------------------------------------------------------------- */
.chs-overlay--pause { background: rgba(1, 4, 2, 0.78); }

/* -------------------------------------------------------------------------
   Jackpot overlay
   ------------------------------------------------------------------------- */
.chs-overlay--jackpot { background: rgba(1, 2, 2, 0.94); }

.chs-jackpot-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(166, 250, 255, 0.85), transparent 60%);
  animation: chs-jackpot-flash 1.6s ease-in-out infinite;
}

@keyframes chs-jackpot-flash {
  0%, 100% { opacity: 0; }
  4% { opacity: 1; }
  8% { opacity: 0.15; }
  12% { opacity: 0.85; }
  16% { opacity: 0; }
  55% { opacity: 0; }
  58% { opacity: 0.6; }
  61% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .chs-jackpot-flash { animation: none; opacity: 0.15; }
}

.chs-jackpot-panel {
  position: relative;
  text-align: center;
  z-index: 1;
}

.chs-jackpot-glyph {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 30px rgba(125, 255, 176, 0.9));
}

.chs-jackpot-title {
  font-size: clamp(1.7rem, 8vw, 3rem);
  margin: 0;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff, var(--chs-green-bright) 55%, var(--chs-green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.chs-jackpot-sub { color: var(--chs-ink-dim); margin: 0.4rem 0; }

.chs-jackpot-amount {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  font-weight: 800;
  color: var(--chs-green-bright);
  margin: 0.6rem 0 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   Loading screen
   ------------------------------------------------------------------------- */
.chs-screen--loading { justify-content: center; align-items: center; }
.chs-loading-glyph { font-size: 3rem; animation: chs-loading-pulse 1s ease-in-out infinite; }
.chs-loading-text { color: var(--chs-ink-dim); margin-top: 0.5rem; }
@keyframes chs-loading-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}


/* Shown while the reels turn waiting on the server's outcome (SMO mode only). Softened so
   the swap between symbols reads as motion rather than a flicker. */
.chs-cell--blur, .chs-cell--blur .chs-glyph {
  filter: blur(2.5px);
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .chs-cell--blur, .chs-cell--blur .chs-glyph { filter: none; opacity: 0.8; }
}
