:root {
    /* Google AI Studio Dark Theme Tokens (Approximate) */
    --md-sys-color-background: #131314;
    --md-sys-color-on-background: #E3E3E3;
    --md-sys-color-surface: #1E1F20;
    --md-sys-color-surface-container: #28292a;
    --md-sys-color-on-surface: #E3E3E3;
    --md-sys-color-on-surface-variant: #C4C7C5;
    --md-sys-color-primary: #A8C7FA;
    --md-sys-color-on-primary: #062E6F;
    --md-sys-color-primary-container: #0842A0;
    --md-sys-color-on-primary-container: #D3E3FD;
    --md-sys-color-outline: #8E918F;
    --md-sys-color-outline-variant: #444746;
    --md-sys-color-error-container: #93000A;
    --md-sys-color-on-error-container: #FFDAD6;

    --user-msg-bg: #28292a;
    --agent-msg-bg: transparent;
}

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

body {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    background-color: #000000; /* 浏览器背景设为纯黑，突出中间的“窗口” */
    color: var(--md-sys-color-on-background);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px; /* 给窗口四周留出边距 */
}

.container {
    width: 100%;
    max-width: 1200px; /* 限制最大宽度 */
    height: 100%;
    max-height: 900px; /* 限制最大高度，避免在超大屏幕上太高 */
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-background);
    border-radius: 24px; /* 窗口圆角 */
    border: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: 0 0 40px rgba(0,0,0,0.5); /* 窗口阴影 */
    overflow: hidden; /* 保证子元素不溢出圆角 */
}

header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--md-sys-color-background);
    z-index: 10; /* Ensure header is above slides if they overlap slightly during transitions */
}

header h1 {
    font-family: 'Google Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--md-sys-color-on-background);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 模拟 Gemini 的星光图标 */
header h1::before {
    content: '✦';
    font-size: 1.5rem;
    background: linear-gradient(135deg, #4285f4, #d96570, #fbbc05);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--md-sys-color-on-surface-variant);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* --- Presentation Mode Styles --- */

#presentation-container {
    flex: 1; /* Take up all available space above input */
    position: relative;
    overflow: hidden;
    background-color: #000;
    min-height: 0; /* Crucial for nested flex containers to shrink properly */
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden; /* Hide completely when not active to avoid interaction */
    transition: opacity 0.6s ease-in-out, visibility 0.6s;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: flex-end;
    z-index: 1;
}

.slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

#welcome-slide {
    background: linear-gradient(135deg, #1e1f20, #000);
    align-items: center;
    justify-content: center;
}

#welcome-slide .slide-content {
    background: transparent;
    backdrop-filter: none;
    text-align: center;
    max-width: 800px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%; /* Take full height of the slide */
    max-height: none; /* Remove max-height restriction */
}

#welcome-slide .slide-content h1 {
    font-size: 3.5rem;
    background: linear-gradient(135deg, #4285f4, #d96570, #fbbc05);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
    white-space: nowrap; /* Prevent awkward wrapping of the title */
}

#welcome-slide .slide-content p {
    font-size: 1.5rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 40px;
}

#welcome-slide .slide-content ul {
    text-align: left;
    font-size: 1.25rem;
    color: var(--md-sys-color-on-surface);
    background: rgba(255,255,255,0.05);
    padding: 32px 48px;
    border-radius: 24px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

#welcome-slide .slide-content li {
    margin-bottom: 16px;
}

.slide-content {
    position: relative;
    width: 100%;
    max-height: 60%; /* Increased max-height for more content */
    padding: 40px 60px 80px; /* Extra bottom padding for nav controls */
    background: linear-gradient(to top, rgba(0,0,0,0.95) 10%, rgba(0,0,0,0.8) 70%, transparent 100%);
    color: var(--md-sys-color-on-background);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

/* Presentation Typography */
.slide-content.markdown-body {
    font-size: 1.35rem; /* Larger base font */
    line-height: 1.6;
}

.slide-content.markdown-body h1 {
    font-size: 3rem;
    margin-bottom: 0.5em;
    color: #fff;
}

.slide-content.markdown-body h2 {
    font-size: 2.2rem;
    color: var(--md-sys-color-primary);
    margin-top: 1em;
}

.slide-content.markdown-body h3 {
    font-size: 1.8rem;
    color: var(--md-sys-color-on-surface);
}

.slide-content.markdown-body ul, 
.slide-content.markdown-body ol {
    padding-left: 1.5em;
}

.slide-content.markdown-body li {
    margin-bottom: 0.5em;
}

.slide-content.markdown-body strong {
    color: var(--md-sys-color-primary);
}

#nav-controls {
    position: absolute;
    bottom: 32px;
    right: 48px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    background: rgba(30, 31, 32, 0.7);
    backdrop-filter: blur(16px);
    padding: 10px 20px;
    border-radius: 100px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.nav-arrow {
    background: transparent;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-arrow:hover:not(:disabled) {
    background: rgba(255,255,255,0.15);
    transform: scale(1.1);
}

.nav-arrow:active:not(:disabled) {
    transform: scale(0.95);
}

.nav-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#slide-indicator {
    font-family: 'Roboto Mono', monospace;
    color: var(--md-sys-color-on-surface);
    font-size: 1rem;
    font-weight: 500;
    min-width: 70px;
    text-align: center;
    letter-spacing: 1px;
}

/* --- Input Area Adjustments --- */
.chat-input-container {
    padding: 20px 40px;
    background: var(--md-sys-color-background);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    z-index: 10;
    flex-shrink: 0; /* Prevent input area from shrinking */
}

.input-wrapper {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 32px;
    border: 1px solid var(--md-sys-color-outline-variant);
    padding: 12px 16px; /* Increased vertical padding slightly */
    gap: 12px;
    display: flex;
    align-items: flex-end;
    min-height: 64px; /* Ensure a minimum height */
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-bottom: 0; /* Ensure no extra margin affecting alignment */
}

.icon-btn:hover {
    background-color: var(--md-sys-color-surface-variant);
    color: var(--md-sys-color-on-surface);
}

.input-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    justify-content: center; /* Center content vertically if it's just one line */
}

.image-preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    /* padding-bottom: 8px;  只有有图片时才需要 padding，JS 控制 */
}

.image-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

textarea {
    flex: 1;
    padding: 4px 0; /* Reduced padding to align better with buttons */
    border: none;
    background: transparent;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    resize: none;
    max-height: 150px;
    min-height: 24px;
    color: var(--md-sys-color-on-surface);
    line-height: 1.5;
}

textarea:focus {
    outline: none;
}

.send-btn {
    width: 40px; /* Match icon-btn size for consistency, or keep slightly larger if preferred */
    height: 40px;
    border-radius: 50%;
    background-color: var(--md-sys-color-on-surface);
    color: var(--md-sys-color-background);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    transform: scale(1.05);
}

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

.send-btn:disabled {
    background-color: transparent;
    color: var(--md-sys-color-outline);
    cursor: not-allowed;
    transform: none;
}

.send-btn .btn-text { display: none; }
.send-btn::after {
    content: '➤';
    font-size: 1.1rem;
    margin-left: -2px;
}

/* --- Misc --- */
.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

/* Typing indicator for slides */
.typing-indicator-block {
    display: flex;
    gap: 6px;
    padding: 10px 0;
    opacity: 0.7;
}

.typing-indicator-block span {
    width: 8px;
    height: 8px;
    background-color: var(--md-sys-color-on-surface);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator-block span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator-block span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

@media (max-width: 768px) {
    body { padding: 0; }
    .container { border-radius: 0; border: none; max-height: none; }
    .slide-content { padding: 24px 24px 80px; }
    .slide-content.markdown-body h1 { font-size: 2rem; }
    #nav-controls { right: 50%; transform: translateX(50%); bottom: 20px; }
}

/* Audio Button Styles */
.audio-btn {
    position: absolute;
    top: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(30, 31, 32, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--md-sys-color-on-surface);
    display: flex; /* Initially hidden by JS, but flex when shown */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.audio-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.audio-btn.playing {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    animation: pulse 2s infinite;
}

.audio-btn.loading {
    cursor: wait;
    opacity: 0.7;
}

.audio-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(168, 199, 250, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(168, 199, 250, 0); }
    100% { box-shadow: 0 0 0 0 rgba(168, 199, 250, 0); }
}

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

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.rotating {
    animation: rotate 1s linear infinite;
}

