/* ═══════════════════════════════════════════════
   SPINTRIX BRAND VARIABLES (shared)
═══════════════════════════════════════════════ */
:root {
  --bg:        #0A0F1A;
  --grey-1:    #CACBCE;
  --grey-2:    #798591;
  --orange:    #F66804;
  --cyan:      #04F1FF;
  --black:     #000000;
  --white:     #FFFFFF;

  /* UI-specific derived tokens */
  --panel-bg:        rgba(10,15,26,0.92);
  --panel-border:    rgba(4,241,255,0.18);
  --panel-border-2:  rgba(246,104,4,0.5);
  --btn-bg:          rgba(255,255,255,0.06);
  --btn-hover:       rgba(4,241,255,0.12);
  --btn-active-c:    var(--cyan);
  --btn-active-o:    var(--orange);
  --hud-bg:          rgba(6,10,19,0.80);
  --hud-border:      rgba(246,104,4,0.5);

  /* Typography */
  --font-head: 'Anton', sans-serif;
  --font-body: 'Satoshi', sans-serif;

  /* Glow effects */
  --glow-c:  0 0 12px rgba(4,241,255,0.5), 0 0 30px rgba(4,241,255,0.2);
  --glow-o:  0 0 12px rgba(246,104,4,0.6), 0 0 30px rgba(246,104,4,0.25);
  --glow-sm: 0 0 8px rgba(4,241,255,0.35);
}

* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  width:100%; height:100%;
  background: transparent;
  font-family: var(--font-body);
  color: var(--white);
  overflow: hidden;
  user-select: none;
}

/* ═══════════════════════════════════════════════
   GAME LAYOUT
═══════════════════════════════════════════════ */
#game-wrap {
  width: 100%; height: 100%;
  position: relative;
  background: transparent;
}

#game-area {
  width: 100%; height: 100%;
  position: relative;
  overflow: hidden;
}

.game-placeholder {
  text-align: center; opacity: 0.18;
  pointer-events: none;
}
.game-placeholder-title {
  font-family: var(--font-head);
  font-size: 28px; letter-spacing: 3px; color: var(--grey-1);
}
.game-placeholder-sub {
  font-size: 11px; letter-spacing: 4px; color: var(--grey-2);
  margin-top: 8px; text-transform: uppercase;
}

/* Message banner (scatter, bonus, etc.) */
#game-message {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(6,10,19,0.88), rgba(10,16,28,0.88));
  border: 1px solid rgba(4,241,255,0.2);
  border-radius: 6px;
  padding: 8px 22px;
  font-family: var(--font-head);
  font-size: 13px; letter-spacing: 2px; color: var(--cyan);
  white-space: nowrap;
  display: none;
  box-shadow: var(--glow-sm);
}
#game-message.show { display: block; }


/* ═══════════════════════════════════════════════
   HUD BAR
   Game viewport is 1:1 with Letterbox scale.
   On landscape displays the game is a centered
   square whose side = 100vh.  The HUD is fixed
   to the bottom, spanning only the game canvas.
═══════════════════════════════════════════════ */
#hud {
  position: fixed;
  bottom: 0;
  left: max(0px, calc((100vw - 100vh) / 2));
  right: max(0px, calc((100vw - 100vh) / 2));
  display: flex; align-items: center;
  padding: 16px 30px;
  gap: 10px;
  z-index: 10;
  background: transparent;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }

/* ── HUD Sections ── */
.hud-left   { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.hud-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 20px; }
.hud-right  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-top: -69px; }
.hud-group  { display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* ── Icon Buttons (generic) ── */
.hud-btn {
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 2px solid rgba(246,104,4,0.5);
  background: rgba(6,10,19,0.80);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  flex-shrink: 0;
}
.hud-btn:hover {
  background: var(--btn-hover);
  border-color: rgba(4,241,255,0.3);
}
.hud-btn:active { transform: scale(0.93); }
.hud-btn svg { width: 20px; height: 20px; }

/* Home icon (paths from images/home_icon.svg) — orange idle, cyan on hover */
#home-btn svg {
  width: 30px;
  height: 30px;
  color: var(--orange);
  transition: color 0.18s ease;
}
#home-btn:hover svg {
  color: var(--cyan);
}

#menu-btn svg,
#sound-btn svg {
  color: var(--orange);
  transition: color 0.18s ease;
}
#menu-btn:hover svg,
#sound-btn:hover svg {
  color: var(--cyan);
}

.hud-btn.active {
  background: rgba(4,241,255,0.1);
  border-color: rgba(4,241,255,0.4);
  box-shadow: var(--glow-sm);
}

/* ── Center Info Panels ── */
.hud-info {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-width: 90px; height: 50px;
  padding: 4px 14px;
  background: rgba(6,10,19,0.80);
  border: 2px solid rgba(246,104,4,0.5);
  border-radius: 10px;
}
.hud-info:first-child { border-left: none; }
.hud-label {
  font-size: 12px; font-weight: 700;
  letter-spacing: 2px; color: var(--orange);
  text-transform: uppercase;
}
.hud-label-bet {
  font-size: 12px; font-weight: 700;
  letter-spacing: 2px; color: var(--orange);
  text-transform: uppercase;
}
.hud-value {
  font-family: var(--font-head);
  font-size: 18px; letter-spacing: 1px;
  color: var(--white);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}
.hud-value.win-flash { color: var(--orange); text-shadow: var(--glow-o); }
.hud-value.cyan { color: var(--cyan); }

/* Bet cluster */
.bet-cluster {
  display: flex; align-items: center; gap: 4px;
  padding: 0 12px;
  background: rgba(6,10,19,0.80);
  border: 2px solid rgba(246,104,4,0.5);
  border-radius: 10px;
  height: 50px;
}
.bet-adj {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.bet-adj:hover { background: rgba(4,241,255,0.12); border-color: rgba(4,241,255,0.4); }
.bet-adj:active { transform: scale(0.88); }
.bet-adj svg { width: 14px; height: 14px; }

.bet-display {
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer; padding: 0 6px; min-width: 60px;
}
.bet-display:hover .hud-value { color: var(--orange); }
.bet-display .hud-label { font-size: 8px; }

/* Desktop only: Credit, Win, and Bet share the same footprint */
@media (orientation: landscape) {
  .hud-center .hud-info,
  .hud-center .bet-cluster {
    width: 180px;
    min-width: 180px;
    box-sizing: border-box;
  }
  .hud-center .bet-cluster {
    justify-content: space-between;
  }
}

/* ── Right Controls ── */
.hud-sep {
  display: none;
}

/* Turbo button (cycles: normal / quick / turbo) */
#turbo-btn {
  width: 42px; height: 42px;
  position: relative;
}
#turbo-btn .bolt-layer {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s;
}
#turbo-btn .bolt-layer img {
  width: 29px;
  height: 29px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
#turbo-btn[data-state="normal"] .bolt-layer.state-quick,
#turbo-btn[data-state="normal"] .bolt-layer.state-turbo { opacity: 0; }
#turbo-btn[data-state="quick"] .bolt-layer.state-normal,
#turbo-btn[data-state="quick"] .bolt-layer.state-turbo  { opacity: 0; }
#turbo-btn[data-state="turbo"] .bolt-layer.state-normal,
#turbo-btn[data-state="turbo"] .bolt-layer.state-quick  { opacity: 0; }
#turbo-btn[data-state="quick"] {
  border-color: rgba(4,241,255,0.3);
}
#turbo-btn[data-state="turbo"] {
  border-color: rgba(246,104,4,0.4);
  box-shadow: 0 0 10px rgba(246,104,4,0.25);
}

/* Autoplay button */
#autoplay-btn svg {
  color: var(--orange);
  transition: color 0.18s ease;
}
#autoplay-btn:hover svg {
  color: var(--cyan);
}
#autoplay-btn.running {
  background: rgba(246,104,4,0.12);
  border-color: rgba(246,104,4,0.4);
  box-shadow: 0 0 10px rgba(246,104,4,0.3);
}
#autoplay-btn.running svg { color: var(--orange); }

/* ── SPIN BUTTON ── */
#spin-btn {
  width: 138px; height: 138px;
  border-radius: 50%;
  border: 3px solid var(--orange);
  background: rgba(6,10,19,0.80);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  margin-top: -69px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(246,104,4,0.08), var(--glow-o);
}
#spin-btn::before {
  content: '';
  position: absolute; inset: -5px;
  border-radius: 50%;
  border: 1px solid rgba(246,104,4,0.2);
  transition: all 0.3s;
}
#spin-btn .spin-btn-icons {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
}
#spin-btn .spin-sygnet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  transition: opacity 0.35s, transform 0.45s, filter 0.3s;
  filter: brightness(0.5) sepia(1) saturate(3) hue-rotate(-5deg) brightness(1.4);
}
#spin-btn .icon-arrow {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
#spin-btn .icon-square {
  display: none;
}
#spin-btn.spinning .icon-arrow {
  animation: spin-arrow-rotate 0.9s linear infinite;
}
@keyframes spin-arrow-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
/* Idle glow — orange */
#spin-btn { animation: spin-btn-idle 3s ease-in-out infinite; }
@keyframes spin-btn-idle {
  0%, 100% { box-shadow: 0 0 0 4px rgba(246,104,4,0.08), 0 0 10px rgba(246,104,4,0.25); filter: brightness(1); }
  50%      { box-shadow: 0 0 0 6px rgba(246,104,4,0.12), 0 0 24px rgba(246,104,4,0.45); filter: brightness(1.1); }
}
#spin-btn:hover {
  animation: none;
  box-shadow: 0 0 0 6px rgba(246,104,4,0.15), 0 0 28px rgba(246,104,4,0.5);
  border-color: var(--orange);
  background: radial-gradient(circle at 40% 35%, rgba(246,104,4,0.25), rgba(6,10,19,0.80));
  filter: brightness(1.15);
}
#spin-btn:active { transform: scale(0.92) translateY(0); }

/* Flash on press — orange burst */
#spin-btn.flash {
  animation: spin-btn-flash 0.3s ease-out;
}
@keyframes spin-btn-flash {
  0%   { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(246,104,4,0.3), 0 0 60px rgba(246,104,4,0.9); filter: brightness(1.6); }
  100% { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(246,104,4,0.12), 0 0 12px rgba(246,104,4,0.3); filter: brightness(1); }
}

/* Spinning state — orange ring */
#spin-btn.spinning {
  animation: spin-pulse 0.7s ease infinite;
  border-color: var(--orange);
  background: radial-gradient(circle at 40% 35%, rgba(246,104,4,0.22), rgba(6,10,19,0.80));
  cursor: not-allowed;
}
#spin-btn.spinning::before { border-color: rgba(246,104,4,0.3); }
@keyframes spin-pulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(246,104,4,0.12), var(--glow-o); }
  50%      { box-shadow: 0 0 0 10px rgba(246,104,4,0.06), 0 0 40px rgba(246,104,4,0.5); }
}


/* ═══════════════════════════════════════════════
   SOUND EXPAND PANEL
═══════════════════════════════════════════════ */
#sound-expand {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 16px;
  width: 160px;
  display: none;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(20px);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
  z-index: 100;
}
#sound-expand.open { display: flex; animation: fadeUp 0.18s ease; }
#sound-wrap { position: relative; }

.sound-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.sound-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  color: var(--grey-1); text-transform: uppercase;
}
.sound-label svg { width: 15px; height: 15px; color: var(--grey-2); }
.sound-label svg.music-on-icon,
.menu-item .music-on-icon,
.sound-label svg.sfx-on-icon,
.menu-item .sfx-on-icon {
  width: 23px;
  height: 23px;
  color: var(--orange);
  flex-shrink: 0;
}

/* Toggle Switch */
.toggle {
  width: 36px; height: 20px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--cyan); box-shadow: 0 0 8px rgba(4,241,255,0.4); }
#menu-popup .toggle.on,
#sound-expand .toggle.on {
  background: var(--orange);
  box-shadow: 0 0 8px rgba(246,104,4,0.45);
}
.toggle::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(16px); }

/* ═══════════════════════════════════════════════
   POPUP MODALS (generic)
═══════════════════════════════════════════════ */
.popup-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
}
.popup-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.popup-overlay.open.no-fade { animation: none; }

.popup {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  backdrop-filter: blur(30px);
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(4,241,255,0.05);
  animation: slideUp 0.22s cubic-bezier(0.34,1.56,0.64,1);
  max-height: 80vh;
  overflow-y: auto;
}

.popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.popup-title {
  font-family: var(--font-head);
  font-size: 16px; letter-spacing: 2px;
  color: var(--white);
}
.popup-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.popup-close:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.popup-close svg { width: 14px; height: 14px; color: var(--grey-2); }

.popup-close.help-close-x { border-color: rgba(246,104,4,0.3); }
.popup-close.help-close-x svg { color: var(--orange); }
.popup-close.help-close-x:hover { background: rgba(246,104,4,0.1); border-color: rgba(246,104,4,0.5); }

/* ── MENU POPUP (desktop: same footprint as Help / Rules large panel) ── */
#menu-popup .popup {
  width: min(820px, 96vw);
  max-height: 82vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(246,104,4,0.1);
}
@media (min-width: 769px) {
  #menu-popup .popup {
    min-height: min(70vh, 580px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #menu-popup .popup > .menu-section {
    flex: 1;
    min-height: 0;
  }
  #menu-popup .menu-bottom-actions {
    margin-top: auto;
    flex-shrink: 0;
  }
}

.menu-section { border-bottom: 1px solid rgba(255,255,255,0.05); }
.menu-section:last-child { border-bottom: none; }

#menu-popup .popup > .menu-section {
  max-width: min(340px, calc(100% - 72px));
  width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
  padding-inline: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.menu-section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 12px 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  color: var(--orange); text-transform: uppercase;
  user-select: none;
}

.menu-section-body {
  display: block;
  padding: 4px 0 12px;
}

.menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  font-size: 12px; font-weight: 500;
  color: var(--grey-1); letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.12s;
}
.menu-item:hover { background: rgba(255,255,255,0.04); }
.menu-item svg { width: 15px; height: 15px; color: var(--grey-2); }
.menu-item .menu-home-icon {
  width: 23px;
  height: 23px;
  color: var(--orange);
  flex-shrink: 0;
}
#exit-lobby-btn.menu-item.link:hover .menu-home-icon {
  color: var(--cyan);
}
.menu-item .menu-fs-icon {
  width: 15px;
  height: 15px;
  color: var(--orange);
  flex-shrink: 0;
}
.menu-item-left { display: flex; align-items: center; gap: 10px; }

.menu-item.link:hover { color: var(--orange); }
.menu-item.link:hover .arrow { color: var(--orange); }
.menu-item.link .arrow { color: var(--grey-2); }

/* ── BET OPTIONS POPUP ── */
#bet-popup .popup { width: 340px; }

.bet-popup-body { padding: 16px 20px 20px; }

.bet-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-top: 4px;
}
.bet-option {
  padding: 10px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px; font-weight: 700;
  color: var(--grey-1);
  font-variant-numeric: tabular-nums;
}
.bet-option:hover {
  background: rgba(4,241,255,0.08);
  border-color: rgba(4,241,255,0.3);
  color: var(--cyan);
}
.bet-option.selected {
  background: rgba(246,104,4,0.12);
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 0 8px rgba(246,104,4,0.28);
}


.bet-max-btn {
  margin-top: 14px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(246,104,4,0.4);
  background: rgba(246,104,4,0.08);
  color: var(--orange);
  font-family: var(--font-head);
  font-size: 13px; letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.15s;
}
.bet-max-btn:hover { background: rgba(246,104,4,0.18); box-shadow: var(--glow-o); }

/* ── AUTOPLAY POPUP ── */
#auto-popup .popup { width: 340px; }
.auto-popup-body { padding: 16px 20px 20px; }

.spin-mode-row {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.spin-mode-btn {
  flex: 1; padding: 10px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  text-align: center; cursor: pointer;
  transition: all 0.15s;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--grey-2); text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.spin-mode-btn .spin-mode-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.spin-mode-btn.selected {
  border-color: var(--orange);
  background: rgba(246,104,4,0.1);
  color: var(--orange);
}

.auto-label {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  color: var(--grey-2); text-transform: uppercase; margin-bottom: 10px;
}
.auto-presets { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.auto-preset {
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  font-size: 12px; font-weight: 700;
  color: var(--grey-1); cursor: pointer;
  transition: all 0.13s;
  flex: 1; text-align: center; min-width: 44px;
}
.auto-preset:hover { background: rgba(4,241,255,0.08); border-color: rgba(4,241,255,0.3); color: var(--cyan); }
.auto-preset.selected {
  background: rgba(246,104,4,0.12);
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 0 8px rgba(246,104,4,0.22);
}

/* Slider */
.slider-wrap { position: relative; padding: 4px 0 4px; margin-bottom: 18px; }
.auto-slider {
  width: 100%; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.1); border-radius: 2px; outline: none;
  cursor: pointer;
}
.auto-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle, var(--cyan), rgba(4,200,220,0.8));
  box-shadow: 0 0 8px rgba(4,241,255,0.5);
  cursor: pointer;
  transition: transform 0.15s;
}
.auto-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.slider-val {
  text-align: center; font-family: var(--font-head);
  font-size: 22px; color: var(--cyan);
  margin-bottom: 6px;
  text-shadow: var(--glow-sm);
}

.auto-start-btn {
  width: 100%; padding: 13px;
  border-radius: 10px;
  border: 2px solid rgba(246,104,4,0.5);
  background: linear-gradient(135deg, rgba(246,104,4,0.2), rgba(246,104,4,0.08));
  color: var(--orange);
  font-family: var(--font-head);
  font-size: 13px; letter-spacing: 2px;
  cursor: pointer; transition: all 0.15s;
}
.auto-start-btn:hover {
  background: linear-gradient(135deg, rgba(246,104,4,0.35), rgba(246,104,4,0.15));
  box-shadow: var(--glow-o);
}

/* ── MENU > PAYTABLE / HELP popups (large panel — match menu desktop size) ── */
#help-popup .popup {
  width: min(820px, 96vw);
  max-height: 82vh;
  height: min(70vh, 580px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#help-popup .help-popup-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.help-popup-body { padding: 16px 20px 20px; }
.help-tab-row { display: flex; gap: 6px; margin-bottom: 16px; }
.help-tab {
  flex: 1; padding: 8px 4px;
  border-radius: 7px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--grey-2); text-transform: uppercase;
  cursor: pointer; text-align: center; transition: all 0.13s;
}
.help-tab.active {
  background: rgba(4,241,255,0.1); border-color: rgba(4,241,255,0.35); color: var(--cyan);
}
.help-content { display: none; }
.help-content.active { display: block; }

.help-text {
  font-size: 12px; line-height: 1.7; color: var(--grey-1);
}
.help-text h4 {
  font-family: var(--font-head); font-size: 12px; letter-spacing: 1.5px;
  color: var(--cyan); margin: 12px 0 6px; text-transform: uppercase;
}
.help-text p { margin-bottom: 8px; }

.pay-table-mini { width: 100%; border-collapse: collapse; margin-top: 4px; }
.pay-table-mini th {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  color: var(--grey-2); text-transform: uppercase;
  padding: 5px 8px; text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.pay-table-mini td {
  font-size: 11px; color: var(--grey-1); padding: 7px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-variant-numeric: tabular-nums;
}
.pay-table-mini td.sym { color: var(--white); font-weight: 600; }
.pay-table-mini td.val { color: var(--orange); font-weight: 700; text-align: center; }
.pay-table-mini td.note { color: var(--cyan); font-size: 10px; }
.pay-table-mini tr:hover td { background: rgba(255,255,255,0.02); }

/* ── GAME HISTORY POPUP (match menu / help panel + footer) ── */
#history-popup .popup {
  width: min(820px, 96vw);
  max-height: 82vh;
}
@media (min-width: 769px) {
  #history-popup .popup {
    min-height: min(70vh, 580px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #history-popup .history-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}
.history-body { padding: 12px 20px 20px; }
.history-row {
  display: grid;
  grid-template-columns: 70px 1fr 70px 70px 38px;
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
}
.history-row:last-child { border-bottom: none; }
.history-time { color: var(--grey-2); font-size: 10px; }
.history-feature { color: var(--grey-1); font-size: 11px; font-weight: 500; }
.history-bet { color: var(--grey-1); text-align: center; }
.history-win { font-weight: 700; text-align: right; }
.history-win.pos { color: var(--orange); }
.history-win.neg { color: var(--grey-2); }

.replay-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; color: var(--grey-2);
  padding: 0;
}
.replay-btn svg { width: 11px; height: 11px; }
.replay-btn:hover {
  background: rgba(4,241,255,0.1);
  border-color: rgba(4,241,255,0.35);
  color: var(--cyan);
}
.replay-btn:active { transform: scale(0.88); }
.replay-btn-highlight {
  border-color: rgba(246,104,4,0.3);
  background: rgba(246,104,4,0.06);
  color: var(--orange);
}
.replay-btn-highlight:hover {
  background: rgba(246,104,4,0.15);
  border-color: rgba(246,104,4,0.5);
  box-shadow: 0 0 8px rgba(246,104,4,0.25);
}

/* ═══════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════ */
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes fadeUp  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideUp { from { opacity:0; transform:translateY(20px) scale(0.97); } to { opacity:1; transform:none; } }

/* ── PAYTABLE SYMBOL ROWS ── */
.pay-section-label {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--cyan); text-transform: uppercase;
  padding: 10px 0 8px; border-bottom: 1px solid rgba(4,241,255,0.1);
  margin-bottom: 10px;
}
.pay-section-note { font-size: 9px; color: var(--grey-2); font-weight: 500; letter-spacing: 1px; }

.sym-row {
  display: flex; align-items: flex-start; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sym-row:last-of-type { border-bottom: none; }
.sym-row-sm { padding: 10px 0; }

.sym-art {
  width: 90px; height: 90px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
}
.sym-art-sm { width: 70px; height: 70px; border-radius: 10px; }
.sym-svg { width: 72px; height: 72px; }
.sym-art-sm .sym-svg { width: 56px; height: 56px; }
.sym-art img { width: 80px; height: 80px; object-fit: contain; border-radius: 8px; }
.sym-art-sm img { width: 62px; height: 62px; }

.sym-info { flex: 1; min-width: 0; }
.sym-name {
  font-size: 13px; font-weight: 700; color: var(--white);
  margin-bottom: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sym-desc { font-size: 11px; line-height: 1.6; color: var(--grey-1); margin-bottom: 10px; }
.sym-desc-sm { font-size: 10px; line-height: 1.5; color: var(--grey-2); margin-bottom: 8px; }

.sym-badge {
  font-size: 8px; font-weight: 700; letter-spacing: 1px;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase;
}
.pot1  { background: rgba(246,104,4,0.15);  color:var(--orange); border:1px solid rgba(246,104,4,0.35); }
.pot2  { background: rgba(4,241,255,0.08);  color:var(--cyan);   border:1px solid rgba(4,241,255,0.25); }
.pot3  { background: rgba(202,203,206,0.1); color:var(--grey-1); border:1px solid rgba(202,203,206,0.25); }
.wild-badge    { background: rgba(246,104,4,0.2); color:var(--orange); border:1px solid rgba(246,104,4,0.3); }
.scatter-badge { background: rgba(4,241,255,0.1); color:var(--cyan);   border:1px solid rgba(4,241,255,0.25); }

.sym-pays {
  display: flex; gap: 6px;
}
.sym-pays-sm { gap: 4px; }
.pay-cell {
  flex: 1; max-width: 60px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px; padding: 5px 4px; text-align: center;
}
.pay-cell.best {
  background: rgba(246,104,4,0.1);
  border-color: rgba(246,104,4,0.3);
}
.pay-combo { font-size: 8px; color: var(--grey-2); font-weight: 700; letter-spacing: 1px; margin-bottom: 2px; }
.pay-val { font-family: var(--font-head); font-size: 13px; color: var(--white); }
.pay-cell.best .pay-val { color: var(--orange); }
.sym-pays-sm .pay-val { font-size: 11px; }

/* Low-value compact grid */
.low-sym-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 4px;
}
.low-sym-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; padding: 12px 8px; text-align: center;
}
.low-sym-art {
  font-family: var(--font-head); font-size: 32px;
  line-height: 1; margin-bottom: 4px;
  text-shadow: 0 0 20px currentColor;
}
.low-sym-art img { width: 48px; height: 48px; object-fit: contain; }
.low-sym-name { font-size: 9px; font-weight: 700; letter-spacing: 1.5px; color: var(--grey-2); text-transform: uppercase; margin-bottom: 6px; }
.low-sym-pays { font-size: 9px; color: var(--grey-1); line-height: 1.6; }

/* Jackpot cards */
.jackpot-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px; padding: 12px 8px; text-align: center;
}
.jackpot-card img { width: 52px; height: 52px; object-fit: contain; margin-bottom: 6px; }
.jackpot-name { font-size: 10px; font-weight: 700; letter-spacing: 2px; margin-bottom: 4px; }
.jackpot-val { font-family: var(--font-head); font-size: 22px; color: var(--orange); }
.jackpot-note { font-size: 9px; color: var(--grey-2); margin-top: 3px; letter-spacing: 1px; }

/* Help popup body extra padding for large version */
#help-popup .help-popup-body { padding: 16px 24px 24px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(4,241,255,0.2); border-radius: 2px; }

/* Notification dot */
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 6px rgba(246,104,4,0.6);
  animation: pulse-notif 2s ease infinite;
}
@keyframes pulse-notif {
  0%,100% { transform: scale(1); opacity:1; }
  50%      { transform: scale(1.3); opacity:0.7; }
}

/* Tooltip */
.hud-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: rgba(6,10,19,0.95);
  border: 1px solid rgba(4,241,255,0.2);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 10px; letter-spacing: 1px;
  color: var(--grey-1); white-space: nowrap;
  pointer-events: none; z-index: 200;
}

/* ═══════════════════════════════════════════════
   MENU BOTTOM QUICK-ACTION BUTTONS
═══════════════════════════════════════════════ */
.menu-bottom-actions {
  display: flex; gap: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.menu-action-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 7px; padding: 16px 8px;
  cursor: pointer;
  border-right: 1px solid rgba(255,255,255,0.06);
  transition: background 0.15s;
  position: relative;
}
.menu-action-btn:last-child { border-right: none; }
.menu-action-btn:hover { background: rgba(255,255,255,0.04); }
.menu-action-btn:hover .menu-action-icon { border-color: rgba(246,104,4,0.45); color: var(--orange); }
.menu-action-btn:hover .menu-action-label { color: var(--orange); }
.menu-action-icon {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.menu-action-icon svg { width: 18px; height: 18px; color: var(--grey-2); }
.menu-action-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  color: var(--grey-2); text-transform: uppercase;
  text-align: center; transition: color 0.15s;
}
/* Icon-only footer (Settings | Rules | History) — active bar */
.menu-footer-nav {
  flex-shrink: 0;
  background: rgba(0,0,0,0.22);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.menu-footer-nav .menu-action-btn {
  padding: 14px 8px 12px;
  gap: 0;
}
.menu-footer-nav .menu-action-label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.menu-footer-nav .menu-action-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
}
.menu-footer-nav .menu-action-icon svg {
  width: 22px; height: 22px;
}
.menu-footer-nav .menu-action-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 18%; right: 18%;
  height: 3px;
  background: var(--orange);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 0 10px rgba(246,104,4,0.5);
}
.menu-footer-nav .menu-action-btn.active .menu-action-icon {
  border-color: rgba(246,104,4,0.4);
  background: rgba(246,104,4,0.1);
}
.menu-footer-nav .menu-action-btn.active .menu-action-icon svg {
  color: var(--orange);
}
.menu-footer-nav .menu-action-btn:hover:not(.active) .menu-action-icon svg {
  color: var(--grey-1);
}
/* ═══════════════════════════════════════════════
   MOBILE / PORTRAIT LAYOUT
═══════════════════════════════════════════════ */
@media (orientation: portrait) {
  /* Background — width-fill, crop top/bottom */
  #game-wrap {
    background: transparent;
  }

  /* HUD becomes a transparent overlay */
  #hud {
    position: fixed; inset: 0;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    display: block;
    pointer-events: none;
  }
  #hud > * { pointer-events: auto; }
  #hud::before { display: none; }

  /* Hide group wrappers visually, let children be positioned */
  .hud-left, .hud-center, .hud-right, .hud-group {
    display: contents !important;
    padding: 0 !important; border: none !important;
    background: transparent !important; box-shadow: none !important;
  }
  .hud-sep { display: none !important; }

  /* Shared mobile button style */
  .m-float {
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
  }

  /* ── Top-left: hamburger ── */
  #menu-btn {
    position: fixed; top: 12px; left: 12px; z-index: 20;
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
  }

  /* ── Top-left: home (next to hamburger) ── */
  #home-btn {
    position: fixed; top: 12px; left: 58px; z-index: 20;
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
  }

  /* ── Top-right: sound ── */
  #sound-wrap {
    position: fixed; top: 12px; right: 12px; z-index: 20;
  }
  #sound-wrap .hud-btn {
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
  }
  #sound-expand {
    bottom: auto !important; top: calc(100% + 10px) !important;
    left: auto !important; right: 0 !important;
  }

  /* ── Win — above spin button ── */
  #win-panel {
    position: fixed;
    bottom: 160px; left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
    border-radius: 10px;
    padding: 4px 20px;
    min-width: auto; height: auto;
  }

  /* ── Spin button — bottom center ── */
  #spin-btn {
    position: fixed !important;
    bottom: 60px; left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    width: 90px !important; height: 90px !important;
    margin: 0 !important;
  }
  #spin-btn:active {
    transform: translateX(-50%) scale(1.1) !important;
  }

  /* ── Autoplay — left of spin ── */
  #autoplay-btn {
    position: fixed;
    bottom: 78px; left: calc(50% - 94px);
    z-index: 20;
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
    width: 38px; height: 38px;
  }

  /* ── Turbo — right of spin ── */
  #turbo-btn {
    position: fixed;
    bottom: 78px; left: calc(50% + 56px);
    z-index: 20;
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
    width: 38px; height: 38px;
  }

  /* ── Bottom-left: Credit ── */
  #credit-panel {
    position: fixed;
    bottom: 12px;
    left: 16px;
    right: calc(50% + 56px);
    z-index: 20;
    background: rgba(6,10,19,0.70);
    border: 2px solid rgba(246,104,4,0.5);
    border-radius: 10px;
    padding: 6px 16px;
    min-width: 0;
    width: auto;
    height: 54px;
    box-sizing: border-box;
  }

  /* ── Bottom-right: Bet cluster ── */
  .bet-cluster {
    position: fixed;
    bottom: 12px;
    left: calc(50% + 56px);
    right: 16px;
    z-index: 20;
    background: rgba(6,10,19,0.70) !important;
    border: 2px solid rgba(246,104,4,0.5) !important;
    border-radius: 10px !important;
    min-width: 0;
    width: auto;
    height: 54px !important;
    justify-content: space-between;
    box-sizing: border-box;
  }

  /* Mobile button sizing */
  .hud-btn { width: 38px; height: 38px; border-radius: 10px; }
  .hud-btn svg { width: 18px; height: 18px; }
  #home-btn svg { width: 27px; height: 27px; }

  /* ── All popups: full-screen on mobile ── */
  .popup-overlay {
    align-items: stretch !important;
    justify-content: stretch !important;
    padding: 0 !important;
  }
  .popup {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: none !important;
  }
  #menu-popup .popup > .menu-section {
    max-width: min(340px, calc(100% - 48px));
    flex: 1;
    min-height: 0;
  }
  #menu-popup .menu-bottom-actions {
    margin-top: auto;
    flex-shrink: 0;
  }
  #help-popup .help-popup-body,
  #history-popup .history-body,
  #bet-popup .bet-popup-body,
  #auto-popup .auto-popup-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}
