/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --card-bg: rgba(255, 255, 255, 0.55);
    --card-border: rgba(255, 255, 255, 0.65);
    --text: #1f2937;
    --text-dim: rgba(31, 41, 55, 0.65);
    --accent: #2f7d5c;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --blur: 16px;
}

html, body { height: 100%; }

body {
    font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    overflow-x: hidden;
}

/* ========== 背景层 ========== */
.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: url("assets/bg/wh_4vkoel.jpg") center / cover no-repeat;
    background-attachment: fixed;
}

/* 竖屏设备（手机竖拿）：用竖版背景图，避免横图被裁掉左右 */
@media (orientation: portrait) {
    .bg {
        background-image: url("assets/bg/wh_4vkoel_vertical.jpg");
    }
}

/* 底部渐变压暗，保证卡片文字可读 */
.bg-scrim {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.35) 100%),
        radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.18) 100%);
}

/* ========== 布局 ========== */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

/* 顶部问候 */
.hero { text-align: center; margin-bottom: 32px; }
.greeting {
    font-size: 44px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.02em;
}
.time {
    margin-top: 8px;
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

/* ========== 搜索框 ========== */
.search-wrap {
    position: relative;
    max-width: 560px;
    margin: 0 auto 28px;
}
.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-dim);
    pointer-events: none;
}
#search {
    width: 100%;
    padding: 14px 20px 14px 50px;
    font-size: 16px;
    color: var(--text);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(var(--blur)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
    box-shadow: var(--shadow);
    outline: none;
    transition: box-shadow 0.2s, background 0.2s;
}
#search::placeholder { color: var(--text-dim); }
#search:focus {
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 0 0 3px rgba(47, 125, 92, 0.25);
}

/* ========== 分类 Tab ========== */
.tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}
.tab {
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.1s;
}
.tab:hover { background: rgba(255, 255, 255, 0.3); }
.tab.active {
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent);
    font-weight: 600;
}
.tab:active { transform: scale(0.96); }

/* ========== 卡片网格 ========== */
.sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    text-decoration: none;
    color: var(--text);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    backdrop-filter: blur(var(--blur)) saturate(1.4);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.card:active { transform: translateY(0); }

.card-favicon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    overflow: hidden;
}
.card-favicon img { width: 100%; height: 100%; object-fit: cover; }

.card-body { min-width: 0; }
.card-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-desc {
    margin-top: 3px;
    font-size: 12.5px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 无结果提示 */
.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 0;
    color: #fff;
    font-size: 15px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* ========== 响应式 ========== */
@media (max-width: 600px) {
    .container { padding: 32px 16px 60px; }
    .greeting { font-size: 34px; }
    .sections { grid-template-columns: 1fr; }
}

/* 深色系统偏好：卡片更深，文字更亮 */
@media (prefers-color-scheme: dark) {
    :root {
        --card-bg: rgba(17, 24, 39, 0.5);
        --card-border: rgba(255, 255, 255, 0.14);
        --text: #f3f4f6;
        --text-dim: rgba(243, 244, 246, 0.62);
        --accent: #6ee7a0;
    }
    .card-favicon { background: rgba(255, 255, 255, 0.1); color: var(--accent); }
    .card:hover { background: rgba(17, 24, 39, 0.65); }
    #search:focus { background: rgba(17, 24, 39, 0.7); }
    .tab.active { background: rgba(17, 24, 39, 0.85); color: var(--accent); }
}
