/* ==========================================================================
   Frontier Saloon — game shell styles
   Scoped with .fsa-* so the shared site stylesheet can't leak in and we
   can't leak out. Mobile-first, single file, no image assets — every
   symbol is emoji/CSS.
   ========================================================================== */

:root {
  /* Dusty saloon palette: brown/tan ground, deep red and gold accents. */
  --fsa-bg-0:        #241209;
  --fsa-bg-1:        #34200f;
  --fsa-bg-2:        #4a2e17;
  --fsa-tan:         #d9b98a;
  --fsa-tan-soft:    #ecd9b8;
  --fsa-brown:       #6b4423;
  --fsa-red:         #8a2323;
  --fsa-red-soft:    #c94444;
  --fsa-gold:        #c9a227;
  --fsa-gold-soft:   #e8c96a;
  --fsa-ink:         #f6ead4;
  --fsa-ink-dim:     #c9ab84;
  --fsa-panel:       rgba(36, 18, 9, 0.92);
  --fsa-panel-line:  rgba(201, 162, 39, 0.24);
  --fsa-chip:        rgba(15, 8, 4, 0.6);
  --fsa-cell:        rgba(255, 255, 255, 0.06);
  --fsa-radius:      16px;
  --fsa-font:        'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --fsa-safe-t:      env(safe-area-inset-top, 0px);
  --fsa-safe-b:      env(safe-area-inset-bottom, 0px);
  --fsa-safe-l:      env(safe-area-inset-left, 0px);
  --fsa-safe-r:      env(safe-area-inset-right, 0px);
}

html, body.fsa-body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--fsa-bg-0);
  color: var(--fsa-ink);
  font-family: var(--fsa-font);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* --------------------------------------------------------------------------
   Shared site header — visible on the menu/help, hidden during play.
   -------------------------------------------------------------------------- */
.fsa-site-header {
  position: relative;
  z-index: 40;
  font-size: 13px;
}
.fsa-site-header header {
  padding: 10px calc(16px + var(--fsa-safe-r)) 10px calc(16px + var(--fsa-safe-l));
  padding-top: calc(10px + var(--fsa-safe-t));
  background: rgba(20, 10, 4, .78);
  border-bottom: 1px solid var(--fsa-panel-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.fsa-site-header a { color: var(--fsa-ink-dim); text-decoration: none; padding: 5px 9px; border-radius: 8px; }
.fsa-site-header a:hover { color: var(--fsa-ink); background: rgba(255,255,255,.07); }
.fsa-site-header a.active { color: var(--fsa-gold); background: rgba(201,162,39,.14); }

body:has(.fsa-root.is-playing) .fsa-site-header,
body:has(.fsa-root.is-playing) #footer { display: none; }

.fsa-root {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(60vw 60vw at 15% -10%, rgba(138, 35, 35, .2), transparent 60%),
    radial-gradient(70vw 70vw at 110% 10%, rgba(201, 162, 39, .14), transparent 60%),
    linear-gradient(180deg, var(--fsa-bg-1), var(--fsa-bg-0) 60%);
}
.fsa-root.is-playing { height: 100vh; overflow: hidden; }

/* --------------------------------------------------------------------------
   Generic dialog-style screens (loading / menu / help / bonus / jackpot)
   -------------------------------------------------------------------------- */
.fsa-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--fsa-safe-t)) calc(16px + var(--fsa-safe-r)) calc(20px + var(--fsa-safe-b)) calc(16px + var(--fsa-safe-l));
  opacity: 0;
  transform: scale(.98);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 20;
  overflow-y: auto;
}
.fsa-screen.is-open { opacity: 1; transform: none; pointer-events: auto; z-index: 30; }

.fsa-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--fsa-panel);
  border: 1px solid var(--fsa-panel-line);
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.02) inset;
}
.fsa-panel-narrow { max-width: 340px; }
.fsa-panel-wide { max-width: 720px; text-align: left; }

.fsa-logo {
  margin: 6px 0 4px;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(135deg, var(--fsa-gold), var(--fsa-red-soft) 55%, var(--fsa-tan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.fsa-menu-glyphs { font-size: 26px; letter-spacing: 4px; margin-bottom: 4px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }
.fsa-tagline { color: var(--fsa-ink-dim); margin: 0 0 20px; font-size: 14px; }
.fsa-muted { color: var(--fsa-ink-dim); }

.fsa-progress { width: 100%; height: 8px; border-radius: 8px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 18px; }
.fsa-progress-bar { height: 100%; width: 40%; background: linear-gradient(90deg, var(--fsa-red-soft), var(--fsa-gold)); border-radius: 8px; animation: fsa-load 1.1s ease-in-out infinite; }
@keyframes fsa-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

.fsa-actions { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 8px; }
.fsa-actions-secondary { margin-top: 4px; }
.fsa-btn {
  appearance: none; border: none; cursor: pointer;
  padding: 14px 20px; border-radius: 14px; font-size: 16px; font-weight: 700;
  font-family: inherit; color: var(--fsa-ink);
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}
.fsa-btn:active { transform: scale(.97); }
.fsa-btn-primary { background: linear-gradient(135deg, var(--fsa-red-soft), #7a1c1c); box-shadow: 0 10px 24px rgba(138,35,35,.35); }
.fsa-btn-primary:hover { filter: brightness(1.08); }
.fsa-btn-cash { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: var(--fsa-ink-dim); }
.fsa-btn-cash.is-disabled, .fsa-btn-cash:disabled { opacity: .55; cursor: not-allowed; }
.fsa-btn-ghost { background: rgba(255,255,255,.05); border: 1px solid var(--fsa-panel-line); color: var(--fsa-ink); }
.fsa-btn-ghost:hover { background: rgba(255,255,255,.09); }

.fsa-jackpot-teaser {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  margin: 14px 0 6px; padding: 10px 16px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(201,162,39,.14), rgba(138,35,35,.1));
  border: 1px solid rgba(201,162,39,.3);
}
.fsa-jackpot-teaser-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--fsa-gold-soft); }
.fsa-jackpot-teaser-value { font-size: 22px; font-weight: 800; color: var(--fsa-gold); font-variant-numeric: tabular-nums; }
.fsa-jackpot-teaser-unit { font-size: 12px; color: var(--fsa-ink-dim); }

.fsa-fineprint { margin-top: 14px; font-size: 11px; color: var(--fsa-ink-dim); opacity: .8; line-height: 1.5; }
.fsa-version::before { content: 'v' attr(data-v); }

.fsa-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid var(--fsa-panel-line); background: rgba(255,255,255,.06);
  color: var(--fsa-ink); font-size: 20px; line-height: 1; cursor: pointer;
}

.fsa-h2 { margin: 0 0 14px; font-size: 22px; font-weight: 800; color: var(--fsa-ink); }
.fsa-h3 { margin: 18px 0 8px; font-size: 15px; color: var(--fsa-gold-soft); text-transform: uppercase; letter-spacing: .06em; }
.fsa-h3:first-child { margin-top: 0; }
.fsa-body { font-size: 14px; line-height: 1.6; color: var(--fsa-ink-dim); margin: 0 0 10px; }
.fsa-list { margin: 0; padding-left: 18px; color: var(--fsa-ink-dim); font-size: 14px; line-height: 1.7; }
.fsa-list b { color: var(--fsa-ink); }

.fsa-help-cols { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 720px) {
  .fsa-help-cols { grid-template-columns: 1.1fr 1fr; }
}

.fsa-paytable { display: flex; flex-direction: column; gap: 8px; }
.fsa-pay-row {
  display: grid; grid-template-columns: 44px 1fr repeat(3, 56px);
  align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 10px; background: var(--fsa-cell);
  font-size: 13px;
}
.fsa-pay-glyph { font-size: 24px; text-align: center; }
.fsa-pay-name { color: var(--fsa-ink); font-weight: 600; }
.fsa-pay-name small { display: block; color: var(--fsa-ink-dim); font-weight: 400; font-size: 11px; }
.fsa-pay-mult { text-align: right; font-variant-numeric: tabular-nums; color: var(--fsa-gold-soft); }
.fsa-pay-head { color: var(--fsa-ink-dim); font-size: 11px; text-transform: uppercase; }

/* --------------------------------------------------------------------------
   Play screen
   -------------------------------------------------------------------------- */
#screen-play.fsa-screen {
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  display: none;
  background: transparent;
}
#screen-play.fsa-screen.is-open { display: flex; opacity: 1; transform: none; }

.fsa-play {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: calc(10px + var(--fsa-safe-t)) calc(12px + var(--fsa-safe-r)) calc(14px + var(--fsa-safe-b)) calc(12px + var(--fsa-safe-l));
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.fsa-topbar { display: flex; align-items: center; gap: 8px; }
.fsa-chip {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 12px;
  border-radius: 12px; background: var(--fsa-chip); border: 1px solid var(--fsa-panel-line);
}
.fsa-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--fsa-ink-dim); }
.fsa-chip-value { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fsa-chip-unit { font-size: 11px; color: var(--fsa-gold-soft); }
.fsa-flash-error { animation: fsa-flash-error .5s ease; }
@keyframes fsa-flash-error {
  0%, 100% { color: var(--fsa-ink); transform: none; }
  30% { color: var(--fsa-red-soft); transform: scale(1.12); }
}

.fsa-jackpot-chip {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 12px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(201,162,39,.16), rgba(138,35,35,.08));
  border: 1px solid rgba(201,162,39,.35); flex: 1; justify-content: center; overflow: hidden;
}
.fsa-jackpot-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--fsa-gold-soft); }
.fsa-jackpot-chip-value { font-size: 16px; font-weight: 800; color: var(--fsa-gold); font-variant-numeric: tabular-nums; white-space: nowrap; }

.fsa-topbar-right { display: flex; gap: 6px; }
.fsa-icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--fsa-panel-line);
  background: var(--fsa-chip); color: var(--fsa-ink); font-size: 16px; cursor: pointer;
}

.fsa-freespin-banner {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border-radius: 12px; font-size: 13px; font-weight: 700;
  background: linear-gradient(90deg, rgba(201,162,39,.2), rgba(138,35,35,.2));
  border: 1px solid rgba(201,162,39,.4); color: var(--fsa-gold-soft); letter-spacing: .04em;
  animation: fsa-pulse-glow 1.6s ease-in-out infinite;
}
.fsa-freespin-banner[hidden] { display: none; }
.fsa-freespin-banner strong { font-size: 17px; color: var(--fsa-ink); }
@keyframes fsa-pulse-glow { 0%, 100% { box-shadow: 0 0 0 rgba(201,162,39,0); } 50% { box-shadow: 0 0 16px rgba(201,162,39,.45); } }

.fsa-reel-frame {
  position: relative;
  border-radius: 18px;
  padding: 10px;
  background: linear-gradient(180deg, var(--fsa-bg-2), var(--fsa-bg-1));
  border: 1px solid var(--fsa-panel-line);
  box-shadow: inset 0 0 30px rgba(0,0,0,.4);
}

.fsa-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.fsa-reel {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--fsa-cell);
  aspect-ratio: 1 / 3;
}
.fsa-reel-strip {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  flex-direction: column;
  will-change: transform;
}
.fsa-cell-sym {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(26px, 8vw, 40px);
  line-height: 1;
  position: relative;
}
.fsa-cell-sym.is-win {
  animation: fsa-cell-pop 1s ease-in-out infinite;
}
.fsa-cell-sym.is-win::after {
  content: '';
  position: absolute; inset: 3px;
  border-radius: 8px;
  border: 2px solid var(--fsa-gold);
  box-shadow: 0 0 14px rgba(201,162,39,.7), inset 0 0 10px rgba(201,162,39,.35);
  pointer-events: none;
}
@keyframes fsa-cell-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.fsa-win-overlay {
  position: absolute; inset: 10px;
  pointer-events: none;
}
.fsa-win-line {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px currentColor);
  opacity: .85;
}

.fsa-spin-flash {
  position: absolute; inset: 0; border-radius: 18px;
  background: radial-gradient(circle, rgba(255,255,255,.32), transparent 60%);
  opacity: 0; pointer-events: none;
}
.fsa-spin-flash.is-flashing { animation: fsa-flash .5s ease-out; }
@keyframes fsa-flash { 0% { opacity: .9; } 100% { opacity: 0; } }

.fsa-win-banner {
  text-align: center; font-size: 20px; font-weight: 800; padding: 8px;
  border-radius: 12px; color: var(--fsa-bg-0);
  background: linear-gradient(90deg, var(--fsa-gold), var(--fsa-gold-soft));
  box-shadow: 0 6px 18px rgba(201,162,39,.4);
  animation: fsa-banner-in .35s ease;
}
.fsa-win-banner[hidden] { display: none; }
@keyframes fsa-banner-in { from { transform: translateY(-8px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.fsa-win-list { display: flex; flex-direction: column; gap: 4px; max-height: 96px; overflow-y: auto; font-size: 12px; }
.fsa-win-list:empty { display: none; }
.fsa-win-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-radius: 8px; background: var(--fsa-cell); color: var(--fsa-ink-dim);
}
.fsa-win-row b { color: var(--fsa-gold-soft); }

.fsa-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.fsa-control-group {
  background: var(--fsa-chip); border: 1px solid var(--fsa-panel-line); border-radius: 12px;
  padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.fsa-control-total { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; padding: 10px 14px; }
.fsa-control-label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--fsa-ink-dim); }
.fsa-total-value { font-size: 18px; font-weight: 800; color: var(--fsa-gold-soft); font-variant-numeric: tabular-nums; }

.fsa-stepper { display: flex; align-items: center; gap: 10px; }
.fsa-stepper-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255,255,255,.1); color: var(--fsa-ink); font-size: 18px; line-height: 1;
}
.fsa-stepper-btn:active { transform: scale(.92); }
.fsa-stepper-btn:disabled { opacity: .35; cursor: not-allowed; }
.fsa-stepper-value { min-width: 44px; text-align: center; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

.fsa-presets { display: flex; gap: 4px; }
.fsa-preset-btn {
  border: 1px solid var(--fsa-panel-line); background: transparent; color: var(--fsa-ink-dim);
  border-radius: 8px; padding: 3px 9px; font-size: 11px; cursor: pointer;
}
.fsa-preset-btn.is-active { background: rgba(201,162,39,.18); border-color: var(--fsa-gold); color: var(--fsa-gold-soft); }

.fsa-spin-btn {
  appearance: none; border: none; cursor: pointer;
  padding: 16px; border-radius: 16px; font-size: 20px; font-weight: 900; letter-spacing: .08em;
  color: var(--fsa-bg-0);
  background: linear-gradient(135deg, var(--fsa-gold), var(--fsa-red-soft));
  box-shadow: 0 12px 26px rgba(138,35,35,.35);
  transition: transform .1s ease, filter .1s ease, opacity .15s ease;
}
.fsa-spin-btn:active { transform: scale(.97); }
.fsa-spin-btn:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.3); }

.fsa-stats-strip {
  display: flex; justify-content: center; gap: 18px; font-size: 12px; color: var(--fsa-ink-dim); padding-bottom: 4px;
}
.fsa-stats-strip b { color: var(--fsa-ink); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Bonus pick round
   -------------------------------------------------------------------------- */
.fsa-bonus-stats { display: flex; justify-content: center; gap: 24px; margin: 14px 0; }
.fsa-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fsa-stat-label { font-size: 11px; color: var(--fsa-ink-dim); text-transform: uppercase; letter-spacing: .05em; }
.fsa-stat-value { font-size: 20px; font-weight: 800; color: var(--fsa-gold-soft); font-variant-numeric: tabular-nums; }

.fsa-bonus-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 6px 0 18px;
}
.fsa-bonus-tile {
  aspect-ratio: 1; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--fsa-brown), #4a2c17);
  color: var(--fsa-ink); font-size: 22px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s ease, background .25s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
}
.fsa-bonus-tile:not(:disabled):hover { transform: translateY(-2px); }
.fsa-bonus-tile:disabled { cursor: default; }
.fsa-bonus-tile.is-revealed {
  background: linear-gradient(145deg, var(--fsa-gold), var(--fsa-gold-soft));
  color: var(--fsa-bg-0);
  animation: fsa-tile-reveal .4s ease;
}
@keyframes fsa-tile-reveal { 0% { transform: scale(.7) rotateY(90deg); } 100% { transform: none; } }

/* --------------------------------------------------------------------------
   Jackpot celebration
   -------------------------------------------------------------------------- */
#screen-jackpot.fsa-screen {
  background: radial-gradient(circle at 50% 40%, rgba(201,162,39,.25), rgba(36,18,9,.96) 65%);
}
.fsa-jackpot-celebrate { text-align: center; }
.fsa-jackpot-bags { font-size: 40px; letter-spacing: 8px; margin-bottom: 6px; animation: fsa-bag-bounce 1s ease-in-out infinite; }
@keyframes fsa-bag-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.fsa-jackpot-title {
  font-size: clamp(40px, 12vw, 72px); font-weight: 900; margin: 0;
  background: linear-gradient(135deg, var(--fsa-gold), #fff 50%, var(--fsa-gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: fsa-shimmer 1.4s linear infinite;
  background-size: 200% auto;
}
@keyframes fsa-shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
.fsa-jackpot-amount { font-size: clamp(22px, 6vw, 32px); font-weight: 800; color: var(--fsa-ink); margin: 10px 0 26px; font-variant-numeric: tabular-nums; }

@media (min-width: 480px) {
  .fsa-controls { grid-template-columns: 1fr 1fr; }
}


/* 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. */
.fsa-cell--blur, .fsa-cell--blur .fsa-glyph {
  filter: blur(2.5px);
  opacity: 0.72;
}

@media (prefers-reduced-motion: reduce) {
  .fsa-cell--blur, .fsa-cell--blur .fsa-glyph { filter: none; opacity: 0.8; }
}
