:root {
    /* Colors */
    --terminal-green: #00D26A;
    --terminal-green-dim: #00A854;
    --terminal-green-dark: #004D25;
    --signal-orange: #FF9F1C;
    --signal-red: #FF4B4B;
    --charcoal: #1A1A1A;
    --charcoal-light: #222222;
    --charcoal-lighter: #2A2A2A;
    --charcoal-border: #333333;
    --text-muted: #888888;

    /* Effects */
    --glow-green: 0 0 15px rgba(0, 210, 106, 0.3);
    --glow-green-soft: 0 0 10px rgba(0, 210, 106, 0.2);
    --transition-fast: all 0.2s ease;
}

[x-cloak] {
    display: none !important;
}

/* RESET & BASE */
* {
    border-radius: 0 !important;
}

body {
    scrollbar-gutter: stable;
}

/* SHARED COMPONENT RULES */
.btn-ghost,
.input-field,
.category-btn {
    border: 1px solid var(--charcoal-border);
    font-size: 0.8125rem;
    transition: var(--transition-fast);
}

.btn-ghost {
    padding: 0.375rem 0.75rem;
}

.btn-ghost:hover {
    background-color: var(--charcoal-lighter);
}

.input-field {
    background-color: var(--charcoal);
    padding: 0.25rem 0.5rem;
    caret-color: transparent;
}

.input-field:focus {
    outline: none;
    border-color: var(--terminal-green);
    box-shadow: 0 0 0 1px var(--terminal-green), 0 0 20px rgba(0, 210, 106, 0.15);
}

/* ACTIVE STATES */
.is-active,
.btn-active,
.category-btn.active,
.tier-btn.active {
    border-color: var(--terminal-green) !important;
}

.is-active,
.btn-active,
.category-btn.active {
    background-color: var(--terminal-green) !important;
    color: var(--charcoal) !important;
    box-shadow: var(--glow-green);
}

.tier-btn.active {
    color: var(--terminal-green) !important;
    background-color: var(--charcoal-light) !important;
    box-shadow: var(--glow-green-soft);
}

/* LAYOUT COMPONENTS */
.panel-header {
    height: 2.5rem;
    background-color: var(--charcoal-light);
    border-bottom: 1px solid var(--charcoal-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    flex-shrink: 0;
}

.panel-section {
    padding: 0.75rem;
    border-bottom: 1px solid var(--charcoal-border);
}

.panel-section-title {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.025em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-base {
    position: fixed;
    inset-block: 0;
    z-index: 60;
    width: 18rem;
    background-color: var(--charcoal);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

@media (min-width: 768px) {
    .sidebar-base {
        position: relative;
        transform: none !important;
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn {
    color: var(--text-muted);
    transition: color 0.2s ease;
    font-size: 1.25rem;
    padding: 0.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--signal-red);
}

/* SCROLLBARS */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: var(--charcoal);
}

::-webkit-scrollbar-thumb {
    background: var(--charcoal-border);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444444;
}

/* CRT EFFECTS */
.crt-overlay {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
}

.scanlines {
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0),
            rgba(255, 255, 255, 0) 50%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0.2));
    background-size: 100% 4px;
    opacity: 0.15;
}

.vignette {
    background: radial-gradient(circle,
            rgba(18, 16, 16, 0) 50%,
            rgba(0, 0, 0, 0.25) 90%,
            rgba(0, 0, 0, 0.6) 100%);
}

/* PERFORMANCE & STATS GRID */
.stats-grid {
    display: grid;
    gap: 0.25rem;
    text-align: center;
}

.stat-box {
    background-color: var(--charcoal);
    padding: 0.5rem;
    border: 1px solid var(--charcoal-border);
}

/* ANIMATIONS */
@keyframes flash {
    0% {
        box-shadow: inset 0 0 0 3px var(--flash-color), 0 0 30px var(--flash-shadow);
    }

    100% {
        box-shadow: inset 0 0 0 1px var(--charcoal-border);
    }
}

.flash-success,
.flash-warning,
.flash-error {
    animation: flash 0.4s ease-out;
}

.flash-success {
    --flash-color: var(--terminal-green);
    --flash-shadow: rgba(0, 210, 106, 0.5);
}

.flash-warning {
    --flash-color: var(--signal-orange);
    --flash-shadow: rgba(255, 159, 28, 0.5);
}

.flash-error {
    --flash-color: var(--signal-red);
    --flash-shadow: rgba(255, 75, 75, 0.5);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.animate-shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* RECENT RESPONSES */
.response-chip {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: bold;
    color: var(--charcoal);
    transition: transform 0.2s ease;
}

.response-chip:hover {
    transform: scale(1.2);
    z-index: 10;
}

/* STATUS INDICATOR */
.status-indicator {
    width: 8px;
    height: 8px;
    display: inline-block;
}

.status-indicator.online {
    background-color: var(--terminal-green);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* SPARKLINE */
.sparkline {
    stroke-linecap: square;
    fill: none;
}

/* HEATMAP */
.heatmap-cell {
    transition: background-color 0.15s ease;
}