@import url('https://cdn.jsdelivr.net/npm/misans@4.0.0/lib/Normal/MiSans-Regular.min.css');
@import url('https://cdn.jsdelivr.net/npm/misans@4.0.0/lib/Normal/MiSans-Bold.min.css');
@import url('https://cdn.jsdelivr.net/npm/misans@4.0.0/lib/Normal/MiSans-Medium.min.css');

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16162a;
    --bg-tertiary: #22223a;
    --bg-bubble-ai: #22223a;
    --bg-input: #22223a;
    --border-color: #2a2a3e;
    --border-light: #333355;
    --border-lighter: #363654;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-dim: #52527a;
    --accent: #4d6bfe;
    --accent-hover: #5d7bff;
    --gradient-user: linear-gradient(135deg, #4d6bfe, #6b5cf0);
    --avatar-bg: #252540;
    --chip-bg: #22223a;
    --chip-border: #2e2e4a;
    --code-bg: #0d1117;
    --code-border: #21262d;
    --code-header: #161b22;
    --scrollbar: #333355;
    --input-hint: #444466;
}

body[data-theme="chatgpt"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f8;
    --bg-tertiary: #ececec;
    --bg-bubble-ai: #f7f7f8;
    --bg-input: #ffffff;
    --border-color: #e5e5e5;
    --border-light: #dddddd;
    --border-lighter: #cccccc;
    --text-primary: #343541;
    --text-secondary: #444444;
    --text-muted: #666666;
    --text-dim: #999999;
    --accent: #10a37f;
    --accent-hover: #0d8c6d;
    --gradient-user: linear-gradient(135deg, #10a37f, #1a9f84);
    --avatar-bg: #ececec;
    --chip-bg: #f0f0f0;
    --chip-border: #e0e0e0;
    --code-bg: #1e1e1e;
    --code-border: #333333;
    --code-header: #282828;
    --scrollbar: #cccccc;
    --input-hint: #aaaaaa;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'MiSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    display: flex;
    transition: background 0.3s ease, color 0.3s ease;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.logo-text {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.15s;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.new-chat-btn {
    margin: 0 12px 12px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-lighter);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
    font-family: inherit;
}

.new-chat-btn:hover {
    background: var(--border-color);
    border-color: var(--accent);
}

.new-chat-btn svg {
    flex-shrink: 0;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 2px;
}

.history-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    padding: 30px 16px;
}

.history-item {
    padding: 9px 36px 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: visible;
    transition: all 0.12s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}
.history-item .history-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.history-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.history-item.active {
    background: var(--accent);
    color: #fff;
}
.history-item.active .history-item-menu-btn {
    background: rgba(255,255,255,0.12);
}
.history-item.active .history-item-menu-btn:hover {
    background: rgba(255,255,255,0.2);
}

.history-item-menu-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0;
    transition: background 0.12s, opacity 0.12s;
    opacity: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    z-index: 2;
}
.history-item:hover .history-item-menu-btn {
    display: flex;
    opacity: 1;
}
.history-item-menu-btn:hover {
    background: var(--border-color);
}
.history-item-menu-btn .dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
    display: block;
}
.history-item.active .history-item-menu-btn .dot {
    background: rgba(255,255,255,0.8);
}

.sidebar-search {
    position: relative;
    margin: 0 12px 10px;
}
.sidebar-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}
.sidebar-search-input {
    width: 100%;
    padding: 7px 10px 7px 30px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-lighter);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.sidebar-search-input::placeholder {
    color: var(--text-dim);
}
.sidebar-search-input:focus {
    border-color: var(--accent);
}

.sidebar-footer {
    padding: 8px 12px 12px;
    border-top: 1px solid var(--border-color);
}

.clear-all-btn {
    width: 100%;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-lighter);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
}

.clear-all-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    min-width: 0;
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.welcome-title {
    font-size: 26px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.welcome-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 720px;
}

.chip {
    padding: 10px 18px;
    background: var(--chip-bg);
    border: 1px solid var(--chip-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 13.5px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.chip:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--text-primary);
}

.chat-bubble {
    display: flex;
    max-width: 80%;
    margin-bottom: 28px;
    position: relative;
}

.chat-bubble.user {
    align-self: flex-end;
}

.chat-bubble.ai {
    align-self: flex-start;
}

.bubble-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    margin-top: 2px;
}

.chat-bubble.user .bubble-avatar {
    display: none;
}

.chat-bubble.ai .bubble-avatar {
    background: var(--avatar-bg);
    border: 1px solid var(--border-lighter);
    color: var(--accent);
    margin-right: 12px;
}

.bubble-body-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bubble-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.7;
    word-break: break-word;
}

.chat-bubble.user .bubble-content {
    white-space: pre-wrap;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 16px;
}

.chat-bubble.ai .bubble-content {
    background: var(--bg-bubble-ai);
    color: var(--text-primary);
    border: 1px solid var(--border-lighter);
    border-bottom-left-radius: 4px;
}

.bubble-content .typing-cursor::after {
    content: '▊';
    animation: blink 1s infinite;
    color: var(--accent);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.bubble-actions {
    position: absolute;
    bottom: -14px;
    right: 0;
    display: none;
    gap: 2px;
    z-index: 10;
}
.chat-bubble:hover .bubble-actions {
    display: flex;
}
.bubble-action-btn {
    width: 24px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid var(--border-lighter);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.bubble-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent);
}
body[data-theme="chatgpt"] .bubble-action-btn {
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.bubble-timestamp {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 4px;
    padding: 0 4px;
    user-select: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.chat-bubble:hover .bubble-timestamp {
    opacity: 1;
}
.chat-bubble.user .bubble-timestamp {
    text-align: right;
    color: rgba(255, 255, 255, 0.5);
}

.version-switcher {
    position: absolute;
    top: -18px;
    left: 0;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 5;
}
.ver-btn {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--border-lighter);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    transition: all 0.1s;
    padding: 0;
    font-family: inherit;
}
.ver-btn:hover:not(:disabled) {
    background: var(--border-color);
    color: var(--text-primary);
    border-color: var(--accent);
}
.ver-btn:disabled {
    opacity: 0.3;
    cursor: default;
}
.ver-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 22px;
    text-align: center;
    user-select: none;
}

.thinking-block {
    margin: 0 0 10px 0;
    border-radius: 10px;
    border: 1px solid var(--border-lighter);
    background: var(--code-bg);
    overflow: hidden;
    animation: thinkFadeIn 0.25s ease;
}
.thinking-block.done {
    border-color: var(--border-lighter);
    background: transparent;
}
.thinking-block.done.collapsed {
    border-color: transparent;
    background: transparent;
}
.thinking-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.thinking-block.done .thinking-header {
    color: var(--text-muted);
    font-size: 12px;
    padding: 0;
}
.thinking-block.done.collapsed .thinking-header {
    padding: 5px 0;
}
.thinking-block.done.collapsed .thinking-header:hover {
    color: var(--text-primary);
}
.thinking-header:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}
.thinking-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.7;
}
.thinking-block.done .thinking-icon {
    opacity: 0.45;
}
.thinking-label {
    flex: 1;
}
.thinking-chevron {
    display: flex;
    align-items: center;
    transition: transform 0.25s ease;
    opacity: 0.55;
}
.thinking-block:not(.collapsed) .thinking-chevron {
    transform: rotate(180deg);
}
.thinking-block.collapsed .thinking-chevron {
    transform: rotate(0deg);
}
.thinking-block.done .thinking-chevron {
    opacity: 0.4;
}
.thinking-body {
    padding: 4px 14px 12px 14px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-muted);
    max-height: 380px;
    overflow-y: auto;
    border-top: 1px solid var(--border-lighter);
}
.thinking-block.done .thinking-body {
    border-top-color: var(--border-lighter);
    color: var(--text-muted);
}
.thinking-block.collapsed .thinking-body {
    display: none;
}
.thinking-body .typing-cursor::after {
    content: '▊';
    animation: blink 1s infinite;
    color: var(--text-muted);
}

@keyframes thinkFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.code-block {
    margin: 10px -4px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--code-header);
    border-bottom: 1px solid var(--code-border);
}

.code-lang {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border-lighter);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11.5px;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.copy-btn:hover {
    background: var(--border-color);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.code-body {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    background: #0d1117;
}

.code-body::-webkit-scrollbar {
    height: 6px;
}

.code-body::-webkit-scrollbar-thumb {
    background: var(--border-lighter);
    border-radius: 3px;
}

.code-body code {
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.65;
    color: #e6edf3;
    white-space: pre;
}

.input-area {
    padding: 16px 20px 20px;
    background: var(--bg-primary);
    position: relative;
}

.streaming-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    font-size: 12.5px;
    color: var(--text-secondary);
    animation: fadeSlideIn 0.25s ease;
}

.streaming-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: statusBlink 1s infinite;
}

.streaming-hint {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.8;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}

.toast {
    padding: 10px 20px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-lighter);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.2s forwards;
    pointer-events: auto;
    white-space: nowrap;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@media (max-width: 480px) {
    .streaming-hint {
        display: none;
    }
}

.input-wrapper {
    position: relative;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    overflow: visible;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

.input-wrapper textarea {
    width: 100%;
    padding: 14px 16px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    line-height: 1.55;
    max-height: 160px;
}

.input-wrapper textarea::placeholder {
    color: var(--text-dim);
}

.input-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 10px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.send-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.mic-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-lighter);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.mic-btn:hover {
    background: var(--border-color);
    border-color: var(--accent);
    color: var(--text-primary);
}

.mic-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mic-btn.recording {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    animation: pulse-record 1.5s ease-in-out infinite;
}

.mic-btn.loading {
    border-color: var(--accent);
    color: var(--accent);
}

.mic-btn.loading svg {
    animation: spin 1s linear infinite;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-hover);
}

.send-btn:disabled {
    background: var(--border-light);
    color: var(--text-dim);
    cursor: not-allowed;
}

.send-btn.stop {
    background: #ef4444;
    color: #fff;
    animation: stopPulse 1.2s infinite;
}

.send-btn.stop:hover {
    background: #dc2626;
}

@keyframes stopPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.toolbar-left {
    display: flex;
    align-items: center;
}

.model-switch-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-lighter);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.model-switch-btn:hover {
    background: var(--border-color);
    border-color: var(--accent);
    color: var(--text-primary);
}

.model-switch-btn .model-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-chevron {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.model-switch-btn.open .model-chevron {
    transform: rotate(180deg);
}

.think-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-lighter);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
    margin-left: 6px;
}
.think-toggle-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}
.think-toggle-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}
.think-toggle-btn.active:hover {
    background: rgba(99, 102, 241, 0.22);
}
.think-toggle-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.think-toggle-label {
    font-size: 11.5px;
}

.model-dropdown {
    position: absolute;
    bottom: 100%;
    left: 8px;
    margin-bottom: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-lighter);
    border-radius: 10px;
    padding: 4px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 200;
}

.model-option {
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s;
}

.model-option:hover {
    background: var(--bg-tertiary);
}

.model-option.active {
    background: var(--accent);
    color: #fff;
}

.model-option.active .model-option-desc {
    color: rgba(255,255,255,0.7);
}

.model-option-name {
    font-size: 13px;
    font-weight: 500;
}

.model-option-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.dropdown-tone-section {
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-lighter);
    margin: 4px 8px;
}

.dropdown-tone-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s;
}

.dropdown-tone-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tone-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tone-overlay.show {
    opacity: 1;
}

.tone-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-lighter);
    border-radius: 16px;
    width: 480px;
    max-width: 92vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tone-overlay.show .tone-modal {
    transform: translateY(0) scale(1);
}

.tone-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-lighter);
}

.tone-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.tone-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.12s;
}

.tone-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tone-modal-body {
    padding: 16px 20px 20px;
}

.tone-section {
    margin-bottom: 20px;
}

.tone-section:last-child {
    margin-bottom: 0;
}

.tone-section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.tone-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.tone-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    background: var(--bg-tertiary);
    border: 1.5px solid transparent;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.tone-preset-btn:hover {
    border-color: var(--border-color);
    color: var(--text-primary);
}

.tone-preset-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.preset-icon {
    font-size: 20px;
    line-height: 1;
}

.preset-name {
    line-height: 1.2;
}

.tone-dims {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tone-dim-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tone-dim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tone-dim-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.tone-dim-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    min-width: 28px;
    text-align: right;
}

.tone-dim-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border-lighter);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.tone-dim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: transform 0.12s, box-shadow 0.12s;
}

.tone-dim-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

.tone-dim-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.tone-dim-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    color: var(--text-dim);
}

.tone-dim-labels span:nth-child(2) {
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .tone-modal {
        border-radius: 14px;
        max-width: 96vw;
    }
    .tone-modal-header {
        padding: 12px 14px 10px;
    }
    .tone-modal-body {
        padding: 12px 14px 16px;
    }
    .tone-preset-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .tone-dim-slider {
        height: 8px;
    }
}

.input-hint {
    text-align: center;
    font-size: 11.5px;
    color: var(--input-hint);
    margin-top: 8px;
}

.quote-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 4px 6px 0;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--text-secondary);
    animation: fadeSlideIn 0.2s ease;
}
.quote-preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.quote-preview-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quote-preview-close {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
}
.quote-preview-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.context-menu {
    position: fixed;
    z-index: 3000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-lighter);
    border-radius: 10px;
    padding: 4px;
    min-width: 130px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.1s;
}
.context-menu-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
body[data-theme="chatgpt"] .context-menu-item {
    font-size: 13px;
}

.sidebar-context-menu {
    position: fixed;
    z-index: 3000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-lighter);
    border-radius: 10px;
    padding: 4px;
    min-width: 160px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    animation: dropIn 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top left;
}
.sidebar-context-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}
.sidebar-context-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.sidebar-context-item svg {
    flex-shrink: 0;
}
.sidebar-context-item--danger,
.sidebar-context-item--danger svg {
    color: #ef4444;
}
.sidebar-context-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.auto-preview {
    background: linear-gradient(135deg, #1a1a2e 50%, #ffffff 50%);
    border: 1px solid #4d6bfe;
}

.voice-status {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 0;
}

.voice-status.show {
    display: flex;
}

.voice-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse-record 1.2s ease-in-out infinite;
}

.voice-status-text {
    font-size: 12.5px;
    color: var(--text-secondary);
}

@keyframes pulse-record {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.15); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.overlay.show {
    display: block;
}

.mobile-menu-btn {
    display: none;
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 50;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-lighter);
    border-radius: 8px;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
}

.mobile-menu-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .chat-bubble {
        max-width: 88%;
    }

    .welcome-title {
        font-size: 22px;
    }

    .input-area {
        padding: 10px 16px 14px;
    }
}

@media (min-width: 901px) {
    .sidebar.collapsed ~ .main-content .mobile-menu-btn,
    .sidebar.collapsed + .main-content .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
    }

    .main-content {
        padding-top: 52px;
    }

    .mobile-menu-btn {
        top: 10px;
        left: 10px;
    }

    .chat-messages {
        padding: 16px 12px;
    }

    .chat-bubble {
        max-width: 92%;
        margin-bottom: 16px;
    }

    .bubble-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .bubble-content {
        font-size: 14px;
        padding: 10px 13px;
    }

    .input-area {
        padding: 8px 12px 12px;
    }

    .input-wrapper textarea {
        font-size: 14px;
        padding: 12px 14px;
    }

    .welcome-title {
        font-size: 19px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .chip {
        font-size: 12.5px;
        padding: 8px 14px;
    }

    .suggestion-chips {
        gap: 8px;
    }

    .code-block {
        margin: 8px -6px;
        border-radius: 6px;
    }

    .code-body {
        padding: 10px 12px;
    }

    .code-body code {
        font-size: 12px;
    }
}

.theme-toggle-btn {
    display: none;
}

.sidebar-theme-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-lighter);
    position: relative;
    overflow: hidden;
}

.sidebar-theme-btn:hover {
    background: var(--border-color);
    border-color: var(--accent);
    color: var(--text-primary);
    transform: rotate(30deg);
    box-shadow: 0 0 16px rgba(77, 107, 254, 0.15);
}

body[data-theme="chatgpt"] .sidebar-theme-btn:hover {
    box-shadow: 0 0 16px rgba(16, 163, 127, 0.15);
}

.sidebar-theme-btn svg {
    position: relative;
    z-index: 1;
}

.mobile-theme-btn {
    display: none;
}

.theme-panel {
    display: none;
    position: fixed;
    top: 52px;
    left: 20px;
    width: 180px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px;
    z-index: 200;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.theme-panel.show {
    display: block;
}

.theme-panel-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-lighter);
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px 8px;
    background: transparent;
    border: 2px solid var(--border-lighter);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.theme-option:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.theme-option.active {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.theme-preview {
    width: 100%;
    height: 36px;
    border-radius: 6px;
    overflow: hidden;
}

.default-preview {
    background: linear-gradient(135deg, #1a1a2e 50%, #22223a 50%);
    border: 1px solid #4d6bfe;
}

.chatgpt-preview {
    background: linear-gradient(135deg, #ffffff 50%, #f7f7f8 50%);
    border: 1px solid #e5e5e5;
}

.theme-name {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

body[data-theme="chatgpt"] .chat-bubble.user .bubble-content {
    background: var(--gradient-user);
    border-bottom-right-radius: 18px;
    border-bottom-left-radius: 18px;
}

body[data-theme="chatgpt"] .chat-bubble.ai .bubble-content {
    background: var(--bg-bubble-ai);
    border: none;
    border-radius: 18px;
}

body[data-theme="chatgpt"] .bubble-avatar {
    display: none;
}

body[data-theme="chatgpt"] .input-wrapper {
    border-radius: 16px;
    box-shadow: 0 0 0 1px var(--border-light), 0 2px 8px rgba(0, 0, 0, 0.06);
}

body[data-theme="chatgpt"] .send-btn {
    background: var(--accent);
    border-radius: 8px;
}
