/* =====================================================================
   笑笑豆导航 · 前台样式（v2 视觉重做）
   ---------------------------------------------------------------------
   结构/交互不变（整窗不滚 + 搜索栏/板块条钉顶 + 面板就地切换 + 面板内滚动），
   只做视觉层重做：更柔和的层次、更大更一致的圆角、聚焦态光环、
   链接 hover 抬升、分类名列改为带强调竖线的标签区。
   配色走 CSS 变量，由 assets/theme.css（后加载）按 data-theme 换肤
   （dawn 清晨 / day 白昼 / dusk 黄昏 / night 夜晚）；含移动端响应式。
   ===================================================================== */

:root {
    --bg:           #eef1f5;   /* 页面底色（衬托面板） */
    --panel:        #fafafa;   /* 面板底 */
    --panel-alt:    #f5f5f7;   /* 奇数行底 */
    --text:         #333333;
    --text-2:       #4d4d4d;   /* 链接名 */
    --text-3:       #888888;
    --border:       #e4e4e4;
    --border-2:     #d7d7d7;
    --row-divider:  #ececec;
    --sep-bg:       #e9edf3;   /* 板块标题条 */
    --sep-border:   #e0e4ea;
    --radius:       14px;      /* v2：面板大圆角 */
    --radius-sm:    10px;      /* v2：控件圆角 */
    --shadow:       0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px rgba(16, 24, 40, .07);
    --shadow-soft:  0 1px 2px rgba(16, 24, 40, .05);
    --header-h:     50px;

    --font: "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI",
            "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;

    /* theme.css 提供的共享 token 兜底（白昼值） */
    --card:            #ffffff;
    --card-2:          #f0f0f0;
    --divider:         #ededed;
    --hover-soft:      rgba(0, 0, 0, .045);
    --shadow-pop:      0 6px 20px rgba(20, 30, 50, .12);
    --accent:          #0e7490;
    --accent-contrast: #ffffff;
    --accent-soft:     rgba(14, 116, 144, .14);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

/* 整窗不滚动：搜索栏 + 板块跳转条钉顶，仅面板主体内部滚动 */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

a { color: inherit; text-decoration: none; }

/* 整页纵向 flex：顶栏 / 面板 / 页脚 三段，面板占满剩余高度 */
.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 100vh;
}

/* ===================== 顶部：站名 + 搜索（钉顶，不随面板滚动） ===================== */
.top-area {
    flex: 0 0 auto;
    text-align: center;
    padding: 24px 16px 14px;
    background: var(--bg);
}
.site-title {
    font-size: 21px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 14px;
    letter-spacing: 1px;
}

/* 搜索条（form 本身即输入框容器）——v2：更高、更圆、聚焦有光环 */
.search-engine {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    width: 100%;
    max-width: 720px;
    background: var(--card);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    vertical-align: top;
    transition: box-shadow .18s, border-color .18s;
}
.search-engine:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-soft);
}
.eng-logo {
    flex: 0 0 58px;
    width: 58px;
    border: 0;
    border-right: 1px solid var(--divider);
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: background .15s;
}
.eng-logo:hover { background: var(--card-2); }
.eng-logo img { width: 26px; height: 26px; border-radius: 6px; }
.search-input {
    flex: 1;
    border: 0; outline: none; background: transparent;
    height: 48px; padding: 0 14px;
    font-size: 16px; color: var(--text);
    font-family: var(--font);
}
.search-input::placeholder { color: var(--text-3); }
.eng-go {
    flex: 0 0 62px;
    width: 62px;
    border: 0;
    border-left: 1px solid var(--divider);
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-3);
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.eng-go:hover { background: var(--accent-soft); color: var(--accent); }

/* 联想下拉 */
.suggest-box {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: var(--panel);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop);
    padding: 6px;
    display: none;
    z-index: 60;
    text-align: left;
}
.suggest-box.show { display: block; }
.suggest-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    cursor: pointer; font-size: 14px; color: var(--text-2);
    transition: background .12s, color .12s;
}
.suggest-item:hover, .suggest-item.active { background: var(--accent-soft); color: var(--accent); }
.suggest-item i { color: var(--text-3); font-size: 13px; }

/* 引擎 chips（位于搜索框上方）——v2：选中态为强调色底 */
.engine-chips { display: flex; gap: 8px; justify-content: center; margin: 0 0 12px; flex-wrap: wrap; }
.engine-chip {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--card); cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: .55;
    box-shadow: var(--shadow-soft);
    transition: opacity .16s, border-color .16s, transform .16s, box-shadow .16s;
}
.engine-chip img { width: 18px; height: 18px; border-radius: 5px; }
.engine-chip:hover { opacity: 1; transform: translateY(-2px); }
.engine-chip.active {
    opacity: 1; border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-soft);
}

/* ===================== 容器（占满剩余高度） ===================== */
.container {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px 16px;
}

/* ===================== 导航面板 ===================== */
.web-site {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* 板块跳转条（钉在面板顶部）
   ⚠️ 用 min-height 而非固定 height：胶囊换行成两排时不会被下方面板盖住 */
.web-site-header {
    flex: 0 0 auto;
    min-height: var(--header-h);
    background: var(--panel);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
    display: flex; align-items: center; justify-content: center;
    padding: 8px 12px;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}
.navi-btn-group {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center; max-width: 100%;
}
.navi-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card); color: var(--text-2);
    font-size: 13px; line-height: 1.4; white-space: nowrap;
    cursor: pointer;
    transition: background .16s, color .16s, border-color .16s, box-shadow .16s, transform .16s;
}
.navi-btn i { font-size: 11px; color: var(--text-3); transition: color .16s; }
.navi-btn:hover { background: var(--card-2); color: var(--text); transform: translateY(-1px); }
.navi-btn.active {
    background: var(--accent); color: var(--accent-contrast);
    border-color: var(--accent);
    box-shadow: 0 3px 10px var(--accent-soft);
}
.navi-btn.active i { color: var(--accent-contrast); }

/* 面板主体：唯一可滚动区域（整窗不滚） */
.web-site-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* 板块面板：一次只显示一个，点击板块就地切换（不滚窗口） */
.board-panel { display: none; }
.board-panel.active { display: block; }

/* 板块标题条 */
.board-head {
    display: flex; align-items: center; gap: 10px;
    background: var(--sep-bg);
    color: var(--text);
    font-weight: 600; font-size: 14px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--sep-border);
}
.board-head .board-name { display: inline-flex; align-items: center; gap: 6px; }
.board-head .board-count { font-size: 12px; font-weight: 500; color: var(--text-3); }

/* 分类行 */
.web-group {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--row-divider);
    min-height: 52px;
}
.web-group.odd  { background: var(--panel-alt); }
.web-group.even { background: var(--panel); }

/* v2：分类名列改为带强调竖线的标签区 */
.web-group-head {
    flex: 0 0 104px;
    display: flex; align-items: center; justify-content: center;
    border-right: 1px solid var(--border);
    box-shadow: inset 3px 0 0 var(--accent-soft);
    color: var(--text);
    font-size: 13.5px; font-weight: 600;
    padding: 6px 6px;
    text-align: center; line-height: 1.3;
    letter-spacing: .3px;
}
.web-group-head i { font-size: 12px; margin-right: 4px; }

/* v2.2：恢复换行（不再横向滚动）；默认每类只显示前 N 条，其余折叠进「+N」 */
.web-group-items {
    flex: 1;
    display: flex; flex-wrap: wrap; align-items: center;
    padding: 4px 4px;
    overflow: visible;
}
/* 折叠态：超出前 N 条的链接不占位；展开后回归。
   ⚠️ 用 display:none 而非移除 DOM —— 保留全部 <a> 供搜索引擎抓取（首页 SSR 是主要收录来源） */
.web-group-item.wg-hidden { display: none; }
.web-group-items.wg-expanded .web-group-item.wg-hidden { display: inline-flex; }
.wg-more {
    display: inline-flex; align-items: center;
    height: 34px; padding: 0 12px; margin: 0 6px;
    border: 1px dashed var(--border-2);
    border-radius: 999px;
    background: transparent; color: var(--text-3);
    font-size: 12.5px; font-family: var(--font); cursor: pointer;
    transition: background .14s, color .14s, border-color .14s;
}
.wg-more:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); border-style: solid; }

/* 行内链接项——v2：hover 抬升 + 图标放大 + 名字变强调色；v2.2：压缩尺寸以一屏容纳更多 */
.web-group-item {
    display: inline-flex; align-items: center; gap: 6px;
    height: 40px;
    padding: 0 10px;
    margin: 2px 0;
    min-width: 116px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13.5px;
    transition: background .14s, color .14s, transform .14s;
}
.web-group-item:hover {
    background: var(--accent-soft);
    color: var(--accent);
    transform: translateY(-1px);
}
.wg-icon {
    width: 20px; height: 20px; border-radius: 5px;
    flex-shrink: 0; object-fit: cover; background: var(--card);
    box-shadow: 0 0 0 1px var(--border);
    transition: transform .14s;
}
.web-group-item:hover .wg-icon { transform: scale(1.08); }
/* 自定义图片图标（抖音推荐博主头像）：圆形 */
.wg-icon.wg-avatar { border-radius: 50%; }
/* 单条链接名称标红（按 data-id 指定，需与 links.id 对应） */
.web-group-item[data-id="1511"] .wg-name { color: #d0021b; font-weight: 600; }
.wg-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 96px;
}

.link-empty { color: var(--text-3); font-size: 13px; padding: 6px 12px; }

/* ===================== 页脚（钉底，不随面板滚动） ===================== */
.footer {
    flex: 0 0 auto;
    background: transparent;
    padding: 12px 22px 16px;
    text-align: center;
}
.footer p { margin: 0; color: var(--text-3); font-size: 12.5px; }

/* ===================== 浮动红点 · 我的导航 ===================== */
.dock { position: fixed; right: 26px; bottom: 26px; z-index: 90; }
.dock-dot {
    position: relative;
    width: 52px; height: 52px;
    border: none; cursor: pointer; padding: 0;
    border-radius: 50%;
    background: #ef3b4e;
    color: #fff; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 20px rgba(239, 59, 78, .32);
    transition: transform .16s, background .16s, box-shadow .16s;
}
.dock-dot:hover { transform: translateY(-2px) scale(1.04); background: #e02a3e; }
.dock-dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    animation: dockPulse 2.4s ease-out infinite;
}
@keyframes dockPulse {
    0%   { box-shadow: 0 0 0 0 rgba(239, 59, 78, .50); }
    70%  { box-shadow: 0 0 0 15px rgba(239, 59, 78, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 59, 78, 0); }
}
.dock-dot i { position: relative; z-index: 1; }
.dock-panel {
    position: absolute; right: 0; bottom: 66px;
    width: 270px;
    background: var(--panel);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    padding: 12px;
    opacity: 0; visibility: hidden;
    transform: translateY(10px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.dock.open .dock-panel { opacity: 1; visibility: visible; transform: none; }
.dock-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 2px 4px 10px;
}
.dock-panel-title {
    font-size: 13.5px; font-weight: 650; color: var(--text);
    display: inline-flex; align-items: center; gap: 7px;
}
.dock-panel-title i { color: #ef3b4e; }
.dock-close {
    border: none; background: transparent; cursor: pointer;
    font-size: 19px; line-height: 1; color: var(--text-3);
    padding: 2px 7px; border-radius: 8px;
}
.dock-close:hover { background: var(--panel-alt); color: var(--text); }
.dock-list { display: flex; flex-direction: column; gap: 2px; max-height: 62vh; overflow-y: auto; }
.dock-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; border-radius: 10px;
    font-size: 13.5px; color: var(--text-2);
    transition: background .14s, color .14s;
}
.dock-link:hover { background: rgba(239, 59, 78, .12); color: #d8232f; }
.dock-link i { width: 16px; text-align: center; font-size: 14px; color: #ef3b4e; flex-shrink: 0; }
.dock-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===================== SEO 隐藏 H1 ===================== */
.seo-h1 {
    position: absolute;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%);
    white-space: nowrap; border: 0;
}

/* =====================================================================
   移动端响应式（断点 980 / 680 / 400）
   ===================================================================== */

/* --- 小屏平板 / 横屏手机 --- */
@media (max-width: 980px) {
    .container { padding: 0 10px 12px; }
    .top-area { padding: 20px 14px 12px; }
}

/* --- 手机竖屏 --- */
@media (max-width: 680px) {
    .top-area { padding: 16px 12px 10px; }
    .site-title { font-size: 19px; margin-bottom: 12px; }
    .search-input { font-size: 15px; height: 44px; }
    .eng-logo { flex-basis: 52px; width: 52px; }
    .eng-logo img { width: 22px; height: 22px; }
    .eng-go { flex-basis: 54px; width: 54px; }

    /* 跳转条：横向滑动不换行 */
    .web-site-header { height: auto; padding: 8px 10px; }
    .navi-btn-group {
        flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start;
        -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .navi-btn-group::-webkit-scrollbar { display: none; }
    .navi-btn { flex: 0 0 auto; }

    /* 分类行改为竖排：分类名成顶部标签 */
    .web-group { flex-direction: column; }
    .web-group-head {
        flex-basis: auto; width: 100%;
        border-right: none; border-bottom: 1px solid var(--border);
        box-shadow: none;
        justify-content: flex-start; padding: 7px 14px;
    }
    .web-group-items { padding: 4px 10px; flex-wrap: wrap; overflow-x: visible; }
    .web-group-item { min-width: 0; flex: 1 1 46%; padding: 0 10px; height: 44px; }
    .wg-name { max-width: none; }
    .footer { padding: 12px; }
    .footer p { font-size: 12px; }
    .dock { right: 14px; bottom: 14px; }
    .dock-dot { width: 48px; height: 48px; font-size: 17px; }
    .dock-panel { width: calc(100vw - 28px); bottom: 60px; }
}

/* --- 小屏手机 --- */
@media (max-width: 400px) {
    .web-group-item { flex-basis: 100%; }
}
