/* Hybrid 1 搜索 — 与 docs/design-mockups/proto-hybrid-1-efficiency.html 定稿一致（作用域 #h1-mod） */

/* 横向边距由外层 .content-site 与下方 #content 一致 */
#h1-mod {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.io-grey-mode #h1-mod {
    --h1-label: #1d1d1f;
    --h1-secondary: rgba(60, 60, 67, 0.6);
    --h1-sep: rgba(60, 60, 67, 0.18);
    --h1-fill: rgba(120, 120, 128, 0.12);
    --h1-blue: #007aff;
    --h1-card-bg: #ffffff;
    --h1-input-bg: rgba(255, 255, 255, 0.92);
    --h1-shadow: 0 1px 0 rgba(0, 0, 0, 0.03), 0 14px 40px rgba(0, 0, 0, 0.06);
    /* grouped secondarySystemGroupedBackground 台面：与页面 #f5f5f7 略分层，托起白卡片 */
    --h1-grouped-surface: #ebebf0;
    --h1-grouped-edge: rgba(60, 60, 67, 0.1);
    --h1-grouped-divider: rgba(60, 60, 67, 0.12);
}

.io-black-mode #h1-mod {
    --h1-label: rgba(255, 255, 255, 0.92);
    --h1-secondary: rgba(235, 235, 245, 0.6);
    --h1-sep: rgba(84, 84, 88, 0.65);
    --h1-fill: rgba(120, 120, 128, 0.24);
    --h1-blue: #0a84ff;
    --h1-card-bg: #1c1c1e;
    --h1-input-bg: rgba(44, 44, 46, 0.9);
    --h1-shadow: none;
    --h1-grouped-surface: #141414;
    --h1-grouped-edge: rgba(84, 84, 88, 0.38);
    --h1-grouped-divider: rgba(84, 84, 88, 0.42);
}

/*
 * 站内索引页：搜索控件 + 本地结果共用 grouped 台面（Apple Settings 式分段），
 * 与下方 #content 目录白卡片在同页底色上形成层次。
 */
#h1-mod .h1-task-surface {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0 0 22px;
    padding: 14px;
    border-radius: 22px;
    background: var(--h1-grouped-surface);
    border: 1px solid var(--h1-grouped-edge);
}

/* 定稿 searchCard：白底卡片 + 圆角 + 阴影 */
#h1-mod .searchCard {
    background: var(--h1-card-bg);
    border: 1px solid var(--h1-sep);
    border-radius: 18px;
    box-shadow: var(--h1-shadow);
    padding: 16px;
    color: var(--h1-label);
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
}

#h1-mod .h1-search-form {
    display: contents;
}

#h1-mod .h1-feature-locked {
    opacity: 0.48;
    pointer-events: none;
    user-select: none;
}

#h1-mod .h1-cap-hint-link {
    font-weight: 500;
    white-space: nowrap;
}

#h1-mod .h1-top-row {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 12px;
    align-items: center;
}

#h1-mod .h1-top-row--no-cat {
    grid-template-columns: 1fr auto;
}

#h1-mod .h1-input-col {
    position: relative;
    min-width: 0;
}

#h1-mod .h1-input-ico {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    opacity: 0.55;
    pointer-events: none;
    color: var(--h1-secondary);
}

#h1-mod .h1-q {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--h1-sep);
    background: var(--h1-input-bg);
    padding: 0 14px 0 40px;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--h1-label);
    outline: none;
    box-sizing: border-box;
}

.io-grey-mode #h1-mod .h1-q::placeholder {
    color: rgba(60, 60, 67, 0.42);
}
.io-black-mode #h1-mod .h1-q::placeholder {
    color: rgba(235, 235, 245, 0.38);
}

.io-grey-mode #h1-mod .h1-q:focus {
    border-color: rgba(0, 122, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.18);
}
.io-black-mode #h1-mod .h1-q:focus {
    border-color: rgba(10, 132, 255, 0.55);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.22);
}

#h1-mod .scope {
    position: relative;
}

#h1-mod .h1-cat {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--h1-sep);
    background: var(--h1-input-bg);
    padding: 0 38px 0 14px;
    font-size: 14px;
    letter-spacing: -0.01em;
    color: var(--h1-label);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

#h1-mod .scope .caret {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.55;
    pointer-events: none;
    font-size: 12px;
}

#h1-mod .advBtn {
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--h1-sep);
    background: var(--h1-fill);
    color: var(--h1-label);
    font-size: 13px;
    letter-spacing: -0.01em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    box-sizing: border-box;
}

#h1-mod .advBtn:hover {
    filter: brightness(0.98);
}
#h1-mod .advBtn:active {
    transform: scale(0.99);
}

/* iOS/macOS 风格分段控件：轨道沿用 advBtn 的描边与填充感 */
#h1-mod .h1-segmented {
    display: flex;
    align-items: stretch;
    height: 44px;
    padding: 3px;
    gap: 2px;
    border-radius: 12px;
    border: 1px solid var(--h1-sep);
    background: var(--h1-fill);
    box-sizing: border-box;
    min-width: 0;
}

#h1-mod .h1-seg-btn {
    flex: 1;
    min-width: 72px;
    margin: 0;
    padding: 0 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--h1-label);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

#h1-mod .h1-seg-btn:hover {
    filter: brightness(0.98);
}

#h1-mod .h1-seg-btn:active {
    transform: scale(0.98);
}

#h1-mod .h1-seg-btn[aria-selected='true'] {
    background: var(--h1-card-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
    font-weight: 600;
}

.io-black-mode #h1-mod .h1-seg-btn[aria-selected='true'] {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

#h1-mod .h1-seg-btn:focus {
    outline: none;
}

.io-grey-mode #h1-mod .h1-seg-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.28);
}

.io-black-mode #h1-mod .h1-seg-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.35);
}

/* Web 模式：隐藏分类列，网格变为「搜索框 | 分段」 */
#h1-mod .h1-top-row.h1-top-row--web-mode {
    grid-template-columns: 1fr auto;
}

#h1-mod .h1-top-row.h1-top-row--web-mode .h1-scope-wrap {
    display: none !important;
}

/* Web 模式：隐藏「收录用户提交」勾选，避免与外链检索混淆 */
#h1-mod.h1-search-web-mode .h1-home-extra {
    display: none !important;
}

#h1-mod .hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--h1-sep);
    color: var(--h1-secondary);
    font-size: 12px;
    letter-spacing: -0.01em;
}

#h1-mod .kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    border: 1px solid var(--h1-sep);
    border-bottom-width: 2px;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.55);
    margin: 0 2px;
    font-size: 11px;
}

.io-black-mode #h1-mod .kbd {
    background: rgba(0, 0, 0, 0.28);
}

#h1-mod .h1-home-extra {
    margin-top: 10px;
}

#h1-mod .h1-include {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 12px;
    color: var(--h1-secondary);
    cursor: pointer;
}

/* Advanced：定稿为 hint 下方文档流展开（非浮动层），类名避免使用 Bootstrap 的 .popover */
#h1-mod .h1-adv-popover {
    display: none;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--h1-sep);
}

#h1-mod .h1-adv-popover.open {
    display: block;
}

#h1-mod .popTitle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--h1-secondary);
    font-size: 12px;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
}

#h1-mod .h1-pop-sub {
    text-align: right;
    color: var(--h1-secondary);
}

#h1-mod .grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

#h1-mod .prov {
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--h1-sep);
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
}

.io-black-mode #h1-mod .prov {
    background: rgba(0, 0, 0, 0.2);
}

.io-grey-mode #h1-mod .prov.active {
    border-color: rgba(0, 122, 255, 0.28);
    background: rgba(0, 122, 255, 0.1);
}
.io-black-mode #h1-mod .prov.active {
    border-color: rgba(10, 132, 255, 0.32);
    background: rgba(10, 132, 255, 0.16);
}

#h1-mod .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--h1-fill);
    border: 1px solid var(--h1-sep);
    flex-shrink: 0;
}

#h1-mod .prov.active .dot {
    background: var(--h1-blue);
    border-color: transparent;
}

#h1-mod .pName {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

#h1-mod .pDesc {
    font-size: 12px;
    color: var(--h1-secondary);
    letter-spacing: -0.01em;
}

/* 结果区：与 searchCard 同一台面内的第二节（发丝分割线 + 顶距） */
#h1-mod .h1-results-stack {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--h1-grouped-divider);
}

/* 定稿：Suggested results 标题行 + 右侧链接（位于 searchCard 之外） */
#h1-mod .h1-results-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin: 0 2px 10px;
}

#h1-mod .h1-results-head-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--h1-label);
}

#h1-mod .more {
    margin-left: auto;
    color: var(--h1-blue);
    font-size: 12px;
    text-decoration: none;
    font-weight: 600;
    flex-shrink: 0;
}

#h1-mod .more:hover {
    text-decoration: underline;
}

#h1-mod .results {
    margin-top: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

#h1-mod .h1-sec-title {
    grid-column: 1 / -1;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--h1-secondary);
    margin: 4px 0 2px;
}

#h1-mod .tool {
    background: var(--h1-card-bg);
    border: 1px solid var(--h1-sep);
    border-radius: 14px;
    padding: 12px;
    min-height: 122px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none !important;
    color: inherit !important;
    box-sizing: border-box;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

#h1-mod .tool:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.io-black-mode #h1-mod .tool:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

#h1-mod .tool .top {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

#h1-mod .tool .logo {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.18), rgba(0, 122, 255, 0.08));
    border: 1px solid rgba(0, 122, 255, 0.18);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: rgba(0, 64, 184, 1);
}

.io-black-mode #h1-mod .tool .logo {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.22), rgba(10, 132, 255, 0.1));
    border-color: rgba(10, 132, 255, 0.24);
    color: #a9d3ff;
}

#h1-mod .tool .meta {
    min-width: 0;
}

#h1-mod .tool .name {
    font-size: 14px;
    letter-spacing: -0.01em;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#h1-mod .tool .desc {
    margin-top: 2px;
    font-size: 12px;
    color: var(--h1-secondary);
    letter-spacing: -0.01em;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#h1-mod .tool .tagRow {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: auto;
    flex-wrap: wrap;
}

#h1-mod .tool .tag {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--h1-fill);
    border: 1px solid var(--h1-sep);
    color: var(--h1-secondary);
}

.io-grey-mode #h1-mod .tool .tag.blue {
    background: rgba(0, 122, 255, 0.1);
    border-color: rgba(0, 122, 255, 0.18);
    color: rgba(0, 64, 184, 1);
}

.io-black-mode #h1-mod .tool .tag.blue {
    color: #a9d3ff;
    background: rgba(10, 132, 255, 0.14);
    border-color: rgba(10, 132, 255, 0.22);
}

#h1-mod .h1-empty,
#h1-mod .h1-err,
#h1-mod .h1-loading {
    grid-column: 1 / -1;
    font-size: 13px;
    color: var(--h1-secondary);
    padding: 8px 0;
}

#h1-mod .h1-err {
    color: #dc3545;
}

@media (max-width: 1100px) {
    #h1-mod .results {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    #h1-mod .h1-top-row,
    #h1-mod .h1-top-row--no-cat,
    #h1-mod .h1-top-row.h1-top-row--web-mode {
        grid-template-columns: 1fr;
    }
    #h1-mod .advBtn,
    #h1-mod .h1-segmented {
        width: 100%;
    }
    #h1-mod .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #h1-mod .results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    #h1-mod .grid {
        grid-template-columns: 1fr;
    }
    #h1-mod .results {
        grid-template-columns: 1fr;
    }
    #h1-mod .h1-task-surface {
        padding: 12px;
        margin-bottom: 18px;
        border-radius: 20px;
    }
}
