/**
 * /search：三栏布局（Logo | 主区 | 侧栏）；落地态主区内搜索与推荐居中；SERP 主区铺满。
 */

.ds-srp {
    /* SERP：左侧列宽 = 图标边长 × 倍数（可与 --ds-serp-logo-size 一起调） */
    --ds-serp-logo-size: 40px;
    --ds-logo-col-serp-multiplier: 1.5;
    --ds-logo-col-serp: calc(var(--ds-serp-logo-size) * var(--ds-logo-col-serp-multiplier));
    --ds-side: minmax(260px, 300px);
    --ds-main-max: 720px;
    --ds-layout-max: 1600px;
    --ds-url: #202124;
    --ds-title: #1a0dab;
    --ds-snippet: #4d5156;
    --ds-field-inner-bg: var(--card, #fff);
    --ds-field-shadow: rgba(32, 33, 36, 0.22);
    --ds-pagination-active-bg: #4285f4;
    --ds-grad-a: rgba(26, 115, 232, 0.42);
    --ds-grad-b: rgba(147, 51, 234, 0.28);
    --ds-grad-c: rgba(5, 150, 105, 0.32);
}

[data-theme="dark"] .ds-srp {
    --ds-url: #81c995;
    --ds-title: #8ab4f8;
    --ds-snippet: #bdc1c6;
    --ds-field-shadow: rgba(0, 0, 0, 0.45);
    --ds-pagination-active-bg: #8ab4f6;
    --ds-grad-a: rgba(138, 180, 248, 0.45);
    --ds-grad-b: rgba(167, 139, 250, 0.32);
    --ds-grad-c: rgba(52, 211, 153, 0.35);
}

[data-theme="warm"] .ds-srp {
    --ds-url: #166534;
    --ds-title: #9a3412;
    --ds-snippet: #57534e;
    --ds-pagination-active-bg: #c2410c;
    --ds-grad-a: rgba(194, 65, 12, 0.4);
    --ds-grad-b: rgba(180, 83, 9, 0.28);
    --ds-grad-c: rgba(22, 101, 52, 0.3);
}

[data-theme="ocean"] .ds-srp {
    --ds-url: #69f0ae;
    --ds-title: #90caf9;
    --ds-snippet: #b0bec5;
    --ds-pagination-active-bg: #29b6f6;
    --ds-grad-a: rgba(41, 182, 246, 0.45);
    --ds-grad-b: rgba(129, 199, 132, 0.3);
    --ds-grad-c: rgba(171, 71, 188, 0.28);
}

.ds-shell {
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

.ds-layout {
    display: grid;
    gap: 28px 36px;
    margin: 0;
    box-sizing: border-box;
    width: 100%;
    flex: 1;
    align-items: start;
}

.ds-mode-landing .ds-layout {
    grid-template-columns: minmax(0, 1fr) var(--ds-side);
}

.ds-mode-serp .ds-layout {
    grid-template-columns: var(--ds-logo-col-serp) minmax(0, 1fr) var(--ds-side);
    column-gap: 0;
    row-gap: 28px;
}

/* 内容列与侧栏间距 25px；与 logo 列无水平间距 */
.ds-mode-serp .ds-col-main {
    margin-right: 25px;
}

/* 落地：无左侧 logo 列（logo 在主区内搜索框上方） */
.ds-mode-landing .ds-col-logo {
    display: none !important;
}

/* —— Logo 列（仅 SERP） —— */
.ds-col-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* 与 .ds-serp-sticky 首行高度（约 12+48+14）对齐，使 logo 与输入条垂直居中一致 */
.ds-mode-serp .ds-col-logo {
    position: sticky;
    top: 0;
    z-index: 19;
    min-height: 74px;
    justify-content: center;
}

.ds-logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 0;
    border-radius: 16px;
    overflow: hidden;
}

.ds-logo-mark--compact img {
    width: var(--ds-serp-logo-size);
    height: var(--ds-serp-logo-size);
    object-fit: contain;
    border-radius: 10px;
}

.ds-logo-mark--compact .ds-landing-logo-fallback {
    font-size: 1rem;
    width: var(--ds-serp-logo-size);
    height: var(--ds-serp-logo-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* —— 落地：搜索框上方的居中 Logo —— */
.ds-landing-logo-above {
    display: block;
    text-decoration: none;
    line-height: 0;
    border-radius: 18px;
    overflow: hidden;
}

.ds-landing-logo-above img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    border-radius: 18px;
}

.ds-landing-logo-above .ds-landing-logo-fallback {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.04em;
}

/* —— 主列 —— */
.ds-col-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ds-mode-landing .ds-landing-zone {
    display: flex;
}

.ds-mode-landing .ds-serp-zone {
    display: none !important;
}

.ds-mode-serp .ds-landing-zone {
    display: none !important;
}

.ds-mode-serp .ds-serp-zone {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* 落地：主列内整体垂直居中 */
.ds-landing-zone {
    flex: 1;
    min-height: calc(100vh - 56px - 80px);
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    box-sizing: border-box;
}

.ds-landing-stack {
    width: 100%;
    max-width: var(--ds-main-max);
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.ds-landing-stack .banner {
    max-width: none;
    width: 100%;
    text-align: left;
}

.ds-landing-stack #ds-landing-form-root {
    width: 100%;
}

/* 渐变描边 + 圆角输入条 */
.ds-google-form {
    width: 100%;
    max-width: none;
    margin: 0;
}

.ds-google-field-grad {
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(125deg, var(--ds-grad-a), var(--ds-grad-b) 45%, var(--ds-grad-c));
    box-sizing: border-box;
    width: 100%;
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

.ds-google-field-grad:focus-within {
    box-shadow: 0 2px 12px var(--ds-field-shadow);
    filter: saturate(1.08);
}

.ds-google-field {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: 11px;
    background: var(--ds-field-inner-bg);
    padding: 0 8px 0 16px;
    box-sizing: border-box;
    transition: box-shadow 0.15s ease;
}

.ds-google-field:hover {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .ds-google-field:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.ds-google-field:focus-within {
    box-shadow: inset 0 0 0 1px var(--primary);
}

.ds-google-field input[type="search"],
.ds-google-field input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    padding: 10px 8px 10px 0;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.ds-google-field input::-webkit-search-decoration,
.ds-google-field input::-webkit-search-cancel-button {
    display: none;
}

.ds-google-search-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease;
}

.ds-google-search-btn:hover {
    background: rgba(66, 133, 244, 0.12);
}

[data-theme="dark"] .ds-google-search-btn:hover {
    background: rgba(138, 180, 248, 0.16);
}

.ds-google-search-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ds-google-search-btn svg {
    width: 22px;
    height: 22px;
}

/* —— SERP 顶栏（仅搜索框） —— */
.ds-serp-zone .ds-serp-sticky {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--card, #fff);
    border-bottom: 1px solid var(--border);
    padding: 12px 0 14px;
    margin: 0 0 4px 0;
}

[data-theme="dark"] .ds-serp-zone .ds-serp-sticky {
    background: var(--bg);
}

#ds-serp-form-root {
    min-width: 0;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.ds-serp-main-body {
    padding-top: 12px;
    width: 100%;
}

/* —— 落地：3×3 推荐标题（仅标题，点击即搜索） —— */
.ds-spotlight-main-wrap {
    width: 100%;
}

.ds-spotlight-section-title {
    margin: 0 0 12px 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    width: 100%;
    text-align: center;
}

.ds-spotlight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
    width: 100%;
}

.ds-spot-cell {
    margin: 0;
    padding: 10px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--ds-title);
    font-size: 0.8125rem;
    font-weight: 400;
    font-family: inherit;
    line-height: 1.35;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, border-color 0.12s ease;
    word-break: break-word;
    hyphens: auto;
}

.ds-spot-cell:hover {
    border-color: var(--primary);
    background: rgba(66, 133, 244, 0.06);
}

[data-theme="dark"] .ds-spot-cell:hover {
    background: rgba(138, 180, 248, 0.1);
}

.ds-spotlight-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ds-spotlight-list--aside .ds-spot-item {
    margin-bottom: 10px;
}

.ds-spotlight-list--aside .ds-spot-item a {
    font-size: 0.8125rem;
    color: var(--primary);
    text-decoration: none;
    line-height: 1.4;
    display: block;
}

.ds-spotlight-list--aside .ds-spot-item a:hover {
    text-decoration: underline;
}

.ds-spotlight-list--aside .ds-spot-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* —— 侧栏 —— */
.ds-col-aside {
    position: sticky;
    top: 24px;
    min-width: 0;
    margin-right: 10px;
    margin-top: 10px;
}

.ds-mode-serp .ds-col-aside {
    top: 68px;
}

.ds-srp-primary {
    width: 100%;
    max-width: none;
    min-width: 0;
}

.ds-srp-stats {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    min-height: 1.25em;
}

.ds-kind-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.ds-kind-row button {
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    font-family: inherit;
}

.ds-kind-row button:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .ds-kind-row button:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ds-kind-row button.on {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
    background: rgba(66, 133, 244, 0.08);
}

.ds-hit {
    margin-bottom: 26px;
    max-width: none;
}

.ds-hit-title {
    margin: 0 0 6px 0;
    padding: 0;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.3;
}

.ds-hit-title a {
    color: var(--ds-title);
    text-decoration: none;
}

.ds-hit-title a:hover {
    text-decoration: underline;
}

.ds-hit-title a:visited {
    color: #681da8;
}

[data-theme="dark"] .ds-hit-title a:visited {
    color: #c58af9;
}

/* 标题内高亮需盖过链接色 */
.ds-hit-title a .ds-hit-highlight {
    color: #c00;
    font-weight: 600;
}

[data-theme="dark"] .ds-hit-title a .ds-hit-highlight {
    color: #f87171;
}

[data-theme="warm"] .ds-hit-title a .ds-hit-highlight {
    color: #b91c1c;
}

[data-theme="ocean"] .ds-hit-title a .ds-hit-highlight {
    color: #ff5252;
}

.ds-hit-snippet {
    font-size: 0.875rem;
    line-height: 1.58;
    color: var(--ds-snippet);
    margin-top: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ds-hit-highlight {
    color: #c00;
    background: transparent;
    font-weight: 600;
    padding: 0 1px;
}

[data-theme="dark"] .ds-hit-highlight {
    color: #f87171;
}

[data-theme="warm"] .ds-hit-highlight {
    color: #b91c1c;
}

[data-theme="ocean"] .ds-hit-highlight {
    color: #ff5252;
}

/* 摘要下方的可点击链接行 */
.ds-hit-linkrow {
    margin-top: 8px;
    font-size: 0.875rem;
    line-height: 1.35;
    word-break: break-all;
}

.ds-hit-linkrow a.ds-hit-link {
    color: var(--ds-url);
    text-decoration: none;
}

.ds-hit-linkrow a.ds-hit-link:hover {
    text-decoration: underline;
}

.ds-hit-more {
    margin-top: 6px;
    font-size: 0.8125rem;
}

.ds-hit-more a {
    color: var(--ds-title);
    text-decoration: none;
}

.ds-hit-more a:hover {
    text-decoration: underline;
}

.ds-empty,
.ds-err {
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 12px 0 20px;
    max-width: none;
}

.ds-err {
    color: #b91c1c;
}

[data-theme="dark"] .ds-err {
    color: #fca5a5;
}

.ds-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 2px;
    margin-top: 28px;
    padding-top: 15px;
    padding-bottom: 15px;
    border-top: 1px solid var(--border);
    user-select: none;
    max-width: none;
}

.ds-pagination a,
.ds-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    font-size: 0.8125rem;
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary);
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: inherit;
}

.ds-pagination a:hover {
    background: rgba(66, 133, 244, 0.08);
}

.ds-pagination span.ds-pg-current {
    color: #fff;
    background: var(--ds-pagination-active-bg);
    font-weight: 600;
    cursor: default;
}

.ds-pagination span.ds-pg-ellipsis {
    min-width: 24px;
    color: var(--text-muted);
    cursor: default;
}

.ds-pagination span.ds-pg-disabled {
    color: var(--text-muted);
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.ds-aside-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

.ds-aside-card h2 {
    margin: 0 0 10px 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}

.ds-aside-card ul:not(.ds-spotlight-list) {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-aside-card li {
    margin-bottom: 8px;
}

.ds-aside-card a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
}

.ds-aside-card a:hover {
    text-decoration: underline;
}

.ds-srp-footer {
    margin-top: auto;
    padding: 20px max(16px, env(safe-area-inset-left)) 32px max(16px, env(safe-area-inset-right));
    border-top: 1px solid var(--border);
    background: var(--card);
}

.ds-srp-footer-inner {
    max-width: var(--ds-layout-max);
    margin: 0 auto;
}

.ds-footer-brand {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 6px;
}

.ds-footer-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 14px 0;
    max-width: 560px;
}

.ds-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 12px;
}

.ds-footer-links a {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
}

.ds-footer-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.ds-footer-legal {
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.ds-footer-legal a {
    color: var(--text-muted);
    text-decoration: none;
}

.ds-footer-legal a:hover {
    text-decoration: underline;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 1040px) {
    .ds-mode-landing .ds-layout,
    .ds-mode-serp .ds-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ds-col-logo {
        justify-content: center;
    }

    .ds-mode-serp .ds-col-logo {
        display: none;
    }

    .ds-col-aside {
        position: static;
        order: 3;
    }

    .ds-col-main {
        order: 2;
    }

    .ds-col-logo {
        order: 1;
    }

    .ds-mode-serp .ds-col-main {
        margin-right: 0;
    }

    #ds-serp-form-root {
        max-width: none;
    }

    .ds-spot-cell {
        font-size: 0.75rem;
        padding: 8px 4px;
        min-height: 40px;
    }
}
