/* ==========================================================================
   DIGITVISION AI — NEURAL LAB
   Cinematic AI Research Laboratory & Neural Network Visualizer
   ========================================================================== */

:root {
    color-scheme: dark;
    --nl-bg-base: #0f1013;
    --nl-bg-surface: #16171b;
    --nl-bg-card: #16171b;
    --nl-bg-card-hover: #1d1e24;
    --nl-border: #24262e;
    --nl-border-bright: #333642;
    --nl-cyan: #d9683e;
    --nl-cyan-glow: rgba(217, 104, 62, 0.25);
    --nl-cyan-subtle: rgba(217, 104, 62, 0.12);
    --nl-blue-ice: #d4974f;
    --nl-violet: #d9683e;
    --nl-violet-glow: rgba(217, 104, 62, 0.2);
    --nl-text-main: #f4f4f6;
    --nl-text-muted: #9da1b0;
    --nl-text-faint: #676a79;
    --nl-green: #22c55e;
    --nl-green-glow: rgba(34, 197, 94, 0.25);
    --nl-danger: #ef4444;
    --nl-font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --nl-font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
    --nl-font-heading: "Space Grotesk", sans-serif;
    --nl-transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    --nl-transition-smooth: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

body.neural-lab-body {
    background-color: var(--nl-bg-base);
    color: var(--nl-text-main);
    font-family: var(--nl-font-sans);
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    user-select: none;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(8, 13, 33, 0.7);
}
::-webkit-scrollbar-thumb {
    background: var(--nl-border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--nl-border-bright);
}

/* ==========================================================================
   TOP COMMAND BAR
   ========================================================================== */
.nl-topbar {
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(8, 13, 33, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--nl-border);
    z-index: 50;
    gap: 16px;
}

.nl-branding {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.nl-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--nl-text-main);
}

.nl-brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--nl-cyan);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    font-family: var(--nl-font-heading);
    display: grid;
    place-items: center;
}

.nl-brand-titles {
    display: flex;
    flex-direction: column;
}

.nl-brand-name {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.nl-cyan-text {
    color: var(--nl-cyan);
}

.nl-lab-tag {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.8px;
    color: var(--nl-blue-ice);
    text-transform: uppercase;
}

.nl-model-status {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
}

.nl-status-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--nl-green);
    box-shadow: 0 0 8px var(--nl-green-glow);
    animation: nlStatusBlink 2.2s infinite;
}

@keyframes nlStatusBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.nl-status-label {
    font-size: 10px;
    font-family: var(--nl-font-mono);
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #6ee7b7;
}

/* Architecture Ribbon */
.nl-arch-ribbon {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(12, 20, 50, 0.7);
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid var(--nl-border);
    max-width: 580px;
    overflow-x: auto;
}

.nl-ribbon-tag {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--nl-cyan);
}

.nl-ribbon-flow {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--nl-font-mono);
    font-size: 11px;
    color: var(--nl-text-muted);
    white-space: nowrap;
}

.nl-arch-step {
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(28, 39, 76, 0.5);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: var(--nl-transition-fast);
}

.nl-arch-step small {
    font-size: 9px;
    color: var(--nl-blue-ice);
    opacity: 0.8;
}

.nl-arch-step.active {
    background: var(--nl-cyan-subtle);
    border: 1px solid var(--nl-cyan);
    color: var(--nl-cyan);
    box-shadow: 0 0 10px var(--nl-cyan-glow);
}

.nl-arch-arrow {
    color: var(--nl-text-faint);
    font-size: 10px;
}

/* Top Actions */
.nl-top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nl-playback-cluster {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(12, 20, 50, 0.6);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--nl-border);
}

.nl-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--nl-text-main);
    display: grid;
    place-items: center;
    font-size: 14px;
    cursor: pointer;
    transition: var(--nl-transition-fast);
}

.nl-icon-btn:hover:not(:disabled) {
    background: rgba(45, 62, 117, 0.4);
    border-color: var(--nl-border-bright);
    color: var(--nl-cyan);
}

.nl-icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.nl-icon-btn.nl-danger-btn:hover:not(:disabled) {
    color: var(--nl-danger);
    border-color: rgba(244, 63, 94, 0.4);
}

.nl-speed-selector {
    display: flex;
    background: rgba(4, 7, 17, 0.8);
    border-radius: 5px;
    padding: 2px;
    gap: 2px;
}

.nl-speed-btn {
    border: none;
    background: transparent;
    color: var(--nl-text-muted);
    font-size: 10px;
    font-family: var(--nl-font-mono);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--nl-transition-fast);
}

.nl-speed-btn.active {
    background: var(--nl-cyan);
    color: #040711;
    font-weight: 700;
}

.nl-btn-subtle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--nl-text-muted);
    padding: 6px 12px;
    border: 1px solid var(--nl-border);
    border-radius: 6px;
    transition: var(--nl-transition-fast);
}

.nl-btn-subtle:hover {
    color: var(--nl-text-main);
    border-color: var(--nl-border-bright);
    background: rgba(28, 39, 76, 0.3);
}

/* ==========================================================================
   MAIN 3-ZONE VIEWPORT GRID (100vh bound)
   ========================================================================== */
.nl-main-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 340px 1fr 340px;
    gap: 12px;
    padding: 12px 16px;
    overflow: hidden;
}

.nl-zone {
    background: rgba(8, 13, 33, 0.7);
    border: 1px solid var(--nl-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* Reusable Header */
.nl-card-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--nl-border);
    background: rgba(12, 20, 50, 0.5);
    flex-shrink: 0;
}

.nl-header-meta {
    display: flex;
    flex-direction: column;
}

.nl-eyebrow {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--nl-cyan);
    text-transform: uppercase;
}

.nl-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--nl-text-main);
    letter-spacing: -0.2px;
}

/* ==========================================================================
   ZONE B: LEFT COLUMN - INPUT & PREPROCESSING
   ========================================================================== */
.nl-input-zone {
    padding: 0;
}

.nl-tab-toggles {
    display: flex;
    background: rgba(4, 7, 17, 0.6);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid var(--nl-border);
}

.nl-tab-toggle {
    border: none;
    background: transparent;
    color: var(--nl-text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--nl-transition-fast);
}

.nl-tab-toggle.active {
    background: var(--nl-border-bright);
    color: var(--nl-text-main);
}

/* Drawing Canvas & Tensor View */
.nl-canvas-wrapper, .nl-tensor-wrapper {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 14px auto 8px;
    border-radius: 10px;
    overflow: hidden;
    background: #000000;
    border: 1px solid var(--nl-border-bright);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 16px rgba(0, 240, 255, 0.05);
    flex-shrink: 0;
}

#nlDrawingCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.nl-canvas-overlay-guide {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: grid;
    place-items: center;
    transition: var(--nl-transition-fast);
}

.nl-canvas-overlay-guide.hidden {
    opacity: 0;
}

.nl-reticle {
    width: 180px;
    height: 180px;
    border: 1px dashed rgba(56, 189, 248, 0.25);
    border-radius: 12px;
}

.nl-hint-text {
    position: absolute;
    bottom: 24px;
    font-size: 12px;
    font-family: var(--nl-font-mono);
    color: rgba(139, 155, 180, 0.6);
    background: rgba(4, 7, 17, 0.85);
    padding: 3px 10px;
    border-radius: 4px;
}

/* Magnified Tensor Pixel Inspector */
.nl-tensor-wrapper {
    display: flex;
    flex-direction: column;
}

.nl-pixel-grid-canvas-wrap {
    position: relative;
    width: 280px;
    height: 236px;
    background: #000;
}

#nlPixelGridCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    image-rendering: pixelated;
}

.nl-grid-crosshair {
    position: absolute;
    width: 8px;
    height: 8px;
    border: 1px solid var(--nl-cyan);
    pointer-events: none;
    display: none;
    box-shadow: 0 0 6px var(--nl-cyan);
}

.nl-pixel-hover-readout {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(12, 20, 50, 0.8);
    border-top: 1px solid var(--nl-border);
    font-family: var(--nl-font-mono);
    font-size: 11px;
    color: var(--nl-text-muted);
}

.nl-hidden {
    display: none !important;
}

/* Buttons */
.nl-input-controls {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    padding: 0 14px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.nl-btn {
    height: 40px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--nl-transition-fast);
}

.nl-btn-secondary {
    background: rgba(28, 39, 76, 0.5);
    color: var(--nl-text-main);
    border-color: var(--nl-border);
}

.nl-btn-secondary:hover {
    background: rgba(45, 62, 117, 0.6);
    border-color: var(--nl-border-bright);
}

.nl-btn-primary {
    background: linear-gradient(135deg, #00d9e6, #2563eb);
    color: #ffffff;
    box-shadow: 0 0 18px var(--nl-cyan-glow);
}

.nl-btn-primary:hover {
    filter: brightness(1.12);
    box-shadow: 0 0 24px var(--nl-cyan-glow);
    transform: translateY(-1px);
}

.nl-btn-primary:disabled {
    filter: grayscale(0.8);
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.nl-notice-bar {
    padding: 6px 14px;
    margin: 0 14px 8px;
    background: rgba(12, 20, 50, 0.6);
    border-radius: 6px;
    border: 1px solid var(--nl-border);
    font-size: 11px;
    color: var(--nl-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nl-notice-bar.nl-error {
    background: rgba(244, 63, 94, 0.12);
    border-color: rgba(244, 63, 94, 0.4);
    color: #fda4af;
}

.nl-notice-icon {
    font-weight: 700;
}

/* Preprocessed Telemetry */
.nl-preproc-telemetry {
    margin: auto 14px 12px;
    padding: 10px 12px;
    background: rgba(12, 20, 50, 0.4);
    border: 1px solid var(--nl-border);
    border-radius: 8px;
}

.nl-telemetry-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--nl-text-muted);
    margin-bottom: 8px;
}

.nl-tag-mono {
    font-family: var(--nl-font-mono);
    color: var(--nl-cyan);
    font-size: 9px;
}

.nl-preproc-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nl-thumbnail-box {
    position: relative;
    width: 56px;
    height: 56px;
    background: #000;
    border: 1px solid var(--nl-border-bright);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.nl-preproc-img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    display: block;
}

.nl-thumbnail-tag {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 7px;
    font-family: var(--nl-font-mono);
    background: rgba(0, 0, 0, 0.8);
    color: var(--nl-cyan);
    padding: 1px 3px;
    border-radius: 2px;
}

.nl-telemetry-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nl-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-family: var(--nl-font-mono);
}

.nl-stat-lbl {
    color: var(--nl-text-muted);
}

.nl-stat-val {
    color: var(--nl-text-main);
    font-weight: 600;
}

/* ==========================================================================
   ZONE C: CENTER - NEURAL HIGHWAY
   ========================================================================== */
.nl-highway-zone {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.nl-highway-header {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--nl-border);
    background: rgba(12, 20, 50, 0.5);
    flex-shrink: 0;
}

.nl-highway-title-cluster {
    display: flex;
    flex-direction: column;
}

.nl-stage-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--nl-font-mono);
    font-size: 11px;
    color: var(--nl-blue-ice);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.25);
    padding: 4px 10px;
    border-radius: 20px;
}

.nl-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--nl-cyan);
    box-shadow: 0 0 8px var(--nl-cyan-glow);
}

/* Track container */
.nl-highway-track {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px 24px;
}

.nl-highway-connections {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.nl-stages-container {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 2;
    margin: auto 0;
    padding: 8px 0;
}

/* Stage Cards */
.nl-stage-card {
    width: 130px;
    height: 250px;
    background: rgba(12, 20, 50, 0.85);
    border: 1px solid var(--nl-border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    padding: 8px;
    cursor: pointer;
    transition: var(--nl-transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.nl-stage-card:hover {
    border-color: var(--nl-border-bright);
    background: var(--nl-bg-card-hover);
    transform: translateY(-2px);
}

.nl-stage-card.nl-active-sim {
    border-color: var(--nl-cyan);
    box-shadow: 0 0 20px var(--nl-cyan-glow);
    background: rgba(0, 240, 255, 0.06);
}

.nl-stage-card.nl-selected-insp {
    border-color: var(--nl-violet);
    box-shadow: 0 0 20px var(--nl-violet-glow);
}

.nl-stage-badge {
    font-size: 9px;
    font-weight: 800;
    font-family: var(--nl-font-mono);
    color: var(--nl-cyan);
    letter-spacing: 0.5px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(28, 39, 76, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nl-stage-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-top: 8px;
    min-height: 0;
}

.nl-stage-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid rgba(28, 39, 76, 0.6);
    padding-top: 6px;
}

.nl-meta-dim {
    font-size: 10px;
    font-family: var(--nl-font-mono);
    color: var(--nl-text-main);
    font-weight: 700;
}

.nl-meta-type {
    font-size: 9px;
    color: var(--nl-text-muted);
}

/* Stage Graphic Wrappers */
.nl-stage-graphic-wrap {
    flex: 1;
    display: grid;
    place-items: center;
}

.nl-stage-main-canvas {
    width: 84px;
    height: 84px;
    background: #000;
    border-radius: 6px;
    border: 1px solid var(--nl-border);
    image-rendering: pixelated;
}

/* Feature Tiles Grid (Conv & Pool) */
.nl-feature-tiles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 3px;
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    padding: 3px;
    border-radius: 6px;
    border: 1px solid rgba(45, 62, 117, 0.4);
}

.nl-feature-tile-canvas {
    width: 100%;
    height: 100%;
    background: #050814;
    border-radius: 2px;
    image-rendering: pixelated;
    display: block;
    transition: var(--nl-transition-fast);
}

.nl-feature-tile-canvas:hover {
    outline: 1px solid var(--nl-cyan);
    box-shadow: 0 0 6px var(--nl-cyan);
    transform: scale(1.15);
    z-index: 10;
}

/* Scan line sweep effect */
.nl-stage-scanline {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--nl-cyan), transparent);
    box-shadow: 0 0 10px var(--nl-cyan);
    opacity: 0;
    pointer-events: none;
}

.nl-stage-scanline.scanning {
    opacity: 1;
    animation: nlScanSweep 1s infinite alternate ease-in-out;
}

@keyframes nlScanSweep {
    0% { top: 10%; }
    100% { top: 90%; }
}

/* Flatten Strip */
.nl-flatten-strip-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

.nl-flatten-bins-strip {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
    width: 88px;
    height: 88px;
    background: #040711;
    padding: 3px;
    border-radius: 4px;
    border: 1px solid var(--nl-border);
}

.nl-bin-cell {
    border-radius: 1px;
    background: #0d1432;
    transition: background 0.25s ease;
}

/* Dense Layer Neurons */
.nl-dense-nodes-matrix {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    width: 96px;
    height: 96px;
    margin: auto;
    background: #040711;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid var(--nl-border);
}

.nl-neuron-dot {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #111a36;
    transition: var(--nl-transition-fast);
}

.nl-neuron-dot.nl-firing {
    box-shadow: 0 0 6px var(--nl-cyan);
}

/* Softmax Nodes List */
.nl-softmax-nodes-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.nl-softmax-mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 12px;
    font-size: 8px;
    font-family: var(--nl-font-mono);
    padding: 0 4px;
    background: rgba(4, 7, 17, 0.6);
    border-radius: 2px;
}

.nl-softmax-mini-row.winner {
    background: var(--nl-cyan);
    color: #040711;
    font-weight: 800;
}

/* Flow Node (Connecting pulses) */
.nl-flow-node {
    width: 14px;
    height: 14px;
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
}

.nl-pulse-ring {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nl-border-bright);
    transition: var(--nl-transition-fast);
}

.nl-flow-node.active .nl-pulse-ring {
    background: var(--nl-cyan);
    box-shadow: 0 0 10px var(--nl-cyan);
    transform: scale(1.3);
}

/* Footer tip */
.nl-highway-footer {
    padding: 6px 18px;
    background: rgba(12, 20, 50, 0.35);
    border-top: 1px solid var(--nl-border);
    flex-shrink: 0;
}

.nl-footer-tip {
    font-size: 10px;
    color: var(--nl-text-muted);
}

/* ==========================================================================
   ZONE D & E: RIGHT COLUMN - INSPECTION & DECISION
   ========================================================================== */
.nl-inspector-zone {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.nl-subcard {
    background: rgba(8, 13, 33, 0.7);
    border: 1px solid var(--nl-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* ZONE D: LIVE LAYER INSPECTOR */
.nl-layer-inspector-card {
    flex: 1.1;
    min-height: 0;
}

.nl-badge-cyan {
    font-size: 10px;
    font-family: var(--nl-font-mono);
    font-weight: 700;
    color: var(--nl-cyan);
    background: var(--nl-cyan-subtle);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.nl-insp-body {
    flex: 1;
    min-height: 0;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.nl-insp-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    flex-shrink: 0;
}

.nl-stat-cell {
    background: rgba(12, 20, 50, 0.6);
    border: 1px solid var(--nl-border);
    padding: 6px 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}

.nl-stat-cell-lbl {
    font-size: 9px;
    color: var(--nl-text-muted);
    font-weight: 600;
}

.nl-stat-cell-val {
    font-size: 12px;
    font-family: var(--nl-font-mono);
    color: var(--nl-text-main);
}

.nl-insp-detail-container {
    flex: 1;
    min-height: 100px;
    background: rgba(4, 7, 17, 0.6);
    border: 1px solid var(--nl-border);
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
}

.nl-empty-insp-msg {
    color: var(--nl-text-muted);
    font-size: 11px;
    text-align: center;
    margin-top: 24px;
    line-height: 1.5;
}

.nl-channel-magnifier-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nl-channel-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.nl-ch-tab-btn {
    border: 1px solid var(--nl-border);
    background: rgba(12, 20, 50, 0.8);
    color: var(--nl-text-muted);
    font-size: 10px;
    font-family: var(--nl-font-mono);
    padding: 2px 7px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.nl-ch-tab-btn.active {
    background: var(--nl-cyan);
    color: #040711;
    border-color: var(--nl-cyan);
    font-weight: 700;
}

.nl-mag-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nl-mag-canvas-wrap {
    width: 90px;
    height: 90px;
    background: #000;
    border: 1px solid var(--nl-cyan);
    border-radius: 6px;
    box-shadow: 0 0 10px var(--nl-cyan-glow);
    overflow: hidden;
    flex-shrink: 0;
}

#nlMagCanvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    display: block;
}

.nl-mag-readout {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 10px;
    font-family: var(--nl-font-mono);
}

.nl-insp-disclaimer {
    font-size: 9px;
    color: var(--nl-text-faint);
    flex-shrink: 0;
}

/* ZONE E: FINAL PREDICTION MATRIX */
.nl-prediction-card {
    flex: 1;
    min-height: 0;
}

.nl-badge-model {
    font-size: 9px;
    font-family: var(--nl-font-mono);
    font-weight: 700;
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.nl-decision-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--nl-border);
    flex-shrink: 0;
}

.nl-predicted-number-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
}

.nl-predicted-number {
    font-size: 46px;
    font-weight: 900;
    line-height: 1;
    color: var(--nl-cyan);
    text-shadow: 0 0 20px var(--nl-cyan-glow), 0 0 40px var(--nl-cyan-glow);
    transition: var(--nl-transition-smooth);
}

.nl-predicted-sub {
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--nl-text-muted);
}

.nl-confidence-gauge-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nl-confidence-headline {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
}

.nl-gauge-track {
    height: 7px;
    background: rgba(28, 39, 76, 0.6);
    border-radius: 4px;
    overflow: hidden;
}

.nl-gauge-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--nl-violet), var(--nl-cyan));
    box-shadow: 0 0 10px var(--nl-cyan-glow);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.nl-confidence-note {
    font-size: 10px;
    color: var(--nl-text-muted);
}

/* 10 Probabilities List */
.nl-probabilities-wrapper {
    flex: 1;
    min-height: 0;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.nl-probs-header {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--nl-text-muted);
    margin-bottom: 4px;
}

.nl-probs-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nl-prob-row {
    display: grid;
    grid-template-columns: 14px 1fr 44px;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-family: var(--nl-font-mono);
}

.nl-prob-digit {
    color: var(--nl-text-muted);
    font-weight: 700;
}

.nl-prob-track {
    height: 5px;
    background: rgba(28, 39, 76, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.nl-prob-bar {
    height: 100%;
    width: 0%;
    background: var(--nl-border-bright);
    transition: width 0.35s ease;
}

.nl-prob-row.top .nl-prob-digit {
    color: var(--nl-cyan);
    font-weight: 900;
}

.nl-prob-row.top .nl-prob-bar {
    background: var(--nl-cyan);
    box-shadow: 0 0 8px var(--nl-cyan);
}

.nl-prob-row.top .nl-prob-val {
    color: var(--nl-cyan);
    font-weight: 700;
}

.nl-prob-val {
    color: var(--nl-text-muted);
    text-align: right;
}

.nl-honest-disclaimer {
    padding: 4px 14px 8px;
    font-size: 8.5px;
    color: var(--nl-text-faint);
    flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVENESS & ACCESSIBILITY
   ========================================================================== */
@media (max-width: 1200px) {
    html, body {
        overflow-y: auto;
        height: auto;
    }
    .nl-main-grid {
        grid-template-columns: 320px 1fr;
        grid-template-rows: auto auto;
        overflow: visible;
    }
    .nl-inspector-zone {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 820px) {
    .nl-main-grid {
        grid-template-columns: 1fr;
    }
    .nl-inspector-zone {
        grid-template-columns: 1fr;
    }
    .nl-arch-ribbon {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
