/* ==========================================================================
   CORE & BREACH UI STYLES
   ==========================================================================
   
   Consolidated CSS for Core Status UI and Breach Status UI panels.
   
   This file contains all styles for:
   - #coreStatusUI (Green theme - Core abilities panel)
   - #breachStatusUI (Orange theme - Breach defense panel)
   
   Both panels share:
   - Same width/height dimensions for consistency
   - Sticky tab system with vertical scrolling
   - Collapsible fieldsets
   - Themed color overlays (green vs orange)
   
   Organization:
   1. Shared Base Styles
   2. Theme-Specific Overrides
   3. Close Buttons (uses standardized style from modal.css - red #ff4444)
   4. Headers
   5. Tab System
   6. Tab Content
   7. Fieldsets & Legends
   8. Status Lines
   9. Upgrade Buttons
   10. Ability Sections (Core)
   11. Ability Sections (Breach)
   
   Last Updated: $(date +%Y-%m-%d)
   ========================================================================== */

/* ==========================================================================
   MOTHER UI — Unified Core + Breach Container
   ========================================================================== */

#motherUI {
    --mother-shell-rgb: 0 255 255;
    --mother-tab-rgb: var(--mother-shell-rgb);
    --mother-panel-bg: rgba(2, 11, 12, 0.94);
    --mother-field-rgb: var(--mother-shell-rgb);
    display: none;
    position: absolute;
    flex-direction: column;
    z-index: 2001;
    width: calc(12vw + 20vh);
    max-height: 60vh;
    backdrop-filter: blur(6px) brightness(1.05);
    -webkit-backdrop-filter: blur(6px) brightness(1.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 2px solid var(--dynamic-color, #00ff88);
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2), 0 0 4px rgba(255, 255, 255, 0.06) inset;
    background-color: rgba(3, 10, 12, 0.94);
    background-image: var(--modal-circuit-vein-layers), linear-gradient(135deg, rgba(5, 16, 14, 0.96), rgba(3, 10, 12, 0.94));
    font-size: 12px;
    overflow-y: hidden;
    overflow-x: hidden;
    /* Bottom breathing room lives on .status-tabs (same layer as tab glows) so overflow:hidden here does not clip */
    padding: 1px 0 0;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

#motherUI[data-active-tab="core"] {
    --mother-shell-rgb: 255 68 68;
    --mother-tab-rgb: 255 68 68;
    --mother-field-rgb: 255 150 70;
}

#motherUI[data-active-tab="breach"] {
    --mother-shell-rgb: 0 255 255;
    --mother-tab-rgb: 0 255 255;
    --mother-field-rgb: 0 255 200;
}

#motherUI.is-opening {
    opacity: 1;
    transform: scale(1);
}

#motherUI.is-closing {
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.15s ease-in, transform 0.15s ease-in;
}

#motherUI:hover {
    box-shadow:
        0 0 6px var(--dynamic-color),
        0 0 3px var(--dynamic-color) inset,
        0 2px 10px rgba(0, 0, 0, 0.5);
}

#motherUI::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--dynamic-color), transparent);
    animation: modalScanLine 3s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}

/* ---- Top-Level CORE / BREACH Tab Strip (wave-button solid: thinner military chips) ---- */
.mother-top-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    padding: 5px 10px 5px;
}

/* Scoped to #motherUI so standalone pages aren’t affected */
#motherUI .mother-tab-btn {
    flex: 1;
    padding: 6px 10px;
    line-height: 1;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 0.38em;
    border: 1px solid rgba(100, 130, 140, 0.45);
    background: linear-gradient(180deg, rgba(38, 52, 58, 0.96) 0%, rgba(14, 20, 24, 0.99) 100%);
    color: rgba(190, 210, 218, 0.55);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 2px 12px rgba(0, 0, 0, 0.5);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        color 0.2s ease,
        text-shadow 0.2s ease;
}

/* Inactive chips — muted neon per lane (not flat grey); slightly richer than base for “idle” pop */
#motherUI .mother-tab-btn:not(.active)[data-mother-tab="breach"] {
    color: #8af6ff;
    text-shadow:
        0 0 4px rgba(180, 255, 255, 0.55),
        0 0 10px rgba(0, 255, 255, 0.5),
        0 0 20px rgba(0, 230, 255, 0.22);
    border-color: rgba(100, 235, 255, 0.58);
    background: linear-gradient(180deg,
            rgba(24, 52, 62, 0.97) 0%,
            rgba(10, 32, 42, 0.99) 45%,
            rgba(6, 18, 26, 0.99) 100%);
    box-shadow:
        inset 0 1px 0 rgba(180, 255, 255, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.42),
        0 2px 12px rgba(0, 0, 0, 0.52),
        0 0 18px rgba(0, 255, 255, 0.2),
        0 0 28px rgba(0, 220, 255, 0.08);
}

#motherUI .mother-tab-btn:not(.active)[data-mother-tab="core"] {
    color: #ff9a8f;
    text-shadow:
        0 0 4px rgba(255, 190, 175, 0.52),
        0 0 10px rgba(255, 80, 60, 0.5),
        0 0 20px rgba(255, 40, 40, 0.22);
    border-color: rgba(255, 88, 72, 0.55);
    background: linear-gradient(180deg,
            rgba(58, 24, 22, 0.97) 0%,
            rgba(40, 13, 12, 0.99) 45%,
            rgba(24, 7, 8, 0.99) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 180, 160, 0.11),
        inset 0 -1px 0 rgba(0, 0, 0, 0.42),
        0 2px 12px rgba(0, 0, 0, 0.52),
        0 0 18px rgba(255, 70, 55, 0.18),
        0 0 28px rgba(255, 40, 40, 0.08);
}

#motherUI .mother-tab-btn:not(.active)[data-mother-tab="breach"]:hover {
    color: #d8ffff;
    text-shadow:
        0 0 6px rgba(220, 255, 255, 0.75),
        0 0 14px rgba(0, 255, 255, 0.72),
        0 0 26px rgba(0, 240, 255, 0.42);
    border-color: rgba(140, 250, 255, 0.78);
    background: linear-gradient(180deg, rgba(36, 72, 82, 0.98) 0%, rgba(14, 40, 48, 0.99) 100%);
    box-shadow:
        inset 0 1px 0 rgba(220, 255, 255, 0.18),
        inset 0 -1px 0 rgba(0, 0, 0, 0.32),
        0 0 26px rgba(0, 255, 255, 0.3),
        0 0 40px rgba(0, 230, 255, 0.14),
        0 3px 14px rgba(0, 0, 0, 0.55);
    transform: translateY(-1px);
}

#motherUI .mother-tab-btn:not(.active)[data-mother-tab="core"]:hover {
    color: #ffe1dc;
    text-shadow:
        0 0 6px rgba(255, 210, 200, 0.72),
        0 0 14px rgba(255, 76, 60, 0.68),
        0 0 26px rgba(255, 45, 45, 0.38);
    border-color: rgba(255, 105, 88, 0.74);
    background: linear-gradient(180deg, rgba(72, 32, 28, 0.98) 0%, rgba(44, 14, 13, 0.99) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 205, 190, 0.16),
        inset 0 -1px 0 rgba(0, 0, 0, 0.32),
        0 0 26px rgba(255, 70, 55, 0.3),
        0 0 40px rgba(255, 40, 40, 0.14),
        0 3px 14px rgba(0, 0, 0, 0.55);
    transform: translateY(-1px);
}

/* Breach active — cyan stack like #waveButton.auto-wave-linked */
#motherUI .mother-tab-btn.active[data-mother-tab="breach"] {
    background: linear-gradient(180deg, #00ddff 0%, #00aacc 50%, #007799 100%);
    border-color: #00ffff;
    border-width: 2px;
    color: #001820;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.35),
        0 0 12px rgba(255, 255, 255, 0.35);
    box-shadow:
        0 0 18px rgba(0, 255, 255, 0.78),
        0 0 32px rgba(0, 255, 255, 0.38),
        0 0 48px rgba(0, 240, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.42),
        inset 0 -1px 0 rgba(0, 0, 0, 0.25);
    transform: translateY(0);
}

#motherUI .mother-tab-btn.active[data-mother-tab="breach"]:hover {
    background: linear-gradient(180deg, #00ffff 0%, #00ddff 50%, #00aacc 100%);
    box-shadow:
        0 0 22px rgba(0, 255, 255, 0.92),
        0 0 40px rgba(0, 255, 255, 0.42),
        0 0 56px rgba(0, 240, 255, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* Core active */
#motherUI .mother-tab-btn.active[data-mother-tab="core"] {
    background: linear-gradient(180deg, #ff6a54 0%, #e22d2d 52%, #8f121a 100%);
    border-color: #ff4444;
    border-width: 2px;
    color: #210303;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.35),
        0 0 12px rgba(255, 205, 190, 0.42);
    box-shadow:
        0 0 18px rgba(255, 68, 68, 0.72),
        0 0 32px rgba(255, 40, 40, 0.36),
        0 0 48px rgba(255, 90, 50, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.38),
        inset 0 -1px 0 rgba(0, 0, 0, 0.28);
    transform: translateY(0);
}

#motherUI .mother-tab-btn.active[data-mother-tab="core"]:hover {
    background: linear-gradient(180deg, #ff826c 0%, #ff4444 52%, #b61624 100%);
    box-shadow:
        0 0 22px rgba(255, 75, 75, 0.9),
        0 0 40px rgba(255, 45, 45, 0.42),
        0 0 56px rgba(255, 110, 60, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.48),
        inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

/* ---- Inner Content Areas ---- */
#motherUI .mother-content {
    padding: 3px 14px 0;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

#motherUI .mother-content[style*="display: block"] {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0;
}

/* --- TACTICAL PANEL BACKGROUND ICONS --- */
#motherUI .mother-content {
    position: relative;
    isolation: isolate;
}

/* Base style for the watermark ghost icon */
#motherUI .mother-content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40%);
    width: 220px;
    height: 220px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.05;
    pointer-events: none;
    z-index: -1;
    filter: grayscale(1) brightness(2);
    mask-image: radial-gradient(circle, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle, black 30%, transparent 80%);
}

#motherUI #coreStatusUI.mother-content::after {
    background-image: url('../assets/icons/hub/core_boost.webp');
}

#motherUI #breachStatusUI.mother-content::after {
    background-image: url('../assets/icons/hub/Breach.webp');
}

/* Section titles — same visual weight for Core and Breach inside Mother UI */
#motherUI .mother-content>h3.mother-panel-heading {
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
}

#motherUI #coreStatusUI.mother-content>h3.mother-panel-heading {
    text-shadow:
        0 0 10px rgba(0, 255, 136, 0.45),
        0 0 22px rgba(0, 255, 136, 0.22);
}

#motherUI #breachStatusUI.mother-content>h3.mother-panel-heading {
    text-shadow:
        0 0 10px rgba(0, 255, 255, 0.42),
        0 0 22px rgba(0, 255, 200, 0.2);
}

/* Close lives inside .mother-top-tabs (flex row) — no overlap with CORE */
#motherUI .mother-top-tabs .modal-close-btn {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    min-width: 15px;
    margin: 0 2px 0 8px;
    padding: 0;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    border-width: 1px;
    border-radius: var(--radius-sm, 3px);
    box-shadow: 0 0 5px rgba(255, 68, 68, 0.4);
}

#motherUI .mother-top-tabs .modal-close-btn:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   INNER PANEL STYLES (Core + Breach content inside Mother UI)
   ========================================================================== */

/* Neutralize legacy positioning on inner content divs (now children of #motherUI) */
#motherUI #coreStatusUI,
#motherUI #breachStatusUI {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    z-index: auto !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    margin: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
}

/* Shared base styles for inner content areas */
#coreStatusUI,
#breachStatusUI {
    display: none;
    flex-direction: column;
    font-size: 12px;
    overflow-y: auto;
    overflow-x: hidden;
}

#coreStatusUI.is-opening,
#breachStatusUI.is-opening {
    opacity: 1;
    transform: scale(1);
}

#coreStatusUI.is-closing,
#breachStatusUI.is-closing {
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.15s ease-in, transform 0.15s ease-in;
}

#coreStatusUI:hover,
#breachStatusUI:hover {
    box-shadow: none;
}

@keyframes modalScanLine {
    0% {
        left: -100%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        left: 100%;
        opacity: 0;
    }
}

/* ----- Color-Specific Overrides ----- */

#coreStatusUI {
    --dynamic-color: #00ff88;
}

#breachStatusUI {
    --dynamic-color: #00cccc;
}

/* Placed-tower modal (#towerStatus): layout + spacing live in CBDstyles.css (avoid overrides here). */

/* Core/Breach panel cooldown bars match settings/music progress bar style (see CBDstyles.css .cooldown-bar) */
#coreStatusUI .cooldown-bar,
#breachStatusUI .cooldown-bar {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-radius: 4px;
}

#coreStatusUI .cooldown-fill,
#breachStatusUI .cooldown-fill {
    /* Start → end: blue-cyan (start) to green (end) */
    background: linear-gradient(90deg, rgba(0, 200, 255, 0.9), rgba(0, 255, 136, 0.95));
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(0, 255, 200, 0.4);
}

/* Shared h3 styles - Enhanced for better hierarchy */
#coreStatusUI h3,
#breachStatusUI h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    color: var(--dynamic-color);
    border-bottom: 1px solid var(--dynamic-color);
    background: rgba(0, 0, 0, 0.86);
    padding: 6px 10px;
    border-radius: var(--radius-lg, 6px);
}

/* Desktop only: Draggable panel — whole Mother UI drags via .mother-top-tabs handle */
@media (min-width: 641px) {

    .mother-top-tabs {
        cursor: grab;
        user-select: none;
        position: relative;
        padding-left: 30px;
    }

    /* Drag grip arcs + [DRAGGABLE] badge live in CBDstyles.css (.mother-top-tabs::before, .panel-drag-label) */
    #motherUI .mother-top-tabs {
        --drag-grip-color: rgb(var(--mother-shell-rgb) / 0.92);
    }

    #motherUI #coreStatusUI h3,
    #motherUI #breachStatusUI h3 {
        cursor: default;
        user-select: none;
    }
}

/* Status Panel Tabs - Positioned at bottom, content above */
#coreStatusUI .status-tabs,
#breachStatusUI .status-tabs {
    display: flex;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    overflow: visible;
    flex-wrap: wrap;
    margin-bottom: 0;
    z-index: 5;
    gap: 4px;
    padding: 4px;
    order: 999;
    /* Ensure tabs appear at bottom */
}

/* Core tabs border */
#coreStatusUI .status-tabs {
    border-top: var(--border-width, 2px) solid #00ff00;
    border-bottom: none;
    box-shadow: 0 -2px 8px rgba(0, 255, 0, 0.1);
}

/* Breach tabs border */
#breachStatusUI .status-tabs {
    border-top: var(--border-width, 2px) solid #ff8800;
    border-bottom: none;
    box-shadow: 0 -2px 8px rgba(255, 136, 0, 0.1);
}

/* Mother UI: one shared tab-strip treatment (Core vs Breach standalone panels keep colors above) */
#motherUI #coreStatusUI .status-tabs,
#motherUI #breachStatusUI .status-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    border-top: 2px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 -2px 14px rgba(0, 0, 0, 0.42),
        0 -1px 0 rgba(255, 255, 255, 0.06);
    /* padding-top gives air above tab buttons; avoid margin-top so mobile margin-top:auto still pins strip */
    padding-top: 3px;
    /* Match former #motherUI bottom inset: glow paints into this padding, not past overflow:hidden outer shell */
    padding-bottom: 8px;
    margin-top: auto;
    margin-bottom: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

#motherUI #coreStatusUI .status-tab-btn,
#motherUI #breachStatusUI .status-tab-btn {
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 34px;
    border-radius: 6px;
    white-space: nowrap;
}

/* Shared status tab button base styles
   --tab-accent: space-separated R G B for twin hover/active glow (set per [data-tab]) */
#coreStatusUI .status-tab-btn,
#breachStatusUI .status-tab-btn {
    background: linear-gradient(180deg,
        rgba(32, 42, 48, 0.96) 0%,
        rgba(16, 22, 28, 0.98) 55%,
        rgba(8, 12, 16, 0.99) 100%);
    color: var(--text-color-light);
    padding: 7px 10px;
    cursor: pointer;
    font-family: var(--main-font);
    font-weight: 800;
    letter-spacing: 0.7px;
    font-size: 10.5px;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
    border-top: var(--border-width, 2px) solid transparent;
    border-bottom: none;
    white-space: nowrap;
    flex: 1;
    min-width: 30%;
    border-radius: 0 0 var(--radius-md, 4px) var(--radius-md, 4px);
    position: relative;
    overflow: visible;
    isolation: isolate;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -2px 0 rgba(0, 0, 0, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.55);
}

/* Core tab button colors */
#coreStatusUI .status-tab-btn {
    --tab-accent: 0 255 120;
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-top: 2px solid rgba(0, 255, 0, 0.35);
    flex: 0 0 calc(50% - 2px);
    max-width: calc(50% - 2px);
    color: rgba(140, 255, 180, 0.75);
    text-shadow: 0 0 5px rgba(0, 255, 100, 0.35), 0 0 12px rgba(0, 255, 80, 0.1);
}

#coreStatusUI .status-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.1), transparent);
    transition: left 0.5s ease;
    border-radius: 0 0 var(--radius-md, 4px) var(--radius-md, 4px);
    pointer-events: none;
    z-index: 0;
}

#coreStatusUI .status-tab-btn:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(20, 50, 30, 0.97), rgba(10, 30, 16, 0.99));
    color: #aaffcc;
    border-color: rgba(0, 255, 100, 0.45);
    text-shadow: 0 0 6px rgba(0, 255, 100, 0.5), 0 0 14px rgba(0, 255, 80, 0.2);
    transform: translateY(1px);
}

#coreStatusUI .status-tab-btn.active {
    background: linear-gradient(180deg, rgba(0, 200, 60, 0.35), rgba(0, 120, 40, 0.25) 50%, rgba(0, 60, 20, 0.3));
    color: #00ff66;
    border-color: rgba(0, 255, 100, 0.6);
    border-top: 2px solid #00ff66;
    text-shadow: 0 0 8px rgba(0, 255, 100, 0.7), 0 0 18px rgba(0, 255, 80, 0.3);
    transform: translateY(2px);
    /* Move down when active since tabs are at bottom */
    position: relative;
}

/* Locked tab styling - CLEANED UP for better border-radius support */
#coreStatusUI .status-tab-btn.locked-tab,
#breachStatusUI .status-tab-btn.locked-tab {
    cursor: pointer;
    opacity: 0.7;
    filter: grayscale(0.25) brightness(0.85);
    border: 1px dashed rgba(120, 80, 80, 0.7) !important;
    /* Simple dashed border - no border-image to preserve border-radius */
    border-radius: 0 0 4px 4px !important;
    background: linear-gradient(135deg, rgba(20, 10, 12, 0.95) 0%, rgba(15, 8, 10, 0.92) 100%) !important;
    color: rgba(180, 140, 140, 0.85) !important;
    box-shadow:
        inset 0 0 6px rgba(0, 0, 0, 0.5),
        0 1px 4px rgba(0, 0, 0, 0.3) !important;
    position: relative;
    overflow: hidden;
    /* Removed excessive animations for cleaner look */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Simplified ::before for locked tabs - subtle scan effect */
#coreStatusUI .status-tab-btn.locked-tab::before,
#breachStatusUI .status-tab-btn.locked-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    animation: lockedScanLine 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

#coreStatusUI .status-tab-btn.locked-tab:hover,
#breachStatusUI .status-tab-btn.locked-tab:hover {
    opacity: 0.8;
    border-color: rgba(150, 100, 100, 0.8) !important;
    cursor: not-allowed;
}

#coreStatusUI .status-tab-btn.locked-tab:active,
#breachStatusUI .status-tab-btn.locked-tab:active {
    transform: none;
    opacity: 0.75;
}

/* Remove pulsing animations from locked panels - causes bar flicker/shifting (scanlines kept) */
#coreStatusUI .status-tab-btn.locked-tab,
#breachStatusUI .status-tab-btn.locked-tab {
    animation: none !important;
}

#coreStatusUI .locked-item,
#breachStatusUI .locked-item {
    animation: none !important;
}

#coreStatusUI .locked-item .upgrade-btn:disabled,
#breachStatusUI .locked-item .upgrade-btn:disabled,
#coreStatusUI .locked-item button:disabled,
#breachStatusUI .locked-item button:disabled {
    animation: none !important;
}

/* Breach tab button colors — 2×2 grid matches Core */
#breachStatusUI .status-tab-btn {
    --tab-accent: 0 255 200;
    border: 1px solid rgba(255, 136, 0, 0.3);
    border-top: 2px solid rgba(255, 136, 0, 0.35);
    flex: 0 0 calc(50% - 2px);
    max-width: calc(50% - 2px);
    text-shadow: 0 0 5px rgba(255, 136, 0, 0.35), 0 0 12px rgba(255, 100, 0, 0.1);
}

#breachStatusUI .status-tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 136, 0, 0.1), transparent);
    transition: left 0.5s ease;
    border-radius: 0 0 var(--radius-md, 4px) var(--radius-md, 4px);
    pointer-events: none;
    z-index: 0;
}

#breachStatusUI .status-tab-btn:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(50, 32, 12, 0.97), rgba(28, 16, 6, 0.99));
    color: #ffbb66;
    border-color: rgba(255, 160, 40, 0.45);
    text-shadow: 0 0 6px rgba(255, 150, 40, 0.5), 0 0 14px rgba(255, 120, 0, 0.2);
    transform: translateY(1px);
}

#breachStatusUI .status-tab-btn.active {
    background: linear-gradient(180deg, rgba(200, 100, 0, 0.3), rgba(120, 60, 0, 0.22) 50%, rgba(60, 30, 0, 0.28));
    color: #ff9922;
    border-color: rgba(255, 153, 34, 0.6);
    border-top: 2px solid #ff8800;
    text-shadow: 0 0 8px rgba(255, 136, 0, 0.7), 0 0 18px rgba(255, 100, 0, 0.3);
    transform: translateY(2px);
    /* Move down when active since tabs are at bottom */
    position: relative;
}

/* Arrow indicators removed - just text, no arrows */

/* ==============================================
   TAB COLOR STYLING - Match Panel Colors
   ============================================== */

/* Core Ability Tabs */

/* Overclock Tab - Orange (#ffa500) */
#coreStatusUI .status-tab-btn[data-tab="overclock"] {
    --tab-accent: 255 165 0;
    border-color: rgba(255, 165, 0, 0.3) !important;
    color: rgba(255,200,120,0.7) !important;
    text-shadow: 0 0 4px rgba(255,165,0,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="overclock"]::before {
    background: linear-gradient(90deg, transparent, rgba(255, 165, 0, 0.06), transparent) !important;
}

#coreStatusUI .status-tab-btn[data-tab="overclock"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(52,36,12,0.97), rgba(28,18,4,0.99)) !important;
    color: #ffcc77 !important;
    border-color: rgba(255, 165, 0, 0.45) !important;
    text-shadow: 0 0 6px rgba(255,165,0,0.5), 0 0 14px rgba(255,130,0,0.2) !important;
}

#coreStatusUI .status-tab-btn[data-tab="overclock"].active {
    background: linear-gradient(180deg, rgba(200,130,0,0.3), rgba(120,75,0,0.22) 50%, rgba(60,38,0,0.28)) !important;
    color: #ffa500 !important;
    border-top: 2px solid #ffa500 !important;
    border-color: rgba(255,165,0,0.6) !important;
    text-shadow: 0 0 8px rgba(255,165,0,0.7), 0 0 18px rgba(255,130,0,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="overclock"].locked-tab {
    border-color: rgba(255, 165, 0, 0.5) !important;
    color: rgba(255, 165, 0, 0.7) !important;
}

/* Breach panel: EMP tab (cyan-teal, matches Breach node) */
#breachStatusUI .status-tab-btn[data-tab="emp-blast"] {
    --tab-accent: 0 255 200;
    border-color: rgba(0, 255, 200, 0.3) !important;
    color: rgba(140,255,230,0.7) !important;
    text-shadow: 0 0 4px rgba(0,255,200,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="emp-blast"]::before {
    background: linear-gradient(90deg, transparent, rgba(0, 255, 200, 0.06), transparent) !important;
}

#breachStatusUI .status-tab-btn[data-tab="emp-blast"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(12,52,42,0.97), rgba(4,28,22,0.99)) !important;
    color: #aaffee !important;
    border-color: rgba(0, 255, 200, 0.45) !important;
    text-shadow: 0 0 6px rgba(0,255,200,0.5), 0 0 14px rgba(0,255,180,0.2) !important;
}

#breachStatusUI .status-tab-btn[data-tab="emp-blast"].active {
    background: linear-gradient(180deg, rgba(0,200,160,0.3), rgba(0,120,90,0.22) 50%, rgba(0,60,45,0.28)) !important;
    color: #00ffc8 !important;
    border-top: 2px solid #00ffc8 !important;
    border-color: rgba(0, 255, 200, 0.6) !important;
    text-shadow: 0 0 8px rgba(0,255,200,0.7), 0 0 18px rgba(0,255,180,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="emp-blast"].locked-tab {
    border-color: rgba(0, 255, 200, 0.45) !important;
    color: rgba(170, 255, 238, 0.65) !important;
}

/* Ram Trap — magenta (matches ability accent) */
#breachStatusUI .status-tab-btn[data-tab="ram-trap"] {
    --tab-accent: 255 95 200;
    border-color: rgba(255, 80, 200, 0.3) !important;
    color: rgba(255,160,225,0.7) !important;
    text-shadow: 0 0 4px rgba(255,80,200,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="ram-trap"]::before {
    background: linear-gradient(90deg, transparent, rgba(255, 80, 200, 0.06), transparent) !important;
}

#breachStatusUI .status-tab-btn[data-tab="ram-trap"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(52,16,42,0.97), rgba(28,6,22,0.99)) !important;
    color: #ffaadd !important;
    border-color: rgba(255, 100, 210, 0.45) !important;
    text-shadow: 0 0 6px rgba(255,80,200,0.5), 0 0 14px rgba(255,60,180,0.2) !important;
}

#breachStatusUI .status-tab-btn[data-tab="ram-trap"].active {
    background: linear-gradient(180deg, rgba(200,60,160,0.3), rgba(120,30,90,0.22) 50%, rgba(60,15,45,0.28)) !important;
    color: #ff50c8 !important;
    border-top: 2px solid #ff66cc !important;
    border-color: rgba(255, 100, 210, 0.6) !important;
    text-shadow: 0 0 8px rgba(255,80,200,0.7), 0 0 18px rgba(255,60,180,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="ram-trap"].locked-tab {
    border-color: rgba(255, 100, 180, 0.45) !important;
    color: rgba(255, 170, 220, 0.65) !important;
}

/* Pathfinder — cyan (consistent with breach tech accent) */
#breachStatusUI .status-tab-btn[data-tab="pathfinder"] {
    --tab-accent: 0 205 255;
    border-color: rgba(0, 200, 255, 0.3) !important;
    color: rgba(140,230,255,0.7) !important;
    text-shadow: 0 0 4px rgba(0,200,255,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="pathfinder"]::before {
    background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.06), transparent) !important;
}

#breachStatusUI .status-tab-btn[data-tab="pathfinder"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(12,42,52,0.97), rgba(4,22,28,0.99)) !important;
    color: #aaeeff !important;
    border-color: rgba(0, 210, 255, 0.45) !important;
    text-shadow: 0 0 6px rgba(0,200,255,0.5), 0 0 14px rgba(0,180,255,0.2) !important;
}

#breachStatusUI .status-tab-btn[data-tab="pathfinder"].active {
    background: linear-gradient(180deg, rgba(0,160,200,0.3), rgba(0,90,120,0.22) 50%, rgba(0,45,60,0.28)) !important;
    color: #00ddff !important;
    border-top: 2px solid #00ccff !important;
    border-color: rgba(0, 210, 255, 0.6) !important;
    text-shadow: 0 0 8px rgba(0,200,255,0.7), 0 0 18px rgba(0,180,255,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="pathfinder"].locked-tab {
    border-color: rgba(0, 180, 230, 0.45) !important;
    color: rgba(150, 220, 255, 0.65) !important;
}

/* SAM Defense — orange */
#breachStatusUI .status-tab-btn[data-tab="sam-defense"] {
    --tab-accent: 255 145 60;
    border-color: rgba(255, 150, 60, 0.3) !important;
    color: rgba(255,190,120,0.7) !important;
    text-shadow: 0 0 4px rgba(255,150,60,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="sam-defense"]::before {
    background: linear-gradient(90deg, transparent, rgba(255, 150, 60, 0.06), transparent) !important;
}

#breachStatusUI .status-tab-btn[data-tab="sam-defense"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(52,32,12,0.97), rgba(28,16,4,0.99)) !important;
    color: #ffcc99 !important;
    border-color: rgba(255, 160, 70, 0.45) !important;
    text-shadow: 0 0 6px rgba(255,150,60,0.5), 0 0 14px rgba(255,120,30,0.2) !important;
}

#breachStatusUI .status-tab-btn[data-tab="sam-defense"].active {
    background: linear-gradient(180deg, rgba(200,110,30,0.3), rgba(120,65,15,0.22) 50%, rgba(60,32,8,0.28)) !important;
    color: #ff9933 !important;
    border-top: 2px solid #ff9933 !important;
    border-color: rgba(255, 160, 70, 0.6) !important;
    text-shadow: 0 0 8px rgba(255,150,60,0.7), 0 0 18px rgba(255,120,30,0.3) !important;
}

#breachStatusUI .status-tab-btn[data-tab="sam-defense"].locked-tab {
    border-color: rgba(255, 140, 60, 0.45) !important;
    color: rgba(255, 200, 160, 0.68) !important;
}

#breachStatusUI .ram-trap-section .upgrade-btn:hover:not(:disabled) {
    box-shadow: 0 0 10px rgba(255, 80, 200, 0.35) !important;
}

#breachStatusUI .breach-pathfinder-section .upgrade-btn:hover:not(:disabled) {
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.35) !important;
}

#breachStatusUI .breach-sam-section .upgrade-btn:hover:not(:disabled) {
    box-shadow: 0 0 10px rgba(255, 150, 60, 0.35) !important;
}

/* Core panel scoped hover shadows - match section accent colors */
#coreStatusUI .overclock-section .upgrade-btn:hover:not(:disabled) {
    box-shadow: 0 0 10px rgba(255, 165, 0, 0.35) !important;
}

#coreStatusUI .drone-section .upgrade-btn:hover:not(:disabled),
#coreStatusUI .drone-section .drone-action-btn:hover:not(:disabled),
#coreStatusUI .drone-section .drone-upgrade-btn:hover:not(:disabled) {
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.35) !important;
}

#coreStatusUI .critter-section .upgrade-btn:hover:not(:disabled) {
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.35) !important;
}

#coreStatusUI .boss-critter-section .upgrade-btn:hover:not(:disabled) {
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.35) !important;
}

/* Drones Tab - Cyan (#00ffff) */
#coreStatusUI .status-tab-btn[data-tab="drones"] {
    --tab-accent: 0 255 255;
    border-color: rgba(0, 255, 255, 0.3) !important;
    color: rgba(140,255,255,0.7) !important;
    text-shadow: 0 0 4px rgba(0,255,255,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="drones"]::before {
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.06), transparent) !important;
}

#coreStatusUI .status-tab-btn[data-tab="drones"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(12,42,52,0.97), rgba(4,22,28,0.99)) !important;
    color: #aaffff !important;
    border-color: rgba(0, 255, 255, 0.45) !important;
    text-shadow: 0 0 6px rgba(0,255,255,0.5), 0 0 14px rgba(0,230,255,0.2) !important;
}

#coreStatusUI .status-tab-btn[data-tab="drones"].active {
    background: linear-gradient(180deg, rgba(0,200,200,0.3), rgba(0,120,120,0.22) 50%, rgba(0,60,60,0.28)) !important;
    color: #00ffff !important;
    border-top: 2px solid #00ffff !important;
    border-color: rgba(0,255,255,0.6) !important;
    text-shadow: 0 0 8px rgba(0,255,255,0.7), 0 0 18px rgba(0,230,255,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="drones"].locked-tab {
    border-color: rgba(0, 255, 255, 0.5) !important;
    color: rgba(0, 255, 255, 0.7) !important;
}

/* Critters Tab - Yellow (#ffff00) */
#coreStatusUI .status-tab-btn[data-tab="critters"] {
    --tab-accent: 255 255 0;
    border-color: rgba(255, 255, 0, 0.3) !important;
    color: rgba(255,255,140,0.7) !important;
    text-shadow: 0 0 4px rgba(255,255,0,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="critters"]::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 0, 0.06), transparent) !important;
}

#coreStatusUI .status-tab-btn[data-tab="critters"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(52,52,12,0.97), rgba(28,28,4,0.99)) !important;
    color: #ffffaa !important;
    border-color: rgba(255, 255, 0, 0.45) !important;
    text-shadow: 0 0 6px rgba(255,255,0,0.5), 0 0 14px rgba(255,230,0,0.2) !important;
}

#coreStatusUI .status-tab-btn[data-tab="critters"].active {
    background: linear-gradient(180deg, rgba(200,200,0,0.3), rgba(120,120,0,0.22) 50%, rgba(60,60,0,0.28)) !important;
    color: #ffff00 !important;
    border-top: 2px solid #ffff00 !important;
    border-color: rgba(255,255,0,0.6) !important;
    text-shadow: 0 0 8px rgba(255,255,0,0.7), 0 0 18px rgba(255,230,0,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="critters"].locked-tab {
    border-color: rgba(255, 255, 0, 0.5) !important;
    color: rgba(255, 255, 0, 0.7) !important;
}

/* Boss Critter Tab - Red (#ff0000 / #be0527) */
#coreStatusUI .status-tab-btn[data-tab="boss-critter"] {
    --tab-accent: 255 60 60;
    border-color: rgba(255, 0, 0, 0.3) !important;
    color: rgba(255,140,140,0.7) !important;
    text-shadow: 0 0 4px rgba(255,0,0,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="boss-critter"]::before {
    background: linear-gradient(90deg, transparent, rgba(255, 0, 0, 0.06), transparent) !important;
}

#coreStatusUI .status-tab-btn[data-tab="boss-critter"]:hover:not(.locked-tab) {
    background: linear-gradient(180deg, rgba(52,12,12,0.97), rgba(28,4,4,0.99)) !important;
    color: #ffaaaa !important;
    border-color: rgba(255, 0, 0, 0.45) !important;
    text-shadow: 0 0 6px rgba(255,0,0,0.5), 0 0 14px rgba(255,30,30,0.2) !important;
}

#coreStatusUI .status-tab-btn[data-tab="boss-critter"].active {
    background: linear-gradient(180deg, rgba(200,0,0,0.3), rgba(120,0,0,0.22) 50%, rgba(60,0,0,0.28)) !important;
    color: #ff3333 !important;
    border-top: 2px solid #ff0000 !important;
    border-color: rgba(255,0,0,0.6) !important;
    text-shadow: 0 0 8px rgba(255,0,0,0.7), 0 0 18px rgba(255,30,30,0.3) !important;
}

#coreStatusUI .status-tab-btn[data-tab="boss-critter"].locked-tab {
    border-color: rgba(255, 0, 0, 0.5) !important;
    color: rgba(255, 0, 0, 0.7) !important;
}

/* Idle: every ability tab gets accent drop shadow (not only .active — avoids "only EMP glows") */
#coreStatusUI .status-tab-btn[data-tab]:not(.locked-tab),
#breachStatusUI .status-tab-btn[data-tab]:not(.locked-tab) {
    box-shadow:
        0 0 18px rgb(var(--tab-accent) / 0.3),
        0 2px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgb(var(--tab-accent) / 0.14) !important;
}

/* Twin glow — same layered shadow for Core & Breach; [data-tab] keeps specificity ≥ CBDstyles breach one-liners */
#coreStatusUI .status-tab-btn[data-tab]:hover:not(.locked-tab),
#breachStatusUI .status-tab-btn[data-tab]:hover:not(.locked-tab) {
    z-index: 2;
    box-shadow:
        0 -7px 22px rgb(var(--tab-accent) / 0.5),
        0 0 34px rgb(var(--tab-accent) / 0.32),
        0 3px 14px rgba(0, 0, 0, 0.45) !important;
}

#coreStatusUI .status-tab-btn[data-tab].active:not(.locked-tab),
#breachStatusUI .status-tab-btn[data-tab].active:not(.locked-tab) {
    z-index: 1;
    box-shadow:
        0 -5px 20px rgb(var(--tab-accent) / 0.44),
        0 0 36px rgb(var(--tab-accent) / 0.44),
        inset 0 0 20px rgb(var(--tab-accent) / 0.14) !important;
}

/* Mother UI only — stronger neon on ability row; gap above bottom tabs kept modest */
#motherUI #coreStatusUI .status-tab-content,
#motherUI #breachStatusUI .status-tab-content {
    margin-bottom: 1px;
    max-height: none !important;
    overflow: visible !important;
    flex: 0 0 auto;
}

/* Mother UI — ~half vertical rhythm inside Core/Breach (fieldsets, legends, stat rows, bottom chips) */
#motherUI #coreStatusUI fieldset,
#motherUI #breachStatusUI fieldset {
    padding: 2px 10px;
    margin: 1px 0;
}

#motherUI #coreStatusUI fieldset.collapsed,
#motherUI #breachStatusUI fieldset.collapsed {
    padding: 2px 10px;
}

#motherUI #coreStatusUI fieldset legend,
#motherUI #breachStatusUI fieldset legend {
    margin-bottom: 2px !important;
    padding: 2px 6px !important;
}

#motherUI #coreStatusUI .status-line,
#motherUI #breachStatusUI .status-line {
    padding: 2px 0;
    gap: 4px;
}

#motherUI #coreStatusUI .status-tab-btn,
#motherUI #breachStatusUI .status-tab-btn {
    padding: 5px 12px;
}

#motherUI #coreStatusUI .status-tab-btn.locked-tab,
#motherUI #breachStatusUI .status-tab-btn.locked-tab,
#motherUI #coreStatusUI .locked-item,
#motherUI #breachStatusUI .locked-item {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

#motherUI #coreStatusUI button:not(.modal-close-btn),
#motherUI #breachStatusUI button:not(.modal-close-btn),
#motherUI #coreStatusUI .upgrade-btn,
#motherUI #breachStatusUI .upgrade-btn {
    padding: 4px 10px !important;
}

#motherUI #coreStatusUI .status-tab-btn[data-tab]:not(.locked-tab),
#motherUI #breachStatusUI .status-tab-btn[data-tab]:not(.locked-tab) {
    box-shadow:
        0 0 24px rgb(var(--tab-accent) / 0.42),
        0 2px 16px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgb(var(--tab-accent) / 0.2) !important;
}

#motherUI #coreStatusUI .status-tab-btn[data-tab]:hover:not(.locked-tab),
#motherUI #breachStatusUI .status-tab-btn[data-tab]:hover:not(.locked-tab) {
    box-shadow:
        0 -9px 28px rgb(var(--tab-accent) / 0.58),
        0 0 44px rgb(var(--tab-accent) / 0.4),
        0 3px 16px rgba(0, 0, 0, 0.5) !important;
}

#motherUI #coreStatusUI .status-tab-btn[data-tab].active:not(.locked-tab),
#motherUI #breachStatusUI .status-tab-btn[data-tab].active:not(.locked-tab) {
    box-shadow:
        0 -7px 26px rgb(var(--tab-accent) / 0.52),
        0 0 46px rgb(var(--tab-accent) / 0.52),
        inset 0 0 24px rgb(var(--tab-accent) / 0.18) !important;
}

/* Status tab content - appears above tabs */
#coreStatusUI .status-tab-content,
#breachStatusUI .status-tab-content {
    animation: fadeIn 0.3s ease-out;
    overflow-y: auto;
    max-height: calc(70vh - 150px);
    order: 1;
    /* Content appears before tabs */
    margin-bottom: 8px;
}

/* Shared fieldset base styles */
#coreStatusUI fieldset,
#breachStatusUI fieldset {
    border-radius: var(--radius-md, 4px);
    padding: 8px 12px;
    margin: 4px 0;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Core fieldset colors */
#coreStatusUI fieldset {
    border: var(--border-width, 2px) solid rgba(0, 255, 0, 0.6);
    border-bottom: var(--border-width, 2px) solid rgba(0, 255, 0, 0.8);
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.03), rgba(0, 255, 0, 0.08));
}

/* Breach fieldset colors */
#breachStatusUI fieldset {
    border: var(--border-width, 2px) solid rgba(255, 136, 0, 0.6);
    border-bottom: var(--border-width, 2px) solid rgba(255, 136, 0, 0.8);
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.03), rgba(255, 136, 0, 0.08));
}

/* Enhanced styling for collapsed fieldsets */
#coreStatusUI fieldset.collapsed {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.12), rgba(0, 255, 0, 0.18));
    border-color: rgba(0, 255, 0, 0.8);
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3), inset 0 0 4px rgba(0, 255, 0, 0.1);
    padding: 6px 12px;
}

#coreStatusUI fieldset.collapsed:hover {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.18), rgba(0, 255, 0, 0.25));
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.4), inset 0 0 6px rgba(0, 255, 0, 0.15);
    transform: translateY(-1px);
}

#breachStatusUI fieldset.collapsed {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.12), rgba(255, 136, 0, 0.18));
    border-color: rgba(255, 136, 0, 0.8);
    box-shadow: 0 0 8px rgba(255, 136, 0, 0.3), inset 0 0 4px rgba(255, 136, 0, 0.1);
    padding: 6px 12px;
}

#breachStatusUI fieldset.collapsed:hover {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.18), rgba(255, 136, 0, 0.25));
    box-shadow: 0 0 12px rgba(255, 136, 0, 0.4), inset 0 0 6px rgba(255, 136, 0, 0.15);
    transform: translateY(-1px);
}

/* Shared collapsible fieldset content */
#coreStatusUI fieldset .fieldset-content,
#breachStatusUI fieldset .fieldset-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

#coreStatusUI fieldset.collapsed .fieldset-content,
#breachStatusUI fieldset.collapsed .fieldset-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Shared legend styling */
#coreStatusUI fieldset legend,
#breachStatusUI fieldset legend {
    user-select: none;
    position: relative;
    padding: 2% 8px;
    margin-bottom: 0;
    pointer-events: none;
    border: var(--border-width, 2px) solid;
}

#coreStatusUI fieldset legend::after,
#coreStatusUI fieldset.collapsed legend::after,
#breachStatusUI fieldset legend::after,
#breachStatusUI fieldset.collapsed legend::after {
    display: none;
    /* Removed collapse indicator */
}

/* Shared fieldset scan line effect */
#coreStatusUI fieldset::before,
#breachStatusUI fieldset::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-size: cover;
    animation: scan 3s infinite;
}

/* Core fieldset scan line color */
#coreStatusUI fieldset::before {
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.2), transparent);
}

/* Breach fieldset scan line color */
#breachStatusUI fieldset::before {
    background: linear-gradient(90deg, transparent, rgba(255, 136, 0, 0.2), transparent);
}

/* Shared legend base styles */
#coreStatusUI legend,
#breachStatusUI legend {
    font-weight: 600;
    padding: 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-radius: var(--radius-sm, 3px);
    color: var(--dynamic-color);
    text-shadow: 0 0 4px var(--dynamic-color);
}

/* Core legend background */
#coreStatusUI legend {
    background: rgba(5, 15, 5, 0.9);
}

/* Breach legend background */
#breachStatusUI legend {
    background: rgba(15, 8, 0, 0.9);
}

/* Shared status-line base styles (Core/Breach only — tower modal uses flex in CBDstyles.css) */
#coreStatusUI .status-line,
#breachStatusUI .status-line {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

/* ========================================================================== */
/*   BASE BUTTON & TEXT STYLES - Sweet Spot Between Versions
   ========================================================================== */

/* Base button styling for all buttons in Core/Breach panels (excluding close button) */
#coreStatusUI button:not(.modal-close-btn),
#breachStatusUI button:not(.modal-close-btn),
#coreStatusUI .upgrade-btn,
#breachStatusUI .upgrade-btn {
    padding: 6px 12px !important;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.5)) !important;
    border: var(--border-width, 2px) solid rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    font-family: inherit !important;
    font-size: 8px !important;
    font-weight: 400 !important;
    text-transform: uppercase !important;
    border-radius: 1em !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    overflow: hidden !important;
    transform: scale(1) !important;
}

/* Sweep effect on hover for upgrade buttons */
#coreStatusUI .upgrade-btn::before,
#breachStatusUI .upgrade-btn::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent) !important;
    transition: left 0.5s ease !important;
}

#coreStatusUI .upgrade-btn:hover:not(:disabled)::before,
#breachStatusUI .upgrade-btn:hover:not(:disabled)::before {
    left: 100% !important;
}

/* Button hover states - lower glow so buttons stay readable (match tower modal) */
#coreStatusUI button:hover:not(:disabled):not(.modal-close-btn),
#breachStatusUI button:hover:not(:disabled):not(.modal-close-btn),
#coreStatusUI .upgrade-btn:hover:not(:disabled),
#breachStatusUI .upgrade-btn:hover:not(:disabled) {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

/* Button active/click states (excluding close button) */
#coreStatusUI button:active:not(.modal-close-btn),
#breachStatusUI button:active:not(.modal-close-btn) {
    transform: translateY(0) !important;
}

/* Disabled button state */
#coreStatusUI button:disabled,
#breachStatusUI button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Status line labels - smaller, consistent sizing */
#coreStatusUI .status-line .label,
#breachStatusUI .status-line .label {
    font-size: 8px !important;
    font-weight: 600 !important;
    opacity: 0.85 !important;
}

/* Status line values - GREEN numbering with less glow */
#coreStatusUI .status-line .value,
#breachStatusUI .status-line .value {
    font-size: 7px !important;
    font-weight: 700 !important;
    color: #00ff00 !important;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.4) !important;
}

/* Legend/Fieldset titles - reduced size */
#coreStatusUI fieldset legend,
#breachStatusUI fieldset legend {
    font-size: 12px !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
}


/* ========================================================================== */
/*   CORE ABILITY SECTIONS
   ========================================================================== */

.overclock-section {
    border-color: rgba(255, 165, 0, 0.6) !important;
    border-bottom: 3px solid rgba(255, 165, 0, 0.6) !important;
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.05), rgba(255, 165, 0, 0.1)) !important;
}

.overclock-section-header {
    color: #ffa500 !important;
    text-shadow: 0 0 6px rgba(255, 165, 0, 0.5) !important;
}

.overclock-section .status-line .label {
    color: #ffa500 !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(255, 165, 0, 0.6) !important;
}

.overclock-section .upgrade-btn {
    border-color: rgba(255, 165, 0, 0.6) !important;
    color: #ffa500 !important;
}

.overclock-section .upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffa500, #ff8c00) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #ffa500, 0 0 3px #ffa500 inset !important;
    text-shadow: none !important;
}

/* EMP Section Styling - Cyan-Teal theme (Breach only) */
.emp-section {
    border-color: rgba(0, 255, 200, 0.6) !important;
    border-bottom: 3px solid rgba(0, 255, 200, 0.6) !important;
    background: linear-gradient(135deg, rgba(0, 255, 200, 0.05), rgba(0, 255, 200, 0.1)) !important;
}

.emp-section-header {
    color: #00ffc8 !important;
    text-shadow: 0 0 6px rgba(0, 255, 200, 0.5) !important;
}

.emp-section .status-line .label {
    color: #aaffee !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(0, 255, 200, 0.6) !important;
}

.emp-section .upgrade-btn {
    border-color: rgba(0, 255, 200, 0.6) !important;
    color: #00ffc8 !important;
}

.emp-section .upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #00ffc8, #00d4a8) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #00ffc8, 0 0 3px #00ffc8 inset !important;
    text-shadow: none !important;
}

/* Ram Trap Section Styling - Magenta theme */
.ram-trap-section {
    border-color: rgba(255, 80, 200, 0.6) !important;
    border-bottom: 3px solid rgba(255, 80, 200, 0.6) !important;
    background: linear-gradient(135deg, rgba(255, 80, 200, 0.05), rgba(255, 80, 200, 0.1)) !important;
}

.ram-trap-section-header {
    color: #ff66cc !important;
    text-shadow: 0 0 6px rgba(255, 80, 200, 0.5) !important;
}

.ram-trap-section .status-line .label {
    color: #ff88dd !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(255, 80, 200, 0.6) !important;
}

.ram-trap-section .upgrade-btn {
    border-color: rgba(255, 80, 200, 0.6) !important;
    color: #ff66cc !important;
}

.ram-trap-section .upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff66cc, #e055b8) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #ff66cc, 0 0 3px #ff66cc inset !important;
    text-shadow: none !important;
}

/* SAM Defense Section Styling - Orange theme */
.breach-sam-section {
    border-color: rgba(255, 150, 60, 0.6) !important;
    border-bottom: 3px solid rgba(255, 150, 60, 0.6) !important;
    background: linear-gradient(135deg, rgba(255, 150, 60, 0.05), rgba(255, 150, 60, 0.1)) !important;
}

.breach-sam-legend {
    color: #ff9933 !important;
    text-shadow: 0 0 6px rgba(255, 150, 60, 0.5) !important;
}

.breach-sam-section .status-line .label {
    color: #ffaa66 !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(255, 150, 60, 0.6) !important;
}

.breach-sam-section .upgrade-btn {
    border-color: rgba(255, 150, 60, 0.6) !important;
    color: #ff9933 !important;
}

.breach-sam-section .upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff9933, #e07820) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #ff9933, 0 0 3px #ff9933 inset !important;
    text-shadow: none !important;
}

/* Pathfinder Section Styling - Cyan-blue theme */
.breach-pathfinder-section {
    border-color: rgba(0, 200, 255, 0.6) !important;
    border-bottom: 3px solid rgba(0, 200, 255, 0.6) !important;
    background: linear-gradient(135deg, rgba(0, 200, 255, 0.05), rgba(0, 200, 255, 0.1)) !important;
}

.breach-pathfinder-legend {
    color: #00ccff !important;
    text-shadow: 0 0 6px rgba(0, 200, 255, 0.5) !important;
}

.breach-pathfinder-section .status-line .label {
    color: #66ddff !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(0, 200, 255, 0.6) !important;
}

.breach-pathfinder-section .upgrade-btn {
    border-color: rgba(0, 200, 255, 0.6) !important;
    color: #00ccff !important;
}

.breach-pathfinder-section .upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #00ccff, #00a8d4) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #00ccff, 0 0 3px #00ccff inset !important;
    text-shadow: none !important;
}

.boss-critter-section {
    border-color: rgba(255, 0, 0, 0.6) !important;
    border-bottom: 3px solid rgba(255, 0, 0, 0.6) !important;
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.05), rgba(255, 0, 0, 0.1)) !important;
}

.boss-critter-section-header {
    color: #ff0000 !important;
    text-shadow: 0 0 6px rgba(255, 0, 0, 0.5) !important;
}

.boss-critter-section .status-line .label {
    color: #ff0000 !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.6) !important;
}

.boss-critter-section .upgrade-btn {
    border-color: rgba(255, 0, 0, 0.6) !important;
    color: #ff0000 !important;
}

.boss-critter-section .upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff0000, #cc0000) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #ff0000, 0 0 3px #ff0000 inset !important;
    text-shadow: none !important;
}

/* Drone Section Styling - Cyan theme */
.drone-section {
    border-color: rgba(0, 255, 255, 0.6) !important;
    border-bottom: 3px solid rgba(0, 255, 255, 0.6) !important;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.05), rgba(0, 255, 255, 0.1)) !important;
}

.drone-section-header {
    color: #00ffff !important;
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.5) !important;
}

.drone-section .status-line .label {
    color: #00ffff !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.6) !important;
}

.drone-section .upgrade-btn,
.drone-section .drone-action-btn,
.drone-section .drone-upgrade-btn {
    border-color: rgba(0, 255, 255, 0.6) !important;
    color: #00ffff !important;
}

.drone-section .upgrade-btn:hover:not(:disabled),
.drone-section .drone-action-btn:hover:not(:disabled),
.drone-section .drone-upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #00ffff, #00cccc) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #00ffff, 0 0 3px #00ffff inset !important;
    text-shadow: none !important;
}

/* Critter Section Styling - Yellow theme */
.critter-section {
    border-color: rgba(255, 255, 0, 0.6) !important;
    border-bottom: 3px solid rgba(255, 255, 0, 0.6) !important;
    background: linear-gradient(135deg, rgba(255, 255, 0, 0.05), rgba(255, 255, 0, 0.1)) !important;
}

.critter-section-header {
    color: #ffff00 !important;
    text-shadow: 0 0 6px rgba(255, 255, 0, 0.5) !important;
}

.critter-section .status-line .label {
    color: #ffff00 !important;
    opacity: 0.9;
    text-shadow: 0 0 8px rgba(255, 255, 0, 0.6) !important;
}

.critter-section .upgrade-btn {
    border-color: rgba(255, 255, 0, 0.6) !important;
    color: #ffff00 !important;
}

.critter-section .upgrade-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ffff00, #cccc00) !important;
    color: #ffffff !important;
    box-shadow: 0 0 6px #ffff00, 0 0 3px #ffff00 inset !important;
    text-shadow: none !important;
}

/* ==========================================================================
   MOTHER UI — ability panels share Overclock layout + button treatment
   (spacing, grid gaps, multi-slot upgrade rows, locked fieldset weight)
   ========================================================================== */

#motherUI #coreStatusUI .fieldset-layout,
#motherUI #breachStatusUI .fieldset-layout {
    gap: 6px;
    margin: 0 0 4px 0;
    align-items: start;
}

#motherUI #coreStatusUI .actions-container:not(.compact-buttons),
#motherUI #breachStatusUI .actions-container:not(.compact-buttons) {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

#motherUI #coreStatusUI .actions-container.compact-buttons,
#motherUI #breachStatusUI .actions-container.compact-buttons {
    margin-top: 2px !important;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
    align-items: stretch;
}

/* Critter (6 upgrades): 3×2 grid reads cleaner than 2×3 in the Mother shell */
#motherUI #coreStatusUI .critter-section .actions-container.compact-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Pathfinder (5 upgrades): 3 + 2 layout */
#motherUI #breachStatusUI .breach-pathfinder-section .actions-container.compact-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#motherUI #coreStatusUI .actions-container.compact-buttons .upgrade-btn,
#motherUI #breachStatusUI .actions-container.compact-buttons .upgrade-btn {
    min-height: 2.65em;
    justify-self: stretch;
    align-self: stretch;
}

/* Locked ability fieldsets in Mother — same visual weight as Overclock locked */
#motherUI #coreStatusUI fieldset.locked-item,
#motherUI #breachStatusUI fieldset.locked-item {
    border-image: none !important;
}

#motherUI #coreStatusUI .locked-item.drone-section,
#motherUI #coreStatusUI .locked-item.drone-section.drone-evolution-scout,
#motherUI #coreStatusUI .locked-item.drone-section.drone-evolution-recon,
#motherUI #coreStatusUI .locked-item.drone-section.drone-evolution-hunter,
#motherUI #coreStatusUI .locked-item.drone-section.drone-evolution-wraith,
#motherUI #coreStatusUI .locked-item.drone-section.drone-evolution-stalker,
#motherUI #coreStatusUI .locked-item.drone-section.drone-evolution-sentinel,
#motherUI #coreStatusUI .locked-item.drone-section.drone-evolution-apex {
    border: 1px dashed rgba(0, 255, 255, 0.8) !important;
    border-bottom: 1px dashed rgba(0, 255, 255, 0.8) !important;
    background: rgba(0, 255, 255, 0.18) !important;
}

#motherUI #coreStatusUI .locked-item.boss-critter-section {
    border: 1px dashed rgba(255, 0, 0, 0.8) !important;
    border-bottom: 1px dashed rgba(255, 0, 0, 0.8) !important;
    background: rgba(190, 5, 39, 0.18) !important;
}

#motherUI #coreStatusUI .locked-item.critter-section {
    border: 1px dashed rgba(255, 255, 0, 0.8) !important;
    border-bottom: 1px dashed rgba(255, 255, 0, 0.8) !important;
    background: rgba(255, 255, 0, 0.18) !important;
}

#motherUI #breachStatusUI .locked-item.emp-section {
    border: 1px dashed rgba(0, 255, 200, 0.8) !important;
    border-bottom: 1px dashed rgba(0, 255, 200, 0.8) !important;
    background: rgba(0, 255, 200, 0.18) !important;
}

#motherUI #breachStatusUI .locked-item.ram-trap-section {
    border: 1px dashed rgba(255, 80, 200, 0.85) !important;
    border-bottom: 1px dashed rgba(255, 80, 200, 0.85) !important;
    background: rgba(255, 80, 200, 0.18) !important;
}

#motherUI #breachStatusUI .locked-item.breach-sam-section {
    border: 1px dashed rgba(255, 150, 60, 0.8) !important;
    border-bottom: 1px dashed rgba(255, 150, 60, 0.8) !important;
    background: rgba(255, 150, 60, 0.18) !important;
}

#motherUI #breachStatusUI .locked-item.breach-pathfinder-section {
    border: 1px dashed rgba(0, 200, 255, 0.8) !important;
    border-bottom: 1px dashed rgba(0, 200, 255, 0.8) !important;
    background: rgba(0, 200, 255, 0.18) !important;
}

#motherUI #coreStatusUI fieldset.locked-item .fieldset-layout,
#motherUI #breachStatusUI fieldset.locked-item .fieldset-layout {
    gap: 4px;
}

#motherUI #coreStatusUI fieldset.locked-item .actions-container.compact-buttons,
#motherUI #breachStatusUI fieldset.locked-item .actions-container.compact-buttons {
    margin-top: 0 !important;
    gap: 4px;
}

#motherUI #coreStatusUI fieldset.locked-item .actions-container:not(.compact-buttons) .upgrade-btn,
#motherUI #breachStatusUI fieldset.locked-item .actions-container:not(.compact-buttons) .upgrade-btn {
    min-height: 28px;
}

#motherUI #coreStatusUI fieldset.locked-item .actions-container.compact-buttons .upgrade-btn,
#motherUI #breachStatusUI fieldset.locked-item .actions-container.compact-buttons .upgrade-btn,
#motherUI #coreStatusUI fieldset.locked-item .upgrade-btn,
#motherUI #breachStatusUI fieldset.locked-item .upgrade-btn {
    font-size: clamp(7px, 0.78vw, 9px) !important;
    line-height: 1.08 !important;
}

#motherUI #coreStatusUI fieldset.locked-item .unlock-progress-container,
#motherUI #breachStatusUI fieldset.locked-item .unlock-progress-container {
    margin-top: 0;
}

#motherUI {
    border: 1px solid rgb(var(--mother-shell-rgb) / 0.34);
    border-top: 2px solid rgb(var(--mother-shell-rgb) / 0.82);
    background-color: var(--mother-panel-bg);
    background-image:
        var(--modal-circuit-vein-layers),
        linear-gradient(135deg, rgba(0, 22, 24, 0.92), rgba(0, 6, 8, 0.96) 58%, rgba(0, 20, 11, 0.9));
    box-shadow:
        0 0 18px rgb(var(--mother-shell-rgb) / 0.16),
        0 14px 34px rgba(0, 0, 0, 0.52),
        inset 0 1px 0 rgb(var(--mother-shell-rgb) / 0.12);
}

#motherUI::after {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 6px;
    pointer-events: none;
    --modal-frame-rgb: var(--mother-shell-rgb);
    background: var(--modal-corner-frame-layers);
    opacity: var(--modal-corner-frame-opacity, 0.85);
}

#motherUI:hover {
    box-shadow:
        0 0 22px rgb(var(--mother-shell-rgb) / 0.22),
        0 14px 34px rgba(0, 0, 0, 0.54),
        inset 0 1px 0 rgb(var(--mother-shell-rgb) / 0.16);
}

#motherUI::before {
    height: 2px;
    background: linear-gradient(90deg, transparent, rgb(var(--mother-shell-rgb) / 0.88), transparent);
    opacity: 0.9;
}

#motherUI .mother-top-tabs {
    position: relative;
    gap: 8px;
    padding: 12px 10px 7px 28px;
    border-bottom: 1px solid rgb(var(--mother-shell-rgb) / 0.2);
    background:
        linear-gradient(90deg, rgb(var(--mother-shell-rgb) / 0.08), transparent 40%),
        rgba(0, 0, 0, 0.34);
}

#motherUI .mother-top-tabs::after {
    content: 'COMMAND PANEL';
    position: absolute;
    top: 2px;
    left: 32px;
    font-size: 6px;
    line-height: 1;
    letter-spacing: 1.5px;
    color: rgb(var(--mother-shell-rgb) / 0.62);
    text-shadow: 0 0 5px rgb(var(--mother-shell-rgb) / 0.28);
    pointer-events: none;
}

#motherUI .mother-tab-btn {
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 5px;
    border: 1px solid rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.48);
    background:
        linear-gradient(180deg, rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.18), rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.07)),
        rgba(0, 10, 12, 0.72);
    color: rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.82);
    text-shadow: 0 0 7px rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.44);
    box-shadow:
        0 0 14px rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.14),
        inset 0 1px 0 rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.13);
}

#motherUI .mother-tab-btn[data-mother-tab="breach"] {
    --mother-tab-rgb: 0 255 255;
}

#motherUI .mother-tab-btn[data-mother-tab="core"] {
    --mother-tab-rgb: 255 68 68;
}

#motherUI .mother-tab-btn:not(.active)[data-mother-tab="breach"],
#motherUI .mother-tab-btn:not(.active)[data-mother-tab="core"] {
    background:
        linear-gradient(180deg, rgb(var(--mother-tab-rgb) / 0.12), rgb(var(--mother-tab-rgb) / 0.04)),
        rgba(0, 9, 10, 0.72);
    border-color: rgb(var(--mother-tab-rgb) / 0.42);
    color: rgb(var(--mother-tab-rgb) / 0.68);
    box-shadow:
        0 0 10px rgb(var(--mother-tab-rgb) / 0.1),
        inset 0 1px 0 rgb(var(--mother-tab-rgb) / 0.1);
}

#motherUI .mother-tab-btn:not(.active)[data-mother-tab="breach"]:hover,
#motherUI .mother-tab-btn:not(.active)[data-mother-tab="core"]:hover {
    color: rgb(var(--mother-tab-rgb) / 0.96);
    border-color: rgb(var(--mother-tab-rgb) / 0.72);
    background:
        linear-gradient(180deg, rgb(var(--mother-tab-rgb) / 0.2), rgb(var(--mother-tab-rgb) / 0.07)),
        rgba(0, 11, 12, 0.78);
    box-shadow:
        0 0 16px rgb(var(--mother-tab-rgb) / 0.18),
        inset 0 1px 0 rgb(var(--mother-tab-rgb) / 0.16);
    transform: translateY(-1px);
}

#motherUI .mother-tab-btn.active[data-mother-tab="breach"],
#motherUI .mother-tab-btn.active[data-mother-tab="core"] {
    border-width: 1px;
    color: rgba(0, 22, 24, 0.92);
    background:
        linear-gradient(180deg, rgb(var(--mother-tab-rgb) / 0.98), rgb(var(--mother-tab-rgb) / 0.68)),
        rgb(var(--mother-tab-rgb) / 0.82);
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.42),
        0 0 10px rgba(255, 255, 255, 0.24);
    box-shadow:
        0 0 18px rgb(var(--mother-tab-rgb) / 0.54),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.24);
}

#motherUI .mother-tab-btn.active[data-mother-tab="breach"]:hover,
#motherUI .mother-tab-btn.active[data-mother-tab="core"]:hover {
    box-shadow:
        0 0 22px rgb(var(--mother-tab-rgb) / 0.62),
        inset 0 1px 0 rgba(255, 255, 255, 0.48),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

#motherUI .mother-top-tabs .modal-close-btn {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 5px;
    font-size: 14px;
}

#motherUI .mother-content {
    padding: 6px 10px 7px;
}

#motherUI #coreStatusUI .status-tab-content,
#motherUI #breachStatusUI .status-tab-content {
    margin-bottom: 6px;
}

#motherUI #coreStatusUI .status-tabs,
#motherUI #breachStatusUI .status-tabs {
    gap: 6px;
    padding: 7px 6px 8px;
    border-top: 1px solid rgb(var(--mother-shell-rgb) / 0.18);
    background:
        linear-gradient(180deg, rgb(var(--mother-shell-rgb) / 0.08), rgba(0, 0, 0, 0.42)),
        rgba(0, 4, 6, 0.82);
    box-shadow:
        inset 0 1px 0 rgb(var(--mother-shell-rgb) / 0.08),
        0 -4px 16px rgba(0, 0, 0, 0.35);
}

#motherUI #coreStatusUI .status-tab-btn,
#motherUI #breachStatusUI .status-tab-btn {
    min-height: 34px;
    padding: 6px 8px !important;
    border-radius: 6px !important;
    border: 1px solid rgb(var(--tab-accent) / 0.44) !important;
    background:
        linear-gradient(180deg, rgb(var(--tab-accent) / 0.13), rgb(var(--tab-accent) / 0.045)),
        rgba(0, 8, 10, 0.82) !important;
    color: rgb(var(--tab-accent) / 0.78) !important;
    text-shadow: 0 0 5px rgb(var(--tab-accent) / 0.38) !important;
    box-shadow:
        0 0 10px rgb(var(--tab-accent) / 0.12),
        inset 0 1px 0 rgb(var(--tab-accent) / 0.1) !important;
    transform: none !important;
}

#motherUI #coreStatusUI .status-tab-btn[data-tab]:hover:not(.locked-tab),
#motherUI #breachStatusUI .status-tab-btn[data-tab]:hover:not(.locked-tab) {
    color: rgb(var(--tab-accent) / 0.96) !important;
    border-color: rgb(var(--tab-accent) / 0.68) !important;
    box-shadow:
        0 0 15px rgb(var(--tab-accent) / 0.22),
        inset 0 1px 0 rgb(var(--tab-accent) / 0.14) !important;
    transform: translateY(-1px) !important;
}

#motherUI #coreStatusUI .status-tab-btn[data-tab].active:not(.locked-tab),
#motherUI #breachStatusUI .status-tab-btn[data-tab].active:not(.locked-tab) {
    color: rgb(var(--tab-accent) / 0.98) !important;
    border-color: rgb(var(--tab-accent) / 0.78) !important;
    background:
        linear-gradient(180deg, rgb(var(--tab-accent) / 0.22), rgb(var(--tab-accent) / 0.08)),
        rgba(0, 10, 12, 0.9) !important;
    box-shadow:
        0 0 20px rgb(var(--tab-accent) / 0.3),
        inset 0 0 14px rgb(var(--tab-accent) / 0.08) !important;
}

#motherUI #coreStatusUI .status-tab-btn.locked-tab,
#motherUI #breachStatusUI .status-tab-btn.locked-tab {
    opacity: 0.62;
    border-style: solid !important;
    border-color: rgb(var(--tab-accent, 255 80 80) / 0.3) !important;
    color: rgb(var(--tab-accent, 255 80 80) / 0.52) !important;
    background:
        linear-gradient(180deg, rgb(var(--tab-accent, 255 80 80) / 0.08), rgba(0, 0, 0, 0.56)),
        rgba(4, 4, 5, 0.78) !important;
    box-shadow:
        0 0 8px rgb(var(--tab-accent, 255 80 80) / 0.08),
        inset 0 0 8px rgba(0, 0, 0, 0.35) !important;
}

#motherUI #coreStatusUI .fieldset-layout,
#motherUI #breachStatusUI .fieldset-layout {
    gap: 7px;
}

#motherUI #coreStatusUI .overclock-section { --mother-field-rgb: 255 165 0; }
#motherUI #coreStatusUI .critter-section { --mother-field-rgb: 255 255 0; }
#motherUI #coreStatusUI .drone-section { --mother-field-rgb: 0 255 255; }
#motherUI #coreStatusUI .boss-critter-section { --mother-field-rgb: 255 52 70; }
#motherUI #breachStatusUI .emp-section { --mother-field-rgb: 0 255 200; }
#motherUI #breachStatusUI .ram-trap-section { --mother-field-rgb: 255 80 200; }
#motherUI #breachStatusUI .breach-pathfinder-section { --mother-field-rgb: 0 200 255; }
#motherUI #breachStatusUI .breach-sam-section { --mother-field-rgb: 255 150 60; }

#motherUI #coreStatusUI fieldset,
#motherUI #breachStatusUI fieldset,
#motherUI #coreStatusUI fieldset.locked-item,
#motherUI #breachStatusUI fieldset.locked-item {
    margin: 0 0 4px;
    padding: 6px 10px 8px;
    border: 1px solid rgb(var(--mother-field-rgb) / 0.58) !important;
    border-bottom: 1px solid rgb(var(--mother-field-rgb) / 0.58) !important;
    border-radius: 6px;
    background:
        linear-gradient(135deg, rgb(var(--mother-field-rgb) / 0.07), transparent 48%),
        rgba(0, 7, 8, 0.72) !important;
    box-shadow:
        0 0 14px rgb(var(--mother-field-rgb) / 0.12),
        inset 0 0 18px rgb(var(--mother-field-rgb) / 0.035) !important;
}

#motherUI #coreStatusUI fieldset::before,
#motherUI #breachStatusUI fieldset::before {
    background: linear-gradient(90deg, transparent, rgb(var(--mother-field-rgb) / 0.12), transparent) !important;
    opacity: 0.7;
    pointer-events: none;
}

#motherUI #coreStatusUI fieldset legend,
#motherUI #breachStatusUI fieldset legend,
#motherUI #coreStatusUI fieldset.locked-item legend,
#motherUI #breachStatusUI fieldset.locked-item legend {
    max-width: calc(100% - 18px);
    margin-bottom: 6px !important;
    padding: 2px 10px !important;
    border: 1px solid rgb(var(--mother-field-rgb) / 0.68) !important;
    border-radius: 4px;
    background: rgba(0, 7, 8, 0.94) !important;
    color: rgb(var(--mother-field-rgb) / 0.96) !important;
    font-size: 11px !important;
    line-height: 1.05;
    text-shadow: 0 0 7px rgb(var(--mother-field-rgb) / 0.42) !important;
}

#motherUI #coreStatusUI .actions-container:not(.compact-buttons),
#motherUI #breachStatusUI .actions-container:not(.compact-buttons) {
    gap: 5px;
}

#motherUI #coreStatusUI .actions-container.compact-buttons,
#motherUI #breachStatusUI .actions-container.compact-buttons {
    gap: 6px;
}

#motherUI #coreStatusUI button:not(.modal-close-btn),
#motherUI #breachStatusUI button:not(.modal-close-btn),
#motherUI #coreStatusUI .upgrade-btn,
#motherUI #breachStatusUI .upgrade-btn,
#motherUI #coreStatusUI fieldset.locked-item .upgrade-btn,
#motherUI #breachStatusUI fieldset.locked-item .upgrade-btn {
    min-height: 30px;
    padding: 5px 9px !important;
    border-radius: 7px !important;
    border: 1px solid rgb(var(--mother-field-rgb) / 0.48) !important;
    background:
        linear-gradient(180deg, rgba(0, 20, 18, 0.86), rgba(0, 4, 5, 0.92)) !important;
    color: rgba(235, 255, 250, 0.86) !important;
    font-size: clamp(7px, 0.72vw, 9px) !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
    text-shadow: 0 0 4px rgba(230, 255, 250, 0.25) !important;
    box-shadow:
        0 0 9px rgb(var(--mother-field-rgb) / 0.08),
        inset 0 1px 0 rgb(var(--mother-field-rgb) / 0.08) !important;
}

#motherUI #coreStatusUI .actions-container:not(.compact-buttons) .upgrade-btn,
#motherUI #breachStatusUI .actions-container:not(.compact-buttons) .upgrade-btn {
    border-color: rgb(var(--mother-field-rgb) / 0.72) !important;
    color: rgb(var(--mother-field-rgb) / 0.96) !important;
    box-shadow:
        0 0 14px rgb(var(--mother-field-rgb) / 0.18),
        inset 0 1px 0 rgb(var(--mother-field-rgb) / 0.12) !important;
}

#motherUI #coreStatusUI .upgrade-btn:hover:not(:disabled),
#motherUI #breachStatusUI .upgrade-btn:hover:not(:disabled),
#motherUI #coreStatusUI button:hover:not(:disabled):not(.modal-close-btn),
#motherUI #breachStatusUI button:hover:not(:disabled):not(.modal-close-btn) {
    color: #ffffff !important;
    border-color: rgb(var(--mother-field-rgb) / 0.78) !important;
    background:
        linear-gradient(180deg, rgb(var(--mother-field-rgb) / 0.22), rgba(0, 8, 10, 0.94)) !important;
    box-shadow:
        0 0 16px rgb(var(--mother-field-rgb) / 0.24),
        inset 0 1px 0 rgb(var(--mother-field-rgb) / 0.14) !important;
    transform: translateY(-1px) !important;
}

#motherUI #coreStatusUI button:disabled,
#motherUI #breachStatusUI button:disabled {
    opacity: 0.46 !important;
}

#motherUI #coreStatusUI .stats-container,
#motherUI #breachStatusUI .stats-container {
    gap: 3px;
    padding: 2px 0 0;
}

#motherUI #coreStatusUI .stats-row,
#motherUI #breachStatusUI .stats-row {
    gap: 8px;
}

#motherUI #coreStatusUI .status-line,
#motherUI #breachStatusUI .status-line,
#motherUI #coreStatusUI fieldset.locked-item .status-line,
#motherUI #breachStatusUI fieldset.locked-item .status-line {
    min-height: 17px;
    padding: 2px 0 !important;
    border-bottom: 1px solid rgb(var(--mother-field-rgb) / 0.16);
}

#motherUI #coreStatusUI .status-line .label,
#motherUI #breachStatusUI .status-line .label,
#motherUI #coreStatusUI fieldset.locked-item .status-line .label,
#motherUI #breachStatusUI fieldset.locked-item .status-line .label {
    color: rgba(176, 255, 232, 0.74) !important;
    font-size: clamp(7px, 0.66vw, 8.5px) !important;
    text-shadow: 0 0 4px rgb(var(--mother-field-rgb) / 0.24) !important;
}

#motherUI #coreStatusUI .status-line .value,
#motherUI #breachStatusUI .status-line .value,
#motherUI #coreStatusUI fieldset.locked-item .status-line .value,
#motherUI #breachStatusUI fieldset.locked-item .status-line .value {
    color: #00ff66 !important;
    font-size: clamp(7px, 0.66vw, 8.5px) !important;
    text-shadow: 0 0 5px rgba(0, 255, 80, 0.36) !important;
}

#motherUI #coreStatusUI .cooldown-bar,
#motherUI #breachStatusUI .cooldown-bar {
    width: 100%;
    height: 7px;
    min-height: 7px;
    margin: 6px 0 0;
    flex-shrink: 0;
    border-color: rgb(var(--mother-field-rgb) / 0.34);
    background: rgba(0, 0, 0, 0.46);
}

#motherUI #coreStatusUI .fieldset-layout > .cooldown-bar,
#motherUI #breachStatusUI .fieldset-layout > .cooldown-bar {
    align-self: stretch;
}

#motherUI #coreStatusUI .cooldown-fill,
#motherUI #breachStatusUI .cooldown-fill {
    background: linear-gradient(90deg, #00d8ff, #00ff88);
    box-shadow: 0 0 8px rgb(var(--mother-field-rgb) / 0.28);
}

#motherUI #coreStatusUI .unlock-progress-container,
#motherUI #breachStatusUI .unlock-progress-container {
    margin-top: 4px;
    padding: 4px;
    border: 1px solid rgba(255, 170, 0, 0.28);
    background: rgba(20, 12, 0, 0.36);
    box-shadow: inset 0 0 8px rgba(255, 170, 0, 0.06);
}

/* ==========================================================================
   MOBILE RESPONSIVE - Bottom Center Positioning
   ========================================================================== */

@media (max-width: 640px) {

    /*
     * Mobile Mother UI — match HOLD V2 Core/Breach phone layout:
     * bottom: 10px, 98vw, translateX(-50%), compact height (~24vh panel + tab strip).
     * Inner #coreStatusUI / #breachStatusUI stay position:static inside Mother (flex fill).
     */
    #motherUI {
        position: fixed !important;
        bottom: 10px !important;
        left: 50% !important;
        right: auto !important;
        top: auto !important;
        transform: translateX(-50%) scale(0.94) !important;
        width: 98vw !important;
        max-width: 98vw !important;
        height: auto !important;
        min-height: 22vh;
        max-height: 26vh;
        padding: 0;
        overflow: hidden;
        z-index: 2001;
        background-color: rgba(3, 10, 12, 0.94);
        background-image: var(--modal-circuit-vein-layers), linear-gradient(135deg, rgba(5, 16, 14, 0.96), rgba(3, 10, 12, 0.94));
        font-size: 10px;
        display: flex;
        flex-direction: column;
    }

    #motherUI.is-opening {
        opacity: 1 !important;
        transform: translateX(-50%) scale(1) !important;
    }

    #motherUI.is-closing {
        opacity: 0 !important;
        transform: translateX(-50%) scale(0.94) !important;
    }

    .mother-top-tabs {
        position: sticky;
        top: 0;
        z-index: 5;
        background: rgba(3, 10, 12, 0.98);
        padding: 4px 8px 4px;
    }

    #motherUI .mother-tab-btn {
        padding: 5px 8px;
        font-size: 10px;
        letter-spacing: 0.9px;
        line-height: 1;
    }

    #motherUI .mother-top-tabs .modal-close-btn {
        width: 16px;
        height: 16px;
        min-width: 16px;
        font-size: 11px;
    }

    #motherUI .mother-content {
        padding: 2px 8px;
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
    }

    /* Neutralize legacy CBDstyles positioning — inner divs fill Mother UI's flex space */
    #motherUI #coreStatusUI,
    #motherUI #breachStatusUI {
        position: static !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        transform: none !important;
        width: 100% !important;
        height: 100% !important;
        z-index: auto !important;
        min-height: 0 !important;
    }

    /* Only the active panel becomes a flex column — leaves display:none intact on hidden panel */
    #motherUI #coreStatusUI[style*="display: block"],
    #motherUI #breachStatusUI[style*="display: block"] {
        display: flex !important;
        flex-direction: column !important;
    }

    /* Sticky tabs at bottom for mobile */
    #coreStatusUI .status-tabs,
    #breachStatusUI .status-tabs {
        order: 999;
        margin-top: auto;
        margin-bottom: 0;
        position: sticky;
        bottom: 0;
        background: inherit;
        z-index: 10;
    }

    /* Tab content above tabs */
    #coreStatusUI .status-tab-content,
    #breachStatusUI .status-tab-content {
        order: 1;
        margin-bottom: 2px;
        /* Reduced from 4px */
    }

    #motherUI #coreStatusUI .status-tab-content,
    #motherUI #breachStatusUI .status-tab-content {
        margin-bottom: 3px;
    }

    /* Compact tab buttons on mobile — 2 per row like desktop */
    #coreStatusUI .status-tab-btn,
    #breachStatusUI .status-tab-btn {
        flex: 0 0 calc(50% - 2px);
        max-width: calc(50% - 2px);
        min-width: calc(50% - 2px);
        padding: 6px 8px;
        font-size: 9px;
        white-space: normal;
        line-height: 1.15;
    }

    /* Compact upgrade buttons on mobile */
    #coreStatusUI .upgrade-btn,
    #breachStatusUI .upgrade-btn {
        padding: 6px 10px;
        /* Reduced vertical padding */
        font-size: 10px;
    }

    /* Header adjustments for mobile */
    #coreStatusUI h3,
    #breachStatusUI h3 {
        width: 100%;
        font-size: 11px;
        /* Reduced from 14px */
        margin-bottom: 2px;
        /* Reduced from 4px */
        padding: 3px 2px;
        /* Reduced padding */
    }

}

@media (max-width: 760px), (max-width: 920px) and (max-height: 540px) {
    #motherUI {
        position: fixed !important;
        left: 50% !important;
        right: auto !important;
        bottom: 5px !important;
        top: auto !important;
        transform: translateX(-50%) scale(0.94) !important;
        width: calc(100vw - 12px) !important;
        max-width: 900px !important;
        height: clamp(168px, 29vh, 226px) !important;
        height: clamp(168px, 29dvh, 226px) !important;
        min-height: 0 !important;
        max-height: 31vh !important;
        max-height: 31dvh !important;
        padding: 0 !important;
        border-radius: 6px;
        overflow: hidden !important;
        background-color: rgba(2, 12, 14, 0.96);
        background-image:
            var(--modal-circuit-vein-layers),
            linear-gradient(135deg, rgba(0, 32, 34, 0.95), rgba(2, 10, 13, 0.98) 58%, rgba(0, 26, 10, 0.95));
    }

    #motherUI.is-opening {
        transform: translateX(-50%) scale(1) !important;
    }

    #motherUI.is-closing {
        transform: translateX(-50%) scale(0.94) !important;
    }

    #motherUI .mother-top-tabs {
        flex: 0 0 auto;
        gap: 5px;
        padding: 4px 7px 4px;
        background: linear-gradient(180deg, rgba(0, 22, 26, 0.98), rgba(0, 8, 10, 0.96));
        border-bottom: 1px solid rgba(0, 255, 255, 0.22);
    }

    #motherUI .mother-tab-btn {
        min-height: 27px;
        padding: 5px 8px;
        font-size: clamp(8px, 1.9vw, 10.5px);
        letter-spacing: 1px;
        border-radius: 5px;
    }

    #motherUI .mother-top-tabs .modal-close-btn {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 15px;
        border-radius: 5px;
    }

    #motherUI .mother-content {
        display: none;
        min-height: 0;
        flex: 1 1 auto;
        padding: 2px 7px 6px !important;
        overflow: hidden;
    }

    #motherUI #coreStatusUI[style*="display: block"],
    #motherUI #breachStatusUI[style*="display: block"] {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 4px;
    }

    #motherUI #coreStatusUI.mother-content > h3.mother-panel-heading,
    #motherUI #breachStatusUI.mother-content > h3.mother-panel-heading {
        display: none !important;
    }

    #motherUI #coreStatusUI .status-tabs,
    #motherUI #breachStatusUI .status-tabs {
        order: 0 !important;
        position: static !important;
        bottom: auto !important;
        margin: 0 !important;
        padding: 4px !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        border-top: none !important;
        border-bottom: 1px solid rgba(0, 255, 255, 0.28);
        background:
            linear-gradient(90deg, rgba(0, 255, 255, 0.08), rgba(0, 255, 120, 0.06)),
            rgba(0, 0, 0, 0.42);
        box-shadow:
            0 0 7px rgba(0, 255, 255, 0.1),
            inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    }

    #motherUI #coreStatusUI .status-tab-btn,
    #motherUI #breachStatusUI .status-tab-btn {
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        min-height: 25px;
        padding: 4px 5px !important;
        border-radius: 4px !important;
        font-size: clamp(7.8px, 1.65vw, 9.5px) !important;
        line-height: 1.05;
        letter-spacing: 0.55px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border-top-width: 1px !important;
        transform: none !important;
        text-shadow: 0 0 4px rgb(var(--tab-accent) / 0.35) !important;
        box-shadow:
            0 0 7px rgb(var(--tab-accent) / 0.16),
            0 1px 7px rgba(0, 0, 0, 0.42),
            inset 0 1px 0 rgb(var(--tab-accent) / 0.16) !important;
    }

    #motherUI #coreStatusUI .status-tab-btn[data-tab].active:not(.locked-tab),
    #motherUI #breachStatusUI .status-tab-btn[data-tab].active:not(.locked-tab) {
        box-shadow:
            0 0 10px rgb(var(--tab-accent) / 0.28),
            inset 0 0 14px rgb(var(--tab-accent) / 0.12) !important;
    }

    #motherUI #coreStatusUI .status-tab-content,
    #motherUI #breachStatusUI .status-tab-content {
        order: 1 !important;
        min-height: 0;
        height: 100%;
        margin: 0 !important;
        overflow: hidden !important;
    }

    #motherUI #coreStatusUI .status-tab-content[style*="display: block"],
    #motherUI #breachStatusUI .status-tab-content[style*="display: block"] {
        display: block !important;
    }

    #motherUI #coreStatusUI .status-tab-content fieldset,
    #motherUI #breachStatusUI .status-tab-content fieldset {
        min-height: 0;
        height: 100%;
        margin: 0 !important;
        padding: 2px 7px 4px !important;
        display: flex;
        flex-direction: column;
        border-radius: 6px;
        box-shadow:
            0 0 8px rgba(0, 255, 220, 0.16),
            inset 0 0 10px rgba(0, 255, 180, 0.05) !important;
    }

    #motherUI #coreStatusUI fieldset legend,
    #motherUI #breachStatusUI fieldset legend {
        max-width: 72%;
        padding: 1px 7px !important;
        margin-bottom: 3px;
        font-size: clamp(6.5px, 1.45vw, 8.5px) !important;
        line-height: 1.05;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #motherUI #coreStatusUI .status-tab-content .fieldset-content,
    #motherUI #breachStatusUI .status-tab-content .fieldset-content {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
        padding: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        scrollbar-width: thin;
    }

    #motherUI #coreStatusUI .fieldset-layout,
    #motherUI #breachStatusUI .fieldset-layout {
        flex: 0 0 auto;
        min-height: 0;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px;
        margin: 0 !important;
        align-items: stretch;
    }

    #motherUI #coreStatusUI .stats-container,
    #motherUI #breachStatusUI .stats-container {
        order: 1;
        flex: 0 0 auto;
        min-width: 0;
        min-height: 0;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: min-content;
        gap: 3px;
        padding: 3px;
        border: 1px solid rgba(0, 255, 255, 0.22);
        border-radius: 5px;
        background:
            linear-gradient(180deg, rgba(0, 255, 255, 0.08), rgba(0, 255, 140, 0.035)),
            rgba(0, 0, 0, 0.28);
        box-shadow: inset 0 0 10px rgba(0, 255, 200, 0.05);
        overflow: hidden;
    }

    #motherUI #coreStatusUI .stats-row,
    #motherUI #breachStatusUI .stats-row {
        display: contents;
    }

    #motherUI #coreStatusUI .status-line,
    #motherUI #breachStatusUI .status-line {
        min-width: 0;
        min-height: 15px;
        padding: 1px 4px !important;
        gap: 3px;
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 4px;
        background: rgba(0, 0, 0, 0.3);
    }

    #motherUI #coreStatusUI .status-line .label,
    #motherUI #breachStatusUI .status-line .label {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: clamp(6px, 1.28vw, 7.3px) !important;
    }

    #motherUI #coreStatusUI .status-line .value,
    #motherUI #breachStatusUI .status-line .value {
        font-size: clamp(6.8px, 1.46vw, 8.4px) !important;
        white-space: nowrap;
    }

    #motherUI #coreStatusUI .actions-container:not(.compact-buttons),
    #motherUI #breachStatusUI .actions-container:not(.compact-buttons) {
        order: 2;
        flex: 0 0 auto;
        min-width: 0;
        position: static;
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        gap: 5px;
        padding: 3px;
        border: 1px solid rgba(0, 255, 220, 0.18);
        border-radius: 5px;
        background:
            linear-gradient(180deg, rgba(0, 255, 220, 0.11), rgba(0, 0, 0, 0.84)),
            rgba(0, 8, 10, 0.9);
        align-self: stretch;
    }

    #motherUI #coreStatusUI .actions-container.compact-buttons,
    #motherUI #breachStatusUI .actions-container.compact-buttons,
    #motherUI #coreStatusUI .critter-section .actions-container.compact-buttons,
    #motherUI #breachStatusUI .breach-pathfinder-section .actions-container.compact-buttons {
        order: 3;
        flex: 0 0 auto;
        min-width: 0;
        min-height: 0;
        margin-top: 0 !important;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 4px;
        align-content: stretch;
        align-self: stretch;
    }

    #motherUI #coreStatusUI .upgrade-btn,
    #motherUI #breachStatusUI .upgrade-btn,
    #motherUI #coreStatusUI button:not(.modal-close-btn),
    #motherUI #breachStatusUI button:not(.modal-close-btn) {
        min-height: 24px;
        width: 100%;
        padding: 4px 5px !important;
        border-radius: 5px !important;
        font-size: clamp(7.8px, 1.65vw, 10px) !important;
        line-height: 1.12 !important;
        letter-spacing: 0.2px;
        white-space: normal !important;
        word-break: normal !important;
        text-align: center;
        box-shadow:
            0 1px 5px rgba(0, 0, 0, 0.48),
            inset 0 0 8px rgba(0, 255, 180, 0.05) !important;
    }

    #motherUI #coreStatusUI .actions-container:not(.compact-buttons) .upgrade-btn,
    #motherUI #breachStatusUI .actions-container:not(.compact-buttons) .upgrade-btn {
        min-height: 32px;
        font-size: clamp(8.5px, 1.82vw, 11px) !important;
        font-weight: 800 !important;
        border-radius: 6px !important;
    }

    #motherUI #coreStatusUI .unlock-progress-container,
    #motherUI #breachStatusUI .unlock-progress-container {
        order: 5;
        flex: 0 0 auto;
        margin-top: 2px;
        padding: 3px 2px 2px;
    }

    #motherUI #coreStatusUI .unlock-progress-bar,
    #motherUI #breachStatusUI .unlock-progress-bar {
        height: 4px;
        margin-bottom: 1px;
    }

    #motherUI #coreStatusUI .unlock-progress-text,
    #motherUI #breachStatusUI .unlock-progress-text {
        font-size: 9px;
        line-height: 1.1;
    }

    /* Cooldown bar — always last in panel layout (stats → action → upgrades → bar) */
    #motherUI #coreStatusUI .fieldset-layout > .cooldown-bar,
    #motherUI #breachStatusUI .fieldset-layout > .cooldown-bar,
    #motherUI #coreStatusUI .fieldset-content > .cooldown-bar,
    #motherUI #breachStatusUI .fieldset-content > .cooldown-bar {
        order: 4;
        flex: 0 0 auto;
        width: 100%;
        height: 6px;
        min-height: 6px;
        margin: 4px 0 0;
        align-self: stretch;
    }

    #motherUI #coreStatusUI fieldset.locked-item,
    #motherUI #breachStatusUI fieldset.locked-item {
        padding: 3px 6px 4px !important;
    }

    #motherUI #coreStatusUI fieldset.locked-item .fieldset-content,
    #motherUI #breachStatusUI fieldset.locked-item .fieldset-content {
        gap: 3px;
        scrollbar-width: none;
    }

    #motherUI #coreStatusUI fieldset.locked-item .fieldset-content::-webkit-scrollbar,
    #motherUI #breachStatusUI fieldset.locked-item .fieldset-content::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    #motherUI #coreStatusUI fieldset.locked-item .fieldset-layout,
    #motherUI #breachStatusUI fieldset.locked-item .fieldset-layout {
        gap: 4px;
    }

    #motherUI #coreStatusUI fieldset.locked-item legend,
    #motherUI #breachStatusUI fieldset.locked-item legend {
        padding: 1px 6px !important;
        font-size: clamp(6px, 1.25vw, 7.4px) !important;
    }

    #motherUI #coreStatusUI fieldset.locked-item .stats-container,
    #motherUI #breachStatusUI fieldset.locked-item .stats-container {
        gap: 3px;
        padding: 3px;
    }

    #motherUI #coreStatusUI fieldset.locked-item .status-line,
    #motherUI #breachStatusUI fieldset.locked-item .status-line {
        min-height: 15px;
        padding: 1px 4px !important;
    }

    #motherUI #coreStatusUI fieldset.locked-item .status-line .label,
    #motherUI #breachStatusUI fieldset.locked-item .status-line .label {
        font-size: clamp(5.6px, 1.12vw, 6.8px) !important;
    }

    #motherUI #coreStatusUI fieldset.locked-item .status-line .value,
    #motherUI #breachStatusUI fieldset.locked-item .status-line .value {
        font-size: clamp(6px, 1.2vw, 7.2px) !important;
    }

    #motherUI #coreStatusUI fieldset.locked-item .actions-container:not(.compact-buttons),
    #motherUI #breachStatusUI fieldset.locked-item .actions-container:not(.compact-buttons) {
        gap: 3px;
        padding: 2px;
    }

    #motherUI #coreStatusUI fieldset.locked-item .actions-container:not(.compact-buttons) .upgrade-btn,
    #motherUI #breachStatusUI fieldset.locked-item .actions-container:not(.compact-buttons) .upgrade-btn {
        min-height: 24px;
        padding: 3px 5px !important;
        font-size: clamp(7.2px, 1.38vw, 8.8px) !important;
        font-weight: 750 !important;
        border-radius: 5px !important;
    }

    #motherUI #coreStatusUI fieldset.locked-item .actions-container.compact-buttons,
    #motherUI #breachStatusUI fieldset.locked-item .actions-container.compact-buttons,
    #motherUI #coreStatusUI fieldset.locked-item.critter-section .actions-container.compact-buttons,
    #motherUI #breachStatusUI fieldset.locked-item.breach-pathfinder-section .actions-container.compact-buttons {
        gap: 3px;
        grid-auto-rows: minmax(19px, 1fr);
        align-content: start;
    }

    #motherUI #coreStatusUI fieldset.locked-item .actions-container.compact-buttons .upgrade-btn,
    #motherUI #breachStatusUI fieldset.locked-item .actions-container.compact-buttons .upgrade-btn {
        min-height: 19px;
        padding: 2px 4px !important;
        font-size: clamp(6.8px, 1.28vw, 8.2px) !important;
        border-radius: 4px !important;
    }

    #motherUI #coreStatusUI fieldset.locked-item .unlock-progress-container,
    #motherUI #breachStatusUI fieldset.locked-item .unlock-progress-container {
        margin-top: 0;
        padding: 1px 3px;
        border-color: rgba(255, 170, 0, 0.28);
        box-shadow:
            0 0 4px rgba(255, 170, 0, 0.12),
            inset 0 0 3px rgba(255, 170, 0, 0.04);
    }

    #motherUI #coreStatusUI fieldset.locked-item .unlock-progress-bar,
    #motherUI #breachStatusUI fieldset.locked-item .unlock-progress-bar {
        height: 3px;
        margin-bottom: 1px;
    }

    #motherUI #coreStatusUI fieldset.locked-item .unlock-progress-text,
    #motherUI #breachStatusUI fieldset.locked-item .unlock-progress-text {
        font-size: 6.4px;
        line-height: 1;
        opacity: 0.78;
    }
}

@media (max-width: 520px) {
    #motherUI {
        height: clamp(190px, 32vh, 270px) !important;
        height: clamp(190px, 32dvh, 270px) !important;
        max-height: 36vh !important;
        max-height: 36dvh !important;
    }

    #motherUI #coreStatusUI .status-tabs,
    #motherUI #breachStatusUI .status-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 3px;
    }

    #motherUI #coreStatusUI .fieldset-layout,
    #motherUI #breachStatusUI .fieldset-layout {
        gap: 4px;
        padding-right: 1px;
    }

    #motherUI #coreStatusUI .stats-container,
    #motherUI #breachStatusUI .stats-container {
        grid-template-columns: 1fr 1fr;
        padding: 4px;
    }

    #motherUI #coreStatusUI .status-line,
    #motherUI #breachStatusUI .status-line {
        min-height: 17px;
    }

    #motherUI #coreStatusUI .actions-container.compact-buttons,
    #motherUI #breachStatusUI .actions-container.compact-buttons,
    #motherUI #coreStatusUI .critter-section .actions-container.compact-buttons,
    #motherUI #breachStatusUI .breach-pathfinder-section .actions-container.compact-buttons {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 760px), (max-width: 920px) and (max-height: 540px) {
    #motherUI {
        border-color: rgb(var(--mother-shell-rgb) / 0.34) !important;
        border-top-color: rgb(var(--mother-shell-rgb) / 0.82) !important;
        background-color: var(--mother-panel-bg) !important;
        background-image:
            var(--modal-circuit-vein-layers),
            linear-gradient(135deg, rgba(0, 22, 24, 0.92), rgba(0, 6, 8, 0.96) 58%, rgba(0, 20, 11, 0.9)) !important;
        box-shadow:
            0 0 18px rgb(var(--mother-shell-rgb) / 0.16),
            0 14px 34px rgba(0, 0, 0, 0.52),
            inset 0 1px 0 rgb(var(--mother-shell-rgb) / 0.12) !important;
    }

    #motherUI .mother-top-tabs {
        gap: 6px;
        padding: 8px 7px 5px 10px;
        border-bottom: 1px solid rgb(var(--mother-shell-rgb) / 0.2);
        background:
            linear-gradient(90deg, rgb(var(--mother-shell-rgb) / 0.08), transparent 42%),
            rgba(0, 0, 0, 0.34);
    }

    #motherUI .mother-top-tabs::after {
        top: 2px;
        left: 8px;
        font-size: 5.5px;
    }

    #motherUI .mother-tab-btn {
        min-height: 28px;
        border-color: rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.48);
        background:
            linear-gradient(180deg, rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.14), rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.04)),
            rgba(0, 9, 10, 0.78);
        box-shadow:
            0 0 10px rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.12),
            inset 0 1px 0 rgb(var(--mother-tab-rgb, var(--mother-shell-rgb)) / 0.1);
    }

    #motherUI .mother-tab-btn.active[data-mother-tab="breach"],
    #motherUI .mother-tab-btn.active[data-mother-tab="core"] {
        border-width: 1px;
        color: rgba(0, 22, 24, 0.92);
        background:
            linear-gradient(180deg, rgb(var(--mother-tab-rgb) / 0.96), rgb(var(--mother-tab-rgb) / 0.66)),
            rgb(var(--mother-tab-rgb) / 0.8);
        box-shadow:
            0 0 16px rgb(var(--mother-tab-rgb) / 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.36);
    }

    #motherUI #coreStatusUI .status-tabs,
    #motherUI #breachStatusUI .status-tabs {
        gap: 3px;
        border-bottom-color: rgb(var(--mother-shell-rgb) / 0.22);
        background:
            linear-gradient(180deg, rgb(var(--mother-shell-rgb) / 0.07), rgba(0, 0, 0, 0.42)),
            rgba(0, 4, 6, 0.82);
        box-shadow:
            inset 0 1px 0 rgb(var(--mother-shell-rgb) / 0.08),
            0 0 7px rgb(var(--mother-shell-rgb) / 0.08);
    }

    #motherUI #coreStatusUI .status-tab-btn,
    #motherUI #breachStatusUI .status-tab-btn {
        border: 1px solid rgb(var(--tab-accent) / 0.42) !important;
        background:
            linear-gradient(180deg, rgb(var(--tab-accent) / 0.11), rgb(var(--tab-accent) / 0.035)),
            rgba(0, 8, 10, 0.82) !important;
    }

    #motherUI #coreStatusUI .status-tab-content fieldset,
    #motherUI #breachStatusUI .status-tab-content fieldset {
        border-color: rgb(var(--mother-field-rgb) / 0.54) !important;
        background:
            linear-gradient(135deg, rgb(var(--mother-field-rgb) / 0.06), transparent 48%),
            rgba(0, 7, 8, 0.72) !important;
    }
}
