:root {
    --bg-dark: #05070a;
    --neon-green: #00ff88;
    --neon-red: #ff003c;
    --neon-blue: #00e5ff;
    --glass-bg: rgba(10, 15, 25, 0.7);
    --glass-border: rgba(0, 255, 136, 0.3);
    --text-main: #e0e0e0;
    --text-dim: #8892b0;
    
    --font-ui: 'Inter', sans-serif;
    --font-heading: 'Rajdhani', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: var(--font-ui);
    color: var(--text-main);
    touch-action: none; /* Prevent scroll on mobile */
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #111a22 0%, #000000 100%);
}

/* Canvases */
canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

#floorCanvas { z-index: 1; }
#gameCanvas { z-index: 2; }
#lightCanvas { z-index: 3; mix-blend-mode: multiply; }
#uiCanvas { z-index: 4; pointer-events: none; }

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    transition: opacity 0.5s ease;
    opacity: 0;
    pointer-events: none;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

.hidden {
    display: none !important;
}

/* Glass Panels */
.glass-panel, .menu-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8), inset 0 0 20px rgba(0,255,136,0.05);
    max-width: 500px;
    width: 90%;
    position: relative;
    overflow: hidden;
}

.glass-panel::before, .menu-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-green), transparent);
}

/* Typography */
h1.game-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: #fff;
    text-shadow: 0 0 15px var(--neon-green);
    letter-spacing: 4px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.subtitle {
    color: var(--neon-green);
    font-family: var(--font-ui);
    letter-spacing: 2px;
    font-size: 0.9rem;
    margin-bottom: 40px;
    opacity: 0.8;
}

h2 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 25px;
    letter-spacing: 2px;
}

/* Buttons */
button {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: none;
    border-radius: 6px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, rgba(0,255,136,0.2) 0%, rgba(0,255,136,0.05) 100%);
    color: var(--neon-green);
    border: 1px solid var(--neon-green);
    box-shadow: 0 0 15px rgba(0,255,136,0.2);
}

.btn-primary:hover {
    background: var(--neon-green);
    color: #000;
    box-shadow: 0 0 25px var(--neon-green);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: #fff;
}

.btn-danger {
    background: rgba(255,0,60,0.1);
    color: var(--neon-red);
    border: 1px solid var(--neon-red);
}

.btn-danger:hover {
    background: var(--neon-red);
    color: #fff;
    box-shadow: 0 0 25px var(--neon-red);
}

/* Thumbnail / Logo */
.thumbnail-img {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(0,255,136,0.2);
    border: 2px solid rgba(0,255,136,0.3);
    object-fit: cover;
}

/* In-Game HUD */
#hud {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 50;
    pointer-events: none;
}

.top-bar {
    position: absolute;
    top: 20px; left: 20px; right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

.mission-info {
    background: var(--glass-bg);
    border-left: 3px solid var(--neon-blue);
    padding: 10px 20px;
    border-radius: 0 8px 8px 0;
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
}

.mission-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.objective {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #fff;
    font-weight: 700;
}

.detection-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--glass-bg);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 200px;
}

.detection-text {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: 2px;
    color: var(--neon-green);
}

.detection-bar-container {
    width: 100%;
    height: 8px;
    background: #111;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.detection-bar {
    width: 0%;
    height: 100%;
    background: var(--neon-green);
    transition: width 0.1s linear, background 0.3s ease;
}

.btn-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.5rem;
    display: flex; justify-content: center; align-items: center;
    pointer-events: all;
    backdrop-filter: blur(5px);
    margin-bottom: 0;
}

/* Gadget Panel */
.gadget-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 15px;
    pointer-events: all;
}

.gadget-slot {
    width: 60px; height: 60px;
    background: var(--glass-bg);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    position: relative;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.gadget-slot:hover {
    border-color: var(--neon-green);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,255,136,0.2);
}

.gadget-slot.active {
    border-color: var(--neon-green);
    box-shadow: inset 0 0 15px rgba(0,255,136,0.3);
}

.gadget-icon {
    font-size: 1.8rem;
}

.gadget-count {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--neon-blue);
    color: #000;
    width: 20px; height: 20px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex; justify-content: center; align-items: center;
}

.key-bind {
    position: absolute;
    bottom: -10px;
    font-size: 0.7rem;
    color: var(--text-dim);
    background: #000;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #333;
}

/* Mobile Controls */
.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .mobile-only {
        display: block;
    }
    .key-bind {
        display: none;
    }
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: calc(100% - 40px);
    height: 150px;
    pointer-events: none;
}

#joystick-area {
    position: absolute;
    bottom: 0; left: 0;
    width: 150px; height: 150px;
    pointer-events: all;
}

#joystick-base {
    position: absolute;
    bottom: 20px; left: 20px;
    width: 120px; height: 120px;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

#joystick-stick {
    position: absolute;
    top: 50%; left: 50%;
    width: 50px; height: 50px;
    margin-top: -25px; margin-left: -25px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    pointer-events: none;
}

.action-buttons {
    position: absolute;
    bottom: 20px; right: 280px; /* Right of the gadget panel */
    pointer-events: all;
}

.btn-action {
    width: 80px; height: 80px;
    border-radius: 50%;
    margin: 0;
    font-size: 0.9rem;
}

.sneak-btn {
    background: rgba(0,255,136,0.1);
    color: var(--neon-green);
    border: 2px solid var(--neon-green);
}
.sneak-btn.active {
    background: rgba(0,255,136,0.4);
    box-shadow: 0 0 20px var(--neon-green);
}

/* Guide Screen */
.guide-sections {
    display: flex; flex-direction: column; gap: 15px; margin-bottom: 25px;
}
.guide-card {
    background: rgba(0,0,0,0.5); padding: 15px; border-radius: 8px; border-left: 2px solid var(--neon-blue); text-align: left;
}
.guide-card h3 {
    font-family: var(--font-heading); color: var(--neon-blue); margin-bottom: 5px;
}
.guide-card p {
    font-size: 0.9rem; color: #ccc;
}

/* Audio Toggle */
.sound-toggle-menu {
    display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 20px;
}
.sound-label { font-family: var(--font-heading); letter-spacing: 1px; color: var(--text-dim); }

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333; transition: .4s;
}
.slider:before {
  position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background-color: white; transition: .4s;
}
input:checked + .slider { background-color: var(--neon-green); }
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 20px; }
.slider.round:before { border-radius: 50%; }

.danger-panel { border-color: var(--neon-red); }
.danger-panel::before { background: linear-gradient(90deg, transparent, var(--neon-red), transparent); }
.success-panel { border-color: var(--neon-blue); }
.success-panel::before { background: linear-gradient(90deg, transparent, var(--neon-blue), transparent); }

/* Responsive adjustments */
@media (max-width: 600px) {
    .top-bar { flex-direction: column; align-items: center; gap: 10px; }
    .mission-info { border-radius: 8px; border-left: none; border-bottom: 3px solid var(--neon-blue); text-align: center; }
    .btn-icon { position: absolute; top: 0; right: 0; }
    .action-buttons { right: 180px; bottom: 0px; }
    .btn-action { width: 60px; height: 60px; font-size: 0.8rem; }
}
