/* ============================================================
   X3 Nation — Apple Liquid Glass Aesthetic
   Theme: Pure Void Black + Liquid Refraction + Precision Glass
   NO EMOJIS — Pure SVG & Vector UI
   ============================================================ */

:root {
    --bg: #030206;
    --surface-glass: rgba(15, 12, 22, 0.62);
    --surface-glass-hover: rgba(25, 20, 36, 0.72);
    --surface-glass-active: rgba(35, 28, 48, 0.82);
    
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-light: rgba(255, 255, 255, 0.18);
    --border-glass-highlight: rgba(255, 255, 255, 0.35);

    --text-primary: #f5f5f7;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    --accent: #9333ea;
    --accent-light: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.35);
    --accent-subtle: rgba(168, 85, 247, 0.12);

    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.25);
    --warning: #f59e0b;
    --danger: #ef4444;

    --ease-apple: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    
    --radius-pill: 9999px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    --glass-blur: blur(28px);
    --glass-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), 
                    inset 0 1px 0 rgba(255, 255, 255, 0.12),
                    inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

html, body {
    width: 100%;
    min-height: 100%;
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    overflow-x: hidden;
}

/* Background Hero Wallpaper (Slightly Blurred) */
.site-bg-layer {
    position: fixed;
    inset: -30px;
    background-image: url('assets/background_hero.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    filter: blur(14px) brightness(0.38) saturate(1.15);
    transform: scale(1.06);
    z-index: 0;
    pointer-events: none;
    will-change: transform, filter;
}

/* Subtle Vignette Gradient Overlay */
.site-bg-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 35%, rgba(3, 2, 6, 0.25) 0%, rgba(3, 2, 6, 0.8) 100%);
    z-index: 0;
    pointer-events: none;
}

/* Background WebGL Liquid Glass Canvas */
canvas#lg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    display: block;
    mix-blend-mode: screen;
    opacity: 0.55;
}

/* Ambient dynamic backdrops */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    animation: ambientFloat 20s infinite alternate ease-in-out;
}

.ambient-glow-1 {
    width: 600px;
    height: 600px;
    top: -100px;
    left: 20%;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.35), transparent 70%);
}

.ambient-glow-2 {
    width: 500px;
    height: 500px;
    bottom: -100px;
    right: 15%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.25), transparent 70%);
    animation-delay: -7s;
}

@keyframes ambientFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.08); }
    100% { transform: translate(-30px, 40px) scale(0.95); }
}

/* App Viewport Container — Fixed Top Alignment */
.app-viewport {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 36px 24px 60px;
    perspective: 1200px;
}

/* Glass Card Foundation */
.glass-card {
    background: var(--surface-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
    pointer-events: none;
}

.glass-card:hover {
    border-color: var(--border-glass-light);
}

/* ============================================================
   Stage 1: The Auth Gate Portal
   ============================================================ */
#auth-stage {
    position: relative;
    margin-top: max(30px, calc(42vh - 280px));
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.85s var(--ease-apple), opacity 0.85s var(--ease-apple), filter 0.85s var(--ease-apple);
    will-change: transform, opacity, filter;
    z-index: 10;
}

/* Lateral Animation Out (Slides to the left) */
#auth-stage.slide-out {
    transform: translateX(-140%) scale(0.9) rotateY(-8deg);
    opacity: 0;
    filter: blur(14px);
    pointer-events: none;
    position: absolute;
    display: none !important;
}

.auth-card {
    width: 100%;
    padding: 44px 36px 36px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-hero-logo {
    width: 260px;
    height: auto;
    max-height: 140px;
    object-fit: contain;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6)) brightness(1.05);
    margin-bottom: 20px;
    user-select: none;
    transition: transform 0.4s var(--ease-apple);
}

.brand-hero-logo:hover {
    transform: scale(1.02);
}

.auth-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    max-width: 400px;
    margin-bottom: 30px;
}

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

/* Apple Liquid Glass Buttons */
.glass-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    padding: 13px 22px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(16px);
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s var(--ease-apple);
    position: relative;
    user-select: none;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-glass-light);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.glass-btn:active {
    transform: translateY(1px);
}

.glass-btn-primary {
    background: linear-gradient(180deg, rgba(88, 101, 242, 0.22) 0%, rgba(88, 101, 242, 0.12) 100%);
    border-color: rgba(88, 101, 242, 0.4);
    box-shadow: 0 0 25px rgba(88, 101, 242, 0.25);
}

.glass-btn-primary:hover {
    background: linear-gradient(180deg, rgba(88, 101, 242, 0.35) 0%, rgba(88, 101, 242, 0.2) 100%);
    border-color: rgba(88, 101, 242, 0.6);
    box-shadow: 0 0 35px rgba(88, 101, 242, 0.4);
}

.glass-btn-accent {
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.28) 0%, rgba(147, 51, 234, 0.16) 100%);
    border-color: rgba(168, 85, 247, 0.45);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.25);
}

.glass-btn-accent:hover {
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.42) 0%, rgba(147, 51, 234, 0.28) 100%);
    border-color: rgba(168, 85, 247, 0.7);
    box-shadow: 0 0 35px rgba(168, 85, 247, 0.45);
}

.glass-btn-accent:disabled, .glass-btn-primary:disabled, .glass-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.dc-btn-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.svg-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-glass);
}

.auth-footer-bar {
    margin-top: 24px;
    padding-top: 18px;
    width: 100%;
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.auth-config-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    transition: color 0.2s ease;
}

.auth-config-btn:hover {
    color: var(--text-primary);
}

.auth-alert-box {
    margin-top: 18px;
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    display: none;
    flex-direction: column;
    gap: 10px;
    line-height: 1.5;
    text-align: left;
    backdrop-filter: blur(16px);
}

.auth-alert-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-alert-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding-left: 28px;
}

.auth-alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.auth-alert-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fde68a;
}

.auth-alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.auth-alert-loading {
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #e9d5ff;
}

/* ============================================================
   Stage 2: The Main Cockpit (Flasher Dashboard)
   ============================================================ */
#main-stage {
    width: 100%;
    max-width: 1080px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: translateX(130%) scale(0.94);
    opacity: 0;
    filter: blur(12px);
    pointer-events: none;
    transition: transform 0.85s var(--ease-apple), opacity 0.85s var(--ease-apple), filter 0.85s var(--ease-apple);
    will-change: transform, opacity, filter;
    z-index: 5;
}

/* Lateral Animation In (Slides into center) */
#main-stage.active {
    transform: translateX(0) scale(1);
    opacity: 1;
    filter: blur(0);
    pointer-events: all;
}

/* Top Navigation Bar */
.top-navbar {
    width: 100%;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius-pill);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.nav-brand-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Model Segmented Tabs */
.nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 3px;
    border-radius: var(--radius-pill);
    gap: 2px;
}

.nav-tab {
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.25s var(--ease-apple);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.nav-tab.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.soon-pill {
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* User & Session controls */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* User Profile Pill */
.user-profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 4px 14px 4px 6px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    transition: all 0.25s var(--ease-apple);
    backdrop-filter: blur(12px);
    user-select: none;
}

.user-profile-pill:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-glass-light);
}

.user-avatar-circle {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    border: 1.5px solid #000;
    box-shadow: 0 0 6px var(--success-glow);
}

.user-name-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.user-role-tag {
    font-size: 9.5px;
    color: var(--accent-light);
    letter-spacing: 0.04em;
    line-height: 1;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    font-size: 12px;
    color: var(--text-secondary);
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background-color 0.3s ease;
}

.status-indicator.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success-glow);
}

.status-indicator.connecting {
    background: var(--warning);
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

/* Panels Area Container — Prevents Vertical Jumps Between Tabs */
#panels-container {
    width: 100%;
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

/* Deeply Relaxed Smooth Tab Transitions */
@keyframes tabSmoothEnter {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.tab-pane-smooth {
    animation: tabSmoothEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity, filter;
}

/* Dashboard Grid Layout (Tab G3) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

@media (max-width: 860px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.panel-card {
    padding: 26px;
    display: flex;
    flex-direction: column;
}

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

.panel-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.panel-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-subtle);
    border: 1px solid rgba(168, 85, 247, 0.25);
    color: var(--accent-light);
}

/* Scooter Connection Panel */
.scooter-connect-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.scooter-telemetry {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 4px;
}

.telem-item {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    padding: 12px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.telem-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.telem-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.power-hint-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    font-size: 12.5px;
    color: #fde68a;
    line-height: 1.4;
}

/* Firmware Preset Cards */
.preset-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preset-card {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s var(--ease-apple);
}

.preset-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-glass-light);
    transform: translateY(-1px);
}

.preset-card.active {
    background: rgba(168, 85, 247, 0.09);
    border-color: rgba(168, 85, 247, 0.45);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.15);
}

.preset-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.preset-icon-box {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
}

.preset-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.preset-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
}

.preset-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.2s ease;
}

.preset-card.active .preset-check {
    border-color: var(--accent-light);
    background: var(--accent-light);
    color: #fff;
}

/* 300 km/h Speed Tag Pills */
.speed-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.16) 0%, rgba(56, 189, 248, 0.12) 100%);
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #e9d5ff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.2);
    width: fit-content;
}

.speed-tag-pill .svg-icon {
    width: 12px;
    height: 12px;
    color: #38bdf8;
}

/* Unlock Profile Switch Banner */
.unlock-code-banner {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid rgba(168, 85, 247, 0.22);
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.unlock-code-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.unlock-code-title {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.unlock-combo-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.unlock-combo-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: var(--radius-sm);
    color: #f5f5f7;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.arrow-symbol {
    color: var(--accent-light);
    font-size: 14px;
    font-weight: 700;
}

.combo-separator {
    color: rgba(255, 255, 255, 0.25);
    font-size: 10px;
}

/* Automatic Partition Indicator Badge */
.auto-partition-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: var(--accent-light);
    letter-spacing: 0.02em;
    user-select: none;
}

/* Flashing Cockpit Card */
.flasher-cockpit-grid {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flash-control-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.partition-select-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.glass-select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

/* ============================================================
   Circular Scooter Progress Gauge
   ============================================================ */
.circular-flash-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 16px 0 28px;
    position: relative;
    user-select: none;
}

.gauge-ring-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.gauge-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 9;
}

.gauge-fill {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-width: 9;
    stroke-linecap: round;
    /* Circumference for r=130: 2 * PI * 130 ≈ 816.81 */
    stroke-dasharray: 816.81;
    stroke-dashoffset: 816.81;
    transform: rotate(-90deg);
    transform-origin: 150px 150px;
    transition: stroke-dashoffset 0.25s ease-out;
    filter: url(#gaugeGlow);
}

.gauge-scooter-frame {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.06) 0%, rgba(255, 255, 255, 0.02) 70%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.scooter-ambient-light {
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.18), transparent 70%);
    filter: blur(20px);
    pointer-events: none;
}

.gauge-scooter-img {
    width: 82%;
    height: 82%;
    object-fit: contain;
    filter: drop-shadow(0 14px 20px rgba(0, 0, 0, 0.7));
    transition: transform 0.3s ease;
    z-index: 2;
}

.gauge-scooter-img.flashing {
    animation: scooterPulse 2s infinite ease-in-out;
}

@keyframes scooterPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 14px 20px rgba(168, 85, 247, 0.4)); }
    50% { transform: scale(1.03); filter: drop-shadow(0 18px 28px rgba(168, 85, 247, 0.7)); }
}

.gauge-meta-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    text-align: center;
}

.gauge-pct-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gauge-pct-number {
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.phase-pill {
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.gauge-status-text {
    font-size: 13.5px;
    color: var(--text-primary);
    font-weight: 500;
}

.gauge-sub-info {
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", monospace;
    color: var(--text-muted);
}

/* ============================================================
   Collapsible Activity Log Terminal
   ============================================================ */
.terminal-window {
    width: 100%;
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s var(--ease-apple);
}

.terminal-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.terminal-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.terminal-title-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.terminal-chevron {
    width: 14px;
    height: 14px;
    transition: transform 0.3s var(--ease-apple);
}

.terminal-window.collapsed .terminal-chevron {
    transform: rotate(-90deg);
}

.terminal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.terminal-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.terminal-btn:hover {
    color: var(--text-primary);
}

.terminal-body {
    padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    max-height: 190px;
    overflow-y: auto;
    color: #a1a1aa;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid var(--border-glass);
    transition: max-height 0.3s var(--ease-apple), padding 0.3s var(--ease-apple);
}

.terminal-window.collapsed .terminal-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border-top: none;
}

.log-line {
    word-break: break-all;
}

.log-time {
    color: #52525b;
    margin-right: 8px;
}

.log-info { color: #93c5fd; }
.log-success { color: #6ee7b7; }
.log-warn { color: #fde68a; }
.log-error { color: #fca5a5; }

/* ============================================================
   Coming Soon Panels (ZT3 & F3) — Smooth Anchoring
   ============================================================ */
.coming-soon-panel {
    display: none;
    padding: 70px 40px;
    text-align: center;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    min-height: 520px;
}

.coming-soon-panel.active {
    display: flex;
}

.soon-icon-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Modals */
.glass-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glass-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.glass-modal-box {
    width: 100%;
    max-width: 500px;
    padding: 32px;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.input-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.glass-input {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
}

.glass-input:focus {
    border-color: var(--accent-light);
}

/* Credits styling */
.credits-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.credit-highlight {
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--text-primary);
}

.credit-name {
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 4px;
}

/* ============================================================
   ADMIN & TESTER ACTION PILLS (NAVBAR)
   ============================================================ */
.glass-btn-admin {
    background: rgba(138, 43, 226, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #e9d5ff;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.25);
}

.glass-btn-admin:hover {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(168, 85, 247, 0.7);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.glass-btn-tester {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.4);
    color: #a5f3fc;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.2);
}

.glass-btn-tester:hover {
    background: rgba(6, 182, 212, 0.28);
    border-color: rgba(6, 182, 212, 0.65);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.35);
}

/* ============================================================
   ADMIN MODAL & AUDIT TABLES
   ============================================================ */
.admin-modal-box {
    max-width: 860px;
    padding: 26px 30px;
    max-height: 90vh;
    overflow-y: auto;
}

.admin-tab-bar {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
    margin-bottom: 18px;
}

.admin-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.admin-tab-btn.active {
    color: #ffffff;
    background: rgba(168, 85, 247, 0.16);
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
    animation: tabSmoothEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.admin-status-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-bottom: 14px;
}

.threat-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
}

.threat-status-pill.secure {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.threat-status-pill.alert {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.threat-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}

.admin-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.audit-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.25);
    max-height: 380px;
    overflow-y: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.audit-table th {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    backdrop-filter: blur(8px);
}

.audit-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    vertical-align: middle;
}

.audit-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.audit-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.audit-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.audit-badge.badge-safe {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.audit-badge.badge-warn {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.audit-badge.badge-danger {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ============================================================
   TESTER COCKPIT / FEATURES GRID
   ============================================================ */
.tester-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 10px;
}

.tester-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
}

.tester-card:hover {
    border-color: rgba(6, 182, 212, 0.35);
    background: rgba(6, 182, 212, 0.04);
}

.tester-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================================
   HAFTUNGSAUSSCHLUSS (15-SECOND DISCLAIMER)
   ============================================================ */
.disclaimer-modal-box {
    max-width: 660px;
    padding: 28px 32px;
}

.disclaimer-text-scroll {
    max-height: 280px;
    overflow-y: auto;
    padding: 16px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin: 16px 0;
}

.disclaimer-block {
    margin-bottom: 14px;
}

.disclaimer-block:last-child {
    margin-bottom: 0;
}

.disclaimer-heading {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-light);
    margin: 0 0 4px 0;
    letter-spacing: 0.3px;
}

.disclaimer-block p {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
}

.disclaimer-timer-container {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}

.disclaimer-timer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 8px;
}

.disclaimer-timer-title {
    color: var(--text-muted);
    font-weight: 500;
}

.disclaimer-timer-count {
    color: var(--accent-light);
    font-family: var(--font-mono);
    font-weight: 600;
}

.disclaimer-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
}

.disclaimer-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-primary));
    box-shadow: 0 0 10px var(--accent-primary);
    transition: width 1s linear;
}

/* ============================================================
   STAGE 0: FULL-SCREEN MANDATORY DISCLAIMER GATE
   Completely blocks the viewport until the user accepts.
   ============================================================ */
@keyframes disclaimerFadeIn {
    from { opacity: 0; transform: scale(1.02); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes disclaimerFadeOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.98); }
}

@keyframes dg-section-enter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hide disclaimer-stage immediately if accepted */
html.disclaimer-done #disclaimer-stage {
    display: none !important;
}

#disclaimer-stage {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: disclaimerFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.disclaimer-stage-inner {
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    gap: 0;

    /* Glass card geometry */
    background: rgba(14, 14, 20, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 20px;
    backdrop-filter: blur(32px) saturate(1.4);
    -webkit-backdrop-filter: blur(32px) saturate(1.4);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 0 60px rgba(0,0,0,0.6),
        0 0 120px rgba(129, 140, 248, 0.08);
    overflow: hidden;
}

/* Top specular highlight strip */
.disclaimer-stage-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    pointer-events: none;
}

/* ---- Header ---- */
.dg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.dg-logo-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dg-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.15));
}

.dg-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.dg-brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.dg-warning-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 9999px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fcd34d;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ---- Title Block ---- */
.dg-title-block {
    padding: 24px 28px 20px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dg-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #ffffff 0%, rgba(255,255,255,0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dg-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ---- Scroll Content Area ---- */
.dg-scroll-area {
    overflow-y: auto;
    padding: 20px 28px;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.dg-scroll-area::-webkit-scrollbar {
    width: 4px;
}

.dg-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 9999px;
}

/* ---- Disclaimer Sections ---- */
.dg-section {
    display: flex;
    gap: 18px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    animation: dg-section-enter 0.4s ease both;
}

.dg-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.dg-section:nth-child(1) { animation-delay: 0.1s; }
.dg-section:nth-child(2) { animation-delay: 0.2s; }
.dg-section:nth-child(3) { animation-delay: 0.3s; }
.dg-section:nth-child(4) { animation-delay: 0.4s; }

.dg-section-num {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: rgba(129, 140, 248, 0.6);
    min-width: 24px;
    padding-top: 2px;
    letter-spacing: 1px;
}

.dg-section-body {
    flex: 1;
    min-width: 0;
}

.dg-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.dg-section-body p {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.dg-section-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ---- Footer: Timer & Accept Button ---- */
.dg-footer {
    padding: 18px 28px 22px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    background: rgba(0,0,0,0.2);
}

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

.dg-timer-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.dg-timer-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-light);
    min-width: 36px;
    text-align: right;
    transition: color 0.3s ease;
}

.dg-progress-track {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.07);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 16px;
}

.dg-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-primary), #c084fc);
    box-shadow: 0 0 10px var(--accent-primary);
    border-radius: 9999px;
}

.dg-accept-btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border-radius: 12px;
    gap: 10px;
    transition: all 0.3s ease;
}

.dg-accept-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
    box-shadow: none;
}

.dg-accept-btn:not(:disabled) {
    animation: pulseBtn 2s ease-in-out infinite;
}

@keyframes pulseBtn {
    0%, 100% { box-shadow: 0 0 20px rgba(129, 140, 248, 0.35); }
    50%       { box-shadow: 0 0 32px rgba(129, 140, 248, 0.6), 0 0 60px rgba(129, 140, 248, 0.2); }
}

/* ============================================================
   CFW VCU CONFIGURATOR & BUILDER STYLES (TESTER SLOT)
   ============================================================ */
.cfw-tester-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.cfw-header-card {
    padding: 20px 24px;
}

.cfw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 860px) {
    .cfw-grid {
        grid-template-columns: 1fr;
    }
}

.cfw-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cfw-section {
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px;
}

.cfw-label-row {
    margin-bottom: 12px;
}

.cfw-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.cfw-input-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cfw-input-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cfw-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cfw-field label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.glass-input, .glass-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.glass-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a855f7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 32px;
}

.glass-select option {
    background: #0f0c16;
    color: #fff;
}

.glass-input:focus, .glass-select:focus {
    border-color: var(--accent-light);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.3);
}

.cfw-range-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.glass-range {
    flex: 1;
    accent-color: var(--accent-cyan);
    height: 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.cfw-range-val {
    min-width: 48px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-cyan);
    text-align: right;
}

.reku-preset-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.reku-chip {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reku-chip:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.reku-chip.active {
    background: rgba(6, 182, 212, 0.18);
    border-color: rgba(6, 182, 212, 0.45);
    color: var(--accent-cyan);
    font-weight: 600;
}

.cfw-action-card {
    padding: 20px 24px;
}

.cfw-action-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.cfw-status-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cfw-status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 12px var(--accent-cyan);
}

.cfw-btn-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Model Selector Cards (G3 / F3 / ZT3) */
.cfw-model-bar {
    padding: 18px 22px;
}

.cfw-model-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

@media (max-width: 780px) {
    .cfw-model-grid {
        grid-template-columns: 1fr;
    }
}

.cfw-model-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.22s ease;
    font-family: inherit;
}

.cfw-model-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(6, 182, 212, 0.35);
    transform: translateY(-1px);
}

.cfw-model-card.active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.14), rgba(168, 85, 247, 0.14));
    border-color: rgba(6, 182, 212, 0.65);
    box-shadow: 0 0 24px rgba(6, 182, 212, 0.22);
}

.cfw-model-img-wrap {
    width: 74px;
    height: 74px;
    flex-shrink: 0;
    border-radius: 12px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.35));
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    overflow: hidden;
}

.cfw-model-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}

.cfw-model-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.cfw-model-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.cfw-model-meta {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

.cfw-model-tag {
    font-size: 10.5px;
    color: var(--text-muted);
}

.cfw-model-active-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    transition: all 0.2s ease;
}

.cfw-model-card.active .cfw-model-active-dot {
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
}

/* Custom Unlock Combo Builder */
.cfw-combo-display {
    min-height: 46px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(168, 85, 247, 0.28);
    margin-bottom: 10px;
}

.cfw-combo-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cfw-combo-pill:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.cfw-combo-sep {
    color: var(--text-muted);
    font-size: 11px;
}

.cfw-combo-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cfw-keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 520px) {
    .cfw-keypad-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.cfw-key-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.16s ease;
}

.cfw-key-btn:hover {
    background: rgba(6, 182, 212, 0.14);
    border-color: rgba(6, 182, 212, 0.45);
    color: #fff;
}

.cfw-key-btn:active {
    transform: scale(0.96);
}

.cfw-key-btn .key-arrow {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-weight: 700;
}

.cfw-key-wide {
    grid-column: 1 / -1;
    border-color: rgba(168, 85, 247, 0.35);
    background: rgba(168, 85, 247, 0.08);
}

.cfw-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.4;
}

.cfw-checkbox-row input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent-cyan);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

.cfw-highlight-box {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.09), rgba(168, 85, 247, 0.09));
    border-color: rgba(6, 182, 212, 0.35);
}

.cfw-patch-diff-log {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-family: var(--font-mono);
    font-size: 11px;
    color: #6ee7b7;
    line-height: 1.55;
    max-height: 140px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ============================================================
   RESPONSIVE & MOBILE OPTIMIZATIONS (Smartphones / Tablets)
   ============================================================ */

@media (max-width: 900px) {
    .top-navbar {
        flex-wrap: wrap;
        border-radius: var(--radius-lg);
        padding: 12px 16px;
        gap: 12px;
    }

    .nav-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-actions {
        order: 2;
        margin-left: auto;
    }
}

@media (max-width: 640px) {
    .app-viewport {
        padding: 16px 12px 40px;
    }

    /* Auth Stage */
    #auth-stage {
        margin-top: max(16px, calc(30vh - 160px));
        max-width: 100%;
    }

    .auth-card {
        padding: 30px 20px 24px;
        border-radius: var(--radius-lg);
    }

    .brand-hero-logo {
        width: 200px;
        max-height: 100px;
        margin-bottom: 14px;
    }

    .auth-title {
        font-size: 18px;
    }

    .auth-subtitle {
        font-size: 12.5px;
        margin-bottom: 22px;
    }

    .auth-actions button {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 13.5px;
        padding: 12px 16px;
    }

    /* Top Navbar */
    .top-navbar {
        border-radius: 18px;
        padding: 10px 14px;
    }

    .nav-brand-title {
        display: none;
    }

    .nav-logo {
        height: 26px;
    }

    .user-profile-pill {
        padding: 3px 10px 3px 5px;
        font-size: 12px;
    }

    .user-role-badge {
        display: none;
    }

    .nav-tab {
        padding: 6px 12px;
        font-size: 12px;
        flex: 1;
        justify-content: center;
    }

    .nav-actions {
        gap: 6px;
    }

    .glass-btn-admin, .glass-btn-tester {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }

    /* Panels & Cards */
    .panel-card {
        padding: 18px 14px;
        border-radius: var(--radius-lg);
    }

    .panel-header {
        margin-bottom: 14px;
    }

    .panel-title {
        font-size: 15px;
    }

    .scooter-telemetry {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .telem-item {
        padding: 10px 12px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .telem-label {
        font-size: 10.5px;
    }

    .telem-value {
        font-size: 12px;
    }

    /* Preset Cards */
    .preset-card {
        padding: 12px 14px;
        gap: 10px;
    }

    .preset-icon-box {
        width: 32px;
        height: 32px;
    }

    .preset-title {
        font-size: 13px;
    }

    .preset-desc {
        font-size: 10.5px;
    }

    .speed-tag-pill {
        font-size: 10px;
        padding: 2px 7px;
    }

    /* Circular Gauge */
    .circular-gauge-container {
        margin: 10px 0 20px;
    }

    .gauge-ring-wrapper {
        width: 230px;
        height: 230px;
    }

    .gauge-svg {
        transform: scale(0.76);
        transform-origin: center center;
    }

    .gauge-scooter-frame {
        width: 170px;
        height: 170px;
    }

    .gauge-scooter-frame img {
        max-width: 130px;
        max-height: 130px;
    }

    .gauge-percentage-readout {
        font-size: 32px;
    }

    /* Collapsible Terminal */
    .terminal-window {
        border-radius: 16px;
    }

    .terminal-header {
        padding: 12px 14px;
    }

    .terminal-body {
        padding: 12px;
        font-size: 11px;
        max-height: 200px;
    }

    /* Disclaimer Stage */
    #disclaimer-stage {
        padding: 10px;
    }

    .disclaimer-stage-inner {
        max-height: 96vh;
        border-radius: 16px;
    }

    .dg-header {
        padding: 14px 16px 12px;
    }

    .dg-logo {
        width: 32px;
        height: 32px;
    }

    .dg-brand {
        font-size: 13px;
    }

    .dg-warning-badge {
        padding: 4px 10px;
        font-size: 11px;
    }

    .dg-title-block {
        padding: 12px 16px;
    }

    .dg-title {
        font-size: 15px;
    }

    .dg-subtitle {
        font-size: 11.5px;
    }

    .dg-scroll-area {
        padding: 14px 16px;
    }

    .dg-section {
        gap: 12px;
        margin-bottom: 14px;
        padding-bottom: 14px;
    }

    .dg-section-title {
        font-size: 12px;
    }

    .dg-section-body p {
        font-size: 11.5px;
    }

    .dg-footer {
        padding: 12px 16px 16px;
    }

    .dg-accept-btn {
        font-size: 12.5px;
        padding: 12px;
    }

    /* Modals */
    .glass-modal-box {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px 16px !important;
        margin: 10px auto;
        border-radius: 18px;
    }

    .admin-tab-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .admin-tab-bar::-webkit-scrollbar {
        display: none;
    }
}

/* ==========================================================================
   CFW THROTTLE RAMP CURVE & ZT3 BATTERY DASHBOARD VISUALIZER
   ========================================================================== */
.cfw-card-full {
    grid-column: 1 / -1;
}

.cfw-curve-container {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 860px) {
    .cfw-curve-container {
        grid-template-columns: 1fr;
    }
}

.cfw-curve-visualizer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cfw-curve-chart-wrap {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 12px;
    position: relative;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.cfw-curve-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.cfw-curve-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 520px) {
    .cfw-curve-metrics {
        grid-template-columns: 1fr;
    }
}

.cfw-metric-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cfw-metric-lbl {
    font-size: 10px;
    color: var(--text-muted);
}

.cfw-metric-val {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.cfw-curve-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px;
}

.cfw-preset-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 500px) {
    .cfw-preset-row {
        grid-template-columns: 1fr;
    }
}

.cfw-preset-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: all 0.2s ease;
    text-align: center;
}

.cfw-preset-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.cfw-preset-btn.active {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.cfw-preset-btn .preset-icon {
    font-size: 16px;
}

.cfw-preset-btn .preset-title {
    font-size: 11px;
    font-weight: 600;
}

.cfw-preset-btn .preset-desc {
    font-size: 9.5px;
    color: var(--text-muted);
    line-height: 1.2;
}
