/* Online home dashboard. */
.app-body-online .app-main {
    width: min(1180px, calc(100vw - 28px));
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    gap: clamp(16px, 4vw, 34px);
    align-items: end;
    margin-bottom: 16px;
    padding: clamp(24px, 5vw, 48px);
    overflow: hidden;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: var(--radius);
    box-shadow: var(--app-shadow-sm);
}

.home-kicker {
    margin: 0 0 8px;
    color: var(--app-primary);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.home-hero h1 {
    margin: 0;
    color: var(--app-text);
    font-size: clamp(2rem, 7vw, 4.4rem);
    line-height: 0.96;
    font-weight: 850;
}

.home-lead {
    max-width: 580px;
    margin: 16px 0 0;
    color: var(--app-muted);
    font-size: clamp(1rem, 2vw, 1.08rem);
}

.home-identity {
    min-width: 0;
    padding: 14px 16px;
    background: var(--app-surface-soft);
    border: 1px solid var(--app-line);
    border-left: 3px solid var(--app-primary);
    border-radius: var(--radius);
}

.identity-label {
    display: block;
    margin-bottom: 5px;
    color: var(--app-muted);
    font-size: 0.84rem;
}

.home-identity strong {
    display: block;
    overflow: hidden;
    color: var(--app-text);
    font-size: 1.12rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 本周热门：Hero 下横滑曲绘条 */
.home-hot {
    margin-bottom: 16px;
    padding: 14px 0 12px;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: var(--radius);
    box-shadow: var(--app-shadow-sm);
    overflow: hidden;
    max-width: 100%;
}

.home-hot-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px 10px;
}

.home-hot-tabs {
    display: inline-flex;
    gap: 6px;
    flex: 0 0 auto;
}

.home-hot-tab {
    min-height: 28px;
    padding: 0 12px;
    color: var(--app-muted);
    background: var(--app-surface-soft);
    border: 1px solid var(--app-line);
    border-radius: 99px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 750;
    cursor: pointer;
}

.home-hot-tab.is-active {
    color: var(--app-primary);
    border-color: var(--app-primary);
    background: var(--app-primary-soft);
}

.home-hot-title {
    color: var(--app-text);
    font-size: 1.02rem;
    font-weight: 850;
}

.home-hot-sub {
    display: inline-block;
    margin-left: 8px;
    color: var(--app-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.home-hot-viewport {
    position: relative;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.home-hot-viewport::-webkit-scrollbar {
    height: 6px;
}

.home-hot-viewport::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--app-primary) 35%, var(--app-line));
    border-radius: 99px;
}

.home-hot-viewport::before,
.home-hot-viewport::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 6px;
    width: 28px;
    pointer-events: none;
    z-index: 1;
}

.home-hot-viewport::before {
    left: 0;
    background: linear-gradient(90deg, var(--app-surface), transparent);
}

.home-hot-viewport::after {
    right: 0;
    background: linear-gradient(270deg, var(--app-surface), transparent);
}

.home-hot-rail {
    display: flex;
    gap: 12px;
    width: max-content;
    max-width: none;
    padding: 2px 16px 6px;
}

.home-hot-empty {
    min-width: min(100%, 280px);
    padding: 28px 12px;
    color: var(--app-muted);
    font-size: 0.88rem;
    text-align: center;
}

.home-hot-card {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: clamp(112px, 28vw, 148px);
    color: inherit;
    text-decoration: none;
    scroll-snap-align: start;
}

.home-hot-card:hover .home-hot-jacket,
.home-hot-card:focus-visible .home-hot-jacket {
    border-color: var(--app-primary);
    transform: translateY(-2px);
    box-shadow: var(--app-shadow, 0 8px 20px rgba(0, 0, 0, 0.14));
}

.home-hot-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 1.1em;
}

.home-hot-rank {
    color: var(--app-text);
    font-size: 0.92rem;
    font-weight: 850;
    font-variant-numeric: tabular-nums;
}

.home-hot-trend {
    font-size: 0.74rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.home-hot-trend.is-up {
    color: #2f8f57;
}

.home-hot-trend.is-down {
    color: #e05a72;
}

.home-hot-trend.is-same,
.home-hot-trend.is-new {
    color: var(--app-muted);
}

.home-hot-jacket {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--app-surface-soft);
    border: 1px solid var(--app-line);
    border-radius: 10px;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

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

.home-hot-name {
    overflow: hidden;
    color: var(--app-text);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-hot-plays {
    color: var(--app-muted);
    font-size: 0.7rem;
    font-weight: 600;
}

@media (max-width: 640px) {
    .home-hot-head {
        padding: 0 12px 8px;
    }

    .home-hot-rail {
        gap: 10px;
        padding: 2px 12px 6px;
    }

    .home-hot-viewport::before,
    .home-hot-viewport::after {
        width: 18px;
    }
}

.home-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: var(--radius);
    box-shadow: var(--app-shadow-sm);
}

.home-search {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 0 12px;
    background: var(--app-surface-soft);
    border: 1px solid var(--app-line);
    border-radius: var(--radius);
}

.home-search span {
    color: var(--app-primary);
    font-size: 1.05rem;
    line-height: 1;
}

.home-search input {
    width: 100%;
    padding: 0;
    color: var(--app-text);
    background: transparent;
    border: 0;
    outline: 0;
}

.home-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.home-filters .filter-chip {
    min-height: 36px;
    padding: 7px 12px;
    color: var(--app-muted);
    background: var(--app-surface-soft);
    border: 1px solid var(--app-line);
    border-radius: var(--radius);
}

.home-filters .filter-chip:hover,
.home-filters .filter-chip.is-active {
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-color: var(--app-primary);
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.home-card {
    --mx: 50%;
    --my: 50%;
    position: relative;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 9px;
    min-height: 150px;
    padding: 17px;
    overflow: hidden;
    color: var(--app-text);
    text-decoration: none;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: var(--radius);
    box-shadow: var(--app-shadow-sm);
    transform: none;
    opacity: 1;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.24s ease;
}

.home-grid.is-enhanced .home-card {
    transform: translateY(8px);
    opacity: 0;
}

.home-grid.is-enhanced .home-card.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.home-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--app-primary);
}

.home-card::after {
    content: ">";
    position: absolute;
    right: 16px;
    bottom: 12px;
    color: var(--app-primary);
    font-weight: 800;
    transition: transform 0.16s ease;
}

.home-card:hover,
.home-card:focus-visible {
    background: var(--app-primary-soft);
    border-color: var(--app-primary);
    transform: translateY(-2px);
}

.home-card:hover::after,
.home-card:focus-visible::after {
    transform: translateX(3px);
}

.card-tag {
    width: fit-content;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border: 1px solid color-mix(in srgb, var(--app-primary) 35%, var(--app-line));
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.home-card strong {
    padding-right: 24px;
    color: var(--app-text);
    font-size: 1.1rem;
    line-height: 1.25;
}

.home-card span:last-child {
    align-self: end;
    padding-right: 22px;
    color: var(--app-muted);
    font-size: 0.92rem;
}

.home-card.is-hidden {
    display: none;
}

.home-empty {
    margin: 18px 0 0;
    color: var(--app-muted);
}

.external-link-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(8px);
}

.external-link-dialog {
    width: min(420px, 100%);
    padding: 22px;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-left: 3px solid var(--app-primary);
    border-radius: var(--radius);
    box-shadow: var(--app-shadow);
}

.external-link-dialog h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
}

.external-link-dialog p {
    margin: 0 0 18px;
    color: var(--app-muted);
}

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

@media (max-width: 760px) {
    .home-hero,
    .home-toolbar {
        grid-template-columns: 1fr;
    }

    .home-hero {
        align-items: start;
        padding: 18px 16px;
    }

    .home-hero h1 {
        font-size: clamp(1.8rem, 10vw, 2.6rem);
        line-height: 1.12;
        writing-mode: horizontal-tb;
        overflow-wrap: anywhere;
    }

    .home-lead {
        max-width: none;
        line-height: 1.55;
    }

    .home-filters {
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-card,
    .home-card::after {
        transition: none;
    }
}
