:root {
    --bg: #e8ecf1;
    --card-bg: #fff;
    --primary: #1a73e8;
    --text: #202124;
    --text2: #5f6368;
    --border: #e0e0e0;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-hover: 0 6px 20px rgba(0,0,0,.10);
    --radius: 12px;
    /* H5 安全区变量 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(180deg, #e3edfb 0%, #e8ecf1 35%, #e8ecf1 100%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.5;
    padding-bottom: var(--safe-bottom);
    overflow-x: hidden;
    /* 优化移动端滚动 */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* ========== 顶部条 ========== */
.top-bar {
    width: 100%;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(20px + var(--safe-top)) 24px 0;
    padding-left: calc(24px + var(--safe-left));
    padding-right: calc(24px + var(--safe-right));
    gap: 24px;
    flex-wrap: wrap;
}
.logo-img {
    height: 44px;
    width: auto;
    user-select: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.08));
}
.weather-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 12px 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06), 0 0 0 1px rgba(255,255,255,.6) inset;
}
.weather-card {
    background: #fff;
    border-radius: 14px;
    padding: 10px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.25s;
    border: 1px solid transparent;
    min-width: 180px;
    color: var(--text);
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.weather-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    border-color: rgba(26,115,232,.25);
}
.weather-card:active {
    transform: scale(0.97);
    transition: transform 0.1s;
}
.weather-label {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    padding: 6px 11px;
    letter-spacing: 1px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.weather-icon { font-size: 26px; line-height: 1; }
.weather-temp { font-size: 22px; font-weight: 700; color: var(--text); }
.weather-desc {
    font-size: 13px;
    color: var(--text2);
    margin-left: auto;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wl-fs { background: linear-gradient(135deg, #4285f4, #5b9cf5); }
.wl-mz { background: linear-gradient(135deg, #34a853, #4caf50); }
.wl-gz { background: linear-gradient(135deg, #ea4335, #f06292); }

/* ========== 搜索卡片 ========== */
.search-card {
    width: 100%;
    max-width: 1100px;
    margin: 20px 16px 0;
    margin-left: calc(16px + var(--safe-left));
    margin-right: calc(16px + var(--safe-right));
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,.06), 0 0 0 1px rgba(255,255,255,.5) inset;
    padding: 40px 30px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.search-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 24px;
    letter-spacing: 0.5px;
}
.search-box-wrap {
    width: 100%;
    max-width: 620px;
    position: relative;
}
.search-input {
    width: 100%;
    height: 50px;
    padding: 0 52px 0 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 28px;
    outline: none;
    transition: all 0.25s;
    background: #fafafa;
    /* 移动端输入优化 */
    -webkit-appearance: none;
    appearance: none;
}
.search-input:hover { border-color: #c0c0c0; background: #fff; }
.search-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(26,115,232,.10); }
.search-icon-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
}
.search-icon-btn:hover { background: #1557b0; transform: translateY(-50%) scale(1.05); }
.search-icon-btn:active { transform: translateY(-50%) scale(0.92); }
.search-btns { margin-top: 22px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.sbtn {
    height: 42px;
    padding: 0 26px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 22px;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    /* 移动端最小触摸区域 */
    min-width: 44px;
}
.sbtn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.15); }
.sbtn:active { transform: scale(0.95); }
.sbtn-baidu { background: linear-gradient(135deg, #2932e1, #4e6ef2); }
.sbtn-bing { background: linear-gradient(135deg, #008373, #00a893); }
.sbtn svg { width: 18px; height: 18px; }
.search-hint { margin-top: 16px; font-size: 12px; color: #999; }

/* ========== 导航链接区域 ========== */
.nav-section {
    width: 100%;
    max-width: 1100px;
    margin: 16px 16px 0;
    margin-left: calc(16px + var(--safe-left));
    margin-right: calc(16px + var(--safe-right));
}
.nav-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.nav-header .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}
.nav-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.3px;
}
.nav-header .count {
    font-size: 12px;
    color: #999;
    font-weight: 400;
}

/* 标签网格 */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
}
.link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card-bg);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    /* 移动端触摸优化 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    /* 移动端最小触摸区域 */
    min-height: 44px;
}
.link-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
    color: var(--primary);
    transform: translateY(-1px);
}
.link-item:active {
    transform: scale(0.96);
    transition: transform 0.1s;
}
.link-item .li-icon {
    width: 30px; height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.link-item .li-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 颜色 */
.ic-blue { background: linear-gradient(135deg, #4285f4, #5b9cf5); }
.ic-green { background: linear-gradient(135deg, #34a853, #4caf50); }
.ic-orange { background: linear-gradient(135deg, #fb8c00, #ffa726); }
.ic-purple { background: linear-gradient(135deg, #7c4dff, #9c7cf4); }
.ic-red { background: linear-gradient(135deg, #e53935, #ef5350); }
.ic-teal { background: linear-gradient(135deg, #00897b, #26a69a); }
.ic-pink { background: linear-gradient(135deg, #e91e63, #f06292); }
.ic-amber { background: linear-gradient(135deg, #ff8f00, #ffb300); }
.ic-indigo { background: linear-gradient(135deg, #3949ab, #5c6bc0); }
.ic-cyan { background: linear-gradient(135deg, #00acc1, #26c6da); }

/* ========== 页脚 ========== */
.footer {
    width: 100%;
    text-align: center;
    padding: 24px 20px calc(24px + var(--safe-bottom));
    margin-top: 24px;
    font-size: 12px;
    color: #999;
    border-top: 1px solid #e8e8e8;
}
.footer a { color: var(--primary); text-decoration: none; margin: 0 4px; }
.footer a:hover { text-decoration: underline; }
.footer span { margin: 0 4px; color: #ccc; }

/* ========== 响应式 ========== */

/* ---------- 平板 (768px - 1024px) ---------- */
@media (max-width: 1024px) {
    .link-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* ---------- 手机横屏 / 小平板 (480px - 768px) ---------- */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: calc(16px + var(--safe-top)) 16px 0;
        padding-left: calc(16px + var(--safe-left));
        padding-right: calc(16px + var(--safe-right));
    }
    .logo-img { height: 38px; }
    .weather-wrap {
        width: 100%;
        justify-content: center;
        gap: 10px;
        padding: 10px 14px;
        border-radius: 16px;
    }
    .weather-card {
        min-width: 0;
        flex: 1;
        justify-content: center;
        padding: 8px 12px;
        gap: 8px;
    }
    .weather-desc { display: none; }
    .weather-label { font-size: 14px; padding: 5px 10px; }
    .weather-icon { font-size: 22px; }
    .weather-temp { font-size: 18px; }

    .search-card {
        margin: 16px 12px 0;
        margin-left: calc(12px + var(--safe-left));
        margin-right: calc(12px + var(--safe-right));
        padding: 30px 20px 24px;
        border-radius: 18px;
    }
    .search-title { font-size: 19px; margin-bottom: 18px; }
    .search-input { height: 46px; font-size: 15px; padding: 0 48px 0 16px; }
    .search-icon-btn { width: 36px; height: 36px; right: 5px; }
    .sbtn { height: 40px; padding: 0 20px; font-size: 13px; }

    .nav-section {
        margin: 14px 12px 0;
        margin-left: calc(12px + var(--safe-left));
        margin-right: calc(12px + var(--safe-right));
    }
    .link-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
    .link-item { padding: 9px 12px; font-size: 12px; }
    .link-item .li-icon { width: 28px; height: 28px; font-size: 12px; border-radius: 6px; }

    .footer {
        font-size: 11px;
        padding: 20px 12px calc(20px + var(--safe-bottom));
    }
}

/* ---------- 手机竖屏 (≤ 480px) ---------- */
@media (max-width: 480px) {
    .top-bar {
        padding: calc(12px + var(--safe-top)) 10px 0;
        padding-left: calc(10px + var(--safe-left));
        padding-right: calc(10px + var(--safe-right));
    }
    .logo-img { height: 32px; }
    .weather-wrap {
        gap: 6px;
        padding: 8px 8px;
        border-radius: 14px;
    }
    .weather-card {
        padding: 6px 8px;
        gap: 6px;
        border-radius: 10px;
    }
    .weather-label { font-size: 12px; padding: 4px 7px; border-radius: 5px; letter-spacing: 0.5px; }
    .weather-icon { font-size: 18px; }
    .weather-temp { font-size: 16px; }

    .search-card {
        margin: 12px 8px 0;
        margin-left: calc(8px + var(--safe-left));
        margin-right: calc(8px + var(--safe-right));
        padding: 24px 14px 20px;
        border-radius: 16px;
    }
    .search-title { font-size: 17px; margin-bottom: 14px; }
    .search-input { height: 44px; font-size: 14px; padding: 0 44px 0 14px; border-radius: 24px; }
    .search-icon-btn { width: 32px; height: 32px; right: 5px; }
    .search-icon-btn svg { width: 16px; height: 16px; }
    .search-btns { margin-top: 16px; gap: 10px; }
    .sbtn { height: 38px; padding: 0 18px; font-size: 12px; border-radius: 19px; }

    .nav-section {
        margin: 12px 8px 0;
        margin-left: calc(8px + var(--safe-left));
        margin-right: calc(8px + var(--safe-right));
    }
    .nav-header h2 { font-size: 14px; }
    .link-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .link-item {
        padding: 8px 10px;
        font-size: 11px;
        gap: 8px;
        border-radius: 6px;
    }
    .link-item .li-icon { width: 26px; height: 26px; font-size: 11px; border-radius: 5px; }

    .footer {
        font-size: 10px;
        padding: 16px 8px calc(16px + var(--safe-bottom));
        line-height: 1.8;
    }
    .footer span { display: none; }
    .footer a { display: inline; }
}

/* ---------- 极小屏 (≤ 360px) ---------- */
@media (max-width: 360px) {
    .weather-card {
        padding: 5px 6px;
        gap: 4px;
        border-radius: 8px;
    }
    .weather-label { font-size: 11px; padding: 3px 6px; }
    .weather-icon { font-size: 16px; }
    .weather-temp { font-size: 14px; }

    .search-card {
        margin: 10px 4px 0;
        margin-left: calc(4px + var(--safe-left));
        margin-right: calc(4px + var(--safe-right));
        padding: 20px 10px 16px;
    }
    .search-title { font-size: 15px; }
    .search-input { height: 40px; font-size: 13px; padding: 0 40px 0 12px; }
    .search-icon-btn { width: 28px; height: 28px; right: 4px; }

    .nav-section {
        margin: 10px 4px 0;
        margin-left: calc(4px + var(--safe-left));
        margin-right: calc(4px + var(--safe-right));
    }
    .link-grid { grid-template-columns: repeat(2, 1fr); gap: 4px; }
    .link-item { padding: 7px 8px; font-size: 10px; gap: 6px; }
    .link-item .li-icon { width: 22px; height: 22px; font-size: 10px; border-radius: 4px; }
}

/* ---------- 横屏手机 (高度不足) ---------- */
@media (max-height: 480px) and (orientation: landscape) {
    .search-card { padding: 16px 14px; }
    .search-title { margin-bottom: 10px; }
    .search-btns { margin-top: 10px; }
}
