:root {
    --bg-page: #ffffff;
    --bg-sidebar: #f0f4f9;
    --text-primary: #1f1f1f;
    --text-secondary: #444746;
    --text-tertiary: #5f6368;
    --accent-blue: #0b57d0;
    --bg-input: #f0f4f9;
    --bg-user-bubble: #e3e3e3;
    --sidebar-hover: #e0e4e9;
    --sidebar-active: #d3e3fd;
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-family);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-right: 1px solid rgba(0,0,0,0.05);
    height: 100%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

body.sidebar-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    border: none;
}

body.sidebar-collapsed #main-menu-btn {
    display: flex !important;
}

.sidebar-top {
    padding: 8px;
    margin-bottom: 12px;
}

.menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.menu-btn:hover {
    background-color: var(--sidebar-hover);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: transparent;
    border: none;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 24px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 8px;
    transition: background-color 0.2s;
}
.new-chat-btn:hover {
    background-color: var(--sidebar-hover);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-item:hover {
    background-color: var(--sidebar-hover);
}
.sidebar-item.active {
    background-color: var(--sidebar-active);
    color: var(--text-primary);
}

.sidebar-section {
    margin-top: 16px;
}
.section-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    padding: 0 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 12px;
}

.system-log {
    display: none; /* Hide retro log to fit Gemini UI, can enable for debugging */
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-page);
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.logo {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 400;
}

.chat-title {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

.top-rights {
    display: flex;
    align-items: center;
    gap: 16px;
}

.upgrade-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #e8f0fe;
    color: var(--accent-blue);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: #0b57d0;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

/* Scroll Wrapper for content */
.scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 120px; /* Space for fixed input */
}

/* Welcome Screen */
.welcome-container {
    padding-top: 10vh;
    max-width: 800px;
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.welcome-container.hidden {
    display: none;
}

.welcome-title {
    font-size: 40px;
    line-height: 1.2;
    font-weight: 500;
    color: #c4c7c5;
    margin-bottom: 60px;
}
.gradient-text {
    background: linear-gradient(74deg, #4285f4 0, #9b72cb 9%, #d96570 20%, #d96570 24%, #9b72cb 35%, #4285f4 44%, #9b72cb 50%, #d96570 56%, #fbbc04 75%, #d96570 84%, #9b72cb 92%, #4285f4 100%);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    max-width: 700px;
}

.suggestion-chip {
    padding: 14px 20px;
    background-color: var(--bg-sidebar);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.suggestion-chip:hover {
    background-color: var(--sidebar-hover);
}

/* Chat container */
.chat-container {
    max-width: 800px;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.chat-container.hidden {
    display: none;
}

.message {
    margin-bottom: 30px;
    display: flex;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

.message.user {
    justify-content: flex-end;
}

.message.user .msg-content {
    background-color: var(--bg-user-bubble);
    padding: 12px 18px;
    border-radius: 24px;
    max-width: 80%;
}

.message.assistant {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 16px;
}

.assistant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-image: linear-gradient(to right, #4285f4, #d96570); /* Gradient avatar */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.message.assistant .msg-content {
    max-width: 85%;
    padding-top: 4px; /* Align with avatar */
}

/* 之前终端风格设定的王家卫遮罩 */
#cinematic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 2s ease-in-out;
}

#cinematic-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#cinematic-text {
    color: #f2f2f2;
    font-family: "Songti SC", "STSong", "MingLiU", serif; 
    font-size: 22px;
    line-height: 1.8;
    letter-spacing: 4px;
    white-space: pre-wrap;
    text-align: center;
    width: 80%;
    max-width: 900px;
    text-shadow: 0 0 10px rgba(255,255,255,0.2);
    transition: opacity 1.5s ease-in-out;
}

/* Input Area Fixed */
.input-container-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 30%);
    transition: all 0.3s ease-in-out;
}

.input-container-wrapper.centered-state {
    bottom: auto;
    top: 50vh; /* 将基于视口原本 35vh 的高度下调到 50vh，避免遮挡回忆字眼 */
    background: transparent;
}

/* Loading Dots */
.loading-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 4px;
}
.loading-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--accent-blue);
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}
.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes blink {
    0% { opacity: 0.3; transform: scale(0.8); }
    20% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.3; transform: scale(0.8); }
}

.input-area {
    max-width: 820px;
    width: 90%;
    background-color: var(--bg-input);
    border-radius: 36px;
    display: flex;
    align-items: center;
    padding: 10px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.input-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.input-wrapper {
    flex: 1;
    margin: 0 16px;
}

#user-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    font-family: var(--font-family);
    color: var(--text-primary);
    outline: none;
}

#user-input:disabled {
    opacity: 0.5;
}

.model-selector {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-right: 8px;
}

.send-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
}
.send-btn:hover {
    background-color: rgba(0,0,0,0.05);
}

.legal-text {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 12px;
}

/* Modal 设置弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--bg-page);
    width: 90%;
    max-width: 800px;
    height: 80vh;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
}

.modal-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
}
.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.modal-desc {
    margin-top: 0;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

#prompt-editor-textarea {
    flex: 1;
    width: 100%;
    resize: none;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
    background-color: var(--bg-input);
    color: var(--text-primary);
    outline: none;
}

#prompt-editor-textarea:focus {
    border-color: var(--accent-blue);
}

.modal-footer {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.secondary-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-family);
}
.secondary-btn:hover {
    background: var(--sidebar-hover);
}

.primary-btn {
    padding: 10px 20px;
    background: var(--accent-blue);
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-family);
}
.primary-btn:hover {
    background-color: #0842a0;
}
