/* --- Core Variable Tokens --- */
:root {
    --bg-base: hsl(225, 25%, 3%);
    --bg-card: rgba(8, 12, 26, 0.55);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(0, 200, 255, 0.15);
    
    --text-primary: hsl(0, 0%, 95%);
    --text-muted: hsl(225, 12%, 62%);
    
    --neon-blue: hsl(190, 100%, 50%);
    --neon-purple: hsl(275, 100%, 65%);
    --neon-green: hsl(145, 95%, 45%);
    --neon-yellow: hsl(45, 95%, 50%);
    --neon-pink: hsl(330, 95%, 55%);
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Fira Code', source-code-pro, Menlo, Monaco, Consolas, monospace;
    
    --transition-smooth: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Base Reset & Setup --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Floating Neon Glow Orbs --- */
.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(150px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    animation: drift 25s infinite alternate ease-in-out;
}

.glow-purple {
    background-color: var(--neon-purple);
    width: 45vw;
    height: 45vw;
    top: -10vw;
    right: -10vw;
}

.glow-blue {
    background-color: var(--neon-blue);
    width: 55vw;
    height: 55vw;
    bottom: -15vw;
    left: -10vw;
    animation-delay: -6s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(6%, 8%) scale(1.1); }
    100% { transform: translate(-4%, -4%) scale(0.95); }
}

/* --- Grid Overlay --- */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.005) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.005) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
    pointer-events: none;
}

/* --- Layout Container --- */
.app-container {
    max-width: 1720px;
    margin: 0 auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
}

/* --- Header Section --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    margin-bottom: 1.25rem;
    z-index: 10;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-orb {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    text-shadow: 0 0 8px rgba(255,255,255,0.5);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.35);
}

.logo-text h1 {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.logo-text h1 span {
    color: var(--neon-blue);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-mono);
    border: 1px solid rgba(0, 200, 255, 0.25);
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(0, 200, 255, 0.05);
    margin-left: 4px;
}

.logo-text p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.preset-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.preset-selector select {
    background: #0c0e1b;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-sans);
    cursor: pointer;
    outline: none;
    transition: var(--transition-smooth);
}

.preset-selector select option {
    background: #0c0e1b;
    color: var(--text-primary);
}

.preset-selector select:hover, .preset-selector select:focus {
    border-color: rgba(0, 200, 255, 0.45);
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.15);
}

/* --- Glow Buttons --- */
.glow-button {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(138, 43, 226, 0.3);
    transition: var(--transition-smooth);
}

.glow-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 200, 255, 0.45);
}

.glow-button:active {
    transform: translateY(0);
}

.btn-spinner-hidden {
    display: none;
}

.btn-spinner-visible {
    display: inline-block;
    animation: rotate 1s linear infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

/* --- Card Styles (Glassmorphism) --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    transition: border-color 0.4s ease;
}

.card-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.01);
}

.card-footer {
    padding: 8px 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.003);
}

/* --- Dashboard Dreispaltig Layout --- */
.dashboard {
    display: grid;
    grid-template-columns: 290px 1.05fr 1.15fr;
    gap: 1.25rem;
    flex: 1;
    min-height: 0;
    margin-bottom: 0.75rem;
}

/* --- Left Column: Showcase Sidebar --- */
.sidebar-section {
    min-height: 0;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feature-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateX(3px);
}

.feature-card.active {
    background: rgba(0, 200, 255, 0.06);
    border-color: rgba(0, 200, 255, 0.28);
    box-shadow: 0 0 15px rgba(0, 200, 255, 0.12);
}

.feature-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.feature-info h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.feature-info p {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* --- Comparison Matrix Widget --- */
.comparison-widget {
    margin-top: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 12px;
}

.comparison-widget h5 {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--neon-blue);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comp-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.comp-row:last-child {
    border-bottom: none;
}

.comp-row span {
    color: var(--text-muted);
}

.comp-row strong {
    color: var(--neon-green);
}

/* --- Center Column: Editor --- */
.editor-section {
    min-height: 0;
}

.tab-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-container {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
    background: rgba(0, 0, 0, 0.22);
}

.line-numbers {
    width: 44px;
    padding: 16px 8px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.2);
    text-align: right;
    border-right: 1px solid rgba(255, 255, 255, 0.02);
    user-select: none;
    line-height: 1.5;
}

.textarea-wrapper {
    flex: 1;
    position: relative;
    height: 100%;
}

#code-editor, #highlighting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.5;
    border: none;
    background: transparent;
    overflow-y: auto;
    white-space: pre;
    tab-size: 4;
}

#code-editor {
    color: transparent;
    caret-color: var(--neon-blue);
    resize: none;
    outline: none;
    z-index: 2;
}

#highlighting-overlay {
    z-index: 1;
    pointer-events: none;
    color: var(--text-primary);
}

/* --- Badges --- */
.badge {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-gc-auto {
    background: rgba(0, 200, 255, 0.08);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 200, 255, 0.22);
}

.badge-gc-manual {
    background: rgba(255, 105, 180, 0.08);
    color: var(--neon-pink);
    border: 1px solid rgba(255, 105, 180, 0.22);
}

/* --- Right Column: Visualizer Panels --- */
.visualizer-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.tabs-header {
    flex-direction: row;
    padding: 5px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 10px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

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

.tab-btn.active {
    color: var(--neon-blue);
    background: rgba(0, 200, 255, 0.07);
    box-shadow: inset 0 0 0 1px rgba(0, 200, 255, 0.1);
}

.tabs-content {
    flex: 1;
    position: relative;
    min-height: 0;
}

.tab-pane {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.tab-pane.active {
    display: flex;
}

.pane-card {
    height: 100%;
    min-height: 0;
}

/* --- Console Pane --- */
.console-body {
    flex: 1;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.console-log {
    color: #e2e8f0;
    white-space: pre-wrap;
}

.console-debug {
    color: var(--neon-pink);
    opacity: 0.88;
}

.system-message {
    color: var(--neon-blue);
    font-style: italic;
    opacity: 0.8;
}

.error-message {
    color: var(--neon-pink);
    background: rgba(255, 0, 100, 0.04);
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--neon-pink);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

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

/* --- Performance / Benchmark Tab --- */
.performance-body {
    flex: 1;
    padding: 20px;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.perf-info-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: 12px;
}

.perf-info-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--neon-yellow);
}

.perf-info-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.chart-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(0, 0, 0, 0.15);
    padding: 18px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.chart-bar-wrapper {
    display: grid;
    grid-template-columns: 120px 1fr 60px;
    align-items: center;
    gap: 15px;
}

.bar-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.bar-track {
    height: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.01);
}

.bar-fill {
    height: 100%;
    border-radius: 100px;
    width: 0%;
    transition: width 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

#bar-python {
    background: linear-gradient(90deg, #3776ab, #ffd343);
    box-shadow: 0 0 10px rgba(55, 118, 171, 0.3);
}

#bar-novavm {
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-pink));
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

#bar-novajit {
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-green));
    box-shadow: 0 0 12px rgba(0, 255, 145, 0.5);
}

.bar-val {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-align: right;
    font-weight: 700;
}

.perf-metric-card {
    background: rgba(0, 255, 145, 0.03);
    border: 1px solid rgba(0, 255, 145, 0.15);
    padding: 14px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.perf-metric-card strong {
    font-size: 1.15rem;
    font-weight: 800;
    text-shadow: 0 0 8px rgba(0, 255, 145, 0.35);
}

/* --- AST Pane --- */
.ast-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.ast-node {
    margin-left: 20px;
    border-left: 1px dotted rgba(255,255,255,0.06);
    padding-left: 10px;
    margin-top: 4px;
}

.ast-node-header {
    color: var(--neon-purple);
    font-weight: bold;
}

.ast-node-prop {
    color: var(--text-muted);
}

.ast-node-val {
    color: var(--neon-yellow);
}

.ast-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
}

/* --- LLVM Pane --- */
.llvm-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.llvm-target-toggle {
    display: flex;
    background: rgba(0,0,0,0.15);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 6px 12px;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.toggle-btn.active {
    color: var(--neon-yellow);
    background: rgba(255, 170, 0, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 170, 0, 0.1);
}

.llvm-body {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    overflow: auto;
}

#llvm-output {
    padding: 18px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
}

/* --- Memory Visualizer Pane --- */
.memory-body {
    flex: 1;
    padding: 20px;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
}

.memory-info-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: 12px;
}

.memory-info-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--neon-blue);
}

.memory-info-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.memory-visualizer-container {
    flex: 1;
    min-height: 180px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.memory-canvas {
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 10px;
    overflow-y: auto;
}

.mem-empty-text {
    align-self: center;
    margin: 0 auto;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.78rem;
}

/* --- Memory Block Nodes --- */
.mem-node {
    padding: 8px 12px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 95px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: popIn 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

.mem-node-name {
    font-weight: 700;
}

.mem-node-rc {
    opacity: 0.7;
    font-size: 0.65rem;
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Node styles */
.node-stack {
    background: rgba(0, 200, 255, 0.08);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 200, 255, 0.22);
}

.node-heap-active {
    background: rgba(255, 105, 180, 0.08);
    color: var(--neon-pink);
    border: 1px solid rgba(255, 105, 180, 0.22);
}

.node-heap-gc {
    background: rgba(138, 43, 226, 0.08);
    color: var(--neon-purple);
    border: 1px solid rgba(138, 43, 226, 0.22);
}

.node-free {
    background: rgba(100, 116, 139, 0.03);
    color: var(--text-muted);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    opacity: 0.5;
    animation: fadeFree 0.4s ease forwards;
}

@keyframes fadeFree {
    100% { filter: grayscale(1); }
}

.memory-legend {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.legend-item {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-stack { background-color: var(--neon-blue); }
.dot-heap-active { background-color: var(--neon-pink); }
.dot-heap-gc { background-color: var(--neon-purple); }
.dot-free { background-color: #64748b; border: 1px dashed rgba(255,255,255,0.3); }

/* --- Highlighting Syntax --- */
.nova-keyword { color: var(--neon-purple); font-weight: bold; }
.nova-directive { color: var(--neon-pink); font-weight: bold; }
.nova-number { color: var(--neon-yellow); }
.nova-string { color: var(--neon-green); }
.nova-comment { color: var(--text-muted); font-style: italic; }
.nova-matrix { color: var(--neon-blue); font-weight: 500; }
.nova-ident { color: var(--text-primary); }

/* --- Colors Utilities --- */
.text-blue { color: var(--neon-blue); }
.text-purple { color: var(--neon-purple); }
.text-green { color: var(--neon-green); }
.text-yellow { color: var(--neon-yellow); }

/* --- Scrollbar Customization --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Responsive Adaptability & Mobile Optimization --- */
@media (max-width: 1200px) {
    .dashboard {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
    }
    
    .app-container {
        height: auto;
        max-height: none;
        padding: 1rem;
    }
    
    /* Set custom order so users see Editor first, then Output, then Sidebar features */
    .editor-section {
        order: 1;
        height: 450px;
    }
    
    .visualizer-section {
        order: 2;
        height: 480px;
    }
    
    .sidebar-section {
        order: 3;
        height: auto;
        max-height: none;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 1rem;
        text-align: center;
    }

    .logo-area {
        justify-content: center;
        flex-direction: column;
        gap: 6px;
    }

    .logo-orb {
        width: 36px;
        height: 36px;
        font-size: 1.15rem;
        border-radius: 10px;
    }

    .logo-text h1 {
        font-size: 1.25rem;
    }

    .logo-text p {
        font-size: 0.72rem;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 10px;
    }

    .preset-selector {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 4px;
    }

    .preset-selector select {
        width: 100%;
        text-align: center;
    }

    .glow-button {
        width: 100%;
        justify-content: center;
        padding: 10px;
    }
}

@media (max-width: 520px) {
    .app-container {
        padding: 0.5rem;
    }

    /* Make tabs scrollable horizontally if they exceed screen width */
    .tabs-header {
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        padding: 4px;
        -webkit-overflow-scrolling: touch;
        gap: 4px;
    }

    .tab-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    /* Adjust charts to tiny widths */
    .chart-bar-wrapper {
        grid-template-columns: 80px 1fr 50px;
        gap: 8px;
    }

    .bar-label {
        font-size: 0.7rem;
    }

    .bar-val {
        font-size: 0.7rem;
    }

    .perf-metric-card {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }

    /* Wrap memory legend items */
    .memory-legend {
        gap: 8px;
        font-size: 0.65rem;
    }

    .legend-item {
        gap: 4px;
    }

    /* Make memory nodes smaller on very narrow screens */
    .mem-node {
        padding: 6px 8px;
        min-width: 75px;
        font-size: 0.65rem;
        gap: 1px;
    }

    .mem-node-rc {
        font-size: 0.58rem;
    }
}
