/* 沉浸模式样式 - 重构版 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #0051CF;
    --primary-dark: #003a92;
    --primary-light: #3374d8;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', sans-serif;
    background: #000;
    color: white;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 主容器 ========== */
.immersive-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

/* 背景层（用于显示当前卡片背景） */
.background-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.8s ease, background-color 0.8s ease, filter 0.6s ease;
}

/* 功能启用态：背景模糊 */
body.feature-active .background-layer {
    filter: blur(20px);
}

/* 顶部暗角遮罩（只作用于背景层） */
.background-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 20rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 1;
}

/* 底部暗角遮罩（只作用于背景层） */
.background-layer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25rem;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 1;
}

/* ========== 左上角音频播放器显示 ========== */
.audio-player-display {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    max-width: 280px;
    transition: all 0.3s ease;
}

/* 悬停时扩展容器 */
.audio-player-display:hover {
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
}

/* 播放和暂停状态下始终扩展容器 */
.audio-player-display.playing,
.audio-player-display.paused {
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
}

.audio-player-display.playing .audio-player-control-btn.playing {
    animation: musicNotesBounce 0.6s ease-in-out infinite;
}

/* 暂停状态不跳动 */
.audio-player-control-btn.paused {
    animation: none !important;
}

.audio-player-control-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: 50%;
    color: white;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.audio-player-control-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.audio-player-control-btn:active {
    transform: scale(0.95);
}

/* 播放器图标状态 */
.audio-player-control-btn.disabled {
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.audio-player-control-btn.disabled:hover {
    background: rgba(255, 255, 255, 0.3);
}

.audio-player-control-btn.paused {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: none !important;
}

.audio-player-control-btn.paused:hover {
    background: rgba(255, 255, 255, 0.25);
}

.audio-player-control-btn.paused .player-icon-paused {
    opacity: 0.6;
    animation: none !important;
}

.audio-player-display.playing .audio-player-control-btn.paused {
    animation: none !important;
}

/* 播放器图标显示/隐藏 */
.audio-player-control-btn .player-icon {
    display: none !important;
}

.audio-player-control-btn.disabled .player-icon-disabled {
    display: block !important;
}

.audio-player-control-btn.playing .player-icon-playing {
    display: block !important;
}

.audio-player-control-btn.paused .player-icon-paused {
    display: block !important;
}

.audio-player-info {
    flex: 1;
    min-width: 0;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.3s ease, opacity 0.3s ease, margin-left 0.3s ease;
}

/* 悬停时显示文本 */
.audio-player-display:hover .audio-player-info {
    max-width: 200px;
    opacity: 1;
    margin-left: 0.75rem;
}

/* 播放和暂停状态下始终显示文本 */
.audio-player-display.playing .audio-player-info,
.audio-player-display.paused .audio-player-info {
    max-width: 200px;
    opacity: 1;
    margin-left: 0.75rem;
}

.audio-player-title {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.audio-player-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 500;
    display: none !important; /* 时间显示已移至卡片进度条 */
}

/* 功能启用态（AI对话或侧边栏打开时）：隐藏播放器 */
body.feature-active .audio-player-display {
    opacity: 0;
    pointer-events: none;
}

/* ========== 顶部输入区域 ========== */
.top-input-area {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    width: auto;
    max-width: 600px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.top-input-area.active {
    width: 90%;
}

/* 功能启用态（侧边栏打开时）：隐藏输入框 */
body.sidebar-active .top-input-area {
    opacity: 0;
    pointer-events: none;
}

/* ========== 右上角更多菜单 ========== */
.top-right-menu {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 200;
    transition: opacity 0.4s ease;
}

/* 功能启用态（AI对话激活时）：隐藏侧边栏按钮 */
body.conversation-active .top-right-menu {
    opacity: 0;
    pointer-events: none;
}

.more-menu-btn {
    width: 56px;
    height: 56px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.more-menu-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.more-menu-btn.active {
    background: rgba(0, 81, 207, 0.5);
    border-color: rgba(0, 81, 207, 0.7);
}

.more-menu-btn svg {
    width: 24px;
    height: 24px;
}

/* 侧边菜单面板 */
.side-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    padding-top: 5rem;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 190;
}

.side-menu-panel.open {
    transform: translateX(0);
}

.menu-section {
    margin-bottom: 2rem;
}

.menu-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.menu-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.menu-select:hover {
    background: rgba(255, 255, 255, 0.15);
}

.menu-select option {
    background: #1a1a1e;
    color: white;
}

.menu-tabs {
    display: flex;
    gap: 0.5rem;
}

.menu-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.menu-tab:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.menu-tab.active {
    background: rgba(0, 81, 207, 0.5);
    border-color: rgba(0, 81, 207, 0.7);
    color: white;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
    border-color: var(--primary-light);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-slider:hover {
    background: rgba(255, 255, 255, 0.15);
}

.toggle-switch input:checked + .toggle-slider:hover {
    background: var(--primary-dark);
}

/* 轮播时长滑块控件 */
.carousel-duration-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.duration-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.duration-slider:hover {
    background: rgba(255, 255, 255, 0.15);
}

.duration-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid white;
}

.duration-slider::-webkit-slider-thumb:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

.duration-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid white;
}

.duration-slider::-moz-range-thumb:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

.duration-value {
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

.menu-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.menu-action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

/* ========== 卡片视窗 ========== */
.cards-viewport {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    padding-bottom: 3rem;
    padding-top: 8rem; /* 为顶部输入区域留出空间 */
    transition: opacity 0.6s ease, filter 0.6s ease;
    z-index: 10;
}

.cards-viewport.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 功能启用态：隐藏卡片（包括侧边栏打开和对话模式） */
body.feature-active .cards-viewport {
    opacity: 0;
    pointer-events: none;
}

/* 侧边栏打开时，确保底部卡片也隐藏 */
body.sidebar-active .cards-viewport {
    opacity: 0;
    pointer-events: none;
}

.cards-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

/* 拖拽状态 */
.cards-wrapper.dragging {
    transition: none;
    cursor: grabbing;
}

.cards-wrapper.draggable {
    cursor: grab;
}

/* ========== 卡片样式 ========== */
.scene-card {
    position: absolute;
    bottom: 0;
    width: 400px;
    min-height: 200px;
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    will-change: transform, width, opacity;
}

/* 预览模式（未选中） - 只显示图片，缩小卡片 */
.scene-card.preview {
    opacity: 0.5;
    transform: scale(0.65);
    width: 320px;
    min-height: 180px;
    background: transparent;
    border: none;
}

.scene-card.preview:hover {
    opacity: 0.8;
    transform: scale(0.75);
}

/* 预览模式（选中但未展开） - 放大显示，更宽 */
.scene-card.selected {
    opacity: 1;
    transform: scale(1);
    z-index: 10;
    width: 550px;
    min-height: 320px;
}

/* 场景选中态（完全展开） */
.scene-card.expanded {
    width: 800px;
    min-height: 700px;
    max-height: 85vh;
    opacity: 1;
    transform: scale(1);
    z-index: 20;
    cursor: default;
}

/* 卡片背景图 */
.card-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: opacity 0.6s ease;
}

/* 生成中状态隐藏背景图，显示渐变动画 */
.scene-card.generating .card-background {
    opacity: 0;
}

.scene-card.expanded .card-background {
    opacity: 0.3;
}

/* 卡片遮罩层（让文字更清晰） */
.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, 
        rgba(0, 0, 0, 0) 0%, 
        rgba(0, 0, 0, 0.3) 40%, 
        rgba(0, 0, 0, 0.7) 70%, 
        rgba(0, 0, 0, 0.85) 100%);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    z-index: 1;
}

/* 选中态显示遮罩 */
.scene-card.selected .card-overlay {
    opacity: 1;
}

/* 展开态加强遮罩 */
.scene-card.expanded .card-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
}

/* 轮播进度条 */
.card-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-progress-bar-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.35);
    width: 0%;
    transition: none;
}

/* 进度条时间显示（已移除） */
.card-progress-time {
    display: none !important;
}

/* 选中态且轮播激活时显示进度条 */
.scene-card.selected.autoplay-active .card-progress-bar {
    opacity: 1;
}

/* 卡片内容 */
.card-content {
    position: relative;
    z-index: 1;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    transition: all 0.6s ease;
}

/* 预览模式（未选中） - 隐藏所有文字 */
.scene-card.preview .card-content {
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

/* 预览模式（选中） - 标题和描述显示在左下角 */
.scene-card.selected .card-content {
    padding: 2rem;
    justify-content: flex-end;
    gap: 0.5rem;
}

.card-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    transition: all 0.6s ease;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* 预览模式（未选中）隐藏标题 */
.scene-card.preview .card-title {
    opacity: 0;
    display: none;
}

/* 预览模式（选中）标题放在左下角，较大文本 */
.scene-card.selected .card-title {
    font-size: 2rem;
    text-align: left;
}

/* 卡片音频指示器 - 复用气泡样式 */
.card-audio-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: middle;
    opacity: 0;
    transform: scale(0.8);
}

/* 选中态和展开态显示音频指示器 */
.scene-card.selected .card-audio-indicator,
.scene-card.expanded .card-audio-indicator {
    opacity: 1;
    transform: scale(1);
}

.card-audio-indicator:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.15);
}

.card-audio-indicator.loading {
    background: rgba(255, 193, 7, 0.6);
    border-color: rgba(255, 193, 7, 0.8);
    pointer-events: none;
}

.card-audio-indicator.playing {
    background: var(--primary-color);
    border-color: var(--primary-light);
}

.card-audio-indicator.playing:hover {
    background: var(--primary-dark);
}

.card-audio-indicator.playing .audio-icon {
    animation: musicNotesBounce 0.6s ease-in-out infinite;
}

.card-audio-indicator.paused {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
    opacity: 0.6;
}

.card-audio-indicator .audio-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.card-description {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.6s ease;
}

/* 预览模式（选中）描述放在左下角，较小文本 */
.scene-card.selected .card-description {
    opacity: 1;
    max-height: 200px;
    font-size: 0.95rem;
    text-align: left;
}

.scene-card.expanded .card-description {
    opacity: 1;
    max-height: none;
}

/* 色彩氛围 - 已隐藏 */
.card-colors {
    display: none !important;
}

.color-dot {
    display: none !important;
}

/* Markdown内容区域（仅展开态显示） */
.card-markdown {
    flex: 1;
    opacity: 0;
    max-height: 0;
    overflow-y: auto;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    transition: all 0.6s ease;
}

.scene-card.expanded .card-markdown {
    opacity: 1;
    max-height: 500px;
}

.card-markdown h1,
.card-markdown h2,
.card-markdown h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.card-markdown h1 { font-size: 1.5rem; }
.card-markdown h2 { font-size: 1.25rem; }
.card-markdown h3 { font-size: 1.1rem; }

.card-markdown p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.card-markdown ul,
.card-markdown ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.card-markdown li {
    margin-bottom: 0.25rem;
}

.card-markdown code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.card-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.card-markdown table thead {
    background: rgba(255, 255, 255, 0.1);
}

.card-markdown table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: white;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.card-markdown table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.card-markdown table tr:last-child td {
    border-bottom: none;
}

.card-markdown table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* 自定义滚动条 */
.card-markdown::-webkit-scrollbar {
    width: 6px;
}

.card-markdown::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.card-markdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* CTA按钮容器（选中态） */
.card-cta-buttons {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.6s ease;
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.scene-card.selected .card-cta-buttons {
    opacity: 1;
    max-height: 60px;
}

.scene-card.expanded .card-cta-buttons {
    opacity: 0;
    max-height: 0;
}

/* 详情按钮（浅色） */
.detail-button {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.detail-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* 执行按钮（主题色） */
.execute-button {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.execute-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.execute-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 执行按钮loading动画 */
@keyframes button-loading-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.execute-button.loading svg {
    animation: button-loading-spin 0.8s linear;
}

/* Loading图标样式 */
.loading-spinner-icon {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: button-loading-spin 0.8s linear infinite;
}

/* 旧的进入按钮（保留但隐藏） */
.card-enter-btn {
    display: none;
}

/* 返回按钮（展开态） - 旧的单按钮版本，只用于体验模式 */
.card-back-btn {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.6s ease;
}

.scene-card.expanded .card-back-btn {
    opacity: 1;
    max-height: 50px;
}

/* 详情模式下隐藏旧的返回按钮 */
.scene-card.expanded.detail-mode .card-back-btn {
    opacity: 0;
    max-height: 0;
    display: none;
}

.back-button {
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 详情展开3按钮布局（返回+删除+体验） */
.card-detail-actions {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.6s ease;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.scene-card.expanded.detail-mode .card-detail-actions {
    opacity: 1;
    max-height: 60px;
}

/* 左侧返回按钮（纯图标） */
.back-button-left {
    width: 50px;
    height: 50px;
    padding: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.back-button-left:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* 右侧操作按钮组 */
.detail-actions-right {
    display: flex;
    gap: 0.75rem;
    flex: 1;
}

/* 删除按钮（纯图标） */
.delete-button-icon {
    width: 50px;
    height: 50px;
    padding: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.delete-button-icon:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
}

/* 体验按钮（图标+文字） - 在详情模式下 */
.experience-button-detail {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.experience-button-detail:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ========== 🎵 音频播放按钮 ========== */
.audio-play-button {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 50px;
    height: 50px;
    padding: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: none; /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
}

/* 🔑 关键：只有在选中态和展开态时才尝试显示（如果有音频） */
.scene-card.selected .audio-play-button,
.scene-card.expanded .audio-play-button {
    opacity: 1;
}

/* 🔑 有音频状态时强制显示（loading/playing/paused） */
.audio-play-button.loading,
.audio-play-button.playing,
.audio-play-button.paused {
    display: flex !important;
}

/* 🔑 明确隐藏hidden状态 */
.audio-play-button.hidden {
    display: none !important;
    opacity: 0 !important;
}

.audio-play-button:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 🎵 加载状态 - 黄色提示 */
.audio-play-button.loading {
    background: rgba(255, 193, 7, 0.8);
    border-color: rgba(255, 193, 7, 1);
    pointer-events: none;
}

.audio-play-button.loading .audio-icon {
    animation: spin 1s linear infinite;
}

/* 🎵 播放状态 - 蓝色高亮 */
.audio-play-button.playing {
    background: var(--primary-color);
    border-color: var(--primary-light);
}

.audio-play-button.playing:hover {
    background: var(--primary-dark);
}

/* 🎵 暂停状态（可播放）- 默认半透明黑 */
.audio-play-button.paused {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.audio-play-button.paused:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* 小型loading spinner */
.loading-spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========== AI生成卡片状态 ========== */
.scene-card.generating {
    pointer-events: none;
}

.generating-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5;
}

.generating-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.generating-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* 渐变背景（生成中） */
.card-gradient-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        var(--gradient-start, #4A90E2) 0%,
        var(--gradient-mid, #50E3C2) 50%,
        var(--gradient-end, #F5A623) 100%
    );
    background-size: 200% 200%;
    animation: gradientFlow 8s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.scene-card.generating .card-gradient-bg {
    opacity: 1;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    height: 56px;
    width: auto;
    min-width: 260px;
}

.input-wrapper:hover {
    background: rgba(255, 255, 255, 0.18);
}

.input-wrapper.active {
    width: 100%;
    cursor: default;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.main-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-wrapper.active .main-input {
    text-align: left;
}

.main-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.back-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.back-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ========== 背景模糊层 ========== */
.blur-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 150;
    animation: fadeIn 0.3s ease;
    transition: background 0.8s ease;
}

/* 背景渐变动画 */
.blur-overlay.gradient-animated {
    background: linear-gradient(
        135deg,
        var(--gradient-start, #4A90E2) 0%,
        var(--gradient-mid, #50E3C2) 50%,
        var(--gradient-end, #F5A623) 100%
    );
    background-size: 200% 200%;
    animation: gradientFlow 8s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========== 推荐问题（跟随输入框下方） ========== */
.recommendations-bottom {
    position: fixed;
    top: 7rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    z-index: 210;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: slideDown 0.4s ease;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.recommendation-item {
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    overflow: hidden;
    position: relative;
}

.recommendation-item:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 英文推荐问题的跑马灯效果 - 悬停时从左到右滚动 */
.recommendation-item.marquee {
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.recommendation-item.marquee .marquee-content {
    display: inline-block;
    transition: transform 0.3s ease;
    padding-right: 2rem; /* 为循环显示留出空间 */
}

/* 悬停时才开始滚动 */
.recommendation-item.marquee:hover .marquee-content {
    animation: marquee-scroll 10s linear forwards;
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }
    45% {
        transform: translateX(0);
    }
    95% {
        transform: translateX(calc(-100% + 250px));
    }
    100% {
        transform: translateX(calc(-100% + 250px));
    }
}

/* 换一换按钮 */
.refresh-recommendations-btn {
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.refresh-recommendations-btn:hover {
    color: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.refresh-recommendations-btn svg {
    transition: transform 0.3s ease;
}

.refresh-recommendations-btn:hover svg {
    transform: rotate(180deg);
}

/* ========== AI气泡区域 ========== */
.ai-bubble-container {
    position: fixed;
    top: 7rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
    z-index: 210;
    animation: slideDown 0.4s ease;
}

.ai-bubble {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* 气泡音频指示器 - 内联在标题前方 */
.bubble-audio-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 0.75rem;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: middle;
}

.bubble-audio-indicator:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: scale(1.15);
}

.bubble-audio-indicator.loading {
    /* 移除黄色背景，保持默认样式 */
    pointer-events: none;
}

.bubble-audio-indicator.playing {
    background: var(--primary-color);
    border-color: var(--primary-light);
}

.bubble-audio-indicator.playing:hover {
    background: var(--primary-dark);
}

.bubble-audio-indicator.playing .audio-icon {
    animation: musicNotesBounce 0.6s ease-in-out infinite;
}

.bubble-audio-indicator.paused {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
    opacity: 0.6;
}

.bubble-audio-indicator .audio-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

/* 音符跳动动画 */
@keyframes musicNotesBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    25% {
        transform: translateY(-2px) scale(1.05);
    }
    50% {
        transform: translateY(0) scale(1);
    }
    75% {
        transform: translateY(2px) scale(0.95);
    }
}

.ai-bubble-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.atmosphere-container {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 16px;
    overflow: hidden;
}

.atmosphere-placeholder {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* 图片遮罩层 - 增强文字可读性 */
.atmosphere-placeholder::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.1) 30%,
        rgba(0, 0, 0, 0.4) 60%,
        rgba(0, 0, 0, 0.7) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* 渐变动画效果（参考chat.css） */
.atmosphere-placeholder.gradient-animated {
    background: linear-gradient(
        135deg,
        var(--gradient-start, #4A90E2) 0%,
        var(--gradient-mid, #50E3C2) 50%,
        var(--gradient-end, #F5A623) 100%
    );
    background-size: 200% 200%;
    animation: gradientFlow 8s ease-in-out infinite;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.atmosphere-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: relative;
    z-index: 2;
}

.atmosphere-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.6s ease;
}

.ai-bubble-content {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.8;
}

.ai-bubble-content h1,
.ai-bubble-content h2,
.ai-bubble-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: white;
}

.ai-bubble-content h1 { font-size: 1.5rem; }
.ai-bubble-content h2 { font-size: 1.25rem; }
.ai-bubble-content h3 { font-size: 1.1rem; }

.ai-bubble-content p {
    margin-bottom: 1rem;
}

.ai-bubble-content ul,
.ai-bubble-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.ai-bubble-content li {
    margin-bottom: 0.5rem;
}

.ai-bubble-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.ai-bubble-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.ai-bubble-content table thead {
    background: rgba(255, 255, 255, 0.1);
}

.ai-bubble-content table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: white;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.ai-bubble-content table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.ai-bubble-content table tr:last-child td {
    border-bottom: none;
}

.ai-bubble-content table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* AI气泡图片预览区域 */
.ai-bubble-image-preview {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.generated-image-card {
    position: relative;
    width: calc(50% - 0.5rem);
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.generated-image-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.generated-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 70%, rgba(0, 0, 0, 0) 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.generated-image-card:hover .image-card-title {
    opacity: 1;
}

/* 单张图片时占满宽度 */
.ai-bubble-image-preview .generated-image-card:only-child {
    width: 100%;
}

/* 自定义滚动条 */
.ai-bubble-container::-webkit-scrollbar {
    width: 6px;
}

.ai-bubble-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.ai-bubble-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ========== Toast提示 ========== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(20, 20, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    max-width: 400px;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.15);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.15);
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .exit-immersive-btn {
        top: 1rem;
        left: 1rem;
        padding: 0.625rem 1rem;
    }

    .exit-immersive-btn span {
        display: none;
    }

    .side-tabs {
        left: 1rem;
    }

    .side-tab {
        width: 48px;
        height: 48px;
    }

    .scene-card {
        width: 90%;
        max-width: 350px;
    }

    .scene-card.expanded {
        width: 95%;
        max-width: 95%;
        min-height: 80vh;
    }

    .bottom-input-area {
        width: 95%;
        bottom: 2rem;
    }

    .card-title {
        font-size: 1.5rem;
    }

    .scene-card.preview .card-title {
        font-size: 1.125rem;
    }
}
