/* ============================================================
 * 设计令牌 —— 潘通蓝色系（浅色版）
 * PANTONE 7457C  #CFEBFC
 * PANTONE 2727C  #3D9DD9
 * PANTONE 2728C  #187FC4
 * ============================================================ */
:root {
    --bg: #f5fafd;
    --card: #ffffff;
    --card-hover: #f8fbfe;
    --border: #e2eef7;
    --text: #0a1e35;
    --text-secondary: #4a5f78;
    --text-muted: #8ba0b8;
    --surface-2: #f5fafd;
    --brand-light: #CFEBFC;
    --brand-primary: #3D9DD9;
    --brand-primary-dark: #187FC4;
    --brand-secondary: #187FC4;
    --shadow-sm: 0 1px 2px rgba(24, 127, 196, 0.05);
    --shadow-md: 0 4px 12px rgba(24, 127, 196, 0.08);
    --shadow-lg: 0 12px 32px rgba(24, 127, 196, 0.12);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.dark {
    --bg: #06192e;
    --card: #0f2842;
    --card-hover: #16334f;
    --border: #1e3d5c;
    --text: #d6e5f5;
    --text-secondary: #94aec7;
    --text-muted: #5a7796;
    --surface-2: #0a2038;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 1rem;
    transition: background 0.3s ease, color 0.3s ease;
    padding: 32px 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

.container { max-width: 1300px; margin: 0 auto; }

/* ============================================================
 * Header
 * ============================================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    background: var(--card);
    padding: 12px 24px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: background 0.3s ease, border-color 0.3s ease;
}
.logo-area { display: flex; align-items: center; gap: 14px; min-width: 0; }
.site-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 14px;
    background: white;
    padding: 4px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
body.dark .site-logo {
    background: transparent;
    mix-blend-mode: lighten;
}
.site-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #3D9DD9 0%, #187FC4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.title-desktop { display: inline; }
.title-mobile { display: none; }

.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--surface-2);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    transform: rotate(15deg);
}

.user-area { position: relative; }
.user-btn {
    background: var(--card);
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}
.user-btn:hover { border-color: var(--brand-primary); }
.user-dropdown {
    position: absolute;
    right: 0;
    top: 50px;
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: 180px;
    display: none;
    z-index: 100;
    overflow: hidden;
}
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover { background: var(--surface-2); }

/* ============================================================
 * Hero 横幅
 * ============================================================ */
.hero {
    position: relative;
    background: linear-gradient(135deg, #3D9DD9 0%, #187FC4 100%);
    border-radius: 20px;
    padding: 20px 28px;
    margin-bottom: 20px;
    color: white;
    overflow: hidden;
    box-shadow: 0 12px 24px -12px rgba(24, 127, 196, 0.4);
    transition: all 0.3s ease;
}
body.dark .hero {
    background: linear-gradient(135deg, #187FC4 0%, #004098 100%);
    box-shadow: 0 12px 24px -12px rgba(0, 64, 152, 0.6);
}
.hero::before {
    content: '';
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(207, 235, 252, 0.35), transparent 70%);
    right: -60px;
    top: -60px;
    pointer-events: none;
}
.hero::after {
    content: '';
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(207, 235, 252, 0.2), transparent 70%);
    right: 100px;
    bottom: -80px;
    pointer-events: none;
}
.hero-content { position: relative; z-index: 2; }

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
    min-height: 30px;
}
.hero-hello {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    white-space: nowrap;
}
.hero-hello .wave {
    display: inline-block;
    animation: wave 2s ease-in-out infinite;
    transform-origin: 70% 70%;
}
@keyframes wave {
    0%, 60%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
}
.hero-date {
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.92;
    font-variant-numeric: tabular-nums;
    flex: 1 1 auto;
    text-align: center;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}
.hero-weather {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.95;
    flex-shrink: 0;
    white-space: nowrap;
    flex-wrap: nowrap;
}
.hero-weather #weatherPlace {
    font-weight: 600;
    opacity: 0.95;
    margin-right: 2px;
}
.weather-icon {
    font-size: 1rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    flex-shrink: 0;
}
.hero-weather #weatherText {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
}
.hero-yiyan {
    font-size: 0.88rem;
    font-style: italic;
    opacity: 0.88;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
 * 搜索栏
 * ============================================================ */
.search-bar {
    background: var(--card);
    border-radius: 20px;
    padding: 6px 6px 6px 20px;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--border);
    max-width: 640px;
    margin: 0 auto 28px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease-out-expo);
    will-change: transform, box-shadow;
    position: relative;
}
.search-bar:focus-within {
    box-shadow:
        0 0 0 4px rgba(61, 157, 217, 0.15),
        0 12px 32px -8px rgba(61, 157, 217, 0.28);
    border-color: var(--brand-primary);
    transform: scale(1.01);
}
.search-bar i.fa-search {
    color: var(--text-muted);
    transition: color 0.2s ease;
    font-size: 15px;
}
.search-bar:focus-within i.fa-search { color: var(--brand-primary); }
.search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 0.9rem;
    outline: none;
    color: var(--text);
    font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-muted); }
.search-bar select {
    border: none;
    background: transparent;
    font-size: 0.85rem;
    color: var(--text-secondary);
    outline: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    font-family: inherit;
    max-width: 100px;
}
.search-bar select:hover { background: var(--surface-2); }
.search-bar button {
    height: 44px;
    padding: 0 22px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #3D9DD9, #187FC4);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 12px -2px rgba(61, 157, 217, 0.4);
}
.search-bar button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -2px rgba(61, 157, 217, 0.5);
}

/* ============================================================
 * 分类
 * ============================================================ */
.category-section { margin-bottom: 44px; }
.category-section:last-child { margin-bottom: 20px; }
.category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
}
.category-accent {
    display: inline-block;
    width: 4px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(180deg, #3D9DD9, #187FC4);
    flex-shrink: 0;
}
.category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 8px;
    border-radius: 11px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-variant-numeric: tabular-nums;
    margin-left: 2px;
}

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

/* ============================================================
 * 卡片
 * ============================================================ */
.nav-card {
    background: var(--card);
    border-radius: 16px;
    padding: 20px 14px 18px;
    text-align: center;
    transition: all 0.3s var(--ease-out-expo);
    border: 1px solid var(--border);
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    display: block;
    position: relative;
    overflow: hidden;
    will-change: transform;
}
.nav-card::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(61, 157, 217, 0.18), transparent 70%);
    border-radius: 50%;
    left: var(--mouse-x, 50%);
    top: var(--mouse-y, 50%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 0;
}
.nav-card:hover::before { opacity: 1; }
.nav-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3D9DD9, #187FC4);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--ease-out-expo);
}
.nav-card:hover::after { transform: scaleX(1); }
.nav-card:hover {
    transform: translateY(-4px);
    border-color: transparent;
    box-shadow: 0 20px 40px -20px rgba(61, 157, 217, 0.35);
}
body.dark .nav-card:hover {
    box-shadow: 0 20px 40px -20px rgba(61, 157, 217, 0.45);
    background: var(--card-hover);
}
.nav-card.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.nav-card.disabled:hover {
    transform: none;
    box-shadow: none;
}
.nav-card.disabled::after { display: none; }

.card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.5px;
    box-shadow: 0 6px 16px -4px rgba(61, 157, 217, 0.35);
    position: relative;
    transition: transform 0.4s var(--ease-spring);
    z-index: 1;
    text-align: center;
    line-height: 1;
}
.card-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 60%);
    pointer-events: none;
}
.nav-card:hover .card-icon {
    transform: scale(1.1) rotate(-4deg);
}
.card-title {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 0;
    word-break: break-word;
    line-height: 1.4;
    transition: color 0.2s ease;
    position: relative;
    z-index: 1;
}
.nav-card:hover .card-title { color: var(--brand-primary); }

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(61, 157, 217, 0.4);
    transform: scale(0);
    animation: rippleAnim 0.65s var(--ease-out-expo);
    pointer-events: none;
    z-index: 0;
}
@keyframes rippleAnim {
    to { transform: scale(4); opacity: 0; }
}

/* ============================================================
 * 骨架屏
 * ============================================================ */
.skeleton-card {
    height: 130px;
    border-radius: 16px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ============================================================
 * 空状态
 * ============================================================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.55;
    display: block;
}
.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 8px;
    font-weight: 600;
}
.empty-state p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ============================================================
 * Footer
 * ============================================================ */
footer {
    text-align: center;
    margin-top: 60px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 20px;
}

/* ============================================================
 * Modal
 * ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(24, 127, 196, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background: var(--card);
    border-radius: 24px;
    padding: 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s var(--ease-out-expo);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-content h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}
.modal-content input {
    width: 100%;
    padding: 12px 16px;
    margin: 10px 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.15s ease;
    font-family: inherit;
    outline: none;
}
.modal-content input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(61, 157, 217, 0.18);
    background: var(--card);
}
.modal-content button {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    border: none;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.modal-content .btn-primary {
    background: linear-gradient(135deg, #3D9DD9, #187FC4);
    color: white;
}
.modal-content .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -4px rgba(61, 157, 217, 0.5);
}
.modal-content .btn-secondary {
    background: var(--surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    margin-top: 8px;
}
.modal-content .btn-secondary:hover { background: var(--border); }
.hidden { display: none !important; }

/* ============================================================
 * 响应式
 * ============================================================ */
@media (max-width: 900px) {
    body { padding: 20px 14px; }
    .hero { padding: 18px 22px; border-radius: 18px; }
    .hero-hello { font-size: 1.15rem; }
    .hero-date { font-size: 0.78rem; }
    .hero-weather { font-size: 0.78rem; }
    .hero-yiyan { font-size: 0.82rem; }
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

@media (max-width: 700px) {
    body { padding: 16px 12px; }

    /* Header 一行显示：标题 + 主题切换 + 登录 */
    .header {
        flex-wrap: nowrap;
        padding: 8px 12px;
        border-radius: 14px;
        margin-bottom: 14px;
        gap: 8px;
    }
    .logo-area {
        gap: 0;
        flex: 1 1 auto;
        min-width: 0;
    }
    .site-logo { display: none; }
    .site-title { font-size: 1rem; }
    .title-desktop { display: none; }
    .title-mobile { display: inline; }

    .header-right { gap: 6px; }
    .theme-toggle {
        width: 34px;
        height: 34px;
        font-size: 13px;
        border-radius: 10px;
    }
    .user-btn {
        padding: 6px 12px;
        font-size: 0.78rem;
        gap: 6px;
    }
    .user-btn #usernameDisplay {
        max-width: 56px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .user-btn .fa-chevron-down { display: none; }

    /* Hero 区：手机端隐藏天气和一言 */
    .hero { padding: 14px 18px; border-radius: 14px; margin-bottom: 14px; }
    .hero-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        flex-wrap: wrap;
        margin-bottom: 0;
        min-height: 0;
    }
    .hero-hello { font-size: 1.05rem; }
    .hero-date {
        font-size: 0.75rem;
        text-align: left;
        white-space: normal;
        overflow: visible;
        padding: 0;
        flex: none;
        width: 100%;
    }
    .hero-weather { display: none; }
    .hero-yiyan { display: none; }

    /* 搜索栏 */
    .search-bar {
        max-width: 100%;
        height: 52px;
        padding: 5px 5px 5px 16px;
        gap: 8px;
        margin-bottom: 22px;
    }
    .search-bar select { display: none; }
    .search-bar button { height: 42px; padding: 0 16px; font-size: 0.8rem; }

    /* 分类 */
    .category-section { margin-bottom: 32px; }
    .category-title { font-size: 1rem; margin-bottom: 14px; }
    .category-accent { height: 18px; }
    .category-count { height: 20px; font-size: 0.68rem; }

    /* 卡片 */
    .cards-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .nav-card { padding: 14px 8px 12px; border-radius: 14px; }
    .card-icon {
        width: 38px;
        height: 38px;
        font-size: 12px;
        border-radius: 11px;
        margin-bottom: 8px;
        letter-spacing: -0.3px;
    }
    .card-title { font-size: 0.78rem; }

    footer { margin-top: 40px; }
}

@media (max-width: 480px) {
    body { padding: 12px 10px; }
    .hero { padding: 12px 14px; }
    .hero-hello { font-size: 1rem; }
    .hero-date { font-size: 0.7rem; }

    .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .nav-card { padding: 12px 6px 10px; }
    .card-icon {
        width: 34px;
        height: 34px;
        font-size: 11px;
        border-radius: 10px;
        margin-bottom: 6px;
        letter-spacing: -0.2px;
    }
    .card-title { font-size: 0.75rem; }

    .modal-content { padding: 22px; border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}