:root {
    --color-primary: #A8DF8E;     /* 草绿 */
    --color-bg: #F0FFDF;          /* 嫩白 */
    --color-soft-pink: #FFD8DF;   /* 樱花粉 */
    --color-rose-pink: #FFAAB8;   /* 玫瑰粉 */
    --color-text-dark: #2E4028;   /* 深树绿 */
    --color-text-muted: #6B8E5F;  /* 柔和绿 */
    --color-shadow: rgba(168, 223, 142, 0.4);
    --color-danger: #FF6B6B;
    --color-warning: #FFC107;
    --color-success: #4CAF50;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: #161c14;
    color: #e0e0e0;
    overflow: hidden;
}

/* 页面外层 Viewport */
.app-viewport {
    width: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 移动端全屏 vs PC 大屏手机模型 */
.phone-frame {
    width: 100%;
    height: 100dvh;
    background-color: var(--color-bg);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    user-select: none;
}

@media (min-width: 480px) {
    .phone-frame {
        width: 375px;
        height: 750px;
        border-radius: 40px;
        border: 10px solid #2d3829;
        box-shadow: 0 20px 45px rgba(0,0,0,0.6), 0 0 0 2px #44543e;
    }
}

/* 顶部状态栏 */
.status-bar {
    height: 40px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-dark);
    z-index: 10;
    background: transparent;
}

.status-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.protocol-badge {
    font-size: 11px;
    opacity: 0.8;
}

.net-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color-success);
    transition: background-color 0.3s ease;
}

.net-status-dot.connecting {
    background-color: var(--color-warning);
    animation: blink 1s infinite alternate;
}

.net-status-dot.disconnected {
    background-color: var(--color-danger);
}

@keyframes blink {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

/* 页面通用容器 */
.app-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* PAGE 1: 登录页 */
.page-login {
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    background: linear-gradient(180deg, var(--color-bg) 0%, #E2F7CE 100%);
}

.brand-logo {
    width: 130px;
    height: 130px;
    border-radius: 32px;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(168, 223, 142, 0.5);
    background: #fff;
    padding: 10px;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-text-dark);
}

.app-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-top: -10px;
    font-weight: 600;
}

.login-form {
    width: 100%;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group input {
    width: 100%;
    height: 52px;
    border-radius: 16px;
    border: 2px solid #CDEEBA;
    background: #fff;
    padding: 0 18px;
    font-size: 16px;
    color: var(--color-text-dark);
    outline: none;
    transition: border-color 0.2s ease;
}

.input-group input:focus {
    border-color: var(--color-primary);
}

.login-form.error input {
    border-color: var(--color-danger) !important;
}

.login-form.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.error-msg-text {
    color: var(--color-danger);
    font-size: 13px;
    font-weight: 700;
    display: none;
    padding-left: 4px;
}

.login-form.error .error-msg-text {
    display: block;
}

.btn-login {
    height: 52px;
    border-radius: 18px;
    border: none;
    background: var(--color-primary);
    color: var(--color-text-dark);
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    box-shadow: 0 6px 16px var(--color-shadow);
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.2s ease;
}

.btn-login:active {
    transform: scale(0.97);
}

/* PAGE 2: 主对话页 */
.page-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 10px 18px 48px 18px;
    justify-content: space-between;
}

.top-info-bar {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(168, 223, 142, 0.6);
}

.status-text {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.version-tag {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
}

/* 沉浸式对话文本展示区 (支持滑动查看历史，隐藏滚动条) */
.lyric-container {
    height: 155px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 10px 12px;
    position: relative;
    gap: 10px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lyric-container::-webkit-scrollbar {
    display: none;
}

.lyric-line {
    font-weight: 700;
    line-height: 1.4;
    transition: all 0.25s ease;
    max-width: 96%;
    word-break: break-word;
    flex-shrink: 0;
}

/* 用户文本：无前缀图标/文字，优雅深暗色 */
.lyric-line.user-msg {
    color: #4A5568;
    font-size: 16px;
    font-weight: 600;
}

/* AI 响应文本：突出颜色区分 (鲜亮草绿/主色) */
.lyric-line.ai-msg {
    color: #2F855A;
    font-size: 18px;
    font-weight: 800;
}

.lyric-line.system-msg {
    color: var(--color-text-muted);
    font-size: 15px;
    font-weight: 500;
}

.lyric-line.disperse-active {
    opacity: 0;
    transform: translateY(-30px) scale(1.1);
    filter: blur(6px);
}

/* 小牛头像 */
.bull-avatar-wrapper {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bull-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: #fff;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px var(--color-shadow);
    transition: transform 0.3s ease;
}

.bull-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bull-avatar.thinking {
    animation: floatPulse 1.5s infinite ease-in-out;
}

@keyframes floatPulse {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

/* 音频波形图 */
.waveform-box {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 6px 0;
}

.wave-bar {
    width: 5px;
    height: 6px;
    background-color: var(--color-primary);
    border-radius: 4px;
    transition: height 0.15s ease, background-color 0.3s ease;
}

.waveform-box.active .wave-bar {
    background-color: var(--color-rose-pink);
}

/* PTT 按钮容器 */
.ptt-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.ptt-btn-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 绝对同心圆脉冲扩散背景 */
.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background-color: var(--color-rose-pink);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.pulse-ring.active {
    opacity: 0.45;
    animation: pulseRingExpand 1.2s infinite ease-out;
}

@keyframes pulseRingExpand {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
}

.btn-ptt {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--color-primary) 0%, #87D067 100%);
    box-shadow: 0 10px 24px var(--color-shadow);
    color: var(--color-text-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    cursor: pointer;
    outline: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-ptt:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.4);
}

.btn-ptt.active {
    background: linear-gradient(135deg, var(--color-rose-pink) 0%, #FF8597 100%);
    transform: scale(1.1);
    box-shadow: 0 12px 30px rgba(255, 170, 184, 0.7);
}

.btn-ptt.reconnect {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
    color: #fff;
}

.btn-ptt svg {
    width: 34px;
    height: 34px;
    fill: currentColor;
    margin-bottom: 2px;
}

.btn-ptt span {
    font-size: 13px;
    font-weight: 800;
}

.ptt-hint-text {
    margin-top: 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-muted);
}

/* 模态框 */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(43, 58, 38, 0.7);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.modal-card {
    background: var(--color-bg);
    border-radius: 28px;
    padding: 24px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    border: 3px solid #fff;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-card h3 {
    font-size: 20px;
    color: var(--color-text-dark);
    margin-bottom: 10px;
}

.modal-card p {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-btn {
    background: var(--color-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 800;
    color: var(--color-text-dark);
    cursor: pointer;
    box-shadow: 0 4px 12px var(--color-shadow);
}

/* UI 原型状态预览浮条 */
.prototype-switcher {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: rgba(34, 44, 31, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid #44543e;
    border-radius: 20px;
    padding: 12px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 340px;
    transition: all 0.3s ease;
}

.prototype-switcher.collapsed .switcher-buttons {
    display: none;
}

.switcher-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.prototype-switcher.collapsed .switcher-header {
    margin-bottom: 0;
}

.switcher-toggle-btn {
    background: #2b3a27;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
}

.switcher-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.switcher-buttons button {
    background: #2d3829;
    border: 1px solid #3c4c37;
    color: #d0e4c8;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.switcher-buttons button:hover, .switcher-buttons button.active {
    background: var(--color-primary);
    color: var(--color-text-dark);
    font-weight: 800;
    border-color: var(--color-primary);
}

