:root {
    --bg-color: #0d0d12;
    --primary-color: #00fff2;
    --accent-color: #ff0055;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-dim: #8888aa;
    --success: #00ff88;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 50% 50%, #1a1a2e 0%, #0d0d12 100%);
    font-family: 'Roboto', sans-serif;
    color: var(--text-main);
    width: 100%;
    height: 100%;
    position: fixed;
    /* Lock to viewport prevents scroll bounce on iOS */
    inset: 0;
    touch-action: none;
    /* Globally prevent pinch-zoom and scroll */
}

/* Landscape Warning - Show only on portrait */
#landscape-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (orientation: portrait) {
    #landscape-warning {
        display: flex;
    }

    .app-container {
        display: none;
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 60px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
}

.dot {
    width: 10px;
    height: 10px;
    background: #444;
    border-radius: 50%;
    box-shadow: 0 0 5px #444;
    transition: all 0.3s ease;
}

.dot.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success), 0 0 15px var(--success);
}

/* Buttons */
.glass-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.glass-btn:active {
    background: rgba(0, 255, 242, 0.1);
    transform: scale(0.95);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.icon-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 255, 242, 0.2);
}

.lights-controls {
    display: flex;
    gap: 10px;
}

/* Main Controls Area */
/* Main Controls Area */
.controls-area {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2vh 2vw;
    /* Reduced side padding */
    position: relative;
    width: 100%;
}

/* Joystick Zones */
.joystick-zone {
    width: 30vmin;
    height: 30vmin;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.joystick-base {
    width: 22vmin;
    height: 22vmin;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.joystick-stick {
    width: 10vmin;
    height: 10vmin;
    border-radius: 50%;
    background: linear-gradient(135deg, #444, #222);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Start centered */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), inset 0 2px 5px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.8);
    pointer-events: none;
    /* Stick follows touch, doesn't capture it */
    transition: transform 0.05s ease-out;
    /* Smooth return, but overridden by dragging usually */
}

.joystick-stick::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1), transparent);
}

.label {
    margin-top: 2vmin;
    font-family: 'Orbitron', sans-serif;
    color: var(--text-dim);
    font-size: 3vmin;
    letter-spacing: 2px;
}

/* Dashboard in center */
.center-dashboard {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dashboard-glass {
    padding: 2vmin 4vmin;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.gauge-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 8vmin;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 255, 242, 0.4);
}

.gauge-value small {
    display: block;
    font-size: 2vmin;
    color: var(--text-dim);
    margin-top: 1vmin;
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
}

/* Active states for joysticks */
.joystick-zone.active .joystick-base {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 255, 242, 0.2);
}

.joystick-zone.active .joystick-stick {
    background: linear-gradient(135deg, var(--primary-color), #0088aa);
    box-shadow: 0 0 20px rgba(0, 255, 242, 0.4);
}