:root {
  --primary: #005BC4; /* Ford Blue */
  --accent: #FF9933; /* Saffron */
  --dark: #111111;
  --light: #ffffff;
  --glass: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden; /* Strictly prevent scrolling */
  position: fixed; /* Locks the body in place on mobile */
  font-family: 'Inter', sans-serif;
  background-color: #87CEEB;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark);
  color: var(--light);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loader-content {
  text-align: center;
}

.loader-content h1 {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.progress-bar {
  width: 200px;
  height: 4px;
  background: #333;
  margin: 0 auto;
  border-radius: 2px;
  overflow: hidden;
}

.progress {
  width: 0%;
  height: 100%;
  background: var(--accent);
  animation: load 2s infinite;
}

@keyframes load {
  0% { width: 0%; }
  50% { width: 100%; }
  100% { width: 0%; }
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: hidden; /* Ensure UI doesn't cause scroll */
}

/* Floating Logo */
#floating-logo {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 10px 25px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    color: white;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 1px;
    z-index: 20;
    pointer-events: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    white-space: nowrap; /* Prevent wrapping */
}

/* Mini Map */
#minimap-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 150px;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    overflow: hidden;
    pointer-events: auto;
}

#minimap {
    position: relative;
    width: 100%;
    height: 100%;
}

#minimap-player {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    border: 2px solid white;
}

.map-marker {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    z-index: 1;
}

/* Controls Hint */
.controls-hint {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    color: white;
    text-align: center;
}

.key-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
}

.key {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

/* Content Overlay */
#content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.4);
    pointer-events: auto;
    transition: opacity 0.3s ease;
    z-index: 50; /* Above controls if open */
}

.hidden {
    opacity: 0;
    pointer-events: none !important;
}

.glass-card {
    background: rgba(25, 25, 35, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    color: white;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.hidden .glass-card {
    transform: translateY(20px);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: white;
}

#content-body h2 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 2rem;
}

#content-body p {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.9);
}

/* Mobile Controls */
#mobile-controls {
    display: none; /* Hidden on desktop */
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 100;
    box-sizing: border-box; /* Ensure padding doesn't add to width */
}

.control-group {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.control-group.right {
    align-items: flex-end;
    gap: 20px;
}

.pedals {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-btn {
    width: 65px;
    height: 65px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
    user-select: none;
    outline: none;
    transition: background 0.1s, transform 0.1s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.95);
}

.control-btn.vertical {
    height: 80px;
    border-radius: 25px;
}

.control-btn.nitro {
    width: 55px;
    height: 55px;
    background: rgba(255, 50, 50, 0.4);
    border-color: rgba(255, 50, 50, 0.6);
    font-weight: bold;
    margin-bottom: 10px;
}

.control-btn.nitro:active {
    background: rgba(255, 50, 50, 0.7);
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .controls-hint {
        display: none;
    }
    
    #mobile-controls {
        display: flex;
    }

    #minimap-container {
        width: 90px;
        height: 90px;
        top: 80px;
        right: 15px;
    }
    
    #floating-logo {
        top: 20px;
        font-size: 1rem;
        padding: 8px 20px;
    }
}

/* Landscape Mode Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    #mobile-controls {
        padding-bottom: 10px;
    }
    
    .control-btn {
        width: 55px;
        height: 55px;
    }
    
    .control-btn.vertical {
        height: 70px;
    }
    
    #floating-logo {
        top: 10px;
        font-size: 0.9rem;
        padding: 5px 15px;
    }
    
    #minimap-container {
        width: 80px;
        height: 80px;
        top: 10px;
        right: 10px;
    }
}
