:root {
    --main-color: #00CC66;
    --bg-color: #050505;
    --glitch-color: #ff00ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    color: var(--main-color);
    font-family: 'VT323', monospace;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-shadow: 0 0 5px var(--main-color);
}

button {
    font-family: 'VT323', monospace;
    cursor: pointer;
    color: var(--main-color);
    background: transparent;
    border: none;
    text-shadow: 0 0 5px var(--main-color);
    transition: all 0.2s;
}

.scanlines {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    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: 999;
    animation: scroll 10s linear infinite;
}

/* Fullscreen background canvas for wireframe animation */
#wireframe {
    position: fixed;
    inset: 0; /* top:0; right:0; bottom:0; left:0; */
    width: 100vw;
    height: 100vh;
    display: block;
    z-index: 0; /* behind main UI */
    pointer-events: none; /* don't interfere with clicks */
    mix-blend-mode: screen; /* subtle glow blending */
    opacity: 0.95;
}

/* Background pseudo-terminal (faint, behind UI) */
#bg-terminal {
    position: fixed;
    inset: 0;
    z-index: 1; /* above canvas (0) but below .container (2) */
    pointer-events: none;
    color: rgba(0,220,140,0.5);
    font-family: 'VT323', monospace;
    font-size: 12px;
    line-height: 1.05;
    white-space: pre-wrap;
    overflow: hidden;
    padding: 28px 40px;
    text-shadow: 0 0 6px rgba(0,220,140,0.06);
    mix-blend-mode: screen;
    display: block;
}

/* Slight vertical scroll to simulate terminal output movement */
.bg-scroll {
    animation: bgScroll 30s linear infinite;
}

@keyframes bgScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(-6%); }
}

@media (prefers-reduced-motion: reduce) {
    #bg-terminal { opacity: 0.09; }
    .bg-scroll { animation: none; }
}

/* Put main container above the background */
.container { z-index: 2; }

/* Keep scanlines above canvas but below boot-screen */
.scanlines { z-index: 3; }

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    #wireframe { opacity: 0.6; }
    .scanlines { animation: none; }
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    right: 20px;
    top: 20px;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: rgba(0, 10, 0, 0.85);
    border: 1px solid rgba(0,204,102,0.15);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    z-index: 10010; /* Above boot screen */
    color: var(--main-color);
    font-family: 'VT323', monospace;
    display: none; /* toggled via JS */
    pointer-events: auto;
}
.settings-panel[aria-hidden="false"] { display: block; }
.settings-inner { padding: 12px; }
.settings-panel header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.settings-panel h2 { font-size:1.2rem; margin:0; }
.settings-panel button { background:transparent; border:none; color:var(--main-color); font-size:1.1rem; cursor:pointer; }
.settings-row { margin: 8px 0; display:flex; flex-direction:column; gap:6px; }
.settings-row label { font-size:0.95rem; }
.settings-row input[type=range] { width:100%; }
.settings-row select { width:100%; background:transparent; color:var(--main-color); border:1px solid rgba(0,204,102,0.12); padding:6px; }
.settings-note { font-size:0.8rem; opacity:0.7; margin-top:8px; }

@media (max-width:700px){
    .settings-panel { right: 10px; left: 10px; top: auto; bottom: 10px; width: auto; }
}

.container {
    width: 90%; max-width: 900px; /* Made slightly wider for the grid */
    border: 2px solid var(--main-color);
    padding: 2rem;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 204, 102, 0.2);
    background: rgba(0, 20, 0, 0.8);
}

/* BOOT SCREEN STYLES */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000; /* Pitch black boot screen */
    color: var(--main-color);
    z-index: 9999; /* Sit on top of everything */
    padding: 2rem;
    overflow: hidden;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#boot-text {
    white-space: pre-wrap; /* Keep formatting */
    margin-bottom: 5px;
}

/* Animation to hide the boot screen */
.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-out;
}

/* Animation to show the main interface */
.fade-in {
    opacity: 1 !important;
    transition: opacity 1s ease-in;
}

/* Make sure the green "OK" looks distinct in the logs */
.log-ok { color: #00ff00; font-weight: bold; }
.log-warn { color: #ffff00; }
.log-err { color: #ff0000; }

/* --- HEADER LAYOUT --- */
.top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Aligns bottom of text */
    border-bottom: 1px solid var(--main-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 4rem;
    line-height: 1;
    letter-spacing: 5px;
}

/* The Admin Tools (Top Right) */
.system-tray {
    display: flex;
    gap: 1rem;
    margin-bottom: 10px;
}

.sys-link {
    text-decoration: none;
    color: var(--main-color);
    font-size: 1.2rem;
    opacity: 0.7;
    transition: all 0.2s;
}
.sys-link:hover {
    opacity: 1;
    text-shadow: 0 0 8px var(--main-color);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.8;
}

/* --- MAIN GRID LAYOUT --- */
.terminal-output {
    font-size: 1.5rem;
    min-height: 60px;
    margin-bottom: 1.5rem;
}

/* Two Column Grid */
.link-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two equal columns */
    gap: 1.5rem; /* Space between items */
}

.net-link {
    text-decoration: none;
    color: var(--main-color);
    font-size: 2rem;
    transition: all 0.2s;
    display: block;
    border: 1px solid transparent; /* Placeholder to prevent jump */
}

.net-link:hover {
    background-color: var(--main-color);
    color: var(--bg-color);
    text-shadow: none;
    padding-left: 10px;
}

.net-link .bracket { opacity: 0; transition: opacity 0.2s; }
.net-link:hover .bracket { opacity: 1; }

footer { margin-top: 3rem; font-size: 1rem; opacity: 0.5; text-align: right; }

@keyframes scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 100%; }
}

/* Status Bar Tweaks */
.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.8;
    border-bottom: 1px solid #004422; /* Subtle separator */
    padding-bottom: 5px;
}

.separator { margin: 0 10px; opacity: 0.5; }

/* Dashboard Upper (Split View) */
.dashboard-upper {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* Text takes more space, Weather takes less */
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: start;
}

/* Weather Widget Styling */
.weather-container {
    border: 1px dotted var(--main-color);
    padding: 10px;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.3);
}

#weather-box {
    font-family: 'VT323', monospace; /* Crucial for ASCII alignment */
    font-size: 1rem;
    line-height: 1;
    white-space: pre; /* Preserves whitespace for ASCII art */
    overflow: hidden;
}

/* Mobile: Stack the grid back to 1 column */
@media (max-width: 700px) {
    h1 { font-size: 2.5rem; }
    .link-grid { grid-template-columns: 1fr; gap: 0.5rem; }
    .top-row { flex-direction: column; align-items: flex-start; }
    .system-tray { margin-top: 1rem; width: 100%; justify-content: flex-end;}
}

@media (max-width: 700px) {
    .dashboard-upper { grid-template-columns: 1fr; }
    .weather-container { display: none; } /* Optional: Hide weather on mobile if too cluttered */
}

/* Command Line Styling */
.command-line {
    margin-top: 2rem;
    border-top: 1px dashed var(--main-color);
    padding-top: 1rem;
    display: flex;
    align-items: center;
}

.prompt {
    margin-right: 10px;
    white-space: nowrap;
}

#cmd-input {
    background: transparent;
    border: none;
    color: var(--main-color);
    font-family: 'VT323', monospace;
    font-size: 1rem;
    width: 100%;
    outline: none;
    text-shadow: 0 0 5px var(--main-color);
    caret-color: var(--main-color); /* The blinking cursor color */
}

/* Optional: Make the input glow slightly on focus */
#cmd-input:focus {
    text-shadow: 0 0 8px var(--main-color);
}