:root {
    color-scheme: dark;
    --bg: #07111f;
    --bg-soft: #0d1d32;
    --panel: rgba(10, 20, 38, 0.74);
    --panel-border: rgba(111, 214, 255, 0.16);
    --text-main: #f4fbff;
    --text-soft: #8eb9d6;
    --accent: #6ad8ff;
    --accent-strong: #7d8cff;
    --danger: #ff8a80;
    --eye-fill: linear-gradient(180deg, #ebfdff 0%, #b9ecff 100%);
    --shadow: 0 32px 80px rgba(2, 10, 23, 0.45);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at 50% 20%, rgba(70, 122, 255, 0.18), transparent 32%),
        radial-gradient(circle at 25% 75%, rgba(80, 255, 208, 0.12), transparent 22%),
        linear-gradient(180deg, #050b15 0%, #07111f 42%, #03060c 100%);
    color: var(--text-main);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    overflow: hidden;
}

.screen {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.face {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 34px;
    transform: translateY(-24px);
}

.face::before {
    content: "";
    position: absolute;
    width: min(72vw, 640px);
    height: min(42vh, 340px);
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(103, 210, 255, 0.18) 0%, rgba(103, 210, 255, 0.08) 35%, rgba(103, 210, 255, 0) 72%);
    filter: blur(18px);
    z-index: 0;
}

.eyes {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(28px, 5vw, 78px);
}

.eye {
    position: relative;
    width: clamp(170px, 19vw, 250px);
    height: clamp(170px, 19vw, 250px);
    border-radius: 48% 48% 46% 46%;
    background:
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.98) 0%, rgba(240, 253, 255, 0.99) 30%, rgba(190, 240, 255, 0.97) 66%, rgba(142, 214, 255, 0.93) 100%);
    box-shadow:
        inset 0 18px 40px rgba(255, 255, 255, 0.58),
        inset 0 -16px 24px rgba(64, 154, 214, 0.14),
        0 0 0 8px rgba(106, 216, 255, 0.08),
        0 26px 60px rgba(19, 73, 148, 0.28);
    overflow: hidden;
    transition: transform 0.18s ease, border-radius 0.2s ease, height 0.2s ease;
}

.eye::before {
    content: "";
    position: absolute;
    inset: 9% 12% 44% 12%;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0));
    filter: blur(10px);
    z-index: 1;
}

.eye::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: inset 0 0 0 2px rgba(56, 148, 255, 0.08);
    pointer-events: none;
}

.eye.listening {
    transform: translateY(5px) scaleY(0.9);
}

.eye.speaking {
    border-radius: 46% 46% 34% 34%;
    transform: translateY(-6px);
}

.eyelid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(9, 20, 38, 0.92) 0%, rgba(8, 18, 34, 0.98) 100%);
    transform: translateY(-102%);
    transition: transform 0.12s ease;
    z-index: 4;
}

.eye.blink .eyelid {
    transform: translateY(0);
}

.pupil {
    position: absolute;
    width: 29%;
    height: 29%;
    border-radius: 50%;
    top: 35.5%;
    left: 35.5%;
    background:
        radial-gradient(circle at 30% 28%, #ffffff 0 16%, #b6fbff 17%, #52c8ff 38%, #2d66e2 60%, #081427 80%);
    box-shadow:
        0 0 24px rgba(96, 225, 255, 0.36),
        inset 0 0 22px rgba(255, 255, 255, 0.24),
        inset 0 -10px 14px rgba(0, 0, 0, 0.28);
    transition: transform 0.18s ease;
    z-index: 2;
}

.pupil::after {
    content: "";
    position: absolute;
    width: 24%;
    height: 24%;
    border-radius: 50%;
    top: 16%;
    left: 19%;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 10px 14px 0 -6px rgba(255, 255, 255, 0.55);
}

.mouth {
    position: relative;
    z-index: 1;
    width: 132px;
    height: 18px;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(222, 250, 255, 0.98), rgba(128, 232, 255, 0.86));
    box-shadow:
        inset 0 3px 8px rgba(255, 255, 255, 0.58),
        0 0 22px rgba(106, 216, 255, 0.16),
        0 10px 28px rgba(10, 34, 65, 0.18);
    transition: all 0.2s ease;
}

.mouth::before {
    content: "";
    position: absolute;
    inset: 3px 18px 7px 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
}

.mouth.speaking {
    height: 46px;
    width: 84px;
    border-radius: 32px;
    background:
        radial-gradient(circle at 50% 28%, rgba(219, 251, 255, 0.98), rgba(121, 233, 255, 0.95) 52%, rgba(45, 167, 219, 0.92) 100%);
    box-shadow:
        inset 0 5px 12px rgba(255, 255, 255, 0.5),
        inset 0 -8px 12px rgba(0, 87, 128, 0.2),
        0 0 26px rgba(96, 225, 255, 0.24);
    animation: talk 0.32s ease-in-out infinite alternate;
}

.panel {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: min(880px, calc(100vw - 32px));
    padding: 22px;
    border-radius: 24px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
    z-index: 2;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    color: var(--text-soft);
    font-size: 15px;
}

.panel-toggle {
    border: 1px solid rgba(106, 216, 255, 0.24);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-soft);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.18s ease;
}

.panel-toggle:hover {
    color: var(--text-main);
    background: rgba(106, 216, 255, 0.1);
    border-color: rgba(106, 216, 255, 0.42);
}

.panel.collapsed {
    opacity: 0;
    transform: translateX(-50%) translateY(24px);
    pointer-events: none;
    visibility: hidden;
}

.edge-toggle {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%) translateY(12px);
    border: 1px solid rgba(106, 216, 255, 0.28);
    background: rgba(9, 23, 42, 0.84);
    color: var(--text-soft);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 24px rgba(2, 10, 23, 0.22);
    z-index: 3;
}

.edge-toggle:hover {
    color: var(--text-main);
    background: rgba(18, 42, 71, 0.92);
    border-color: rgba(106, 216, 255, 0.46);
}

.screen.edge-reveal .edge-toggle {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #7a8aa2;
    box-shadow: 0 0 0 0 rgba(106, 216, 255, 0.45);
}

.status-dot.live {
    background: var(--accent);
    animation: pulse 1.4s infinite;
}

.status-dot.warning {
    background: var(--danger);
}

.dialogue-card {
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.dialogue-card + .dialogue-card {
    margin-top: 12px;
}

.dialogue-label {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--text-soft);
}

.dialogue-text {
    margin: 0;
    line-height: 1.6;
    min-height: 26px;
    font-size: 17px;
}

.dialogue-text.partial {
    color: #cde8f7;
}

.dialogue-text.final {
    color: var(--text-main);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(106, 216, 255, 0.45);
    }
    100% {
        box-shadow: 0 0 0 14px rgba(106, 216, 255, 0);
    }
}

@keyframes talk {
    from {
        transform: scaleY(0.85);
    }
    to {
        transform: scaleY(1.08);
    }
}

@media (max-width: 768px) {
    .screen {
        padding: 20px;
    }

    .face {
        transform: translateY(-48px);
    }

    .panel {
        bottom: 16px;
        width: calc(100vw - 24px);
        padding: 18px;
    }

    .edge-toggle {
        bottom: 10px;
    }
}
