/* ===================================
   NACKLSWEEPER STYLES
   Classic Minesweeper with modern polish
   =================================== */

:root {
  /* NACKL Brand Colors */
  --color-primary: #00d4aa;
  --color-primary-dark: #00b892;
  --color-primary-light: #33dfbb;
  
  /* Classic Minesweeper Colors */
  --color-bg: #c0c0c0;
  --color-bg-dark: #808080;
  --color-bg-light: #dfdfdf;
  --color-border-light: #ffffff;
  --color-border-dark: #7b7b7b;
  
  /* Cell Colors */
  --color-cell-hidden: #bdbdbd;
  --color-cell-revealed: #f0f0f0;
  --color-cell-flag: #ff4444;
  --color-cell-mine: #333333;
  
  /* Number Colors (Classic) */
  --color-num-1: #0000ff;
  --color-num-2: #008000;
  --color-num-3: #ff0000;
  --color-num-4: #000080;
  --color-num-5: #800000;
  --color-num-6: #008080;
  --color-num-7: #000000;
  --color-num-8: #808080;
  
  /* UI Colors */
  --color-text: #000000;
  --color-text-light: #ffffff;
  --color-overlay-bg: rgba(0, 0, 0, 0.85);
  --color-menu-bg: #2a2a2a;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* Borders */
  --bevel-size: 3px;
  --border-radius: 4px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-medium: 250ms ease;
  --transition-slow: 400ms ease;
}

/* ===================================
   NACKL THEME - 1980s SYNTH-WAVE
   =================================== */

body[data-theme="nackl"] {
  /* Synth-Wave Neon Colors */
  --color-primary: #00ffff;
  --color-primary-dark: #00cccc;
  --color-primary-light: #66ffff;
  
  /* Dark retro background */
  --color-bg: #0a0a0f;
  --color-bg-dark: #050508;
  --color-bg-light: #15151f;
  
  /* Purple accent */
  --color-accent: #ff00ff;
  --color-accent-light: #ff66ff;
  
  /* No borders - only neon glows */
  --color-border-light: transparent;
  --color-border-dark: transparent;
  
  /* Cell Colors - Dark with neon */
  --color-cell-hidden: rgba(20, 20, 40, 0.6);
  --color-cell-revealed: rgba(10, 10, 20, 0.8);
  --color-cell-flag: #ff00ff;
  --color-cell-mine: #ff0066;
  
  /* Neon Number Colors */
  --color-num-1: #00ffff;
  --color-num-2: #00ff88;
  --color-num-3: #ff00ff;
  --color-num-4: #ff0099;
  --color-num-5: #ffff00;
  --color-num-6: #ff6600;
  --color-num-7: #ff0066;
  --color-num-8: #9900ff;
  
  /* UI Colors */
  --color-text: #ffffff;
  --color-text-light: #ffffff;
  --color-overlay-bg: rgba(0, 0, 0, 0.95);
  --color-menu-bg: rgba(10, 10, 30, 0.98);
  
  /* Retro Fonts */
  font-family: var(--font-main, 'Orbitron', sans-serif);
}
  
  /* Cell Colors - darker theme */
  --color-cell-hidden: #2a2a2a;
  --color-cell-revealed: #1a1a1a;
  --color-cell-flag: #ff6600;
  --color-cell-mine: #ff0000;
  
  /* Number Colors - vibrant neon style */
  --color-num-1: #00d4ff;
  --color-num-2: #00ff88;
  --color-num-3: #ff6600;
  --color-num-4: #ff00ff;
  --color-num-5: #ffff00;
  --color-num-6: #ff0088;
  --color-num-7: #ffffff;
  --color-num-8: #888888;
  
  /* UI Colors */
  --color-text: #ffffff;
  --color-text-light: #ffffff;
  --color-overlay-bg: rgba(0, 0, 0, 0.95);
  --color-menu-bg: #1a1a1a;
}

/* ===================================
   RESET & BASE
   =================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--color-bg);
  color: var(--color-text);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  margin: 0px!important;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

input {
  font-family: inherit;
}

/* Disable pull-to-refresh */
body {
  overscroll-behavior-y: contain;
}

/* Prevent zoom on double-tap */
button, a, input {
  touch-action: manipulation;
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================
   BEVEL STYLES (Classic Minesweeper)
   =================================== */

.bevel-raised {
  border-width: var(--bevel-size);
  border-style: solid;
  border-color: var(--color-border-light) var(--color-border-dark) var(--color-border-dark) var(--color-border-light);
}

.bevel-recessed {
  border-width: var(--bevel-size);
  border-style: solid;
  border-color: var(--color-border-dark) var(--color-border-light) var(--color-border-light) var(--color-border-dark);
}

.bevel-flat {
  border: 1px solid var(--color-border-dark);
}

/* ===================================
   LAYOUT
   =================================== */

#game-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #c0c0c0 0%, #a0a0a0 100%);
  transition: background var(--transition-medium);
}

/* Animated Background Canvas */
.game-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.4; /* Powered up! */
  pointer-events: none;
}

/* Game board and UI above canvas */
#game-board-container,
.menu-toggle,
.menu-panel {
  position: relative;
  z-index: 1;
}

/* NACKL Theme - Dark background with subtle pattern */
body[data-theme="nackl"] #game-container {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
  background-image: 
    linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 212, 255, 0.03) 10px, rgba(0, 212, 255, 0.03) 20px);
}

#game-board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  max-width: 100%;
  max-height: 100%;
}

/* Mobile: center vertically and reduce header space */
@media (max-width: 768px) {
  #game-board-container {
    padding: var(--spacing-xs);
    gap: var(--spacing-xs);
    height: 100vh;
    justify-content: center;
  }
}

/* WTF Mode: Fullscreen - NO scrollbars ever */
body.wtf-mode #game-container {
  padding: 0;
  margin: 0;
  overflow: hidden;
}

body.wtf-mode #game-board-container {
  padding: 2px;
  gap: 2px;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
  justify-content: center;
  align-items: center;
}

body.wtf-mode .game-board {
  overflow: auto !important;
  max-width: 100% !important;
  max-height: calc(100vh - 60px) !important;
}

body.wtf-mode .menu-toggle {
  position: fixed;
  z-index: 10000;
  background: rgba(42, 42, 42, 0.95);
}

body.wtf-mode .game-header {
  margin-bottom: 2px;
  flex-shrink: 0;
}

/* ===================================
   MENU TOGGLE BUTTON
   =================================== */

.menu-toggle {
  position: fixed;
  top: var(--spacing-md);
  left: var(--spacing-md);
  right: auto;
  z-index: 10000;
  width: 56px;
  height: 56px;
  background: rgba(0, 255, 255, 0.15);
  border: 1px solid rgba(0, 255, 255, 0.4);
  border-radius: 5%;
  color: var(--color-text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 
    0 0 20px rgba(0, 255, 255, 0.4),
    inset 0 0 10px rgba(0, 255, 255, 0.2);
  transition: all var(--transition-medium);
  cursor: pointer;
  opacity: 0.6;
}

.menu-toggle::before,
.menu-toggle::after {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  background: #00ffff;
  border-radius: 2px;
  transition: all var(--transition-medium);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.8);
}

.hamburger-line {
  display: block;
  width: 28px;
  height: 3px;
  background: #00ffff;
  border-radius: 2px;
  transition: all var(--transition-medium);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.8);
}

.menu-toggle::after {
  /* No additional margin needed */
}

.menu-toggle:hover {
  background: rgba(0, 255, 255, 0.25);
  border-color: rgba(0, 255, 255, 0.8);
  box-shadow: 
    0 0 30px rgba(0, 255, 255, 0.6),
    inset 0 0 15px rgba(0, 255, 255, 0.3);
  transform: scale(1.1);
  opacity: 0.9;
}

.menu-toggle:hover::before,
.menu-toggle:hover::after,
.menu-toggle:hover .hamburger-line {
  box-shadow: 0 0 12px rgba(0, 255, 255, 1);
}

.menu-toggle:active {
  transform: scale(1.05);
}

/* Animated X when menu open */
.menu-toggle.active::before {
  transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active .hamburger-line {
  opacity: 0;
  transform: scale(0);
}

.menu-toggle.active::after {
  transform: translateY(-9px) rotate(-45deg);
}

/* ===================================
   SIDE MENU PANEL
   =================================== */

.menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--color-menu-bg);
    color: var(--color-text-light);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.5);
    z-index: 10001;
    transform: translateX(-100%);
    transition: transform var(--transition-medium);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* Hide scrollbars (cross-browser) */
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE 10+ */
}

.menu-panel::-webkit-scrollbar {
    display: none;                /* Chrome, Safari, Edge */
}

.menu-panel[data-open="true"] {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: var(--color-menu-bg);
  z-index: 10;
}

.menu-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.btn-icon {
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  transition: background var(--transition-fast);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-content {
  padding: var(--spacing-md);
}

.menu-section {
  margin-bottom: var(--spacing-lg);
}

.menu-section h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  margin-bottom: var(--spacing-sm);
}

/* ===================================
   BUTTONS
   =================================== */

.btn {
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text);
}

.btn-primary:hover {
  background: var(--color-primary-light);
}

.btn-primary:active {
  background: var(--color-primary-dark);
  transform: translateY(1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.05);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.125rem;
}

.btn-full {
  width: 100%;
  margin-bottom: var(--spacing-sm);
}

/* Difficulty Buttons */
.difficulty-buttons {
  display: grid;
  gap: var(--spacing-sm);
}

.difficulty-buttons .btn {
  text-align: left;
  padding: 12px;
}

.difficulty-buttons .btn small {
  display: block;
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 2px;
}

/* WTF Mode Button - Synth Purple */
.wtf-btn {
  background: linear-gradient(135deg, #9900ff 0%, #ff00ff 100%);
  color: var(--color-text-light);
  border: none;
  font-weight: 700;
  position: relative;
  overflow: visible;
  box-shadow: 
    0 0 20px rgba(153, 0, 255, 0.8),
    0 0 40px rgba(255, 0, 255, 0.6),
    inset 0 0 20px rgba(255, 0, 255, 0.3);
}

.wtf-btn:hover {
  background: linear-gradient(135deg, #aa00ff 0%, #ff33ff 100%);
  box-shadow: 
    0 0 30px rgba(153, 0, 255, 1),
    0 0 60px rgba(255, 0, 255, 0.8),
    inset 0 0 30px rgba(255, 0, 255, 0.5);
  transform: translateY(-2px);
}

.wtf-warning {
  display: block;
  font-size: 0.65rem;
  margin-top: 2px;
  color: #ffff00;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 255, 0, 1);
}

/* NACKL Theme - Enhanced WTF button */
body[data-theme="nackl"] .wtf-btn {
  box-shadow: 
    0 0 25px rgba(153, 0, 255, 0.9),
    0 0 50px rgba(255, 0, 255, 0.7),
    inset 0 0 25px rgba(255, 0, 255, 0.4);
}

body[data-theme="nackl"] .wtf-btn:hover {
  box-shadow: 
    0 0 35px rgba(153, 0, 255, 1),
    0 0 70px rgba(255, 0, 255, 0.9),
    inset 0 0 35px rgba(255, 0, 255, 0.6);
}

/* Theme Buttons */
.theme-buttons {
  display: grid;
  gap: var(--spacing-sm);
}

.theme-btn {
  text-align: left;
  padding: 12px;
  position: relative;
  transition: all var(--transition-fast);
}

.theme-btn.active {
  background: var(--color-primary);
  color: var(--color-text);
  border-color: var(--color-primary);
}

.theme-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===================================
   FORM ELEMENTS
   =================================== */

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: var(--spacing-xs);
  color: rgba(255, 255, 255, 0.8);
}

.form-group input[type="number"] {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  color: var(--color-text-light);
  font-size: 1rem;
}

.form-group input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(255, 255, 255, 0.15);
}

.toggle-option {
  display: flex;
  align-items: center;
  padding: var(--spacing-sm) 0;
  cursor: pointer;
  font-size: 0.9375rem;
}

.toggle-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: var(--spacing-sm);
  cursor: pointer;
}

.toggle-option:hover {
  opacity: 0.8;
}

/* Shuffle Music Button */
.shuffle-btn {
  width: 100%;
  margin-top: var(--spacing-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  font-size: 0.875rem;
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(0, 255, 255, 0.1);
  border: 1px solid rgba(0, 255, 255, 0.3);
  color: #00ffff;
  font-family: var(--font-main, 'Orbitron', sans-serif);
  transition: all var(--transition-fast), transform 0.3s ease;
}

.shuffle-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  border-color: rgba(0, 255, 255, 0.6);
  box-shadow: 
    0 0 15px rgba(0, 255, 255, 0.4),
    inset 0 0 10px rgba(0, 255, 255, 0.2);
}

.shuffle-btn:active {
  transform: scale(0.98);
  box-shadow: 
    0 0 10px rgba(0, 255, 255, 0.6),
    inset 0 0 15px rgba(0, 255, 255, 0.3);
}

.shuffle-btn svg {
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(0, 255, 255, 0.6));
}

.shuffle-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===================================
   GAME HEADER
   =================================== */

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  min-width: 250px;
}

.counter-display {
  display: flex;
  gap: 2px;
  background: #000;
  padding: 4px 8px;
  border-radius: 2px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
}

.counter-display .digit {
  display: inline-block;
  width: 16px;
  height: 24px;
  background: #000;
  color: #ff0000;
  font-size: 20px;
  text-align: center;
  line-height: 24px;
  text-shadow: 0 0 2px #ff0000;
}

.face-button {
  width: 48px;
  height: 48px;
  background: var(--color-cell-hidden);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
  padding: 4px;
}

.face-button:active {
  transform: scale(0.95);
}

.face-button.pressed {
  background: var(--color-bg-dark);
}

.face-image {
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: transform var(--transition-fast);
}

.face-button:active .face-image {
  transform: scale(0.9);
}

/* NACKL Theme - Glowing face button */
body[data-theme="nackl"] .face-button {
  background: transparent;
  box-shadow: 0 0 15px rgba(255, 165, 0, 0.3);
}

body[data-theme="nackl"] .face-button:hover {
  box-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
}

.face-icon {
  width: 32px;
  height: 32px;
  pointer-events: none;
}

/* ===================================
   GAME BOARD
   =================================== */

.game-board {
  display: grid;
  gap: 1px;
  background: rgba(0, 255, 255, 0.2);
  padding: var(--bevel-size);
  border-radius: var(--border-radius);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(0, 255, 255, 0.2);
  max-width: 100%;
  max-height: calc(100vh - 200px);
  overflow: auto;
}

/* Cell Styling */
.cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  font-family: var(--font-main, 'Orbitron', sans-serif);
  cursor: pointer;
  position: relative;
  background: var(--color-cell-hidden);
  transition: background var(--transition-fast);
  border: 1px solid rgba(0, 255, 255, 0.15);
  padding: 0;
  /* Improve touch handling */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* WTF Mode: Smaller cells and fonts */
body.wtf-mode .cell {
  font-size: 0.7rem;
  font-weight: 600;
}

body.wtf-mode .game-board {
  padding: 2px;
}

body.wtf-mode .bevel-size {
  --bevel-size: 2px;
}

.cell.hidden {
  background: var(--color-cell-hidden);
  border-width: var(--bevel-size);
  border-style: solid;
  border-color: var(--color-border-light) var(--color-border-dark) var(--color-border-dark) var(--color-border-light);
}

.cell.hidden:active {
  border-color: var(--color-border-dark) var(--color-border-light) var(--color-border-light) var(--color-border-dark);
}

.cell.revealed {
  background: var(--color-cell-revealed);
  border: 1px solid var(--color-border-dark);
  cursor: default;
}

.cell.flagged {
  background: var(--color-cell-hidden);
  border-width: var(--bevel-size);
  border-style: solid;
  border-color: var(--color-border-light) var(--color-border-dark) var(--color-border-dark) var(--color-border-light);
}

.cell.question {
  background: var(--color-cell-hidden);
  border-width: var(--bevel-size);
  border-style: solid;
  border-color: var(--color-border-light) var(--color-border-dark) var(--color-border-dark) var(--color-border-light);
}

.cell.mine {
  background: var(--color-cell-mine);
}

.cell.exploded {
  background: #ff0000;
}

.cell.wrong-flag {
  background: var(--color-cell-hidden);
}

/* Cell Content */
.cell.revealed.num-1 { color: var(--color-num-1); }
.cell.revealed.num-2 { color: var(--color-num-2); }
.cell.revealed.num-3 { color: var(--color-num-3); }
.cell.revealed.num-4 { color: var(--color-num-4); }
.cell.revealed.num-5 { color: var(--color-num-5); }
.cell.revealed.num-6 { color: var(--color-num-6); }
.cell.revealed.num-7 { color: var(--color-num-7); }
.cell.revealed.num-8 { color: var(--color-num-8); }

/* NACKL Theme - Glow effects on numbers */
body[data-theme="nackl"] .cell.revealed.num-1 { text-shadow: 0 0 8px var(--color-num-1); }
body[data-theme="nackl"] .cell.revealed.num-2 { text-shadow: 0 0 8px var(--color-num-2); }
body[data-theme="nackl"] .cell.revealed.num-3 { text-shadow: 0 0 8px var(--color-num-3); }
body[data-theme="nackl"] .cell.revealed.num-4 { text-shadow: 0 0 8px var(--color-num-4); }
body[data-theme="nackl"] .cell.revealed.num-5 { text-shadow: 0 0 8px var(--color-num-5); }
body[data-theme="nackl"] .cell.revealed.num-6 { text-shadow: 0 0 8px var(--color-num-6); }
body[data-theme="nackl"] .cell.revealed.num-7 { text-shadow: 0 0 4px var(--color-num-7); }
body[data-theme="nackl"] .cell.revealed.num-8 { text-shadow: 0 0 4px var(--color-num-8); }

/* NACKL Theme - Accent highlights */
body[data-theme="nackl"] .cell.hidden:hover {
  box-shadow: inset 0 0 10px rgba(0, 212, 255, 0.3);
}

body[data-theme="nackl"] .cell.flagged {
  box-shadow: inset 0 0 10px rgba(255, 102, 0, 0.3);
}

/* Cell Icons */
.cell-icon {
  width: 70%;
  height: 70%;
  pointer-events: none;
}

/* ===================================
   OVERLAYS
   =================================== */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-medium);
  padding: var(--spacing-md);
}

.overlay[data-visible="true"] {
  opacity: 1;
  pointer-events: all;
}

.overlay-content {
  background: var(--color-menu-bg);
  color: var(--color-text-light);
  padding: var(--spacing-xl);
  border-radius: var(--border-radius);
  max-width: 500px;
  width: 100%;
  text-align: center;
  transform: scale(0.9);
  transition: transform var(--transition-medium);
}

.overlay[data-visible="true"] .overlay-content {
  transform: scale(1);
}

.overlay-wide {
  max-width: 600px;
}

.overlay-title {
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
  color: var(--color-primary);
}

.overlay-message {
  font-size: 1.125rem;
  margin-bottom: var(--spacing-lg);
  line-height: 1.6;
}

.overlay-buttons {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  flex-wrap: wrap;
}

/* ===================================
   SPLASH SCREEN - Vertical Layout, Mobile-First
   =================================== */

/* Hide hamburger while splash is showing */
#splash-screen[data-visible="true"] ~ #game-container .menu-toggle {
  display: none;
  pointer-events: none;
}

.splash-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.5;
}

/* CRITICAL: Centered, zero padding, content fills screen safely */
.splash-content-new {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
  gap: 6px;
}

/* Logo - compact */
.splash-logo-container {
  position: relative;
  flex-shrink: 0;
  animation: logoFloat 4s ease-in-out infinite;
  width: 65vw;
  max-width: 240px;
}

.splash-logo-animated {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.5));
  animation: logoGlow 3s ease-in-out infinite;
}

.logo-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130%;
  height: 130%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.2) 0%, transparent 70%);
  animation: glowPulse 3s ease-in-out infinite;
  pointer-events: none;
}

/* Subtitle - compact */
.splash-subtitle-new {
  font-family: 'Roboto', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--color-primary);
  text-transform: uppercase;
  opacity: 0.85;
  text-align: center;
  line-height: 1.2;
  flex-shrink: 0;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  animation: subtitlePulse 2s ease-in-out infinite;
}

/* Character Grid - ALWAYS 2×2, fills space, minimal padding */
.character-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: calc(100vw - 100px);
  max-width: 420px;
  margin: 0;
  flex-shrink: 1;
  padding: 0 8px;
}

.character-card {
  position: relative;
  background: rgba(10, 10, 20, 0.85);
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-radius: 12px;
  padding: 8px 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
  min-height: 0;
  aspect-ratio: 0.85;
  animation: cardFadeIn 0.6s ease-out backwards;
}

/* Staggered animation for cards */
.character-card:nth-child(1) { animation-delay: 0.1s; }
.character-card:nth-child(2) { animation-delay: 0.2s; }
.character-card:nth-child(3) { animation-delay: 0.3s; }
.character-card:nth-child(4) { animation-delay: 0.4s; }

.character-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent, rgba(0, 212, 255, 0.12), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.character-card:active {
  transform: scale(0.94);
  border-color: rgba(0, 212, 255, 0.7);
  box-shadow: 0 0 25px rgba(0, 212, 255, 0.4);
}

.character-card:active::before {
  transform: translateX(100%);
}

/* Image container - vertical aspect */
.character-image-container {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  min-height: 0;
}

.character-image {
  max-height: 100%;
  max-width: 85%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 3px 10px rgba(0, 212, 255, 0.6));
  animation: characterFloat 3s ease-in-out infinite;
}

.character-card:active .character-image {
  transform: scale(1.1) rotate(5deg);
  filter: drop-shadow(0 5px 15px rgba(0, 212, 255, 0.9));
}

.character-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  border-radius: 50%;
  opacity: 0.4;
  animation: characterGlow 3s ease-in-out infinite;
  pointer-events: none;
}

.beginner-glow {
  background: radial-gradient(circle, rgba(255, 102, 136, 0.6) 0%, transparent 70%);
}

.intermediate-glow {
  background: radial-gradient(circle, rgba(0, 255, 136, 0.6) 0%, transparent 70%);
}

.expert-glow {
  background: radial-gradient(circle, rgba(0, 255, 255, 0.6) 0%, transparent 70%);
}

.wtf-glow {
  background: radial-gradient(circle, rgba(255, 100, 0, 0.7) 0%, transparent 70%);
  animation: wtfGlowPulse 1.5s ease-in-out infinite;
}

/* Character Name - bold, animated */
.character-name {
  font-family: 'Roboto', sans-serif;
  font-size: 10.5px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 2px;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.6);
  flex-shrink: 0;
}

/* Stats - compact */
.character-stats {
  font-family: 'Open Sans', sans-serif;
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0;
  line-height: 1.2;
  flex-shrink: 0;
}

.character-warning {
  font-family: 'Roboto', sans-serif;
  font-size: 7.5px;
  font-weight: 700;
  text-align: center;
  color: #ffaa00;
  margin-top: 2px;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.8);
  line-height: 1.1;
  animation: warningPulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.character-hover-effect {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(0, 212, 255, 0.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  border-radius: 12px;
}

.character-card:active .character-hover-effect {
  opacity: 1;
}

/* WTF Card - orange theme with extra effects */
.wtf-card {
  border-color: rgba(255, 102, 0, 0.4);
  animation: wtfCardPulse 2s ease-in-out infinite;
}

.wtf-card:active {
  border-color: rgba(255, 102, 0, 0.9);
  box-shadow: 0 0 30px rgba(255, 102, 0, 0.6);
}

.wtf-card .character-name {
  color: #ff6600;
  text-shadow: 0 0 10px rgba(255, 102, 0, 0.8);
}

.lightning-effect {
  display: none;
}

/* Music Notice - at bottom */
.splash-music-notice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Open Sans', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: rgba(0, 255, 255, 0.8);
  background: rgba(0, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 14px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  box-shadow: 
    0 0 15px rgba(0, 255, 255, 0.3),
    inset 0 0 10px rgba(0, 255, 255, 0.1);
  animation: musicNoticePulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
  margin-top: 8px;
}

.music-icon {
  color: #00ffff;
  filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.9));
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  animation: musicIconBounce 2s ease-in-out infinite;
}

/* ════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════ */

@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.5)); }
  50% { filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.8)); }
}

@keyframes subtitlePulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes characterFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

@keyframes warningPulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes wtfCardPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255, 102, 0, 0.3); }
  50% { box-shadow: 0 0 25px rgba(255, 102, 0, 0.5); }
}

@keyframes wtfGlowPulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.2); }
}

@keyframes musicNoticePulse {
  0%, 100% {
    box-shadow: 
      0 0 15px rgba(0, 255, 255, 0.3),
      inset 0 0 10px rgba(0, 255, 255, 0.1);
  }
  50% {
    box-shadow: 
      0 0 25px rgba(0, 255, 255, 0.5),
      inset 0 0 15px rgba(0, 255, 255, 0.2);
  }
}

@keyframes musicIconBounce {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-3px); }
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.2; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.3; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes characterGlow {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.15); }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE - ALWAYS 2×2 GRID
   ════════════════════════════════════════════════════════ */

/* Small phones (≤600px height) */
@media (max-height: 600px) {
  .splash-logo-container {
    width: 55vw;
    max-width: 200px;
  }

  .splash-subtitle-new {
    font-size: 8px;
  }

  .character-grid {
    gap: 5px;
    width: calc(100vw - 12px);
  }

  .character-card {
    padding: 6px 5px;
  }

  .character-name {
    font-size: 9.5px;
  }

  .character-stats {
    font-size: 8px;
  }

  .character-warning {
    font-size: 7px;
  }

  .splash-music-notice {
    font-size: 8px;
    padding: 4px 8px;
  }
}

/* Tablet & larger phones (480px+) */
@media (min-width: 480px) {
  .splash-content-new {
    gap: 8px;
  }

  .splash-logo-container {
    max-width: 280px;
  }

  .splash-subtitle-new {
    font-size: 10px;
    letter-spacing: 0.16em;
  }

  .character-grid {
    gap: 8px;
    max-width: 460px;
  }

  .character-card {
    padding: 10px 8px;
    border-radius: 14px;
  }

  .character-name {
    font-size: 11.5px;
    margin-bottom: 3px;
  }

  .character-stats {
    font-size: 10px;
  }

  .character-warning {
    font-size: 8.5px;
  }

  .splash-music-notice {
    font-size: 10px;
    padding: 6px 12px;
  }

  .music-icon {
    width: 14px;
    height: 14px;
  }
}

/* Landscape mode - still 2×2 but more compact */
@media (max-height: 500px) and (orientation: landscape) {
  .splash-content-new {
    gap: 4px;
  }

  .splash-logo-container {
    width: 45vw;
    max-width: 160px;
  }

  .splash-subtitle-new {
    font-size: 7.5px;
  }

  .character-grid {
    gap: 4px;
    width: calc(100vw - 12px);
  }

  .character-card {
    padding: 5px 4px;
    aspect-ratio: 0.9;
  }

  .character-name {
    font-size: 9px;
  }

  .character-stats {
    font-size: 7.5px;
  }

  .character-warning {
    font-size: 6.5px;
  }

  .splash-music-notice {
    font-size: 8px;
    padding: 3px 8px;
  }
}

/* Desktop (768px+) - STILL 2×2 for consistency */
@media (min-width: 768px) {
  .splash-content-new {
    gap: 12px;
  }

  .splash-logo-container {
    max-width: 340px;
  }

  .splash-subtitle-new {
    font-size: 11px;
    letter-spacing: 0.2em;
  }

  .character-grid {
    gap: 12px;
    max-width: 500px;
  }

  .character-card {
    padding: 14px 10px;
    border-width: 2.5px;
  }

  .character-name {
    font-size: 13px;
    margin-bottom: 4px;
  }

  .character-stats {
    font-size: 11px;
  }

  .character-warning {
    font-size: 9.5px;
  }

  .splash-music-notice {
    font-size: 11px;
    padding: 7px 14px;
  }

  .music-icon {
    width: 15px;
    height: 15px;
  }
}

/* Large desktop (1200px+) - STILL 2×2 */
@media (min-width: 1200px) {
  .splash-logo-container {
    max-width: 380px;
  }

  .splash-subtitle-new {
    font-size: 12px;
  }

  .character-grid {
    gap: 16px;
    max-width: 460px;
  }

  .character-card {
    padding: 16px 12px;
  }

  .character-name {
    font-size: 14px;
  }

  .character-stats {
    font-size: 12px;
  }
}


/* ===================================
   CHARACTER IDLE ANIMATIONS
   =================================== */

@keyframes char-bounce {
  0%, 100% { transform: translateY(0); }
  40%       { transform: translateY(-8px); }
  60%       { transform: translateY(-4px); }
}

@keyframes char-sway {
  0%, 100% { transform: rotate(-3deg) scale(1); }
  50%       { transform: rotate(3deg) scale(1.05); }
}

@keyframes char-pulse {
  0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 8px rgba(0,255,255,0.3)); }
  50%       { transform: scale(1.08); filter: drop-shadow(0 0 16px rgba(0,255,255,0.7)); }
}

@keyframes char-shake {
  0%,100% { transform: translateX(0) rotate(0deg); }
  20%      { transform: translateX(-3px) rotate(-2deg); }
  40%      { transform: translateX(3px) rotate(2deg); }
  60%      { transform: translateX(-2px) rotate(-1deg); }
  80%      { transform: translateX(2px) rotate(1deg); }
}

.char-anim-bounce {
  animation: char-bounce 2.2s ease-in-out infinite;
  transform-origin: bottom center;
}

.char-anim-sway {
  animation: char-sway 3s ease-in-out infinite;
  transform-origin: bottom center;
}

.char-anim-pulse {
  animation: char-pulse 2.5s ease-in-out infinite;
  transform-origin: center;
}

.char-anim-shake {
  animation: char-shake 1.8s ease-in-out infinite;
  transform-origin: center;
}

/* Pause animations on hover so card hover scale feels clean */
.character-card:hover .char-anim-bounce,
.character-card:hover .char-anim-sway,
.character-card:hover .char-anim-pulse,
.character-card:hover .char-anim-shake {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .char-anim-bounce, .char-anim-sway, .char-anim-pulse, .char-anim-shake {
    animation: none;
  }
}

/* ===================================
   CHARACTER TOOLTIPS
   =================================== */

.char-tooltip {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  background: rgba(5, 5, 15, 0.97);
  border: 1px solid var(--tooltip-color, #00ffff);
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 220px;
  min-width: 160px;
  box-shadow:
    0 0 18px color-mix(in srgb, var(--tooltip-color, #00ffff) 40%, transparent),
    0 4px 20px rgba(0,0,0,0.6);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.char-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.char-tooltip.tooltip-warning {
  border-color: #ff6600;
  box-shadow:
    0 0 18px rgba(255, 102, 0, 0.5),
    0 4px 20px rgba(0,0,0,0.6);
}

.char-tooltip-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--tooltip-color, #00ffff);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.char-tooltip-desc {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.82);
  line-height: 1.5;
  white-space: pre-line;
}

/* ===================================
   MENU DIFFICULTY CARDS (vertical)
   =================================== */

.menu-difficulty-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-diff-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(0, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.22s ease;
  overflow: hidden;
  text-align: left;
  width: 100%;
  color: var(--color-text-light);
}

.menu-diff-card:hover {
  background: rgba(0, 255, 255, 0.08);
  border-color: rgba(0, 255, 255, 0.45);
  transform: translateX(4px);
  box-shadow: 0 0 14px rgba(0, 255, 255, 0.15);
}

.menu-diff-card:active {
  transform: translateX(2px) scale(0.99);
}

.menu-diff-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.3));
  transition: transform 0.22s ease;
}

.menu-diff-card:hover .menu-diff-img {
  transform: scale(1.12);
}

.menu-diff-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.menu-diff-name {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  text-transform: uppercase;
}

.menu-diff-stats {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
}

.menu-diff-warning {
  font-size: 0.65rem;
  color: #ffaa00;
  font-weight: 600;
  margin-top: 1px;
}

/* WTF card - orange accent */
.menu-diff-card--wtf {
  border-color: rgba(255, 102, 0, 0.25);
}

.menu-diff-card--wtf:hover {
  background: rgba(255, 102, 0, 0.08);
  border-color: rgba(255, 102, 0, 0.55);
  box-shadow: 0 0 14px rgba(255, 102, 0, 0.2);
}

.menu-diff-name--wtf {
  color: #ff6600 !important;
}

.menu-diff-card--wtf .menu-diff-img {
  filter: drop-shadow(0 0 6px rgba(255, 102, 0, 0.4));
}

/* Custom card - no image, icon instead */
.menu-diff-card--custom {
  border-style: dashed;
  border-color: rgba(255,255,255,0.2);
}

.menu-diff-card--custom:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.05);
  box-shadow: none;
}

.menu-diff-custom-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0.6;
  flex-shrink: 0;
}

.menu-diff-card--active {
  background: rgba(0, 255, 255, 0.1) !important;
  border-color: rgba(0, 255, 255, 0.6) !important;
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.2) !important;
}

.menu-diff-card--active .menu-diff-glow { opacity: 1 !important; }

.menu-diff-card--wtf.menu-diff-card--active {
  background: rgba(255, 102, 0, 0.1) !important;
  border-color: rgba(255, 102, 0, 0.6) !important;
  box-shadow: 0 0 16px rgba(255, 102, 0, 0.2) !important;
}

/* Glow accent bar on left edge */
.menu-diff-glow {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 8px 0 0 8px;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.menu-diff-card:hover .menu-diff-glow { opacity: 1; }

.menu-glow-beginner    { background: #ff6688; box-shadow: 0 0 8px #ff6688; }
.menu-glow-intermediate{ background: #00ff88; box-shadow: 0 0 8px #00ff88; }
.menu-glow-expert      { background: #00ffff; box-shadow: 0 0 8px #00ffff; }
.menu-glow-wtf         { background: #ff6600; box-shadow: 0 0 8px #ff6600; }

.leaderboard-tabs {
  display: flex;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-md);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.tab-button {
  flex: 1;
  padding: var(--spacing-sm);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}

.tab-button:hover {
  color: rgba(255, 255, 255, 0.8);
}

.tab-button.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* WTF tab gets its own electric-yellow accent */
.tab-button.tab-wtf {
  color: rgba(255, 220, 0, 0.6);
}
.tab-button.tab-wtf:hover {
  color: rgba(255, 220, 0, 0.9);
}
.tab-button.tab-wtf.active {
  color: #ffdc00;
  border-bottom-color: #ffdc00;
  text-shadow: 0 0 8px #ffdc00;
}

.leaderboard-content {
  min-height: 300px;
  max-height: 60vh;
  overflow-y: auto;
  text-align: left;
  padding: var(--spacing-sm);
}

.leaderboard-count {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-primary);
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  background: rgba(0, 212, 170, 0.1);
  border-radius: var(--border-radius);
  font-weight: 600;
}

.leaderboard-list {
  list-style: none;
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background var(--transition-fast);
}

.leaderboard-entry:hover {
  background: rgba(255, 255, 255, 0.05);
}

.leaderboard-entry.rank-1 {
  background: rgba(255, 215, 0, 0.15);
  border-left: 3px solid #ffd700;
}

.leaderboard-entry.rank-2 {
  background: rgba(192, 192, 192, 0.15);
  border-left: 3px solid #c0c0c0;
}

.leaderboard-entry.rank-3 {
  background: rgba(205, 127, 50, 0.15);
  border-left: 3px solid #cd7f32;
}

.leaderboard-entry:nth-child(1) .entry-rank { color: #ffd700; font-weight: bold; }
.leaderboard-entry:nth-child(2) .entry-rank { color: #c0c0c0; font-weight: bold; }
.leaderboard-entry:nth-child(3) .entry-rank { color: #cd7f32; font-weight: bold; }

.entry-rank {
  font-weight: bold;
  margin-right: var(--spacing-sm);
  min-width: 40px;
  text-align: right;
}

.entry-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: var(--spacing-sm);
}

.entry-time {
  color: var(--color-primary);
  font-weight: bold;
  min-width: 50px;
  text-align: right;
}

.entry-date {
  font-size: 0.7rem;
  opacity: 0.6;
  margin-left: var(--spacing-sm);
  min-width: 90px;
  text-align: right;
}

.leaderboard-empty {
  text-align: center;
  padding: var(--spacing-xl);
  opacity: 0.6;
}

/* Custom scrollbar for leaderboard */
.leaderboard-content::-webkit-scrollbar {
  width: 8px;
}

.leaderboard-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.leaderboard-content::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 4px;
}

.leaderboard-content::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-light);
}

/* Firefox scrollbar */
.leaderboard-content {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) rgba(255, 255, 255, 0.05);
}

/* ===================================
   CREDITS
   =================================== */

.credits-text {
  text-align: center;
  line-height: 1.8;
}

.credits-text p {
  margin-bottom: var(--spacing-sm);
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   =================================== */

@media (max-width: 768px) {
  .game-header {
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    min-width: 200px;
  }
  
  .counter-display .digit {
    width: 14px;
    height: 20px;
    font-size: 16px;
    line-height: 20px;
  }
  
  .face-button {
    width: 40px;
    height: 40px;
  }
  
  .face-icon {
    width: 28px;
    height: 28px;
  }
  
  .cell {
    font-size: 0.875rem;
  }
  
  .overlay-title {
    font-size: 1.5rem;
  }
  
  .splash-logo {
    max-width: 85%;
  }
  
  .splash-title {
    font-size: 1.75rem;
  }
}

@media (max-width: 480px) {
  .menu-toggle {
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    width: 40px;
    height: 40px;
  }
  
  .game-header {
    min-width: 180px;
  }
  
  .counter-display .digit {
    width: 12px;
    height: 18px;
    font-size: 14px;
    line-height: 18px;
  }
  
  .face-button {
    width: 36px;
    height: 36px;
  }
  
  .face-icon {
    width: 24px;
    height: 24px;
  }
  
  .cell {
    font-size: 0.75rem;
  }
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
  .menu-toggle,
  .menu-panel,
  .overlay {
    display: none !important;
  }
}

/* Splash overlay - zero padding override */
.splash-overlay.overlay {
  padding: 0;
  align-items: center;
  justify-content: center;
}

<style>
/* critical layout only */
body { margin:0; background:#000; color:#fff; }
#game-container { min-height:100vh; }

/* ---- Preloader (critical, blocks loading flash) ---- */
html.is-booting body { overflow: hidden; }

#preloader {
  position: fixed;
  inset: 0;
  z-index: 2147483647; /* top of everything */
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity .28s ease, visibility .28s ease;
}

#preloader .pre-card{
  width: min(460px, 90vw);
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(18,18,18,.75);
  box-shadow: 0 14px 60px rgba(0,0,0,.65);
  text-align: center;
}

#preloader .pre-logo{
  width: 92px;
  height: 92px;
  object-fit: contain;
  display:block;
  margin: 0 auto 12px;
  filter: drop-shadow(0 0 14px rgba(0,212,170,.22));
  opacity: .95;
}

#preloader .pre-text{
  margin-top: 10px;
  font: 600 13px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  letter-spacing: .3px;
  opacity: .86;
}

#preloader .pre-bar{
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}

#preloader .pre-bar > span{
  display:block;
  height: 100%;
  width: 34%;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  animation: preSlide 1.05s ease-in-out infinite;
}

@keyframes preSlide{
  0%   { transform: translateX(-130%); }
  55%  { transform: translateX(170%); }
  100% { transform: translateX(420%); }
}

html.is-ready #preloader{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
</style>
