body {
    margin: 0;
    font-family: "Segoe UI", "Consolas", monospace, sans-serif;
    color: #e4e4e4;
    background: #101010;
    overflow-x: hidden;
    position: relative;
}

/* Surreal Background */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 25%, rgba(255,50,200,0.2), transparent 40%),
        radial-gradient(circle at 80% 75%, rgba(50,255,200,0.15), transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(100,100,255,0.1), transparent 50%);
    filter: blur(120px);
    opacity: 0.7;
    z-index: -3;
    animation: floatColors 25s infinite alternate ease-in-out;
}
@keyframes floatColors {
    0% { transform: scale(1) translate(0px, 0px) rotate(0deg); }
    50% { transform: scale(1.05) translate(-20px, 15px) rotate(3deg); }
    100% { transform: scale(1) translate(20px, -15px) rotate(-3deg); }
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle, rgba(255,255,255,0.02) 0%, transparent 80%),
        radial-gradient(circle, rgba(200,255,255,0.015) 0%, transparent 70%);
    pointer-events: none;
    z-index: -2;
    animation: mistMove 60s infinite linear;
}
@keyframes mistMove {
    0% { transform: translate(0px, 0px) rotate(0deg); }
    50% { transform: translate(30px, 20px) rotate(1deg); }
    100% { transform: translate(-20px, -15px) rotate(-1deg); }
}

/* Top system bar */
.top-system-bar {
    background: rgba(38, 42, 49, 0.9);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    border-bottom: 1px solid #3a3f47;
    backdrop-filter: blur(4px);
}
.system-items span {
    margin-right: 12px;
    color: #4caf50;
}
.system-items span:nth-child(4) {
    color: orange;
    font-weight: bold;
}
.time-cores {
    display: flex;
    align-items: center;
}
.time {
    margin-right: 12px;
    color: #888;
}
.cores-grid {
    display: grid;
    grid-template-columns: repeat(3, 16px);
    gap: 4px;
}
.core-green { background: #4caf50; width: 14px; height: 14px; }
.core-red   { background: #ff2b2b; width: 14px; height: 14px; }
.core-yellow{ background: orange;    width: 14px; height: 14px; }

/* Header */
.header {
    text-align: center;
    padding: 20px;
    background: rgba(20, 20, 30, 0.7);
    border-bottom: 1px solid #3a3f47;
}
.header h1 a {
    color: #e4e4e4;
    text-decoration: none;
    font-size: 2.5em;
}
.tagline {
    font-size: 13px;
    color: #888;
}

/* Nav bar */
.nav-bar {
    text-align: center;
    padding: 10px;
    background: rgba(38, 42, 49, 0.85);
    border-bottom: 1px solid #3a3f47;
}
.nav-bar a {
    color: #e4e4e4;
    text-decoration: none;
    margin: 0 16px;
}

/* Content grid */
.content-grid {
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    gap: 20px;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Panels */
.panel {
    background: rgba(38, 42, 49, 0.85);
    backdrop-filter: blur(8px);
    padding: 20px;
    border: 1px solid #3a3f47;
    border-radius: 6px;
}
.panel h2 {
    margin-top: 0;
    border-bottom: 1px solid #3a3f47;
    padding-bottom: 10px;
    font-size: 18px;
}
.panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.panel li {
    padding: 6px 0;
    border-bottom: 1px dotted #2f333a;
    font-size: 13px;
    line-height: 1.4;
}

/* Scrollable log */
#log-list {
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Center content spacing */
.center-content .panel {
    margin-bottom: 20px;
}

/* Sector status colors */
.destroyed {
    color: #ff2b2b;
    font-weight: bold;
    text-transform: uppercase;
    animation: flicker 1.2s infinite alternate;
}
@keyframes flicker {
    0%,100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.planned {
    color: orange;
    font-weight: bold;
}

/* Links */
a {
    color: #4caf50;
    text-decoration: none;
    font-weight: bold;
}
a:hover {
    color: #88ff88;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    font-size: 12px;
    color: #666;
    padding: 20px;
    border-top: 1px solid #3a3f47;
}

/* ─────────────────────────────────────────────── */
/* Modal for spectrogram popup                        */
/* ─────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.92);
    backdrop-filter: blur(6px);
}
.modal-content {
    margin: 5% auto;
    display: block;
    max-width: 92%;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(120, 100, 255, 0.6);
}
#caption {
    margin: 15px auto;
    display: block;
    width: 90%;
    max-width: 800px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    font-size: 15px;
}
.close-modal {
    position: absolute;
    top: 25px;
    right: 35px;
    color: #f1f1f1;
    font-size: 45px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}
.close-modal:hover,
.close-modal:focus {
    color: #bbb;
    text-decoration: none;
}

/* ─────────────────────────────────────────────── */
/* Panic / horror mode                                */
/* ─────────────────────────────────────────────── */
.panic-mode {
    background: #1a0000 !important;
    animation: panicFlicker 0.12s infinite alternate;
}
@keyframes panicFlicker {
    0%   { filter: brightness(1) contrast(1) hue-rotate(0deg); }
    50%  { filter: brightness(1.4) contrast(1.3) hue-rotate(8deg); }
    100% { filter: brightness(0.7) contrast(0.9) hue-rotate(-8deg); }
}

/* Darker modal during panic */
.modal {
    background-color: rgba(20, 0, 0, 0.94) !important;
}

/* Ominous close button */
.close-modal {
    color: #ff4444;
    text-shadow: 0 0 10px #ff0000;
}
.close-modal:hover {
    color: #ff7777;
    text-shadow: 0 0 15px #ff4444;
}

/* Responsive */
@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    .close-modal {
        right: 20px;
        top: 15px;
        font-size: 35px;
    }
}