:root {
    --bg-color: #030107;
    --terminal-green: #2aff2a;
    --warning-amber: #ffaa00;
    --corrupted-red: #ff0044;
    --void-purple: #8a2be2;
    --glow-color: rgba(138, 43, 226, 0.4);
    --font-main: 'VT323', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--terminal-green);
    font-family: var(--font-main);
    font-size: 1.4rem;
    line-height: 1.3;
    overflow-x: hidden;
    overflow-wrap: break-word;
    padding: 20px;
    position: relative;
}

/* CRT Scanline Filter Simulation */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.3) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.05), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 9999;
    background-size: 100% 5px, 6px 100%;
    pointer-events: none;
}

header {
    text-align: center;
    border-bottom: 2px dashed var(--void-purple);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.subtitle {
    color: #888;
    font-size: 1.1rem;
    margin-top: 5px;
}

.marquee-container {
    background: #100020;
    border: 1px solid var(--void-purple);
    padding: 5px;
    margin-bottom: 15px;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-text {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 18s linear infinite;
}

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

.signal-banner {
    max-width: 900px;
    margin: 0 auto 18px;
    padding: 8px 14px;
    text-align: center;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    color: var(--warning-amber);
    background: rgba(255, 176, 0, 0.06);
    border: 1px dashed var(--warning-amber);
}

h1 {
    font-size: 3.8rem;
    text-shadow: 0 0 10px var(--void-purple);
    color: #fff;
    letter-spacing: 3px;
}

.game-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .game-grid {
        grid-template-columns: 310px 1fr;
    }
}

.sidebar {
    border: 2px solid var(--void-purple);
    padding: 15px;
    background: rgba(10, 2, 20, 0.7);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.2);
}

.sidebar h2 {
    border-bottom: 1px solid var(--void-purple);
    margin-bottom: 12px;
    padding-bottom: 3px;
    color: #fff;
    font-size: 1.6rem;
}

.stat-line {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

/* Dashboard Navigation Link Modules */
.dashboard-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.dashboard-links a {
    color: #fff;
    background: rgba(138, 43, 226, 0.2);
    border: 1px solid var(--void-purple);
    padding: 6px;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    text-align: center;
}

.dashboard-links a:hover {
    background: var(--terminal-green);
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 8px var(--terminal-green);
}

.ca-container {
    border: 1px dashed #ff0044;
    background: rgba(255, 0, 68, 0.1);
    padding: 6px;
    font-family: monospace;
    font-size: 0.75rem;
    word-break: break-all;
    margin-top: 5px;
}

.ca-label {
    color: var(--corrupted-red);
    font-weight: bold;
    display: block;
}

.ca-value {
    color: #eee;
}

.main-panel {
    border: 2px solid var(--void-purple);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(5, 1, 10, 0.9);
    min-height: 450px;
}

.gauge-container {
    width: 100%;
    max-width: 500px;
    border: 2px solid var(--terminal-green);
    height: 35px;
    margin: 20px 0;
    position: relative;
    background: #0d021a;
}

.gauge-bar {
    height: 100%;
    width: 50%;
    background-color: var(--terminal-green);
    transition: width 0.3s ease, background-color 0.5s ease;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    font-size: 1.5rem;
    color: #fff;
    text-shadow: 2px 2px 0px #000;
}

/* Purple & Green Portrait Frame Interface Asset */
.void-face-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    mix-blend-mode: screen; /* Blends the black image backgrounds directly into your web theme */
}


.void-face-canvas {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #2b004f 20%, #000000 80%);
    position: relative;
}

/* Simulating the glowing eye artifacts */
.cyber-eye {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    top: 42%;
}

.left-eye {
    left: 32%;
    background: #2aff2a;
    box-shadow: 0 0 12px #2aff2a, 0 0 20px #2aff2a;
}

.right-eye {
    right: 32%;
    background: #ff0044;
    box-shadow: 0 0 12px #ff0044;
}

.file-info-tag {
    position: absolute;
    bottom: 4px;
    left: 6px;
    font-size: 0.85rem;
    color: #666;
    background: rgba(0,0,0,0.7);
    padding: 0 4px;
}

.btn-pet {
    background: transparent;
    color: var(--terminal-green);
    border: 3px outset var(--terminal-green);
    font-family: var(--font-main);
    font-size: 1.9rem;
    padding: 8px 25px;
    cursor: pointer;
    transition: all 0.1s ease;
    margin-top: 15px;
}

.btn-pet:active {
    border-style: inset;
    background: rgba(42, 255, 42, 0.2);
}

.void-speech-bubble {
    background: rgba(20, 5, 35, 0.8);
    border: 1px dashed var(--void-purple);
    padding: 12px;
    margin: 15px 0;
    min-height: 70px;
    width: 100%;
    max-width: 550px;
    font-style: italic;
    text-align: center;
}

.terminal-log {
    width: 100%;
    background: #020005;
    border: 1px solid var(--void-purple);
    height: 110px;
    margin-top: 15px;
    padding: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-y: auto;
    text-align: left;
}

.log-entry {
    margin-bottom: 5px;
    border-left: 3px solid var(--terminal-green);
    padding-left: 6px;
    color: #aaa;
}

/* Core Lore Panel Area */
.lore-footer-panel {
    margin-top: 25px;
    border: 2px solid #333;
    background: #0a0512;
    padding: 15px;
    font-size: 1.1rem;
    color: #8c829e;
}

.lore-footer-panel h3 {
    color: #fff;
    border-bottom: 1px solid #333;
    margin-bottom: 8px;
}

/* STATE MUTATIONS OVERRIDES */
body.state-decaying {
    color: var(--warning-amber);
}
body.state-decaying .sidebar, 
body.state-decaying .main-panel { border-color: var(--warning-amber); }
body.state-decaying .gauge-bar { background-color: var(--warning-amber); }
body.state-decaying .btn-pet { color: var(--warning-amber); border-color: var(--warning-amber); }

body.state-dissolving {
    color: var(--corrupted-red);
    background-color: #120005;
}
body.state-dissolving .sidebar, 
body.state-dissolving .main-panel { border-color: var(--corrupted-red); animation: shake 0.3s infinite; }
body.state-dissolving .gauge-bar { background-color: var(--corrupted-red); }
body.state-dissolving .btn-pet { color: var(--corrupted-red); border-color: var(--corrupted-red); }

@keyframes shake {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-1px, 1px); }
    100% { transform: translate(1px, -1px); }
}

.message-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    border: 4px double var(--corrupted-red);
    padding: 20px;
    z-index: 10000;
    width: 300px;
    text-align: center;
    display: none;
}

.message-box button {
    background: transparent;
    color: #fff;
    border: 1px solid #fff;
    padding: 4px 12px;
    font-family: var(--font-main);
    cursor: pointer;
    margin-top: 10px;
}

.counter-box {
    background: #000;
    border: 1px solid #444;
    padding: 2px 6px;
    font-family: monospace;
    color: #ff3333;
    font-weight: bold;
}
/* === NEW MINI-GAME STYLES === */
.residual-spot {
    background: rgba(42, 255, 42, 0.1);
    border: 1px dashed var(--terminal-green);
    padding: 18px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.residual-spot:hover {
    background: rgba(42, 255, 42, 0.25);
    box-shadow: 0 0 12px var(--terminal-green);
}

.residual-spot.collected {
    opacity: 0.3;
    pointer-events: none;
    border-color: #555;
}

#btn-wander {
    border-color: var(--void-purple);
    color: #d8b4fe;
}

#btn-wander:hover {
    background: rgba(138, 43, 226, 0.2);
}
/* === Instructions Panel === */
.instructions-panel {
    background: rgba(10, 2, 20, 0.95);
    border: 2px solid var(--void-purple);
    padding: 20px;
    margin-bottom: 20px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.instructions-panel h3 {
    color: #fff;
    margin-bottom: 10px;
    margin-top: 18px;
    border-bottom: 1px solid var(--void-purple);
    padding-bottom: 5px;
}

.instructions-panel h3:first-child {
    margin-top: 0;
}

.instructions-panel p {
    margin-bottom: 8px;
    font-size: 1.15rem;
}

.instructions-panel p strong {
    color: #d8b4fe;
}

.instructions-panel em {
    color: var(--warning-amber);
    font-style: normal;
}

.instructions-panel .legend-row {
    display: flex;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 1.05rem;
    line-height: 1.25;
}

.instructions-panel .legend-row b {
    color: #d8b4fe;
    flex: 0 0 145px;
}

/* Re-open instructions button (header) */
.help-toggle {
    display: inline-block;
    margin-top: 12px;
    background: rgba(138, 43, 226, 0.18);
    color: #d8b4fe;
    border: 1px solid var(--void-purple);
    font-family: var(--font-main);
    font-size: 1.05rem;
    letter-spacing: 1px;
    padding: 5px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.help-toggle:hover {
    background: var(--void-purple);
    color: #fff;
    box-shadow: 0 0 10px var(--glow-color);
}

@media (max-width: 600px) {
    body { font-size: 0.95rem; padding: 12px; }
    h1 { font-size: 1.9rem; letter-spacing: 1px; }
    .subtitle { font-size: 0.88rem; }
    .help-toggle { font-size: 0.85rem; padding: 5px 10px; white-space: normal; }
    .signal-banner { font-size: 0.88rem; padding: 8px 10px; }
    .instructions-panel { padding: 12px; }
    .instructions-panel p { font-size: 0.92rem; }
    .instructions-panel .legend-row {
        flex-direction: column;
        gap: 0;
        margin-bottom: 10px;
    }
    .instructions-panel .legend-row b {
        flex-basis: auto;
    }
    .sidebar h2 { font-size: 1.3rem; }
    .btn-pet { font-size: 1.4rem; padding: 8px 16px; }
    .terminal-log { font-size: 0.8rem; }
}

/* === Residual Spots === */
.residual-spot {
    background: rgba(42, 255, 42, 0.08);
    border: 1px dashed var(--terminal-green);
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.residual-spot:hover {
    background: rgba(42, 255, 42, 0.22);
    box-shadow: 0 0 12px var(--terminal-green);
}

.residual-spot.collected {
    opacity: 0.35;
    pointer-events: none;
    border-color: #444;
}

#btn-wander {
    border-color: var(--void-purple);
    color: #d8b4fe;
}