* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Silkscreen', 'Chakra Petch', monospace;
}

body {
    background-color: #050505;
    color: #ffd700;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    user-select: none;
}

#boot-screen,
#offline-screen {
    position: fixed;
    inset: 0;
    background-color: #050505;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
    padding: 24px;
    gap: 12px;
}

#offline-screen {
    display: none;
}

.boot-text {
    font-size: 18px;
    letter-spacing: 2px;
    animation: pulseText 1.2s infinite;
}

.offline-title {
    font-size: 32px;
    font-weight: bold;
    color: #ff3b3b;
    letter-spacing: 4px;
    text-shadow: 0 0 12px rgba(255, 59, 59, 0.65);
    animation: visorFlicker 4s infinite;
}

.offline-sub {
    font-size: 14px;
    color: #b39700;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.offline-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

#btn-retry {
    background: transparent;
    color: #ffd700;
    border: 1px solid #ffd700;
    padding: 12px 24px;
    font-size: 13px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1.5px;
    transition: 0.2s;
}

#btn-retry:hover {
    background: #ffd700;
    color: #050505;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

@keyframes pulseText {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

#auth-screen {
    display: none;
    flex-direction: column;
    width: 380px;
    padding: 28px;
    border: 1px solid #ffd700;
    background-color: #0a0a0a;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.12);
}

.header-title {
    text-align: center;
    font-size: 17px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 22px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #665500;
}

.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 12px;
    margin-bottom: 6px;
    color: #ccac00;
    letter-spacing: 1px;
}

.form-group input {
    background-color: #000000;
    border: 1px solid #665500;
    color: #ffd700;
    padding: 10px;
    font-size: 14px;
    outline: none;
}

.form-group input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.25);
}

#btn-connect {
    margin-top: 8px;
    padding: 12px;
    background-color: #ffd700;
    color: #050505;
    border: none;
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: 0.2s;
}

#btn-connect:hover {
    background-color: #ffea70;
}

#auth-error {
    margin-top: 12px;
    color: #ff3b3b;
    font-size: 12px;
    text-align: center;
    min-height: 16px;
}

#workspace {
    display: none;
    width: 96vw;
    max-width: 1440px;
    height: 86vh;
    gap: 14px;
    align-items: stretch;
}

.side-panel {
    width: 280px;
    min-width: 240px;
    border: 1px solid #4d4000;
    background-color: #090909;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1.5px;
    border-bottom: 1px solid #4d4000;
    background-color: #111005;
}

.panel-content {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    font-size: 12px;
}

.log-line {
    margin-bottom: 6px;
    color: #b39700;
    line-height: 1.35;
    word-break: break-word;
}

.stat-box {
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid #332b00;
    background-color: #0d0d0d;
}

.stat-label {
    font-size: 10px;
    color: #998200;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 13px;
    font-weight: bold;
    color: #ffd700;
}

.highlight-boss {
    color: #00ff88;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #1a1a1a;
    margin-top: 8px;
    border: 1px solid #4d4000;
}

#gpu-bar-fill {
    height: 100%;
    width: 0%;
    background-color: #ffd700;
    transition: width 0.4s ease;
}
#chat-screen {
    flex: 1;
    border: 1px solid #ffd700;
    background-color: #080808;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.08);
    min-width: 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #665500;
    background-color: #111005;
}

.status-text {
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
}

.header-controls {
    display: flex;
    gap: 8px;
}

.lang-btn,
.logout-btn {
    background: transparent;
    border: 1px solid #ffd700;
    color: #ffd700;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: 0.2s;
}

.lang-btn:hover {
    background-color: #ffd700;
    color: #050505;
}

.logout-btn {
    border-color: #ff4d4d;
    color: #ff4d4d;
}

.logout-btn:hover {
    background-color: #ff4d4d;
    color: #050505;
}

#chat-box {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    user-select: text;
}

.message {
    max-width: 78%;
    width: fit-content;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid #4d4000;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: normal;
}

.sender {
    display: block;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 5px;
    opacity: 0.95;
}

.user-msg {
    align-self: flex-end;
    background-color: #1a1705;
    border-color: #ffd700;
    color: #fff3b0;
}

.user-msg .sender {
    color: #00ff88;
    text-align: right;
}

.ai-msg {
    align-self: flex-start;
    background-color: #0f0f0f;
    border-color: #665500;
    color: #ffd700;
}

.ai-msg .sender {
    color: #ffd700;
    text-align: left;
}

.sys-msg {
    align-self: center;
    font-size: 12px;
    color: #998200;
    border: none;
    background: transparent;
    text-align: center;
}

.chat-input-area {
    display: flex;
    padding: 12px;
    gap: 10px;
    border-top: 1px solid #665500;
    background-color: #0d0d0d;
}

#message-input {
    flex: 1;
    background-color: #000000;
    border: 1px solid #665500;
    color: #ffd700;
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
}

#message-input:focus {
    border-color: #ffd700;
}

#btn-send {
    background-color: #ffd700;
    color: #050505;
    border: none;
    padding: 0 20px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.2s;
}

#btn-send:hover {
    background-color: #ffea70;
}

#designer-credit {
    position: fixed;
    bottom: 28px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: #998200;
    letter-spacing: 1.5px;
    z-index: 150;
    pointer-events: none;
}

#security-footer {
    position: fixed;
    bottom: 8px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 9px;
    color: #665500;
    letter-spacing: 1px;
    padding: 0 12px;
    z-index: 150;
    pointer-events: none;
}

::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #080808;
}
::-webkit-scrollbar-thumb {
    background: #4d4000;
}
::-webkit-scrollbar-thumb:hover {
    background: #ffd700;
}

@media (max-width: 950px) {
    body {
        height: 100dvh;
        margin: 0;
        padding: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    #workspace {
        flex-direction: column !important;
        width: 100% !important;
        height: 100dvh !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    #left-panel,
    #right-panel,
    #designer-credit,
    #security-footer {
        display: none !important;
    }

    #chat-screen {
        width: 100% !important;
        height: 100dvh !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .chat-header {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 10px 12px !important;
        flex-shrink: 0;
    }

    #header-status {
        width: 100%;
        font-size: 12px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-controls {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
    }

    .lang-btn,
    .logout-btn {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }

    #chat-box {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 12px !important;
    }

    .message {
        max-width: 86% !important;
        width: fit-content;
        font-size: 13px !important;
        line-height: 1.45;
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: normal;
    }

    .chat-input-area {
        padding: 8px 10px !important;
        gap: 8px !important;
        flex-shrink: 0;
    }

    #message-input {
        font-size: 16px !important;
        padding: 10px 12px !important;
        min-width: 0 !important;
    }

    #btn-send {
        padding: 10px 14px !important;
        font-size: 13px !important;
        flex-shrink: 0;
    }
}

@media (max-width: 600px) {
    #auth-screen {
        width: 90% !important;
        max-width: 360px !important;
        padding: 20px 16px !important;
        margin: auto;
    }

    #auth-screen input,
    #auth-screen button {
        font-size: 16px !important;
    }
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.32) 50%
    );
    background-size: 100% 4px;
    z-index: 9999;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: -10%;
    width: 120%;
    height: 120%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://w3.org id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.06'/%3E%3C/svg%3E");
    box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.85);
    animation: visorStatic 0.25s steps(2) infinite;
    z-index: 9998;
    pointer-events: none;
}

@keyframes visorStatic {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-1%, 1%); }
    50% { transform: translate(1%, -1%); }
    75% { transform: translate(-1%, -0.5%); }
    100% { transform: translate(0.5%, 1%); }
}

.status-text,
.header-title,
.panel-header {
    text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
    animation: visorFlicker 6s infinite;
}

@keyframes visorFlicker {
    0%, 96%, 98%, 100% { opacity: 1; transform: skewX(0deg); }
    97% { opacity: 0.7; transform: skewX(-4deg); }
    99% { opacity: 0.85; transform: skewX(3deg); }
}