:root {
    color-scheme: light;
    --bg: #f8f9fb;
    --panel: rgba(255, 255, 255, 0.95);
    --border: rgba(34, 34, 34, 0.08);
    --text: #202124;
    --muted: #5f6368;
    --primary: #1a73e8;
    --shadow: 0 24px 80px rgba(60, 64, 67, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top, #ffffff 0%, #ebf0ff 38%, #f8f9fb 100%);
}

.page-shell {
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    position: relative;
}

.brand-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    position: absolute;
}

.brand-blue { top: 0; left: 0; background: #4285f4; }
.brand-red { top: 0; right: 0; background: #db4437; }
.brand-yellow { bottom: 0; left: 0; background: #f4b400; }
.brand-green { bottom: 0; right: 0; background: #0f9d58; }

.brand-text {
    font-size: 18px;
    font-weight: 700;
}

.profile-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.login-button {
    border: none;
    border-radius: 999px;
    padding: 10px 20px;
    background: linear-gradient(90deg, #3083ff 0%, #1a66d0 100%);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.login-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(26, 102, 208, 0.18);
}

.profile-status {
    font-size: 13px;
    color: var(--muted);
}

.hero-section {
    display: grid;
    place-items: center;
    margin: 36px 0;
}

.hero-card {
    width: min(760px, 100%);
    padding: 48px 36px;
    border-radius: 32px;
    background: var(--panel);
    box-shadow: var(--shadow);
    text-align: center;
}

.hero-title {
    font-size: clamp(34px, 5vw, 56px);
    font-weight: 700;
    margin-bottom: 24px;
}

.search-meta-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search-engine-label {
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
}

.search-engine-selector {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    min-width: 220px;
    cursor: pointer;
    position: relative;
}

.search-engine-selector:hover {
    border-color: rgba(26, 115, 232, 0.35);
}

.search-engine-selected {
    flex: 1;
    font-size: 15px;
    color: var(--text);
}

.search-engine-arrow {
    font-size: 13px;
    color: var(--muted);
}

.search-engine-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(60, 64, 67, 0.12);
    z-index: 10;
    overflow: hidden;
}

.search-engine-option {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.search-engine-option:hover {
    background: rgba(66, 133, 244, 0.08);
}

.search-form {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

.search-input {
    width: min(560px, 100%);
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 17px;
    color: var(--text);
    outline: none;
}

.search-input:focus {
    border-color: rgba(26, 115, 232, 0.45);
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.12);
}

.search-submit {
    min-width: 120px;
    border: none;
    border-radius: 999px;
    padding: 16px 24px;
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.hint-row {
    color: var(--muted);
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.hint-row a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px dashed rgba(34, 34, 34, 0.32);
}

.history-card,
.shortcuts-card,
.oauth-card {
    margin-top: 20px;
    padding: 26px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.history-card-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    border-radius: 22px;
    background: #fff;
    border: 1px solid rgba(34, 34, 34, 0.06);
}

.history-card-item a {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.history-card-item p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.history-card-item .visit-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 18px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.secondary-btn,
.primary-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    cursor: pointer;
}

.secondary-btn {
    background: #f4f6fb;
    color: var(--text);
    border: 1px solid rgba(34, 34, 34, 0.08);
}

.secondary-btn:hover {
    background: #eef3ff;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
}

.shortcut-editor {
    margin-bottom: 16px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(66, 133, 244, 0.08);
    border: 1px dashed rgba(34, 34, 34, 0.15);
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.editor-list {
    display: grid;
    gap: 12px;
}

.shortcut-editor-item {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid rgba(34, 34, 34, 0.07);
}

.editor-field {
    display: grid;
    gap: 6px;
}

.editor-field label {
    font-size: 13px;
    color: var(--muted);
}

.editor-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(34, 34, 34, 0.12);
    border-radius: 10px;
    font-size: 14px;
}

.delete-btn {
    align-self: flex-end;
    border: none;
    background: rgba(255, 70, 70, 0.08);
    color: #c00;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
}

.delete-btn:hover {
    background: rgba(255, 70, 70, 0.16);
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.shortcut-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 18px;
    border-radius: 22px;
    background: #fff;
    border: 1px solid rgba(34, 34, 34, 0.06);
}

.shortcut-card a {
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.shortcut-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.oauth-content {
    display: grid;
    gap: 12px;
    color: var(--muted);
    line-height: 1.75;
}

.oauth-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(26, 115, 232, 0.1);
    color: #1a73e8;
    font-weight: 600;
}

.github-sync-button {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    background: #1a73e8;
    color: #fff;
    cursor: pointer;
    margin-top: 12px;
}

.github-sync-button:hover,
.github-login-button:hover {
    opacity: 0.94;
}

.github-login-button {
    background: #24292e;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

.sync-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .top-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .profile-panel {
        align-items: stretch;
    }
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    .search-submit {
        width: 100%;
    }
    .sync-actions {
        flex-direction: column;
    }
}

/* GitHub 设置模态框样式 */
.github-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.github-settings-content {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow);
}

.github-settings-content h3 {
    margin: 0 0 20px 0;
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}

.setting-field {
    margin-bottom: 20px;
}

.setting-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text);
}

.setting-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.setting-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.setting-field small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.setting-field small a {
    color: var(--primary);
    text-decoration: none;
}

.setting-field small a:hover {
    text-decoration: underline;
}

.setting-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
}
