/* E-01 SENTINEL THEME */
:root {
    --bg-color: #000000;
    --primary-color: #2563EB;
    /* ETECHAL Blue */
    --text-color: #F0F0F0;
    /* Bone White */
    --alert-color: #FF3333;
    --hud-font: 'Share Tech Mono', monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--hud-font);
    margin: 0;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- HUD LAYER --- */
#hud-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    padding: 20px;
    box-sizing: border-box;
    font-size: 12px;
    color: rgba(37, 99, 235, 0.7);
    text-shadow: 0 0 5px var(--primary-color);
}

.message {
    padding: 0 20px;
    margin-bottom: 10px;
    font-size: 14px;
    /* Hardcoded small size */
    line-height: 1.4;
    text-shadow: 0 0 5px var(--primary-color);
}

.hud-top-left {
    position: absolute;
    top: 10px;
    /* Aligned with Debug */
    left: 20px;
}

.hud-top-right {
    position: absolute;
    top: 10px;
    /* Aligned with Debug */
    right: 20px;
}

.hud-bottom-left {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

.hud-bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

/* --- EYE INTERNALS (Restored) --- */
.face-container {
    display: flex;
    gap: 40px;
    transition: transform 0.5s ease;
}

.eye-ring {
    width: 140px;
    height: 140px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 50%;
}

.ring-outer {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    border-top-color: transparent;
    border-bottom-color: transparent;
    animation: spin 6s linear infinite;
    box-shadow: 0 0 10px var(--primary-color);
    opacity: 0.7;
}

.ring-inner {
    position: absolute;
    width: 85%;
    height: 85%;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: spin 3s linear infinite reverse;
}

.digital-pupil {
    position: absolute;
    width: 40%;
    height: 40%;
    /* Explicit Centering (100 - 40) / 2 = 30% */
    top: 30%;
    left: 30%;
    background: radial-gradient(circle, #fff 0%, var(--primary-color) 60%, transparent 100%);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--primary-color);
    animation: pupilPulse 3s ease-in-out infinite;
    transition: transform 0.1s ease-out;
    /* Optimized for movement */
}

/* ... existing code ... */

@keyframes pupilPulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 51, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 25px rgba(255, 51, 0, 0.8);
    }

    100% {
        box-shadow: 0 0 15px rgba(255, 51, 0, 0.4);
    }
}

.ring-shutter-top,
.ring-shutter-bottom {
    position: absolute;
    width: 100%;
    height: 50%;
    background: #000;
    border-bottom: 2px solid var(--primary-color);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 10;
}

.ring-shutter-top {
    top: -50%;
    border-bottom: 2px solid var(--primary-color);
}

.ring-shutter-bottom {
    bottom: -50%;
    border-top: 2px solid var(--primary-color);
    border-bottom: none;
}

/* EMOTIONS */
.blink .ring-shutter-top {
    top: 0 !important;
}

.blink .ring-shutter-bottom {
    bottom: 0 !important;
}

.eye-ring.angry .ring-shutter-top {
    top: -10%;
    transform: rotate(15deg) scale(1.2);
}

.eye-ring.angry .digital-pupil {
    width: 20%;
    height: 20%;
    background: radial-gradient(circle, #fff 0%, #FF3333 60%, transparent 100%);
    box-shadow: 0 0 30px #FF3333;
}

.eye-ring.happy .ring-shutter-bottom {
    bottom: -20%;
    border-radius: 50% 50% 0 0;
    height: 60%;
}

.eye-ring.happy .digital-pupil {
    width: 45%;
    height: 45%;
    animation: bounce 1s infinite;
}

.eye-ring.sad .ring-shutter-top {
    top: -20%;
    transform: rotate(-10deg);
}

/* ANIMATIONS */
@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* --- MUSIC MODE RIPPLES --- */
.ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Match eye shape */
    border: 6px solid var(--primary-color);
    /* Thicker start */
    box-shadow: 0 0 15px var(--primary-color), inset 0 0 10px var(--primary-color);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    /* Behind rings */
    top: 0;
    left: 0;
}

.ripple.animate {
    animation: ripple-effect 0.8s ease-out forwards;
}

@keyframes ripple-effect {
    0% {
        transform: scale(1);
        opacity: 0.8;
        border-width: 6px;
    }

    100% {
        transform: scale(2.0);
        /* Larger expansion */
        opacity: 0;
        border-width: 0px;
    }
}

/* --- SINGING BUBBLES --- */
.note-bubble {
    position: absolute;
    bottom: 2%;
    /* Starts very low, practically at the edge */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #BD00FF;
    /* Purple tone */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #BD00FF;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 0 20px #BD00FF;
    z-index: 100;
    pointer-events: none;
    animation: float-note 1.5s ease-out forwards;
}

@keyframes float-note {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
        bottom: 2%;
        /* Match start */
    }

    20% {
        transform: translateX(-50%) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translateX(-50%) scale(1);
        opacity: 0;
        bottom: 30%;
        /* Floats up */
    }
}

.holographic-frame {
    width: 100%;
    height: 100%;
    border: none;
    /* Removed border as requested */
    box-shadow: none;
    /* Removed shadow to be cleaner */
    position: relative;
    background: #000;
}

#media-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- MOUTH (New) --- */
.mouth {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
    /* Center horizontally relative to eyes layer */
    left: 50%;
    transform: translateX(-50%) scale(0.5);
    /* Initially small */
    top: 80%;
    /* Position just below eyes (inside 40% layer) */
    box-shadow: 0 0 10px var(--primary-color);
    pointer-events: none;
}

/* Mouth in Split View (Video Active) - Move UP to avoid overlap */
body.split-view .mouth {
    top: 90% !important;
    /* Just below eyes, above video */
    transform: translateX(-50%) scale(0.4);
}

.mouth.talking {
    opacity: 1;
    animation: mouth-talk 0.3s infinite alternate;
}

@keyframes mouth-talk {
    0% {
        transform: translateX(-50%) scale(0.8);
        border-width: 2px;
    }

    100% {
        transform: translateX(-50%) scale(1.2);
        border-width: 4px;
    }
}

/* --- LAYOUT SYSTEM (Phase 18 Responsive) --- */

/* DEFAULT (PORTRAIT / MOBILE) */
#eyes-layer {
    position: absolute;
    top: 5%;
    /* Eyes in top 1/3 (5% + half height) */
    left: 0;
    width: 100%;
    height: 40%;
    /* Compact height to define "Upper Third" area */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    transition: all 0.5s ease;
}

#content-layer {
    position: absolute;
    top: 35%;
    /* Starts below eyes in split view */
    left: 0;
    width: 100%;
    height: 0;
    /* Hidden by default */
    z-index: 6;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    transition: all 0.5s ease;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

#overlay-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25%;
    /* Fixed Footer */
    display: flex;
    flex-direction: row;
    /* Side-by-Side */
    z-index: 20;
    background: linear-gradient(to top, black 95%, transparent);
    border-top: none;
    /* Removed blue line */
    overflow: hidden;
    box-sizing: border-box;
    align-items: center;
    /* Vertically center items */
}

/* TEXT AREA (Right Side) */
.text-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 5px;
}

.col-user {
    flex: 1;
    color: #00FFCC;
    text-shadow: none;
    /* Removed glow for discretion */
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.2;
    border-right: none;
    border-bottom: none;
    /* Removed line */
    overflow-y: auto;
    display: flex;
    align-items: center;
}

.col-robot {
    flex: 1;
    color: var(--primary-color);
    text-shadow: none;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.2;
    overflow-y: auto;
    display: flex;
    align-items: center;
}

/* CONTROL BAR (Left Side) */
.control-bar {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
    background: transparent;
    border-right: none;
    /* Removed line */
}

/* --- MATRIX DIVIDER --- */
#matrix-divider {
    position: absolute;
    bottom: 25%;
    /* Top of overlay */
    left: 0;
    width: 100%;
    height: 24px;
    /* Approx 2 lines */
    z-index: 15;
    background: transparent;
    overflow: hidden;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    line-height: 12px;
    color: #004488;
    text-shadow: 0 0 2px #0088FF;
    white-space: wrap;
    word-break: break-all;
    pointer-events: none;
    opacity: 0.8;
    display: none;
    /* Hidden by default until activated */
}

#matrix-divider span {
    display: inline-block;
    width: 8px;
    text-align: center;
}

#matrix-divider span.bright {
    color: #00F0FF;
    text-shadow: 0 0 5px #00F0FF;
}

#matrix-divider span.dim {
    color: #002244;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #004488;
    /* Dark Blue Border */
    background: #001133;
    /* Dark Blue Background */
    color: #446688;
    /* Dark Text */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-family: 'Share Tech Mono', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: none;
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.active {
    background: #002255;
    /* Slightly lighter */
    color: #0088FF;
    /* Bright Blue Text */
    border-color: #0088FF;
    box-shadow: 0 0 10px rgba(0, 136, 255, 0.3);
}

/* Mic Button (Blue) */
#mic-btn {
    /* Legacy override if needed, but we'll use generic class */
}

#mic-btn.listening {
    background: #002255;
    color: #00F0FF;
    border-color: #00F0FF;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    animation: none;
    /* No pulse, discreet */
}

/* Vision Button (Cyan/Green) */
#vision-btn {
    border-color: #00FFCC;
    box-shadow: 0 0 5px #00FFCC;
}

#vision-btn.active {
    background: #00FFCC;
    box-shadow: 0 0 15px #00FFCC;
    animation: pulse-green 1s infinite;
}

/* Sound Button (Purple) */
#sound-btn {
    border-color: #BD00FF;
    box-shadow: 0 0 5px #BD00FF;
}

#sound-btn.active {
    background: #BD00FF;
    box-shadow: 0 0 15px #BD00FF;
    animation: pulse-purple 1s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 5px #00FFCC;
    }

    50% {
        box-shadow: 0 0 20px #00FFCC;
    }

    100% {
        box-shadow: 0 0 5px #00FFCC;
    }
}

@keyframes pulse-purple {
    0% {
        box-shadow: 0 0 5px #BD00FF;
    }

    50% {
        box-shadow: 0 0 20px #BD00FF;
    }

    100% {
        box-shadow: 0 0 5px #BD00FF;
    }
}


.control-btn.active {
    color: #000;
}

.control-btn.danger.active {
    background: #FF003C;
    border-color: #FF003C;
    box-shadow: 0 0 20px #FF003C;
}

/* Specific Button Styles */
#mic-btn {
    /* Legacy override if needed, but we'll use generic class */
}

/* PORTRAIT SPLIT VIEW (Sandwich) */
body.split-view #eyes-layer {
    height: 35%;
    /* Shrink to top */
    top: 0%;
    /* Force to very top in split view */
    transform: scale(0.6);
    /* Smaller to fit */
    align-items: flex-start;
    /* Align to top of container */
    padding-top: 20px;
}

body.split-view #content-layer {
    height: 40%;
    /* Middle section */
    top: 35%;
    border-top: none;
    /* Removed blue border */
    border-bottom: none;
    /* Removed blue border */
}

/* LANDSCAPE OVERRIDES */
@media (orientation: landscape) {

    /* Normal Landscape */
    #eyes-layer {
        height: 60%;
        /* Reduced from 75% to bring center up */
        width: 100%;
        top: 5%;
        /* Slight margin from top */
        left: 0;
    }

    #content-layer {
        /* Reset for landscape split logic */
        top: 0;
        left: 0;
        height: 75%;
        width: 0;
        /* Hidden width */
    }

    #overlay-container {
        height: 25%;
        width: 100%;
    }

    /* LANDSCAPE SPLIT VIEW (Side-by-Side) */
    body.split-view #content-layer {
        width: 50%;
        height: calc(75% - 50px);
        /* Reduced height further */
        left: 0;
        top: 40px;
        /* Fix: Reset top from portrait mode */
        border-right: none;
        /* Removed vertical blue border */
        border-top: none;
        border-bottom: none;
    }

    body.split-view #eyes-layer {
        width: 50%;
        height: 75%;
        left: 50%;
        top: 0;
        transform: scale(0.7);
    }
}

#chat-history {
    overflow-y: auto;
    /* Scroll internally */
    max-height: 100%;
    padding-bottom: 10px;
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#chat-history::-webkit-scrollbar {
    display: none;
}

.message {
    padding: 0 20px;
    pointer-events: auto;
    align-items: center;
}

#input-wrapper {
    flex: 1;
    display: flex;
    background: rgba(30, 30, 30, 0.9);
    border-radius: 30px;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#text-input {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    outline: none;
    font-size: 14px;
    /* Smaller input */
}

/* Cyberpunk Mic Button (Redesigned) */
#mic-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color), inset 0 0 10px var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Inner pulsing core */
#mic-btn::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.5;
    box-shadow: 0 0 10px var(--primary-color);
}

#mic-btn.listening {
    border-color: var(--alert-color);
    box-shadow: 0 0 20px var(--alert-color), inset 0 0 15px var(--alert-color);
}

#mic-btn.listening::after {
    background: var(--alert-color);
    animation: core-pulse 0.5s infinite alternate;
}

@keyframes core-pulse {
    from {
        transform: scale(1);
        opacity: 0.5;
    }

    to {
        transform: scale(1.5);
        opacity: 1;
    }
}

button {
    background: none;
    border: none;
    font-size: 1.2em;
    /* Smaller buttons */
    cursor: pointer;
    color: #fff;
    padding: 0 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
    color: #fff;
}

#send-btn {
    background: transparent;
    color: #00ffcc;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 51, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 25px rgba(255, 51, 0, 0.8);
    }

    100% {
        box-shadow: 0 0 15px rgba(255, 51, 0, 0.4);
    }
}

/* --- VOICE VISUALIZER --- */
#voice-visualizer {
    position: absolute;
    bottom: 15%;
    /* Positioned below eyes */
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 50;
}

#voice-visualizer.active {
    opacity: 1;
}

.voice-bar {
    width: 10px;
    /* Start small */
    height: 2px;
    background: #00F0FF;
    box-shadow: 0 0 15px #00F0FF;
    border-radius: 2px;
}

/* Animation when active */
#voice-visualizer.active .voice-bar {
    animation: voice-wave 0.4s infinite alternate ease-in-out;
}

@keyframes voice-wave {
    0% {
        width: 20px;
        opacity: 0.4;
        box-shadow: 0 0 5px #00F0FF;
    }

    100% {
        width: 180px;
        opacity: 1;
        box-shadow: 0 0 20px #00F0FF, 0 0 40px #00F0FF;
    }
}

body.vision-mode #content-layer {
    display: flex !important;
    width: 100% !important;
    /* Keep full size for internal rendering */
    height: 100% !important;
    opacity: 0 !important;
    /* Hide visually */
    pointer-events: none;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

body.vision-mode #eyes-layer {
    height: 100% !important;
    /* Full screen eyes */
    top: 0 !important;
}