* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-layout {
    display: flex;
    height: 100%;
}

/* 侧边栏样式 */
.sidebar {
    width: 260px;
    min-width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-right-width: 0 !important;
    opacity: 0 !important;
    pointer-events: none;
    visibility: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 32px;
}

.brand-image {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.brand-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 20px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.new-chat-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--primary-rgb), 0.3);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 15px;
    margin-bottom: 2px;
}

.nav-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.nav-item svg.icon {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

.sidebar-section {
    margin-top: 24px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.section-title {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 0 12px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item {
    padding: 10px 12px;
    border-radius: var(--border-radius-md);
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.history-item:hover {
    background-color: #eee;
}

.history-item.active {
    background-color: #e8f0fe;
    color: var(--primary-color);
}

.history-empty {
    font-size: 13px;
    color: #999;
    padding: 8px 4px;
}

.draw-item {
    gap: 10px;
    justify-content: space-between;
}

.history-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draw-thumb-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f4f4f6;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.draw-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.draw-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.draw-prompt {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.delete-history, .delete-story, .delete-wiki, .delete-drawing {
    opacity: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    margin-left: auto;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #92949b;
    cursor: pointer;
    pointer-events: none;
    transition: opacity 0.18s ease, color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
    flex-shrink: 0;
}

.delete-record svg {
    flex-shrink: 0;
}

.delete-icon-lid {
    transform-origin: 18px 6px;
    transition: transform 0.18s ease;
}

.history-item:hover .delete-record,
.history-item:focus-within .delete-record {
    opacity: 1;
    pointer-events: auto;
}

.delete-record:hover {
    background-color: rgba(220, 38, 38, 0.09);
    color: #dc2626;
}

.delete-record:hover .delete-icon-lid {
    transform: translateY(-1px) rotate( -8deg);
}

.delete-record:active {
    transform: scale(0.92);
    background-color: rgba(220, 38, 38, 0.15);
}

.delete-record:focus-visible {
    outline: 2px solid rgba(220, 38, 38, 0.55);
    outline-offset: 2px;
    color: #dc2626;
    background-color: rgba(220, 38, 38, 0.09);
}

@media (hover: none) {
    .history-item .delete-record {
        opacity: 1;
        pointer-events: auto;
        width: 36px;
        height: 36px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .delete-record, .delete-icon-lid {
        transition: none;
    }
    .delete-record:active, .delete-record:hover .delete-icon-lid {
        transform: none;
    }
}

/* 侧边栏底部 */
.sidebar-bottom {
    border-top: 1px solid var(--border-color);
    padding: 12px 8px;
    position: relative;
    flex-shrink: 0;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.about-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
}

.about-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

.about-popover {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 8px;
    right: 8px;
    width: auto;
    max-width: calc(100% - 16px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    display: none;
    z-index: 100;
    animation: popIn 0.2s ease-out;
    white-space: normal;
}

.about-popover.active {
    display: block;
}

.popover-content {
    padding: 16px;
}

.popover-intro {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

.popover-intro strong {
    color: var(--primary-color);
}

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

.popover-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.popover-item {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s;
}

.popover-item:hover {
    background-color: #f5f5f5;
}

.popover-divider {
    height: 1px;
    background-color: #f0f0f0;
    margin: 12px 0;
}

.popover-info {
    font-size: 12px;
    color: #999;
    line-height: 1.8;
}

.popover-info p {
    margin-bottom: 4px;
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: white;
}

.top-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: white;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f0f0f0;
}

.sidebar-toggle:hover {
    background-color: #f7f7f9;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-text {
    background: white;
    border: 1px solid #1a73e8;
    color: #1a73e8;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-text:hover {
    background-color: #f8fbff;
}

.btn-primary {
    background-color: #1d1d1f;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background-color: #000;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 180px;
    display: flex;
    flex-direction: column;
}

.chat-box {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* 空状态/初始状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10vh;
    width: 100%;
}

.greeting {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 12px;
}

.empty-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    text-align: center;
    line-height: 1.7;
    max-width: 560px;
}

/* 小毛球形象动画 */
@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0);
    }
    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

@keyframes breathe {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 20px 30px rgba(0,0,0,0.15);
    }
}

.welcome-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    animation: float 4s ease-in-out infinite, breathe 4s ease-in-out infinite;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.welcome-avatar:hover {
    transform: scale(1.1) rotate(5deg);
    animation-play-state: paused;
}

/* 空状态 - 胶囊开关与药丸推荐 */
.mode-switch-capsule {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    background-color: #f4f4f7;
    padding: 4px;
    border-radius: 24px;
    margin: 0 0 40px;
    gap: 4px;
}

.mode-switch-capsule .switch-btn {
    padding: 8px 24px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.mode-switch-capsule .switch-btn.active {
    background-color: white;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.recommendations {
    width: min(100%, 420px);
}

.rec-title {
    font-size: 13px;
    color: #999;
    margin-bottom: 16px;
    text-align: left;
    width: 100%;
}

.rec-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.rec-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background-color: white;
    border: 1px solid #f2f2f2;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.rec-item:hover {
    background-color: #f9f9f9;
    border-color: #e5e5e5;
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.rec-icon {
    width: 18px;    height: 18px;
    color: #1a73e8;
    flex-shrink: 0;
}

.rec-item span {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 400;
}

/* 消息样式 */
.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.message.child {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.agent {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
    animation: float-mini 3s ease-in-out infinite;
}

@keyframes float-mini {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.message-text {
    padding: 12px 16px;
    border-radius: var(--border-radius-lg);
    font-size: 16px;
    line-height: 1.6;
}

.message.is-streaming .message-text::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 4px;
    vertical-align: -2px;
    background: #2563eb;
    animation: streamCursor 1s step-end infinite;
}

.stream-status {
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 16px;
}

@keyframes streamCursor {
    50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .message.is-streaming .message-text::after { animation: none; }
}

.chat-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: zoom-in;
    transition: transform 0.2s;
}

.chat-image:hover {
    transform: scale(1.02);
}

.message-content {
    display: flex;
    flex-direction: column;
}

.message-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.message.child .message-bubble-row {
    flex-direction: row-reverse;
}

.message.child .message-text {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 2px 18px;
    box-shadow: var(--shadow-sm);
}

.message.agent .message-text {
    background-color: var(--message-agent-bg);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 2px 18px 18px 18px;
    box-shadow: var(--shadow-sm);
    display: inline-block;
}

.play-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.88);
    color: #4c7df0;
    box-shadow: 0 6px 18px rgba(76, 125, 240, 0.16);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.message.child .play-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow: 0 6px 18px rgba(30, 64, 175, 0.22);
}

.play-btn:hover {
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 10px 22px rgba(76, 125, 240, 0.22);
}

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

.play-btn svg {
    width: 17px;
    height: 17px;
}

@keyframes audioPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 6px 18px rgba(76, 125, 240, 0.16);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 10px 24px rgba(76, 125, 240, 0.26);
    }
}

@keyframes speakerWave {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.06) rotate(-4deg);
    }
    75% {
        transform: scale(1.06) rotate(4deg);
    }
}

.play-btn.is-playing,
.wiki-play-btn.is-playing {
    animation: audioPulse 1.15s ease-in-out infinite;
}

.play-btn.is-playing svg,
.wiki-play-btn.is-playing svg {
    animation: speakerWave 0.9s ease-in-out infinite;
    transform-origin: center;
}

/* 故事书全屏视图 */
.storybook-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none; /* 初始隐藏 */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.storybook-overlay.active {
    display: flex;
}

.storybook-container {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    background-color: white;
    border-radius: 32px;
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px rgba(0,0,0,0.4);
    overflow: hidden;
}

.close-storybook {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    color: #333;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-storybook:hover {
    background-color: #e0e0e0;
    transform: rotate(90deg);
}

.storybook-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.story-page-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 24px;
    animation: fadeIn 0.5s ease;
}

.story-image-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.story-page-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.story-text-container {
    padding: 0 20px 20px;
    text-align: center;
}

.story-text {
    font-size: 22px;
    line-height: 1.6;
    color: var(--text-primary);
    font-weight: 500;
}

.storybook-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 0 40px;
}

.nav-btn {
    padding: 12px 24px;
    border-radius: 30px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 217, 61, 0.3);
}

#pageIndicator {
    font-size: 18px;
    font-weight: 600;
    color: #666;
}

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

/* 输入区域 V2 - 内置工具栏 */
.input-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 24px 40px;
    background: linear-gradient(transparent, white 50%);
    pointer-events: none;
}

.input-container-v2 {
    max-width: 850px;
    margin: 0 auto;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 24px;
    padding: 16px 20px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-container-v2:focus-within {
    border-color: rgba(78, 131, 255, 0.65);
    box-shadow:
        0 0 0 3px rgba(78, 131, 255, 0.12),
        0 12px 48px rgba(78, 131, 255, 0.16);
}

#userInput {
    width: 100%;
    border: none;
    outline: none;
    font-size: 16px;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    margin-bottom: 16px;
    background: transparent;
    line-height: 1.6;
    color: var(--text-primary);
}

.input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-circle-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #eee;
    background: white;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-circle-btn:hover {
    background-color: #f5f5f7;
    border-color: #e0e0e0;
}

.quick-pills {
    display: flex;
    gap: 8px;
}

.pill-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background-color: #f7f7f9;
    border-radius: 18px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.pill-item:hover {
    background-color: #efeff2;
    border-color: #e8e8e8;
}

.pill-item.active {
    background: linear-gradient(180deg, #ffffff 0%, #f3f6ff 100%);
    border-color: #d9e3ff;
    color: #2457d6;
    box-shadow: 0 4px 12px rgba(36, 87, 214, 0.12);
}

.pill-item svg {
    width: 14px;
    height: 14px;
    color: #1a73e8;
}

.pill-item.active svg {
    color: #2457d6;
}

.auto-badge {
    font-size: 12px;
    color: #a1a1a6;
    margin-right: 8px;
}

.voice-btn-v2, .send-btn-v2 {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.voice-btn-v2:hover {
    background-color: #f5f5f7;
}

.send-btn-v2 {
    background-color: #f4f4f7;
    color: #ccc;
}

.send-btn-v2.active {
    background-color: #1d1d1f;
    color: white;
}

.send-btn-v2.active:hover {
    background-color: #000;
    transform: scale(1.05);
}

.send-btn-v2 svg, .voice-btn-v2 svg, .tool-circle-btn svg {
    width: 20px;
    height: 20px;
}

/* 录音状态 */
.voice-btn-v2 {
    position: relative;
    overflow: visible;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.voice-btn-v2:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.voice-btn-v2:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

.recording-status:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.06);
    color: #2563eb;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.recording-status.is-recording::before {
    content: '';
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 50%;
    background: currentColor;
    animation: voiceMicPulse 0.9s ease-in-out infinite;
}

.voice-btn-v2.recording {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.08);
}

.voice-btn-v2.recording::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.28);
    animation: voiceRing 1.2s ease-out infinite;
}

.voice-btn-v2.recording svg {
    animation: voiceMicPulse 0.9s ease-in-out infinite;
}

@keyframes voiceMicPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.14);
        opacity: 1;
    }
}

@keyframes voiceRing {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.25);
        opacity: 0;
    }
}

/* 等待中动画适配 */
.message.loading {
    padding: 0;
    align-self: flex-start;
}

.loading-dots {
    display: flex;
    gap: 4px;
    padding: 12px 0;
}

.loading-dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ccc;
    animation: dotBounce 1.2s infinite ease-in-out;
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-6px); opacity: 1; }
}

.new-chat-btn svg.icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

.nav-item svg.icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.nav-item.active svg.icon {
    color: var(--primary-color);
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
}

.tool-btn svg.tool-icon {
    width: 16px;
    height: 16px;
}

.input-action-btn svg,
.voice-btn svg,
.send-btn svg {
    width: 20px;
    height: 20px;
}

.send-btn svg {
    color: white;
}

.voice-btn svg {
    color: var(--text-secondary);
}

.input-action-btn svg {
    color: var(--text-secondary);
}

/* 百科小课堂 */
.wiki-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.wiki-overlay.active {
    display: flex;
}

.wiki-container {
    width: 90%;
    max-width: 900px;
    height: 84vh;
    background-color: #fbfbfd;
    border-radius: 32px;
    padding: 28px 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.close-wiki {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f3;
    color: #333;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2001;
}

.close-wiki:hover {
    background-color: #e4e4e9;
    transform: rotate(90deg);
}

.wiki-header {
    margin-bottom: 16px;
}

.wiki-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.wiki-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.wiki-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.wiki-search input {
    flex: 1;
    border: 1px solid #e8e8ec;
    background: white;
    border-radius: 16px;
    padding: 12px 18px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

.wiki-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.12);
}

.wiki-ask-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 22px;
    border: none;
    border-radius: 16px;
    background-color: #1d1d1f;
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.wiki-ask-btn:hover:not(:disabled) {
    background-color: #000;
}

.wiki-ask-btn:disabled {
    background-color: #c7c7cc;
    cursor: not-allowed;
}

.wiki-ask-btn svg {
    width: 18px;
    height: 18px;
}

.wiki-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.wiki-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.wiki-card {
    background: white;
    border: 1px solid #f0f0f2;
    border-radius: 20px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.wiki-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

.wiki-card-cover {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    background-color: #f4f4f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wiki-card-placeholder {
    font-size: 32px;
}

.wiki-card-title {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.wiki-empty,
.wiki-loading {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 15px;
}

.wiki-empty-hint,
.wiki-hint-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.wiki-detail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.wiki-back-btn {
    align-self: flex-start;
    border: none;
    background: #f0f0f3;
    color: #333;
    padding: 8px 16px;
    border-radius: 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.wiki-back-btn:hover {
    background-color: #e4e4e9;
}

.wiki-detail-body {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

.wiki-detail-image {
    flex: 0 0 320px;
    border-radius: 20px;
    overflow: hidden;
    background-color: #f4f4f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wiki-detail-text {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wiki-detail-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.wiki-play-btn {
    align-self: flex-start;
    border: none;
    background-color: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wiki-play-btn:hover {
    background-color: var(--primary-dark);
}

.wiki-play-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.wiki-detail-summary {
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
}

.wiki-point {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: white;
    border: 1px solid #f0f0f2;
    border-radius: 16px;
    padding: 12px 16px;
}

.wiki-point-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.wiki-point-detail {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}
