/* NestedNews v2
   Near-black page, one column of cards in the middle, sets on the left and
   today's ranked stories on the right. */

:root {
    --bg: #151517;
    --panel: #1c1c1f;
    --panel-hover: #202024;
    --surface: #1e1e20;
    --text: #fdfdff;
    --muted: rgba(253, 253, 255, 0.7);
    --faint: rgba(253, 253, 255, 0.45);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --accent: #6ba4ff;
    --up: #3aa267;
    --down: #cc434d;
    /* Two strengths of hover wash, and the rail's scrollbar, so both themes
       read the same way. */
    --wash: rgba(255, 255, 255, 0.06);
    --wash-soft: rgba(255, 255, 255, 0.04);
    --scroll: rgba(255, 255, 255, 0.18);
    /* Darker than the page, so the sidebar reads as its own surface. */
    --sidebar-bg: #101012;
    /* The ranking card's rows, a shade above the card they sit in. */
    --rail-card: #202024;
    /* What a chosen set or category is filled with, in either theme. */
    --accent-fill: color-mix(in srgb, var(--accent) 22%, var(--panel-hover));
    --tip-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    --admin-accent: #f59e0b;
    --admin-card-bg: #272219;
    --admin-card-hover: #2e281d;
    --admin-card-border: rgba(245, 158, 11, 0.34);
    --admin-comment-bg: rgba(245, 158, 11, 0.1);
    --admin-badge-bg: rgba(245, 158, 11, 0.18);
    --admin-badge-text: #fbbf24;
    --feed-col: minmax(0, 52.8rem);
    --feed-max: 52.8rem;
    color-scheme: dark;
}

:root[data-width="fill"] {
    --feed-col: minmax(0, 1fr);
    --feed-max: none;
}

/* Light mode keeps the same shapes and dimensions; only the paper changes.
   The toggle in the sidebar writes data-theme on <html>. */
:root[data-theme="light"] {
    --bg: #ebebf3;
    --panel: #ffffff;
    --panel-hover: #f1f1f6;
    --surface: #fbfbfe;
    --text: #15151a;
    /* A touch stronger than the dark values, so small secondary text keeps
       the same legibility on white paper. */
    --muted: rgba(21, 21, 26, 0.74);
    --faint: rgba(21, 21, 26, 0.56);
    --border: rgba(18, 18, 24, 0.1);
    --border-strong: rgba(18, 18, 24, 0.2);
    --accent: #1c66eb;
    --up: #15803d;
    --down: #c0272f;
    --wash: rgba(18, 18, 24, 0.05);
    --wash-soft: rgba(18, 18, 24, 0.035);
    --scroll: rgba(18, 18, 24, 0.2);
    /* Lighter than the page, so the sidebar reads as its own surface. */
    --sidebar-bg: #fafafd;
    /* Barely off white, so the rows and ticker boxes read as their own blocks
       on the white rail without needing an edge. */
    --rail-card: #f5f5fa;
    --tip-shadow: 0 10px 24px rgba(18, 18, 24, 0.18);
    --admin-accent: #b45309;
    --admin-card-bg: #fff9ec;
    --admin-card-hover: #fef3d9;
    --admin-card-border: rgba(180, 83, 9, 0.3);
    --admin-comment-bg: rgba(245, 158, 11, 0.12);
    --admin-badge-bg: rgba(217, 119, 6, 0.14);
    --admin-badge-text: #92400e;
    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 24rem minmax(0, 1fr);
    background: var(--bg);
    color: var(--text);
    font-family:
        "Inter",
        "Segoe UI",
        system-ui,
        -apple-system,
        sans-serif;
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
    position: sticky;
    top: 0;
    /* Sticky already makes this a stacking context, so it needs a stacking
       level of its own: the content is nudged left over the sidebar's edge,
       and without this it would paint — and catch clicks — above the fold
       handle and the folded tooltips. */
    z-index: 10;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.35rem 1rem;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* The theme switch: a sun while the page is dark, a moon while it's light. */
.theme-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    /* Sits level with the wordmark, which carries its own bottom padding. */
    margin: 0 0.4rem 0.4rem 0;
    padding: 0;
    color: var(--muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--text);
    background: var(--panel-hover);
    border-color: var(--border-strong);
}

.theme-toggle svg {
    width: 1rem;
    height: 1rem;
}

.theme-toggle .icon-moon {
    display: none;
}

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

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

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.4rem 0.4rem;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
}

/* The wordmark folds down to this home icon when the sidebar is collapsed. */
.brand-home {
    display: none;
    width: 1.2rem;
    height: 1.2rem;
}

.brand-home svg {
    width: 100%;
    height: 100%;
}

.brand-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--accent);
}

.brand-prefix {
    font-weight: 300;
    letter-spacing: 0.06em;
}

.brand-name {
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.brand:hover {
    opacity: 0.85;
}

/* The handle that folds the sidebar away, riding the divider line. */
.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -0.85rem;
    transform: translateY(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.sidebar-toggle:hover {
    color: var(--text);
    background: var(--panel-hover);
    border-color: var(--border-strong);
}

.sidebar-toggle svg {
    width: 0.9rem;
    height: 0.9rem;
    transition: transform 0.2s ease;
}

:root[data-sidebar="collapsed"] .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Folded: the rail keeps only the icons — a home mark for the wordmark and
   each set's own icon — so the feed gets the width back. */
@media (min-width: 52.01rem) {
    :root[data-sidebar="collapsed"] body {
        grid-template-columns: 4.9rem minmax(0, 1fr);
    }

    :root[data-sidebar="collapsed"] .sidebar {
        align-items: center;
        padding: 1.2rem 0.55rem;
    }

    :root[data-sidebar="collapsed"] .sidebar-head {
        flex-direction: column;
        gap: 0.55rem;
        width: 100%;
    }

    :root[data-sidebar="collapsed"] .brand {
        justify-content: center;
        width: 2.6rem;
        height: 2.6rem;
        padding: 0;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 0.8rem;
    }

    :root[data-sidebar="collapsed"] .brand-home {
        display: inline-flex;
        color: var(--text);
    }

    :root[data-sidebar="collapsed"] .brand-dot,
    :root[data-sidebar="collapsed"] .brand-prefix,
    :root[data-sidebar="collapsed"] .brand-name {
        display: none;
    }

    :root[data-sidebar="collapsed"] .theme-toggle {
        margin: 0;
    }

    :root[data-sidebar="collapsed"] .sets {
        align-items: center;
        width: 100%;
    }

    :root[data-sidebar="collapsed"] .set-button {
        justify-content: center;
        gap: 0;
        width: 2.8rem;
        height: 2.8rem;
        padding: 0;
        border-radius: 0.9rem;
    }

    :root[data-sidebar="collapsed"] .set-icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    :root[data-sidebar="collapsed"] .set-label,
    :root[data-sidebar="collapsed"] .set-count,
    :root[data-sidebar="collapsed"] .subsets {
        display: none;
    }

    /* Folded, the footer buttons become matching icon tiles stacked in the rail. */
    :root[data-sidebar="collapsed"] .side-footer {
        flex-direction: column;
        align-items: center;
        gap: 0.45rem;
        width: 100%;
        padding: 0;
    }

    :root[data-sidebar="collapsed"] .side-settings,
    :root[data-sidebar="collapsed"] .side-account {
        flex: none;
        width: auto;
    }

    :root[data-sidebar="collapsed"] .settings-button,
    :root[data-sidebar="collapsed"] .account-button {
        justify-content: center;
        width: 2.8rem;
        height: 2.8rem;
        padding: 0;
        border-radius: 0.9rem;
    }

    :root[data-sidebar="collapsed"] .settings-label,
    :root[data-sidebar="collapsed"] .account-label {
        display: none;
    }

    /* Folded icons name themselves on hover (and on keyboard focus) with the
       same rounded pill the expanded rail uses, plus a caret pointing at the
       icon. data-tip is kept in step with the label in app.js. */
    :root[data-sidebar="collapsed"] [data-tip] {
        position: relative;
    }

    :root[data-sidebar="collapsed"] [data-tip]::after {
        content: attr(data-tip);
        position: absolute;
        top: 50%;
        left: calc(100% + 1rem);
        z-index: 20;
        padding: 0.5rem 0.9rem;
        font-size: 0.95rem;
        font-weight: 500;
        line-height: 1.2;
        white-space: nowrap;
        color: var(--text);
        background: var(--panel-hover);
        border: 1px solid var(--border-strong);
        border-radius: 999px;
        box-shadow: var(--tip-shadow);
        opacity: 0;
        pointer-events: none;
        transform: translate(-0.3rem, -50%);
        transition:
            opacity 0.12s ease,
            transform 0.12s ease;
    }

    /* The caret: a small square turned on its corner, wearing the pill's two
       leading borders so it reads as part of the same box. */
    :root[data-sidebar="collapsed"] [data-tip]::before {
        content: "";
        position: absolute;
        top: 50%;
        left: calc(100% + 0.72rem);
        z-index: 21;
        width: 0.55rem;
        height: 0.55rem;
        background: var(--panel-hover);
        border-left: 1px solid var(--border-strong);
        border-bottom: 1px solid var(--border-strong);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-50%) rotate(45deg);
        transition: opacity 0.12s ease;
    }

    :root[data-sidebar="collapsed"] [data-tip]:hover::after,
    :root[data-sidebar="collapsed"] [data-tip]:focus-visible::after {
        opacity: 1;
        transform: translate(0, -50%);
    }

    :root[data-sidebar="collapsed"] [data-tip]:hover::before,
    :root[data-sidebar="collapsed"] [data-tip]:focus-visible::before {
        opacity: 1;
    }
}

.rail-title {
    padding: 0 0.5rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
}

.sets {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* Each set is a full pill: icon, name, and how many categories it holds. */
.set-button {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.8rem 1.1rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--muted);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.set-button:hover {
    background: var(--surface);
    color: var(--text);
}

.set-button[aria-current="true"] {
    background: var(--accent-fill);
    color: var(--text);
    font-weight: 600;
}

.set-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--faint);
}

.set-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.set-button:hover .set-icon,
.set-button[aria-current="true"] .set-icon {
    color: var(--accent);
}

/* With one of the set's categories filtered, the category carries the
   highlight and the set pill above it drops back to plain — it stays
   aria-current, it just stops looking chosen. */
.sets.has-category .set-button[aria-current="true"] {
    background: transparent;
}

.sets.has-category .set-button[aria-current="true"]:hover {
    background: var(--surface);
}

.set-count {
    margin-left: auto;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

/* The active set's categories, hanging under its button. Same shape as a set
   pill, a size down, with the category's own dot standing in for the icon. */
.subsets {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* Inset by the same amount left and right, so the smaller pills sit
       inside the width of the set pill above them. */
    margin: 0.15rem 2.1rem 0.55rem 2.1rem;
}

.subset {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    width: 100%;
    padding: 0.16rem 0.35rem 0.16rem 0.12rem;
    /* A quiet fill instead of an edge, so the category pills read as softer
       than the set pill they sit under. */
    background: color-mix(in srgb, var(--panel-hover) 70%, transparent);
    border-radius: 999px;
    transition: background 0.15s ease;
}

/* The name is the filter; the eye beside it is the hide switch. */
.subset-main {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1;
    min-width: 0;
    padding: 0.28rem 0.45rem;
    font: inherit;
    font-size: 0.83rem;
    text-align: left;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.subset:hover {
    background: color-mix(in srgb, var(--panel-hover) 100%, transparent);
}

.subset:hover .subset-main {
    color: var(--text);
}

/* The category the feed is filtered to: tinted with the accent, since there
   is no edge left to colour. */
.subset.is-filtered {
    background: var(--accent-fill);
}

.subset.is-filtered .subset-main {
    color: var(--text);
}

.subset.is-filtered .subset-count {
    color: var(--muted);
}

/* Its stories are out of the feed: the eye is struck through and the pill
   goes quiet, but it stays clickable so it can be brought back. */
.subset.is-hidden .subset-main {
    color: var(--faint);
}

.subset.is-hidden .subset-dot {
    opacity: 0.35;
}

.subset-eye {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    color: var(--faint);
    background: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.subset-eye:hover {
    color: var(--text);
    background: var(--surface);
}

.subset-eye .eye-slash {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.subset.is-hidden .subset-eye .eye-slash {
    opacity: 1;
}

/* The cog beside the eye opens the category's sources: the same quiet spot,
   with one switch per outlet. */
.subset-cog {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    color: var(--faint);
    background: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.subset-cog:hover,
.subset-cog[aria-expanded="true"] {
    color: var(--text);
    background: var(--surface);
}

/* Some of its sources are off, so the cog stays lit rather than receding. */
.subset-cog.has-off {
    color: var(--muted);
}

.subset-sources {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    /* As tall as its list, never stretched down the column: the sets below
       keep their place. */
    flex: none;
    align-self: stretch;
    padding: 0.4rem 0.45rem 0.45rem;
    background: color-mix(in srgb, var(--panel-hover) 70%, transparent);
    border-radius: 0.85rem;
}

.subset-sources[hidden] {
    display: none;
}

.source-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.05rem 0.3rem 0.15rem;
}

.source-title {
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--faint);
}

.source-tally {
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

.source-list {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    /* A long list scrolls under the category instead of running off the
       bottom of the sidebar. */
    max-height: 13rem;
    overflow-y: auto;
}

/* Styled the narrow way, like the rail's, so the switches aren't squeezed
   by a browser scrollbar. */
.source-list::-webkit-scrollbar {
    width: 6px;
}

.source-list::-webkit-scrollbar-thumb {
    background: var(--scroll);
    border-radius: 1rem;
}

.source-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    padding: 0.2rem 0.3rem;
    font-size: 0.78rem;
    color: var(--muted);
    border-radius: 0.45rem;
    cursor: pointer;
}

.source-row:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--panel-hover) 90%, transparent);
}

.source-row input {
    flex-shrink: 0;
    width: 0.85rem;
    height: 0.85rem;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.source-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Off: struck through and quiet, but still readable enough to switch on. */
.source-row.is-off .source-name {
    color: var(--faint);
    text-decoration: line-through;
}

.subset-dot {
    flex-shrink: 0;
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 50%;
    background: var(--border-strong);
}

.subset-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subset-count {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

/* Footer row pinned to the foot of the rail: Settings and Bluesky Sign in
   share one horizontal line. Popover menus float above the row. */
.side-footer {
    position: relative;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.15rem;
}

.side-settings {
    position: static;
    flex: 0 0 auto;
}

.side-account {
    position: static;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    justify-content: flex-end;
}

.settings-button,
.account-button {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.9rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--muted);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.account-button {
    max-width: 100%;
    min-width: 0;
}

.account-button.is-signed-in {
    color: var(--text);
    background: var(--surface);
}

.settings-button:hover,
.settings-button[aria-expanded="true"],
.account-button:hover,
.account-button[aria-expanded="true"] {
    background: var(--surface);
    color: var(--text);
}

.settings-button svg {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
}

.account-avatar-slot {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    color: var(--accent);
}

.account-avatar-slot svg {
    width: 100%;
    height: 100%;
}

.account-avatar-img {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    object-fit: cover;
}

.account-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-menu,
.account-menu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.7rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    box-shadow: var(--tip-shadow);
}

.settings-menu {
    left: 0;
}

.account-menu {
    right: 0;
    min-width: 14rem;
    max-width: min(19rem, calc(100vw - 2rem));
}

/* Without this the flex display above would beat the [hidden] attribute. */
.settings-menu[hidden],
.account-menu[hidden] {
    display: none;
}

.account-card {
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--border);
}

.account-card-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-card-handle {
    font-size: 0.74rem;
    color: var(--faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-link,
.account-menu-signout {
    display: block;
    width: 100%;
    padding: 0.42rem 0.55rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: left;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.account-menu-link:hover,
.account-menu-signout:hover {
    background: var(--wash);
    color: var(--text);
}

.account-menu-signout:hover {
    color: var(--down);
}

.settings-title {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--faint);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.settings-options {
    display: flex;
    gap: 0.3rem;
}

.settings-option {
    padding: 0.35rem 0.65rem;
    font: inherit;
    font-size: 0.8rem;
    color: var(--muted);
    background: color-mix(in srgb, var(--panel-hover) 70%, transparent);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.settings-option:hover {
    background: var(--panel-hover);
    color: var(--text);
}

.settings-option[aria-pressed="true"] {
    background: var(--accent-fill);
    color: var(--text);
    font-weight: 600;
}

.ghost-btn {
    padding: 0.5rem 0.8rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.ghost-btn:hover {
    background: var(--panel-hover);
    border-color: var(--border-strong);
}

.ghost-btn:focus-visible,
.set-button:focus-visible,
.sidebar-toggle:focus-visible,
.rail-toggle:focus-visible,
.card:focus-visible,
.top-toggle:focus-visible,
.card-story:focus-visible,
.card-sources a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------- feed */

/* Feed and top stories side by side, the pair centred in the space beside
   the sidebar. */
.content {
    --content-gap: clamp(1.25rem, 2.5vw, 2.5rem);
    grid-column: 2;
    display: grid;
    grid-template-columns: var(--feed-col) 25.2rem;
    justify-content: center;
    align-items: start;
    gap: var(--content-gap);
    padding: 1.75rem clamp(1rem, 2.5vw, 2rem) 4rem;
}

.feed {
    min-width: 0;
}

@media (min-width: 104.01rem) {
    /* Folded, the rail leaves the grid altogether: the stories recentre in the
       room it gives back, and its tab hangs on the edge of the screen rather
       than floating out in the margin the centred pair leaves behind. */
    :root[data-rail="folded"] .content {
        grid-template-columns: var(--feed-col);
    }

    :root[data-rail="folded"] .side {
        position: fixed;
        top: 50%;
        right: 0;
        transform: translateY(-50%);
        z-index: 30;
        width: auto;
        min-height: 0;
        max-height: none;
        padding: 0;
        gap: 0;
    }

    :root[data-rail="folded"] .side > :not(.rail-toggle) {
        display: none;
    }

    :root[data-rail="folded"] .rail-toggle {
        position: static;
        transform: none;
        border-radius: 0.6rem 0 0 0.6rem;
    }
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: var(--feed-max);
}

.card {
    display: flex;
    flex-direction: column;
    padding: 0.95rem 1rem;
    color: inherit;
    background: var(--panel);
    border-radius: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.card:hover {
    background: var(--panel-hover);
}

/* Only the headline and the picture lead to the story — every other click is
   the card asking for its "also on" panel, so the two sit side by side. */
.card-main {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.card-thumb-link {
    flex-shrink: 0;
    display: block;
}

.card-expand {
    margin-top: 0.8rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--border);
    cursor: auto;
}

.card-expand-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--faint);
}

.card-sources {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-top: 0.35rem;
    list-style: none;
}

.card-sources a {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 0.6rem;
    padding: 0.32rem 0.35rem;
    border-radius: 0.4rem;
    color: var(--muted);
    text-decoration: none;
}

.card-sources a:hover {
    background: var(--surface);
    color: var(--text);
}

/* The outlet this card came from leads the list. */
.card-sources a.is-current .card-source-title {
    color: var(--text);
    font-weight: 600;
}

.card-source-outlet {
    padding-top: 0.1rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-source-title {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text);
}

/* A story that arrived with a poll stays lit for 30 seconds (NEW_CARD_MS in
   app.js drops the class at the same moment), then eases back to normal. */
/* Card layouts, picked from the settings at the foot of the rail. Normal is
   the untouched look; the other two only add or remove. */
/* Which side the picture sits on, also from the settings. */
:root[data-thumb="left"] .card-main {
    flex-direction: row-reverse;
}

:root[data-density="compact"] .card-blurb {
    display: none;
}

/* Without the excerpt the card is shorter than its picture, which left a gap
   under the source line; a smaller square keeps the two level. */
:root[data-density="compact"] .card-thumb {
    width: 4.1rem;
}

:root[data-density="comfy"] .card-thumb {
    width: 10rem;
}

.card.is-new {
    animation: card-arrive 30s ease-out both;
}

@keyframes card-arrive {
    0% {
        background: color-mix(
            in srgb,
            var(--card-accent, var(--accent)) 26%,
            var(--panel)
        );
        border-color: var(--card-accent, var(--accent));
    }
    5%,
    90% {
        background: color-mix(
            in srgb,
            var(--card-accent, var(--accent)) 15%,
            var(--panel)
        );
        border-color: color-mix(
            in srgb,
            var(--card-accent, var(--accent)) 55%,
            transparent
        );
    }
    100% {
        background: var(--panel);
        border-color: var(--border);
    }
}

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

.card-kicker {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
}

.card-kicker .dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--accent);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text);
}

/* Headline and excerpt share one link laid over the text block: the whole
   block is the target, but it still reads as plain type inside the card. */
.card-story {
    display: block;
    color: inherit;
    text-decoration: none;
}

.card-story:hover .card-title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.card-blurb {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.55rem;
    font-size: 0.72rem;
    color: var(--faint);
}

.card-meta img {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 0.15rem;
    object-fit: contain;
}

/* "+2 others", between the outlet and the age. */
.card-others {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.card-outlet {
    color: var(--muted);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-thumb {
    width: 5.5rem;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 0.55rem;
    background: var(--surface);
}

.card-thumb-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.92);
}

.card-thumb-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card-thumb-initial {
    font-size: 1.3rem;
    font-weight: 600;
    color: #161617;
}

.feed-more {
    max-width: var(--feed-max);
    padding-top: 1rem;
}

.feed-more .ghost-btn {
    width: 100%;
}

.state-note {
    padding: 2.5rem 0.25rem;
    font-size: 0.85rem;
    color: var(--faint);
}

/* Skeleton while the first stories land. */
.card.is-loading {
    display: block;
    height: 6.5rem;
    background: linear-gradient(
        100deg,
        var(--panel) 20%,
        var(--panel-hover) 40%,
        var(--panel) 60%
    );
    background-size: 220% 100%;
    animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
    to {
        background-position: -120% 0;
    }
}

/* ------------------------------------------------------------------- rail */

/* The markets strip and the ranking card stack in one sticky column. */
.side {
    position: sticky;
    top: 1.75rem;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: calc(100vh - 3.5rem);
}

/* The rail's fold, hanging on the seam between the stories and the ranking.
   Narrow screens turn it into a tab on the edge of the drawer. */
.rail-toggle {
    position: absolute;
    top: 50%;
    left: -0.85rem;
    transform: translateY(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    visibility: visible;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: var(--tip-shadow);
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.rail-toggle:hover {
    color: var(--text);
    background: var(--panel-hover);
    border-color: var(--border-strong);
}

.rail-toggle svg {
    width: 0.9rem;
    height: 0.9rem;
    transition: transform 0.2s ease;
}

/* Folded, the chevron turns to point back at the ranking. */
:root[data-rail="folded"] .rail-toggle svg {
    transform: rotate(180deg);
}

/* Search for the stories in the set on screen, above the index strip. */
.rail-search {
    flex-shrink: 0;
    display: block;
}

.search-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--panel);
    border: 0;
    border-radius: 0.875rem;
    appearance: none;
}

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

.search-input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Index moves above the ranking: Dow, Nasdaq and the S&P, read from CNBC. */
.markets {
    flex-shrink: 0;
    padding: 0.75rem;
    background: var(--panel);
    border-radius: 0.9rem;
    transition: opacity 0.2s ease;
}

.markets.is-stale {
    opacity: 0.55;
}

.markets-row {
    display: flex;
    gap: 0.5rem;
}

.tick {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.5rem 0.5rem;
    background: var(--rail-card);
    border-radius: 0.6rem;
}

.tick-name {
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tick-change,
.tick-pct {
    font-size: 0.88rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--muted);
}

.tick-pct {
    font-size: 0.8rem;
}

.tick-value {
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

.tick-change.up,
.tick-pct.up {
    color: var(--up);
}

.tick-change.down,
.tick-pct.down {
    color: var(--down);
}

/* Today's ranking is its own card, not a full-height sidebar. */
.rail {
    position: static;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    margin: 0;
    padding: 1.05rem 0.75rem 0.9rem;
    background: var(--panel);
    border-radius: 0.9rem;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll) transparent;
}

.rail::-webkit-scrollbar {
    width: 8px;
}

.rail::-webkit-scrollbar-thumb {
    background: var(--scroll);
    border-radius: 1rem;
}

.rail-title {
    padding: 0.15rem 0.5rem 0.7rem;
}

/* The story count, sitting under the ranking card. */
.side-note {
    margin: 0;
    padding: 0 0.75rem;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: var(--faint);
}

/* The set's address in that line leads back to the set. */
.side-note-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 0.15em;
}

.side-note-link:hover {
    color: var(--text);
    text-decoration-color: currentColor;
}

/* Sits just under the count line, not a full gap away from it. */
.side-note-old {
    margin-top: -0.55rem;
}

.top-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    list-style: none;
}

/* Every top story is its own small card inside the rail, and opens in place
   the way a top-story card does on the board. */
.top-item {
    background: var(--rail-card);
    border-radius: 0.7rem;
    overflow: hidden;
    transition: background 0.15s ease;
}

.top-toggle {
    display: flex;
    gap: 0.55rem;
    width: 100%;
    padding: 0.6rem 0.65rem;
    font: inherit;
    text-align: left;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.15s ease;
}

.top-toggle:hover,
.top-item.expanded .top-toggle {
    background: var(--wash-soft);
}

.top-rank {
    flex-shrink: 0;
    width: 1.1rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
    color: var(--faint);
}

.top-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-headline {
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text);
}

.top-meta {
    margin-top: 0.2rem;
    font-size: 0.7rem;
    color: var(--faint);
}

.top-expand {
    padding: 0.7rem 0.7rem 0.8rem;
    border-top: 1px solid var(--border);
}

.top-why {
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--muted);
}

.top-why strong {
    font-weight: 600;
    color: var(--text);
}

/* The rail's panel borrows the feed cards' "Seen on" rows; only the outlet
   column narrows, because the rail is short on width. */
.top-seen-label {
    margin-top: 0.7rem;
}

.top-seen a {
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.3rem;
}

.rail-empty {
    padding: 0.25rem 0.5rem;
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--faint);
}

/* ---------------------------------------------------------------- phone bar */

/* Phone chrome: a bar on top holding the search, one at the bottom holding a
   button for each panel. Both stay out of the way on wider screens, which
   have the search in the ranking and a tab on each panel's edge instead. */
.mobile-header,
.mobile-footer {
    display: none;
    position: fixed;
    right: 0;
    left: 0;
    z-index: 70;
    background: var(--bg);
}

.mobile-header {
    top: 0;
    align-items: center;
    gap: 0.6875rem;
    min-height: var(--mobile-header-h);
    padding: 0.625rem 1.0625rem;
    border-bottom: 1px solid var(--border);
}

.mobile-slot {
    flex: 1;
    min-width: 0;
}

.mobile-header .search-input {
    padding: 0.6875rem 0.9375rem;
    font-size: 1rem;
    border-radius: 0.875rem;
    background: var(--surface);
}

.mobile-header .side-account {
    position: relative;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 46%;
}

.mobile-header .account-button {
    gap: 0.6875rem;
    padding: 0.5625rem 0.9rem;
    font-size: 1.025rem;
    background: var(--surface);
    white-space: nowrap;
}

.mobile-header .account-button:not(.is-signed-in) {
    gap: 0;
    padding: 0.6875rem;
    justify-content: center;
}

.mobile-header .account-button:not(.is-signed-in) .account-label,
.mobile-header .account-button.is-signed-in .account-label,
header#mobileHeader > div#accountWrap > button#accountToggle.is-signed-in .account-label {
    display: none !important;
}

.mobile-header .account-button.is-signed-in {
    gap: 0;
    padding: 0.6875rem;
    justify-content: center;
}

.mobile-header .account-avatar-slot {
    width: 1.4375rem;
    height: 1.4375rem;
}

.mobile-header .account-avatar-img {
    width: 1.5625rem;
    height: 1.5625rem;
}

.mobile-header .account-menu {
    top: calc(100% + 0.5rem);
    bottom: auto;
    right: 0;
    z-index: 80;
}

.mobile-footer {
    bottom: 0;
    gap: 0.55rem;
    padding: 0.5rem 0.85rem;
    border-top: 1px solid var(--border);
}

/* One button per panel, lit for as long as that panel is open. */
.mobile-panel {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.6rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 0;
    border-radius: 0.7rem;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.mobile-panel svg {
    width: 1rem;
    height: 1rem;
}

.mobile-panel:hover {
    color: var(--text);
}

:root[data-sidebar="open"] #mobileSets,
:root[data-rail="open"] #mobileTop {
    color: var(--text);
    background: var(--accent-fill);
}

.mobile-panel:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 104rem) {
    body {
        grid-template-columns: 21rem minmax(0, 1fr);
    }

    /* Not enough room for a column, so the ranking slides over the page as a
       drawer instead, shut until its tab is pressed. */
    :root {
        --rail-width: min(22rem, 86vw);
    }

    /* One column, the stories keeping their full width and the room the rail
       would have taken going spare either side of them. */
    .content {
        grid-template-columns: var(--feed-col);
        justify-content: center;
    }

    .side {
        position: fixed;
        top: 0;
        bottom: 0;
        right: calc(-1 * var(--rail-width));
        z-index: 60;
        width: var(--rail-width);
        /* Its own height, so the ranking scrolls inside the drawer rather than
           running off the bottom of a locked page. */
        height: 100vh;
        height: 100dvh;
        max-height: none;
        padding: 1.1rem 1rem 1.5rem;
        overflow-y: auto;
        background: var(--bg);
        border-left: 1px solid var(--border);
        /* Hidden as well as off the page, so its links leave the tab order. */
        visibility: hidden;
        transition:
            right 0.25s ease,
            visibility 0s linear 0.25s;
    }

    :root[data-rail="open"] .side {
        right: 0;
        visibility: visible;
        transition:
            right 0.25s ease,
            visibility 0s;
    }

    /* The page behind the drawer holds still while it's open. */
    :root[data-rail="open"] body {
        overflow: hidden;
    }

    /* A tab riding the drawer's outer edge, there whether it's open or shut. */
    .rail-toggle {
        position: fixed;
        top: 50%;
        right: 0;
        left: auto;
        transform: translateY(-50%);
        border-radius: 0.6rem 0 0 0.6rem;
        transition:
            right 0.25s ease,
            background 0.15s ease,
            border-color 0.15s ease,
            color 0.15s ease;
    }

    :root[data-rail="open"] .rail-toggle {
        right: var(--rail-width);
    }

    .rail-scrim {
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgb(0 0 0 / 50%);
    }

    /* Natural height, so the whole list is in the drawer's scroll area. */
    .rail {
        flex: 0 0 auto;
        overflow: visible;
    }
}

/* Under 76rem the sidebar folds to its icons — a 4.9rem column of set icons,
   the theme switch and the settings tile — so the stories take back the width
   the names and counts were using. It is still a column here; the drawer that
   replaces it entirely waits until the phone width below. The folded styles
   themselves live with the other collapsed rules, above. app.js folds it.
*/

@media (max-width: 52rem) {
    /* The bars' own heights, so the drawers sit flush between them. */
    :root {
        --mobile-header-h: 4.140625rem;
        --mobile-footer-h: 3.3125rem;
    }

    /* No room for the icon column either, so the sidebar leaves the flow and
       rides over the stories as a drawer, opened from the footer's Sets
       button. app.js keeps it shut until asked for, since an open drawer
       would sit on top of the board every visit. */
    :root {
        --side-width: min(21rem, 86vw);
    }

    body {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: calc(-1 * var(--side-width));
        z-index: 60;
        width: var(--side-width);
        max-height: none;
        overflow-y: auto;
        /* Hidden as well as off the page, so its links leave the tab order. */
        visibility: hidden;
        transition:
            left 0.25s ease,
            visibility 0s linear 0.25s;
    }

    :root[data-sidebar="open"] .sidebar {
        left: 0;
        visibility: visible;
        transition:
            left 0.25s ease,
            visibility 0s;
    }

    /* The page behind the drawer holds still while it's open. */
    :root[data-sidebar="open"] body {
        overflow: hidden;
    }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgb(0 0 0 / 50%);
    }

    .mobile-header,
    .mobile-footer {
        display: flex;
    }

    /* The footer's buttons drive both panels, so their edge tabs go. */
    .sidebar-toggle,
    .rail-toggle {
        display: none;
    }

    /* Each drawer hangs between the two bars rather than behind them, its own
       height so the panel scrolls inside instead of running under them. */
    .sidebar,
    .side {
        top: var(--mobile-header-h);
        bottom: var(--mobile-footer-h);
        height: calc(100vh - var(--mobile-header-h) - var(--mobile-footer-h));
        height: calc(100dvh - var(--mobile-header-h) - var(--mobile-footer-h));
    }

    .content {
        padding: calc(var(--mobile-header-h) + 1rem) 1rem
            calc(var(--mobile-footer-h) + 1.4rem);
    }

    .card-thumb {
        width: 5.5rem;
    }

    :root[data-density="comfy"] .card-thumb {
        width: 7rem;
    }

    :root[data-density="compact"] .card-thumb {
        width: 3.4rem;
    }

    /* A phone has no room for a column of outlet names beside headlines. */
    .card-sources a {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.1rem;
    }
}

/* ----------------------------------------------------- AT-Proto social news website UI */

.source-avatar {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.source-empty {
    padding: 0.35rem 0.3rem;
    font-size: 0.74rem;
    color: var(--faint);
}

/* Feed toolbar: Hot / New / Top / Saved sort bar */
.feed-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    max-width: var(--feed-max);
    margin-bottom: 0.75rem;
}

.sort-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 2rem;
}

.sort-tab {
    padding: 0.35rem 0.78rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 2rem;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}

.sort-tab:hover {
    color: var(--text);
    background: var(--wash);
}

.sort-tab[aria-pressed="true"] {
    color: var(--text);
    font-weight: 600;
    background: var(--accent-fill);
}

.sort-tab:focus-visible,
.vote-btn:focus-visible,
.card-action:focus-visible,
.card-cat-btn:focus-visible,
.thread-close:focus-visible,
.comment-collapse:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.feed-scope {
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
    white-space: nowrap;
}

/*  upvote / downvote gutter */
.card-vote {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    min-width: 2.5rem;
    padding-top: 0.1rem;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    color: var(--faint);
    background: transparent;
    border: 0;
    border-radius: 0.4rem;
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease,
        transform 0.1s ease;
}

.vote-btn svg {
    width: 1.35rem;
    height: 1.35rem;
}

.vote-btn:hover {
    background: var(--wash);
    color: var(--text);
}

.vote-btn:active {
    transform: scale(0.9);
}

.vote-up.is-active,
.vote-up:hover {
    color: #ff6b35;
}

.vote-down.is-active,
.vote-down:hover {
    color: var(--accent);
}

.vote-score {
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--muted);
}

.is-upvoted .vote-score {
    color: #ff6b35;
}

.is-downvoted .vote-score {
    color: var(--accent);
}

/* Post metadata kicker: Community · Author · Time · Domain */
.card-kicker {
    flex-wrap: wrap;
    text-transform: none;
    letter-spacing: 0.01em;
    font-weight: 400;
    font-size: 0.75rem;
    margin-bottom: 0.35rem;
}

.card-cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.card-cat-btn:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.meta-sep {
    color: var(--faint);
}

.card-author-link {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    min-width: 0;
}

.card-author-link:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.card-author-avatar {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.card-author-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-time {
    color: var(--faint);
    text-decoration: none;
}

.card-time:hover {
    color: var(--muted);
    text-decoration: underline;
}

.card-domain {
    color: var(--faint);
    font-size: 0.72rem;
}

/* Video indicator on post thumbnail */
.card-thumb-link {
    position: relative;
}

.thumb-video-badge {
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    color: #ffffff;
    background: rgba(15, 15, 18, 0.78);
    border-radius: 50%;
    pointer-events: none;
}

.thumb-video-badge svg {
    width: 0.85rem;
    height: 0.85rem;
}

/* action bar */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.65rem;
    margin-top: 0.55rem;
}

.card-action,
.card-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.45rem;
    margin-left: -0.45rem;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
    background: transparent;
    border: 0;
    border-radius: 0.4rem;
    text-decoration: none;
}

.card-action {
    cursor: pointer;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.card-action:hover {
    color: var(--text);
    background: var(--wash);
}

.card-action.is-saved {
    color: var(--accent);
}

.card-action svg,
.card-stat svg {
    width: 0.9rem;
    height: 0.9rem;
    flex-shrink: 0;
}

.card-others {
    color: var(--muted);
}

.top-thread-btn {
    width: 100%;
    margin-top: 0.65rem;
    font-size: 0.74rem;
    padding: 0.4rem 0.65rem;
}

/* -------------------------------------------- AT-Protocol Thread Modal */

:root[data-thread="open"] body {
    overflow: hidden;
}

.thread-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2.2rem 1.25rem;
    background: rgba(8, 8, 10, 0.72);
    backdrop-filter: blur(4px);
}

.thread-backdrop[hidden] {
    display: none;
}

.thread-dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 52rem;
    max-height: calc(100vh - 4.4rem);
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 1rem;
    box-shadow: var(--tip-shadow);
    overflow: hidden;
}

.thread-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
}

.thread-dialog-kicker {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thread-dialog-kicker .dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.thread-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.thread-close:hover {
    color: var(--text);
    background: var(--panel-hover);
}

.thread-close svg {
    width: 1rem;
    height: 1rem;
}

.thread-scroll {
    overflow-y: auto;
    padding: 1.25rem;
}

.thread-wrap {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.thread-post-main {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.thread-post-content {
    flex: 1;
    min-width: 0;
}

.thread-author-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.thread-avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.thread-author-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.thread-author-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.thread-author-name:hover {
    text-decoration: underline;
}

.thread-author-handle {
    font-size: 0.74rem;
    color: var(--faint);
}

.thread-title {
    font-size: 1.18rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    text-wrap: balance;
}

.thread-fulltext {
    margin-top: 0.65rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.facet-link {
    color: var(--accent);
    text-decoration: none;
}

.facet-link:hover {
    text-decoration: underline;
}

.thread-external-card {
    display: flex;
    gap: 0.85rem;
    margin-top: 0.85rem;
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.thread-external-card:hover {
    background: var(--panel-hover);
    border-color: var(--border-strong);
}

.thread-external-thumb {
    width: 7.5rem;
    height: 5.2rem;
    object-fit: cover;
    border-radius: 0.45rem;
    flex-shrink: 0;
}

.thread-external-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.thread-external-domain {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--faint);
}

.thread-external-title {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}

.thread-external-desc {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thread-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.thread-image {
    width: 100%;
    max-height: 24rem;
    object-fit: cover;
    border-radius: 0.65rem;
    background: var(--surface);
    margin-top: 0.75rem;
}

.thread-images .thread-image {
    margin-top: 0;
}

.thread-quote-card {
    display: block;
    margin-top: 0.85rem;
    padding: 0.75rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    color: inherit;
    text-decoration: none;
}

.thread-quote-card:hover {
    border-color: var(--border-strong);
}

.thread-quote-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
}

.thread-quote-avatar {
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    object-fit: cover;
}

.thread-quote-author {
    font-weight: 600;
    color: var(--text);
}

.thread-quote-handle {
    color: var(--faint);
}

.thread-quote-text {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.thread-quote-card.is-unavailable {
    border-style: dashed;
    cursor: default;
}

.thread-quote-card.is-unavailable .thread-quote-text {
    margin-top: 0;
    color: var(--faint);
    font-style: italic;
}

.thread-quote-card.is-compact {
    margin-top: 0.45rem;
    padding: 0.55rem 0.7rem;
}

.thread-external-card.is-compact {
    margin-top: 0.45rem;
    padding: 0.55rem 0.65rem;
    gap: 0.65rem;
}

.thread-external-card.is-compact .thread-external-thumb {
    width: 5.2rem;
    height: 3.8rem;
}

.thread-images.is-compact {
    margin-top: 0.45rem;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.thread-image.is-compact {
    margin-top: 0.45rem;
    max-height: 16rem;
    width: auto;
    max-width: 100%;
}

.thread-images.is-compact .thread-image.is-compact {
    margin-top: 0;
    width: 100%;
}

.thread-quote-external {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    margin-top: 0.4rem;
    padding: 0.4rem 0.55rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.45rem;
}

.thread-quote-external-title {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.thread-quote-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 0.35rem;
    margin-top: 0.45rem;
}

.thread-quote-thumb {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 11rem;
    margin-top: 0.45rem;
    object-fit: cover;
    border-radius: 0.45rem;
    background: var(--panel);
}

.thread-quote-images .thread-quote-thumb {
    margin-top: 0;
    width: 100%;
}

.thread-actions {
    margin-top: 0.85rem;
}

.thread-also {
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.thread-reply-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
}

.thread-reply-cta {
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
}

.thread-reply-cta:hover {
    text-decoration: underline;
}

.thread-comments {
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

.thread-comments-title {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 0.75rem;
}

.thread-loading,
.thread-empty {
    padding: 1rem 0;
}

/* Nested comment tree */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.comment-node.is-nested {
    margin-top: 0.65rem;
}

.comment-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
}

.comment-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--faint);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    cursor: pointer;
}

.comment-collapse:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.comment-avatar {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    object-fit: cover;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.comment-author:hover {
    text-decoration: underline;
}

.comment-handle,
.comment-time {
    color: var(--faint);
    text-decoration: none;
}

.comment-time:hover {
    color: var(--muted);
    text-decoration: underline;
}

.comment-body-wrap {
    display: grid;
    grid-template-columns: 1.25rem minmax(0, 1fr);
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.comment-branch {
    position: relative;
    width: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.comment-branch::before {
    content: "";
    position: absolute;
    top: 0.1rem;
    bottom: 0.1rem;
    left: 50%;
    width: 1px;
    background: var(--border-strong);
    transform: translateX(-50%);
    transition: background 0.15s ease;
}

.comment-branch:hover::before {
    background: var(--accent);
}

.comment-inner {
    min-width: 0;
}

.comment-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-foot {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

.comment-reply-link {
    color: var(--faint);
    text-decoration: none;
}

.comment-reply-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.comment-node.is-collapsed .comment-body-wrap {
    display: none;
}

/* ------------------------------------------- Bluesky Account, Reposts, Reply */

.card-repost.is-reposted {
    color: var(--up);
}

.comment-like-btn,
.comment-reply-btn {
    padding: 0.1rem 0.25rem;
    font: inherit;
    font-size: 0.72rem;
    color: var(--faint);
    background: transparent;
    border: 0;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.comment-like-btn:hover,
.comment-reply-btn:hover {
    color: var(--text);
    background: var(--wash);
}

.comment-like-btn.is-liked {
    color: #ff6b35;
    font-weight: 600;
}

.thread-reply-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.thread-reply-signin {
    padding: 0.35rem 0.75rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--accent);
    border: 0;
    border-radius: 0.45rem;
    cursor: pointer;
    white-space: nowrap;
}

.thread-reply-signin:hover {
    opacity: 0.92;
}

.thread-composer {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.75rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

.comment-reply-form {
    margin-top: 0.55rem;
    margin-bottom: 0.35rem;
}

.thread-composer-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.76rem;
    color: var(--muted);
}

.thread-composer-avatar {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    object-fit: cover;
}

.thread-composer-input {
    width: 100%;
    min-height: 4.5rem;
    padding: 0.55rem 0.65rem;
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    resize: vertical;
}

.comment-reply-form .thread-composer-input {
    min-height: 3.4rem;
    font-size: 0.82rem;
}

.thread-composer-input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.thread-composer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.thread-composer-count {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
}

.thread-composer-count.is-over {
    color: var(--down);
    font-weight: 600;
}

.thread-composer-btns {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.thread-composer-error {
    font-size: 0.76rem;
    color: var(--down);
}

.thread-composer-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: #34d399;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 0.5rem;
}

:root[data-theme="light"] .thread-composer-status {
    color: #047857;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.thread-composer-status-link {
    color: inherit;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.comment-node.is-just-posted > .comment-body-wrap > .comment-inner {
    padding: 0.45rem 0.65rem;
    background: rgba(56, 189, 248, 0.08);
    border-left: 2px solid var(--accent);
    border-radius: 0 0.5rem 0.5rem 0;
}

.comment-posted-badge {
    padding: 0.08rem 0.42rem;
    font-size: 0.66rem;
    font-weight: 600;
    color: #34d399;
    background: rgba(52, 211, 153, 0.14);
    border-radius: 999px;
}

:root[data-theme="light"] .comment-posted-badge {
    color: #047857;
    background: rgba(16, 185, 129, 0.14);
}

.card-repost-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--up);
    font-weight: 500;
}

.auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(8, 8, 10, 0.72);
    backdrop-filter: blur(4px);
}

.auth-backdrop[hidden] {
    display: none;
}

.auth-dialog {
    width: 100%;
    max-width: 27rem;
    background: var(--panel);
    border: 1px solid var(--border-strong);
    border-radius: 1rem;
    box-shadow: var(--tip-shadow);
    overflow: hidden;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.2rem 1.25rem 1.3rem;
}

.auth-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.auth-subtitle {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--muted);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--muted);
}

.auth-help-link {
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.auth-help-link:hover {
    text-decoration: underline;
}

.auth-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font: inherit;
    font-size: 0.88rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
}

.auth-input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.auth-note {
    font-size: 0.74rem;
    line-height: 1.4;
    color: var(--faint);
}

.auth-error {
    padding: 0.5rem 0.65rem;
    font-size: 0.78rem;
    color: var(--down);
    background: color-mix(in srgb, var(--down) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--down) 35%, transparent);
    border-radius: 0.5rem;
}

.auth-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.auth-submit {
    padding: 0.5rem 0.95rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--accent);
    border: 0;
    border-radius: 0.55rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.auth-submit:hover {
    opacity: 0.92;
}

.auth-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.account-button:focus-visible,
.account-menu-link:focus-visible,
.account-menu-signout:focus-visible,
.auth-submit:focus-visible,
.thread-reply-signin:focus-visible,
.comment-like-btn:focus-visible,
.comment-reply-btn:focus-visible,
.new-thread-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.feed-toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.new-thread-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--accent);
    border: 0;
    border-radius: 9999px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    white-space: nowrap;
}

.new-thread-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.new-thread-btn:active {
    transform: translateY(0);
}

.new-thread-btn svg {
    flex-shrink: 0;
}

.post-thread-dialog {
    max-width: 32rem;
}

.post-thread-form {
    padding: 1.25rem 1.4rem 1.4rem;
    gap: 0.9rem;
}

.post-thread-select {
    cursor: pointer;
    background-color: var(--surface);
    color: var(--text);
}

.post-thread-tags-badge {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.65rem;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 0.5rem;
    font-size: 0.76rem;
    color: var(--text);
}

.post-thread-tags-label {
    color: var(--muted);
    font-size: 0.74rem;
}

.post-thread-tags-list {
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.01em;
}

.post-thread-textarea {
    width: 100%;
    min-height: 7.5rem;
    max-height: 18rem;
    resize: vertical;
    padding: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.post-thread-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted);
}

.post-thread-count.is-over {
    color: var(--down);
    font-weight: 600;
}

.post-thread-user {
    font-size: 0.75rem;
    color: var(--muted);
}

.post-thread-signin-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.8rem;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 0.55rem;
    font-size: 0.8rem;
    color: var(--text);
}

/* ----------------------------------------------------- Admin Role Styling */

.account-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.08rem 0.42rem;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 0.32rem;
    line-height: 1.3;
}

.role-badge-admin {
    color: var(--admin-badge-text);
    background: var(--admin-badge-bg);
    border: 1px solid var(--admin-card-border);
}

.card.is-admin-post {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-card-border);
}

.card.is-admin-post:hover {
    background: var(--admin-card-hover);
}

.thread-post.is-admin-post {
    padding: 0.9rem 1rem;
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-card-border);
    border-radius: 0.8rem;
}

.thread-author-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.comment-node.is-admin-comment {
    padding: 0.65rem 0.75rem;
    background: var(--admin-comment-bg);
    border: 1px solid var(--admin-card-border);
    border-radius: 0.65rem;
}

.comment-node.is-admin-comment .comment-node:not(.is-admin-comment) {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.new-thread-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
}

.post-thread-admin-notice {
    padding: 0.55rem 0.7rem;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--admin-badge-text);
    background: var(--admin-badge-bg);
    border: 1px solid var(--admin-card-border);
    border-radius: 0.55rem;
}

@media (max-width: 52rem) {
    .feed-toolbar {
        flex-wrap: wrap;
    }

    .card-main {
        gap: 0.65rem;
    }

    .card-vote {
        min-width: 2.1rem;
    }

    .card-actions {
        flex-wrap: nowrap;
        gap: 0.5rem;
        max-width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .card-actions::-webkit-scrollbar {
        display: none;
    }

    .card-actions .card-action {
        flex-shrink: 0;
        margin-left: 0;
        padding: 0.25rem 0.35rem;
        white-space: nowrap;
    }

    .card-actions .card-action:first-child {
        margin-left: -0.35rem;
    }

    .card-actions .action-word {
        display: none;
    }

    .thread-backdrop {
        padding: 0;
    }

    .thread-dialog {
        max-height: 100vh;
        max-height: 100dvh;
        height: 100%;
        border-radius: 0;
    }

    .thread-external-card {
        flex-direction: column;
    }

    .thread-external-thumb {
        width: 100%;
        height: 9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }

    /* Without the fade, a new story still reads as new for its 30 seconds. */
    .card.is-new {
        background: color-mix(
            in srgb,
            var(--card-accent, var(--accent)) 12%,
            var(--panel)
        );
        border-color: color-mix(
            in srgb,
            var(--card-accent, var(--accent)) 45%,
            transparent
        );
    }
}
