:root {
    --bg-color: #0a0a0a;
    --term-color: #0f0; /* Classic Green */
    --term-glow: #0f0;
    --error-color: #f00;
    --warn-color: #fa0;
}

/* Themes */
body.theme-amber {
    --term-color: #ffb000;
    --term-glow: #ffb000;
}

body.theme-cyan {
    --term-color: #00ffff;
    --term-glow: #00ffff;
}

body {
    background-color: var(--bg-color);
    color: var(--term-color);
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-shadow: 0 0 5px var(--term-glow);
}

/* Background Grid */
.background-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 200vw;
    height: 200vh;
    background: 
        linear-gradient(transparent 0%, rgba(0, 255, 0, 0.1) 2%, transparent 3%),
        linear-gradient(90deg, transparent 0%, rgba(0, 255, 0, 0.1) 2%, transparent 3%);
    background-size: 50px 50px;
    transform: perspective(500px) rotateX(60deg) translateY(-100px) translateZ(-200px);
    animation: gridMove 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes gridMove {
    0% { transform: perspective(500px) rotateX(60deg) translateY(0) translateZ(-200px); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(50px) translateZ(-200px); }
}

/* HUD Elements - REMOVED */
/* Replaced by Dashboard Layout */

.dashboard-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    padding-bottom: 110px; /* keep content above terminal drawer */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    z-index: 5;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--term-color);
    margin-bottom: 20px;
    background: rgba(0, 20, 0, 0.8);
}


.main-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 20px;
    flex-grow: 1;
    height: 0; /* Force scroll within panels if needed */
}

.panel {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--term-color);
    padding: 15px;
    display: flex;
    flex-direction: column;
}

h3 {
    margin-top: 0;
    border-bottom: 1px dashed var(--term-color);
    padding-bottom: 5px;
    font-size: 1.2em;
}

/* Service Cards */
.service-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.card {
    border: 1px solid var(--term-color);
    padding: 10px;
    background: rgba(0, 50, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.card:hover {
    background: rgba(0, 255, 0, 0.1);
    transform: translateY(-2px);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    box-shadow: 0 0 5px currentColor;
}

[data-status="online"] .status-dot { background: #0f0; color: #0f0; }
[data-status="warning"] .status-dot { background: #fa0; color: #fa0; }
[data-status="offline"] .status-dot { background: #f00; color: #f00; }

/* Network Map */
.network-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.network-map {
    position: relative;
    width: 200px;
    height: 200px;
}

.node {
    position: absolute;
    background: var(--term-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--term-glow);
}

.center-node {
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.satellite-node {
    width: 10px;
    height: 10px;
    animation: orbit 10s linear infinite;
}

.n1 { top: 20%; left: 50%; animation-delay: 0s; }
.n2 { top: 50%; right: 20%; animation-delay: -2.5s; }
.n3 { bottom: 20%; left: 50%; animation-delay: -5s; }
.n4 { top: 50%; left: 20%; animation-delay: -7.5s; }

@keyframes orbit {
    0% { transform: rotate(0deg) translateX(80px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}

.network-status {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 0.8em;
}

/* System Stats */
.stat-row {
    margin-bottom: 15px;
    font-size: 0.9em;
}

.bar-container {
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
    border: 1px solid var(--term-color);
}

.bar-fill {
    height: 100%;
    background: var(--term-color);
    box-shadow: 0 0 5px var(--term-glow);
    transition: width 0.5s;
}

.mini-terminal {
    margin-top: auto;
    font-size: 0.7em;
    opacity: 0.8;
}

.scoreboard-panel {
    margin-top: 15px;
    border-top: 1px dashed var(--term-color);
    padding-top: 10px;
}

.scoreboard-panel h4 {
    margin: 0 0 8px;
    font-size: 0.9em;
    letter-spacing: 1px;
}

#scoreboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 140px;
    overflow-y: auto;
}

#scoreboard-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    padding: 4px 0;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.1);
}

#scoreboard-list .tag {
    font-weight: bold;
}

#scoreboard-list .ts {
    opacity: 0.7;
}

#scoreboard-list .empty {
    justify-content: center;
    font-style: italic;
    opacity: 0.6;
}

/* Terminal Drawer */
.terminal-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px; /* Collapsed height */
    background: #000;
    border-top: 2px solid var(--term-color);
    z-index: 100;
    transition: height 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.terminal-drawer.open {
    height: 50vh;
}

.drawer-handle {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0, 50, 0, 0.2);
    font-weight: bold;
    letter-spacing: 2px;
}

.drawer-handle:hover {
    background: rgba(0, 100, 0, 0.4);
}

.terminal-content {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: none; /* Hidden when collapsed */
}

.terminal-drawer.open .terminal-content {
    display: block;
}

/* Hide old terminal styles */
.terminal, .side-panel { display: none; }

/* Mobile */
@media (max-width: 768px) {
    .main-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .network-panel { display: none; } /* Hide map on mobile */
}
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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;
    pointer-events: none;
    z-index: 10;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 150, 0, 0) 60%, rgba(0, 0, 0, 0.6) 100%);
    pointer-events: none;
    z-index: 9;
}

.terminal {
    width: 65%; /* Reduced width to make room for side panel */
    height: 80%;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    background: rgba(10, 10, 10, 0.9); /* Semi-transparent background */
    border: 1px solid var(--term-color);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
    margin-right: 20px; /* Spacing */
}

.side-panel {
    width: 30%;
    height: 80%;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid var(--term-color);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#neofetch-static {
    font-size: 12px; /* Smaller font for the art */
    line-height: 1.2;
    white-space: pre;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    .terminal {
        width: 90%;
        height: 60%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    .side-panel {
        width: 90%;
        height: 30%;
        font-size: 10px;
    }
}

.terminal::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

#output {
    white-space: pre-wrap;
    margin-bottom: 10px;
}

.line {
    margin: 2px 0;
    opacity: 0;
    animation: fadeIn 0.1s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.input-line {
    display: flex;
    align-items: center;
}

.prompt {
    margin-right: 10px;
    font-weight: bold;
}

#command-input {
    background: transparent;
    border: none;
    color: var(--term-color);
    font-family: inherit;
    font-size: inherit;
    flex-grow: 1;
    outline: none;
    text-shadow: inherit;
    caret-color: var(--term-color);
}

.success { color: var(--term-color); }
.error { color: var(--error-color); text-shadow: 0 0 5px var(--error-color); }
.warning { color: var(--warn-color); text-shadow: 0 0 5px var(--warn-color); }
.system { color: #aaa; font-style: italic; }

/* Glitch effect for boot */
@keyframes glitch {
    0% { transform: translate(0) }
    20% { transform: translate(-2px, 2px) }
    40% { transform: translate(-2px, -2px) }
    60% { transform: translate(2px, 2px) }
    80% { transform: translate(2px, -2px) }
    100% { transform: translate(0) }
}

.glitch {
    animation: glitch 0.2s linear infinite;
}