/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f2f3f7;
    --bg-gradient: linear-gradient(180deg, #e8ecf4 0%, #f2f3f7 100%);
    --widget-bg: rgba(255, 255, 255, 0.82);
    --widget-blur: saturate(180%) blur(24px);
    --text: #1c1c1e;
    --text-secondary: #8e8e93;
    --widget-shadow: 0 8px 32px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.03);
    --widget-radius: 20px;
    --tile-radius: 14px;
    --icon-size: 32px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Noto Sans SC", sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Container ===== */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px 24px 32px;
}

/* ===== Widget Grid ===== */
.widget-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    justify-content: center;
}

@media (min-width: 560px) {
    .widget-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1050px) {
    .widget-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 热搜采用 2 列宽，与普通 widget 宽度一致 */
#widget-trending {
    display: block;
}

/* ===== Header / 顶部时间区 ===== */
header {
    text-align: center;
    margin-bottom: 28px;
    padding: 20px 0 16px;
}

.site-title {
    text-decoration: none;
    color: inherit;
}

h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--text);
}

.subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    font-weight: 400;
}

/* ===== Navigation ===== */
.nav {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    padding: 4px 0;
}

.nav-link:hover {
    color: var(--text);
}

/* ===== Widget ===== */
.widget {
    margin-bottom: 20px;
    background: var(--widget-bg);
    -webkit-backdrop-filter: var(--widget-blur);
    backdrop-filter: var(--widget-blur);
    border-radius: var(--widget-radius);
    box-shadow: var(--widget-shadow);
    padding: 20px 16px;
    overflow: hidden;
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.widget-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.5px;
}

.widget-header .widget-badge {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Link Tiles ===== */
.tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (min-width: 480px) {
    .tiles { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 560px) {
    .tiles { grid-template-columns: repeat(5, 1fr); gap: 6px; }
}

@media (min-width: 900px) {
    .tiles { grid-template-columns: repeat(6, 1fr); }
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px 10px;
    text-decoration: none;
    color: var(--text);
    border-radius: var(--tile-radius);
    transition: background 0.15s ease, transform 0.15s ease;
    cursor: pointer;
}

.tile:hover {
    background: rgba(0, 0, 0, 0.04);
}

.tile:active {
    transform: scale(0.94);
}

.tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent, #e8ecf4);
    flex-shrink: 0;
    transition: background 0.2s;
}

.tile-icon img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    display: block;
}

.tile-label {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    color: var(--text);
    line-height: 1.3;
}

/* ===== Trending / 热搜 ===== */
#widget-trending {
    padding: 0;
}

#widget-trending .widget-header {
    padding: 20px 16px 12px;
    margin-bottom: 0;
}

.trending-scroll {
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}

.trending-scroll::-webkit-scrollbar { width: 3px; }
.trending-scroll::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 2px;
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text);
    transition: background 0.12s;
}

.trending-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.trending-rank {
    flex-shrink: 0;
    width: 24px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    color: var(--text-secondary);
}

.trending-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.trending-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.trending-author {
    font-size: 11px;
    color: var(--text-secondary);
}

.trending-loading,
.trending-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Post List ===== */
.post-list {
    list-style: none;
    padding: 0;
}

.post-list li {
    padding: 12px 0;
}

.post-list li + li {
    border-top: 1px solid rgba(0,0,0,0.06);
}

.post-list a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 15px;
}

.post-list a:hover {
    opacity: 0.7;
}

.post-list .date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* ===== Post Content ===== */
.post h1 {
    text-align: left;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-size: 24px;
}

.post .post-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.post p { margin-bottom: 16px; }
.post ul, .post ol { margin: 0 0 16px 20px; }
.post li { margin-bottom: 4px; }

.post code {
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.post pre {
    background: #1c1c1e;
    color: #e5e5e5;
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.post pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.post blockquote {
    border-left: 3px solid rgba(0,0,0,0.1);
    padding-left: 16px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.post img { max-width: 100%; border-radius: 12px; }

/* ===== Footer ===== */
footer {
    margin-top: 28px;
    padding-top: 20px;
    text-align: center;
}

footer p {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .container { padding: 28px 12px 24px; }

    h1 { font-size: 26px; letter-spacing: 4px; }

    .widget { padding: 16px 12px; }
    #widget-trending { padding: 0; }
    #widget-trending .widget-header { padding: 16px 12px 8px; }

    .tiles { gap: 4px; }

    .trending-item { padding: 8px 12px; }
    .trending-title { font-size: 13px; }

    .tile-icon {
        width: 40px;
        height: 40px;
    }

    .tile-icon img {
        width: 22px;
        height: 22px;
    }

    .tile-label { font-size: 10px; }
}

@media (min-width: 900px) {
    .tile-icon {
        width: 52px;
        height: 52px;
    }

    .tile-icon img {
        width: 30px;
        height: 30px;
    }

    .tile-label { font-size: 12px; }
}

@media (min-width: 1200px) {
    .container { padding: 48px 32px 32px; }

    .tile-icon {
        width: 56px;
        height: 56px;
    }

    .tile-icon img {
        width: 32px;
        height: 32px;
    }
}

@media (min-width: 1600px) {
    .container { max-width: 1200px; }
}

