:root {
    --bg-dark: #06070a;
    --bg-card: rgba(16, 20, 28, 0.7);
    --border-glass: rgba(255, 255, 255, 0.07);
    
    --text-main: #f1f5f9;
    --text-muted: #808e9b;
    --text-dim: #4b5563;

    --laser-red: #ff2a4b;
    --laser-cyan: #00f2fe;
    --laser-green: #00e676;
    --laser-orange: #ff9f43;
    --laser-blue: #38bdf8;

    --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --drawer-width: 380px;
}

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

input, button, textarea {
    font-family: inherit;
    user-select: auto;
}

html, body {
    width: 100%;
    min-height: 100dvh;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow-x: hidden;
    position: relative;
}

.bg-vignette {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
    pointer-events: none;
    z-index: 0;
}

.app-layout {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
}

/* Vector Icons */
.svg-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
}

.svg-mini {
    width: 15px;
    height: 15px;
}

.svg-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.text-cyan { color: var(--laser-cyan); }
.text-green { color: var(--laser-green); }
.text-orange { color: var(--laser-orange); }
.text-blue { color: var(--laser-blue); }
.text-red { color: var(--laser-red); }

/* -------------------------------------------------------------
   Minimalist Lockscreen
------------------------------------------------------------- */
.auth-lockscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 7, 10, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-lockscreen.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-box {
    width: 100%;
    max-width: 330px;
    background: rgba(14, 18, 26, 0.94);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.85);
    padding: 28px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
}

.auth-icon-wrap {
    width: 50px;
    height: 50px;
    background: rgba(0, 242, 254, 0.06);
    border: 1px solid rgba(0, 242, 254, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--laser-cyan);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.15);
}

.svg-lock {
    width: 22px;
    height: 22px;
}

.auth-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.password-field-wrap {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background: rgba(7, 9, 14, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 4px 5px 4px 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.password-field-wrap:focus-within {
    border-color: rgba(255, 42, 75, 0.5);
    box-shadow: 0 0 16px rgba(255, 42, 75, 0.2);
}

.password-field-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 16px;
    letter-spacing: 3px;
    padding: 10px 0;
}

.password-field-wrap input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 2px;
}

.auth-enter-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #ff2a4b, #d81436);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px rgba(255, 42, 75, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.auth-enter-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 18px rgba(255, 42, 75, 0.6);
}

.auth-enter-btn:active {
    transform: scale(0.95);
}

.auth-error-msg {
    display: none;
    font-size: 12px;
    color: var(--laser-red);
    padding: 4px 0 0;
}

/* -------------------------------------------------------------
   Top Status Bar
------------------------------------------------------------- */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
}

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

.brand h1 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-main);
}

.status-beacon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-beacon.online {
    background-color: var(--laser-green);
    box-shadow: 0 0 10px var(--laser-green);
}

.status-beacon.offline {
    background-color: var(--laser-red);
    box-shadow: 0 0 8px var(--laser-red);
}

.hud-lock-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.hud-lock-btn:hover {
    color: var(--laser-red);
    border-color: rgba(255, 51, 75, 0.3);
}

/* -------------------------------------------------------------
   GIANT 3D POWER BUTTON (Center Stage)
------------------------------------------------------------- */
.button-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 30px 0;
    pointer-events: none;
}

.button-chassis {
    position: relative;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Circular Laser Track (Always clearly visible outline) */
.radial-progress-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

.ring-track {
    fill: none;
    stroke: rgba(255, 42, 75, 0.22);
    stroke-width: 4.5;
    filter: drop-shadow(0 0 6px rgba(255, 42, 75, 0.35));
    transition: stroke 0.2s ease, filter 0.2s ease;
}

.radial-progress-svg.is-holding .ring-track {
    stroke: rgba(255, 42, 75, 0.45);
    filter: drop-shadow(0 0 10px rgba(255, 42, 75, 0.6));
}

.ring-fill {
    fill: none;
    stroke: url(#laserGrad);
    stroke-width: 5.5;
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px rgba(255, 42, 75, 0.9)) drop-shadow(0 0 18px rgba(255, 75, 110, 0.6));
    transition: stroke-dashoffset 0.04s linear;
}

.radial-progress-svg.is-holding .ring-fill {
    filter: drop-shadow(0 0 12px rgba(255, 42, 75, 1)) drop-shadow(0 0 24px rgba(255, 75, 110, 0.85));
}

/* Metallic Bezel */
.bezel-ring {
    position: relative;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1e2636 0%, #10151f 50%, #0a0d14 100%);
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.9),
        inset 0 2px 4px rgba(255, 255, 255, 0.15),
        inset 0 -4px 8px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.led-halo {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    box-shadow: inset 0 0 30px rgba(255, 42, 75, 0.3);
    pointer-events: none;
}

/* -------------------------------------------------------------
   THE 3D PUSH BUTTON
   Strict Hitbox: ONLY the circular cap handles clicks
------------------------------------------------------------- */
.push-button-3d {
    position: relative;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    clip-path: circle(50% at 50% 50%);
    border: none;
    outline: none;
    cursor: pointer;
    background: transparent;
    padding: 0;
    margin: 0;
    pointer-events: auto !important;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.btn-top-surface {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ff4765 0%, #d81436 45%, #92041e 80%, #580010 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Massive 3D Depth */
    box-shadow: 
        0 3px 0 #ff6b84,
        0 6px 0 #ba0a28,
        0 10px 0 #8b041c,
        0 16px 0 #580010,
        0 22px 35px rgba(0, 0, 0, 0.85),
        0 0 45px rgba(255, 42, 75, 0.45);

    transform: translateY(-8px);
    transition: transform 0.15s cubic-bezier(0.18, 0.89, 0.32, 1.28), box-shadow 0.15s ease;
    pointer-events: none;
}

.surface-bevel {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.35), inset 0 -3px 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.btn-core {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #fff;
    pointer-events: none;
}

.power-svg-icon {
    width: 68px;
    height: 68px;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.7));
}

.btn-label-primary {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

/* 3D Pressed Down State */
.push-button-3d:active .btn-top-surface,
.push-button-3d.is-holding .btn-top-surface {
    transform: translateY(6px);
    box-shadow: 
        0 1px 0 #ff6b84,
        0 2px 0 #ba0a28,
        0 4px 0 #8b041c,
        0 6px 0 #580010,
        0 8px 15px rgba(0, 0, 0, 0.7),
        0 0 65px rgba(255, 42, 75, 0.9);
}

/* Minimal Linear Indicator */
.hold-progress-bar {
    width: 180px;
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 16px;
    pointer-events: none;
}

.bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--laser-red), #ff758c);
    border-radius: 3px;
    transition: width 0.08s linear;
}

/* -------------------------------------------------------------
   HORIZONTAL Side Triggers (Thumb-friendly, 100% Readable)
------------------------------------------------------------- */
.drawer-trigger {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(16, 22, 32, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
}

/* Left Trigger */
.trigger-left {
    left: 0;
    border-left: none;
    border-radius: 0 14px 14px 0;
    color: var(--laser-cyan);
}

.trigger-left:hover {
    transform: translateY(-50%) translateX(4px);
    background: rgba(22, 30, 44, 0.98);
}

/* Right Trigger */
.trigger-right {
    right: 0;
    border-right: none;
    border-radius: 14px 0 0 14px;
    color: var(--laser-red);
}

.trigger-right:hover {
    transform: translateY(-50%) translateX(-4px);
    background: rgba(22, 30, 44, 0.98);
}

.trigger-arrow {
    font-size: 11px;
}

/* -------------------------------------------------------------
   Slide-out Drawers (Minimalist)
------------------------------------------------------------- */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.side-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--drawer-width);
    max-width: 90vw;
    background: rgba(10, 14, 20, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.85);
    overflow: hidden;
}

.drawer-left {
    left: 0;
    border-right: 1px solid var(--border-glass);
    transform: translateX(-100%);
}

.drawer-left.is-open {
    transform: translateX(0);
}

.drawer-right {
    right: 0;
    border-left: 1px solid var(--border-glass);
    transform: translateX(100%);
}

.drawer-right.is-open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-glass);
}

.drawer-header h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.drawer-close {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

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

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Telemetry Cards */
.telemetry-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.telemetry-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
}

.t-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.t-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.t-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-dim);
    font-weight: 700;
}

.t-val-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.t-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.charging-chip {
    font-size: 9px;
    color: var(--laser-green);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Actions Grid */
.drawer-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.act-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.act-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.act-btn:active {
    transform: scale(0.97);
}

.act-btn-danger:hover {
    border-color: rgba(255, 51, 75, 0.5);
    background: rgba(255, 51, 75, 0.1);
}

/* Terminal & APK */
.terminal-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-dim);
}

.apk-actions {
    display: flex;
    gap: 6px;
}

.pill-btn {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none;
    border: 1px solid var(--border-glass);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

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

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

.chip {
    font-size: 10px;
    font-family: var(--font-mono);
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
}

.chip:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.terminal-box {
    height: 140px;
    background: #040508;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.term-line { word-break: break-all; white-space: pre-wrap; }
.term-system { color: #64748b; }
.term-info { color: #94a3b8; }
.term-success { color: var(--laser-green); }
.term-error { color: var(--laser-red); }

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 3px 6px 3px 10px;
}

.term-prompt {
    font-family: var(--font-mono);
    color: var(--laser-green);
    font-weight: 700;
}

.terminal-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 12px;
}

.term-submit {
    background: #1e293b;
    border: 1px solid var(--border-glass);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

/* -------------------------------------------------------------
   Mobile & Responsive Adaptations
------------------------------------------------------------- */
@media (max-width: 600px) {
    .app-layout {
        padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
    }

    /* Giant 3D Button on Phones */
    .button-stage {
        padding: 15px 0;
        min-height: 290px;
    }

    .button-chassis {
        width: 270px;
        height: 270px;
    }

    .bezel-ring {
        width: 215px;
        height: 215px;
    }

    .push-button-3d {
        width: 172px;
        height: 172px;
    }

    .power-svg-icon {
        width: 56px;
        height: 56px;
    }

    .btn-label-primary {
        font-size: 16px;
        letter-spacing: 2.5px;
    }

    /* Side Drawers full width on Mobile */
    :root {
        --drawer-width: 100vw;
    }

    .side-drawer {
        max-width: 100vw;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .drawer-trigger {
        top: 60%;
        padding: 10px 12px;
        font-size: 11px;
    }
}
