:root {
    --vp-bg: #050011;
    --vp-pink: #ff00ff;
    --vp-cyan: #00ffff;
    --vp-purple: #9d00ff;
    --vp-yellow: #ffff00;
    --vp-grid: rgba(255, 0, 255, 0.1);
    --vp-glass: rgba(10, 0, 20, 0.85);

    --font-head: 'Press Start 2P', monospace;
    --font-ui: 'Orbitron', sans-serif;
    --font-body: 'Exo 2', sans-serif;
}

body {
    background-color: var(--vp-bg);
    color: #fff;
    font-family: var(--font-body);
    margin: 0;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- CRT & GLITCH EFFECTS --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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: 1000;
}

.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 100%), linear-gradient(rgba(18, 16, 16, 0), rgba(18, 16, 16, 0));
    pointer-events: none;
    z-index: 999;
}

.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    pointer-events: none;
    z-index: 998;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- LAYOUT --- */
#main-interface {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    z-index: 10;
    position: relative;
    background:
        linear-gradient(rgba(5, 0, 17, 0.9), rgba(5, 0, 17, 0.9)),
        repeating-linear-gradient(0deg, transparent 0, transparent 40px, var(--vp-grid) 40px, var(--vp-grid) 41px),
        repeating-linear-gradient(90deg, transparent 0, transparent 40px, var(--vp-grid) 40px, var(--vp-grid) 41px);
    background-size: 100% 100%, 100% 100%, 100% 100%;
    perspective: 1000px;
}

/* --- HEADER --- */
.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid var(--vp-pink);
    background: var(--vp-glass);
    padding: 10px 20px;
    box-shadow: 0 0 15px var(--vp-pink), inset 0 0 10px var(--vp-pink);
    margin-bottom: 20px;
    transform: skewX(-10deg);
}

.header-segment {
    transform: skewX(10deg);
}

.main-title {
    font-family: var(--font-head);
    font-size: 2rem;
    color: var(--vp-yellow);
    text-shadow: 3px 3px var(--vp-purple);
    margin: 0;
    text-transform: uppercase;
}

.label {
    font-size: 0.9rem;
    color: var(--vp-cyan);
    font-family: var(--font-ui);
    letter-spacing: 2px;
}

.value {
    font-family: var(--font-ui);
    font-weight: bold;
    font-size: 1.5rem;
}

.neon-pink {
    color: var(--vp-pink);
    text-shadow: 0 0 5px var(--vp-pink);
}

.neon-cyan {
    color: var(--vp-cyan);
    text-shadow: 0 0 5px var(--vp-cyan);
}

.neon-yellow {
    color: var(--vp-yellow);
    text-shadow: 0 0 5px var(--vp-yellow);
}

.neon-green {
    color: #0f0;
    text-shadow: 0 0 5px #0f0;
}

.flicker-slow {
    animation: flicker 4s infinite;
}

@keyframes flicker {

    0%,
    100% {
        opacity: 1;
    }

    95% {
        opacity: 0.8;
    }

    96% {
        opacity: 0.2;
    }

    97% {
        opacity: 1;
    }
}

/* --- MAIN CONTAINER --- */
.holo-container {
    display: flex;
    flex-grow: 1;
    gap: 20px;
    overflow: hidden;
}

.side-panel {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-box {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--vp-cyan);
    padding: 15px;
    box-shadow: 0 0 8px var(--vp-cyan);
}

.panel-box h3 {
    margin: 0 0 10px 0;
    color: var(--vp-purple);
    font-family: var(--font-ui);
    border-bottom: 1px dashed var(--vp-pink);
    padding-bottom: 5px;
    font-size: 1.1rem;
}

.data-row {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    margin-top: 8px;
    font-family: var(--font-ui);
}

.bar-container {
    width: 60%;
    height: 8px;
    background: #222;
    border: 1px solid #555;
}

.bar-fill {
    height: 100%;
}

.neon-pink-bg {
    background: var(--vp-pink);
    box-shadow: 0 0 5px var(--vp-pink);
}

.neon-cyan-bg {
    background: var(--vp-cyan);
    box-shadow: 0 0 5px var(--vp-cyan);
}

.warning {
    color: red;
    animation: blink 1s infinite;
    font-weight: bold;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.large-digit {
    font-family: var(--font-head);
    font-size: 3rem;
    text-align: center;
    margin: 10px 0;
}

.level-desc {
    text-align: center;
    font-size: 0.8rem;
    color: #ccc;
}

/* --- CHAT INTERFACE --- */
.chat-interface {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--vp-purple);
    box-shadow: inset 0 0 20px rgba(157, 0, 255, 0.2), 0 0 15px var(--vp-purple);
}

.chat-header {
    background: var(--vp-purple);
    color: #fff;
    padding: 5px 15px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.chat-scroll-area {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
}

/* Messages */
.message {
    margin-bottom: 15px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.bubble {
    background: rgba(0, 255, 255, 0.1);
    border-left: 3px solid var(--vp-cyan);
    padding: 10px;
    max-width: 80%;
    font-size: 1.2rem;
    line-height: 1.5;
}

.user-msg {
    align-self: flex-end;
    text-align: right;
}

/* Flex fix for user messages alignment */
.message.user-msg {
    display: flex;
    justify-content: flex-end;
}

.user-msg .bubble {
    background: rgba(255, 0, 255, 0.1);
    border-left: none;
    border-right: 3px solid var(--vp-pink);
}

.sender {
    display: block;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 3px;
    color: var(--vp-cyan);
    font-family: var(--font-ui);
}

.user-msg .sender {
    color: var(--vp-pink);
}

/* Input */
.input-zone {
    padding: 25px;
    background: rgba(0, 0, 0, 0.95);
    border-top: 3px solid var(--vp-purple);
    min-height: 80px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 4px solid var(--vp-cyan);
    padding-bottom: 5px;
}

.prompt-symbol {
    color: var(--vp-pink);
    font-family: var(--font-head);
    font-size: 1.8rem;
    margin-right: 15px;
    animation: blink 1s infinite;
}

#user-input {
    background: transparent;
    border: none;
    color: var(--vp-cyan);
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    flex-grow: 1;
    outline: none;
    text-shadow: 0 0 5px var(--vp-cyan);
    padding: 10px 0;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.status-item {
    border: 1px solid #555;
    text-align: center;
    padding: 8px;
    font-size: 0.9rem;
    background: #111;
}

.status-item.online {
    border-color: #0f0;
    color: #0f0;
    box-shadow: inset 0 0 5px #0f0;
}

.status-item.offline {
    border-color: red;
    color: red;
}

.status-item.warning {
    border-color: var(--vp-yellow);
    color: var(--vp-yellow);
    animation: blink 2s infinite;
}

/* Retro Sun Decorative */
.decorative-box {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    border: none;
    background: transparent;
    box-shadow: none;
}

.retro-sun {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: linear-gradient(to top, var(--vp-yellow), var(--vp-pink));
    box-shadow: 0 0 40px var(--vp-pink);
    clip-path: polygon(0 0, 100% 0, 100% 60%, 0 60%);
    /* Cut bottom */
}

.retro-sun::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--vp-bg);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: var(--vp-purple);
}

/* --- GLITCH TEXT EFFECT --- */
.glitch-text {
    position: relative;
    color: var(--vp-yellow);
    font-size: 2.5rem;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 2px 2px var(--vp-purple);
}

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

.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% {
        clip: rect(20px, 9999px, 15px, 0);
    }

    20% {
        clip: rect(60px, 9999px, 80px, 0);
    }

    40% {
        clip: rect(35px, 9999px, 100px, 0);
    }

    60% {
        clip: rect(10px, 9999px, 45px, 0);
    }

    80% {
        clip: rect(90px, 9999px, 110px, 0);
    }

    100% {
        clip: rect(50px, 9999px, 30px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(90px, 9999px, 10px, 0);
    }

    20% {
        clip: rect(10px, 9999px, 100px, 0);
    }

    40% {
        clip: rect(50px, 9999px, 40px, 0);
    }

    60% {
        clip: rect(80px, 9999px, 20px, 0);
    }

    80% {
        clip: rect(30px, 9999px, 90px, 0);
    }

    100% {
        clip: rect(70px, 9999px, 60px, 0);
    }
}