/* Let iOS know this page supports both light & dark */
:root {
    color-scheme: light dark;
}

/* Default (light mode) */
:root {
    --bg: #ffffff;
    --text: #111111;
    --muted: #444444;
    --title: #111111;
    --subtitle: #444444;
    --link: #0b57d0;
    --hot: #e65100;
    --score: #1a7f37;
    --comments: #57606a;
    --hot-bg: #fff3e0;
    --hot-border: #ffe0b2;
    --score-bg: #dafbe1;
    --score-border: #aceebb;
    --comments-bg: #eef1f4;
    --comments-border: #d0d7de;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0f14;
        --text: #e8e8e8;
        --muted: #b5b5b5;
        --title: #ffffff;
        --subtitle: #cfcfcf;
        --link: #7ab7ff;
        --hot: #ff9e40;
        --score: #56d364;
        --comments: #8b949e;
        --hot-bg: rgba(230,81,0,0.18);
        --hot-border: rgba(230,81,0,0.30);
        --score-bg: rgba(26,127,55,0.18);
        --score-border: rgba(26,127,55,0.30);
        --comments-bg: rgba(139,148,158,0.15);
        --comments-border: rgba(139,148,158,0.25);
    }
}

/* Apply */
html,
body {
    background: var(--bg);
    color: var(--text);
}

h1,
h2,
h3 {
    color: var(--title);
}

.subtitle,
.hn-subtitle,
.page-subtitle,
p.subtitle {
    color: var(--subtitle);
}

a {
    color: var(--link);
}

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

:root {
    --hn-maxw: 920px;
    --hn-radius: 16px;
    --hn-border: rgba(0, 0, 0, 0.10);
    --hn-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
    --hn-muted: rgba(0, 0, 0, 0.62);
    --hn-fg: rgba(0, 0, 0, 0.92);
    --hn-card-bg: rgba(255, 255, 255, 0.92);

    --hn-sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    --hn-serif: "Source Serif 4", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --hn-border: rgba(255, 255, 255, 0.14);
        --hn-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
        --hn-muted: rgba(255, 255, 255, 0.74);
        --hn-fg: rgba(255, 255, 255, 0.92);
        --hn-card-bg: rgba(20, 20, 20, 0.60);
    }
}

.hn-wrap {
    max-width: var(--hn-maxw);
    margin: 0 auto;
    padding: 18px 16px 34px 16px;
    color: var(--hn-fg);
    font-family: var(--hn-serif);
    font-size: 18px;
}

.hn-h1 {
    font-family: var(--hn-sans);
    font-size: 1.75rem;
    line-height: 1.18;
    margin: 0 0 8px 0;
    letter-spacing: -0.015em;
}

.hn-subtitle {
    margin: 0 0 10px 0;
    color: var(--hn-muted);
    font-size: 1.02rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
}

.hn-subtitle a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hn-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 2px 0;
}

.hn-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--hn-border);
    background: rgba(0, 0, 0, 0.03);
    font-family: var(--hn-sans);
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--hn-fg);
}

@media (prefers-color-scheme: dark) {
    .hn-badge {
        background: rgba(255, 255, 255, 0.06);
    }
}

.hn-rule {
    height: 1px;
    border: 0;
    background: var(--hn-border);
    margin: 14px 0 6px 0;
}

.hn-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-top: 18px;
}

.hn-card {
    border: 1px solid var(--hn-border);
    border-radius: var(--hn-radius);
    box-shadow: var(--hn-shadow);
    background: var(--hn-card-bg);
    overflow: hidden;
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.hn-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
    .hn-card:hover {
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
    }
}

/* ===== Card Collapse/Expand ===== */
.hn-collapse-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
    z-index: 2;
    transition: background 0.15s ease, transform 0.2s ease;
}
.hn-collapse-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}
.hn-collapse-btn svg {
    transition: transform 0.25s ease;
}
.hn-card.is-collapsed .hn-collapse-btn svg {
    transform: rotate(-90deg);
}
.hn-card.is-collapsed .hn-body > *:not(.hn-title):not(.hn-collapse-btn) {
    display: none;
}
.hn-card.is-collapsed .hn-body {
    padding-bottom: 10px;
}
.hn-card.is-collapsed .hn-title {
    margin-bottom: 0;
    padding-right: 36px;
}
.hn-card.is-collapsed {
    opacity: 0.75;
}
.hn-card.is-collapsed:hover {
    opacity: 1;
    transform: none;
    box-shadow: var(--hn-shadow);
}

/* Collapse All button */
.hn-collapse-all-btn {
    font-family: var(--hn-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--link);
    background: none;
    border: 1px solid var(--link);
    border-radius: 999px;
    padding: 2px 12px;
    margin-left: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    vertical-align: middle;
}
.hn-collapse-all-btn:hover {
    background: var(--link);
    color: #fff;
}

@media (prefers-color-scheme: dark) {
    .hn-collapse-btn {
        background: rgba(255, 255, 255, 0.08);
    }
    .hn-collapse-btn:hover {
        background: rgba(255, 255, 255, 0.15);
    }
}

@media (max-width: 600px) {
    .hn-collapse-btn {
        width: 26px;
        height: 26px;
        top: 10px;
        right: 10px;
    }
    .hn-collapse-all-btn {
        font-size: 11px;
        padding: 1px 10px;
        margin-left: 8px;
    }
}

.hn-body {
    padding: 14px 16px 18px 16px;
    position: relative;
}

.hn-title {
    font-family: var(--hn-sans);
    font-size: 1.28rem;
    line-height: 1.25;
    font-weight: 780;
    margin: 0 0 8px 0;
    padding-right: 36px;
}

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

.hn-title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hn-meta {
    margin: 0 0 12px 0;
    color: var(--hn-muted);
    font-size: 0.98rem;
}

.hn-img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.04);
    cursor: zoom-in;
}

@media (max-width: 520px) {
    .hn-img {
        height: 210px;
    }
}

.hn-text-en {
    margin: 10px 0 10px 0;
    font-size: 1.06rem;
    line-height: 1.6;
    max-width: 76ch;
    color: var(--hn-fg);
}

.hn-text-zh {
    margin: 0;
    font-size: 1.06rem;
    line-height: 1.6;
    color: var(--hn-muted);
    max-width: 76ch;
}

/* ===== Lightbox modal ===== */
.hn-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    z-index: 9999;
}

.hn-lightbox.is-open {
    display: flex;
}

.hn-lightbox-inner {
    position: relative;
    max-width: min(1100px, 96vw);
    max-height: 90vh;
}

.hn-lightbox-img {
    display: block;
    max-width: 96vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
}

.hn-lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    font-size: 22px;
    line-height: 38px;
    text-align: center;
}

.hn-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.75);
}

/* ===== Index page: day rows ===== */
.hn-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hn-day-row {
    padding: 12px 4px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.12);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.hn-day-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hn-day-row:first-child {
    padding-top: 0;
}

.hn-day-date {
    font-family: var(--hn-sans);
    font-weight: 750;
    font-size: 1.02em;
    flex-shrink: 0;
    min-width: 140px;
    padding-top: 4px;
}
.hn-day-weekday {
    font-weight: 400;
    font-size: 0.85em;
    color: var(--hn-muted);
    margin-left: 2px;
}

.hn-day-stories {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.hn-story-link {
    display: flex;
    align-items: baseline;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 140ms ease;
    min-width: 0;
}

.hn-story-link:hover {
    background: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
    .hn-story-link:hover {
        background: rgba(255, 255, 255, 0.06);
    }
}

.hn-row-type {
    font-family: var(--hn-sans);
    font-weight: 700;
    font-size: 0.85em;
    padding: 2px 10px;
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}

.hn-type-best {
    background: #dbeafe;
    color: #1e40af;
}

.hn-type-top {
    background: #fef3c7;
    color: #92400e;
}

.hn-type-weekly {
    background: #ede9fe;
    color: #5b21b6;
}

@media (prefers-color-scheme: dark) {
    .hn-type-best {
        background: rgba(59, 130, 246, 0.18);
        color: #93c5fd;
    }
    .hn-type-top {
        background: rgba(245, 158, 11, 0.18);
        color: #fcd34d;
    }
    .hn-type-weekly {
        background: rgba(139, 92, 246, 0.18);
        color: #c4b5fd;
    }
}

/* ===== Weekly digest tag summary bar ===== */
.hn-weekly-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 4px;
}

/* ===== Weekly section on index page ===== */
/* ── Today's Top Stories ── */
.hn-top-stories-section {
    /* inherits from .hn-index-section */
}

.hn-top-stories-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hn-top-story-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.12);
    transition: background 0.15s;
}

.hn-top-story-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.hn-top-story-item:first-child {
    padding-top: 0;
}

.hn-top-story-item:hover {
    background: rgba(128, 128, 128, 0.05);
}

.hn-top-story-rank {
    font-family: var(--hn-sans);
    font-size: 1.3em;
    font-weight: 700;
    color: var(--hn-accent, #ff6600);
    min-width: 28px;
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}

.hn-top-story-content {
    flex: 1;
    min-width: 0;
}

.hn-top-story-title {
    font-family: var(--hn-sans);
    font-size: 1.05em;
    font-weight: 600;
    color: var(--title);
    line-height: 1.4;
}

.hn-top-story-title-text {
    /* inherits from parent */
}
a.hn-top-story-title-text {
    color: inherit;
    text-decoration: none;
    transition: text-decoration 0.2s;
}
a.hn-top-story-title-text:hover {
    text-decoration: underline;
}

.hn-top-story-link {
    display: inline-block;
    font-size: 0.8em;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.15s;
    vertical-align: middle;
    margin-left: 4px;
}

.hn-top-story-link:hover {
    opacity: 1;
}

.hn-top-story-zh {
    font-family: var(--hn-sans);
    font-size: 0.88em;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.4;
}

.hn-top-story-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
    font-family: var(--hn-sans);
    font-size: 0.78em;
    color: var(--muted);
}

.hn-hot-idx {
    color: var(--hot);
    font-weight: 600;
}

.hn-top-story-score {
    color: var(--score);
    font-weight: 600;
}

.hn-top-story-comments {
    color: var(--comments);
    font-weight: 500;
}

.hn-top-story-tag {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    background: rgba(128, 128, 128, 0.1);
    font-size: 0.92em;
    color: var(--muted);
}

.hn-top-stories-more {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 14px;
    font-family: var(--hn-sans);
    font-size: 0.85em;
    font-weight: 500;
    color: var(--link);
    text-decoration: none;
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 6px;
    transition: background 0.15s, border-color 0.15s;
}

.hn-top-stories-more:hover {
    background: rgba(128, 128, 128, 0.06);
    border-color: rgba(128, 128, 128, 0.35);
}

/* --- Show more / Show less toggle --- */
.hn-top-story-extra {
    display: none;
}

.hn-top-stories-list.is-expanded .hn-top-story-extra {
    display: flex;
}

.hn-top-stories-toggle {
    display: block;
    width: 100%;
    margin: 4px 0 2px;
    padding: 8px 0;
    font-family: var(--hn-sans);
    font-size: 0.85em;
    font-weight: 600;
    color: var(--hn-accent, #ff6600);
    background: transparent;
    border: 1px dashed rgba(128, 128, 128, 0.25);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    letter-spacing: 0.03em;
}

.hn-top-stories-toggle:hover {
    background: rgba(255, 102, 0, 0.06);
    border-color: var(--hn-accent, #ff6600);
}

@media (prefers-color-scheme: dark) {
    .hn-top-story-item:hover {
        background: rgba(255, 255, 255, 0.04);
    }
    .hn-top-story-tag {
        background: rgba(255, 255, 255, 0.08);
    }
}

.hn-weekly-section {
    /* inherits from .hn-index-section */
}

/* ── Unified index section container ── */
.hn-index-section {
    margin: 20px 0;
    padding: 16px 18px;
    border: 1px solid var(--hn-border);
    border-radius: var(--hn-radius);
    background: var(--hn-card-bg);
    box-shadow: var(--hn-shadow);
}

.hn-section-title {
    font-family: var(--hn-sans);
    font-size: 1.05em;
    font-weight: 700;
    color: var(--title);
    margin: 0 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--hn-accent, #ff6600);
    letter-spacing: 0.02em;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hn-section-zh {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--hn-muted, #888);
    letter-spacing: 0.05em;
}

.hn-hot-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff6600, #e53935);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.06em;
    line-height: 1.4;
    animation: hn-hot-pulse 2s ease-in-out infinite;
}

@keyframes hn-hot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

.hn-row-detail {
    font-family: var(--hn-sans);
    font-size: 0.85em;
    color: var(--hn-muted);
    line-height: 1.35;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hn-row-detail b {
    color: var(--hn-fg);
}

.hn-row-sep {
    opacity: 0.5;
    margin: 0 1px;
}

/* Mobile: stack date and stories vertically */
@media (max-width: 640px) {
    .hn-day-row {
        flex-direction: column;
        gap: 6px;
        padding: 10px 2px;
    }
    .hn-day-date {
        min-width: auto;
        font-size: 1.08em;
    }
    .hn-story-link {
        padding: 4px 4px;
        max-width: 100%;
    }
    .hn-row-detail {
        font-size: 0.82em;
    }
    .hn-index-section {
        padding: 12px 14px;
        margin: 14px 0;
    }
}

.hn-link a {
    font-family: var(--hn-sans);
    font-weight: 750;
    text-decoration: none;
}

.hn-link a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ===== Sort Toggle Bar (Trending pages) ===== */
.hn-sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 8px 0;
    font-family: var(--hn-sans);
}

.hn-sort-label {
    font-size: 0.88rem;
    color: var(--hn-muted);
    font-weight: 500;
    margin-right: 2px;
}

.hn-sort-toggle-btn {
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--hn-sans);
    border: 1px solid rgba(0,0,0,0.15);
    background: transparent;
    color: var(--hn-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-radius: 6px;
}

.hn-sort-toggle-btn:hover {
    background: rgba(0,0,0,0.05);
}

.hn-sort-toggle-btn.is-active {
    background: var(--link);
    color: #fff;
    border-color: var(--link);
}

/* Hotness badge in tags row */
.hn-hot-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--hn-sans);
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: #fff;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.4;
    vertical-align: middle;
    transition: opacity 0.2s ease;
}

.hn-hot-badge--dim {
    background: #bbb;
    opacity: 0.55;
}

/* --- Sort-mode metric highlight/dim --- */
.hn-stat--highlight {
    background: var(--score) !important;
    color: #fff !important;
    border-color: var(--score) !important;
    font-weight: 700;
    transform: scale(1.05);
}
.hn-stat--dim {
    opacity: 0.4;
}

.hn-meta2-created--highlight {
    font-weight: 700;
    color: #1565c0;
    opacity: 1 !important;
}
.hn-meta2-created--dim {
    opacity: 0.45;
}

@media (prefers-color-scheme: dark) {
    .hn-hot-badge--dim {
        background: #555;
        opacity: 0.55;
    }
    .hn-stat--highlight {
        background: var(--score) !important;
        color: #111 !important;
        border-color: var(--score) !important;
    }
    .hn-stat--dim {
        opacity: 0.35;
    }
    .hn-meta2-created--highlight {
        color: #64b5f6;
    }
    .hn-meta2-created--dim {
        opacity: 0.4;
    }
    .hn-sort-toggle-btn {
        border-color: #444;
        color: #aaa;
    }
    .hn-sort-toggle-btn:hover {
        background: rgba(255,255,255,0.08);
    }
    .hn-sort-toggle-btn.is-active {
        background: var(--link);
        color: #111;
    }
    .hn-hot-badge {
        background: linear-gradient(135deg, #e85d26 0%, #d4820e 100%);
    }
}

@media (max-width: 640px) {
    .hn-sort-bar {
        gap: 5px;
    }
    .hn-sort-toggle-btn {
        padding: 4px 10px;
        font-size: 12px;
    }
    .hn-sort-label {
        font-size: 0.82rem;
    }
    .hn-hot-badge {
        font-size: 0.72rem;
        padding: 1px 6px;
    }
}

/* ===== Statistics bar ===== */
.hn-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 2px;
    margin: 8px 0 4px 0;
    font-family: var(--hn-sans);
    font-size: 0.88rem;
    color: var(--hn-muted);
}

.hn-stat-item {
    white-space: nowrap;
}

.hn-stat-num {
    font-weight: 700;
    color: var(--hn-fg);
}

.hn-stat-sep {
    margin: 0 4px;
    opacity: 0.5;
}

@media (max-width: 640px) {
    .hn-stats {
        font-size: 0.82rem;
    }
}

.hn-hint {
    margin-top: 16px;
    color: var(--hn-muted);
    font-size: 0.98rem;
}

/* =========================
   Mobile font scaling
   ========================= */
@media (max-width: 640px) {
    .hn-wrap {
        font-size: 17px;
        padding: 18px 14px 34px 14px;
    }

    .hn-h1 {
        font-size: 1.6rem;
    }

    /* Subtitle (scraped-at time): keep current size — user is happy with it */
    .hn-subtitle {
        font-size: 1.02rem;
    }

    .hn-title {
        font-size: 1.15rem;
        line-height: 1.28;
    }

    .hn-meta {
        font-size: 0.92rem;
    }

    .hn-text-en,
    .hn-text-zh {
        font-size: 0.98rem;
        line-height: 1.65;
    }

    .hn-badge {
        font-size: 0.88rem;
    }
}

/* =========================
   Mobile spacing polish
   ========================= */
@media (max-width: 640px) {
    .hn-list {
        gap: 16px;
        /* 原来是 22px：手机上会显得太散 */
        margin-top: 14px;
    }

    .hn-body {
        padding: 16px 16px 18px 16px;
        /* 原来顶部略紧 */
    }

    .hn-card {
        border-radius: 18px;
        /* 更“柔软” */
    }

    .hn-title {
        margin-bottom: 10px;
    }

    .hn-meta {
        margin-bottom: 12px;
        font-size: 0.92rem;
    }

    .hn-rule {
        margin: 16px 0 10px 0;
    }

    /* 图片在手机上更适合的比例 */
    .hn-img {
        height: 200px;
        /* 你现在 520px 才改 210，这里更统一 */
    }
}

/* Index: keep each row compact (single-line when possible) */
.hn-index-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    /* allow ellipsis */
}

.hn-index-link {
    white-space: nowrap;
    flex: 0 0 auto;
}

.hn-index-meta {
    min-width: 0;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* too long => ... */
    opacity: 0.9;
}

.hn-meta+.hn-img {
    margin-top: 10px;
}



.hn-goup {
    position: fixed;
    right: 14px;
    bottom: 24px;
    z-index: 9999;
    padding: 14px 18px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.18);
    background: rgba(255, 255, 255, 0.92);
    font-family: var(--hn-sans);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    transition: right 0.2s ease, opacity 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    .hn-goup {
        border-color: rgba(255, 255, 255, 0.22);
        background: rgba(30, 30, 30, 0.85);
    }
}

/* Meta line: left zh title + right created time */
.hn-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.hn-meta-right {
    white-space: nowrap;
    opacity: 0.85;
    font-size: 0.95em;
}

.hn-meta2 {
    margin: 4px 0 10px;
    opacity: 0.85;
    font-size: 0.95em;
    line-height: 1.25;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.hn-meta2 a {
    text-decoration: none;
}

.hn-meta2 a:hover {
    text-decoration: underline;
}

/* ===== Mode badge (Best / Top) next to H1 ===== */
.hn-mode-badge {
    display: inline-block;
    vertical-align: middle;
    padding: 3px 14px;
    border-radius: 999px;
    font-family: var(--hn-sans);
    font-size: 0.52em;
    font-weight: 700;
    letter-spacing: 0.02em;
    position: relative;
    top: -3px;
    margin-left: 6px;
}

.hn-mode-best {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.hn-mode-top {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.hn-mode-weekly {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

@media (prefers-color-scheme: dark) {
    .hn-mode-best {
        background: rgba(59, 130, 246, 0.18);
        color: #93c5fd;
        border-color: rgba(59, 130, 246, 0.30);
    }
    .hn-mode-top {
        background: rgba(245, 158, 11, 0.18);
        color: #fcd34d;
        border-color: rgba(245, 158, 11, 0.30);
    }
    .hn-mode-weekly {
        background: rgba(139, 92, 246, 0.18);
        color: #c4b5fd;
        border-color: rgba(139, 92, 246, 0.30);
    }
}

/* ===== Nav pill buttons (Prev / Index / Next) ===== */
.hn-nav {
    margin: 6px 0 8px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.hn-nav .hn-prev {
    justify-self: start;
}

.hn-nav .hn-nav-index {
    justify-self: center;
}

.hn-nav .hn-next {
    justify-self: end;
}

.hn-nav-btn {
    display: inline-block;
    font-family: var(--hn-sans);
    font-size: 0.88em;
    font-weight: 600;
    text-decoration: none;
    padding: 5px 16px;
    border-radius: 999px;
    border: 1px solid var(--hn-border);
    background: rgba(0, 0, 0, 0.03);
    color: var(--hn-fg);
    transition: background 140ms ease, border-color 140ms ease;
}

.hn-nav-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    border-color: rgba(0, 0, 0, 0.22);
}

/* Index button slightly more prominent */
.hn-nav-index {
    border-color: var(--link);
    color: var(--link);
}

.hn-nav-index:hover {
    background: rgba(11, 87, 208, 0.06);
    border-color: var(--link);
}

@media (prefers-color-scheme: dark) {
    .hn-nav-btn {
        background: rgba(255, 255, 255, 0.06);
    }
    .hn-nav-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(255, 255, 255, 0.28);
    }
    .hn-nav-index {
        border-color: var(--link);
        color: var(--link);
    }
    .hn-nav-index:hover {
        background: rgba(122, 183, 255, 0.10);
    }
}

/* Broken images: fully hidden (JS also sets display:none) */
.hn-img--hidden {
    display: none !important;
}

/* Tiny images: don't stretch to full width; show as contained small media */
.hn-img.hn-img--tiny {
    height: auto !important;
    max-height: 240px;
    object-fit: contain !important;
    cursor: default !important;

    /* visually nicer */
    background: transparent !important;
    border-radius: 12px;
    margin: 10px auto 10px;
    max-width: min(520px, 100%);
}

/* ===== Story tag badges ===== */
.hn-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    pointer-events: none; /* prevent accidental taps on card tags */
    margin: 8px 0 10px 0;
}

/* Score & comments stat icons on tags line */
.hn-stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    padding: 3px 10px;
    border-radius: 999px;
    font-family: var(--hn-sans);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
    pointer-events: auto; /* override parent pointer-events: none */
    cursor: default;
    text-decoration: none;
}
.hn-stat-score {
    background: var(--score-bg);
    color: var(--score);
    border: 1px solid var(--score-border);
}
a.hn-stat-score {
    cursor: pointer;
}
a.hn-stat-score:hover {
    background: var(--score-border);
}
.hn-stat-comments {
    background: var(--comments-bg);
    color: var(--comments);
    border: 1px solid var(--comments-border);
}
a.hn-stat-comments {
    cursor: pointer;
}
a.hn-stat-comments:hover {
    background: var(--comments-border);
}
/* External link indicator for clickable stat icons */
a.hn-stat::after {
    content: '\2197';
    font-size: 0.7em;
    margin-left: 2px;
    opacity: 0.6;
}
a.hn-stat:hover::after {
    opacity: 1;
}

.hn-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-family: var(--hn-sans);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
    cursor: default;
    border: 1px solid transparent;
    transition: opacity 140ms ease;
}

.hn-filter-bar .hn-tag:hover {
    opacity: 0.85;
}

/* Color variants — light mode */
.hn-tag--blue      { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.hn-tag--indigo    { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.hn-tag--red       { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.hn-tag--teal      { background: #ccfbf1; color: #115e59; border-color: #99f6e4; }
.hn-tag--amber     { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.hn-tag--slate     { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.hn-tag--green     { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.hn-tag--pink      { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.hn-tag--cyan      { background: #cffafe; color: #155e75; border-color: #a5f3fc; }
.hn-tag--violet    { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.hn-tag--purple    { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.hn-tag--orange    { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.hn-tag--emerald   { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.hn-tag--sky       { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.hn-tag--rose      { background: #ffe4e6; color: #9f1239; border-color: #fecdd3; }

/* Share button (in tags row) */
.hn-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    margin-left: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    pointer-events: auto;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}
.hn-share-btn:hover {
    color: #f97316;
    border-color: #f97316;
    background: rgba(249,115,22,0.06);
}
.hn-share-btn:active {
    transform: scale(0.92);
}
.hn-share-btn svg {
    display: block;
}

/* Share toast notification */
.hn-share-toast {
    position: absolute;
    z-index: 9999;
    padding: 5px 12px;
    border-radius: 6px;
    background: #1e293b;
    color: #f8fafc;
    font-family: var(--hn-sans);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.hn-share-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Color variants — dark mode */
@media (prefers-color-scheme: dark) {
    .hn-share-btn {
        border-color: #334155;
        color: #64748b;
    }
    .hn-share-btn:hover {
        color: #fb923c;
        border-color: #fb923c;
        background: rgba(251,146,60,0.1);
    }
    .hn-share-toast {
        background: #f1f5f9;
        color: #1e293b;
    }
    .hn-tag--blue      { background: rgba(59,130,246,0.18);  color: #93c5fd; border-color: rgba(59,130,246,0.30); }
    .hn-tag--indigo    { background: rgba(99,102,241,0.18);  color: #a5b4fc; border-color: rgba(99,102,241,0.30); }
    .hn-tag--red       { background: rgba(239,68,68,0.18);   color: #fca5a5; border-color: rgba(239,68,68,0.30); }
    .hn-tag--teal      { background: rgba(20,184,166,0.18);  color: #5eead4; border-color: rgba(20,184,166,0.30); }
    .hn-tag--amber     { background: rgba(245,158,11,0.18);  color: #fcd34d; border-color: rgba(245,158,11,0.30); }
    .hn-tag--slate     { background: rgba(148,163,184,0.15); color: #cbd5e1; border-color: rgba(148,163,184,0.25); }
    .hn-tag--green     { background: rgba(34,197,94,0.18);   color: #86efac; border-color: rgba(34,197,94,0.30); }
    .hn-tag--pink      { background: rgba(236,72,153,0.18);  color: #f9a8d4; border-color: rgba(236,72,153,0.30); }
    .hn-tag--cyan      { background: rgba(6,182,212,0.18);   color: #67e8f9; border-color: rgba(6,182,212,0.30); }
    .hn-tag--violet    { background: rgba(139,92,246,0.18);  color: #c4b5fd; border-color: rgba(139,92,246,0.30); }
    .hn-tag--purple    { background: rgba(168,85,247,0.18);  color: #d8b4fe; border-color: rgba(168,85,247,0.30); }
    .hn-tag--orange    { background: rgba(249,115,22,0.18);  color: #fdba74; border-color: rgba(249,115,22,0.30); }
    .hn-tag--emerald   { background: rgba(16,185,129,0.18);  color: #6ee7b7; border-color: rgba(16,185,129,0.30); }
    .hn-tag--sky       { background: rgba(14,165,233,0.18);  color: #7dd3fc; border-color: rgba(14,165,233,0.30); }
    .hn-tag--rose      { background: rgba(244,63,94,0.18);   color: #fda4af; border-color: rgba(244,63,94,0.30); }
    .hn-stat-score     { background: var(--score-bg);    color: var(--score); border-color: var(--score-border); }
    a.hn-stat-score:hover { background: var(--score-border); }
    .hn-stat-comments  { background: var(--comments-bg);  color: var(--comments); border-color: var(--comments-border); }
    a.hn-stat-comments:hover { background: var(--comments-border); }
}

/* Mobile tag sizing */
@media (max-width: 640px) {
    .hn-tag {
        font-size: 0.75rem;
        padding: 2px 8px;
    }
}

/* ===== Tag filter bar ===== */
.hn-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0 4px 0;
    padding: 0;
}

.hn-filter-btn {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-family: var(--hn-sans);
    font-size: 0.80rem;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.01em;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity 140ms ease, transform 100ms ease, box-shadow 140ms ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.hn-filter-btn:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* "All" button: neutral style */
.hn-filter-btn--all {
    background: rgba(0, 0, 0, 0.06);
    color: var(--hn-fg);
    border-color: var(--hn-border);
}

@media (prefers-color-scheme: dark) {
    .hn-filter-btn--all {
        background: rgba(255, 255, 255, 0.08);
    }
}

/* Active state: ring highlight */
.hn-filter-btn.is-active {
    box-shadow: 0 0 0 2px var(--link);
    opacity: 1;
    transform: none;
}

/* Dim non-active buttons when a filter is active */
.hn-filter-bar:has(.hn-filter-btn.is-active:not(.hn-filter-btn--all)) .hn-filter-btn:not(.is-active) {
    opacity: 0.50;
}

.hn-filter-bar:has(.hn-filter-btn.is-active:not(.hn-filter-btn--all)) .hn-filter-btn:not(.is-active):hover {
    opacity: 0.75;
}

/* Filter status line */
.hn-filter-status {
    font-family: var(--hn-sans);
    font-size: 0.88rem;
    color: var(--hn-muted);
    margin: 6px 0 2px 0;
    padding: 0;
}

/* Mobile filter bar */
@media (max-width: 640px) {
    .hn-filter-bar {
        gap: 5px;
        margin: 12px 0 4px 0;
    }
    .hn-filter-btn {
        font-size: 0.75rem;
        padding: 3px 9px;
    }
}

/* Make card tags clickable when filter is available */
.hn-list .hn-tag {
    cursor: pointer;
}

.hn-list .hn-tag:hover {
    opacity: 0.75;
    transform: translateY(-1px);
    transition: opacity 140ms ease, transform 100ms ease;
}

/* ===== Search (Index page) ===== */
.hn-search-box {
    margin: 18px 0 8px 0;
}

.hn-search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    border: 2px solid var(--muted);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.hn-search-input:focus {
    border-color: var(--link);
}

.hn-search-input::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.hn-search-status {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}

.hn-search-results {
    margin: 12px 0;
}

.hn-search-item {
    padding: 14px 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

.hn-search-item:last-child {
    border-bottom: none;
}

.hn-search-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.hn-search-item-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--link);
    text-decoration: none;
    line-height: 1.4;
}

.hn-search-item-title:hover {
    text-decoration: underline;
}

.hn-search-item-zh {
    font-size: 15px;
    color: var(--muted);
    margin-top: 3px;
    line-height: 1.4;
}

.hn-search-item-meta {
    font-size: 14px;
    color: var(--muted);
    margin-top: 5px;
    opacity: 0.85;
}

.hn-search-item-meta a {
    color: var(--link);
    text-decoration: none;
}

.hn-search-item-meta a:hover {
    text-decoration: underline;
}

.hn-search-item-tags {
    margin-top: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.hn-search-item-tags .hn-tag {
    font-size: 12px;
    padding: 1px 7px;
}

.hn-search-item-page {
    display: inline-block;
    margin-top: 8px;
    font-size: 14px;
    font-family: var(--hn-sans);
    font-weight: 600;
    color: var(--link);
    text-decoration: none;
    padding: 4px 14px;
    border-radius: 999px;
    border: 1px solid var(--link);
    opacity: 0.65;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.hn-search-item-page:hover {
    opacity: 1;
    background: var(--link);
    color: #fff;
    text-decoration: none;
}

/* Search keyword highlighting */
.hn-highlight {
    background: rgba(255, 220, 50, 0.45);
    color: inherit;
    padding: 0.05em 0.15em;
    border-radius: 3px;
}
@media (prefers-color-scheme: dark) {
    .hn-highlight {
        background: rgba(255, 200, 40, 0.3);
    }
}

.hn-search-more {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 8px 0 16px 0;
    font-size: 14px;
    font-family: inherit;
    color: var(--link);
    background: transparent;
    border: 2px solid var(--link);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.hn-search-more:hover {
    background: var(--link);
    color: #fff;
}

/* ── Sort toggle ── */
.hn-search-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 13px;
  font-family: var(--hn-sans);
  color: var(--hn-muted);
}
.hn-sort-btn {
  background: var(--bg);
  border: 1px solid var(--hn-border);
  border-radius: 14px;
  padding: 3px 12px;
  font-size: 12px;
  font-family: var(--hn-sans);
  color: var(--hn-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.hn-sort-btn:hover {
  border-color: var(--link);
  color: var(--link);
}
.hn-sort-btn.hn-sort-active {
  background: var(--link);
  border-color: var(--link);
  color: #fff;
}


/* ===== Tag Bubble Chart ===== */
.hn-tag-cloud {
  margin: 20px 0 8px;
  position: relative;
}

.hn-tag-cloud-body {
  position: relative;
  border: 1px solid var(--hn-border);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
  padding: 8px;
}
.hn-bubble-chart {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}
.hn-bubble-chart svg {
  max-width: 100%;
  height: auto;
}
.hn-tag-cloud-tooltip {
  display: none;
  position: absolute;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-family: var(--hn-sans);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  line-height: 1.5;
}
.hn-bubble circle {
  transition: fill-opacity 0.18s ease, stroke-width 0.18s ease, stroke-opacity 0.18s ease;
}
.hn-bubble text {
  pointer-events: none;
}
@media (prefers-color-scheme: dark) {
  .hn-tag-cloud-body {
    background: rgba(255,255,255,0.03);
  }
  .hn-tag-cloud-tooltip {
    background: rgba(255, 255, 255, 0.88);
    color: #111;
  }
  .hn-bubble circle {
    fill-opacity: 0.22;
    stroke-opacity: 0.7;
  }
}
@media (max-width: 600px) {
  .hn-tag-cloud-body {
    padding: 4px;
  }
}


/* ===== Trends link in stats bar ===== */
.hn-stat-link {
  font-family: var(--hn-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
  border: 1px solid var(--link);
  border-radius: 999px;
  padding: 1px 12px;
  opacity: 0.75;
  transition: all 0.15s ease;
}
.hn-stat-link:hover {
  background: var(--link);
  color: #fff;
  opacity: 1;
  text-decoration: none;
}
.hn-rss-link {
  color: #f26522;
  border-color: #f26522;
}
.hn-rss-link:hover {
  background: #f26522;
  color: #fff;
}

/* ===== Language Toggle (Segmented Control) ===== */
.hn-lang-toggle {
  display: inline-flex;
  position: relative;
  background: var(--bg);
  border: 1px solid var(--hn-border);
  border-radius: 8px;
  padding: 2px;
  margin: 0;
  overflow: hidden;
  flex-shrink: 0;
}
.hn-lang-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(100% / 3 - 1px);
  height: calc(100% - 4px);
  background: var(--link);
  border-radius: 6px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}
.hn-lang-btn {
  position: relative;
  z-index: 1;
  background: none;
  border: none;
  padding: 3px 14px;
  font-family: var(--hn-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  opacity: 0.5;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
  line-height: 1.5;
  letter-spacing: 0.02em;
}
.hn-lang-btn:hover {
  opacity: 0.8;
}
.hn-lang-btn.hn-lang-active {
  color: #fff;
  opacity: 1;
}

/* ===== Language visibility rules ===== */
/* EN only: hide Chinese text and Chinese title */
.hn-lang-en .hn-text-zh,
.hn-lang-en .hn-meta {
  display: none;
}

/* ZH only: hide English text */
.hn-lang-zh .hn-text-en {
  display: none;
}

/* Bilingual: show everything (default) */
.hn-lang-bi .hn-text-en,
.hn-lang-bi .hn-text-zh,
.hn-lang-bi .hn-meta {
  display: block;
}

/* When inside sort bar: push to right via auto margin */
.hn-lang-toggle--in-sort {
  margin-left: auto;
}

/* Standalone toolbar row (Best pages without sort bar) */
.hn-lang-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 8px 0;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .hn-lang-toggle {
    background: rgba(255, 255, 255, 0.05);
  }
}

/* Responsive: smaller on mobile */
@media (max-width: 600px) {
  .hn-lang-btn {
    padding: 3px 11px;
    font-size: 11px;
  }
  .hn-sort-bar {
    flex-wrap: wrap;
  }
  .hn-lang-toggle--in-sort {
    margin-left: 0;
    margin-top: 4px;
  }
}

/* ===== Compact card (Weekly Digest) ===== */
.hn-card-compact {
  padding: 10px 16px;
  margin-bottom: 4px;
  border-radius: 8px;
  border: 1px solid var(--hn-border);
  background: var(--bg);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.hn-card-compact:hover {
  border-color: var(--link);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.hn-card-compact .hn-body {
  padding: 0;
}
.hn-card-compact .hn-title {
  font-size: 17px;
  margin: 0 0 2px 0;
  line-height: 1.4;
}
.hn-card-compact .hn-meta {
  font-size: 15px;
  margin: 0 0 4px 0;
  opacity: 0.7;
}
.hn-card-compact .hn-tags {
  margin: 4px 0;
}
.hn-card-compact .hn-tags .hn-tag {
  font-size: 11px;
  padding: 1px 7px;
}
.hn-card-compact .hn-search-item-page {
  font-size: 13px;
  padding: 2px 10px;
  margin-top: 4px;
}
.hn-compact-score {
  display: inline-block;
  font-family: var(--hn-sans);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--link);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 6px;
  vertical-align: middle;
  line-height: 1.5;
  min-width: 28px;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .hn-card-compact {
    background: rgba(255, 255, 255, 0.02);
  }
  .hn-card-compact:hover {
    background: rgba(255, 255, 255, 0.04);
  }
}
@media (max-width: 600px) {
  .hn-card-compact {
    padding: 8px 12px;
  }
  .hn-card-compact .hn-title {
    font-size: 16px;
  }
}

/* ===== Daily Page Link Icon (Weekly Digest) ===== */
.hn-daily-link {
  display: inline-block;
  font-size: 0.72em;
  text-decoration: none;
  opacity: 0.35;
  vertical-align: middle;
  margin-left: 4px;
  transition: opacity 0.15s;
}
.hn-daily-link:hover {
  opacity: 0.85;
  text-decoration: none;
}
@media (prefers-color-scheme: dark) {
  .hn-daily-link {
    opacity: 0.4;
  }
  .hn-daily-link:hover {
    opacity: 0.9;
  }
}

/* ===== Stream Graph ===== */
.hn-stream-controls {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 1rem;
}
.hn-stream-subtitle {
  margin: 0 !important;
}
.hn-stream-range-bar {
  display: flex;
  gap: 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
}
.hn-stream-range-btn {
  padding: 5px 14px;
  font-size: 13px;
  font-family: var(--hn-sans);
  background: transparent;
  border: none;
  border-right: 1px solid #ccc;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.hn-stream-range-btn:last-child {
  border-right: none;
}
.hn-stream-range-btn:hover {
  background: rgba(0,0,0,0.05);
}
.hn-stream-range-btn.hn-stream-range-active {
  background: var(--link);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .hn-stream-range-bar {
    border-color: #444;
  }
  .hn-stream-range-btn {
    border-color: #444;
    color: #aaa;
  }
  .hn-stream-range-btn:hover {
    background: rgba(255,255,255,0.08);
  }
  .hn-stream-range-btn.hn-stream-range-active {
    background: var(--link);
    color: #111;
  }
}
@media (max-width: 600px) {
  .hn-stream-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .hn-stream-range-btn {
    padding: 4px 10px;
    font-size: 12px;
  }
}
.hn-stream-wrap {
  position: relative;
  margin: 0 0 2rem;
}
.hn-stream-chart {
  display: block;
  margin: 0 auto;
  max-width: 100%;
}
.hn-stream-chart svg {
  max-width: 100%;
  height: auto;
}
.hn-stream-tooltip {
  display: none;
  position: absolute;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 13px;
  font-family: var(--hn-sans);
  padding: 6px 12px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  line-height: 1.5;
}
.hn-stream-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-top: 12px;
  font-family: var(--hn-sans);
  font-size: 12px;
  color: var(--muted);
}
.hn-stream-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}
.hn-stream-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.hn-stream-path {
  transition: opacity 0.2s ease;
}
@media (prefers-color-scheme: dark) {
  .hn-stream-tooltip {
    background: rgba(255, 255, 255, 0.88);
    color: #111;
  }
  .hn-stream-path {
    opacity: 0.85;
  }
}
@media (max-width: 600px) {
  .hn-stream-legend {
    font-size: 11px;
    gap: 6px 12px;
  }
}
