/* Version 6.0: Complete visual overhaul to a "Black Lodge" / David Lynch theme. */

/* --- General Setup --- */
:root {
    /* ANNOTATION: Version 6.0 - New Black Lodge color palette. */
    --main-bg: #000000;
    --text-color: #ffffff;
    --primary-border: #700000;
    --accent-red: #cc0000;
    --chevron-white: #e0e0e0;
}

body {
    background-color: var(--main-bg);
    color: var(--text-color);
    font-family: 'Special Elite', monospace;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    /* ANNOTATION: Version 6.0 - Added chevron (zig-zag) background pattern. */
    background-image: repeating-linear-gradient(
        -60deg,
        var(--main-bg),
        var(--main-bg) 20px,
        var(--chevron-white) 20px,
        var(--chevron-white) 40px
    );
}

/* --- Main Layout --- */
#game-container {
    width: 95vw;
    max-width: 700px;
    height: 90vh;
    border: 3px solid var(--primary-border);
    background-color: rgba(0, 0, 0, 0.85);
    padding: 20px;
    box-shadow: 0 0 35px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.5s, border-color 0.5s;
}

header h1 {
    text-align: center;
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--text-color);
}

#main-content {
    display: flex;
    flex-grow: 1;
    gap: 20px;
    height: calc(100% - 50px);
    min-height: 0; 
}

#ui-container {
    flex: 1;
    border: 2px solid var(--primary-border);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
    background-color: rgba(0, 0, 0, 0.4);
}

/* --- Agent Display (The Stage) --- */
/* ANNOTATION: Version 6.0 - Restyled to look like red curtains. */
#agent-display {
    border: 2px solid var(--primary-border);
    height: 180px; 
    position: relative;
    background: repeating-linear-gradient(
        to bottom,
        var(--accent-red) 0%,
        #a00 15%,
        #a00 85%,
        var(--accent-red) 100%
    );
    overflow: hidden;
    transition: height 0.3s;
    box-shadow: inset 0 0 20px #000;
}

#screen-flicker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    animation: screen-flicker 20s infinite alternate;
    opacity: 0.15;
}
@keyframes screen-flicker {
    0%, 100% { background: rgba(255, 255, 255, 0.05); }
    50% { background: transparent; }
}

/* ANNOTATION: Version 6.0 - This area now represents David Lynch. */
#agent-image {
    width: 120px;
    height: 160px;
    background-image: url('images/venus_statue.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    border: 3px double var(--text-color);
    background-color: #111;
    filter: grayscale(1) contrast(1.5);
}

/* --- Dialogue Box & Log --- */
#dialogue-box {
    border: 1px solid var(--primary-border);
    background: rgba(0,0,0,0.3);
    padding: 10px;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.user-message { color: #a0a0a0; margin: 0; padding-left: 5px; font-style: italic; }
.max-message { position: relative; }
.max-message p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }
.copy-btn { position: absolute; top: -5px; right: 0; background-color: var(--primary-border); color: var(--text-color); border: 1px solid var(--text-color); font-family: 'Special Elite', monospace; font-size: 14px; padding: 2px 8px; cursor: pointer; display: none; opacity: 0; transition: opacity 0.3s; }
.max-message:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background-color: var(--text-color); color: var(--main-bg); }
.copy-btn.copied { background-color: #fff; color: #000; }
#dialogue-box::-webkit-scrollbar { width: 12px; }
#dialogue-box::-webkit-scrollbar-track { background: var(--main-bg); border-left: 1px solid var(--primary-border); }
#dialogue-box::-webkit-scrollbar-thumb { background-color: var(--primary-border); }
#dialogue-box::-webkit-scrollbar-thumb:hover { background-color: var(--accent-red); }
.cursor { animation: blink 1s step-end infinite; }

/* --- Player HUD & Controls --- */
#controls { border: 1px solid var(--primary-border); padding: 10px; background: rgba(0,0,0,0.3); }
#talk-btn { width: 100%; padding: 15px; background-color: var(--accent-red); border: 2px solid var(--primary-border); color: var(--text-color); font-family: 'Special Elite', monospace; font-size: 18px; cursor: pointer; text-transform: uppercase; transition: background-color 0.2s; margin-bottom: 10px; letter-spacing: 2px; }
#talk-btn:hover { background-color: #ff3333; }
#text-input-container { display: flex; gap: 10px; width: 100%; }
#memo-input { flex-grow: 1; background-color: transparent; border: 1px solid var(--primary-border); color: var(--text-color); font-family: 'Special Elite', monospace; font-size: 16px; padding: 5px 10px; }
#memo-input:focus { outline: none; border-color: var(--accent-red); box-shadow: 0 0 5px var(--accent-red); }
#send-text-btn { padding: 5px 15px; background-color: transparent; border: 2px solid var(--primary-border); color: var(--text-color); font-family: 'Special Elite', monospace; font-size: 16px; cursor: pointer; text-transform: uppercase; transition: background-color 0.2s, color 0.2s; }
#send-text-btn:hover { background-color: var(--primary-border); }
.controls-info { font-size: 14px; text-align: center; margin-top: 10px; color: #a0a0a0; }

/* --- Dormant Mode Styles --- */
#ui-container.dormant-mode #dialogue-box { flex-grow: 0.1; }

/* --- Animations & Effects --- */
/* ANNOTATION: Version 6.0 - Glitch effect updated to red and white. */
.glitch { position: relative; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; overflow: hidden; }
.glitch::before { text-shadow: -2px 0px var(--accent-red); animation: flicker-effect 3s linear infinite alternate; }
.glitch::after { text-shadow: 2px 0px #ffffff; animation: flicker-effect 2.5s linear infinite alternate-reverse; }

@keyframes flicker-effect {
  0%, 15%, 45%, 100% { opacity: 1; }
  16%, 44% { opacity: 0.6; }
}
@keyframes blink { 50% { opacity: 0; } }

/* ANNOTATION: Version 6.0 - UI effect classes updated for new theme. */
.red-room-effect {
    box-shadow: 0 0 45px var(--accent-red), inset 0 0 45px var(--accent-red);
    border-color: var(--accent-red);
}

/* ANNOTATION: Version 6.0 - Replaced owl-cave-effect with statue-glitch-effect. */
.statue-glitch-effect {
    box-shadow: 0 0 45px var(--text-color), inset 0 0 45px var(--text-color);
    border-color: var(--text-color);
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body { font-size: 16px; overflow: auto; height: auto; padding: 10px 0; }
    #game-container { height: auto; width: 95vw; padding: 10px; }
    #main-content { flex-direction: column; }
    #agent-display { height: 150px; }
    #agent-image { width: 80px; height: 120px; }
    #dialogue-box { min-height: 200px; max-height: 40vh; }
}