/* ==================================================================== */
/* 0. CONFIGURATION & GLOBALS */
/* ==================================================================== */

:root {
  /* Premium Royal Purple Palette */
  --primary-bg: #0f0518;
  --primary-accent: #7c3aed;
  /* Violet 600 */
  --primary-glow: #8b5cf6;
  /* Violet 500 */
  --secondary-accent: #06b6d4;
  /* Cyan 500 */

  --surface-glass: rgba(255, 255, 255, 0.03);
  --surface-glass-hover: rgba(255, 255, 255, 0.08);
  --surface-border: rgba(255, 255, 255, 0.1);

  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --text-accent: #a78bfa;

  --success-color: #10b981;
  --error-color: #ef4444;
  --gold-color: #fbbf24;

  --font-main: 'Outfit', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --backdrop-blur: blur(12px);
  --danger-color: #751717; /* Added for banner consistency */
  --card-bg: #151520; /* Added for explainer consistency */
  --border-color: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--primary-bg);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, var(--text-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.2rem;
}

h2,
h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* ==================================================================== */
/* 1. BASE UTILITIES & HELPERS */
/* ==================================================================== */

.subtitle {
  color: var(--text-secondary);
  font-weight: 300;
  letter-spacing: 1px;
  font-size: 0.9rem;
}

.custom-link {
  color: white;
  font-weight: bold;
  text-decoration: none;
}

.custom-link:hover,
.custom-link:visited,
.custom-link:active {
  color: white;
  text-decoration: none;
}

/* Background Effects */
.bg-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s infinite ease-in-out;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--primary-accent);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--secondary-accent);
  bottom: -150px;
  right: -150px;
  animation-delay: -10s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(30px, 50px);
  }
}

/* Tutorial/Overlay Dims */
#tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: none;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#tutorial-overlay:not(.hidden) {
  display: flex;
}

.dim-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 900;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.dim-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.highlight-element {
  position: relative;
  z-index: 950;
  box-shadow: 0 0 0 4px var(--primary-accent), 0 0 50px rgba(124, 58, 237, 0.5);
  transition: all 0.3s ease;
  background: var(--surface-dark);
  border-radius: inherit;
}

/* ==================================================================== */
/* 2. LAYOUT & STRUCTURE (Containers, Header, Footer) */
/* ==================================================================== */

.app-container {
  width: 100%;
  max-width: 900px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  z-index: 1;
}

/* Header */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
  padding: 1rem 2rem;
  background: var(--surface-glass);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
}

.logo-section {
  line-height: 1;
}

#main-logo {
  max-height: 40px;
  width: auto;
  margin: 0;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  border: 1px solid var(--surface-border);
  position: relative;
}

/* ==================================================================== */
/* 3. COMPONENTS (Reusable UI Elements) */
/* ==================================================================== */

/* Demo Banner (60% Width, Centered) */
#demo-warning-banner {
  /* BACKGROUND AND SIZING */
  background-color: var(--danger-color, #751717);
  color: #FFFFFF;

  /* Centering the 60% block */
  width: 60%;
  margin: 0.5rem auto 0.5rem auto;

  /* FLEXBOX FOR INNER TEXT CENTERING */
  display: flex;
  justify-content: center;
  align-items: center;

  /* VISUAL SPACING AND TEXT STYLE */
  padding: 0.75rem 0.5rem;

  /* TEXT STYLE */
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  line-height: 1.2;
}

#demo-warning-banner h2 {
  margin: 0;
  padding: 0;
  font-size: 1em;
  color: inherit;
}


/* Balance Display & Float */
.balance-display {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--success-color);
  font-weight: 600;
  letter-spacing: -0.5px;
}

.currency-symbol {
  color: var(--text-secondary);
  margin-right: 4px;
}

.balance-float {
  position: absolute;
  top: 50%;
  right: 1.2rem;
  transform: translateY(-50%);

  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;

  animation-duration: 1.5s;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
  z-index: 10;
}

.balance-float.earn {
  color: var(--success-color);
  animation-name: balance-float-earn;
}

.balance-float.spend {
  color: var(--error-color);
  animation-name: balance-float-spend;
}

/* Keyframes for EARN (Floats UP) */
@keyframes balance-float-earn {
  0% {
    opacity: 0;
    /* Start above the balance text */
    transform: translate(0, -1.2rem);
  }

  10% {
    opacity: 1;
    transform: translate(0, -1.5rem);
  }

  100% {
    opacity: 0;
    transform: translate(0, -3rem); /* Scalable distance */
  }
}

/* Keyframes for SPEND (Floats DOWN) */
@keyframes balance-float-spend {
  0% {
    opacity: 0;
    transform: translate(0, 0);
  }

  10% {
    opacity: 1;
    transform: translate(0, 10px);
  }

  100% {
    opacity: 0;
    transform: translate(0, 3rem); /* Scalable distance */
  }
}

/* Buttons */
.btn {
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.2);
  z-index: -1;
  transition: width 0s linear;
}

.btn.hold-active .btn-progress {
  width: 100%;
  transition: width 0.1s linear;
}

.btn.hold-active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary-accent), var(--primary-glow));
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.6);
  filter: brightness(1.1);
}

.btn.primary:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.secondary {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
}

.btn.secondary:hover {
  background: var(--surface-glass-hover);
  border-color: var(--text-primary);
}

.btn.text {
  background: none;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn.text:hover {
  color: var(--text-primary);
}

.btn.large {
  padding: 1.2rem 4rem;
  font-size: 1.5rem;
  border-radius: 50px;
  letter-spacing: 2px;
}

/* Card/Glass Styles */
.lobby-card,
.game-card,
.tutorial-card {
  background: var(--surface-glass);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  padding: 2.5rem;
  width: 100%;
  box-shadow: var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

/* Lobby */
.selection-group h3 {
  margin-bottom: 1rem;
}

.grid-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

#tier-options {
  margin-bottom: 1.5rem;
}

#buyin-selection-group {
  padding-top: 1.5rem;
}

.option-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.option-card:hover {
  background: var(--surface-glass-hover);
  transform: translateY(-4px);
  border-color: var(--primary-accent);
  box-shadow: 0 10px 20px -5px rgba(124, 58, 237, 0.3);
}

.option-card.selected {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--primary-accent);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

.option-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.3rem;
}

.option-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.lobby-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--surface-border);
}

.summary-box {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.summary-box .total {
  font-size: 1.4rem;
  color: var(--text-primary);
  font-weight: 700;
  margin-top: 0.5rem;
  color: var(--primary-accent);
}

.lobby-controls {
  display: flex;
  gap: 1rem;
}

/* ==================================================================== */
/* 4. VIEWS (LOBBY, GAME, SPLASH, AUDIT) */
/* ==================================================================== */

/* View Transitions */
.view-section {
  animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  width: 100%;
}

.view-section.hidden {
  display: none;
}

.view-section.active {
  display: block;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Splash View */
.splash-content {
  text-align: center;
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.splash-title {
  font-size: 5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--primary-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
  letter-spacing: -2px;
  text-shadow: 0 10px 30px rgba(124, 58, 237, 0.3);
}

.splash-subtitle {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 4rem;
  font-weight: 300;
  letter-spacing: 2px;
}

.splash-visual {
  position: relative;
  width: 200px;
  height: 200px;
  margin-bottom: 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.orb-pulse {
  width: 100px;
  height: 100px;
  background: var(--primary-accent);
  border-radius: 50%;
  box-shadow: 0 0 50px var(--primary-glow);
  animation: pulse-orb 3s infinite ease-in-out;
}

@keyframes pulse-orb {
  0% {
    transform: scale(1);
    box-shadow: 0 0 50px var(--primary-glow);
  }

  50% {
    transform: scale(1.5);
    box-shadow: 0 0 80px var(--primary-glow), 0 0 120px var(--secondary-accent);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 50px var(--primary-glow);
  }
}

/* Game View */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.room-info {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: flex;
  gap: 1.5rem;
}

/* Jackpot Display */
.jackpot-header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.jackpot-label {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0;
}

#jackpot-display {
  color: var(--gold-color);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
  animation: pulse-gold 2s infinite;
}

#lobby-jackpot {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-color);
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.5);
  animation: pulse-gold 3s infinite;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

@keyframes pulse-gold {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }
}

.status-bar {
  text-align: center;
  margin-bottom: 3rem;
}

#game-status {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.5rem;
  min-height: 2rem;
}

#round-info {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.players-container {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 4rem;
  flex-wrap: wrap;
}

.player-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 2rem;
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
}

.player-card.user-player {
  background: rgba(124, 58, 237, 0.05);
  border-color: rgba(124, 58, 237, 0.3);
}

.player-card.winner {
  border-color: var(--success-color);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
  transform: scale(1.05);
  z-index: 10;
}

.player-card.eliminated {
  opacity: 0.4;
  filter: grayscale(1);
}

.player-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #333, #111);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
  border: 2px solid var(--surface-border);
}

.user-player .player-avatar {
  background: linear-gradient(135deg, var(--primary-accent), var(--primary-glow));
  border-color: rgba(255, 255, 255, 0.2);
}

.player-info {
  text-align: center;
}

.player-name {
  font-size: 1rem;
  margin-bottom: 0.2rem;
  color: var(--text-secondary);
  display: block;
}

.player-winnings {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  display: block;
  min-height: 1.2rem;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.roll-display {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.5rem;
}

.roll-value {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

.roll-parity {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  min-height: 2.2rem;
}

/* Animations */
@keyframes roll {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  50% {
    transform: translateY(-5px);
    opacity: 0.7;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.rolling .roll-value {
  animation: roll 0.1s infinite;
  color: var(--secondary-accent);
}


/* Notifications */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.notification-toast {
  background: rgba(15, 5, 24, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--surface-border);
  border-left: 4px solid var(--primary-accent);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  color: var(--text-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  min-width: 300px;
  max-width: 400px;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 1rem;

  animation: slideInRight 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  transform-origin: right center;
}

.notification-toast.success {
  border-left-color: var(--success-color);
}

.notification-toast.error {
  border-left-color: var(--error-color);
}

.notification-toast.info {
  border-left-color: var(--primary-accent);
}

.notification-toast.hiding {
  animation: slideOutRight 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Audit Controls */
.audit-panel {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 5, 24, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--surface-border);
  border-left: 2px solid var(--primary-accent);
  padding: 1.2rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  width: 240px;
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.audit-panel.retracted {
  transform: translate(-100%, -50%);
}

.audit-toggle-btn {
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(15, 5, 24, 0.9);
  border: 1px solid var(--surface-border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  padding-bottom: 3px;
}

.audit-toggle-btn .icon::before {
  content: '‹';
}

.audit-panel.retracted .audit-toggle-btn .icon::before {
  content: '›';
}

.audit-toggle-btn:hover {
  color: var(--primary-accent);
  background: rgba(20, 10, 30, 0.95);
}

.audit-panel h3 {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.2rem;
  text-align: center;
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 0.5rem;
}

.audit-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.audit-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.audit-control-group label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audit-toggle {
  width: 40px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.audit-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.audit-toggle.active {
  background: rgba(124, 58, 237, 0.3);
}

.audit-toggle.active::after {
  left: 22px;
  background: var(--primary-accent);
  box-shadow: 0 0 10px var(--primary-accent);
}

.audit-divider {
  border: 0;
  height: 1px;
  background: var(--surface-border);
  margin: 0.2rem 0;
}

.audit-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.audit-input-group label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.input-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.input-controls input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 4px;
  width: 100%;
  text-align: center;
  border-radius: 4px;
}

.btn-mini {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-primary);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.btn-mini:hover {
  background: var(--primary-accent);
}


/* Explainer Page Overlay */
.explainer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.explainer-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.explainer-content {
  background: linear-gradient(145deg, var(--card-bg) 0%, rgba(20, 20, 30, 0.95) 100%);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  width: 95%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.explainer-header {
  padding: 25px 35px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
}

.explainer-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.8rem;
  font-weight: 300;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.explainer-body {
  padding: 35px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.explainer-section {
  margin-bottom: 50px;
  position: relative;
}

.explainer-section:last-child {
  margin-bottom: 0;
}

.explainer-section h3 {
  color: var(--primary-accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 20px;
  display: inline-block;
  border-bottom: 2px solid var(--primary-accent);
  padding-bottom: 5px;
}

.explainer-section h4 {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin: 25px 0 15px 0;
  font-weight: 500;
}

.explainer-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1rem;
  margin-bottom: 20px;
  max-width: 800px;
}

.explainer-section ul,
.explainer-section ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
  padding: 0;
  list-style: none;
  margin-bottom: 25px;
}

.explainer-section li {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: transform 0.2s, border-color 0.2s;
}

.explainer-section li:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.explainer-section li strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

/* Visual Examples */
.visual-example {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  margin: 30px auto;
  max-width: 600px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.2);
}

.visual-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 20px;
}

.v-player {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-dark);
  border: 3px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.v-player.winner {
  border-color: var(--success-color);
  box-shadow: 0 0 25px rgba(0, 255, 136, 0.4);
  transform: scale(1.1);
  z-index: 2;
}

.v-player.loser {
  opacity: 0.5;
  transform: scale(0.9);
}

.v-player.jackpot-hit {
  border-color: var(--gold-color);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
  animation: pulse-gold 2s infinite;
}

.v-parity {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.v-roll {
  font-size: 0.75rem;
  color: var(--text-secondary);
  position: absolute;
  bottom: -30px;
  width: 120%;
  text-align: center;
  font-weight: 500;
}

.v-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  position: absolute;
  bottom: -50px;
  width: 120%;
  text-align: center;
  font-weight: 500;
  text-transform: uppercase;
}

.visual-caption {
  font-size: 1rem !important;
  color: var(--primary-accent) !important;
  margin-top: 35px !important;
  font-style: normal !important;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-align: center;
}

/* Tier Visual */
.tier-visual .tier-row {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin: 20px 0;
}

.t-group {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.t-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-secondary);
  opacity: 0.5;
}

.t-dot.winner {
  background: var(--success-color);
  opacity: 1;
  box-shadow: 0 0 10px var(--success-color);
}

.tier-arrow {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 10px 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.7;
}

@keyframes pulse-gold {
  0% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
  }

  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
  }

  100% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
  }
}

/* ==================================================================== */
/* 5. MEDIA QUERIES (Mobile/Responsive) */
/* ==================================================================== */

@media (max-width: 768px) {
  .app-container {
    padding: 10px;
    gap: 1rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  /* Splash Screen Mobile Text */
  .splash-title {
    font-size: 3rem;
  }

  .splash-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  /* Lobby Mobile Text */
  #lobby-jackpot {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .option-value {
    font-size: 0.9rem;
  }

  .option-label {
    font-size: 0.65rem;
  }

  .header-content {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
  }

  .user-section {
    width: 100%;
    justify-content: center;
    padding: 0.3rem 1rem;
  }

  .lobby-card,
  .game-card {
    padding: 1rem;
  }

  h2,
  h3 {
    margin-bottom: 0.8rem;
  }

  .grid-options {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 0.5rem;
  }

  .option-card {
    padding: 0.5rem;
  }

  .grid-options {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  }

  .lobby-footer {
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .lobby-controls {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 1rem;
  }

  .lobby-controls button {
    width: 100%;
  }

  .game-header {
    flex-direction: column;
    gap: 1rem;
  }

  .room-info {
    width: 100%;
    justify-content: center;
    font-size: 0.8rem;
  }

  .players-container {
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .player-card {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-height: auto;
  }

  .player-avatar {
    width: 50px;
    height: 50px;
    font-size: 1rem;
    margin-bottom: 0;
  }

  .player-info {
    text-align: left;
    flex: 1;
    padding-left: 1rem;
  }

  .player-name {
    margin-bottom: 0.2rem;
  }

  .roll-display {
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-top: 0;
  }

  .roll-parity {
    font-size: 1.2rem;
    min-height: auto;
  }

  /* Audit Panel Mobile */
  .audit-panel {
    left: 0;
    transform: translate(-100%, -50%);
  }

  .audit-panel.visible {
    transform: translate(0, -50%);
  }

  .audit-panel .audit-toggle-btn .icon::before {
    content: '›';
  }

  .audit-panel.visible .audit-toggle-btn .icon::before {
    content: '‹';
  }

  /* Game Status Mobile */
  #game-status {
    font-size: 1.2rem;
  }

  /* Explainer Mobile */
  .explainer-header h2 {
    font-size: 1.4rem;
  }

  .explainer-section p,
  .explainer-section li {
    font-size: 0.9rem;
  }
}