:root {
  --felt: #06361f;
  /* deep casino green */
  --felt-2: #0a2f20;
  --gold: #ffd700;
  --accent: #ff4d4f;
  /* risky red */
  --muted: rgba(255, 255, 255, 0.9);
  --glass: rgba(255, 255, 255, 0.03);
  /* Solid fallback used when backdrop/blur/gloss are disabled (perf mode) */
  --glass-solid: rgba(6, 54, 31, 0.98);
  --glass-solid-border: rgba(255,215,0,0.05);
  --footer-height: 48px;
}

/* Black Market mode: much darker gradient and a semi-opaque overlay to darken the scene
   without obscuring UI elements (overlay sits under the .shell container which is z-index:1) */
body.black-market-active {
  background: radial-gradient(circle at 20% 10%, rgba(255, 215, 0, 0.01), transparent 10%), linear-gradient(180deg, #020b07, #020b07);
}

/* The semi-opaque overlay sits above the decorative texture (body::before) but below
   the UI shell (z-index: 1) so only the background darkens */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0; /* same baseline as body::before; painting order places ::after above ::before */
  background: rgba(0,0,0,0); /* start transparent */
  transition: background 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}

body.black-market-active::after {
  background: rgba(31, 8, 8, 0.479);
  opacity: 1;
}

/* So the decorative texture doesn't wash out the darker scene, tone it down */
body.black-market-active::before {
  opacity: 0.01; /* almost invisible */
  mix-blend-mode: multiply;
}

html,
body {
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, system-ui, -apple-system, "Helvetica Neue", Arial
}

body {
  background: radial-gradient(circle at 20% 10%, rgba(255, 215, 0, 0.03), transparent 10%), linear-gradient(180deg, var(--felt), var(--felt-2));
  color: var(--muted);
  /* Use a column layout so footer can sit at bottom of the document if content is short */
  display: flex;
  flex-direction: column;
  align-items: center; /* center the main .shell horizontally */
  justify-content: flex-start;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  transition: background 0.5s ease;
  /* keep content layout natural — footer will sit at the end of the page */
  padding-bottom: 0;
}

body::before {
  content: "";
  position: fixed;
  top: -720px;
  left: -640px;
  width: calc(100% + 1280px);
  height: calc(100% + 720px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.02;
  background-image: url("../sprites/background-repeating.png");
  background-repeat: repeat;
  background-size: 1280px 720px;
  animation: noiseMove 120s linear infinite;
  will-change: transform;
  mix-blend-mode: overlay;
}

/* When in Performance Mode, reduce expensive compositing (texture blend modes) on the body background */
.gfx-no-effects body::before { mix-blend-mode: normal !important; opacity: 0.05 !important; }

/* Prevent accidental horizontal overflow while perf mode is enabled */
html.gfx-no-effects, body.gfx-no-effects { overflow-x: hidden !important; }

@keyframes noiseMove {
  0% { transform: translate3d(0, 0, 0); }
  12.5% { transform: translate3d(35px, 90px, 0); }
  25% { transform: translate3d(50px, 180px, 0); }
  37.5% { transform: translate3d(35px, 270px, 0); }
  50% { transform: translate3d(0, 360px, 0); }
  62.5% { transform: translate3d(-35px, 450px, 0); }
  75% { transform: translate3d(-50px, 540px, 0); }
  87.5% { transform: translate3d(-35px, 630px, 0); }
  100% { transform: translate3d(0, 720px, 0); }
}

body.no-background::before {
  display: none;
}

body.no-movement::before {
  animation: none;
}

.version {
  position: fixed;
  top: 8px;
  right: 12px;
  font-size: 10px;
  color: var(--muted);
  opacity: 0.4;
  z-index: 10001;
  pointer-events: none;
  font-weight: 600;
}

.victory-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  animation: fadeIn 0.4s ease-out;
}

/* Discord confirmation modal should appear above the victory modal and other content */
#discord-modal { z-index: 22001; }

.intro-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25000;
  animation: fadeIn 0.5s ease-out;
}

.intro-content {
  background: linear-gradient(180deg, rgba(6, 54, 31, 0.95), rgba(10, 47, 32, 0.95));
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 48px 60px;
  max-width: 550px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(255, 215, 0, 0.2), 0 0 80px rgba(255, 215, 0, 0.15);
  animation: victoryPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.intro-title {
  font-size: 40px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 32px;
}

.intro-subtitle {
  font-size: 18px;
  color: var(--muted);
  opacity: 0.8;
  margin-bottom: 32px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.intro-message {
  font-size: 16px;
  color: var(--muted);
  opacity: 0.9;
  line-height: 1.8;
  margin-bottom: 36px;
}

.intro-message strong {
  color: var(--gold);
  font-weight: 800;
}

.intro-button {
  background: linear-gradient(180deg, #ffd700, #d4a500);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  padding: 16px 48px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
  transition: all 0.2s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.intro-button:hover {
  background: linear-gradient(180deg, #ffe44d, #e0b000);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.intro-button:active {
  transform: translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.victory-content {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.15), rgba(6, 54, 31, 0.95));
  border: 3px solid var(--gold);
  border-radius: 20px;
  padding: 48px 60px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(255, 215, 0, 0.3), 0 0 100px rgba(255, 215, 0, 0.2);
  animation: victoryPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes victoryPop {
  0% {
    transform: scale(0.5) translateY(100px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.victory-title {
  font-size: 36px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 4px 8px rgba(0, 0, 0, 0.8);
  margin-bottom: 24px;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 4px 8px rgba(0, 0, 0, 0.8);
  }
  50% {
    text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.8);
  }
}

.victory-rank {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.victory-rank-name {
  font-size: 42px;
  font-weight: 900;
  color: var(--gold);
  margin-bottom: 24px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.victory-message {
  font-size: 16px;
  color: var(--muted);
  opacity: 0.9;
  line-height: 1.6;
  margin-bottom: 32px;
}

.victory-button {
  background: linear-gradient(180deg, #ffd700, #d4a500);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  padding: 16px 40px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.4);
  transition: all 0.2s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Actions layout inside victory modal (used for Join Discord confirm modal) */
.victory-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.victory-button:hover {
  background: linear-gradient(180deg, #ffe44d, #e0b000);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.victory-button:active {
  transform: translateY(0);
}

.shell {
  width: 100%;
  max-width: 920px;
  padding: 28px;
  box-sizing: border-box;
  min-height: auto;
  position: relative;
  z-index: 1;
  flex: 1 0 auto; /* allow the shell to grow to fill vertical space */
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin-bottom: 22px;
  text-align: center;
}

.title {
  font-weight: 800;
  color: var(--gold);
  font-size: 24px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 13px;
  opacity: .9
}

.center-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.balance {
  font-size: 28px;
  margin-bottom: 14px;
  color: var(--gold);
  font-weight: 700
}

.btn-row {
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: center;
  margin-bottom: 48px;
  /* Allow row to wrap when horizontal space is limited so buttons flow to a new line
     instead of being squished. */
  flex-wrap: wrap;
}

.btn {
  /* Use a flexible size that scales between a min and max, so the buttons maintain
     proportions across breakpoints and can scale down gracefully when needed. */
  --size: clamp(90px, 24vw, 150px);
  width: var(--size);
  /* Use aspect-ratio so height always matches width and the element stays circular. */
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  user-select: none;
  box-shadow: 0 12px 30px rgba(2, 8, 12, .65), inset 0 -8px 18px rgba(0, 0, 0, .25);
  transition: transform .15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow .15s ease, filter .15s ease;
  position: relative;
  /* Prevent extreme shrinking which causes the circular button to look squished. If
     space is tight, buttons will wrap to the next row (via flex-wrap) instead. */
  flex: 0 1 var(--size);
  min-width: 72px; /* minimum comfortable tap target */
}

.btn::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 40%, transparent 60%);
  opacity: 0.6;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.btn::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 15%;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.5), rgba(255,255,255,0.1) 50%, transparent 70%);
  opacity: 0.8;
  pointer-events: none;
}

.btn:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 18px 40px rgba(2, 8, 12, .75), inset 0 -8px 18px rgba(0, 0, 0, .25);
  filter: brightness(1.15);
}

.btn:hover::before {
  opacity: 0.8;
}

.btn:active {
  transform: scale(0.95) translateY(0);
  box-shadow: 0 6px 15px rgba(2, 8, 12, .65), inset 0 -4px 12px rgba(0, 0, 0, .3);
  animation: buttonPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Performance Mode: remove heavy visual effects for low-end devices ---- */
/* Add this class to documentElement when gfx_performance is ON */
.gfx-no-effects .toast,
.gfx-no-effects .toast--bm-red,
.gfx-no-effects .toast--bm-green,
.gfx-no-effects .toast--bm-orange,
.gfx-no-effects .toast--soft,
.gfx-no-effects .upgrade-card,
.gfx-no-effects .upgrade-card.maxed-out,
.gfx-no-effects .bm-card,
.gfx-no-effects .intro-content,
.gfx-no-effects .victory-content,
.gfx-no-effects .intro-modal,
.gfx-no-effects .victory-modal,
.gfx-no-effects .btn,
.gfx-no-effects .toggle-container,
.gfx-no-effects .bm-card.bm-active,
.gfx-no-effects .meta-description,
.gfx-no-effects .site-footer {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
}

/* Replace translucent 'glass' with solid fallback colors to keep text readable */
.gfx-no-effects .toast { background: rgba(7, 38, 30, 0.96) !important; color: var(--muted) !important; }
.gfx-no-effects .toast--bm-red { background: rgba(183,28,28,0.94) !important; color: #fff !important; border: 1px solid rgba(183,28,28,0.08) !important; }
.gfx-no-effects .toast--bm-green { background: rgba(46,125,50,0.94) !important; color: #e8f5e9 !important; border: 1px solid rgba(46,125,50,0.08) !important; }
.gfx-no-effects .toast--bm-orange { background: rgba(239,108,0,0.94) !important; color: #fff8e1 !important; border: 1px solid rgba(239,108,0,0.06) !important; }
.gfx-no-effects .toast--soft { background: rgba(15,40,30,0.95) !important; color: var(--muted) !important; }

/* Buttons: remove bright pseudo-elements used for gloss/shine */
.gfx-no-effects .btn::before,
.gfx-no-effects .btn::after {
  background: none !important;
  opacity: 0 !important;
}
.gfx-no-effects .btn { box-shadow: none !important; }

/* Upgrade cards: replace translucent background and strong box-shadow */
.gfx-no-effects .upgrade-card,
.gfx-no-effects .upgrade-card.maxed-out,
.gfx-no-effects .bm-card,
.gfx-no-effects .bm-card .upgrade-title {
  background: rgba(10, 36, 28, 0.97) !important;
  border-color: var(--glass-solid-border) !important;
  box-shadow: none !important;
}
.gfx-no-effects .upgrade-card::after { background: rgba(0,0,0,0.04) !important; }
.gfx-no-effects .upgrade-card::before { background: none !important; opacity: 0 !important; }

/* Keep necessary contrast for titles when text-shadow is removed */
.gfx-no-effects .victory-title,
.gfx-no-effects .intro-title,
.gfx-no-effects .upgrade-title,
.gfx-no-effects .upgrade-value,
.gfx-no-effects .win-title,
.gfx-no-effects h1,
.gfx-no-effects h2,
.gfx-no-effects h3 {
  text-shadow: none !important;
}

/* Apply subtle fallback border so weak separators remain visible */
.gfx-no-effects .toast,
.gfx-no-effects .upgrade-card,
.gfx-no-effects .site-footer,
.gfx-no-effects .toggle-container { border: 1px solid rgba(255,255,255,0.03) !important; }

/* Keep small shadow for simple elevation but nothing costly */
.gfx-no-effects button,
.gfx-no-effects .button { box-shadow: 0 1px 2px rgba(0,0,0,0.25) !important; }

/* Global fallback: ensure any remaining blur/backdrop filters are disabled */
.gfx-no-effects * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Disable costly CSS animations/transitions in perf mode */
.gfx-no-effects * {
  animation: none !important;
  transition: none !important;
}

/* Active events / black market badges: use readable solid backgrounds and disable animations */
.gfx-no-effects .active-event-badge {
  background: rgba(13, 82, 180, 0.98) !important; /* opaque blue */
  border: 1px solid rgba(13, 82, 180, 0.12) !important;
  box-shadow: none !important;
  color: #fff !important;
  animation: none !important;
  transition: none !important;
}
.gfx-no-effects .active-bm-badge {
  background: rgba(183,28,28,0.96) !important; /* opaque red */
  border: 1px solid rgba(183,28,28,0.12) !important;
  box-shadow: none !important;
  color: #fff !important;
  animation: none !important;
  transition: none !important;
}

/* Victory and modals: replace translucent contents with opaque fallback for readability */
.gfx-no-effects .victory-modal { background: rgba(0,0,0,0.95) !important; }
.gfx-no-effects .victory-content { background: rgba(6,54,31,1) !important; border: 3px solid var(--glass-solid-border) !important; box-shadow: none !important; color: var(--muted) !important; }
.gfx-no-effects .intro-content { background: rgba(6,54,31,1) !important; border: 2px solid var(--glass-solid-border) !important; box-shadow: none !important; color: var(--muted) !important; }
.gfx-no-effects .intro-modal { background: rgba(0,0,0,0.95) !important; }
.gfx-no-effects .event-modal { background: rgba(0,0,0,0.95) !important; }
.gfx-no-effects .reset-modal { background: rgba(0,0,0,0.95) !important; }
.gfx-no-effects .floating-balance { background: rgba(7, 38, 30, 0.98) !important; box-shadow: none !important; }

/* .btn.active-state was previously used for class-based pulse; now handled via Web Animations API */

.btn.cooldown {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.5);
  transform: scale(0.98);
}

@keyframes buttonPop {
  0% { transform: scale(0.95) translateY(0); }
  50% { transform: scale(1.05) translateY(-2px); }
  100% { transform: scale(1) translateY(0); }
}

.earn {
  background: linear-gradient(180deg, #1db954, #149046);
  color: #fff;
  font-weight: 800
}

.earn:hover {
  background: linear-gradient(180deg, #22d160, #16a450);
}

.work-harder {
  background: linear-gradient(180deg, #ff5722, #e64a19);
  color: #fff;
  font-weight: 800;
}

.work-harder:hover {
  background: linear-gradient(180deg, #ff7043, #f4511e);
}

.gamble {
  background: linear-gradient(180deg, #ffd700, #d4a500);
  color: #ffffff;
  font-weight: 900
}

.gamble:hover {
  background: linear-gradient(180deg, #ffe44d, #e0b000);
  box-shadow: 0 18px 40px rgba(2, 8, 12, .75), inset 0 -16px 36px rgba(0, 0, 0, .5);
}

.soft-gamble {
  background: linear-gradient(180deg, #9c27b0, #7b1fa2);
  color: #fff;
  font-weight: 900
}

.soft-gamble:hover {
  background: linear-gradient(180deg, #ab47bc, #8e24aa);
}

.hard-gamble {
  background: linear-gradient(180deg, #d32f2f, #b71c1c);
  color: #ffffff;
  font-weight: 900
}

.hard-gamble:hover {
  background: linear-gradient(180deg, #e53935, #c62828);
}

/* Confetti-only gamble button (visually distinct pink) */
#confetti-gamble-btn {
  background: linear-gradient(180deg, #ff69b4, #e91e63);
  color: #ffffff;
  font-weight: 900;
  /* Combine the base dark shadow used by other buttons with a subtle pink highlight
     to preserve the celebratory style while matching the rest of the UI. */
  box-shadow: 0 12px 30px rgba(2, 8, 12, .65),
              0 6px 18px rgba(233, 30, 99, 0.08),
              inset 0 -8px 18px rgba(0, 0, 0, .25);
}

#confetti-gamble-btn:hover {
  background: linear-gradient(180deg, #ff85c2, #f06292);
  transform: scale(1.08) translateY(-4px);
  /* Stronger dark shadow with brighter pink halo on hover to match other buttons' hover style */
  box-shadow: 0 18px 40px rgba(2, 8, 12, .75),
              0 12px 36px rgba(233, 30, 99, 0.16),
              inset 0 -12px 26px rgba(0,0,0,0.35);
}

#confetti-gamble-btn:active {
  transform: scale(0.95) translateY(0);
  /* Use the 'active' shadow similar to .btn:active but add a pink tint for flavor */
  box-shadow: 0 6px 15px rgba(2, 8, 12, .65),
              0 4px 10px rgba(233, 30, 99, 0.10),
              inset 0 -4px 12px rgba(0, 0, 0, .3);
}

#confetti-gamble-btn:focus {
  outline: none;
  box-shadow: 0 12px 30px rgba(2, 8, 12, .65),
              0 8px 22px rgba(233, 30, 99, 0.12),
              inset 0 -8px 18px rgba(0, 0, 0, .25);
}

.btn .label {
  /* Scale text proportionally to the button size while maintaining reasonable limits. */
  font-size: clamp(13px, calc(var(--size) * 0.12), 18px);
}

.btn .sub {
  font-size: clamp(10px, calc(var(--size) * 0.08), 14px);
  opacity: .95
}

/* Smaller screens: reduce padding/gaps and slightly reduce max size so UI fits nicely. */
@media (max-width: 600px) {
  .btn-row { gap: 12px }
  .btn { --size: clamp(72px, 30vw, 120px); min-width: 64px; }
}

/* Very narrow (small phones): scale font sizes down more and keep layout usable. */
@media (max-width: 420px) {
  .btn-row { gap: 8px }
  .btn { --size: clamp(64px, 28vw, 100px); min-width: 56px; }
  .btn .label { font-size: clamp(11px, calc(var(--size) * 0.11), 16px); }
  .btn .sub { font-size: clamp(9px, calc(var(--size) * 0.075), 12px); }
}

/* Disabled state for individual toggle containers (used by Performance Mode to show disallowed toggles) */
.toggle-container.disabled {
  opacity: 0.8; /* Slightly less faded so they remain easier to see */
  filter: grayscale(0.25); /* soften the gray, not full fade */
  pointer-events: none; /* prevents clicks on the entire container */
}
/* Ensure label text appears grayed for disabled toggle containers */
.toggle-container.disabled label { opacity: 0.6; color: rgba(255,255,255,0.6); }

/* Disabled switch style */
.switch input:disabled + .slider {
  opacity: 0.8; /* easier visibility */
  filter: grayscale(0.25);
  cursor: not-allowed;
  border-color: rgba(255,255,255,0.12);
}

/* Keep the background-color swatches visually enabled independent of the image toggle */
.bg-theme-button.disabled {
  opacity: 0.6;
  pointer-events: none;
  filter: grayscale(0.3);
}

.hint {
  margin-top: 40px;
  font-size: 13px;
  opacity: .85
}

.keybinds-section {
  margin-top: max(40px, 10vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px
}

.keybinds-title {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1px
}

.keybinds {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap
}

.keybind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px
}

.key {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  min-width: 50px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3)
}

.action {
  font-size: 11px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px
}

.meta-info {
  margin-top: 48px;
  margin-bottom: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.meta-description {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
  line-height: 1.5;
  margin: 0;
}

.meta-description a {
  color: #ffd700;
  text-decoration: none;
  transition: opacity 0.2s;
}

.meta-description a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.toast-container {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  /* Toasts should appear above modals (modals use z-index: 20000). */
  z-index: 30001;
  max-width: 90vw;
  align-items: center;
}

/* Global site footer (always visible at bottom of viewport) */
.site-footer {
  position: relative; /* normal document flow */
  left: auto;
  bottom: auto;
  width: 100%;
  height: var(--footer-height);
  background: transparent; /* no dark background as requested */
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  z-index: auto; /* let overlays (toasts/modals) be above */
  border-top: 1px solid rgba(255,255,255,0.03);
}
.site-footer .footer-inner { max-width: 920px; width: 100%; padding: 8px 12px; text-align:center; }

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--glass);
  backdrop-filter: blur(6px);
  color: var(--muted);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
  font-weight: 700;
  white-space: nowrap;
}

/* Toast variants for better visual matching (black market / success / warning) */
.toast--bm-red {
  /* translucent glass with red tint so toasts stay consistent with the glassy style */
  background: linear-gradient(135deg, rgba(211,47,47,0.12), rgba(183,28,28,0.06));
  backdrop-filter: blur(6px);
  color: #fff;
  border: 1px solid rgba(211,47,47,0.12);
  box-shadow: 0 6px 20px rgba(183,28,28,0.08);
}

.toast--bm-green {
  background: linear-gradient(135deg, rgba(76,175,80,0.14), rgba(46,125,50,0.06));
  backdrop-filter: blur(6px);
  color: #e8f5e9;
  border: 1px solid rgba(76,175,80,0.32); /* stronger visible border */
  box-shadow: 0 8px 26px rgba(46,125,50,0.18), inset 0 1px 0 rgba(255,255,255,0.02);
  /* subtle outline to separate from background when contrast is low */
  outline: 1px solid rgba(0,0,0,0.06);
}

.toast--bm-orange {
  background: linear-gradient(135deg, rgba(255,152,0,0.12), rgba(239,108,0,0.05));
  backdrop-filter: blur(6px);
  color: #fff8e1;
  border: 1px solid rgba(255,152,0,0.10);
  box-shadow: 0 6px 20px rgba(239,108,0,0.06);
}

.toast--soft {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  backdrop-filter: blur(6px);
  color: var(--muted);
}

.active-events-container {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  pointer-events: none;
  z-index: 9999;
  max-width: 300px;
}

.active-event-badge {
  padding: 12px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(91, 163, 255, 0.2), rgba(91, 163, 255, 0.1));
  border: 1px solid rgba(91, 163, 255, 0.4);
  color: #5ba3ff;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(91, 163, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  animation: slideInLeft 0.3s ease-out;
  transition: opacity 0.5s ease-out;
}

.active-event-badge.fade-out {
  opacity: 0;
}

/* Active Black Market badges (top-right) */
.active-bm-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  pointer-events: none;
  z-index: 9999;
  max-width: 320px;
  align-items: flex-end;
}

.active-bm-badge {
  padding: 12px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255,82,82,0.18), rgba(255,82,82,0.08));
  border: 1px solid rgba(255,82,82,0.28);
  color: #ff5252;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(255,82,82,0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease-out;
  transition: opacity 0.5s ease-out, transform 0.2s ease-out;
}

.active-bm-badge.fade-out { opacity: 0; }

.active-bm-badge.ending {
  animation: pulse 0.5s ease-in-out;
  border-color: rgba(255,100,100,0.6);
  background: linear-gradient(135deg, rgba(255,100,100,0.2), rgba(255,100,100,0.1));
  color: #ff6464;
}

.active-bm-time {
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}

@keyframes slideInRight {
  from { transform: translateX(320px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.active-event-badge.ending {
  animation: pulse 0.5s ease-in-out;
  border-color: rgba(255, 100, 100, 0.6);
  background: linear-gradient(135deg, rgba(255, 100, 100, 0.2), rgba(255, 100, 100, 0.1));
  color: #ff6464;
}

.active-event-time {
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-320px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.progress-bar-container {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .4)
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  flex-wrap: wrap
}

.current-rank {
  color: var(--gold);
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.next-rank {
  color: rgba(255, 255, 255, 0.6);
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right
}

.progress-bar-bg {
  height: 22px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6);
  position: relative
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.3), rgba(255, 237, 78, 0.3));
  border-radius: 10px;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px
}

.progress-bar-current {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ffed4e);
  border-radius: 10px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px
}

.progress-handle {
  font-size: 11px;
  font-weight: 800;
  color: #e7e7e7;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8)
}

/* Tabs + Shop grid */
.tabs{display:flex;gap:10px;margin:10px 0 16px;flex-wrap:wrap;align-items:center;}
.tab-button{
  background:transparent;
  border:1px solid rgba(255,255,255,0.06);
  color:var(--muted);
  padding:8px 12px;
  border-radius:8px;
  cursor:pointer;
  font-weight:700;
  transition: all 0.2s ease;
}
.tab-button:hover:not(.active) {
  border-color: rgba(255,215,0,0.12);
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.tab-button:active {
  animation: jiggle 0.3s ease;
}
.tab-button.active{
  background:linear-gradient(90deg, rgba(255,215,0,0.08), rgba(255,215,0,0.02));
  color:var(--gold);
  border-color:rgba(255,215,0,0.18);
  box-shadow: 0 0 12px rgba(255,215,0,0.15);
  transform: translateY(-1px) scale(1.15);
  animation: jiggle 0.3s ease;
}
/* Responsive tweaks: reduce padding and allow smaller buttons on narrow screens */
@media (max-width: 420px) {
  .tabs { gap: 8px; }
  .tab-button { padding: 6px 8px; font-size: 13px; }
}
@keyframes jiggle {
  0%, 100% { transform: translateY(-1px) scale(1.15) rotate(0deg); }
  25% { transform: translateY(-1px) scale(1.15) rotate(-2deg); }
  75% { transform: translateY(-1px) scale(1.15) rotate(2deg); }
}
.tab-content{display:none;min-height:0}
.tab-content.active{display:block}

/* Casino-specific button row spacing: target the main button row only */
#casino > .btn-row:first-of-type {
  margin-top: 28px;
  margin-bottom: 24px;
}

.shop-controls {
  display: flex;
  justify-content: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 215, 0, 0.1);
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Allow the sort-controls area to take remaining space inside shop-controls
  and make inner toggle expand horizontally instead of using margin hacks */
.shop-controls .sort-controls { flex: 1 1 auto; align-items: center; }
.shop-controls .sort-controls .shop-toggle { display:flex; align-items:center; gap:12px; width:100%; justify-content:flex-start; flex-wrap: wrap; }
/* Place Sort label + select on the left, push Reverse label+switch to the right */
.shop-controls .sort-controls .shop-toggle > label[for="sort-type"],
.shop-controls .sort-controls .shop-toggle > select {
  order: 0; /* left group */
}
.shop-controls .sort-controls .shop-toggle > .reverse-toggle {
  order: 1; /* right group */
  margin-left: auto; /* push this group to the far right */
  display:flex; align-items:center; gap:8px; flex: 0 0 auto;
}
.shop-controls .sort-controls .shop-toggle > select { margin-left: 8px; min-width: 140px; max-width: clamp(160px, 24vw, 280px); }

/* When space is tight, ensure the left group (sort by) can shrink and wrap cleanly */
.shop-controls .sort-controls .shop-toggle > label[for="sort-type"] { flex: 0 0 auto; }
.shop-controls .sort-controls .shop-toggle > select { flex: 0 1 auto; max-width: clamp(160px, 24vw, 280px); }

@media (max-width: 560px) {
  .shop-controls .sort-controls .shop-toggle { gap:8px; }
  .shop-controls .sort-controls .shop-toggle > select { flex: 1 1 auto; min-width: 140px; max-width: 100%; }
  /* If width gets very small, put reverse toggle on a new line and keep it close together */
  .shop-controls .sort-controls .shop-toggle > .reverse-toggle { order: 2; margin-left: 0; justify-content: flex-start; }
}

.sort-controls label {
  font-weight: 600;
  color: #ffd700;
  margin: 0;
}

.sort-controls select {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sort-controls select:hover {
  border-color: rgba(255, 215, 0, 0.6);
  background: rgba(0, 0, 0, 0.5);
}

.sort-controls select:focus {
  outline: none;
  border-color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.sort-controls select option {
  background: #1a1a1a;
  color: #fff;
}



.reverse-control {
  display: flex;
  align-items: center;
  gap: 8px;
}



/* Shop toggle override */
.shop-toggle {
  margin-bottom: 0 !important;
  gap: 12px;
}

.shop-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px;margin-top:10px;align-items:start}
.upgrade-card{
  background:linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  padding:16px;
  border-radius:12px;
  border:1px solid rgba(255,215,0,0.15);
  box-shadow:0 4px 20px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,0.05);
  display:flex;
  flex-direction:column;
  gap:10px;
  transition:all 0.3s ease;
  position:relative;
  overflow:hidden;
  align-self: start; /* Prevent stretching to match row height in grid layouts */
}
.upgrade-card::before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:2px;
  background:linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity:0.3;
}

/* Add a subtle solid overlay to mask background texture under cards to
   prevent decorative background from briefly showing through during
   animations or layer compositing. Keep very low opacity to preserve look. */
.upgrade-card::after{
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: rgba(0,0,0,0.10);
  pointer-events: none;
  z-index: 0;
}

/* Ensure card children render above the overlay */
.upgrade-card > * {
  position: relative;
  z-index: 1;
}
.upgrade-card:hover{
  transform:translateY(-2px);
  border-color:rgba(255,215,0,0.3);
  box-shadow:0 6px 24px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,0.08);
}

.upgrade-card.maxed-out {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.15), rgba(0, 0, 0, 0.4));
  border-color: rgba(184, 134, 11, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.upgrade-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:2px;
}
.upgrade-title{
  font-weight:800;
  color:var(--gold);
  font-size:15px;
  text-shadow:0 2px 4px rgba(0,0,0,0.3);
  letter-spacing:0.3px;
  flex:1;
}
.upgrade-description{
  font-size:12px;
  opacity:0.8;
  line-height:1.5;
  margin-bottom:6px;
  color:rgba(255,255,255,0.9);
}
.upgrade-stats{
  display:flex;
  flex-direction:column;
  gap:6px;
  background:rgba(0,0,0,0.2);
  padding:10px;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.05);
}
.stat-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-size:12px;
}
.stat-label{
  color:rgba(255,255,255,0.6);
  font-size:11px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.5px;
}
.level-badge{
  background:linear-gradient(135deg, rgba(30,144,255,0.3), rgba(30,144,255,0.15));
  padding:4px 10px;
  border-radius:12px;
  font-weight:700;
  font-size:10px;
  border:1px solid rgba(30,144,255,0.3);
  color:#fff;
  white-space:nowrap;
  flex-shrink:0;
}
.level-badge.maxed{
  background:linear-gradient(135deg, rgba(255,215,0,0.35), rgba(255,215,0,0.2));
  border-color:rgba(255,215,0,0.5);
  color:var(--gold);
  font-weight:800;
}
.price-value{
  font-weight:700;
  color:#ff6b6b;
  font-size:12px;
  white-space:nowrap;
}
.price-value.affordable{
  color:#4CAF50;
}
.price-value.maxed{
  color:var(--gold);
}
.unlock-row{
  background:rgba(255,140,0,0.2);
  padding:8px;
  margin:-4px;
  border-radius:4px;
  border:1px solid rgba(255,140,0,0.4);
}
.unlock-row .stat-label{
  color:rgba(255,200,150,1);
  font-weight:700;
}
.unlock-value{
  font-weight:700;
  color:#FFD700;
  font-size:12px;
  text-shadow:0 1px 2px rgba(0,0,0,0.5);
}
.upgrade-locked-info{
  background:rgba(255,140,0,0.2);
  border:1px solid rgba(255,140,0,0.4);
  border-radius:8px;
  padding:12px;
  font-size:12px;
  color:#FFD700;
  text-align:center;
  font-weight:700;
  margin-top:auto;
  text-shadow:0 1px 2px rgba(0,0,0,0.5);
}
.unlock-info{
  background:rgba(255,77,79,0.15);
  border:1px solid rgba(255,77,79,0.3);
  border-radius:6px;
  padding:8px 10px;
  font-size:11px;
  color:rgba(255,200,200,0.9);
  text-align:center;
  font-weight:600;
}
.upgrade-actions{display:flex;gap:6px;margin-top:auto;padding-top:8px;border-top:1px solid rgba(255,255,255,0.08);align-items:center}
.buy-btn{
  flex:1;
  padding:10px 8px;
  border-radius:8px;
  border:0;
  cursor:pointer;
  font-weight:700;
  white-space:nowrap;
  font-size:11px;
  transition:all 0.2s ease;
  box-shadow:0 2px 6px rgba(0,0,0,0.3);
  will-change:transform, filter;
}
.buy-btn:hover:not(.locked){
  transform:translateY(-1px);
  box-shadow:0 4px 10px rgba(0,0,0,0.4);
  filter: brightness(1.15);
}
.buy-btn:active:not(.locked){
  transform:translateY(0);
}
.buy-btn.shaking {
  animation: buttonShake 0.35s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes buttonShake {
  10%, 90% { transform: translate3d(-2px, 0, 0) rotate(-2deg); }
  20%, 80% { transform: translate3d(3px, 0, 0) rotate(3deg); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0) rotate(-5deg); }
  40%, 60% { transform: translate3d(6px, 0, 0) rotate(5deg); }
}
.buy-1{background:linear-gradient(135deg, #4CAF50, #388E3C);color:white;text-shadow:0 1px 2px rgba(0,0,0,0.3)}
.buy-5{background:linear-gradient(135deg, #2196F3, #1565C0);color:white;text-shadow:0 1px 2px rgba(0,0,0,0.3)}
.buy-max{background:linear-gradient(135deg, #ffd700, #ff8c00);color:#ffffff;border:1px solid rgba(255,215,0,0.4);text-shadow:0 1px 2px rgba(0,0,0,0.3);font-weight:800}
.locked{opacity:.4;filter:grayscale(.8);cursor:not-allowed;transform:none!important}

.disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.05)
}

.options-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

.options-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
  margin-bottom: 30px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
}

.option-section {
  background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,215,0,0.15);
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  margin-bottom: 20px;
}

.option-section h3 {
  margin-top: 0;
}

.option-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.option-description {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* Changelog small tweaks */
.changelog-version strong { color: var(--gold); }
.changelog-version ul { margin-top: 6px; margin-bottom: 0; padding-left: 18px; }

/* Use summary from details for collapsible changelog entries */
details.changelog-version summary {
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 215, 0, 0.03);
  border: 1px solid rgba(255, 215, 0, 0.06);
  color: var(--gold);
  font-weight: 700;
}
/* summary open styles are defined later */
/* Add a grouped dark background to expanded changelog content */
details.changelog-version {
  display: block;
  border-radius: 8px;
  overflow: hidden; /* keep children inside rounded box */
}
/* The summary sits visually on top of the details; keep it transparent when open so the background is a single box */
details.changelog-version summary { border-radius: 8px; padding: 8px 12px; }
details.changelog-version[open] summary { background: rgba(255,215,0,0.06); border: 1px solid rgba(255,215,0,0.08); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
/* move the list inside the details background and ensure markers are inside */
/* Use `ul` as the dark-background panel so it starts below the summary and doesn't go under it */
/* Single continuous panel for changelog content (title + lists inside)
   The summary sits visually on top; the `.changelog-content` becomes the single boxed panel. */
details.changelog-version[open] > .changelog-content {
  margin: 0; /* remove default margin to keep content inside the box */
  padding: 12px 12px 12px 16px;
  color: rgba(255,255,255,0.9);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-top: none; /* avoid double border under the summary */
  border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
  display: block;
}

/* Keep each logical block visually separated but without individual borders */
.changelog-content .changelog-block { margin-bottom: 10px; }

/* Ensure lists inside the changelog-content keep the intended padding and marker behavior */
details.changelog-version[open] > .changelog-content ul {
  margin: 0; /* keep the list inside the block */
  padding-left: 18px;
  list-style-position: inside;
}

.option-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--gold), #d4a500);
  color: var(--felt);
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(255,215,0,0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.option-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,215,0,0.4);
  background: linear-gradient(135deg, #ffe44d, #e0b000);
}

.option-btn:active {
  transform: translateY(0);
}

/* Danger Zone */
.danger-zone {
  border: 1px solid rgba(255, 80, 60, 0.3);
  background: rgba(255, 80, 60, 0.05);
}

.danger-zone h3 {
  color: #ff503c;
}

.option-btn.danger {
  background: rgba(255, 80, 60, 0.2);
  border: 1px solid rgba(255, 80, 60, 0.5);
  color: #ff503c;
}

/* Less-dangerous caution button (yellow/gold themed) */
.option-btn.caution {
  /* Use a softer transparent interior with a sharp gold border and white text to indicate caution */
  background: linear-gradient(180deg, rgba(255,215,0,0.06), rgba(255,215,0,0.03));
  border: 1px solid #ffd740; /* sharp gold border */
  color: var(--gold, #ffd740);
  box-shadow: 0 4px 12px rgba(255,215,0,0.12);
}
.option-btn.caution:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,215,0,0.28);
  background: linear-gradient(180deg, rgba(255,215,0,0.12), rgba(255,215,0,0.06));
  border-color: #ffd700;
}
.option-btn.caution:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(255,215,0,0.14) inset;
  background: linear-gradient(180deg, rgba(255,215,0,0.14), rgba(255,215,0,0.08));
}
.option-btn.caution:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(255,215,0,0.12), 0 6px 16px rgba(255,215,0,0.12);
  border-color: #ffd700;
}

/* Disabled states for option and reset buttons */
.option-btn:disabled, .reset-button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.2) contrast(0.9);
  box-shadow: none !important;
}

.option-btn:disabled {
  background: rgba(60,60,60,0.12);
  color: rgba(255,215,0,0.6);
  border-color: rgba(255,215,0,0.06);
}

.option-btn.danger:hover {
  background: rgba(255, 80, 60, 0.4);
  border-color: #ff503c;
}

/* Caution Zone: less dangerous option area with yellow/gold theme */
.caution-zone {
  border: 1px solid rgba(255, 215, 0, 0.12);
  background: rgba(255, 215, 0, 0.03);
}
.caution-zone h3 { color: var(--gold); }

.reset-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #ff4d4f, #d32f2f);
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(255,77,79,0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255,77,79,0.5);
  background: linear-gradient(135deg, #ff6b6b, #f44336);
}

.reset-btn:active {
  transform: translateY(0);
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
  animation: particle-burst 0.8s ease-out forwards;
}

@keyframes particle-burst {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0.3);
  }
}

/* Options Sliders */
.slider-container {
  margin-bottom: 16px;
}

.slider-container label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  transition: transform 0.1s;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
  transition: transform 0.1s;
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.advanced-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.advanced-slider-row label {
  flex: 0 0 90px;
  font-size: 13px;
  margin: 0;
  text-align: right;
  color: rgba(255, 255, 255, 0.8);
}

.advanced-slider-row input {
  flex: 1;
  margin: 0;
}

.advanced-slider-row .val-display {
  flex: 0 0 36px;
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.format-preview-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.25;
  list-style: disc;
}

.format-preview-list li {
  margin: 0 0 4px 0;
}

.toggle-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* For the background color selector container, allow wrapping and reflow */
.toggle-container.bg-color-toggle {
  justify-content: flex-start;
  gap: 14px;
  align-items: center;
}

/* On small screens, stack the label and swatches vertically for better layout */
@media (max-width: 520px) {
  .toggle-container.bg-color-toggle { flex-direction: column; align-items: flex-start; }
  .bg-theme-row { width: 100%; gap: 8px; margin-left: 0; }
  .bg-theme-button { width: clamp(18px, 6vw, 24px); }
}

/* When toggle has a preview, stack the preview under the controls while keeping label + input on same row */
.toggle-container.has-preview {
  flex-direction: column;
  align-items: flex-start;
}

.toggle-main {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.toggle-main select { margin-left: auto; }

.toggle-container label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

/* Background color selector */
.bg-theme-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-left: auto }
.bg-theme-button {
  width: clamp(20px, 4.5vw, 28px); aspect-ratio: 1/1; border-radius: 10px; border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer; display: inline-block; box-shadow: 0 4px 10px rgba(0,0,0,0.25); transition: transform .15s ease, box-shadow .1s ease, border-color .12s ease;
  position: relative; overflow: hidden; display:inline-flex; align-items:center; justify-content:center; min-width: 20px; min-height: 20px;
}
.bg-theme-button:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(0,0,0,0.32); }
.bg-theme-button.active { outline: none; border-color: rgba(255,215,0,0.95); box-shadow: 0 0 0 6px rgba(255,215,0,0.10), 0 10px 28px rgba(0,0,0,0.42); }
.bg-theme-button.active::after { content: '✓'; color: #fff; font-weight: 800; position:absolute; font-size: 16px; padding: 1px 3px; border-radius: 4px; text-shadow: none; background: transparent; }
.bg-theme-button[aria-pressed="true"] { border-color: rgba(255,215,0,0.95); }
.bg-theme-button.disabled { opacity: 0.4; pointer-events: none; filter: grayscale(0.25); }
.bg-theme-button:focus { outline: 0; box-shadow: 0 0 0 4px rgba(255,215,0,0.12), 0 10px 20px rgba(0,0,0,0.32); }
.bg-theme-button.green { background: linear-gradient(180deg, #064a29, #06361f); }
.bg-theme-button.blue { background: linear-gradient(180deg, #052f6b, #071a3b); }
.bg-theme-button.purple { background: linear-gradient(180deg, #651a7f, #4a115c); }
.bg-theme-button.gold { background: linear-gradient(180deg, #ffd740, #d4a500); }
.bg-theme-button.midnight { background: linear-gradient(180deg, #0b0f22, #060614); }
.bg-theme-button.red { background: linear-gradient(180deg, #e53935, #c62828); }
/* New casino-themed color options */
.bg-theme-button.burgundy { background: linear-gradient(180deg, #7b1f2a, #3a0a10); }
.bg-theme-button.teal { background: linear-gradient(180deg, #00796b, #004d40); }

/* Theme body classes that override key --felt variables */
html.theme-green, body.theme-green { --felt: #06361f; --felt-2: #0a2f20; }
html.theme-blue, body.theme-blue { --felt: #052a56; --felt-2: #03162a; }
html.theme-purple, body.theme-purple { --felt: #3b0f3b; --felt-2: #221022; }
html.theme-gold, body.theme-gold { --felt: #3b2b00; --felt-2: #2a2000; }
html.theme-midnight, body.theme-midnight { --felt: #071022; --felt-2: #02060b; }
html.theme-red, body.theme-red { --felt: #e53935; --felt-2: #c62828; }
html.theme-burgundy, body.theme-burgundy { --felt: #7b1f2a; --felt-2: #3a0a10; }
html.theme-teal, body.theme-teal { --felt: #00796b; --felt-2: #004d40; }

/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

/* Hide default HTML checkbox */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--gold);
  border-color: var(--gold);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--gold);
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #fff;
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

@media(max-width:560px) {
  .btn {
    --size: clamp(72px, 28vw, 120px);
  }

  .btn-row {
    gap: 14px;
    /* Remove global margin here, will use #casino scoped rule */
  }

  .balance {
    padding-top: 6px;
    font-size: 20px
  }

  body {
    align-items: flex-start;
    padding: 10px 0;
  }

  .shell {
    padding: 16px;
  }
}

@media(max-width:560px) {
  #casino > .btn-row:first-of-type {
    margin-top: 12px;
  }
}

/* Reset Modal */
.reset-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20000;
  animation: fadeIn 0.3s ease-out;
}

.reset-content {
  background: linear-gradient(135deg, #2a0e0e, #1a0505);
  border: 2px solid #ff503c;
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 40px rgba(255, 80, 60, 0.3);
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Textarea inside modals: non-resizable, centered, and constrained with margin at bottom */
.reset-content textarea { 
  resize: none;
  display: block;
  width: calc(100% - 24px);
  max-width: 520px;
  margin: 0 auto 12px; /* center + bottom margin */
  box-sizing: border-box;
}

.reset-title {
  font-size: 24px;
  font-weight: 900;
  color: #ff503c;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.reset-message {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
  margin-bottom: 24px;
}

.reset-message strong {
  color: #ff503c;
  font-weight: 700;
}

.reset-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.reset-button {
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-transform: uppercase;
}

.reset-button.cancel {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.reset-button.cancel:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.reset-button.confirm {
  background: #ff503c;
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 80, 60, 0.4);
}

.reset-button.confirm:hover {
  background: #ff6b5b;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 80, 60, 0.5);
}

/* Keep the cooldown suffix lowercase even when parent buttons use uppercase transform */
.reset-button .cooldown-suffix,
.option-btn .cooldown-suffix,
.btn .cooldown-suffix {
  text-transform: none;
  font-size: 0.95em;
  opacity: 0.95;
}

/* Event Modal */
.event-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 22000;
  animation: fadeIn 0.3s ease-out;
}

.event-content {
  background: linear-gradient(135deg, rgba(10, 50, 120, 0.95), rgba(20, 40, 100, 0.95));
  border: 2px solid #5ba3ff;
  border-radius: 16px;
  padding: 40px;
  max-width: 450px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 40px rgba(91, 163, 255, 0.3), 0 0 80px rgba(91, 163, 255, 0.15);
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.event-title {
  font-size: 28px;
  font-weight: 900;
  color: #5ba3ff;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 20px rgba(91, 163, 255, 0.4);
}

.event-description {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.7;
  margin-bottom: 24px;
}

.event-description strong {
  color: #5ba3ff;
  font-weight: 700;
}

.event-timer {
  font-size: 14px;
  color: rgba(91, 163, 255, 0.8);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 20px;
}

.event-button-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.event-close-btn {
  background: #5ba3ff;
  color: #fff;
  border: none;
  padding: 12px 30px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(91, 163, 255, 0.3);
}

.event-close-btn:hover {
  background: #7bb8ff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(91, 163, 255, 0.4);
}

.event-close-btn:active {
  transform: translateY(0);
}

.event-modal.fade-out {
  animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes scaleIn {
  0% {
    transform: scale(0.8) translateY(50px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Info Tab Version and Title Tweaks */
#info .option-section h2 {
  margin-top: 0.75em !important;
}
#info .version-display {
  margin-bottom: 0 !important;
}

@keyframes workPulseAnim {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.balance.work-pulse {
  animation: workPulseAnim 0.15s ease-out;
}

@keyframes gambleWinAnim {
  0% { transform: scale(1) rotate(0deg); color: var(--gold); text-shadow: none; }
  15% { transform: scale(1.3) rotate(-5deg); color: var(--gold); text-shadow: 0 0 25px var(--gold); }
  30% { transform: scale(1.3) rotate(5deg); color: var(--gold); text-shadow: 0 0 20px var(--gold); }
  50% { transform: scale(1.2) rotate(-3deg); color: var(--gold); text-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
  85% { transform: scale(1.05) rotate(1deg); color: var(--gold); text-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }
  100% { transform: scale(1) rotate(0deg); color: var(--gold); text-shadow: none; }
}

.balance.gamble-win {
  animation: gambleWinAnim 1.5s ease-out;
}

/* Mirror balance animations for the floating HUD so it visually matches */
.floating-balance .value.work-pulse {
  animation: workPulseAnim 0.15s ease-out;
}

.floating-balance .value.gamble-win {
  animation: gambleWinAnim 1.5s ease-out;
}

/* Black Market Styles */
.bm-card {
  border: 1px solid rgba(255, 82, 82, 0.3);
  background: linear-gradient(145deg, rgba(40, 10, 10, 0.6), rgba(20, 5, 5, 0.8));
}

.bm-card:hover {
  border-color: rgba(255, 82, 82, 0.6);
  box-shadow: 0 4px 20px rgba(255, 82, 82, 0.15);
}

.bm-card .upgrade-title {
  color: #ff5252;
}

.bm-card.out-of-stock:not(.bm-active) {
  opacity: 0.6;
  filter: grayscale(0.8);
}

.bm-card.out-of-stock button {
  background: #333;
  color: #888;
  cursor: not-allowed;
}

.buff-active {
  font-size: 12px;
  text-align: center;
  margin: 8px 0;
  padding: 4px;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.black-market-header h2 {
  color: #ff5252;
  text-shadow: 0 0 10px rgba(255, 82, 82, 0.3);
}

.black-market-header p {
  color: #aaa;
  font-style: italic;
}


/* Black Market Button Styles */
.bm-buy-btn {
  width: 100%;
  margin-top: 10px;
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  color: #ffcdd2;
  border: 1px solid rgba(255, 82, 82, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.bm-buy-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #e53935, #c62828);
  color: #fff;
  border-color: rgba(255, 82, 82, 0.5);
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
  transform: translateY(-1px);
}

.bm-buy-btn:active:not(:disabled) {
  transform: translateY(0);
}

.bm-buy-btn:disabled {
  background: #2a2a2a;
  color: #555;
  border-color: transparent;
  cursor: not-allowed;
  box-shadow: none;
}

/* Active state for black market button - uses same button but indicates ACTIVE */
.bm-buy-btn.active {
  background: linear-gradient(135deg, #4CAF50, #2E7D32);
  color: #fff;
  border-color: rgba(76, 175, 80, 0.2);
  box-shadow: 0 6px 14px rgba(76, 175, 80, 0.25);
}

/* Fix for shaking cards */
.bm-card:hover {
  transform: none !important; /* Override default upgrade-card hover movement */
}

/* Active black market item - red glow */
.bm-card.bm-active {
  opacity: 1;
  filter: none;
  border-color: rgba(255, 82, 82, 0.8);
  box-shadow: 0 0 20px rgba(255, 82, 82, 0.5), 0 0 40px rgba(255, 82, 82, 0.3);
}

/* Remove tap highlight on mobile browsers */
button, .your-button-class {
  -webkit-tap-highlight-color: transparent;
}
#win-chance { transition: color 160ms linear; }