* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* 顶部导航栏 */
.top-nav {
    background: #f5f5f5;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    width: 257px;
    min-width: 257px;
    flex: 0 0 auto;
    padding-right: 20px;
}

.nav-left .logo {
    color: #333;
    font-size: 24px;
    font-weight: bold;
}

.nav-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    flex-shrink: 0;
}

.version-badge {
    background: #e8e8e8;
    color: #666;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: 720px;
    width: calc(100% - 48px);
    display: flex;
    align-items: center;
    gap: 0;
}

/* 搜索栏容器 */
.search-bar {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    overflow: visible;
    transition: border-color 0.2s;
}

.search-bar:focus-within {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
}

/* 搜索引擎按钮（左侧） */
.search-engine-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 20px 0 0 20px;
    padding: 0;
    transition: background 0.15s;
}

.search-engine-btn:hover {
    background: #f0f0f0;
}

.search-engine-btn img {
    width: 22px;
    height: 22px;
    border-radius: 3px;
}

.search-engine-btn svg {
    display: block;
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 10px 4px;
    border: none;
    border-radius: 0;
    font-size: 15px;
    background: transparent;
    color: #333;
    outline: none;
}

.search-input::placeholder {
    color: #999;
}

/* 搜索提交按钮（右侧放大镜） */
.search-submit-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0 20px 20px 0;
    color: #999;
    padding: 0;
    transition: all 0.15s;
}

.search-submit-btn:hover {
    color: #333;
    background: #f0f0f0;
}

/* 搜索引擎选择器面板 */
.search-engine-picker {
    display: none;
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 200;
    padding: 6px 0;
    max-height: 420px;
    overflow-y: auto;
}

.search-engine-picker.show {
    display: block !important;
}

.engine-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.1s;
    position: relative;
}

.engine-item:hover {
    background: #f5f5f5;
}

.engine-item.active {
    background: #e8f0fe;
}

.engine-item-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
}

.engine-item-icon img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.engine-item-name {
    flex: 1;
    font-size: 14px;
}

.engine-item-check {
    color: #3498db;
    font-size: 12px;
    font-weight: bold;
}

.engine-item-delete {
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border: none;
    background: transparent;
    transition: color 0.15s;
}

.engine-item-delete:hover {
    color: #e74c3c;
}

.engine-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.engine-add-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #888;
    transition: background 0.1s;
    border: none;
    border-top: 1px solid #eee;
    margin-top: 2px;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.engine-add-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.engine-add-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
    border-radius: 50%;
    font-size: 18px;
    color: #aaa;
    line-height: 1;
}

/* 自定义引擎输入框（内联在 picker 内） */
.engine-custom-form {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.engine-custom-form input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    background: #fafafa;
}

.engine-custom-form input:focus {
    border-color: #3498db;
    background: white;
}

.engine-custom-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.engine-custom-actions button {
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: white;
    color: #555;
}

.engine-custom-actions button.engine-save-btn {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.engine-custom-actions button.engine-save-btn:hover {
    background: #2980b9;
}

/* 搜索联想下拉框 */
.suggestions-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    z-index: 200;
    max-height: 380px;
    overflow-y: auto;
}
.suggestions-dropdown.show {
    display: block !important;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.15s;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: #f0f0f0;
}

.suggestion-item .suggestion-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.suggestion-item .suggestion-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-section-label {
    padding: 6px 16px 2px;
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggestion-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.suggestion-footer {
    padding: 8px 16px;
    font-size: 12px;
    color: #0078d4;
    cursor: pointer;
    border-top: 1px solid #eee;
    text-align: center;
}

.suggestion-footer:hover {
    background: #f5f5f5;
}

.nav-right {
    display: flex;
    gap: 8px;
}

.nav-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: #e8e8e8;
    border-color: #bbb;
}

/* 顶部导航栏菜单按钮容器：紧跟版本号 */
.nav-menu-wrapper {
    position: relative;
    display: inline-flex;
    margin-left: auto;
}

/* 统一 ... 菜单按钮样式（无边框无方框） */
.folder-menu-btn,
.content-folder-menu-btn,
.nav-menu-btn {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #999;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
    padding: 4px 6px;
}

/* 书签行 ... 按钮默认隐藏，hover 时显示 */
.bookmark-menu-btn {
    display: none;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #999;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
    padding: 4px 6px;
    margin-left: 8px;
    text-decoration: none;
}

.folder-menu-btn {
    margin-left: auto;
}

.content-folder-menu-btn {
    margin-left: auto;
}

.folder-menu-btn:hover,
.content-folder-menu-btn:hover,
.nav-menu-btn:hover,
.bookmark-menu-btn:hover {
    color: #333;
}

/* 认证界面 */
#auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 380px;
}

.auth-logo {
    font-size: 48px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
}

.auth-logo-img {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    border-radius: 8px;
}

.auth-copyright {
    margin-top: 24px;
    font-size: 12px;
    color: #999;
    text-align: center;
}

.auth-version {
    margin-top: 8px;
    font-size: 11px;
    color: #bbb;
}

/* ================================================================
   个人信息界面
   ================================================================ */
#profile-container {
    height: 100vh;
    height: 100dvh;
    display: flex;
    background: #f5f7fa;
}
#profile-container.hidden {
    display: none !important;
}
.profile-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
}
.profile-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 420px;
    padding: 32px 28px;
}
.profile-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 24px;
    text-align: center;
}
.profile-section {
    margin-bottom: 20px;
}
.profile-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
    display: block;
}
.profile-current-user {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding: 8px 12px;
    background: #f5f7fa;
    border-radius: 6px;
}
.profile-field-row {
    display: flex;
    gap: 10px;
}
.profile-field-row input {
    flex: 1;
}
.profile-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.profile-box input:focus {
    border-color: #4da3d4;
}
.profile-box input::placeholder {
    color: #aaa;
}
.profile-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    color: #555;
    transition: background 0.15s;
    white-space: nowrap;
}
.profile-btn:hover {
    background: #f0f0f0;
}
.profile-btn--primary {
    width: 100%;
    background: #4da3d4;
    color: #fff;
    border: none;
    padding: 12px;
    font-size: 15px;
    margin-top: 4px;
}
.profile-btn--primary:hover {
    background: #3d93c4;
}
.profile-divider {
    height: 1px;
    background: #eee;
    margin: 24px 0;
}
.profile-msg {
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
}
.profile-msg--success { color: #27ae60; }
.profile-msg--error { color: #e74c3c; }

[data-theme="dark"] #profile-container {
    background: #1a1a2e;
}
[data-theme="dark"] .profile-box {
    background: #2a2a3e;
    box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
[data-theme="dark"] .profile-title {
    color: #eee;
}
[data-theme="dark"] .profile-label {
    color: #999;
}
[data-theme="dark"] .profile-current-user {
    background: #3a3a4e;
    color: #eee;
}
[data-theme="dark"] .profile-box input {
    background: #1e1e30;
    border-color: #444;
    color: #eee;
}
[data-theme="dark"] .profile-box input::placeholder { color: #666; }
[data-theme="dark"] .profile-btn {
    background: #3a3a4e;
    border-color: #555;
    color: #ddd;
}
[data-theme="dark"] .profile-btn:hover { background: #4a4a5e; }
[data-theme="dark"] .profile-btn--primary {
    background: #3d93c4;
    color: #fff;
}
[data-theme="dark"] .profile-btn--primary:hover { background: #3498db; }
[data-theme="dark"] .profile-divider { background: #444; }
[data-theme="dark"] .profile-msg--success { color: #2ecc71; }
[data-theme="dark"] .profile-msg--error { color: #e74c3c; }

/* 移动端 */
@media (max-width: 768px) {
    .profile-box {
        padding: 24px 18px;
        max-width: 100%;
    }
}

.auth-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 380px;
    overflow: hidden;
}

.auth-tabs {
    display: flex;
}

.auth-tabs button {
    flex: 1;
    padding: 16px;
    border: none;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 15px;
    color: #666;
    transition: all 0.2s ease;
}

.auth-tabs button.active {
    background: white;
    color: #2c3e50;
    font-weight: 500;
}

.auth-form {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form input {
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.auth-form input:focus {
    border-color: #3498db;
}

.auth-form button[type="submit"] {
    padding: 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.auth-form button[type="submit"]:hover {
    background: #2980b9;
}

.auth-back-btn {
    padding: 12px;
    background: transparent;
    color: #999;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.auth-back-btn:hover {
    color: #666;
    border-color: #ccc;
}

/* 主布局 */
.main-layout {
    flex: 1;
    display: flex;
    background: white;
    min-height: 0;
    height: calc(100vh - 56px);
}

/* 底部版权 */
#main-footer {
    text-align: center;
    font-size: 12px;
    color: #999;
    padding: 12px 0;
    margin-top: auto;
    background: transparent;
    border-top: 1px solid #e8e8e8;
}

/* 左侧边栏 */
.sidebar {
    width: 257px;
    min-width: 257px;
    background: #fafafa;
    border-right: 1px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: calc(100vh - 56px);
    position: sticky;
    top: 0;
}

.sidebar-title {
    display: none;
}

.sidebar-title .folder-icon {
    font-size: 18px;
    color: inherit;
}

.folder-tree {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.folder-item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    position: relative;
    margin: 0;
}

/* 多选模式下 folder-header 内的 checkbox */
.folder-item .select-checkbox {
    margin-right: 6px;
    margin-left: 6px;
    flex-shrink: 0;
}

.folder-item:hover > .folder-header {
    background: #f0f0f0;
}

.folder-item.selected > .folder-header {
    background: #e8f0fe;
}

.folder-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 20px;
    height: 24px;
    min-height: 24px;
    line-height: 1;
    transition: background-color 0.15s ease;
    position: relative;
}

.folder-toggle {
    display: none;
}

.folder-icon {
    margin-right: 6px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    color: #555;
}

.folder-icon svg {
    display: block;
}

.bookmark-icon-sm {
    margin-right: 6px;
    font-size: 14px;
    flex-shrink: 0;
}

.folder-name {
    flex: 1;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subfolders {
    padding-left: 1em;
}

/* 右侧内容区 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: white;
}

.content-header {
    display: none;
}

.content-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 6px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: white;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: #f0f0f0;
    border-color: #bbb;
}

/* 三点菜单 */
.menu-wrapper {
    position: relative;
}

#more-menu-btn {
    padding: 6px 10px;
    font-weight: bold;
    letter-spacing: 2px;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 150px;
    z-index: 200;
    padding: 4px 0;
}

/* 顶部导航栏下拉菜单左对齐 */
#nav-menu-dropdown {
    right: auto;
    left: 0;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background 0.1s ease;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item:first-child {
    border-radius: 4px 4px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 4px 4px;
}

.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

.dropdown-item--danger {
    color: #e74c3c;
}

.dropdown-item--danger:hover {
    background: #fdf2f2;
}

.dropdown-info {
    padding: 8px 16px 10px 16px;
    font-size: 12px;
    color: #999;
    border-top: 1px solid #f0f0f0;
    user-select: none;
}

.bookmarks-list {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bookmark-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
}

/* 右侧内容区文件夹行 */
.content-folder-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #f0f4ff;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: inherit;
    gap: 10px;
    margin-bottom: 4px;
    position: relative;
}

.content-folder-item:hover {
    background: #e2eafc;
}

.content-folder-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    color: #555;
}

.content-folder-icon svg {
    display: block;
}

.content-folder-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-folder-count {
    display: none;
}

.bookmark-item:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.bookmark-item * {
    text-decoration: none;
}

.bookmark-favicon {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
    background: #f5f5f5;
}

.bookmark-info {
    flex: 1;
    min-width: 0;
}

.bookmark-info h3 {
    font-size: 14px;
    font-weight: 400;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-info p {
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 搜索高亮 */
.search-highlight {
    background: #ffeaa7;
    color: #2d3436;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 14px;
}

/* 模态框 */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.changelog-entry {
    margin-bottom: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.changelog-entry h3 {
    padding: 12px 16px;
    font-weight: 500;
    color: #333;
    background: #fafafa;
    font-size: 14px;
    margin: 0;
    border-bottom: 1px solid #e0e0e0;
}

.changelog-entry ul {
    padding: 12px 16px 12px 36px;
    background: white;
}

.modal-content li {
    margin-bottom: 8px;
    color: #555;
    font-size: 14px;
}

/* 书签菜单栏（每个书签右侧三点） */
.bookmark-item {
    position: relative;
}

.bookmark-menu-btn {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 4px 6px;
    border-radius: 0;
    flex-shrink: 0;
    line-height: 1;
    margin-left: 8px;
    text-decoration: none;
    transition: color 0.15s;
}

.bookmark-item:hover .bookmark-menu-btn {
    display: block;
}

.bookmark-menu-btn:hover {
    color: #333;
}

.bookmark-dropdown {
    position: absolute;
    right: 8px;
    top: calc(100% - 4px);
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    min-width: 140px;
    z-index: 300;
}

/* 通用输入对话框 */
.input-modal-content {
    max-width: 420px;
    padding: 24px 28px;
}

.input-modal-content h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 500;
}

.input-modal-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.input-modal-fields input {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.input-modal-fields input:focus {
    border-color: #3498db;
}

.input-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.input-modal-btn {
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.input-modal-btn--cancel {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.input-modal-btn--cancel:hover {
    background: #e8e8e8;
}

.input-modal-btn--confirm {
    background: #3498db;
    color: white;
}

.input-modal-btn--confirm:hover {
    background: #2980b9;
}

.hidden {
    display: none !important;
}

/* 手机端适配 */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 6px 10px;
        gap: 4px;
    }

    .nav-left {
        flex: 0 0 auto;
        width: 140px;
        min-width: 140px;
        padding-right: 8px;
        order: 1;
    }

    .nav-left .logo {
        font-size: 16px;
    }

    .version-badge {
        font-size: 9px;
        padding: 2px 5px;
    }

    .nav-center {
        position: relative;
        left: auto;
        transform: none;
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
        margin: 0 6px;
        min-width: 0;
        order: 2;
        display: flex;
    }

    .search-input {
        font-size: 14px;
        padding: 8px 14px;
    }

    .suggestion-item {
        font-size: 13px;
        padding: 9px 12px;
    }

    .suggestions-dropdown {
        max-height: 300px;
    }

    .nav-right {
        flex: 0 0 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 3px;
        order: 3;
    }

    .nav-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .main-layout {
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
    }

    .sidebar {
        width: 140px;
        min-width: 140px;
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
    }

    .sidebar-title {
        display: none;
    }

    .folder-header {
        padding: 0 8px;
        height: 32px;
        min-height: 32px;
        font-size: 13px;
    }

    .folder-tree {
        padding: 4px 0;
    }

    .content-area {
        min-height: 0;
    }

    .content-header {
        display: none;
    }

    .content-header h2 {
        font-size: 14px;
    }

    .bookmarks-list {
        padding: 10px 12px;
        gap: 6px;
    }

    .bookmark-item {
        padding: 8px 10px;
    }

    .bookmark-favicon {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }

    .bookmark-info h3 {
        font-size: 12px;
    }

    .bookmark-info p {
        font-size: 11px;
    }

    .auth-logo {
        font-size: 36px;
        margin-bottom: 6px;
    }

    .auth-logo-img {
        width: 40px;
        height: 40px;
        margin-bottom: 12px;
    }

    .auth-box {
        max-width: 100%;
    }

    .auth-form {
        padding: 20px 16px;
    }

    .modal-content {
        width: 95%;
        padding: 20px 16px;
    }
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 9999;
    max-width: 90vw;
    word-break: break-all;
    text-align: center;
}

.toast--show {
    opacity: 1;
}

/* 多选操作栏 */
.multi-select-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: #2c3e50;
    color: white;
    font-size: 14px;
    position: sticky;
    top: 60px;
    z-index: 99;
}

.multi-select-bar.hidden {
    display: none;
}

.multi-select-actions {
    display: flex;
    gap: 8px;
}

.multi-select-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    background: transparent;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.multi-select-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.multi-select-btn--danger:hover {
    background: rgba(231, 76, 60, 0.3);
    border-color: rgba(231, 76, 60, 0.6);
}

.multi-select-btn--cancel {
    opacity: 0.7;
}

/* 多选 checkbox */
.select-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #3498db;
}

.multi-select-item {
    cursor: default;
}

/* 文件夹选择器 */
.folder-picker-content {
    max-width: 400px;
}

.folder-picker-tree {
    max-height: 50vh;
    overflow-y: auto;
    margin-top: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.folder-picker-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.1s;
    border-bottom: 1px solid #f0f0f0;
}

.folder-picker-item:hover {
    background: #e8f0fe;
}

.folder-picker-item:last-child {
    border-bottom: none;
}

/* 短链接管理弹窗 */
.shares-modal-content {
    max-width: 560px;
}

.profile-modal-content {
    max-width: 420px;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.profile-form label {
    font-size: 13px;
    color: #666;
    margin-bottom: -8px;
}

.profile-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: #333;
    outline: none;
    box-sizing: border-box;
}

.profile-form input:focus {
    border-color: #667eea;
}

.profile-form button[type="submit"] {
    padding: 12px;
    background: #333;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 4px;
}

.profile-form button[type="submit"]:hover {
    background: #555;
}

.shares-list {
    max-height: 400px;
    overflow-y: auto;
}

.share-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.share-item:last-child {
    border-bottom: none;
}

.share-item-info {
    flex: 1;
    min-width: 0;
    margin-right: 12px;
}

.share-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-item-url {
    font-size: 12px;
    color: #667eea;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-item-time {
    font-size: 11px;
    color: #999;
}

.share-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.share-item-btn {
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.share-item-btn:hover {
    background: #f0f0f0;
}

.share-item-btn--danger {
    color: #dc3545;
    border-color: #dc3545;
}

.share-item-btn--danger:hover {
    background: #dc3545;
    color: white;
}

.shares-list .loading,
.shares-list .empty-state {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
}

/* ====== 搜索历史面板 ====== */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
}

.side-panel.hidden {
    display: none;
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.side-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.side-panel-actions {
    display: flex;
    gap: 4px;
}

.side-panel-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: all 0.15s;
}

.side-panel-icon-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.side-panel-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    color: #999;
}

.side-panel-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: #333;
    padding: 4px 0;
}

.side-panel-search input::placeholder {
    color: #bbb;
}

.side-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.12s;
}

.history-item:hover {
    background: #f5f5f5;
}

.history-item-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-query {
    display: block;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.history-item-url {
    display: block;
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-top: 2px;
}

.history-item-visit .history-item-icon {
    color: #4a90d9;
}

.history-item-time {
    flex-shrink: 0;
    font-size: 12px;
    color: #bbb;
    white-space: nowrap;
}

.side-panel-empty {
    text-align: center;
    padding: 40px 20px;
    color: #bbb;
    font-size: 14px;
}

/* ====== 暗色主题 ====== */
[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1a1a1a;
    --bg-card: #1e1e1e;
    --bg-hover: #2a2a2a;
    --bg-input: #2a2a2a;
    --text-primary: #f0f0f0;
    --text-secondary: #d0d0d0;
    --text-muted: #b8b8b8;
    --border-color: #333;
    --accent: #3498db;
    --danger: #e74c3c;
    --highlight-bg: #3d3520;
}

[data-theme="dark"] html {
    background: var(--bg-primary);
}

[data-theme="dark"] body {
    background: var(--bg-primary);
    color: var(--text-muted);
}

[data-theme="dark"] .top-nav {
    background: var(--bg-secondary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .nav-left .logo {
    color: var(--text-muted);
}

[data-theme="dark"] .nav-btn {
    background: var(--bg-card);
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .nav-btn:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .search-bar {
    background: var(--bg-input);
    border-color: var(--border-color);
}

[data-theme="dark"] .search-bar:focus-within {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}

[data-theme="dark"] .search-engine-btn {
    color: var(--text-muted);
}

[data-theme="dark"] .search-engine-btn:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .search-input {
    background: transparent;
    color: var(--text-muted);
}

[data-theme="dark"] .search-input::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .search-submit-btn {
    color: var(--text-muted);
}

[data-theme="dark"] .search-submit-btn:hover {
    color: #ddd;
    background: var(--bg-hover);
}

[data-theme="dark"] .search-engine-picker {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

[data-theme="dark"] .engine-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .engine-item:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .engine-item.active {
    background: rgba(52,152,219,0.15);
}

[data-theme="dark"] .engine-divider {
    background: var(--border-color);
}

[data-theme="dark"] .engine-add-btn {
    color: #888;
    border-top-color: var(--border-color);
    background: transparent;
}

[data-theme="dark"] .engine-add-btn:hover {
    background: var(--bg-hover);
    color: #ddd;
}

[data-theme="dark"] .engine-add-icon {
    border-color: #555;
    color: #777;
}

[data-theme="dark"] .engine-custom-form input {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

[data-theme="dark"] .engine-custom-form input:focus {
    background: var(--bg-hover);
}

[data-theme="dark"] .engine-custom-actions button {
    background: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-muted);
}

[data-theme="dark"] .engine-item-delete {
    color: #666;
}

[data-theme="dark"] .engine-item-delete:hover {
    color: #e74c3c;
}

[data-theme="dark"] .suggestions-dropdown {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

[data-theme="dark"] .suggestion-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .suggestion-item:hover,
[data-theme="dark"] .suggestion-item.active {
    background: var(--bg-hover);
}

[data-theme="dark"] .suggestion-divider {
    background: var(--border-color);
}

[data-theme="dark"] .suggestion-footer {
    border-top-color: var(--border-color);
    color: #4da3ff;
}

[data-theme="dark"] .suggestion-footer:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .main-layout {
    background: var(--bg-primary);
}

[data-theme="dark"] .sidebar {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .folder-header {
    color: var(--text-muted);
}

[data-theme="dark"] .folder-item {
    color: var(--text-muted);
}


[data-theme="dark"] .folder-name {
    color: var(--text-muted);
}


[data-theme="dark"] .folder-icon,
[data-theme="dark"] .content-folder-icon {
    color: #bbb;
}
    [data-theme="dark"] .folder-menu-btn,
[data-theme="dark"] .content-folder-menu-btn,
[data-theme="dark"] .nav-menu-btn,
[data-theme="dark"] .bookmark-menu-btn {
    color: #777;
}

[data-theme="dark"] .folder-menu-btn:hover,
[data-theme="dark"] .content-folder-menu-btn:hover,
[data-theme="dark"] .nav-menu-btn:hover,
[data-theme="dark"] .bookmark-menu-btn:hover {
    color: #bbb;
}

[data-theme="dark"] .folder-item:hover > .folder-header {
    background: var(--bg-hover);
}

[data-theme="dark"] .folder-item.selected > .folder-header {
    background: rgba(52, 152, 219, 0.15);
}

[data-theme="dark"] .sidebar-title {
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .content-area {
    background: var(--bg-primary);
}

[data-theme="dark"] .content-header {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .content-header h2 {
    color: var(--text-muted);
}

[data-theme="dark"] .bookmark-favicon {
    background: transparent;
}

[data-theme="dark"] .bookmark-item {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .bookmarks-list {
    background: var(--bg-primary);
}

[data-theme="dark"] .bookmark-item:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .bookmark-info h3 {
    color: var(--text-muted);
}

[data-theme="dark"] .bookmark-info p {
    color: var(--text-muted);
}

[data-theme="dark"] .bookmark-menu-btn {
    color: var(--text-muted);
}

[data-theme="dark"] .bookmark-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-muted);
}

[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-muted);
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .dropdown-item--danger {
    color: var(--danger);
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-info {
    color: #666;
    border-top-color: #3a3a3a;
}

[data-theme="dark"] .empty-state {
    color: var(--text-muted);
}

[data-theme="dark"] .multi-select-bar {
    background: var(--bg-secondary);
}

[data-theme="dark"] .multi-select-btn--cancel {
    opacity: 0.6;
}

[data-theme="dark"] .modal-content {
    background: var(--bg-card);
    color: var(--text-muted);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

[data-theme="dark"] .modal-content .close {
    color: var(--text-muted);
}

[data-theme="dark"] .modal-content .close:hover {
    color: var(--text-muted);
}

[data-theme="dark"] .auth-wrapper {
    color: var(--text-muted);
}

[data-theme="dark"] .auth-box {
    background: var(--bg-card);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

[data-theme="dark"] .auth-tabs button {
    color: var(--text-muted);
}

[data-theme="dark"] .auth-tabs button.active {
    color: var(--accent);
    border-color: var(--accent);
}

[data-theme="dark"] .auth-form input {
    background: var(--bg-input);
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .auth-form input::placeholder {
    color: var(--text-muted);
}

[data-theme="dark"] .auth-form button[type="submit"] {
    background: var(--accent);
}

[data-theme="dark"] .auth-back-btn {
    color: #888;
    border-top-color: var(--border-color);
    background: transparent;
}

[data-theme="dark"] .auth-back-btn:hover {
    color: #aaa;
    background: rgba(255,255,255,0.05);
}

[data-theme="dark"] .auth-copyright {
    color: var(--text-muted);
}

[data-theme="dark"] .version-badge {
    background: var(--bg-hover);
    color: var(--text-muted);
}

[data-theme="dark"] #main-footer {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .search-highlight {
    background: var(--highlight-bg);
    color: #f0c040;
}

[data-theme="dark"] .changelog-entry {
    border-color: var(--border-color);
}

[data-theme="dark"] .changelog-entry h3 {
    color: var(--accent);
}

[data-theme="dark"] .changelog-entry li {
    color: var(--text-muted);
}

[data-theme="dark"] .input-modal-content input {
    background: var(--bg-input);
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .input-modal-btn--cancel {
    background: var(--bg-hover);
    color: var(--text-muted);
}

[data-theme="dark"] .shares-modal-content h2 {
    color: var(--text-muted);
}

[data-theme="dark"] .profile-form label {
    color: #aaa;
}

[data-theme="dark"] .profile-form input {
    background: #2a2a2a;
    border-color: #444;
    color: #ddd;
}

[data-theme="dark"] .profile-form input:focus {
    border-color: #667eea;
}

[data-theme="dark"] .profile-form button[type="submit"] {
    background: #444;
}

[data-theme="dark"] .profile-form button[type="submit"]:hover {
    background: #666;
}

[data-theme="dark"] .share-item {
    border-color: var(--border-color);
}

[data-theme="dark"] .share-item-title {
    color: var(--text-muted);
}

[data-theme="dark"] .share-item-time {
    color: var(--text-muted);
}

[data-theme="dark"] .share-item-btn {
    background: var(--bg-hover);
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .share-item-btn:hover {
    background: var(--bg-card);
}

[data-theme="dark"] .content-folder-item {
    color: var(--text-muted);
    background: var(--bg-card);
}

[data-theme="dark"] .content-folder-item:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .content-folder-name {
    color: var(--text-muted);
}


[data-theme="dark"] .folder-picker-tree {
    border-color: var(--border-color);
}

[data-theme="dark"] .folder-picker-item {
    color: var(--text-muted);
    border-color: var(--border-color);
}

[data-theme="dark"] .folder-picker-item:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .toast {
    background: rgba(255,255,255,0.9);
    color: #121212;
}

[data-theme="dark"] .action-btn {
    background: var(--bg-card);
    color: var(--text-muted);
    border-color: var(--border-color);
}

/* ================================================================
   浏览器入口界面（V2.0.0）
   ================================================================ */
#browser-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(170deg, #d4f3e8 0%, #b8e6d4 30%, #a8ded5 60%, #c8e8df 100%);
    position: relative;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 波浪背景纹 */
#browser-container::before {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -5%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse at 30% 70%, rgba(152, 210, 190, 0.4) 0%, transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}
#browser-container::after {
    content: '';
    position: absolute;
    bottom: -15%;
    right: -8%;
    width: 55%;
    height: 55%;
    background: radial-gradient(ellipse at 70% 60%, rgba(140, 200, 178, 0.35) 0%, transparent 55%);
    border-radius: 50%;
    pointer-events: none;
}

.browser-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    position: relative;
    z-index: 10;
}

.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.hamburger-btn:hover {
    background: rgba(0,0,0,0.06);
}

/* 主导区域：logo + 搜索框 居中 */
.browser-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10vh;
    position: relative;
    z-index: 2;
}

.browser-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 640px;
    padding: 0 24px;
}

.browser-logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.browser-search-wrapper {
    position: relative;
    width: 100%;
}

.browser-search-input {
    width: 100%;
    height: 48px;
    padding: 0 48px 0 48px;
    border: none;
    border-radius: 24px;
    background: rgba(255,255,255,0.85);
    font-size: 16px;
    color: #333;
    outline: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, background 0.2s;
}
.browser-search-input::placeholder {
    color: #aab;
}
.browser-search-input:focus {
    background: rgba(255,255,255,0.98);
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
}

.browser-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #aab;
    pointer-events: none;
}

/* 快捷方式区域 */
.quick-access-section {
    margin-top: 48px;
    width: 100%;
    max-width: 800px;
    padding: 0 24px;
}

.quick-access-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
}

.quick-access-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    cursor: pointer;
    border-radius: 8px;
    width: 88px;
    transition: background 0.15s;
    text-decoration: none;
    position: relative;
}
.quick-access-item:hover {
    background: rgba(255,255,255,0.35);
}

.quick-access-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.quick-access-icon-wrap img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
}
.quick-access-icon-wrap .qa-fallback {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.quick-access-name {
    font-size: 12px;
    color: #555;
    text-align: center;
    line-height: 1.3;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 添加按钮特殊样式 */
.qa-add .quick-access-icon-wrap {
    background: rgba(255,255,255,0.5);
    border: 2px dashed rgba(0,0,0,0.12);
}
.qa-add .quick-access-icon-wrap svg {
    color: #999;
}

/* 快捷方式右键删除按钮 (touch: 长按后显示) */
.quick-access-item .qa-remove {
    display: none;
    position: absolute;
    top: 0;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e74c3c;
    color: #fff;
    border: none;
    font-size: 14px;
    line-height: 18px;
    cursor: pointer;
    text-align: center;
}
.quick-access-item:hover .qa-remove {
    display: block;
}

/* 底部版本号 */
.browser-footer {
    text-align: center;
    padding: 12px;
    font-size: 11px;
    color: rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
    cursor: pointer;
}
.browser-footer:hover {
    color: rgba(0,0,0,0.5);
}

/* ================================================================
   侧边菜单抽屉
   ================================================================ */
.menu-drawer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
}
.menu-drawer.hidden {
    display: none;
}

.menu-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    animation: fadeIn 0.2s ease;
}

.menu-drawer-panel {
    position: relative;
    width: 280px;
    max-width: 80vw;
    height: 100%;
    background: #fff;
    box-shadow: 2px 0 20px rgba(0,0,0,0.12);
    animation: slideInLeft 0.22s ease;
    display: flex;
    flex-direction: column;
}

.menu-drawer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}
.menu-drawer-header img {
    border-radius: 8px;
}

.menu-drawer-nav {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    transition: background 0.12s;
    text-align: left;
    width: 100%;
}
.menu-drawer-item:hover {
    background: #f5f5f5;
}
.menu-drawer-item svg {
    flex-shrink: 0;
    color: #666;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* ================================================================
   返回按钮（书签管理 + 认证界面）
   ================================================================ */
.nav-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background 0.15s;
    flex-shrink: 0;
}
.nav-back-btn:hover {
    background: rgba(0,0,0,0.06);
}


/* 认证界面布局微调 */
#auth-container {
    height: 100vh;
    height: 100dvh;
    display: flex;
}
#auth-container.hidden {
    display: none !important;
}
.auth-wrapper {
    position: relative;
}

/* ================================================================
   浏览器界面暗色主题
   ================================================================ */
[data-theme="dark"] #browser-container {
    background: linear-gradient(170deg, #1a2a26 0%, #182622 30%, #162420 60%, #1a2a26 100%);
}
[data-theme="dark"] #browser-container::before {
    background: radial-gradient(ellipse at 30% 70%, rgba(40, 80, 70, 0.3) 0%, transparent 60%);
}
[data-theme="dark"] #browser-container::after {
    background: radial-gradient(ellipse at 70% 60%, rgba(35, 70, 60, 0.25) 0%, transparent 55%);
}

[data-theme="dark"] .hamburger-btn {
    color: #ccc;
}
[data-theme="dark"] .hamburger-btn:hover {
    background: rgba(255,255,255,0.08);
}

[data-theme="dark"] .browser-search-input {
    background: rgba(40,40,40,0.85);
    color: #eee;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
[data-theme="dark"] .browser-search-input::placeholder {
    color: #777;
}
[data-theme="dark"] .browser-search-input:focus {
    background: rgba(50,50,50,0.95);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
[data-theme="dark"] .browser-search-icon {
    color: #777;
}

[data-theme="dark"] .quick-access-item:hover {
    background: rgba(255,255,255,0.08);
}
[data-theme="dark"] .quick-access-icon-wrap {
    background: rgba(60,60,60,0.7);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="dark"] .qa-add .quick-access-icon-wrap {
    background: rgba(60,60,60,0.5);
    border-color: rgba(255,255,255,0.12);
}
[data-theme="dark"] .qa-add .quick-access-icon-wrap svg {
    color: #777;
}
[data-theme="dark"] .quick-access-name {
    color: #ccc;
}

[data-theme="dark"] .browser-footer {
    color: rgba(255,255,255,0.25);
}
[data-theme="dark"] .browser-footer:hover {
    color: rgba(255,255,255,0.4);
}

[data-theme="dark"] .menu-drawer-panel {
    background: #1e1e1e;
    box-shadow: 2px 0 20px rgba(0,0,0,0.3);
}
[data-theme="dark"] .menu-drawer-header {
    border-color: #333;
    color: #eee;
}
[data-theme="dark"] .menu-drawer-item {
    color: #ddd;
}
[data-theme="dark"] .menu-drawer-item:hover {
    background: #2a2a2a;
}
[data-theme="dark"] .menu-drawer-item svg {
    color: #999;
}

[data-theme="dark"] .nav-back-btn {
    color: #ccc;
}
[data-theme="dark"] .nav-back-btn:hover {
    background: rgba(255,255,255,0.08);
}

/* 快捷方式添加弹窗 */
.qa-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.qa-modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.15);
    animation: scaleIn 0.15s ease;
}

.qa-modal-box h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.qa-modal-box input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.15s;
}
.qa-modal-box input:focus {
    border-color: #4da3d4;
}
.qa-modal-box input::placeholder {
    color: #aaa;
}

.qa-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.qa-modal-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.qa-modal-btn--cancel {
    background: #f0f0f0;
    color: #666;
}
.qa-modal-btn--cancel:hover {
    background: #e4e4e4;
}
.qa-modal-btn--confirm {
    background: #4da3d4;
    color: #fff;
}
.qa-modal-btn--confirm:hover {
    background: #3d93c4;
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .browser-main {
        padding-top: 6vh;
    }
    .browser-logo {
        width: 40px;
        height: 40px;
    }
    .browser-search-input {
        height: 44px;
        font-size: 15px;
    }
    .quick-access-section {
        margin-top: 36px;
        padding: 0 12px;
    }
    .quick-access-grid {
        gap: 0 2px;
    }
    .quick-access-item {
        width: 78px;
        padding: 10px 4px;
        gap: 6px;
    }
    .quick-access-icon-wrap {
        width: 38px;
        height: 38px;
    }
    .quick-access-name {
        font-size: 11px;
        max-width: 64px;
    }
    .menu-drawer-panel {
        width: 260px;
    }
}

/* 手机暗色主题 */
[data-theme="dark"] .qa-modal-box {
    background: #2a2a2a;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
[data-theme="dark"] .qa-modal-box h3 {
    color: #eee;
}
[data-theme="dark"] .qa-modal-box input {
    background: #1e1e1e;
    border-color: #444;
    color: #eee;
}
[data-theme="dark"] .qa-modal-box input::placeholder {
    color: #666;
}
[data-theme="dark"] .qa-modal-btn--cancel {
    background: #3a3a3a;
    color: #ccc;
}
[data-theme="dark"] .qa-modal-btn--cancel:hover {
    background: #444;
}

[data-theme="dark"] .action-btn:hover {
    background: var(--bg-hover);
}

/* 搜索历史面板暗色主题 */
[data-theme="dark"] .side-panel {
    background: var(--bg-secondary);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .side-panel-header {
    border-color: var(--border-color);
}

[data-theme="dark"] .side-panel-header h3 {
    color: var(--text-primary);
}

[data-theme="dark"] .side-panel-icon-btn {
    color: #777;
}

[data-theme="dark"] .side-panel-icon-btn:hover {
    background: var(--bg-hover);
    color: #bbb;
}

[data-theme="dark"] .side-panel-search {
    border-color: var(--border-color);
    color: #777;
}

[data-theme="dark"] .side-panel-search input {
    color: var(--text-primary);
}

[data-theme="dark"] .side-panel-search input::placeholder {
    color: #666;
}

[data-theme="dark"] .history-item:hover {
    background: var(--bg-hover);
}

[data-theme="dark"] .history-item-query {
    color: var(--text-primary);
}

[data-theme="dark"] .history-item-url {
    color: #666;
}

[data-theme="dark"] .history-item-visit .history-item-icon {
    color: #6aafff;
}

[data-theme="dark"] .history-item-time {
    color: #666;
}

[data-theme="dark"] .side-panel-empty {
    color: #666;
}

/* ========== 简洁模式 ========== */
.clean-mode-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 56px);
    height: calc(100dvh - 56px);
    padding: 40px 20px;
    background: #f5f0eb;
    overflow-y: auto;
    min-height: 0;
}

.clean-search-wrapper {
    width: 100%;
    max-width: 800px;
    position: relative;
}

.clean-search-bar {
    width: 100%;
    display: flex;
    align-items: center;
    background: white;
    border: none;
    border-radius: 28px;
    overflow: visible;
    transition: box-shadow .2s;
    height: 52px;
    padding: 0 16px 0 20px;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
}

.clean-search-bar:focus-within {
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
}

.clean-search-bar .search-engine-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    margin-right: 6px;
    opacity: .7;
    transition: opacity .15s;
}

.clean-search-bar .search-engine-btn:hover {
    opacity: 1;
}

.clean-search-bar .search-input {
    flex: 1;
    min-width: 0;
    padding: 12px 0;
    border: none;
    font-size: 16px;
    background: transparent;
    color: #333;
    outline: none;
}

.clean-search-bar .search-input::placeholder {
    color: #bbb;
}

.clean-search-bar .search-submit-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    color: #999;
    padding: 0;
    transition: all .15s;
}

.clean-search-bar .search-submit-btn:hover {
    color: #333;
    background: rgba(0,0,0,.05);
}

.clean-bookmarks-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 16px;
    max-width: 900px;
    width: 100%;
    margin-top: 32px;
    padding: 0 20px;
}

.clean-bookmark-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: transform .15s;
    width: 64px;
    text-decoration: none;
}

.clean-bookmark-item:hover {
    transform: translateY(-2px);
}

.clean-bookmark-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.clean-bookmark-icon img,
.clean-favicon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.clean-icon-char {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    line-height: 1;
    user-select: none;
}

.clean-bookmark-title {
    font-size: 11px;
    color: #888;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.clean-add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: transform .15s;
    width: 64px;
    border: none;
    background: transparent;
}

.clean-add-btn:hover {
    transform: translateY(-2px);
}

.clean-add-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 20px;
    flex-shrink: 0;
    background: #eee;
}

.clean-add-label {
    font-size: 11px;
    color: #888;
}

/* 简洁模式下隐藏导航栏搜索框 */
.clean-mode-active .nav-center {
    display: none !important;
}

/* 暗色主题 */
[data-theme="dark"] .clean-mode-view {
    background: #1a1a1a;
}

[data-theme="dark"] .clean-search-bar {
    background: #2a2a2a;
    box-shadow: 0 2px 16px rgba(0,0,0,.25);
}

[data-theme="dark"] .clean-search-bar:focus-within {
    box-shadow: 0 4px 24px rgba(0,0,0,.35);
}

[data-theme="dark"] .clean-search-icon {
    color: #666;
}

[data-theme="dark"] .clean-search-bar .search-input {
    color: #e0e0e0;
}

[data-theme="dark"] .clean-search-bar .search-input::placeholder {
    color: #666;
}

[data-theme="dark"] .clean-search-bar .search-submit-btn {
    color: #666;
}

[data-theme="dark"] .clean-search-bar .search-submit-btn:hover {
    color: #ccc;
    background: rgba(255,255,255,.08);
}

[data-theme="dark"] .clean-bookmark-icon {
    background: #2a2a2a;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

[data-theme="dark"] .clean-icon-char {
    color: #ccc;
}

[data-theme="dark"] .clean-bookmark-title {
    color: #888;
}

[data-theme="dark"] .clean-add-icon {
    color: #666;
    background: #333;
}

[data-theme="dark"] .clean-add-label {
    color: #888;
}

@media (max-width: 768px) {
    .clean-mode-view {
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
        padding: 20px 12px;
    }
    .clean-search-wrapper {
        max-width: 100%;
    }
    .clean-search-bar {
        height: 44px;
        border-radius: 22px;
        padding: 0 12px 0 16px;
    }
    .clean-search-icon svg {
        width: 16px;
        height: 16px;
    }
    .clean-search-bar .search-engine-btn {
        width: 24px;
        height: 24px;
    }
    .clean-search-bar .search-input {
        font-size: 15px;
    }
    .clean-suggestions-dropdown {
        max-height: 280px;
    }
    .clean-bookmarks-grid {
        flex-wrap: wrap;
        gap: 8px;
        max-width: 300px;
        padding: 0 4px;
        margin-top: 24px;
    }
    .clean-bookmark-item {
        width: 52px;
    }
    .clean-add-btn {
        width: 52px;
    }
    .clean-bookmark-icon {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    .clean-bookmark-icon img,
    .clean-favicon {
        width: 32px;
        height: 32px;
    }
    .clean-bookmark-title {
        font-size: 10px;
        max-width: 52px;
    }
    .clean-add-icon {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    .clean-add-label {
        font-size: 10px;
    }
    .search-engine-picker.clean-picker-mobile {
        left: 8px;
        right: 8px;
        max-height: 60vh;
    }
    .search-engine-picker.clean-picker-mobile .engine-item {
        padding: 10px 8px;
        font-size: 13px;
    }
    .search-engine-picker.clean-picker-mobile .engine-icon {
        width: 22px;
        height: 22px;
    }
}