@media (max-width: 600px) {
  body {
    padding-top: 2px !important;
    margin-top: 0 !important;
  }
  .pixel-title-box {
    margin-bottom: 0 !important;
    margin-top: 2px !important; /* Increased for clear visibility */
    position: relative !important;
    z-index: 1 !important;
  }
  
  .pixel-title-text,
  h1.fade-in {
    line-height: 1 !important;
    margin-bottom: -2px !important; /* Negative margin to reduce spacing */
    margin-top: -8px !important;
    padding: 8px !important;
  }
  .tagline.fade-in {
    margin-top: -5px !important; /* Negative margin to pull up toward title */
    margin-bottom: 5px !important; /* Add spacing between tagline and next track text */
    line-height: 1 !important;
    padding: 0 !important;
    font-size: 0.85rem !important; /* Changed from 1rem to 0.75rem */
  }  #next-track-time.fade-in {
    margin-top: 0 !important;
    margin-bottom: 3px !important; /* Ensure spacing before game container */
    line-height: 1 !important;
    padding: 3px !important;
    font-size: 0.75rem !important; /* Changed from 1rem to 0.75rem */
  }
  
  /* Remove .game-container overrides and instead target .game-ui, .game-screen, and #gameCanvas for spacing reduction */
  .game-ui {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }  .game-screen {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  .gameCanvas {
    margin-top: 0 !important;
    padding-top: 0 !important;
    display: block;
  }
}

/* Pixel title box for HOTLAP DAILY */
.pixel-title-box {
  border: none !important;
  display: inline-block !important;
  padding: 0 !important;
  background: transparent !important;
  margin-bottom: 4px !important;
  margin-top: 10px !important; /* Ensures desktop spacing is always visible */
}
.pixel-title-text {
  font-family: "Tiny5", sans-serif !important;
  font-weight: 400 !important;
  font-style: normal;
  color: #111;
  letter-spacing: 4px;
  background: transparent; /* Changed from white to transparent to match parent */
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  font-size: 32px;
  line-height: 1.1;
}

.pixel-title-text strong {
  font-family: "Tiny5", sans-serif !important;
  font-weight: 400 !important;
}


@media (max-width: 768px) {
  footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100vw;
    background: rgba(255,255,255,0.97);
    z-index: 100;
    margin-top: 0;
    padding: 10px 0 8px 0;
    font-size: 0.85em;
    box-shadow: 0 -2px 8px #0001;
  }
  .game-container {
    margin-bottom: 48px; /* Add space for footer */
  }
}
html, body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

.game-container {
  flex: 1;
}

footer {
  text-align: center;
  margin-top: 32px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95em;
  color: #aaa;
}
footer a {
  color: #aaa;
  text-decoration: underline;
  margin-right: 18px;
}
footer a:last-child {
  margin-right: 0;
}
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F8F8;
  --text-primary: #000000;
  --text-secondary: #333333;
  --accent: #000000;
  --accent-hover: #333333;
  --border: #000000;
  --surface: #F1F1F1;
  --mercedes-color: #C0C0C0;
  --williams-color: #0C2340;
  --highlight-blue: #0066FF;
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'IBM Plex Mono', monospace;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Allow text selection in input fields */
input, select, textarea {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Typography */
h1, .tagline, .leaderboard-title, .best-lap, .previous-lap, #lap-timer, 
.key, .action, #shareButton, .share-icon, .pixel-button {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html, body {
  background-color: var(--bg-primary);
  height: 100%;
  overflow: hidden; /* Prevent overall scrolling */
}

body {
  margin: 0;
  padding: 0;
  font-family: 'IBM Plex Mono', monospace;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  overflow: hidden; /* Prevent body scrolling */
}

@media (max-width: 768px) {
  body {
    overflow: hidden; /* Prevent scrolling */
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
}

/* Layout */
.game-container {
  width: 50%;
  height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  margin: 1rem auto; /* Reduced from 2rem to 1rem (50% reduction) */
  padding: 1rem;
  box-sizing: border-box;
  gap: 1rem;
}

@media (max-width: 768px) {
  .game-container {
    width: 100%; /* Full width */
    height: 100vh;  /* Full viewport height */
    margin: 0;
    padding: 0.5rem 0.5rem 0; /* Remove bottom padding */
    display: flex;
    flex-direction: column;
  }
}

.game-ui {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  padding: 0.5rem;
  border-radius: 0;
  width: 100%;
  flex: 1;
  min-height: 0;
  max-height: 75vh;  /* Increased to match other elements */
  box-shadow: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

@media (max-width: 768px) {
  .game-ui {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: none;
    background: transparent;
    overflow: hidden;
  }

  /* Adjust the order of elements for mobile */
  .controls-panel {
    order: 2; /* Display after game screen */
    position: relative;
    bottom: auto; 
    left: 0;
    right: 0;
    width: 100%;
    margin: 0 auto;
    height: auto;
    max-height: 35vh;
    padding: 0.5rem;
    overflow-y: auto;
    z-index: 10;
  }

  .game-screen {
    order: 1; /* Display before controls panel */
    flex: 1;
    min-height: 0;
    height: 55vh;
    margin-bottom: 0.5rem;
  }
}

/* Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  padding: 0.5rem 0 0;
  margin-bottom: 0.15rem;
  line-height: 1;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  h1 {
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    padding: 0.5rem 0;
    z-index: 2;
    font-size: 1.5rem;
    flex-shrink: 0;
  }
}

h1 strong {
  display: inline-block;
  border: none;
  font-weight: 700;
}

.tagline {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
  font-weight: 400;
  text-align: center;
  letter-spacing: -0.01em;
  padding: 0 0.25rem;
}

@media (max-width: 768px) {
  .tagline {
    position: sticky;
    top: 2.5rem;
    background: var(--bg-primary);
    padding-bottom: 0.5rem;
    z-index: 2;
    font-size: 0.7rem;
    flex-shrink: 0;
  }
}

/* Game screen */
.game-screen {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #FFFFFF;  /* Changed from var(--bg-secondary) to pure white */
  box-shadow: none;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0.25rem;
  max-height: 75vh;
}

.game-screen:hover {
  transform: translate(-2px, -2px);
  box-shadow: none;
}

@media (max-width: 768px) {
  .game-screen {
    flex: 1;
    min-height: 0; /* Allow it to shrink if needed */
    height: 55vh; /* Fixed height instead of calc */
    margin-bottom: 0.5rem; /* Space before control panel */
  }
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

@media (max-width: 768px) {
  #gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

/* Stats and UI elements */
.stats {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
}

@media (max-width: 768px) {
  .stats {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: auto;
    left: auto;
    z-index: 15;
    width: auto;
    max-width: none;
  }
}

#lap-timer {
  padding: 0.6rem 1rem;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  box-shadow: none;
  text-align: center;
  width: 100%;
}

#next-track-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 400;
  text-align: center;
  letter-spacing: -0.01em;
  padding: 0 0.25rem;
}

@media (max-width: 768px) {
  #lap-timer {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid var(--border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    min-width: 100px;
    text-align: center;
    display: block !important; /* Ensure it's always displayed */
    opacity: 1 !important; /* Ensure it's visible */
  }

  #next-track-time {
    position: sticky;
    top: 4rem;
    background: var(--bg-primary);
    padding-bottom: 0.5rem;
    z-index: 2;
    font-size: 0.65rem;
    flex-shrink: 0;
  }
}

#leaderboard {
  margin-top: auto;
  padding: 0.8rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: none;
  width: 100%;
}

@media (max-width: 768px) {
  #leaderboard {
    margin: 0;
    padding: 0.35rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
  }
}

.best-lap {
  color: var(--highlight-blue);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  padding-bottom: 0;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .best-lap {
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
    padding-bottom: 0.15rem;
  }
}

.previous-lap {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 0.3rem;
  padding-top: 0;
}

.leaderboard-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#lap-times {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-family: 'IBM Plex Mono', monospace;
}

/* In-game leaderboard */
.in-game-leaderboard {
  position: absolute;
  top: 10px;
  left: 10px;
  display: none; /* Hidden by default */
  flex-direction: column;
  gap: 0.25rem;
  z-index: 100;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  color: var(--text-primary);
  min-width: 120px;
  box-shadow: none;
}

.in-game-leaderboard.visible {
  display: flex; /* Show when this class is added */
}

@media (max-width: 768px) {
  .in-game-leaderboard {
    padding: 0.175rem 0.25rem;
    font-size: 0.85rem !important; /* Updated to match lap timer (0.85rem) */
    min-width: 100px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  }
  
  .in-game-best-lap {
    font-size: 0.85rem !important; /* Updated to match lap timer (0.85rem) */
  }
  
  .in-game-previous-lap {
    font-size: 0.8rem !important; /* Slightly smaller than best lap but still close to lap timer */
  }
}

#in-game-lap-times {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: 'IBM Plex Mono', monospace;
}

.in-game-best-lap {
  color: var(--highlight-blue);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.2rem;
  padding-bottom: 0;
}

.in-game-previous-lap {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  padding-bottom: 0;
}

.in-game-sparkline {
    font-family: monospace;
    letter-spacing: 0.1em;
    font-size: 1rem;
    line-height: 1;
    color: #A9A9A9;  /* Default gray color for all laps */
    margin: 0;
    white-space: pre;
    opacity: 1;
}

.in-game-sparkline .best-lap {
    color: purple;  /* Purple color for the best lap */
}

@media (max-width: 768px) {
    .in-game-sparkline {
        font-size: 0.85rem;
        margin: 0.05rem 0 0.15rem 0;
    }
}

/* Form elements */
select,
input {
  width: 100%;
  padding: 0.4rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-radius: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  transition: all 0.1s ease;
  margin-bottom: 0.15rem;
  min-width: 0;
  -webkit-touch-callout: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

select:hover,
input:hover {
  background-color: var(--bg-primary);
  transform: translate(-2px, -2px);
  box-shadow: none;
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: none;
}

@media (max-width: 768px) {
  select,
  input,
  .pixel-button {
    padding: 0.35rem;
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
  }
}

label {
  display: block;
  margin-bottom: 0.05rem;
  color: var(--text-primary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Buttons */
.pixel-button {
  width: 100%;
  padding: 0.4rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0.07rem 0; /* Further reduced from 0.1rem by 30% */
}

.pixel-button:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  transform: translate(-2px, -2px);
  box-shadow: none;
}

.pixel-button:active {
  transform: translate(0, 0);
  box-shadow: none;
}

.pixel-button.glow {
  animation: glowingButton 2s infinite;
  background: var(--bg-primary);
  border-color: var(--accent);
  color: var(--accent);
}

/* Blue glow for normal start state */
#startButton {
    color: var(--highlight-blue);
    border-color: var(--highlight-blue);
    animation: blueGlowingButton 2s infinite;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: var(--bg-primary);
    transition: all 0.1s ease;
    margin-bottom: 0.07rem; /* Further reduced from 0.1rem by 30% */
}

#startButton:hover {
    transform: translate(-2px, -2px);
    box-shadow: none;
}

#startButton:active {
    background: var(--highlight-blue);
    color: var(--bg-primary);
    transform: translate(0, 0);
    box-shadow: none;
}

#startButton.crash-glow {
    color: #D10000;  /* Bright, prominent red for text */
    border-color: #FF0000;  /* Keep bright red for border */
    animation: redGlowingButton 2s infinite;
    background: var(--bg-primary);
}

#startButton.crash-glow:hover {
    background: var(--bg-primary);
    color: #D10000;  /* Keep same red on hover */
}

#startButton.crash-glow:active {
    background: #D10000;  /* Use same red for pressed state */
    color: var(--bg-primary);
}

/* Updated glowing animations */
@keyframes blueGlowingButton {
  0% {
    box-shadow: 0 0 3px var(--highlight-blue),
                0 0 5px var(--highlight-blue);
    border-color: var(--highlight-blue);
  }
  50% {
    box-shadow: 0 0 6px var(--highlight-blue),
                0 0 10px var(--highlight-blue);
    border-color: var(--highlight-blue);
  }
  100% {
    box-shadow: 0 0 3px var(--highlight-blue),
                0 0 5px var(--highlight-blue);
    border-color: var(--highlight-blue);
  }
}

@keyframes greenGlowingButton {
  0% {
    box-shadow: 0 0 3px #32CD32,
                0 0 5px #32CD32;
    border-color: #32CD32;
  }
  50% {
    box-shadow: 0 0 6px #32CD32,
                0 0 10px #32CD32;
    border-color: #32CD32;
  }
  100% {
    box-shadow: 0 0 3px #32CD32,
                0 0 5px #32CD32;
    border-color: #32CD32;
  }
}

@keyframes redGlowingButton {
    0% {
        box-shadow: 0 0 4px #FF0000,
                    0 0 8px #FF0000;
        border-color: #FF0000;
    }
    50% {
        box-shadow: 0 0 8px #FF0000,
                    0 0 16px #FF0000;
        border-color: #FF0000;
    }
    100% {
        box-shadow: 0 0 4px #FF0000,
                    0 0 8px #FF0000;
        border-color: #FF0000;
    }
}

/* Share button styles */
#shareButton {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    margin-top: 0.5rem;
}

.control-share-button {
    margin-top: 0.5rem !important; /* Further reduced from 0.7rem by ~30% */
}

#shareButton:hover {
    background-color: var(--bg-secondary);
}

#shareButton.completed-glow {
    color: var(--highlight-blue);
    border-color: var(--highlight-blue);
    animation: blueGlowingButton 2s infinite;
}

#shareButton.completed-glow:hover {
    background: var(--highlight-blue);
    color: var(--bg-primary);
}

@media (max-width: 768px) {
  #shareButton {
    padding: 0.35rem;
  }
}

/* Share card styles */
.share-card {
    position: relative;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    box-shadow: none;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 0;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

@media (max-width: 768px) {
  .share-modal .share-card {
    width: 92%;
    padding: 0.5rem;
    max-height: 90vh;
  }
}

.share-card-preview {
    width: 500px;
    height: 500px;
    max-width: 100%;
    max-height: 100%;
    border: 2px solid var(--border);
    object-fit: contain;
}

@media (max-width: 768px) {
  .share-card-preview {
    width: 100%;
    height: auto;
  }
}

.share-card-buttons {
    display: flex;
    gap: 1rem;
    width: 100%;
    margin-top: 1rem;
}

.share-card-buttons .pixel-button {
    flex: 1;
}

/* Unified Close Button Styles for All Modals with SVG Icon */
.modal-close {
    position: absolute;
    top: -25px;
    right: -25px;
    width: 50px;
    height: 50px;
    background: #FF0000;
    border: 2px solid var(--border);
    color: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
    box-shadow: none;
    z-index: 1001;
    border-radius: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.modal-close:hover {
    transform: translate(-2px, -2px);
    box-shadow: none;
    background: #CC0000;
}

.modal-close:active {
    transform: translate(0, 0);
    box-shadow: none;
    background: #AA0000;
}

/* SVG icon inside close buttons */
.modal-close svg {
    width: 24px;
    height: 24px;
    pointer-events: none;
    /* SVG has its own fill and stroke properties */
}

/* Mobile-specific adjustments for close buttons */
@media (max-width: 768px) {
    .modal-close {
        top: -25px;
        right: -25px;
        width: 50px;
        height: 50px;
    }
    
    .modal-close svg {
        width: 26px;
        height: 26px;
    }
}

/* Share modal styles */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15); /* frosty light overlay */
    opacity: 0;
    visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px); /* Safari/iOS support */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.share-modal.visible {
    opacity: 1;
    visibility: visible;
}

.share-modal.visible .share-card {
    transform: scale(1);
    opacity: 1;
}

/* Controls */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin-top: 0.07rem;
  padding: 0 7.5%; /* Changed from 15% to 7.5% to make buttons 15% closer instead of 30% */
  box-sizing: border-box;
}

.control-item {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: unset;
  cursor: pointer;
  transition: none;
  width: 100%;
  height: 100%;
}

.control-item:first-child {
  justify-content: flex-end; /* Align left button to the right */
  padding-right: 2.5%; /* Reduced from 5% to 2.5% for more balanced spacing */
}

.control-item:last-child {
  justify-content: flex-start; /* Align right button to the left */
  padding-left: 2.5%; /* Reduced from 5% to 2.5% for more balanced spacing */
}

.control-item:active,
.control-item.pressed {
  background: transparent;
  border: none;
  box-shadow: none; /* Removed glow effect */
  transform: translateY(4px); /* Reduced movement from 6px to 4px */
}

.control-item:hover {
  background: transparent;
  border: none;
  box-shadow: none;
}

.control-image {
  width: 100%;
  height: auto; /* Changed from 100% to auto to maintain aspect ratio */
  object-fit: contain;
  max-width: 150px;
  max-height: 120px; /* Reduced from 150px to 120px */
  display: block;
  padding: 0;
  margin: 0 auto; /* Center the image */
  -webkit-touch-callout: none; /* Prevent iOS callout */
  -webkit-user-select: none; /* Prevent selection */
  -webkit-user-drag: none; /* Prevent dragging */
  user-select: none; /* Prevent selection */
  pointer-events: none; /* Prevent pointer events */
}

@media (max-width: 768px) {
  .control-item {
    min-height: unset;
    padding: 0;
  }
  .control-image {
    max-width: 110px;
    max-height: 90px; /* Reduced from 110px to 90px */
    padding: 0;
  }
}

.key {
  display: inline-block;
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--border);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  user-select: none;
  -webkit-user-select: none;
}

.action {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.12rem; /* Further reduced from 0.17rem by 30% */
  padding: 0.4rem;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 0;
  height: 100%;
  padding: 0.35rem;
  max-height: 75vh; /* Updated to match game screen */
  overflow-y: auto;
  box-shadow: none;
}

@media (max-width: 768px) {
  .controls-panel {
    position: relative; /* Change from fixed to relative */
    bottom: auto; 
    left: 0;
    right: 0;
    width: 100%; /* Full width */
    margin: 0 auto;
    height: auto;
    max-height: 35vh; /* Limit height */
    padding: 0.5rem;
    overflow-y: auto;
    z-index: 10;
  }
}

.player-setup {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

@media (max-width: 768px) {
  .player-setup {
    gap: 0.15rem;
  }
}

.track-select {
  margin-bottom: 0.15rem;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes glowingButton {
  0% {
    box-shadow: 0 0 5px var(--accent),
                0 0 10px var(--accent),
                0 0 15px var(--accent);
    border-color: var(--accent);
    color: var(--accent);
  }
  50% {
    box-shadow: 0 0 10px var(--accent),
                0 0 20px var(--accent),
                0 0 25px var(--accent);
    border-color: var(--accent);
    color: var(--accent);
  }
  100% {
    box-shadow: 0 0 5px var(--accent),
                0 0 10px var(--accent),
                0 0 15px var(--accent);
    border-color: var(--accent);
    color: var(--accent);
  }
}

/* Media queries */
@media (max-height: 760px) {
  .game-container {
    height: 100vh;
    padding: 0.25rem 0.15rem;
    gap: 0.15rem;
  }
  
  h1 {
    font-size: 1.8rem;
    padding: 1rem 0 0;
    margin-bottom: 0.05rem;
  }
  
  .tagline {
    font-size: 0.8rem;
    margin-bottom: 0.05rem;
  }
  
  .controls-panel {
    gap: 0.15rem;
  }
  
  .control-item {
    padding: 0.1rem;
  }
  
  select,
  input,
  .pixel-button {
    padding: 0.25rem;
    margin-bottom: 0.1rem;
    font-size: 0.8rem;
  }
  
  .key,
  .action {
    font-size: 0.65rem;
  }
  
  .control-item {
    min-height: 60px;
  }
  
  .control-image {
    max-width: 60px;
    max-height: 60px;
  }
}

/* Even smaller screens */
@media (max-height: 600px) {
  .game-container {
    padding: 0.15rem 0.1rem;
    gap: 0.1rem;
  }
  
  h1 {
    font-size: 1.5rem;
    padding: 0.5rem 0 0;
  }
  
  .tagline {
    font-size: 0.7rem;
  }
  
  select,
  input,
  .pixel-button {
    font-size: 0.75rem;
    padding: 0.2rem;
  }
  
  .key,
  .action {
    font-size: 0.6rem;
  }
  
  .control-item {
    min-height: 50px;
  }
  
  .control-image {
    max-width: 50px;
    max-height: 50px;
  }
}



.x-emoji-link {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 2rem;
  text-decoration: none;
  z-index: 10;
  transition: transform 0.1s;
}
.x-emoji-link:hover {
  transform: scale(1.15) rotate(-10deg);
  text-shadow: 0 2px 8px #0002;
}
@media (max-width: 768px) {
  .x-emoji-link {
    top: 8px;
    right: 10px;
    font-size: 1.5rem;
  }
}

/* Hamburger Menu Styles */
#hamburger {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  background: none;
  border: none;
  outline: none;
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0;
  transition: left 0.6s ease, top 0.6s ease, background 0.6s ease, border-radius 0.6s ease;
}

#hamburger.panel-open {
  position: fixed;
  top: 12px;
  right: auto;
  left: 188px;
  z-index: 301;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

#hamburger.panel-open .hamburger-bar {
  background: #333;
}

.hamburger-bar {
  width: 28px;
  height: 3px;
  background: #444;
  margin: 3px 0;
  border-radius: 1px;
  transition: all 0.7s cubic-bezier(.4,2,.6,1);
  pointer-events: none;
}

#hamburger.active .hamburger-bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
  transition: all 0.7s cubic-bezier(.4,2,.6,1);
  background: #333;
}

#hamburger.active .hamburger-bar:nth-child(2) {
  opacity: 0;
  transition: all 0.7s cubic-bezier(.4,2,.6,1);
}

#hamburger.active .hamburger-bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
  transition: all 0.7s cubic-bezier(.4,2,.6,1);
  background: #333;
}

#hamburger:focus {
  outline: none;
}

#hamburger:active, #hamburger:focus {
  outline: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  #hamburger {
    transform: none;
    transform-origin: top left;
    width: 32px;
    height: 32px;
    transition: left 0.6s ease, top 0.6s ease, background 0.6s ease, border-radius 0.6s ease;
  }
  
  #hamburger.panel-open {
    top: 10px;
    left: 188px;
    right: auto;
  }
  
  .hamburger-bar {
    width: 22px;
    height: 2.2px;
    margin: 2px 0;
  }
  
  #hamburger.active .hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
    background: #333;
  }
  
  #hamburger.active .hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
    background: #333;
  }
}

/* Violation modal styles - matches share modal design */
.violation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15); /* Same frosty overlay as share modal */
    opacity: 0;
    visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px); /* Safari/iOS support */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.violation-modal.visible {
    opacity: 1;
    visibility: visible;
}

.violation-modal.visible .violation-card {
    transform: scale(1);
    opacity: 1;
}

.violation-card {
    position: relative;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    box-shadow: none;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 0;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    text-align: center;
}

.violation-card h3 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.violation-card p {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

.violation-details {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    padding: 1rem;
    width: 100%;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    text-align: left;
}

.violation-card .pixel-button {
    width: auto;
    min-width: 120px;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .violation-card {
        width: 92%;
        padding: 1rem;
        max-height: 90vh;
    }
}