:root {
    --bg-color: #050505;
    --primary-color: #00ff41; /* Classic Matrix Green */
    --primary-glow: rgba(0, 255, 65, 0.5);
    --secondary-color: #6100ff; /* Cyber Purple */
    --accent-color: #00d4ff; /* Tech Cyan */
    --text-color: #e0e0e0;
    --error-color: #ff003c;
    --font-mono: 'Fira Code', monospace;
    --font-heading: 'Orbitron', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-family: var(--font-mono);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Scanlines & Effects */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.15;
}

.vignette {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 50%, rgba(0,0,0,0.8) 100%);
    z-index: 101;
    pointer-events: none;
    opacity: 0; /* Hidden on PC by default */
    transition: opacity 0.5s ease;
}

.mobile-view ~ .vignette, #app-container.mobile-view ~ .vignette {
    opacity: 1; /* Shown when in mobile simulation */
}

@keyframes flicker {
    0% { opacity: 0.27861; }
    5% { opacity: 0.34769; }
    10% { opacity: 0.23604; }
    /* ... shortened for brevity but I'll add a few more ... */
    100% { opacity: 0.23604; }
}

body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 102;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

#app-container {
    width: 95vw;
    height: 90vh; /* Fallback */
    height: 90dvh; /* Dynamic Viewport Height for mobile keyboard support */
    max-width: 1200px;
    border: 1px solid var(--primary-glow);
    background: rgba(0, 20, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.1);
    position: relative;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; /* Added to help with internal layout */
}

.header-btn {
    background: rgba(0, 255, 65, 0.05);
    border: 1px solid var(--primary-glow);
    color: var(--primary-color);
    padding: 2px 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 10px;
    border-radius: 2px;
}

.header-btn:hover {
    background: rgba(0, 255, 65, 0.15);
    box-shadow: 0 0 10px var(--primary-glow);
}

.phase {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.phase.active {
    display: flex;
}

/* Identity Glitch & Scramble Effects */
.identity-glitch {
    position: relative;
    display: inline-block;
    animation: glitch-skew 1s infinite linear alternate-reverse;
}

.identity-glitch::before,
.identity-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.identity-glitch::before {
    left: 2px;
    text-shadow: -2px 0 var(--accent-color);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.identity-glitch::after {
    left: -2px;
    text-shadow: -2px 0 var(--secondary-color);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

.resolving {
    text-shadow: 0 0 10px var(--primary-glow), 0 0 20px var(--primary-glow);
    transition: all 0.2s ease;
}

@keyframes glitch-anim {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    5% { clip: rect(70px, 9999px, 71px, 0); }
    10% { clip: rect(29px, 9999px, 83px, 0); }
    100% { clip: rect(67px, 9999px, 62px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(10px, 9999px, 50px, 0); }
    100% { clip: rect(80px, 9999px, 20px, 0); }
}

@keyframes glitch-skew {
    0% { transform: skew(3deg); }
    10% { transform: skew(-1deg); }
    100% { transform: skew(0deg); }
}

/* Phase 1: Nickname */
.glitch {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 900;
    text-transform: uppercase;
    position: relative;
    text-shadow: 0.05em 0 0 var(--secondary-color), -0.05em -0.025em 0 var(--accent-color);
    animation: glitch 1s infinite;
}

@keyframes glitch {
    0% { text-shadow: 0.05em 0 0 var(--secondary-color), -0.05em -0.025em 0 var(--accent-color); }
    14% { text-shadow: 0.05em 0 0 var(--secondary-color), -0.05em -0.025em 0 var(--accent-color); }
    15% { text-shadow: -0.05em -0.025em 0 var(--secondary-color), 0.025em 0.025em 0 var(--accent-color); }
    49% { text-shadow: -0.05em -0.025em 0 var(--secondary-color), 0.025em 0.025em 0 var(--accent-color); }
    50% { text-shadow: 0.025em 0.05em 0 var(--secondary-color), 0.05em 0 0 var(--accent-color); }
    99% { text-shadow: 0.025em 0.05em 0 var(--secondary-color), 0.05em 0 0 var(--accent-color); }
    100% { text-shadow: -0.025em 0 0 var(--secondary-color), -0.025em -0.025em 0 var(--accent-color); }
}

.multi-input-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 40px;
    width: 100%;
    max-width: 500px;
    transition: opacity 0.5s ease;
}

.input-row {
    display: flex;
    align-items: center;
    border-bottom: 2px solid var(--primary-color);
    padding: 5px 10px;
}

.input-row .prompt {
    font-size: 1.1rem;
    margin-right: 15px;
    opacity: 0.8;
}

#nickname-input, #node-id-input {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-family: var(--font-mono);
    font-size: 1.2rem;
    outline: none;
    flex-grow: 1;
}

#execute-link-btn {
    background: var(--primary-color);
    border: none;
    color: var(--bg-color);
    font-family: var(--font-heading);
    font-size: 1rem;
    padding: 15px 25px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: bold;
    transition: all 0.2s ease;
    text-transform: uppercase;
    position: relative;
    clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
    align-self: center;
}

#execute-link-btn:hover {
    box-shadow: 0 0 25px var(--primary-glow);
    transform: translateY(-2px);
    filter: brightness(1.2);
}

.sub-text {
    margin-top: 25px;
    font-size: 0.9rem;
    opacity: 0.6;
    letter-spacing: 2px;
}

/* Phase 2: Progress */
.progress-bar-container {
    width: 80%;
    height: 20px;
    background: rgba(0, 255, 65, 0.1);
    margin: 20px 0;
    border: 1px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

#progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
    transition: width 0.1s linear;
}

.loading-info {
    display: flex;
    justify-content: space-between;
    width: 80%;
    margin-bottom: 10px;
}

/* Phase 3: Terminals */
.terminal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    height: 100%;
}

.terminal-wrapper {
    background: rgba(0,0,0,0.8);
    border: 1px solid var(--primary-glow);
    display: flex;
    flex-direction: column;
}

.terminal-header {
    background: rgba(0, 255, 65, 0.2);
    padding: 5px 10px;
    font-size: 0.7rem;
    font-weight: bold;
    color: #fff;
}

.terminal-content {
    flex-grow: 1;
    overflow-y: hidden;
    padding: 10px;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

.log-line {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInLog 0.1s forwards;
}

@keyframes fadeInLog {
    to { opacity: 1; transform: translateY(0); }
}

/* Phase 3.5: Diagnostics */
.diagnostic-window {
    width: 70%;
    max-width: 600px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--primary-glow);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.1);
    display: flex;
    flex-direction: column;
}

.diagnostic-header {
    background: var(--primary-color);
    color: var(--bg-color);
    padding: 10px;
    font-weight: bold;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    text-align: center;
}

#diagnostic-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.diag-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px hidden rgba(0, 255, 65, 0.1);
}

.diag-name {
    color: var(--text-color);
}

.diag-status {
    font-weight: bold;
}

.diag-status.ok { color: var(--primary-color); }
.diag-status.warn { color: #ffcc00; }
.diag-status.fail { color: var(--error-color); }

/* ... (the rest is a mix of Phase 4 and Media Queries) ... */
/* I will provide a representative revert by combining the known pieces */

/* Phase 4: Chat */
#phase-chat {
    align-items: stretch;
    justify-content: flex-start;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--primary-glow);
    background: rgba(0, 255, 65, 0.05);
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 15px;
    transition: all 0.5s ease;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.status-indicator.online {
    background: #00ff00;
    box-shadow: 0 0 15px #00ff00;
}

.status-indicator.offline {
    background: #ff0000;
    box-shadow: 0 0 15px #ff0000;
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.chat-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    flex-grow: 1;
}

#online-nodes {
    font-size: 0.7rem;
    color: var(--accent-color);
    margin-right: 20px;
    letter-spacing: 1px;
    background: rgba(0, 212, 255, 0.1);
    padding: 4px 8px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    cursor: help;
}

.system-time {
    font-size: 0.8rem;
    opacity: 0.8;
}

#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(0, 0, 0, 0.2);
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

#chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
    border-radius: 3px;
}

.typing-indicator {
    position: absolute;
    bottom: 5px;
    left: 20px;
    font-size: 0.7rem;
    color: var(--primary-color);
    font-style: italic;
    opacity: 0.8;
    pointer-events: none;
    z-index: 5;
    height: 1.2em;
}

#jump-to-bottom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: var(--bg-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 15px;
    font-family: var(--font-heading);
    font-size: 0.7rem;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
}

.hidden { display: none !important; }

.system-msg { color: var(--accent-color); font-size: 0.8rem; opacity: 0.7; }

.message {
    padding: 8px 12px;
    border-left: 2px solid var(--primary-color);
    background: rgba(0, 255, 65, 0.02);
    animation: fadeIn 0.3s ease-out;
    align-self: flex-start;
    max-width: 85%;
    display: flex;
    flex-direction: column;
}

.message.remote {
    border-left-color: var(--accent-color);
    background: rgba(0, 212, 255, 0.02);
}

.msg-user {
    font-weight: bold;
    margin-bottom: 2px;
    color: var(--primary-color);
    font-size: 0.7rem;
    letter-spacing: 1px;
    opacity: 0.8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.msg-meta { font-size: 0.6rem; opacity: 0.5; font-weight: normal; }

.msg-text a { color: var(--accent-color); text-decoration: underline; }

#exit-chat-btn {
    background: transparent;
    border: 1px solid var(--error-color);
    color: var(--error-color);
    font-family: var(--font-heading);
    font-size: 0.7rem;
    padding: 2px 10px;
    cursor: pointer;
    margin-left: 15px;
}

.clearing-text {
    color: var(--error-color) !important;
    font-family: var(--font-mono);
}

#chat-input-form {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--primary-glow);
}

#message-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 1rem;
    outline: none;
}

/* Floating Terminal Windows (DevBlog) */
.terminal-window {
    position: absolute;
    top: 100px;
    right: 50px;
    width: 450px;
    height: 500px;
    background: rgba(0, 5, 0, 0.98);
    border: 1px solid var(--primary-glow);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.9);
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.window-header {
    background: rgba(0, 255, 65, 0.1);
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    border-bottom: 1px solid var(--primary-glow);
    user-select: none;
}

.window-title {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    color: var(--primary-color);
    letter-spacing: 1.5px;
}

.win-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
}

.window-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-color);
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.blog-post {
    margin-bottom: 25px;
    border-left: 1px solid rgba(0, 255, 65, 0.2);
    padding-left: 15px;
}

.blog-date {
    display: block;
    font-size: 0.65rem;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.blog-title {
    display: block;
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.blog-item {
    display: block;
    margin-bottom: 8px;
    position: relative;
    padding-left: 15px;
}

.blog-item::before {
    content: ">>";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-size: 0.7rem;
}

@media screen and (max-width: 768px) {
    .terminal-window {
        width: 90%;
        height: 70%;
        top: 15% !important;
        right: 5% !important;
        left: 5% !important;
    }
}

.clearing-text {
    color: var(--error-color) !important;
    font-family: var(--font-mono);
}

#chat-input-form {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--primary-glow);
}

#message-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-mono);
    font-size: 1rem;
    outline: none;
}

/* Premium Mobile Adaptation */
@media screen and (max-width: 768px) {
    #app-container {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        padding: 0;
        border: none;
        background: var(--bg-color);
    }

    .vignette { opacity: 1; }

    #toggle-view-btn {
        opacity: 0.8;
        padding: 8px;
        font-size: 1.1rem;
        background: rgba(0, 255, 65, 0.15);
    }

    .glitch { font-size: 2rem; word-break: break-word; }

    .input-container { font-size: 1.1rem; flex-direction: column; align-items: stretch; width: 90%; margin: 20px auto; padding: 15px; }

    #nickname-input { width: 100%; font-size: 1.3rem; padding: 10px 0; text-align: center; }

    .terminal-grid { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; gap: 15px; }

    .terminal-content { font-size: 0.75rem; letter-spacing: 0.5px; }

    .diagnostic-window { width: 100%; font-size: 0.85rem; }

    .chat-header { padding: 12px 10px; gap: 12px; }

    .chat-title { font-size: 0.9rem; }

    #exit-chat-btn { margin-left: auto; padding: 6px 12px; font-size: 0.7rem; }

    #chat-messages { padding: 15px 10px; }

    .message { font-size: 1rem; padding: 12px; margin-bottom: 8px; }

    #chat-input-form { padding: 15px 10px; }

    #message-input { font-size: 1rem; }
}

/* Force mobile view via class */
.mobile-view#app-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    padding: 0;
    border: none;
    background: var(--bg-color);
    z-index: 1000;
}

.mobile-view .phase { padding: 20px; }
.mobile-view #phase-chat.phase { padding: 0; }
.mobile-view #toggle-view-btn { opacity: 0.8; padding: 8px; font-size: 1.1rem; background: rgba(0, 255, 65, 0.15); }
.mobile-view .glitch { font-size: 2rem; word-break: break-word; }
.mobile-view .input-container { font-size: 1.1rem; flex-direction: column; align-items: stretch; width: 90%; margin: 20px auto; padding: 15px; }
.mobile-view #nickname-input { width: 100%; font-size: 1.3rem; padding: 10px 0; text-align: center; }
.mobile-view .terminal-grid { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; gap: 15px; padding: 10px; }
.mobile-view .terminal-content { font-size: 0.75rem; letter-spacing: 0.5px; }
.mobile-view .diagnostic-window { width: 100%; font-size: 0.85rem; }
.mobile-view .chat-header { padding: 12px 10px; gap: 12px; }
.mobile-view .chat-title { font-size: 0.9rem; }
.mobile-view #exit-chat-btn { margin-left: auto; padding: 6px 12px; font-size: 0.7rem; }
.mobile-view #chat-messages { padding: 15px 10px; }
.mobile-view .message { font-size: 1rem; padding: 12px; margin-bottom: 8px; }
.mobile-view #chat-input-form { padding: 15px 10px; }
.mobile-view #message-input { font-size: 1rem; }

/* Attachment Button Styles */
.attach-btn {
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}

.attach-btn:hover { opacity: 1; transform: scale(1.1); text-shadow: 0 0 10px var(--primary-glow); }

.msg-text img {
    display: block;
    max-width: 300px;
    max-height: 200px;
    border: 1px solid var(--primary-glow);
    border-radius: 4px;
    margin-top: 8px;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
    cursor: zoom-in;
}

@media screen and (max-width: 768px) {
    .msg-text img { max-width: 100%; max-height: 250px; }
}

/* Profanity Scramble Effect */
.scrambled-word {
    color: var(--error-color);
    font-weight: bold;
    text-shadow: 0 0 5px var(--error-color);
    display: inline-block;
    padding: 0 2px;
}

.scrambled-word::before {
    content: attr(data-scramble);
    animation: scramble-text 0.15s infinite alternate;
}

@keyframes scramble-text {
    0% { content: "}@#?!-"; }
    20% { content: "$*?&{"; }
    40% { content: "@!+%="; }
    60% { content: "#?$<>"; }
    80% { content: "!&*%{"; }
    100% { content: "?@+-="; }
}

.scrambled-word.revealed { animation: blink-error 0.5s ease; }

@keyframes blink-error {
    0% { opacity: 0; }
    50% { opacity: 1; text-shadow: 0 0 15px var(--error-color); }
    100% { opacity: 1; }
}

/* Phase 5: Locked Portal UI (Global Tokens) */
.locked-container {
    max-width: 600px;
    padding: 40px;
    border: 1px solid var(--error-color);
    background: rgba(20, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 0 50px rgba(255, 0, 60, 0.3);
    text-align: center;
    border-radius: 4px;
    animation: fadeIn 0.5s ease-out;
}

.locked-msg {
    color: var(--error-color);
    font-family: var(--font-heading);
    font-size: 3rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 4px;
    animation: glitch 1s infinite alternate;
}

.ban-text {
    font-size: 1.1rem;
    color: #fff;
    opacity: 0.8;
    margin: 20px 0;
}

.ban-countdown {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 0, 65, 0.1);
    border: 1px solid rgba(255, 0, 60, 0.3);
    border-radius: 4px;
}

.countdown-label {
    display: block;
    font-size: 0.7rem;
    color: var(--error-color);
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.countdown-value {
    display: block;
    font-size: 4rem;
    font-weight: bold;
    color: var(--error-color);
    text-shadow: 0 0 20px var(--error-color);
    font-family: var(--font-heading);
}

.locked-logs {
    margin-top: 30px;
    height: 120px;
    overflow-y: auto;
    font-size: 0.7rem;
    color: var(--error-color);
    opacity: 0.5;
    text-align: left;
    border-top: 1px solid rgba(255, 0, 60, 0.2);
    padding-top: 15px;
    scrollbar-width: none;
}

.locked-logs::-webkit-scrollbar { display: none; }

@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* --- VOID_THEME_ENGINE: MULTI-STYLE OVERRIDES --- */

/* 1. NEON_CYBER THEME */
body.theme-neon {
    --primary-color: #ff007f; /* Neon Pink */
    --primary-glow: rgba(255, 0, 127, 0.6);
    --accent-color: #00f3ff; /* Neon Cyan */
    --secondary-color: #9d00ff; /* Deep Purple */
    --bg-color: #0a000a;
}
body.theme-neon #app-container {
    background: rgba(40, 0, 20, 0.1);
    border-color: var(--primary-glow);
}
body.theme-neon .chat-header { background: rgba(255, 0, 127, 0.05); }
body.theme-neon .message { border-left-color: var(--primary-color); background: rgba(255, 0, 127, 0.02); }

/* 2. CLASSIC_SILVER THEME */
body.theme-gray {
    --primary-color: #e0e0e0; /* Silver/Slate */
    --primary-glow: rgba(255, 255, 255, 0.1);
    --accent-color: #888888;
    --secondary-color: #444444;
    --bg-color: #1a1a1a;
}
body.theme-gray #app-container {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.1);
}
body.theme-gray .chat-header { background: rgba(255, 255, 255, 0.05); }
body.theme-gray .message { border-left-color: #888; background: rgba(255, 255, 255, 0.01); }

/* 3. STYLING_PANEL INTERFACE */
#styling-panel {
    position: absolute;
    top: 65px;
    right: -320px;
    width: 260px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid var(--primary-color);
    padding: 20px;
    z-index: 2005;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#styling-panel.open {
    right: 20px;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.panel-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--primary-glow);
    padding-bottom: 8px;
    letter-spacing: 2px;
}

.theme-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theme-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--primary-glow);
    color: var(--primary-color);
    padding: 12px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-option:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px var(--primary-glow);
}

.theme-option.active {
    background: var(--primary-color);
    color: var(--bg-color);
    font-weight: bold;
}

.preview-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-matrix { background: #00ff41; box-shadow: 0 0 5px #00ff41; }
.dot-neon { background: #ff007f; box-shadow: 0 0 5px #ff007f; }
.dot-gray { background: #e0e0e0; box-shadow: 0 0 5px #e0e0e0; }

@media screen and (max-width: 768px) {
    #styling-panel.open {
        right: 0;
        width: 100%;
        top: 60px;
    }
}

/* --- VOID_ANIMATION_ENGINE: CANVAS BACKGROUND --- */

#void-bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    display: block;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#void-bg-canvas.visible {
    opacity: 1;
}

/* Red Core Theme */
body.theme-red {
    --primary-color: #ff2525;
    --primary-glow: rgba(255, 37, 37, 0.6);
    --accent-color: #ff8800;
    --secondary-color: #880000;
    --bg-color: #0a0000;
}
body.theme-red #app-container {
    background: rgba(30, 0, 0, 0.1);
    border-color: rgba(255, 37, 37, 0.4);
}
body.theme-red .chat-header { background: rgba(255, 0, 0, 0.05); }
body.theme-red .message { border-left-color: var(--primary-color); background: rgba(255, 37, 37, 0.02); }

.dot-red { background: #ff2525; box-shadow: 0 0 5px #ff2525; }

/* --- VOID_BG_ACTIVE: Glassmorphic Overlay when animation is running --- */

body.bg-active #app-container {
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.8s ease, backdrop-filter 0.8s ease;
}

body.bg-active .chat-header {
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.bg-active #chat-input-form {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

body.bg-active .message {
    background: rgba(0, 0, 0, 0.55) !important;
}

body.bg-active .terminal-wrapper,
body.bg-active .diagnostic-window {
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
