:root {
    --bg: #080a0f;
    --panel: #10141d;
    --panel-2: #151b27;
    --line: #222a3a;
    --line-soft: rgba(255, 255, 255, 0.07);
    --text: #e8edf7;
    --muted: #8b95a9;
    --muted-2: #667085;
    --gold: #f5b642;
    --gold-soft: rgba(245, 182, 66, 0.14);
    --teal: #2dd4bf;
    --teal-soft: rgba(45, 212, 191, 0.13);
    --blue: #64b5f6;
    --blue-soft: rgba(100, 181, 246, 0.13);
    --purple: #c084fc;
    --purple-soft: rgba(192, 132, 252, 0.13);
    --red: #f87171;
    --radius: 16px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(1100px 520px at 12% -8%, rgba(245, 182, 66, 0.10), transparent 62%),
        radial-gradient(900px 480px at 95% 0%, rgba(45, 212, 191, 0.07), transparent 58%),
        var(--bg);
    color: var(--text);
    font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: inherit; }

button, input { font: inherit; }

.app {
    width: min(1420px, 100%);
    margin: 0 auto;
    padding: 20px 22px 30px;
}

/* top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    text-decoration: none;
    min-width: 0;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #1b1406;
    background: linear-gradient(145deg, #ffd479, #f5a623);
    box-shadow: 0 8px 24px rgba(245, 166, 35, 0.24);
    flex: 0 0 auto;
}

.brand-mark svg { width: 27px; height: 27px; display: block; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
    font-size: 1.28rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
}
.brand-text small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    white-space: nowrap;
}

.top-actions { display: flex; gap: 9px; flex: 0 0 auto; }
a.ghost { display: inline-flex; align-items: center; text-decoration: none; }

.ghost {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    border-radius: 11px;
    padding: 9px 14px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.ghost:hover {
    border-color: rgba(245, 182, 66, 0.45);
    background: rgba(245, 182, 66, 0.07);
}

.ghost.on {
    color: #1b1406;
    background: var(--gold);
    border-color: var(--gold);
    font-weight: 650;
}

.ghost:disabled { opacity: 0.55; cursor: default; }

/* status */
.statusbar {
    position: relative;
    display: grid;
    grid-template-columns: auto auto minmax(260px, 1fr);
    grid-template-areas:
        "main metrics line"
        "last last last";
    align-items: center;
    gap: 10px 18px;
    padding: 14px 18px;
    margin-bottom: 20px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
}

.status-main {
    grid-area: main;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted-2);
    box-shadow: 0 0 0 4px rgba(139, 149, 169, 0.10);
    flex: 0 0 auto;
}

.dot.live {
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12), 0 0 14px rgba(45, 212, 191, 0.55);
}

.dot.off { background: var(--red); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.10); }

.latency-metrics {
    grid-area: metrics;
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.metric {
    padding: 4px 9px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.16);
    color: var(--muted);
    font-size: 0.73rem;
    white-space: nowrap;
}

.metric b {
    color: var(--gold);
    font-weight: 650;
    margin-left: 3px;
}

.latency-line {
    grid-area: line;
    color: var(--muted-2);
    font-size: 0.76rem;
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.last-event {
    grid-area: last;
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
    color: var(--muted);
    font-size: 0.77rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-event b { color: var(--text); font-weight: 600; }

/* layout */
.layout {
    display: grid;
    grid-template-columns: 228px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.search {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--muted);
}

.search svg { width: 17px; height: 17px; flex: 0 0 auto; }

.search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.86rem;
}

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

.channel-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.channel-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.channel-btn:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

.channel-btn.active {
    color: var(--text);
    background: var(--gold-soft);
    border-color: rgba(245, 182, 66, 0.28);
}

.channel-btn .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-btn .count {
    font-size: 0.7rem;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
}

.channel-btn.active .count { color: var(--gold); }

.side-note {
    margin: 2px 2px 0;
    color: var(--muted-2);
    font-size: 0.72rem;
    line-height: 1.7;
}

/* feed */
.feed { min-width: 0; }

.feed-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 2px 0 16px;
}

.feed-head h1 {
    margin: 0;
    font-size: 1.22rem;
    letter-spacing: 0.01em;
}

.feed-head p {
    margin: 4px 0 0;
    color: var(--muted-2);
    font-size: 0.76rem;
}

.feed-count {
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.feed-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 14px;
}

.post-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 17px 17px 14px;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    border-color: rgba(245, 182, 66, 0.35);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
}

.post-card.new {
    animation: new-pulse 1.8s ease;
}

@keyframes new-pulse {
    0% { border-color: rgba(245, 182, 66, 0.85); box-shadow: 0 0 0 1px rgba(245, 182, 66, 0.4); }
    100% { border-color: var(--line-soft); box-shadow: none; }
}

.post-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 9px;
}

.channel-badge {
    display: inline-flex;
    align-items: center;
    max-width: calc(100% - 88px);
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    color: var(--gold);
    background: var(--gold-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-badge[data-channel="vip115hot"] { color: var(--purple); background: var(--purple-soft); }
.channel-badge[data-channel="aliyun4kmovies"] { color: var(--teal); background: var(--teal-soft); }
.channel-badge[data-channel="bdwpzhpd"] { color: var(--blue); background: var(--blue-soft); }
.channel-badge[data-channel="leoziyuan"] { color: #f9a8d4; background: rgba(249, 168, 212, 0.12); }

.post-time {
    color: var(--muted-2);
    font-size: 0.7rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.post-card h2 {
    margin: 0 0 8px;
    font-size: 0.98rem;
    line-height: 1.5;
    font-weight: 650;
    color: #f2f6fc;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 9px;
}

.badge {
    padding: 2px 7px;
    border: 1px solid var(--line-soft);
    border-radius: 6px;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.14);
    font-size: 0.66rem;
    white-space: nowrap;
}

.badge.gold { color: var(--gold); border-color: rgba(245, 182, 66, 0.22); }
.badge.teal { color: var(--teal); border-color: rgba(45, 212, 191, 0.22); }

.badge.rating-douban,
.badge.rating-imdb {
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}

.badge.rating-douban {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.32);
    background: rgba(34, 197, 94, 0.12);
}

.badge.rating-imdb {
    color: #f5c518;
    border-color: rgba(245, 197, 24, 0.32);
    background: rgba(245, 197, 24, 0.1);
}

.badge.rating-douban b,
.badge.rating-imdb b {
    font-weight: 750;
}

a.badge.rating-douban:hover,
a.badge.rating-imdb:hover {
    filter: brightness(1.18);
    border-color: currentColor;
}

.excerpt {
    margin: 0 0 13px;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    flex: 1;
}

.post-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 11px;
    border-top: 1px solid var(--line-soft);
    color: var(--muted-2);
    font-size: 0.7rem;
}

.open-hint { color: var(--gold); opacity: 0.8; }

.empty {
    padding: 80px 20px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

.empty-icon { font-size: 2rem; margin-bottom: 10px; }
.empty p { margin: 0 0 6px; color: var(--text); }
.empty small { color: var(--muted-2); }

.more {
    display: block;
    width: 100%;
    margin: 18px 0 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--muted);
    cursor: pointer;
}

.more:hover { color: var(--text); border-color: rgba(245, 182, 66, 0.35); }

.pan-search {
    display: block;
    width: fit-content;
    margin: 0 0 14px;
    padding: 10px 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--muted);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.pan-search:hover { color: var(--text); border-color: rgba(245, 182, 66, 0.35); }

.footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 38px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
    color: var(--muted-2);
    font-size: 0.72rem;
}

/* reader */
.reader-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
}

.reader {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    width: min(760px, 94vw);
    padding: 26px 30px 28px;
    overflow-y: auto;
    background: linear-gradient(180deg, #10151f, #0b0e15 58%);
    border-left: 1px solid rgba(245, 182, 66, 0.18);
    box-shadow: var(--shadow);
}

body.reader-open { overflow: hidden; }

.reader-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.reader-head .channel-badge { max-width: none; }

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.icon-btn:hover { color: var(--text); border-color: rgba(245, 182, 66, 0.4); }

.reader h2 {
    margin: 0 0 12px;
    font-size: 1.42rem;
    line-height: 1.42;
    letter-spacing: 0.01em;
    word-break: break-word;
}

.reader-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.reader-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.reader-links:empty { display: none; }

.provider-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    border: 1px solid rgba(245, 182, 66, 0.25);
    border-radius: 9px;
    color: var(--gold);
    background: var(--gold-soft);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
}

.provider-link:hover { border-color: rgba(245, 182, 66, 0.6); }

.reader-body {
    padding-top: 17px;
    border-top: 1px solid var(--line-soft);
    color: #c8d2e1;
    font-size: 0.92rem;
    line-height: 1.85;
    word-break: break-word;
}

.reader-loading { color: var(--muted); }

.reader-body a {
    color: var(--gold);
    text-decoration: none;
    border-bottom: 1px dotted rgba(245, 182, 66, 0.4);
}

.reader-body a:hover { border-bottom-style: solid; }

.reader-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
}

.primary {
    display: inline-flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 10px;
    background: var(--gold);
    color: #1b1406;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
}

.primary:hover { background: #ffd36a; }

.reader-time { color: var(--muted-2); font-size: 0.72rem; }

/* toast */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 80;
    transform: translateX(-50%);
    max-width: min(560px, 90vw);
    padding: 10px 16px;
    border: 1px solid rgba(245, 182, 66, 0.28);
    border-radius: 11px;
    background: rgba(16, 20, 29, 0.96);
    color: var(--text);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* responsive */
@media (max-width: 980px) {
    .statusbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "main metrics"
            "line line"
            "last last";
    }
    .latency-line { text-align: left; white-space: normal; }
    .layout { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
    .feed-list { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .app { padding: 14px 14px 24px; }
    .topbar { align-items: flex-start; }
    .brand-text strong { font-size: 1.12rem; }
    .brand-text small { font-size: 0.58rem; letter-spacing: 0.12em; }
    .top-actions { gap: 6px; }
    .ghost { padding: 8px 10px; font-size: 0.78rem; }
    .statusbar {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main"
            "metrics"
            "line"
            "last";
        padding: 13px 14px;
    }
    .latency-metrics { gap: 6px; }
    .metric { font-size: 0.68rem; }
    .layout { display: block; }
    .sidebar {
        position: static;
        margin-bottom: 16px;
    }
    .channel-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .channel-nav::-webkit-scrollbar { display: none; }
    .channel-btn {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 8px 11px;
    }
    .channel-btn .count { margin-left: 7px; }
    .side-note { display: none; }
    .feed-head { margin-top: 0; }
    .feed-list { grid-template-columns: 1fr; }
    .reader {
        width: 100%;
        padding: 20px 18px 24px;
        border-left: 0;
    }
    .reader h2 { font-size: 1.2rem; }
    .footer { flex-direction: column; gap: 6px; }
}
