@import url('theme.css');
@import url('icons.css');

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
    position: relative;
}

.site-header,
.main-content,
.site-footer {
    position: relative;
    z-index: 1;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color var(--transition);
}

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

.hidden {
    display: none !important;
}

/* ===== Background ===== */
.page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 80% 60% at 8% -5%, var(--bg-mesh-1) 0%, transparent 55%),
        radial-gradient(ellipse 70% 55% at 95% 45%, var(--bg-mesh-2) 0%, transparent 50%),
        radial-gradient(ellipse 60% 45% at 50% 105%, var(--bg-mesh-3) 0%, transparent 45%);
    transition: background-color var(--transition);
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: var(--header-h);
    padding: 0 var(--page-gutter);
    background: color-mix(in srgb, var(--bg-card) 92%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--border) 80%, transparent);
}

.header-inner {
    width: 100%;
    min-height: var(--header-h);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.site-title {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    max-width: min(240px, 48%);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
    min-width: 0;
    overflow: visible;
}

.site-title a,
.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition);
    line-height: 0;
    flex-shrink: 0;
    cursor: pointer;
}

.site-brand .site-logo,
.site-brand .site-logo--svg,
.site-brand .site-logo-inline,
.site-brand .site-logo-fallback {
    pointer-events: none;
}

.site-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-logo {
    display: block;
    height: 22px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    flex-shrink: 0;
}

.site-logo--svg {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    height: 22px;
    width: auto;
    max-width: 140px;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--text-primary);
    transition: color var(--transition);
    line-height: 0;
}

.site-logo--svg .site-logo-inline,
.site-logo--svg .site-logo-fallback {
    display: block;
    height: 22px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    vertical-align: middle;
    pointer-events: none;
}

.site-logo--svg .site-logo-inline {
    overflow: hidden;
}

.site-brand:hover .site-logo--svg {
    color: var(--accent-light);
}

.site-brand:hover {
    color: var(--accent-light);
}

.header-actions .theme-switch {
    flex-shrink: 0;
}

/* ===== Main Content ===== */
.main-content {
    width: 100%;
    margin: 0;
    padding: 28px var(--page-gutter) 32px;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 0 0 32px;
}

.hero.hero--subtitle-only .site-subtitle {
    margin-top: 0;
}

.hero.hero--avatar-only .avatar-wrap {
    margin-bottom: 0;
}

.avatar-wrap {
    width: 88px;
    height: 88px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--bg-card);
    transition: all var(--transition);
}

.avatar-wrap:hover {
    border-color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.avatar-placeholder svg {
    width: 40px;
    height: 40px;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    transition: color var(--transition);
    margin-top: 4px;
}

/* ===== Search ===== */
.search-box {
    position: relative;
}

.header-search {
    --search-w: 120px;
    --search-w-focus: 240px;
    width: var(--search-w);
    flex-shrink: 0;
    transition: width var(--transition);
    overflow: hidden;
}

.header-search:focus-within,
.header-search.has-value {
    width: var(--search-w-focus);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition);
}

.header-search:focus-within .search-icon {
    color: var(--accent);
}

.search-box input {
    width: 100%;
    height: var(--header-control-h);
    padding: 0 12px 0 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.8125rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ===== Item Grid ===== */
/* 8 列基准：各比例约为原 4 列布局的一半尺寸 */
/* 1:1 小方形 | 2:1 横长条 | 1:2 竖长条 | 2:2 大方形 */
.item-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 8), minmax(0, 1fr));
    grid-auto-rows: var(--grid-cell-size, 96px);
    gap: 12px;
    width: 100%;
}

.item-grid-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    opacity: 0;
    transform: translateY(12px);
    animation: cardIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.item-card-stack {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    container-type: size;
    container-name: item-card;
}

.item-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
}

.item-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    cursor: pointer;
}

.item-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.item-card.is-pinned {
    border-color: rgba(255, 190, 11, 0.4);
}

.item-card-cover {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
}

.item-card-cover .card-cover-blur {
    position: absolute;
    inset: -10%;
    z-index: 0;
    width: 120%;
    height: 120%;
    max-width: none;
    object-fit: cover;
    filter: blur(22px) saturate(1.12);
    transform: scale(1.04);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.55s ease;
}

.item-card-cover .card-cover-blur.is-hidden {
    opacity: 0;
}

.item-card-cover:has(.card-cover-img:not(.is-img-showing))::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--text-muted) 12%, var(--bg-card)) 0%,
        color-mix(in srgb, var(--text-muted) 18%, var(--bg-secondary)) 50%,
        color-mix(in srgb, var(--text-muted) 14%, var(--bg-primary)) 100%
    );
    backdrop-filter: blur(10px) saturate(1.08);
    -webkit-backdrop-filter: blur(10px) saturate(1.08);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-muted) 8%, transparent);
    opacity: 0.88;
}

.item-card-cover:has(.card-cover-img.is-img-showing)::before {
    content: none;
}

.item-card-cover img,
.item-card-cover .card-cover-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-card-cover .card-cover-img {
    z-index: 1;
    opacity: 0;
    transform: scale(1.06);
    filter: blur(22px) saturate(1.1);
}

/* 图片已加载：立刻显示模糊态，并缓慢过渡到清晰（无呼吸） */
.item-card-cover .card-cover-img.is-img-showing {
    opacity: 1;
    transition:
        opacity 0.35s ease,
        filter 2.4s cubic-bezier(0.22, 1, 0.36, 1),
        transform 2.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.item-card-cover .card-cover-img.is-img-loaded {
    filter: blur(0) saturate(1);
    transform: scale(1);
}

.item-card:hover .item-card-cover .card-cover-img.is-img-loaded {
    transform: scale(1.04);
    transition: transform 0.45s ease;
}

.item-card-cover-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-grid-cell[data-span="1x1"] .item-card-cover-placeholder .item-cover-letter {
    font-size: 1rem;
}

.item-card-cover-placeholder .item-cover-letter {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
    opacity: 0.5;
}

.item-card-title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 20px 8px 8px;
    max-height: 36%;
    box-sizing: border-box;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.35) 55%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity var(--transition), transform var(--transition);
    pointer-events: none;
    overflow: hidden;
}

.item-card:hover .item-card-title-overlay {
    opacity: 1;
    transform: translateY(0);
}

.item-card-title {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: clamp(0.625rem, 2.8cqw, 0.875rem);
    font-weight: 600;
    color: #fff;
    line-height: 1.25;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-grid-cell[data-span="1x1"] .item-card-title-overlay {
    padding: 14px 5px 5px;
    max-height: 32%;
}

.item-grid-cell[data-span="1x1"] .item-card-title {
    font-size: clamp(0.55rem, 6cqw, 0.7rem);
    line-height: 1.2;
}

.item-grid-cell[data-span="2x1"] .item-card-title-overlay,
.item-grid-cell[data-span="1x2"] .item-card-title-overlay {
    max-height: 40%;
}

.item-grid-cell[data-span="2x2"] .item-card-title {
    font-size: 0.95rem;
}

/* 卡片圆形/胶囊浮层：统一毛玻璃 */
.card-glass-badge {
    pointer-events: none;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(12px) saturate(1.25);
    -webkit-backdrop-filter: blur(12px) saturate(1.25);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
}

.pin-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 20px;
    color: var(--pin-color);
    font-weight: 500;
    line-height: 1.2;
    max-width: calc(100% - 52px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.type-badge,
.card-layout-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 5px;
    border: none;
    border-radius: 4px;
    font-family: var(--font);
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
}

.type-badge {
    padding: 0 6px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--accent-hot) 78%, transparent);
    color: #fff;
}

.card-layout-trigger {
    min-width: 24px;
    padding: 0 4px;
    color: #fff;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.card-layout-trigger {
    pointer-events: auto;
}

.card-layout-trigger:hover {
    background: color-mix(in srgb, var(--accent) 72%, rgba(255, 255, 255, 0.12));
    border-color: rgba(255, 255, 255, 0.35);
}

.item-card-corner {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 12;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
    max-width: min(58%, 120px);
    line-height: 0;
    pointer-events: none;
}

.item-card-corner > .type-badge,
.item-card-corner > .card-layout-trigger {
    pointer-events: auto;
    align-self: center;
    justify-self: center;
}

.item-card-corner > .card-layout-menu {
    pointer-events: auto;
}

.type-badge--media {
    background: var(--accent-light);
}

.type-badge--link {
    background: var(--accent-warm);
}

.type-badge--game {
    background: #6366f1;
}

.item-card-cover video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.item-card-douyin-cover {
    pointer-events: none;
}

.item-card-cover-douyin {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    overflow: hidden;
}

.item-card-douyin-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.douyin-cover-status {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    padding: 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.douyin-cover-spinner {
    width: 28px;
    height: 28px;
    border-width: 2px;
}

.douyin-cover-status--error {
    color: #f87171;
}

.item-grid-cell--douyin .item-card-cover:has(.card-cover-img:not(.is-img-showing))::before {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--text-muted) 16%, var(--bg-card)) 0%,
        color-mix(in srgb, var(--text-muted) 24%, var(--bg-secondary)) 100%
    );
}

@media (prefers-reduced-motion: reduce) {
    .item-card-cover:has(.card-cover-img:not(.is-img-showing))::before {
        opacity: 0.85;
    }

    .item-card-cover .card-cover-img.is-img-showing {
        transition: opacity 0.2s ease;
        filter: none;
        transform: none;
    }
}

.media-play-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(26px, 20cqw, 40px);
    height: clamp(26px, 20cqw, 40px);
    border-radius: 50%;
    z-index: 2;
}

.media-play-badge::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-40%, -50%);
    border-style: solid;
    border-width: clamp(5px, 1.8cqw, 8px) 0 clamp(5px, 1.8cqw, 8px) clamp(9px, 3.2cqw, 13px);
    border-color: transparent transparent transparent #fff;
}

/* 小尺寸卡片：角标 / 置顶 / 播放按钮随容器缩放 */
@container item-card (max-width: 200px), (max-height: 200px) {
    .pin-badge {
        top: 5px;
        left: 5px;
        font-size: 0.55rem;
        padding: 2px 5px;
        max-width: calc(100% - 44px);
    }

    .item-card-corner {
        top: 5px;
        right: 5px;
        gap: 2px;
        max-width: min(54%, 96px);
    }

    .type-badge,
    .card-layout-trigger {
        height: 18px;
        min-height: 18px;
        max-height: 18px;
        font-size: 0.55rem;
        padding: 0 4px;
    }

    .card-layout-trigger {
        min-width: 22px;
    }

    .item-card-title-overlay {
        padding: 16px 6px 6px;
        max-height: 34%;
    }

    .douyin-cover-status {
        font-size: 0.65rem;
        padding: 6px;
        gap: 6px;
    }

    .douyin-cover-spinner {
        width: 22px;
        height: 22px;
    }
}

@container item-card (max-width: 140px), (max-height: 140px) {
    .pin-badge {
        top: 4px;
        left: 4px;
        font-size: 0.5rem;
        padding: 1px 4px;
        max-width: calc(100% - 36px);
    }

    .item-card-corner {
        top: 4px;
        right: 4px;
        max-width: min(50%, 72px);
    }

    .type-badge,
    .card-layout-trigger {
        height: 16px;
        min-height: 16px;
        max-height: 16px;
        font-size: 0.5rem;
        padding: 0 3px;
        border-radius: 3px;
    }

    .type-badge {
        border-radius: 10px;
        padding: 0 4px;
    }

    .card-layout-trigger {
        min-width: 20px;
    }

    .item-card-title-overlay {
        padding: 12px 4px 4px;
        max-height: 30%;
    }

    .item-card-cover-placeholder .item-cover-letter {
        font-size: 0.85rem;
    }

    .douyin-cover-status {
        font-size: 0.55rem;
        padding: 4px;
        gap: 4px;
    }

    .douyin-cover-spinner {
        width: 18px;
        height: 18px;
    }

    .pin-badge {
        font-size: 0;
        padding: 2px 4px;
    }

    .pin-badge::before {
        content: '顶';
        font-size: 0.5rem;
        line-height: 1.2;
    }
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 600;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.lightbox-content {
    max-width: min(960px, 100%);
    max-height: calc(100vh - 80px);
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: calc(100vh - 80px);
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.lightbox-loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-width: 120px;
    min-height: 120px;
    padding: 32px;
}

.lightbox-loading-wrap--overlay {
    position: absolute;
    inset: 0;
    min-height: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-sm);
    z-index: 1;
}

.lightbox-video-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.22);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lightbox-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes lightbox-spin {
    to { transform: rotate(360deg); }
}

.lightbox-loading-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.lightbox-loading,
.lightbox-error {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    padding: 24px;
    text-align: center;
}

.item-card-trigger {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    text-align: inherit;
    font: inherit;
    color: inherit;
}

.item-card-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.card-layout-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 72px;
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: var(--shadow);
    flex-direction: column;
    gap: 2px;
    pointer-events: auto;
}

.card-layout-menu.is-open {
    display: flex;
}

.card-layout-option {
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition), color var(--transition);
}

.card-layout-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.card-layout-option.is-active {
    background: var(--accent-glow);
    color: var(--accent-light);
}

@keyframes cardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.list-section.is-loading .item-list {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== Loading & Empty ===== */
.loading-state {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.error-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.error-state p {
    margin-bottom: 16px;
}

.btn-retry {
    padding: 10px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-retry:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
}

.page-btn--nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 40px;
}

.page-btn-icon {
    display: block;
    width: 18px;
    height: 18px;
}

.page-btn-icon--next {
    transform: scaleX(-1);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 8px;
}

/* ===== Footer ===== */
.site-footer {
    width: 100%;
    margin: 0;
    padding: 40px var(--page-gutter) 32px;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
    margin-bottom: 16px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.footer-link-icon {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

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

.footer-text,
.icp-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ===== Article Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.25s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

body.modal-open {
    overflow: hidden;
}

/* ===== Poki 游戏弹窗 ===== */
.game-modal-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: min(960px, calc(100vw - 32px));
    max-height: 92vh;
    margin: auto;
}

.game-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: var(--shadow);
}

.game-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.game-modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.game-modal-fs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.game-modal-fs:hover,
.game-modal-fs.is-active {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.game-modal-external {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--accent-light);
    text-decoration: none;
}

.game-modal-body:fullscreen,
.game-modal-body:-webkit-full-screen {
    min-height: 100vh;
    width: 100%;
    background: #000;
}

.game-modal-body:fullscreen .game-modal-frame,
.game-modal-body:-webkit-full-screen .game-modal-frame {
    position: absolute;
    inset: 0;
}

.game-modal-external:hover {
    text-decoration: underline;
}

.game-modal-body {
    position: relative;
    flex: 1 1 auto;
    min-height: min(70vh, 520px);
    background: #0a0a0f;
}

.game-modal-loading,
.game-modal-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
    padding: 24px;
    text-align: center;
}

.game-modal-error {
    color: #f87171;
}

.game-modal-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.game-modal-frame.hidden,
.game-modal-loading.hidden,
.game-modal-error.hidden {
    display: none;
}

.game-modal-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.game-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.item-card-cover-placeholder--game {
    background: linear-gradient(145deg, #1e1b4b, #312e81);
}

.item-card-cover-placeholder--game .item-cover-letter {
    opacity: 0.85;
    color: #c7d2fe;
}

.gamepad-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: clamp(28px, 18cqw, 42px);
    height: clamp(28px, 18cqw, 42px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 2;
}

.gamepad-badge .icon {
    display: block;
    width: 58%;
    height: 58%;
}

.article-modal-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    margin: auto;
}

.article-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 28px 24px 24px;
    box-shadow: var(--shadow);
}

.article-modal-inner {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.article-modal-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.article-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.article-modal-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.article-modal-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.article-modal-time {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.article-modal-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 20px;
    line-height: 1.6;
}

.article-modal-body {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.75;
}

.article-modal-body p {
    margin: 0.75em 0;
    text-indent: 2em;
}

.article-modal-body p:first-child {
    margin-top: 0;
}

.article-modal-body p:last-child {
    margin-bottom: 0;
}

.article-modal-body h2,
.article-modal-body h3,
.article-modal-body h4 {
    margin: 1.25em 0 0.5em;
    font-weight: 600;
    line-height: 1.35;
}

.article-modal-body > div {
    margin: 0.75em 0;
    text-indent: 2em;
}

.article-modal-body ul,
.article-modal-body ol {
    margin: 0.75em 0;
    padding-left: 1.4em;
}

.article-modal-body a {
    color: var(--accent-light);
    text-decoration: underline;
}

.article-modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 0.75em 0;
}

.article-modal-body blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
}

.article-modal-body img,
.article-modal-body .article-image,
.article-modal-body .article-video,
.article-modal-body video {
    display: block;
    max-width: 100%;
    margin: 1em 0;
    border-radius: var(--radius-sm);
}

.article-modal-body video,
.article-modal-body .article-video {
    background: #000;
}

.article-modal-body pre {
    margin: 1em 0;
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.article-modal-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}

.article-modal-body pre code {
    font-size: 0.85em;
    line-height: 1.6;
}

.article-modal-body p code {
    padding: 0.15em 0.4em;
    border-radius: 4px;
    background: var(--bg-input);
}

.article-modal-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5em 0;
}

.article-modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9rem;
}

.article-modal-body th,
.article-modal-body td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
}

.article-modal-body th {
    background: var(--bg-card);
}

.article-modal-body del {
    opacity: 0.75;
}

.article-modal-link {
    display: inline-block;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--accent-light);
}

.article-modal-link:hover {
    color: var(--accent);
}

/* ===== Link Confirm Modal ===== */
.link-confirm {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: var(--shadow);
}

.link-confirm-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0 0 10px;
}

.link-confirm-url {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
    word-break: break-all;
    margin: 0 0 22px;
}

.link-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.link-confirm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.link-confirm-btn--ghost {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.link-confirm-btn--ghost:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.link-confirm-btn--primary {
    background: var(--accent);
    color: #fff;
}

.link-confirm-btn--primary:hover {
    background: var(--accent-light);
}

/* ===== Fade In ===== */
.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Page Transition ===== */
.page-transition-enter {
    animation: pageEnter 0.4s ease forwards;
}

@keyframes pageEnter {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .item-list {
        gap: 12px;
    }
}

@media (max-width: 768px) {
    :root {
        --page-gutter: 48px;
    }
}

@media (max-width: 480px) {
    :root {
        --page-gutter: 16px;
    }

    .main-content {
        padding-bottom: 24px;
    }

    .item-list {
        gap: 10px;
    }

    .item-card-corner {
        max-width: min(52%, 88px);
    }

    .pin-badge {
        max-width: calc(100% - 40px);
    }

    .site-header {
        padding: 0 var(--page-gutter);
    }

    .site-title {
        max-width: min(200px, 45%);
        overflow: visible;
    }

    .header-search {
        --search-w: 88px;
        --search-w-focus: min(200px, calc(100vw - 148px));
    }

    .search-box input {
        font-size: 0.8rem;
        padding-left: 32px;
    }

    .search-icon {
        left: 10px;
        width: 14px;
        height: 14px;
    }
}
