:root {
    --theme-color: #2780BB;
    --light-bg: rgba(255, 255, 255, 0.85); /* 高级毛玻璃背景 */
    --light-text: #2c3e50;
    --light-border: rgba(224, 224, 224, 0.6);
    --light-btn: rgba(240, 240, 240, 0.8);
    --light-btn-hover: rgba(255, 255, 255, 0.95);
    --dark-bg: rgba(30, 30, 30, 0.85);
    --dark-text: #f0f2f5;
    --dark-border: rgba(80, 80, 80, 0.4);
    --dark-btn: rgba(50, 50, 50, 0.8);
    --dark-btn-hover: rgba(70, 70, 70, 0.95);
    --overlay-light: rgba(255, 255, 255, 0.3);
    --overlay-dark: rgba(0, 0, 0, 0.5);
    --shadow-light: rgba(0, 0, 0, 0.08); /* softer */
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --glass-blur: 16px;
    --radius-xl: 30px;
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

#background-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -3;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-in-out;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    transition: var(--transition);
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 10%;
    /* min-height: 100vh; */
}

.top-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px 0;
    width: 100%;
}

.title-div {
    width: 50%;
}

.title-area {
    display: flex;
    align-items: center;
    height: 44px;
}

#custom-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--theme-color);
    transition: var(--transition);
    cursor: default;
    text-shadow: 0px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

.settings-btn,
.bg-info-btn {
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--theme-color);
    font-size: 1.3rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-left: 0;
    padding: 0;
    aspect-ratio: 1 / 1;
}

.settings-btn:hover,
.bg-info-btn:hover {
    transform: scale(1.08);
}

.bg-info-btn {
    margin-right: 20px;
}

.engine-switcher-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 20px; 
}

.engine-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--theme-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius-xl);
    padding: 0 20px;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
    height: 44px;
    min-width: 80px;
    font-weight: 700;
}

.engine-switcher-btn:hover {
    transform: scale(1.04);
}

.engine-switcher-btn i.fas.fa-caret-down {
    font-size: 1.1em;
    color: #888;
}

.engine-switcher-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    min-width: 120px;
    border-radius: var(--radius-md);
    z-index: 999;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    transition: opacity 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.1);
    will-change: opacity, transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.engine-switcher-dropdown.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
}

.engine-option {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 1.05rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.engine-option.selected {
    font-weight: 600;
}

.engine-option img,
.engine-option i.fas {
    margin-right: 0 !important;
}

.engine-switcher-btn i.fas.fa-caret-down,
.engine-switcher-btn i.fas.fa-caret-up {
    font-size: 1.1em;
    color: var(--theme-color);
    opacity: 0.8;
}

.search-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-grow: 1;
    padding: 15vh 0 0 0; 
}

.search-form {
    width: 100%;
    max-width: 680px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.jump-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 12px; 
    background: var(--theme-color);
    color: var(--theme-text-color);
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    width: fit-content;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 1;
    z-index: 5;
    font-weight: 500;
    will-change: transform, opacity;
}

.jump-bubble.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 15px);
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box:has(.search-history-list.active) .search-input-container {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
    box-shadow: none; /* Remove bottom shadow separating them */
    transition: none; /* Disable transition for border-radius to avoid animation when opening/closing dropdown */
}

.search-box:has(.search-history-list.active) {
    border-radius: var(--radius-xl);
}

.search-input-container {
    width: 100%;
    position: relative;
    z-index: 2;
    background-color: transparent;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Set transition to override border-radius animations but keep other transitions like box-shadow/colors */
    transition: background-color 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.search-input-container:focus-within {
    box-shadow: 0 12px 36px var(--shadow-light);
    /* Remove any transform: translateY to fix the jump */
}

.search-input {
    width: 100%;
    padding: 18px 24px;
    padding-right: 120px;
    border-radius: var(--radius-xl);
    border: none;
    font-size: 1.1rem;
    transition: var(--transition);
    outline: none;
    cursor: text;
    background: transparent;
    z-index: 3;
}

.search-input::placeholder {
    opacity: 0.7;
}

.search-history-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    z-index: 1;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    padding-bottom: 10px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.1);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.search-history-list.active {
    display: block;
}
.search-history-list div {
    padding: 12px 24px;
    cursor: pointer;
    font-size: 1.05rem;
    transition: background-color 0.2s;
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--theme-color);
    color: var(--theme-text-color);
    border: none;
    border-radius: var(--radius-xl);
    padding: 12px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    height: 44px;
    font-size: 1.05rem;
    font-weight: 600;
    margin-left: 0;
    z-index: 4;
}

.search-btn:hover {
    transform: translateY(-50%) scale(1.03);
    opacity: 0.95;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.search-btn-text {
    display: inline;
}

@media (max-width: 480px) {
    .search-btn-text {
        display: none;
    }

    .search-input {
        padding-right: 80px;
    }

    .search-btn {
        padding: 10px 16px;
        height: 38px;
        right: 6px;
    }
}

.quick-links-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 40px;
    padding: 20px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 95px; /* Increased from 90px to prevent text clipping */
    text-decoration: none;
    transition: var(--transition);
    border-radius: var(--radius-lg);
    padding: 10px 15px; /* Reduced vertical padding */
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.15);
    will-change: transform, border-color, box-shadow;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.quick-link-icon-container {
    font-size: 1.8rem;
    margin-bottom: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-link-favicon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12%;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.quick-link-default-icon {
    color: var(--theme-color);
}

.quick-link-text {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.2; /* Ensures text has enough space and doesn't get cut vertically */
    padding-bottom: 2px; /* Prevent descender clipping */
    transition: var(--transition);
}

.quick-link:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 设置面板样式 */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-dark);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
    visibility: hidden;
    will-change: opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    pointer-events: none;
}

.settings-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.settings-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 100%;
    max-width: 480px;
    height: calc(100% - 40px);
    /* We'll use JS to adjust bg or handle via light/dark root */
    background-color: var(--light-bg); 
    color: var(--light-text);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    z-index: 101;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    visibility: hidden;
    pointer-events: none;
}

.settings-panel.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

.settings-header {
    padding: 20px 24px 0 24px;
    border-bottom: 1px solid var(--light-border);
    display: flex;
    flex-direction: column;
}

.settings-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.settings-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.settings-tabs {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.settings-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tab-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    font-size: 1rem;
    font-weight: 600;
    padding: 10px 4px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover {
    opacity: 0.9;
}

.tab-btn.active {
    opacity: 1;
    color: var(--theme-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--theme-color);
    border-radius: 3px;
    z-index: 1;
}

.close-settings {
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.5rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

.close-settings:hover {
    background-color: var(--light-btn-hover);
    transform: rotate(90deg);
}

.settings-content {
    padding: 30px;
    overflow-y: auto;
    flex-grow: 1;
}

.settings-tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-section {
    margin-bottom: 35px;
}

.settings-section h3 {
    margin-bottom: 20px;
    font-size: 1.15rem;
    font-weight: 600;
}

.setting-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 20px;
    padding: 0;
}

.setting-label {
    font-size: 1rem;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.block-label {
    display: block;
    margin-bottom: 12px;
}

.text-input,
.settings-select {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--light-border);
    width: 240px;
    font-size: 1rem;
    color: inherit;
    background-color: rgba(255,255,255,0.5);
    transition: var(--transition);
}

.settings-dropdown-container {
    position: relative;
    width: 240px;
    margin-bottom: 5px;
}

.settings-select {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.color-picker {
    width: 44px;
    height: 44px;
    border: none;
    cursor: pointer;
    padding: 0;
    background: none;
    border-radius: 50%;
    overflow: hidden;
    -webkit-appearance: none;
    appearance: none;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.color-picker::-moz-color-swatch {
    border: none;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

.color-hex-label {
    font-family: inherit;
    font-size: 1.05rem;
    color: var(--light-text);
    background: rgba(255,255,255,0.5);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--light-border);
}

.dark-mode .color-hex-label {
    color: var(--dark-text);
    background: rgba(0,0,0,0.5);
    border-color: var(--dark-border);
}

.theme-color-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius-xl);
    transition: var(--transition);
    background-color: var(--light-btn);
}

.radio-item:hover {
    transform: translateY(-2px);
}

.radio-item input {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--light-border);
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    cursor: pointer;
    background-color: transparent;
    transition: var(--transition);
}

.radio-item input:checked {
    border-color: var(--theme-color);
    background-color: transparent;
    border-width: 2px;
}

.radio-item input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--theme-color);
}

.radio-item input:checked+span {
    font-weight: 600;
}

/* 开关样式 - iOS风格 */
.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 34px;
    transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    border-radius: 50%;
    transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked+.slider:before {
    transform: translateX(26px);
    background-color: var(--theme-text-color) !important;
}

input:checked+.slider {
    background-color: var(--theme-color);
}

/* 图片上传样式 */
.image-upload-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
}

.image-upload-btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.image-upload {
    display: none;
}

.image-preview-container {
    margin-top: 10px;
    width: 100%;
}

.preview-label {
    margin-top: -16px;
    margin-bottom: 8px;
    display: block;
    font-size: 0.95rem;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 快速链接编辑器 */
.quick-links-editor {
    margin-top: 15px;
    padding: 20px;
    border-radius: var(--radius-md);
    transition: var(--transition);
    border: 1px solid rgba(120, 120, 120, 0.1);
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    width: 100%;
}

.link-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border: 1px solid rgba(120, 120, 120, 0.1);
    width: 100%;
    box-sizing: border-box;
}

.link-item-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.link-item input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    transition: var(--transition);
}

.link-item-actions {
    display: flex;
    justify-content: flex-end;
}

.delete-link-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #ff4d4d;
    color: white;
}

.delete-link-btn:hover {
    background-color: #ff3333;
    transform: translateY(-1px);
}

.add-link-btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    background-color: var(--theme-color);
    color: var(--theme-text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    margin-left: auto;
    font-weight: 500;
}

.add-link-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}


/* 导入导出样式 */
.import-export-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reset-btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background-color: #ff4d4d;
    color: white;
    font-weight: 500;
}

.reset-btn:hover {
    background-color: #ff3333;
    transform: translateY(-2px);
}

.import-btn,
.export-btn,
.clear-history-btn,
.sort-btn-up,
.sort-btn-down {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    font-weight: 500;
}

.sort-btn-up,
.sort-btn-down {
    margin-right: 5px;
    padding: 8px 12px;
}

.import-input {
    display: none;
}

.import-filename {
    font-size: 0.9rem;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}

/* 透明度控制 */
.opacity-control {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 240px;
}

.opacity-slider {
    flex-grow: 1;
    accent-color: var(--theme-color);
    cursor: pointer;
}

.opacity-value {
    width: 44px;
    text-align: center;
    font-weight: 600;
}

.opacity-labels {
    display: flex;
    justify-content: space-between;
    width: 240px;
    margin-top: 8px;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* 设置页脚 */
.settings-footer {
    width: 100%;
    box-sizing: border-box;
    padding: 24px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid var(--light-border);
}

.history-actions {
    display: flex;
    gap: 12px;
}

.history-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    border: none;
    background-color: var(--light-btn);
    color: var(--light-text);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-btn:hover:not(:disabled) {
    background-color: var(--light-btn-hover);
    color: var(--theme-color);
    transform: translateY(-2px);
}

.history-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.apply-settings-btn,
.reset-btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
    height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.apply-settings-btn {
    background-color: var(--theme-color);
    color: var(--theme-text-color);
}

.apply-settings-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.about-link-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border: none;
    outline: none;
    font-weight: 500;
    color: var(--theme-color);
    transition: var(--transition);
}

.about-link-btn:hover {
    opacity: 0.8;
}

/* 提示框样式 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 28px;
    border-radius: var(--radius-xl);
    color: var(--theme-text-color);
    background-color: var(--theme-color);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1002;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    font-size: 1.05rem;
    font-weight: 500;
    opacity: 0;
}

.toast:not(.hidden) {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 分割线 */
.section-divider {
    border: none;
    height: 1px;
    margin: 25px 0;
    transition: var(--transition);
}

/* 工具类 */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* 浅色模式 */
.light-mode {
    background-color: transparent;
    color: var(--light-text);
}

.light-mode .engine-switcher-btn,
.light-mode .settings-btn,
.light-mode .bg-info-btn {
    background: var(--light-btn);
    color: var(--theme-color);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.light-mode .engine-switcher-btn:hover,
.light-mode .settings-btn:hover,
.light-mode .bg-info-btn:hover {
    background: var(--light-btn-hover);
}

.light-mode .engine-switcher-dropdown {
    background: rgba(255, 255, 255, 0.85); /* modernized */
    box-shadow: 0 8px 32px var(--shadow-light);
}

.light-mode .engine-option {
    color: var(--light-text);
}

.light-mode .engine-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.light-mode .settings-panel {
    background-color: rgba(255, 255, 255, 0.85);
    color: var(--light-text);
}

.light-mode .settings-header {
    border-bottom-color: var(--light-border);
}

.light-mode .close-settings {
    color: var(--light-text);
}

.light-mode .close-settings:hover {
    color: var(--theme-color);
}

.light-mode .settings-footer {
    border-top: 1px solid var(--light-border);
}

.light-mode .text-input,
.light-mode .settings-select,
.light-mode .image-preview {
    border-color: var(--light-border);
    background-color: rgba(255,255,255,0.5);
    color: var(--light-text);
}

.light-mode .radio-item {
    background-color: var(--light-btn);
}

.light-mode .radio-item:hover {
    background-color: var(--light-btn-hover);
}

.light-mode .slider {
    background-color: #d1d5db;
}

.light-mode .slider:before {
    background-color: white;
}

.light-mode .image-upload-btn,
.light-mode .import-btn,
.light-mode .export-btn,
.light-mode .clear-history-btn,
.light-mode .sort-btn-up,
.light-mode .sort-btn-down {
    background-color: var(--light-btn);
    color: var(--light-text);
}

.light-mode .image-upload-btn:hover,
.light-mode .import-btn:hover,
.light-mode .export-btn:hover,
.light-mode .clear-history-btn:hover,
.light-mode .sort-btn-up:hover,
.light-mode .sort-btn-down:hover {
    background-color: var(--light-btn-hover);
}

.light-mode .quick-links-editor {
    background-color: rgba(255, 255, 255, 0.6);
}

.light-mode .link-item {
    background-color: rgba(255, 255, 255, 0.8);
}

.light-mode .link-item input {
    background-color: transparent;
    border-color: var(--light-border);
    color: var(--light-text);
}

.light-mode .quick-link {
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--light-text);
    box-shadow: 0 8px 32px var(--shadow-light);
}

.light-mode .quick-link-icon {
    color: var(--theme-color);
}

.light-mode .search-input {
    background-color: transparent;
    color: var(--light-text);
}

.light-mode .search-input-container {
    background-color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.4);
}

.light-mode .search-input-container:focus-within {
    background-color: rgba(255, 255, 255, 0.7); /* Keep original transparent feel */
}

.light-mode .section-divider {
    background-color: var(--light-border);
}

.light-mode .search-history-list {
    background-color: rgba(255, 255, 255, 0.7); /* Match input */
    border-color: rgba(255, 255, 255, 0.4);
}

.light-mode .search-history-list div:hover {
    background: rgba(0, 0, 0, 0.05); /* clean hover */
}

.light-mode .settings-footer {
    border-top: 1px solid var(--light-border);
}

.light-mode .about-link-btn {
    color: var(--theme-color);
}

/* 深色模式 */
.dark-mode {
    background-color: transparent;
    color: var(--dark-text);
}

.dark-mode .engine-switcher-btn,
.dark-mode .settings-btn,
.dark-mode .bg-info-btn {
    background: var(--dark-btn);
    color: var(--theme-color);
    box-shadow: 0 4px 12px var(--shadow-dark);
}

.dark-mode .engine-switcher-btn:hover,
.dark-mode .settings-btn:hover,
.dark-mode .bg-info-btn:hover {
    background: var(--dark-btn-hover);
}

.dark-mode .engine-switcher-dropdown {
    background: rgba(30, 30, 30, 0.85); /* modernized */
    box-shadow: 0 8px 32px var(--shadow-dark);
}

.dark-mode .engine-option {
    color: var(--dark-text);
}

.dark-mode .engine-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode .settings-panel {
    background-color: rgba(30, 30, 30, 0.85);
    color: var(--dark-text);
}

.dark-mode .settings-header {
    border-bottom-color: var(--dark-border);
}

.dark-mode .close-settings {
    color: var(--dark-text);
}

.dark-mode .close-settings:hover {
    color: var(--theme-color);
    background-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .settings-footer {
    border-top: 1px solid var(--dark-border);
    background: rgba(255,255,255,0.02);
}

.dark-mode .text-input,
.dark-mode .settings-select,
.dark-mode .image-preview {
    border-color: var(--dark-border);
    background-color: rgba(0,0,0,0.5);
    color: var(--dark-text);
}

.dark-mode .radio-item {
    background-color: var(--dark-btn);
}

.dark-mode .radio-item:hover {
    background-color: var(--dark-btn-hover);
}

.dark-mode .radio-item input {
    border-color: #666;
    background-color: var(--dark-btn);
}

.dark-mode .slider {
    background-color: #555;
}

.dark-mode .slider:before {
    background-color: white;
}

.dark-mode .image-upload-btn,
.dark-mode .import-btn,
.dark-mode .export-btn,
.dark-mode .clear-history-btn,
.dark-mode .sort-btn-up,
.dark-mode .sort-btn-down {
    background-color: var(--dark-btn);
    color: var(--dark-text);
}

.dark-mode .image-upload-btn:hover,
.dark-mode .import-btn:hover,
.dark-mode .export-btn:hover,
.dark-mode .clear-history-btn:hover,
.dark-mode .sort-btn-up:hover,
.dark-mode .sort-btn-down:hover {
    background-color: var(--dark-btn-hover);
}

.dark-mode .quick-links-editor {
    background-color: rgba(20, 20, 20, 0.6);
}

.dark-mode .link-item {
    background-color: rgba(40, 40, 40, 0.8);
}

.dark-mode .link-item input {
    background-color: transparent;
    border-color: var(--dark-border);
    color: var(--dark-text);
}

.dark-mode .quick-link {
    background-color: rgba(20, 20, 20, 0.7);
    color: var(--dark-text);
    box-shadow: 0 8px 32px var(--shadow-dark);
}

.dark-mode .quick-link-icon {
    color: var(--theme-color);
}

.dark-mode .search-input {
    background-color: transparent;
    color: var(--dark-text);
}

.dark-mode .search-input-container {
    background-color: rgba(20, 20, 20, 0.7);
    border-color: rgba(80, 80, 80, 0.3);
}

.dark-mode .search-input-container:focus-within {
    background-color: rgba(20, 20, 20, 0.7); /* Keep original transparent feel */
}

.dark-mode .section-divider {
    background-color: var(--dark-border);
}

.dark-mode .search-history-list {
    background-color: rgba(20, 20, 20, 0.7); /* Match input */
    border-color: rgba(80, 80, 80, 0.3);
}

.dark-mode .search-history-list div:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dark-mode .settings-footer {
    border-top: 1px solid var(--dark-border);
}

.dark-mode .history-btn {
    background-color: var(--dark-btn);
    color: var(--dark-text);
}

.dark-mode .history-btn:hover:not(:disabled) {
    background-color: var(--dark-btn-hover);
    color: var(--theme-color);
}

.dark-mode .about-link-btn {
    color: var(--theme-color);
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    border-radius: 6px;
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background-color: rgba(150, 150, 150, 0.3);
}
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(150, 150, 150, 0.6);
}

.dark-mode ::-webkit-scrollbar-thumb {
    background-color: rgba(100, 100, 100, 0.3);
}
.dark-mode ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(100, 100, 100, 0.6);
}

/* 自定义模态框样式 */
.custom-modal {
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.custom-modal.hidden {
    display: none !important;
}

.custom-modal.is-closing {
    opacity: 0;
}

.custom-modal.is-closing .custom-modal-dialog {
    animation: modalPopOut 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.custom-modal-mask {
    position: absolute;
    left: 0; top: 0; right: 0; bottom: 0;
    background: var(--overlay-dark);
    z-index: 1;
}

.custom-modal-dialog {
    position: relative;
    z-index: 2;
    border-radius: var(--radius-lg);
    min-width: 320px;
    max-width: 90vw;
    padding: 0;
    animation: modalPop 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.1);
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

@keyframes modalPop {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes modalPopOut {
    from { transform: scale(1) translateY(0); opacity: 1; }
    to   { transform: scale(0.9) translateY(20px); opacity: 0; }
}

.custom-modal-content {
    padding: 30px 24px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.custom-modal-message {
    font-size: 1.1rem;
    color: var(--light-text);
    margin-bottom: 24px;
    text-align: center;
    word-break: break-all;
    line-height: 1.5;
}

.custom-modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
}

.custom-modal-btn {
    min-width: 90px;
    padding: 10px 0;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.custom-modal-btn.ok {
    background: var(--theme-color);
    color: var(--theme-text-color);
}

.custom-modal-btn.ok:hover,
.custom-modal-btn.cancel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.light-mode .custom-modal-dialog {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 12px 48px var(--shadow-light);
}

.light-mode .custom-modal-message {
    color: var(--light-text);
}

.light-mode .custom-modal-btn.cancel {
    background: var(--light-btn);
    color: var(--light-text);
}

.dark-mode .custom-modal-dialog {
    background: rgba(30, 30, 30, 0.85);
    box-shadow: 0 12px 48px var(--shadow-dark);
}

.dark-mode .custom-modal-message {
    color: var(--dark-text);
}

.dark-mode .custom-modal-btn.cancel {
    background: var(--dark-btn);
    color: var(--dark-text);
}