/* ==========================================================================
   AetherDraw Core Styling - Modern Glassmorphic Tech Aesthetic
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #07090e;
    --bg-slate: #0b111e;
    --panel-bg: rgba(13, 20, 38, 0.55);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-glow: rgba(99, 102, 241, 0.15);
    
    /* Text colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents & Status */
    --accent-primary: #6366f1; /* Indigo */
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    /* Font */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Shadow and Blur */
    --glass-blur: 16px;
    --shadow-premium: 0 10px 30px -5px rgba(0, 0, 0, 0.3), 0 0 15px -3px rgba(99, 102, 241, 0.1);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ==========================================================================
   Canvas Grid Background Presets
   ========================================================================== */

#drawingCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: background var(--transition-smooth);
}

/* Preset: Slate Drafting Grid */
.bg-slate-grid {
    background-color: #080c14;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(99, 102, 241, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.015) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
    background-position: center;
}

/* Preset: Green Chalkboard */
.bg-chalkboard {
    background-color: #1a302a;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.04) 15%, transparent 20%),
        radial-gradient(rgba(255, 255, 255, 0.03) 15%, transparent 20%);
    background-size: 8px 8px, 4px 4px;
    background-position: 0 0, 4px 4px;
}

/* Preset: White Math Paper Grid */
.bg-white-paper {
    background-color: #fafbfc;
    background-image: 
        linear-gradient(rgba(0, 100, 250, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 100, 250, 0.06) 1px, transparent 1px);
    background-size: 25px 25px;
    background-position: center;
}

/* Preset: Transparent Glass Overlay */
.bg-transparent-glass {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
}

/* Cursor Canvas */
#cursorCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* ==========================================================================
   Interface & Panels (Glassmorphism)
   ========================================================================== */

#app-interface {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let canvas capture drawing pointer events */
}

#app-interface > * {
    pointer-events: auto; /* Enable controls interaction */
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px -5px rgba(0, 0, 0, 0.4), 0 0 25px -3px rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   Control Panel
   ========================================================================== */

#controls {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 320px;
    padding: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 10; /* Float in front of fullscreen camera */
}

/* Scrollbar for Controls */
#controls::-webkit-scrollbar {
    width: 6px;
}
#controls::-webkit-scrollbar-track {
    background: transparent;
}
#controls::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
#controls::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 16px;
    margin-bottom: 8px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.4));
}

.panel-header h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 40%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Section Headings */
.control-group h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Mode Selector (Brush, Neon, Airbrush, Laser, Eraser) */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.mode-btn {
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 8px 4px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.mode-btn svg {
    transition: var(--transition-smooth);
}

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

.mode-btn.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}

.mode-btn[data-mode="neon"].active {
    color: #fff;
    background: rgba(168, 85, 247, 0.15);
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.1);
}

.mode-btn[data-mode="eraser"].active {
    color: #fff;
    background: rgba(244, 63, 94, 0.15);
    border-color: rgba(244, 63, 94, 0.3);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.1);
}

/* ==========================================================================
   Colors Section
   ========================================================================== */

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.section-title-row h3 {
    margin-bottom: 0;
}

#colorPalette {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.color-btn {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
    background-clip: padding-box;
}

.color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.color-btn.active {
    border-color: var(--text-primary);
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

/* Custom Color Wrapper */
.custom-color-wrapper {
    position: relative;
    width: 26px;
    height: 26px;
}

.custom-color-wrapper input[type="color"] {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.custom-color-wrapper label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.custom-color-wrapper label:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: rotate(45deg);
}

/* ==========================================================================
   Brush Size Slider & Badges
   ========================================================================== */

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.slider-header h3 {
    margin-bottom: 0;
}

.badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
}

.badge-indigo {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.slider-container {
    padding: 4px 0;
}

/* Modern Slider Input Style */
#brushSize {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    transition: background var(--transition-smooth);
}

#brushSize::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    border: 2px solid var(--accent-primary);
    transition: var(--transition-smooth);
}

#brushSize::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--accent-primary);
}

/* ==========================================================================
   Canvas BG Presets Selector
   ========================================================================== */

.bg-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.bg-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
}

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

.bg-btn.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    color: #fff;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.1);
}

/* ==========================================================================
   Action Buttons
   ========================================================================== */

.actions-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn svg {
    transition: var(--transition-smooth);
}

.btn:hover svg {
    transform: translate(0, -1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-primary) 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    color: #fca5a5;
}
.btn-danger:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.3);
    color: #fff;
    transform: translateY(-1px);
}

/* ==========================================================================
   Status Indicators Footer
   ========================================================================== */

#status-panel {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Status Badges */
.badge-status {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.badge-status.no-hand {
    background: rgba(244, 63, 94, 0.1);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-status.hand-detected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
    animation: pulse-glow-green 2s infinite ease-in-out;
}

.badge-status.idle {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-status.drawing {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.25);
    animation: pulse-glow-cyan 1.5s infinite ease-in-out;
}

@keyframes pulse-glow-green {
    0%, 100% { box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
    50% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.35); }
}

@keyframes pulse-glow-cyan {
    0%, 100% { box-shadow: 0 0 0 rgba(6, 182, 212, 0); }
    50% { box-shadow: 0 0 10px rgba(6, 182, 212, 0.35); }
}

/* ==========================================================================
   Video Preview Wrapper
   ========================================================================== */

#video-wrapper {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.video-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    background: var(--accent-rose);
    border-radius: 50%;
    animation: blink 1.5s infinite ease-in-out;
}

#btn-toggle-video {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

#btn-toggle-video:hover {
    color: var(--text-primary);
}

#video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    transition: max-height var(--transition-smooth);
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera stream */
}

#handOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* Mirror skeleton overlay to match webcam */
    pointer-events: none;
}

/* Minimized Video State */
#video-wrapper.minimized #video-container {
    display: none;
}

#video-wrapper.minimized {
    width: 160px;
}

@keyframes blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ==========================================================================
   Instruction Card & Floating Action Button
   ========================================================================== */

#instructions-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10; /* Float in front of fullscreen camera */
}

#btn-close-instructions {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

#btn-close-instructions:hover {
    color: var(--text-primary);
}

.instruction-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.instruction-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instruction-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.step-num {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.instruction-steps p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* Toggle Help FAB */
#btn-help {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: none; /* Only visible when card is hidden */
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10; /* Float in front of fullscreen camera */
}

#btn-help:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* ==========================================================================
   Responsive Styling
   ========================================================================== */

@media (max-width: 820px) {
    #controls {
        position: fixed;
        top: auto;
        bottom: 24px;
        left: 24px;
        width: calc(100% - 48px);
        max-height: 40vh;
        z-index: 100;
    }
    
    #video-wrapper {
        top: 24px;
        right: 24px;
        width: 180px;
    }

    #instructions-card, #btn-help {
        display: none !important; /* Hide help on mobile/small viewports */
    }
}

/* ==========================================================================
   Fullscreen Camera Background Mode
   ========================================================================== */

.video-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-header-actions button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.video-header-actions button:hover {
    color: var(--text-primary);
}

body.camera-bg-active #video-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
    box-shadow: none;
    z-index: 0;
    background: #000;
}

body.camera-bg-active #video-container {
    width: 100vw;
    height: 100vh;
    aspect-ratio: auto;
}

body.camera-bg-active #webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.35; /* Translucent camera stream */
}

body.camera-bg-active #handOverlay {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

body.camera-bg-active .video-header {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 20;
    border-radius: 12px;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--panel-border);
    padding: 10px 14px;
}

/* Camera Error Overlay Message */
.camera-error-msg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.9);
    color: var(--accent-rose);
    padding: 20px;
    text-align: center;
    z-index: 5;
}

.camera-error-msg svg {
    filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.4));
}

.camera-error-msg p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* ==========================================================================
   Smart Shapes Toggle Switch
   ========================================================================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.06);
    transition: .3s;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

/* ==========================================================================
   Diagnostics HUD
   ========================================================================== */
#perf-hud {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 320px;
    padding: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

#perf-hud:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.hud-level-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.level-premium {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.level-high {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.level-medium {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.level-low {
    background: rgba(244, 63, 94, 0.2);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.hud-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 16px;
}

.hud-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hud-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.hud-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ==========================================================================
   Gesture Onboarding Calibration Overlay
   ========================================================================== */
#onboarding-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    padding: 28px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: rgba(9, 13, 24, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 30px -5px rgba(99, 102, 241, 0.25);
    transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

#btn-skip-onboarding {
    position: absolute;
    top: 14px;
    right: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#btn-skip-onboarding:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.onboarding-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.onboarding-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
    animation: bounce 2s infinite ease-in-out;
}

#onboarding-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

#onboarding-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.onboarding-interactive-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    padding: 16px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.onboarding-gesture-visual {
    width: 100px;
    height: 100px;
}

.onboarding-svg {
    width: 100%;
    height: 100%;
}

#onboarding-feedback {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-cyan);
    font-weight: 600;
    min-height: 18px;
}

.onboarding-steps-indicator {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.onboarding-steps-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: var(--transition-smooth);
}

.onboarding-steps-indicator .dot.active {
    background: var(--accent-cyan);
    box-shadow: 0 0 6px var(--accent-cyan);
    width: 14px;
    border-radius: 3px;
}

/* Onboarding animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.hand-icon-g {
    animation: hand-sway 3s infinite ease-in-out;
}

@keyframes hand-sway {
    0%, 100% { transform: translate(15px, 12px) scale(0.7); }
    50% { transform: translate(15px, 6px) scale(0.7); }
}

/* ==========================================================================
   UI Magnetic Snap and Effects
   ========================================================================== */
.magnetic-target {
    transform: scale(1.05) !important;
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.35) !important;
    color: #fff !important;
    background: rgba(6, 182, 212, 0.15) !important;
}

/* Adjust modebtn active for new modes */
.mode-btn[data-mode="airbrush"].active {
    color: #fff;
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.1);
}

.mode-btn[data-mode="laser"].active {
    color: #fff;
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}

/* Small adjustments to controls panel padding/height to fit HUD */
@media (min-width: 821px) {
    #controls {
        max-height: calc(100vh - 360px); /* Leave room for HUD bottom-left */
    }
}

