/* Vtoroy Web - Desktop-style II Eyes */

:root {
    --bg-dark: #0a0a0a;
    --bg-subtle: #111111;

    /* Eye colors - matching desktop */
    --eye-idle: rgba(180, 180, 190, 0.7);
    --eye-active: rgba(0, 212, 170, 0.85);      /* Recording - green/cyan */
    --eye-waiting: rgba(255, 193, 7, 0.85);     /* Waiting - yellow */
    --eye-speaking: rgba(255, 82, 82, 0.85);    /* Speaking - red */
    --eye-error: rgba(255, 82, 82, 0.85);       /* Error - red */
    --pupil-color: rgba(40, 40, 50, 0.9);

    --text-primary: #ffffff;
    --text-muted: #666666;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    touch-action: manipulation;
}

/* Subtle background glow */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 40%, rgba(100, 100, 120, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
}

/* ========== EYES WIDGET ========== */
.eyes-widget {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Wave container for sound ripples */
.wave-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid var(--eye-active);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

/* Eyes container */
.eyes-container {
    display: flex;
    gap: 16px;
    position: relative;
    z-index: 2;
    /* Squeeze + breathing transforms applied via JS */
}

/* Individual Eye - Roman I style */
.eye {
    width: 32px;
    height: 180px;
    background: var(--eye-idle);
    border-radius: 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 0 30px rgba(180, 180, 190, 0.3);
}

/* Glow effect container */
.eye-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border-radius: 32px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Pupil */
.pupil {
    width: 26px;
    height: 26px;
    background: var(--pupil-color);
    border-radius: 50%;
    position: relative;
    transition: transform 0.08s ease-out;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
}

/* Pupil highlight */
.pupil::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 5px;
    height: 5px;
    background: white;
    border-radius: 50%;
    opacity: 0.7;
}

/* ========== STATES ========== */

/* Idle - default gray */
.eyes-widget.idle .eye {
    background: var(--eye-idle);
    box-shadow: 0 0 30px rgba(180, 180, 190, 0.3);
}

/* Recording/Listening - green with waves */
.eyes-widget.recording .eye {
    background: var(--eye-active);
    box-shadow:
        0 0 40px rgba(0, 212, 170, 0.5),
        0 0 80px rgba(0, 212, 170, 0.3);
}

.eyes-widget.recording .eye-glow {
    opacity: 1;
    background: radial-gradient(ellipse, rgba(0, 212, 170, 0.4) 0%, transparent 70%);
    animation: glowPulse 0.8s ease-in-out infinite;
}

.eyes-widget.recording .wave {
    animation: waveExpand 1.5s ease-out infinite;
}

.eyes-widget.recording .wave:nth-child(2) {
    animation-delay: 0.5s;
}

.eyes-widget.recording .wave:nth-child(3) {
    animation-delay: 1s;
}

/* Waiting/Thinking - yellow */
.eyes-widget.waiting .eye {
    background: var(--eye-waiting);
    box-shadow:
        0 0 40px rgba(255, 193, 7, 0.5),
        0 0 80px rgba(255, 193, 7, 0.3);
}

.eyes-widget.waiting .eye-glow {
    opacity: 1;
    background: radial-gradient(ellipse, rgba(255, 193, 7, 0.4) 0%, transparent 70%);
    animation: glowPulse 1.2s ease-in-out infinite;
}

.eyes-widget.waiting .wave {
    border-color: var(--eye-waiting);
    animation: waveExpand 2s ease-out infinite;
}

.eyes-widget.waiting .wave:nth-child(2) {
    animation-delay: 0.7s;
}

/* Speaking - red with squint */
.eyes-widget.speaking .eye {
    background: var(--eye-speaking);
    height: 150px;  /* Slight squint */
    box-shadow:
        0 0 40px rgba(255, 82, 82, 0.5),
        0 0 80px rgba(255, 82, 82, 0.3);
}

.eyes-widget.speaking .eye-glow {
    opacity: 1;
    background: radial-gradient(ellipse, rgba(255, 82, 82, 0.4) 0%, transparent 70%);
    animation: glowPulse 0.6s ease-in-out infinite;
}

.eyes-widget.speaking .pupil {
    animation: pupilPulse 0.3s ease-in-out infinite alternate;
}

/* Error - red fade */
.eyes-widget.error .eye {
    background: var(--eye-error);
    animation: errorFade 2s ease-out forwards;
}

/* ========== ANIMATIONS ========== */

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

@keyframes waveExpand {
    0% {
        width: 60px;
        height: 60px;
        opacity: 0.6;
    }
    100% {
        width: 280px;
        height: 280px;
        opacity: 0;
    }
}

@keyframes pupilPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

@keyframes errorFade {
    0% { background: var(--eye-error); }
    100% { background: var(--eye-idle); }
}

/* Blink animation */
.eye.blinking {
    height: 6px !important;
    border-radius: 12px;
}

.eye.blinking .pupil {
    opacity: 0;
    transform: scale(0);
}

/* ========== VOICE BUTTON ========== */
.voice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 36px;
    background: transparent;
    border: 2px solid var(--text-muted);
    border-radius: 40px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.voice-btn:hover {
    border-color: var(--eye-active);
    box-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
}

.voice-btn:active,
.voice-btn.recording {
    transform: scale(0.95);
    border-color: var(--eye-active);
    background: rgba(0, 212, 170, 0.1);
    box-shadow: 0 0 30px rgba(0, 212, 170, 0.4);
}

.voice-btn.recording {
    animation: btnPulse 1s ease-in-out infinite;
}

.voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 170, 0.3); }
    50% { box-shadow: 0 0 40px rgba(0, 212, 170, 0.6); }
}

.mic-icon {
    width: 22px;
    height: 22px;
}

.btn-text {
    font-size: 13px;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* ========== MESSAGES ========== */
.message-area {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.message {
    padding: 14px 20px;
    border-radius: 16px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.3s ease;
}

.message.visible {
    opacity: 1;
    transform: translateY(0);
}

.message.hidden {
    display: none;
}

.user-msg {
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.bot-msg {
    background: linear-gradient(135deg, var(--eye-active), rgba(0, 180, 150, 0.9));
    color: white;
}

/* ========== HINT ========== */
.hint {
    position: absolute;
    bottom: 24px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: lowercase;
    letter-spacing: 1px;
    opacity: 0.4;
}

/* ========== MOBILE ========== */
@media (max-width: 480px) {
    .eyes-widget {
        width: 250px;
        height: 250px;
    }

    .eyes-container {
        gap: 12px;
    }

    .eye {
        width: 26px;
        height: 140px;
        border-radius: 13px;
    }

    .pupil {
        width: 20px;
        height: 20px;
    }

    .voice-btn {
        padding: 14px 28px;
    }

    @keyframes waveExpand {
        0% { width: 50px; height: 50px; opacity: 0.6; }
        100% { width: 220px; height: 220px; opacity: 0; }
    }
}

/* Smooth cursor tracking */
@media (pointer: fine) {
    .pupil {
        transition: transform 0.06s linear;
    }
}
