/* 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;
    overflow-y: auto;
    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: flex-start;
    min-height: 100vh;
    padding: 2rem;
    padding-top: 10vh;
    position: relative;
    overflow-y: auto;
    max-height: 100vh;
}

/* ========== 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: var(--bg-dark);
    border: 2px solid var(--text-muted);
    border-radius: 40px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    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;
}

/* ========== CHAT CONTAINER ========== */
.chat-wrapper {
    margin-top: 20px;
    width: 90%;
    max-width: 380px;
}

/* ========== CHAT TOGGLE BAR ========== */
.chat-toggle {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
}

.chat-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

.chat-toggle.open {
    border-radius: 16px 16px 0 0;
    border-bottom-color: transparent;
}

.chat-toggle-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-toggle-text {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-toggle-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.chat-toggle.open .chat-toggle-icon {
    transform: rotate(180deg);
}

/* ========== CHAT PANEL ========== */
.chat-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s ease;
}

.chat-panel.open {
    grid-template-rows: 1fr;
}

/* Pulsing animation when AI is thinking */
.chat-panel.thinking .chat-panel-inner {
    animation: chatPulse 1.5s ease-in-out infinite;
}

@keyframes chatPulse {
    0%, 100% {
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
    50% {
        border-color: rgba(255, 193, 7, 0.4);
        box-shadow: 0 0 20px 0 rgba(255, 193, 7, 0.2);
    }
}

.chat-panel-inner {
    overflow: hidden;
    min-height: 0;
    background: rgba(10, 10, 12, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: none;
    border-radius: 0 0 16px 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    max-height: 35vh;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    opacity: 0.8;
}

.chat-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-close svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Chat message bubbles */
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.5;
    animation: msgFadeIn 0.3s ease;
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-msg.user {
    align-self: flex-end;
    background: rgba(0, 180, 140, 0.15);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

.chat-msg.bot {
    align-self: flex-start;
    background: rgba(100, 80, 180, 0.15);
    border: 1px solid rgba(130, 100, 220, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

.chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
    opacity: 0.5;
}

/* Chat input area */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.3);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-input:focus {
    border-color: rgba(0, 212, 170, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 180, 140, 0.2);
    border: 1px solid rgba(0, 212, 170, 0.3);
    color: rgba(0, 212, 170, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-send:hover {
    background: rgba(0, 180, 140, 0.3);
    transform: scale(1.05);
}

.chat-send:active {
    transform: scale(0.95);
}

.chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.chat-send svg {
    width: 18px;
    height: 18px;
}


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

/* ========== ACTIVITY HIGHLIGHT ========== */
.activity-highlight {
    text-align: center;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    padding: 4px 16px;
}

.activity-text {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    opacity: 0.5;
    transition: all 0.3s ease;
    max-width: 340px;
    line-height: 1.4;
    /* Allow wrapping for full text */
    white-space: normal;
    word-wrap: break-word;
}

.activity-highlight.active .activity-text {
    color: rgba(255, 193, 7, 0.9);
    opacity: 1;
}

.activity-line {
    padding: 2px 0;
    opacity: 0.6;
    font-size: 11px;
}

.activity-line:last-child {
    opacity: 1;
    font-size: 12px;
}

/* ========== MOBILE ========== */
@media (max-width: 480px) {
    html, body {
        overflow: auto;
    }

    .container {
        justify-content: flex-start;
        padding-top: 10vh;
        min-height: auto;
    }

    .eyes-widget {
        width: 200px;
        height: 200px;
        margin-bottom: 24px;
    }

    .eyes-container {
        gap: 10px;
    }

    .eye {
        width: 22px;
        height: 110px;
        border-radius: 11px;
    }

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

    .voice-btn {
        padding: 12px 24px;
    }

    @keyframes waveExpand {
        0% { width: 40px; height: 40px; opacity: 0.6; }
        100% { width: 180px; height: 180px; opacity: 0; }
    }

    /* Progress indicator mobile */
    .progress-indicator {
        margin-top: 16px;
        padding: 12px 16px;
    }

    .progress-stages {
        gap: 6px;
    }

    .progress-stage {
        padding: 5px 10px;
        font-size: 10px;
    }

    .progress-stage .icon {
        font-size: 12px;
    }

    .progress-arrow {
        font-size: 8px;
    }

    .progress-status {
        font-size: 11px;
    }

    /* Chat toggle mobile */
    .chat-toggle {
        margin-top: 16px;
        padding: 10px 16px;
    }

    .chat-toggle-text {
        font-size: 12px;
        max-width: 200px;
    }

    /* Chat panel mobile */
    .chat-panel.open {
        max-height: 50vh;
    }

    .chat-header {
        padding: 14px 16px;
    }

    .chat-messages {
        padding: 12px;
        gap: 10px;
    }

    .chat-msg {
        font-size: 12px;
        padding: 8px 12px;
    }

    .hint {
        position: relative;
        margin-top: 30px;
    }
}

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

/* Version badge */
.version {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.5;
    font-family: monospace;
}

/* ========== PROGRESS INDICATOR ========== */
.progress-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-indicator.active {
    display: flex;
}

.progress-stages {
    display: flex;
    gap: 8px;
    align-items: center;
}

.progress-stage {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
}

.progress-stage.active {
    background: rgba(255, 193, 7, 0.15);
    color: var(--eye-waiting);
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.2);
}

.progress-stage.done {
    background: rgba(0, 212, 170, 0.15);
    color: var(--eye-active);
}

.progress-stage .icon {
    font-size: 14px;
}

.progress-stage.active .icon {
    animation: pulse 1s ease-in-out infinite;
}

.progress-arrow {
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 10px;
}

.progress-status {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0.7;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

