:root {
    --bg-dark: #060b19;
    --bg-panel: rgba(9, 15, 31, 0.88);
    --bg-panel-solid: #0a1124;
    --bg-card: rgba(17, 26, 48, 0.78);
    --border-subtle: rgba(56, 189, 248, 0.18);
    --border-bright: rgba(56, 189, 248, 0.48);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-cyan: #38bdf8;
    --accent-teal: #00f2fe;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #a855f7;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════
   TOP COMMAND NAVBAR (ctOS / NOC HUD)
   ═══════════════════════════════════════════════════════════════════════ */
.top-navbar {
    position: fixed;
    top: 12px;
    left: 16px;
    right: 16px;
    height: 58px;
    z-index: 1100;
    background: var(--bg-panel);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 24px rgba(56, 189, 248, 0.08);
}

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

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(16, 185, 129, 0.22));
    border: 1px solid var(--border-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    font-size: 17px;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.25);
}

.brand-titles h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
    text-transform: uppercase;
}

.brand-sub {
    font-size: 11.5px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.18s ease;
}

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

.nav-btn.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(56, 189, 248, 0.12));
    border-color: var(--border-bright);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.18);
}

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

.health-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    cursor: pointer;
    transition: all 0.2s ease;
}

.health-pill.degraded {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.health-pill.outage {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.55);
    color: #f87171;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.65; }
}

.ecosystem-link {
    text-decoration: none;
    color: var(--accent-cyan);
    font-size: 12px;
    font-weight: 600;
    padding: 7px 11px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: rgba(56, 189, 248, 0.08);
    transition: all 0.15s ease;
}

.ecosystem-link:hover {
    border-color: var(--accent-cyan);
    background: rgba(56, 189, 248, 0.16);
}

/* ═══════════════════════════════════════════════════════════════════════
   MAP CANVAS & CUSTOM MARKERS
   ═══════════════════════════════════════════════════════════════════════ */
#map {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: #040814;
}

.dc-marker-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dc-marker-core {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0ea5e9;
    border: 2px solid #ffffff;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.95);
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
}

.dc-marker-ring {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid rgba(56, 189, 248, 0.55);
    animation: dcPulse 2.6s infinite ease-out;
    pointer-events: none;
}

.dc-marker-wrap.ctrlgrid-core .dc-marker-core {
    width: 18px;
    height: 18px;
    background: #10b981;
    border-color: #ecfdf5;
    box-shadow: 0 0 18px #10b981;
}

.dc-marker-wrap.ctrlgrid-core .dc-marker-ring {
    width: 38px;
    height: 38px;
    border: 2px solid #10b981;
}

.dc-marker-wrap.status-degraded .dc-marker-core {
    background: #f59e0b;
    box-shadow: 0 0 16px #f59e0b;
}

.dc-marker-wrap.status-degraded .dc-marker-ring {
    width: 36px;
    height: 36px;
    border: 2px solid #f59e0b;
    animation-duration: 1.3s;
}

.dc-marker-wrap.status-outage .dc-marker-core {
    background: #ef4444;
    box-shadow: 0 0 20px #ef4444;
}

.dc-marker-wrap.status-outage .dc-marker-ring {
    width: 44px;
    height: 44px;
    border: 2.5px solid #ef4444;
    animation-duration: 0.95s;
}

@keyframes dcPulse {
    0% { transform: scale(0.55); opacity: 0.95; }
    100% { transform: scale(1.65); opacity: 0; }
}

.zone-submarker {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.94);
    border: 1.5px solid #a855f7;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7), 0 0 12px rgba(168, 85, 247, 0.65);
    color: #f3e8ff;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.zone-submarker:hover {
    transform: translate(-50%, -50%) scale(1.08);
    border-color: #38bdf8;
}

.zone-submarker.primary-zone-pin {
    border-color: #38bdf8;
    background: rgba(8, 47, 73, 0.95);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.75), 0 0 14px rgba(56, 189, 248, 0.8);
    color: #e0f2fe;
}

.zone-submarker.ctrlgrid-db-pin {
    border-color: #10b981;
    background: rgba(6, 78, 59, 0.95);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.75), 0 0 16px rgba(16, 185, 129, 0.85);
    color: #ecfdf5;
}

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

/* Animated subsea cable dash flow */
.subsea-cable-line {
    stroke-dasharray: 8 6;
    animation: cableFlow 24s linear infinite;
}

@keyframes cableFlow {
    to { stroke-dashoffset: -280; }
}

/* ═══════════════════════════════════════════════════════════════════════
   LEFT CONTROL & TELEMETRY SIDEBAR
   ═══════════════════════════════════════════════════════════════════════ */
.left-sidebar {
    position: fixed;
    top: 82px;
    left: 16px;
    bottom: 16px;
    width: 340px;
    z-index: 1000;
    background: var(--bg-panel);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-section {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-cyan);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.kpi-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 10px 12px;
}

.kpi-val {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.kpi-lbl {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.layer-toggles {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12.5px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
}

.toggle-item:hover {
    background: rgba(56, 189, 248, 0.08);
}

.toggle-item input[type="checkbox"] {
    accent-color: var(--accent-cyan);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.search-box {
    position: relative;
    margin-bottom: 8px;
}

.search-box input {
    width: 100%;
    padding: 9px 12px 9px 32px;
    border-radius: 9px;
    border: 1px solid var(--border-subtle);
    background: rgba(6, 11, 25, 0.85);
    color: var(--text-primary);
    font-size: 12.5px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent-cyan);
}

.search-box i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 12px;
}

.continent-pills {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.continent-pill {
    font-size: 11px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.continent-pill.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--accent-cyan);
    color: #fff;
}

.directory-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dir-item {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.16s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dir-item:hover, .dir-item.selected {
    border-color: var(--accent-cyan);
    background: rgba(56, 189, 248, 0.12);
    transform: translateX(2px);
}

.dir-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dir-item-sub {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-top: 2px;
}

.dir-badge {
    font-family: var(--font-mono);
    font-size: 10.5px;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.14);
    color: var(--accent-cyan);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════
   RIGHT DETAIL INSPECTOR MODAL / DRAWER (RADAR-STYLE NODE INSPECTOR)
   ═══════════════════════════════════════════════════════════════════════ */
.inspector-drawer {
    position: fixed;
    top: 82px;
    right: 16px;
    bottom: 16px;
    width: 440px;
    z-index: 1050;
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-bright);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 30px rgba(56, 189, 248, 0.14);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.inspector-drawer.hidden {
    transform: translateX(480px);
    opacity: 0;
    pointer-events: none;
}

.inspector-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.22), rgba(15, 23, 42, 0.85));
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.inspector-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.inspector-close:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
}

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

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

.meta-box {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

.meta-box-val {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.meta-box-lbl {
    font-size: 10.5px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.info-block {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px;
}

.info-block h4 {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-cyan);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.info-block p {
    font-size: 13px;
    line-height: 1.58;
    color: #e2e8f0;
}

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

.zone-chip {
    background: rgba(6, 11, 25, 0.75);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 12px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-pill {
    font-size: 11.5px;
    font-family: var(--font-mono);
    padding: 4px 9px;
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #bae6fd;
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════
   FULL OVERLAY VIEW: LIVE HEALTH MONITOR & OUTAGE CENTER
   ═══════════════════════════════════════════════════════════════════════ */
.health-overlay-view {
    position: fixed;
    top: 82px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1080;
    background: rgba(6, 11, 25, 0.94);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.health-overlay-view.hidden {
    display: none !important;
}

.health-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.health-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 18px;
}

.health-card h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.node-status-list, .incident-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.node-row, .incident-card {
    background: rgba(6, 11, 25, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
}

.incident-card.active-inc {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.08);
}

.sim-btn {
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.sim-btn.active {
    background: rgba(239, 68, 68, 0.22);
    border-color: #ef4444;
    color: #fca5a5;
}

/* ═══════════════════════════════════════════════════════════════════════
   SEPARATE DEDICATED MOBILE & STANDALONE PWA INTERFACE (<= 768px)
   ═══════════════════════════════════════════════════════════════════════ */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block;
    }

    /* Move Leaflet zoom control out of the way of the mobile bottom sheet */
    .leaflet-bottom.leaflet-right {
        bottom: calc(176px + env(safe-area-inset-bottom, 0px)) !important;
        right: 6px !important;
    }

    /* 1. Top Floating Mobile HUD */
    .m-top-hud {
        position: fixed;
        top: calc(8px + env(safe-area-inset-top, 0px));
        left: 10px;
        right: 10px;
        z-index: 1150;
        display: flex;
        flex-direction: column;
        gap: 8px;
        pointer-events: none;
    }

    .m-hud-bar {
        pointer-events: auto;
        background: rgba(8, 13, 28, 0.92);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 8px 11px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65);
    }

    .m-brand {
        display: flex;
        align-items: center;
        gap: 9px;
        min-width: 0;
    }

    .m-brand-icon {
        width: 32px;
        height: 32px;
        border-radius: 9px;
        background: linear-gradient(135deg, rgba(56, 189, 248, 0.24), rgba(16, 185, 129, 0.22));
        border: 1px solid var(--border-bright);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--accent-cyan);
        font-size: 14px;
        flex-shrink: 0;
    }

    .m-brand-title {
        font-size: 13px;
        font-weight: 800;
        letter-spacing: 0.03em;
        color: #fff;
        white-space: nowrap;
    }

    .m-brand-sub {
        font-size: 10.5px;
        color: var(--text-secondary);
        font-family: var(--font-mono);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .m-hud-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    .m-icon-btn {
        width: 33px;
        height: 33px;
        border-radius: 9px;
        border: 1px solid rgba(56, 189, 248, 0.25);
        background: rgba(15, 23, 42, 0.85);
        color: var(--text-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
        cursor: pointer;
    }

    .m-icon-btn.active {
        background: rgba(239, 68, 68, 0.24);
        border-color: #ef4444;
        color: #fca5a5;
    }

    .m-status-pill {
        display: flex;
        align-items: center;
        gap: 5px;
        padding: 5px 9px;
        border-radius: 999px;
        font-family: var(--font-mono);
        font-size: 10.5px;
        font-weight: 700;
        background: rgba(16, 185, 129, 0.16);
        border: 1px solid rgba(16, 185, 129, 0.45);
        color: #34d399;
    }

    .m-status-pill.degraded {
        background: rgba(245, 158, 11, 0.18);
        border-color: #f59e0b;
        color: #fbbf24;
    }

    .m-status-pill.outage {
        background: rgba(239, 68, 68, 0.22);
        border-color: #ef4444;
        color: #f87171;
    }

    .m-quick-chips {
        pointer-events: auto;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .m-quick-chips::-webkit-scrollbar {
        display: none;
    }

    .m-chip {
        padding: 6px 11px;
        border-radius: 999px;
        background: rgba(8, 13, 28, 0.9);
        border: 1px solid rgba(56, 189, 248, 0.22);
        color: var(--text-secondary);
        font-size: 11.5px;
        font-weight: 600;
        white-space: nowrap;
        display: flex;
        align-items: center;
        gap: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
        cursor: pointer;
    }

    .m-chip.active {
        background: rgba(14, 165, 233, 0.28);
        border-color: var(--accent-cyan);
        color: #fff;
    }

    /* 2. Interactive Mobile Bottom Sheet (Peek / Half / Full Snap States) */
    .m-bottom-sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(60px + env(safe-area-inset-bottom, 0px));
        z-index: 1120;
        background: rgba(8, 13, 28, 0.96);
        border-top: 1px solid var(--border-bright);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.72);
        display: flex;
        flex-direction: column;
        transition: height 0.26s cubic-bezier(0.16, 1, 0.3, 1);
        overflow: hidden;
    }

    .m-bottom-sheet.hidden {
        display: none !important;
    }

    .m-bottom-sheet.snap-peek {
        height: 108px;
    }

    .m-bottom-sheet.snap-half {
        height: 48vh;
    }

    .m-bottom-sheet.snap-full {
        height: calc(100vh - 134px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }

    .m-sheet-drag-zone {
        padding: 8px 0 4px;
        display: flex;
        justify-content: center;
        cursor: grab;
        touch-action: none;
    }

    .m-drag-pill {
        width: 40px;
        height: 4px;
        border-radius: 999px;
        background: rgba(148, 163, 184, 0.45);
    }

    .m-sheet-header {
        padding: 4px 16px 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
    }

    .m-sheet-titles {
        min-width: 0;
        flex: 1;
    }

    .m-sheet-badge {
        font-family: var(--font-mono);
        font-size: 10px;
        color: var(--accent-cyan);
        text-transform: uppercase;
        letter-spacing: 0.06em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .m-sheet-title {
        font-size: 16px;
        font-weight: 700;
        color: #fff;
        margin: 2px 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .m-sheet-sub {
        font-size: 11.5px;
        color: var(--text-secondary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .m-sheet-btns {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .m-sheet-btn {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.14);
        background: rgba(255, 255, 255, 0.06);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        cursor: pointer;
    }

    .m-sheet-btn.hidden {
        display: none !important;
    }

    .m-sheet-body {
        flex: 1;
        overflow-y: auto;
        padding: 12px 16px 18px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        -webkit-overflow-scrolling: touch;
    }

    /* 3. Dedicated Mobile Full Screens (Explore & Live Health) */
    .m-screen {
        position: fixed;
        top: calc(64px + env(safe-area-inset-top, 0px));
        left: 0;
        right: 0;
        bottom: calc(60px + env(safe-area-inset-bottom, 0px));
        z-index: 1160;
        background: rgba(6, 11, 25, 0.97);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .m-screen.hidden {
        display: none !important;
    }

    .m-screen-header {
        padding: 12px 14px 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background: rgba(10, 17, 36, 0.95);
    }

    .m-segmented-control {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        background: rgba(6, 11, 25, 0.9);
        padding: 4px;
        border-radius: 10px;
        border: 1px solid var(--border-subtle);
    }

    .m-seg-btn {
        padding: 8px 10px;
        border-radius: 7px;
        border: none;
        background: transparent;
        color: var(--text-secondary);
        font-size: 12px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        cursor: pointer;
    }

    .m-seg-btn.active {
        background: rgba(56, 189, 248, 0.22);
        color: #fff;
        box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
    }

    .m-screen-list {
        flex: 1;
        overflow-y: auto;
        padding: 10px 14px 18px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .m-screen-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 14px;
        -webkit-overflow-scrolling: touch;
    }

    .m-health-hero {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .m-drill-banner {
        background: rgba(245, 158, 11, 0.1);
        border: 1px solid rgba(245, 158, 11, 0.38);
        border-radius: 12px;
        padding: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .m-section-card {
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        padding: 14px;
    }

    .m-section-hdr {
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--accent-cyan);
        margin-bottom: 10px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* 4. Mobile PWA Install Modal */
    .m-pwa-modal {
        position: fixed;
        inset: 0;
        z-index: 1300;
        background: rgba(3, 7, 18, 0.82);
        display: flex;
        align-items: flex-end;
        justify-content: center;
        padding: 14px;
        padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    }

    .m-pwa-modal.hidden {
        display: none !important;
    }

    .m-pwa-card {
        width: 100%;
        max-width: 420px;
        background: #0b1329;
        border: 1px solid var(--border-bright);
        border-radius: 18px;
        padding: 18px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
    }

    .m-pwa-steps {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 14px;
    }

    .m-pwa-step {
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 10px;
        padding: 10px 12px;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 12px;
        line-height: 1.4;
    }

    .m-primary-btn {
        width: 100%;
        padding: 11px;
        border-radius: 10px;
        border: none;
        background: var(--accent-cyan);
        color: #060b19;
        font-weight: 800;
        font-size: 13.5px;
        cursor: pointer;
    }

    /* 5. Native Mobile Bottom Navigation Dock */
    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: calc(60px + env(safe-area-inset-bottom, 0px));
        background: #070d1f;
        border-top: 1px solid var(--border-subtle);
        z-index: 1200;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .mnav-btn {
        background: none;
        border: none;
        color: var(--text-secondary);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        font-size: 10.5px;
        font-weight: 600;
        cursor: pointer;
    }

    .mnav-btn i {
        font-size: 15px;
    }

    .mnav-btn.active {
        color: var(--accent-cyan);
    }
}
