/* ============================================================
   iTboy · 全站共用样式
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root,
:root[data-theme="dark"] {
    --bg: #0a0d12;
    --text: #e8edf2;
    --text-dim: #8b949e;
    --text-faint: #5a636e;
    --accent: #6ecfbf;
    --card-bg: rgba(255, 255, 255, 0.022);
    --card-bg-hover: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.07);
    --hairline: rgba(255, 255, 255, 0.06);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --bar-track: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] {
    --bg: #f6f7f9;
    --text: #1a1f26;
    --text-dim: #5a636e;
    --text-faint: #8b949e;
    --accent: #0f8a7a;
    --card-bg: #ffffff;
    --card-bg-hover: #ffffff;
    --card-border: rgba(0, 0, 0, 0.07);
    --hairline: rgba(0, 0, 0, 0.07);
    --shadow: 0 8px 22px rgba(20, 30, 45, 0.07);
    --bar-track: rgba(0, 0, 0, 0.06);
}

:root {
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
    --accent-line: color-mix(in srgb, var(--accent) 30%, transparent);
    --accent-glow: color-mix(in srgb, var(--accent) 6%, transparent);
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
    :root {
        --accent-soft: rgba(110, 207, 191, 0.10);
        --accent-line: rgba(110, 207, 191, 0.30);
        --accent-glow: rgba(110, 207, 191, 0.06);
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
        "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s ease, color .25s ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(720px 380px at 88% -10%, var(--accent-glow), transparent 70%),
        radial-gradient(560px 320px at 0% 105%, var(--accent-glow), transparent 70%);
    z-index: 0;
}

a {
    color: inherit;
}

/* ---------- 页面容器 ---------- */
.page {
    position: relative;
    z-index: 1;
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 24px 48px;
}

/* ---------- 顶栏 ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.brand::before {
    content: "";
    width: 3px;
    height: 18px;
    border-radius: 2px;
    background: var(--accent);
}

.brand-name {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: .5px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-dim);
    font-size: 12.5px;
    text-decoration: none;
    transition: color .2s, border-color .2s, background-color .2s;
}

.back-btn:hover {
    color: var(--accent);
    border-color: var(--accent-line);
    background: var(--card-bg-hover);
}

.back-btn svg {
    width: 13px;
    height: 13px;
}

.theme-toggle {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-dim);
    cursor: pointer;
    transition: color .2s, border-color .2s, background-color .2s;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent-line);
    background: var(--card-bg-hover);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

:root[data-theme="dark"] .icon-sun {
    display: block;
}

:root[data-theme="dark"] .icon-moon {
    display: none;
}

:root[data-theme="light"] .icon-sun {
    display: none;
}

:root[data-theme="light"] .icon-moon {
    display: block;
}

.hairline {
    margin: 16px 0 28px;
    height: 1px;
    background: linear-gradient(90deg,
            transparent, var(--hairline) 12%,
            var(--hairline) 88%, transparent);
}

/* ============================================================
   面包屑导航
   ============================================================ */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    font-size: 12px;
    letter-spacing: .3px;
}

.breadcrumb a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color .2s;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    color: var(--text-faint);
    opacity: .6;
    user-select: none;
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 550;
}

/* ---------- 页面标题区 ---------- */
.page-head {
    margin-bottom: 28px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .3px;
}

.page-title::before {
    content: "";
    width: 4px;
    height: 20px;
    border-radius: 2px;
    background: var(--accent);
}

.page-desc {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

.page-meta {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* ---------- 页面介绍（SEO 文字） ---------- */
.page-intro {
    margin-top: 16px;
    padding: 14px 18px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-dim);
    max-width: 780px;
    border-left: 2px solid var(--accent-line);
    background: var(--card-bg);
    border-radius: 0 8px 8px 0;
    letter-spacing: .2px;
}

.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13px;
    border: 1px dashed var(--card-border);
    border-radius: 12px;
}

/* ============================================================
   榜单列表
   ============================================================ */
.rank-list {
    border-top: 1px solid var(--hairline);
}

.rank-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 13px 8px;
    border-bottom: 1px solid var(--hairline);
    text-decoration: none;
    color: inherit;
    transition: background-color .15s, padding-left .15s;
}

.rank-item:hover {
    background: var(--accent-soft);
    padding-left: 14px;
}

.rank-idx {
    flex-shrink: 0;
    width: 28px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: var(--text-faint);
}

.rank-item:nth-child(1) .rank-idx,
.rank-item:nth-child(2) .rank-idx,
.rank-item:nth-child(3) .rank-idx {
    color: var(--accent);
}

.rank-body {
    flex: 1;
    min-width: 0;
}

.rank-title {
    display: block;
    /* ← 修复：span 默认 inline，ellipsis 不生效 */
    font-size: 14.5px;
    font-weight: 550;
    line-height: 1.4;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-desc {
    display: block;
    /* ← 修复：同上 */
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-right {
    flex-shrink: 0;
    text-align: right;
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
    line-height: 1.45;
    /* ← 优化：HN 分数+作者名两行更紧凑 */
}

.rank-hot {
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
}

.tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    margin-right: 6px;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: 1px;
}

.tag-hot {
    background: rgba(230, 57, 70, .15);
    color: #ff6b6b;
}

.tag-new {
    background: rgba(110, 207, 191, .15);
    color: var(--accent);
}

.tag-top {
    background: rgba(245, 158, 11, .15);
    color: #fbbf24;
}

/* ============================================================
   封面网格
   ============================================================ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.video-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    transition: transform .2s, border-color .2s, box-shadow .2s;
}

.video-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-line);
    box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft);
}

.video-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg,
            var(--accent-soft) 0%,
            rgba(255, 255, 255, 0.02) 100%);
    display: grid;
    place-items: center;
    overflow: hidden;
}

.video-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-cover .cover-placeholder {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    opacity: .35;
}

.video-cover .rank-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    display: grid;
    place-items: center;
    backdrop-filter: blur(6px);
}

.video-card:hover .rank-badge {
    background: var(--accent);
    color: #0a0d12;
}

.video-body {
    padding: 10px 12px 12px;
}

.video-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 39px;
}

.video-meta {
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-faint);
}

.video-stat {
    color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   卡片流
   ============================================================ */
.feed {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feed-card {
    padding: 18px 20px;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: var(--card-bg);
    transition: border-color .2s, background-color .2s, transform .2s;
}

.feed-card:hover {
    border-color: var(--accent-line);
    background: var(--card-bg-hover);
    transform: translateY(-2px);
}

.feed-title {
    font-size: 15px;
    font-weight: 650;
    line-height: 1.5;
    margin-bottom: 8px;
}

.feed-text {
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--text-dim);
}

.feed-meta {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11.5px;
    color: var(--text-faint);
}

.feed-source {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   时间轴
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--hairline);
}

.tl-item {
    position: relative;
    padding: 14px 0 18px;
}

.tl-item::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 20px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
}

.tl-year {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.tl-text {
    font-size: 13.5px;
    line-height: 1.75;
}

.tl-desc {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.7;
}

/* ============================================================
   大图
   ============================================================ */
.hero-image {
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

.hero-image img {
    width: 100%;
    display: block;
}

.hero-caption {
    padding: 18px 20px;
}

.hero-caption-title {
    font-size: 15px;
    font-weight: 650;
    line-height: 1.5;
    margin-bottom: 6px;
}

.hero-caption-sub {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.7;
}

.hero-caption-meta {
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* ============================================================
   农历
   ============================================================ */
.almanac {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    background: var(--card-bg);
    padding: 28px 24px;
}

.alm-hero {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 20px;
}

.alm-day-num {
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
    letter-spacing: -2px;
}

.alm-day-sub {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 2px;
}

.alm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.alm-cell {
    padding: 12px 14px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.01);
}

.alm-cell-k {
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.alm-cell-v {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text);
}

.alm-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 1.5px;
    margin: 22px 0 12px;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
    margin-top: 56px;
    padding-top: 22px;
    border-top: 1px solid var(--hairline);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-faint);
}

.footer a {
    color: var(--accent);
    /* ← 修复：从 --text-dim 改为 --accent，链接变青明显 */
    text-decoration: none;
    border-bottom: 1px dotted var(--accent-line);
    transition: color .2s, border-color .2s;
}

.footer a:hover {
    color: var(--text);
    /* ← hover 反白，交互反馈更强 */
    border-bottom-color: var(--accent);
}

.footer-left {
    line-height: 1.85;
    flex: 1;
    min-width: 0;
}

.footer-left>div+div {
    margin-top: 4px;
}

.footer-right {
    white-space: nowrap;
    padding-top: 1px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 720px) {
    .page {
        padding: 16px 16px 40px;
    }

    .hairline {
        margin: 14px 0 22px;
    }

    .breadcrumb {
        font-size: 11.5px;
        margin-bottom: 16px;
    }

    .page-title {
        font-size: 19px;
    }

    .page-title::before {
        height: 17px;
        width: 3px;
    }

    .page-intro {
        padding: 12px 14px;
        font-size: 12.5px;
        line-height: 1.85;
    }

    .rank-item {
        gap: 12px;
        padding: 11px 6px;
    }

    .rank-idx {
        width: 22px;
        font-size: 13px;
    }

    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .video-title {
        font-size: 12.5px;
        min-height: 36px;
    }

    .feed-card {
        padding: 14px 16px;
    }

    .feed-title {
        font-size: 14px;
    }

    .alm-hero {
        padding-bottom: 16px;
    }

    .alm-day-num {
        font-size: 44px;
    }

    .footer {
        gap: 10px;
        font-size: 11.5px;
    }

    .footer-left {
        flex: 1 1 100%;
    }

    .footer-right {
        flex-shrink: 0;
        padding-top: 0;
        margin-left: auto;
        /* ← 修复：推向右边缘 */
    }
}

@media (max-width: 360px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}