:root,
:root[data-theme="dark"] {
    --bg: #0a0f17;
    --surface: #0f1620;
    --surface-2: #121a25;
    --surface-3: #172131;
    --border: #1f2937;
    --border-strong: #2a3a52;
    --border-soft: #172131;
    --text: #e6edf3;
    --text-muted: #9aa4af;
    --text-dim: #6e7681;
    --accent: #8b80ff;
    --accent-hover: #a79dff;
    --on-accent: #0b0a1a;
    --accent-soft: rgba(139,128,255,0.12);
    --accent-border: rgba(139,128,255,0.34);
    --brand-1: #6d5bff;
    --brand-2: #b06cff;
    --brand-grad: linear-gradient(135deg, #6d5bff, #b06cff);
    --upvote: #ff7a59;
    --downvote: #7a8cff;
    --green: #3fb950;
    --thread: #1f2937;
    --thread-hover: #58a6ff;
    --row-tint: rgba(255,255,255,0.015);
    --shadow-card: 0 10px 40px rgba(0,0,0,0.4);
    --header-bg: rgba(10,15,23,0.85);
    --header-shadow: none;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --surface-3: #e7eaee;
    --border: #e2e5e9;
    --border-strong: #c8ccd1;
    --border-soft: #eef0f3;
    --text: #14161a;
    --text-muted: #565a60;
    --text-dim: #878a8c;
    --accent: #5b46e8;
    --accent-hover: #6f5bf0;
    --on-accent: #ffffff;
    --accent-soft: rgba(91,70,232,0.10);
    --accent-border: rgba(91,70,232,0.32);
    --brand-1: #5b46e8;
    --brand-2: #9b5cf0;
    --brand-grad: linear-gradient(135deg, #5b46e8, #9b5cf0);
    --upvote: #ff4500;
    --downvote: #5470d8;
    --green: #2da44e;
    --thread: #d8dbdf;
    --thread-hover: #0079d3;
    --row-tint: rgba(0,0,0,0.022);
    --shadow-card: 0 4px 22px rgba(15,30,55,0.10);
    --header-bg: rgba(255,255,255,0.85);
    --header-shadow: 0 1px 0 var(--border);
    color-scheme: light;
}

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

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ===== Header ===== */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1300px;
    margin: 0 auto;
    height: 66px;
    padding: 0 20px 0 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.tl-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
}
.logo span { color: var(--accent); }
.logo-mark {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    display: block;
}
.brand-tag {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    padding: 3px 8px;
    border-radius: 999px;
}
@media (max-width: 720px) { .brand-tag { display: none; } }

.search {
    flex: 1;
    max-width: 640px;
    position: relative;
}
.search input {
    width: 100%;
    height: 46px;
    padding: 0 18px 0 46px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}
.search input:focus { border-color: var(--accent); }
.search::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    background-color: var(--text-muted);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat center / contain;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") no-repeat center / contain;
}

/* Search autocomplete dropdown */
.ac-menu {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.32); padding: 6px; max-height: 70vh; overflow-y: auto;
}
.ac-row {
    display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px;
    text-decoration: none; cursor: pointer;
}
.ac-row:hover, .ac-row.is-active { background: var(--surface-2); }
.ac-fav { width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0; object-fit: contain; }
.ac-fav-ph { background: var(--surface-3); }
.ac-search-ico { display: grid; place-items: center; color: var(--text-muted); }
.ac-search-ico svg { width: 16px; height: 16px; }
.ac-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; }
.ac-tag { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 0.9rem; }
.ac-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.ac-label { color: var(--text); font-size: 0.92rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-row.is-active .ac-label, .ac-row:hover .ac-label { color: var(--accent); }
.ac-sub { color: var(--text-dim); font-size: 0.76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-kind { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.ac-all { border-top: 1px solid var(--border-soft); margin-top: 4px; padding-top: 11px; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

.btn {
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s, transform 0.05s;
}
.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
    border: 1px solid var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand-grad);
    font-weight: 700;
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.avatar.sm { width: 26px; height: 26px; font-size: 0.7rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar.huge { width: 80px; height: 80px; font-size: 1.8rem; border: 4px solid var(--surface); }

.avatar.a-orange { background: linear-gradient(135deg, #ff7a59, #ffb347); }
.avatar.a-green  { background: linear-gradient(135deg, #46c98b, #8ed5a8); }
.avatar.a-pink   { background: linear-gradient(135deg, #ff5b9c, #ffa1c2); }
.avatar.a-yellow { background: linear-gradient(135deg, #f0c419, #f5d97a); }
.avatar.a-teal   { background: linear-gradient(135deg, #2ec4b6, #5fd8cc); }

/* ===== Layout ===== */
.layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr) 320px;
    gap: 24px;
    max-width: 1300px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}
.layout.no-right {
    grid-template-columns: 240px minmax(0, 1fr);
    max-width: 1100px;
}

/* ===== Sidebar (left) ===== */
.sidebar {
    align-self: start;
    padding-right: 4px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.nav-section { margin-bottom: 20px; }
.nav-title {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: var(--text-dim);
    padding: 8px 12px;
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text);
    font-size: 0.92rem;
    transition: background 0.12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.community-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.74rem;
    color: #ffffff;
    flex-shrink: 0;
}
.community-dot.lg { width: 72px; height: 72px; font-size: 2rem; border: 4px solid var(--surface); }
.c-blue   { background: #58a6ff; }
.c-orange { background: #ff7a59; }
.c-green  { background: #46c98b; }
.c-purple { background: #b768ff; }
.c-pink   { background: #ff5b9c; }

/* ===== Feed ===== */
.feed-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.sort-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.88rem;
    transition: background 0.12s, color 0.12s;
}
.sort-btn:hover { background: var(--surface-2); color: var(--text); }
.sort-btn.active { background: var(--surface-2); color: var(--accent); }
.sort-btn svg { width: 16px; height: 16px; }

.post {
    display: grid;
    grid-template-columns: 44px 1fr;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
    transition: border-color 0.12s;
}
.post:hover { border-color: var(--border-strong); }
.post.detail:hover { border-color: var(--border); }

.vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 4px;
    background: var(--row-tint);
}
.vote-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: var(--text-dim);
    transition: background 0.12s, color 0.12s;
}
.vote-btn:hover { background: var(--surface-2); }
.vote-btn.up:hover, .vote-btn.up.active { color: var(--upvote); }
.vote-btn.down:hover, .vote-btn.down.active { color: var(--downvote); }
.vote-btn svg { width: 18px; height: 18px; }
.vote-count {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
}
.vote-count.upvoted { color: var(--upvote); }

.post-body { padding: 12px 16px 8px; min-width: 0; }

.post-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.post-meta a { color: var(--text); font-weight: 600; }
.post-meta a:hover { color: var(--accent); }
.post-meta .dot { color: var(--text-dim); }
.post-meta .badge {
    background: var(--surface-2);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 10px;
    color: var(--text);
}
.post-title:hover { color: var(--accent); }
.post.detail .post-title { font-size: 1.5rem; cursor: default; }
.post.detail .post-title:hover { color: var(--text); }

.post-text {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post.detail .post-text {
    display: block;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    -webkit-line-clamp: unset;
}
.post.detail .post-text p { margin-bottom: 14px; }
.post.detail .post-text p:last-child { margin-bottom: 0; }

.post-image {
    width: 100%;
    max-height: 380px;
    background: var(--surface-2);
    border-radius: 8px;
    margin-bottom: 12px;
    display: grid;
    place-items: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    overflow: hidden;
}
.post-image.gradient-1 { background: linear-gradient(135deg, #1e3a5f, #2d5a8c); height: 280px; }
.post-image.gradient-2 { background: linear-gradient(135deg, #5f1e3a, #8c2d5a); height: 240px; }
.post-image.gradient-3 { background: linear-gradient(135deg, #2d5a3a, #46c98b); height: 220px; }
.post-image.gradient-4 { background: linear-gradient(135deg, #3a2d5a, #b768ff); height: 260px; }

.post-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 6px;
    flex-wrap: wrap;
}
.action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: background 0.12s;
}
.action:hover { background: var(--surface-2); }
.action svg { width: 16px; height: 16px; }

/* ===== Right sidebar ===== */
.right {
    align-self: start;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}
.card-banner {
    height: 48px;
    background: linear-gradient(135deg, #58a6ff, #b768ff);
}
.card-body { padding: 14px 16px; }
.card-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 8px;
}
.card-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}
.card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.stat-num { font-weight: 700; font-size: 0.95rem; }
.stat-label { color: var(--text-dim); font-size: 0.75rem; }

.trending-item {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    transition: background 0.12s;
}
.trending-item:first-of-type { border-top: none; }
.trending-item:hover { background: var(--surface-2); }
.trending-rank {
    font-weight: 700;
    color: var(--text-dim);
    font-size: 1.1rem;
    min-width: 18px;
}
.trending-title { font-size: 0.85rem; font-weight: 500; line-height: 1.35; }
.trending-meta { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }

.rules-list { padding: 0 16px 12px; }
.rule {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}
.rule:first-of-type { border-top: none; }
.rule-num { color: var(--text-dim); font-weight: 700; min-width: 16px; }

.mods-list { padding: 0 16px 14px; }
.mod {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.mod a { color: var(--text); font-weight: 500; }
.mod a:hover { color: var(--accent); }

/* ===== Community banner ===== */
.community-cover {
    height: 120px;
    background: linear-gradient(135deg, #1e3a5f 0%, #58a6ff 50%, #b768ff 100%);
}
.community-cover.c-blue   { background: linear-gradient(135deg, #1e3a5f 0%, #58a6ff 55%, #79b8ff 100%); }
.community-cover.c-orange { background: linear-gradient(135deg, #5f2419 0%, #ff7a59 55%, #ffb347 100%); }
.community-cover.c-green  { background: linear-gradient(135deg, #1e5f3a 0%, #46c98b 55%, #8ed5a8 100%); }
.community-cover.c-purple { background: linear-gradient(135deg, #3a1e5f 0%, #9b5cff 50%, #d49bff 100%); }
.community-cover.c-pink   { background: linear-gradient(135deg, #5f1e3a 0%, #ff5b9c 55%, #ffa1c2 100%); }

.community-header {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px 20px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
}
.community-dot.lg {
    width: 76px;
    height: 76px;
    font-size: 2.1rem;
    border: 4px solid var(--bg);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    margin-top: -38px;
    flex-shrink: 0;
}
.community-header-meta {
    flex: 1;
    min-width: 0;
    padding-top: 6px;
}
.community-name {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.community-handle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.community-handle .handle-slug { color: var(--text); font-weight: 500; }
.community-handle .stat-num { color: var(--text); font-weight: 600; }
.community-handle .sep {
    color: var(--text-dim);
    width: 3px;
    height: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    display: inline-block;
}
.community-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 6px;
}
.btn-joined,
button.btn-joined[disabled] {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: default;
    opacity: 1;
}
.btn-joined svg { width: 14px; height: 14px; color: var(--green); }
.btn-create-post {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-create-post svg { width: 14px; height: 14px; }

.community-tabs {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
}
.community-tab {
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.92rem;
    border-bottom: 2px solid transparent;
    transition: color 0.12s, border-color 0.12s;
    margin-bottom: -1px;
}
.community-tab:hover { color: var(--text); }
.community-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== Comments ===== */
.compose {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.compose-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}
.compose-meta a { color: var(--accent); font-weight: 600; }
.compose textarea {
    width: 100%;
    min-height: 96px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}
.compose textarea:focus { border-color: var(--accent); }
.compose-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.comments-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    color: var(--text-dim);
    font-size: 0.85rem;
}
.comments-toolbar select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.comment-tree {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 16px;
}

.comment {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 10px;
    padding: 12px 0;
    position: relative;
}
.comment + .comment { border-top: 1px solid var(--border); }

.comment-thread {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.comment-thread .thread-line {
    flex: 1;
    width: 2px;
    background: var(--thread);
    border-radius: 1px;
    margin-top: 4px;
    cursor: pointer;
    transition: background 0.12s;
}
.comment-thread .thread-line:hover { background: var(--thread-hover); }

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

.comment-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.comment-header .username {
    color: var(--text);
    font-weight: 600;
}
.comment-header .username:hover { color: var(--accent); }
.comment-header .op-badge {
    background: rgba(88,166,255,0.15);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.comment-header .mod-badge {
    background: rgba(70,201,139,0.15);
    color: #46c98b;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comment-body {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 6px;
}
.comment-body p + p { margin-top: 8px; }
.comment-body code {
    background: var(--surface-2);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.85em;
    color: var(--accent);
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: -8px;
}
.comment-actions .vote-mini {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
}
.comment-actions .vote-mini button {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: grid;
    place-items: center;
    color: var(--text-dim);
    transition: background 0.12s, color 0.12s;
}
.comment-actions .vote-mini button:hover { background: var(--surface-2); }
.comment-actions .vote-mini button.up:hover, .vote-mini button.up.active { color: var(--upvote); }
.comment-actions .vote-mini button.down:hover, .vote-mini button.down.active { color: var(--downvote); }
.comment-actions .vote-mini button svg { width: 14px; height: 14px; }
.comment-actions .vote-mini .count.upvoted { color: var(--upvote); }
.comment-actions .vote-mini .count.downvoted { color: var(--downvote); }

.comment-action {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.12s, color 0.12s;
}
.comment-action:hover { background: var(--surface-2); color: var(--text); }
.comment-action svg { width: 14px; height: 14px; }

.comment-replies { margin-top: 4px; }
.comment-replies .comment + .comment { border-top: none; }
.comment-replies .comment { padding: 10px 0; }

.collapsed .comment-content > *:not(.comment-header) { display: none; }
.collapsed .comment-replies { display: none; }

.footer {
    color: var(--text-dim);
    font-size: 0.78rem;
    text-align: center;
    padding: 16px 0;
}
.footer a { color: var(--accent); }

/* ===== Admin ===== */
.admin-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.admin-aside {
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.admin-aside::-webkit-scrollbar { width: 6px; }
.admin-aside::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.admin-brand {
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--border);
}
.admin-brand-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}
.admin-brand-name span { color: var(--accent); }
.admin-brand-name .logo-mark { width: 24px; height: 24px; }
.admin-brand-pill {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.admin-aside-nav { padding: 14px 12px; flex: 1; }
.admin-aside-section { margin-bottom: 18px; }
.admin-aside-title {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--text-dim);
    padding: 6px 12px 8px;
    font-weight: 700;
}
.admin-aside-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
}
.admin-aside-link:hover { background: var(--surface-2); color: var(--text); }
.admin-aside-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--accent);
}
.admin-aside-link svg { width: 19px; height: 19px; flex-shrink: 0; }
.admin-aside-link .badge-count {
    margin-left: auto;
    background: var(--surface-2);
    color: var(--text-muted);
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}
.admin-aside-link.active .badge-count {
    background: var(--accent-soft);
    color: var(--accent);
}

.admin-aside-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.78rem;
}

.admin-main { padding: 32px 40px 60px; min-width: 0; }

.admin-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.admin-page-header h1 {
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}
.admin-page-header .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}
.admin-page-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.admin-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--row-tint);
    gap: 12px;
}
.admin-card-head h2 {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text);
}
.admin-card-head .head-meta {
    color: var(--text-dim);
    font-size: 0.82rem;
}
.admin-card-body { padding: 20px; }
.admin-card-body.flush { padding: 0; }

.admin-form { display: flex; flex-direction: column; gap: 16px; }
.admin-field { display: flex; flex-direction: column; gap: 6px; }
.admin-field > label {
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 600;
}
.admin-field .required { color: var(--upvote); margin-left: 2px; }
.admin-field .help {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 2px;
}
.admin-field input[type="text"],
.admin-field input[type="number"],
.admin-field input[type="password"],
.admin-field select,
.admin-field textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.admin-field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }

.admin-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.admin-field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.admin-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    height: 100%;
}
.admin-checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }

.admin-form-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}
.admin-form-foot .left { margin-right: auto; color: var(--text-dim); font-size: 0.85rem; }

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 20px 22px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    gap: 16px;
}
.admin-stat-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.admin-stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    flex-shrink: 0;
}
.admin-stat-icon svg { width: 23px; height: 23px; }
.admin-stat-icon.orange { background: rgba(255,122,89,0.14); color: var(--upvote); }
.admin-stat-icon.green  { background: rgba(70,201,139,0.14); color: var(--green); }
.admin-stat-num { font-size: 1.95rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.6px; }
.admin-stat-label { color: var(--text-dim); font-size: 0.85rem; margin-top: 2px; }

/* ===== Admin dashboard visualizations ===== */
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-cols > .admin-card { margin-bottom: 16px; min-width: 0; }

/* Vertical bar chart (weekly additions, daily traffic) */
.viz-chart { display: flex; align-items: flex-end; gap: 7px; height: 130px; }
.viz-colu { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; cursor: default; }
.viz-colu-bars { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; }
.viz-colu .seg-h { background: var(--accent); border-radius: 3px 3px 0 0; }
.viz-colu .seg-b { background: var(--surface-3); border: 1px solid var(--border-soft); border-bottom: none; border-radius: 3px 3px 0 0; }
.viz-colu-label { text-align: center; font-size: 0.64rem; color: var(--text-dim); margin-top: 6px; white-space: nowrap; overflow: hidden; }
.viz-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 0.76rem; color: var(--text-dim); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Horizontal bar rows (category / type distribution, top lists) */
.viz-rows { display: flex; flex-direction: column; gap: 11px; }
.viz-row { display: grid; grid-template-columns: 140px 1fr 44px; align-items: center; gap: 10px; font-size: 0.85rem; }
.viz-row.wide { grid-template-columns: minmax(0, 1fr) 90px 50px; }
.viz-row .viz-label { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 7px; min-width: 0; }
.viz-row .viz-label a:hover { color: var(--accent) !important; }
.viz-bar { display: block; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.viz-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); opacity: .85; }
.viz-val { text-align: right; color: var(--text-dim); font-size: 0.8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* AI pipeline coverage */
.cov-rows { display: flex; flex-direction: column; gap: 16px; }
.cov-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.86rem; margin-bottom: 7px; }

@media (max-width: 900px) {
    .admin-cols { grid-template-columns: 1fr; }
    .viz-row { grid-template-columns: 110px 1fr 40px; }
}
@media (max-width: 480px) {
    .viz-chart { gap: 4px; }
    .viz-colu-label { font-size: 0.56rem; }
    .cmp-vs-side { padding: 8px 10px; gap: 7px; }
    .cmp-vs-badge { padding: 0 7px; }
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table thead th {
    text-align: left;
    padding: 12px 20px;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    background: var(--row-tint);
    border-bottom: 1px solid var(--border);
}
.admin-table tbody td {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table .cell-strong { color: var(--text); font-weight: 600; }
.admin-table .cell-dim { color: var(--text-dim); font-size: 0.85rem; }
.admin-table .cell-mono {
    font-family: 'Menlo', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.admin-table .cell-actions { text-align: right; white-space: nowrap; }
.admin-table .row-link { color: var(--accent); font-weight: 500; }
.admin-table .row-link:hover { text-decoration: underline; }

.admin-empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-dim);
}
.admin-empty .empty-icon {
    width: 48px; height: 48px;
    margin: 0 auto 12px;
    border-radius: 12px;
    background: var(--surface-2);
    display: grid; place-items: center;
    color: var(--text-dim);
}
.admin-empty .empty-icon svg { width: 22px; height: 22px; }
.admin-empty .empty-title {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.admin-empty .empty-sub { font-size: 0.88rem; }

.admin-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.admin-pill.accent { background: var(--accent-soft); color: var(--accent); }
.admin-pill.green  { background: rgba(70,201,139,0.15); color: var(--green); }
.admin-pill.warn   { background: rgba(255,122,89,0.15); color: var(--upvote); }

.admin-row-action {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
    border: 1px solid transparent;
}
.admin-row-action:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.admin-row-action.primary { color: var(--accent); border-color: var(--accent-border); }
.admin-row-action.primary:hover { background: var(--accent-soft); color: var(--accent-hover); }

.admin-alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.9rem;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.admin-alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.admin-alert.success {
    background: rgba(70,201,139,0.10);
    border-color: rgba(70,201,139,0.4);
    color: #46c98b;
}
.admin-alert.error {
    background: rgba(255,122,89,0.10);
    border-color: rgba(255,122,89,0.4);
    color: var(--upvote);
}

.admin-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.admin-quick a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.12s, border-color 0.12s;
}
.admin-quick a:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.admin-quick a svg { width: 16px; height: 16px; }

.admin-login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 20% 20%, var(--accent-soft), transparent 42%),
        radial-gradient(circle at 80% 80%, rgba(176,108,255,0.12), transparent 42%),
        var(--bg);
}
.admin-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 32px;
    box-shadow: var(--shadow-card);
}
.admin-login-card .brand {
    text-align: center;
    margin-bottom: 28px;
}
.admin-login-card .brand .name {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.admin-login-card .brand .name span { color: var(--accent); }
.admin-login-card .brand .name .logo-mark { width: 26px; height: 26px; vertical-align: -5px; margin-right: 4px; }
.admin-login-card .brand .pill {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.admin-content-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 500;
}

button[disabled], select[disabled], textarea[disabled], input[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ===== Public create pages ===== */
.page-narrow {
    max-width: 760px;
    margin: 28px auto 60px;
    padding: 0 20px;
}
.page-narrow .page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.page-narrow h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}
.page-narrow .page-sub {
    color: var(--text-muted);
    font-size: 0.92rem;
}
.page-narrow .page-back {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}
.page-narrow .page-back:hover { background: var(--surface-2); color: var(--text); }

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(88,166,255,0.08);
    border: 1px solid rgba(88,166,255,0.25);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 18px;
}
.notice svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--accent); }

/* ===== Inline reply forms on post.php ===== */
.reply-details {
    display: inline-block;
}
.reply-details summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    transition: background 0.12s, color 0.12s;
    user-select: none;
}
.reply-details summary::-webkit-details-marker { display: none; }
.reply-details summary::marker { content: ''; }
.reply-details summary:hover { background: var(--surface-2); color: var(--text); }
.reply-details summary svg { width: 14px; height: 14px; }
.reply-details[open] > summary { color: var(--accent); background: var(--surface-2); }

.inline-form {
    display: block;
    margin-top: 10px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.inline-form .row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.inline-form .row > * { flex: 1; }
.inline-form input[type="text"],
.inline-form textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.inline-form textarea {
    min-height: 84px;
    line-height: 1.5;
    resize: vertical;
}
.inline-form input:focus,
.inline-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(88,166,255,0.15);
}
.inline-form .actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.inline-form .actions .hint {
    margin-right: auto;
    color: var(--text-dim);
    font-size: 0.78rem;
}

.btn-create {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-create svg { width: 16px; height: 16px; }

.sidebar-create {
    margin: 0 0 14px;
    padding: 0 12px;
}
.sidebar-create a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--accent-border);
    transition: background 0.12s, border-color 0.12s;
}
.sidebar-create a:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.sidebar-create a svg { width: 16px; height: 16px; }

/* ===== R-card (Reddit-style post listing) ===== */
.r-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 16px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.r-card:hover {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
}
/* The title's overlay makes the whole card a link to the details page... */
.r-card .r-title::after { content: ""; position: absolute; inset: 0; z-index: 1; }
/* ...except controls that lead elsewhere, which sit above it. */
.r-card .community-badge,
.r-card .r-visit { position: relative; z-index: 2; }

.r-vote-inline {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    border-radius: 999px;
    padding: 2px;
    margin-right: 4px;
}
.r-vote-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    background: transparent;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}
.r-vote-btn:hover { background: var(--surface-3); }
.r-vote-btn.up:hover, .r-vote-btn.up.active { color: var(--upvote); background: rgba(255,122,89,0.14); }
.r-vote-btn.down:hover, .r-vote-btn.down.active { color: var(--downvote); background: rgba(122,140,255,0.14); }
.r-vote-btn svg { width: 16px; height: 16px; }
.r-vote-count {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    padding: 0 8px;
    min-width: 40px;
    text-align: center;
    line-height: 1;
}
.r-vote-count.up { color: var(--upvote); }
.r-vote-count.down { color: var(--downvote); }

.r-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.r-meta a { color: var(--text-muted); text-decoration: none; }
.r-meta a:hover { color: var(--accent); }
.r-meta .meta-sep { color: var(--text-dim); }
.r-meta .community-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.8rem;
}
.r-meta .community-badge .community-dot { width: 18px; height: 18px; font-size: 0.6rem; }
.r-meta .community-badge:hover { color: var(--accent); }
.r-meta .author { color: var(--text-muted); font-weight: 500; }
.r-meta .badge-pill {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid var(--accent-border);
    margin-left: 2px;
}
/* Base pill (also used outside .r-meta, e.g. comparison tables) + clickable behaviour. */
.badge-pill {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid var(--accent-border);
    text-decoration: none;
}
a.badge-pill { transition: background 0.12s, color 0.12s, border-color 0.12s; }
a.badge-pill:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.r-meta .r-join,
button.r-join[disabled] {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: 999px;
    padding: 2px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    margin-left: 4px;
    cursor: default;
    opacity: 1;
    transition: background 0.12s;
}
.r-meta .r-join:hover { background: var(--accent-hover); }

.r-title-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.r-title {
    display: block;
    font-size: 1.18rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.2px;
}
.r-title:hover { color: var(--accent); text-decoration: none; }
.r-domain {
    font-size: 0.82rem;
    color: var(--text-dim);
    font-weight: 500;
    text-decoration: none;
}
.r-domain:hover { color: var(--accent); text-decoration: none; }

.r-url {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    color: var(--text-dim);
    text-decoration: none;
    margin: 5px 0 9px;
    max-width: 100%;
}
.r-url-fav { width: 15px; height: 15px; border-radius: 3px; flex-shrink: 0; object-fit: contain; }
.r-url-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.r-url:hover .r-url-text { color: var(--accent); text-decoration: underline; }

.r-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--border-soft);
}
.r-card-tech { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.r-details, .r-visit {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
.r-details:hover, .r-visit:hover { text-decoration: underline; }

.q-detail-url {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 6px 0 12px;
    word-break: break-all;
}
.q-detail-url:hover { color: var(--accent); text-decoration: none; }

/* ===== Directory page ===== */
.dir-section { margin-bottom: 28px; }
.dir-cat-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.dir-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.dir-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 14px 16px;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
    color: var(--text);
}
.dir-card:hover {
    border-color: var(--accent-border);
    background: var(--surface-2);
    text-decoration: none;
}
.dir-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.dir-card-head .community-dot {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.dir-card-h {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}
.dir-card-sub {
    color: var(--text-dim);
    font-size: 0.78rem;
    margin-top: 2px;
}
.dir-new { color: var(--accent); font-weight: 600; }
.dir-card-latest {
    display: flex; align-items: center; gap: 7px;
    margin-top: 9px; padding-top: 9px;
    border-top: 1px dashed var(--border-soft);
    color: var(--text-dim); font-size: 0.76rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dir-latest-label {
    flex-shrink: 0; font-size: 0.62rem; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--accent);
    background: var(--accent-soft); border-radius: 4px; padding: 1px 5px;
}
.dir-card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.r-excerpt {
    color: var(--text-muted);
    font-size: 0.93rem;
    line-height: 1.5;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.r-image {
    width: 100%;
    border-radius: 6px;
    margin-bottom: 10px;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,0.5);
    font-size: 0.82rem;
    overflow: hidden;
    max-height: 380px;
}
.r-image.gradient-1 { background: linear-gradient(135deg, #1e3a5f, #2d5a8c); height: 280px; }
.r-image.gradient-2 { background: linear-gradient(135deg, #5f1e3a, #8c2d5a); height: 240px; }
.r-image.gradient-3 { background: linear-gradient(135deg, #2d5a3a, #46c98b); height: 220px; }
.r-image.gradient-4 { background: linear-gradient(135deg, #3a2d5a, #b768ff); height: 260px; }

.r-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    margin: 6px -6px -2px;
}
.r-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.12s, color 0.12s;
    text-decoration: none;
}
.r-action:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.r-action svg { width: 16px; height: 16px; }

/* ===== Q-card (post listings, Stack-Overflow style) ===== */
.q-card {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 18px;
    padding: 18px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}
.q-card:hover { border-color: var(--border); }

.q-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.q-stat { display: flex; flex-direction: column; gap: 2px; }
.q-stat-num { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.q-stat.has-comments {
    border: 1px solid var(--green);
    border-radius: 4px;
    padding: 4px 0;
    color: var(--green);
}
.q-stat.has-comments .q-stat-num { color: var(--green); }

.q-body { min-width: 0; }
.q-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--accent);
    line-height: 1.35;
    margin-bottom: 8px;
}
.q-title:hover { text-decoration: underline; }

.q-excerpt {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.q-image {
    width: 100%;
    max-height: 220px;
    border-radius: 6px;
    margin-bottom: 12px;
    display: grid;
    place-items: center;
    color: var(--text-dim);
    font-size: 0.82rem;
}
.q-image.gradient-1 { background: linear-gradient(135deg, #1e3a5f, #2d5a8c); height: 180px; }
.q-image.gradient-2 { background: linear-gradient(135deg, #5f1e3a, #8c2d5a); height: 160px; }
.q-image.gradient-3 { background: linear-gradient(135deg, #2d5a3a, #46c98b); height: 160px; }
.q-image.gradient-4 { background: linear-gradient(135deg, #3a2d5a, #b768ff); height: 180px; }

.q-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    border: 1px solid transparent;
    transition: background 0.15s;
}
.tag-pill:hover { background: rgba(88,166,255,0.18); text-decoration: none; }
.tag-pill .community-dot { width: 14px; height: 14px; font-size: 0.55rem; }
.tag-pill.badge {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.q-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.q-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-dim);
}
.q-author .avatar { width: 22px; height: 22px; font-size: 0.7rem; }
.q-author strong { color: var(--accent); font-weight: 500; }

/* ===== Filter bar (compact pill toggle, replaces feed-toolbar look) ===== */
.q-filter-bar {
    display: flex;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px;
    margin-bottom: 16px;
    width: fit-content;
}
.q-filter-bar button {
    padding: 7px 14px;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.88rem;
    transition: all 0.15s;
}
.q-filter-bar button.active {
    background: var(--surface-3);
    color: var(--text);
}
.q-filter-bar button:hover:not(.active) { color: var(--text); }

/* ===== Post detail (circular vote buttons + author chip) ===== */
.q-detail-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}
.q-detail-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}
.q-detail-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.q-detail-meta strong { color: var(--text); font-weight: 500; }

.q-post {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-soft);
}

.vote-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}
.vote-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: var(--text-muted);
    background: transparent;
}
.vote-circle:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.vote-circle.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}
.vote-circle svg { width: 16px; height: 16px; }
.vote-stack .vote-count {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.q-post-body { min-width: 0; }
.q-post-body .q-image { max-height: 360px; height: auto; }
.q-post-body .q-image.gradient-1 { height: 280px; }
.q-post-body .q-image.gradient-2 { height: 240px; }
.q-post-body .q-image.gradient-3 { height: 220px; }
.q-post-body .q-image.gradient-4 { height: 260px; }
.q-post-content {
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--text);
}
.q-post-content p + p { margin-top: 12px; }
.q-post-content code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Menlo','Consolas',monospace;
    font-size: 0.9em;
    color: var(--accent-hover);
}

.q-post-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.q-post-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.85rem;
    color: var(--text-dim);
}
.q-post-actions a, .q-post-actions button {
    color: var(--text-dim);
    transition: color 0.15s;
}
.q-post-actions a:hover, .q-post-actions button:hover { color: var(--accent); text-decoration: none; }

.author-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.82rem;
}
.author-chip .avatar { width: 28px; height: 28px; font-size: 0.75rem; }
.author-chip strong { color: var(--text); font-weight: 600; display: block; }
.author-chip .meta { color: var(--text-dim); font-size: 0.75rem; }

.answers-header {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 24px 0 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== Trending card (matches demo's right-rail) ===== */
.trending-row {
    padding: 10px 0;
    border-top: 1px solid var(--border-soft);
    cursor: pointer;
    display: block;
}
.trending-row:first-of-type { border-top: none; padding-top: 0; }
.trending-row:hover { text-decoration: none; }
.trending-row:hover .trending-row-title { color: var(--accent); }
.trending-row-title {
    color: var(--text);
    font-size: 0.88rem;
    margin-bottom: 4px;
    transition: color 0.15s;
    line-height: 1.4;
}
.trending-row-meta {
    color: var(--text-dim);
    font-size: 0.78rem;
}
.sim-bar-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    vertical-align: middle;
}
.sim-bar {
    width: 52px;
    height: 5px;
    border-radius: 3px;
    background: var(--border-soft);
    overflow: hidden;
    flex-shrink: 0;
}
.sim-bar-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    opacity: 0.75;
}
.sim-pct {
    font-size: 0.74rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    min-width: 28px;
}

/* Admin: AI code-explainer page */
.explain-walk { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 14px; }
.explain-walk li::marker { color: var(--accent); font-weight: 700; }
.explain-walk-title { font-weight: 600; color: var(--text); font-size: 0.95rem; margin-bottom: 3px; }
.explain-walk-text { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.code-snip {
    margin: 10px 0 2px;
    padding: 12px 14px;
    background: #0d1117;            /* fixed dark canvas in both themes (github-dark hljs) */
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.55;
}
.code-snip code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: transparent;
    color: #e6edf3;
    white-space: pre;
}
.explain-notes { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.explain-notes li { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }
.explain-notes li::marker { color: var(--upvote); }

/* ===== Theme toggle ===== */
.theme-toggle { position: relative; }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Light-mode header tweak — give the sticky header a subtle bottom shadow */
:root[data-theme="light"] header {
    box-shadow: var(--header-shadow);
}
:root[data-theme="light"] .post-image {
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .layout { grid-template-columns: 220px minmax(0, 1fr); }
    .right { display: none; }
}
@media (max-width: 768px) {
    .layout { grid-template-columns: 1fr; padding: 16px; }
    .layout.no-right { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    /* Keep search usable on phones — give it the header space the buttons used. */
    .search { margin: 0 4px; }
    .search input { height: 40px; font-size: 16px; padding: 0 14px 0 40px; } /* 16px stops iOS zoom-on-focus */
    .search::before { left: 13px; }
    .header-inner { padding: 0 14px; gap: 10px; }
    header .btn-create { display: none; }         /* Directory/Submit buttons — still in hero + footer */
    .header-actions a.icon-btn { display: none; } /* random-link icon; theme toggle stays */
    /* Right column: stack below the main column instead of disappearing — it holds
       Quick facts, health, timeline, views, trending. (≤1100 hides it; re-shown here.) */
    .right { display: block; }
    .community-cover { height: 96px; }
    .community-dot.lg { width: 64px; height: 64px; font-size: 1.7rem; margin-top: -30px; border-width: 3px; }
    .community-header { flex-direction: column; align-items: flex-start; gap: 14px; padding: 0 16px 16px; }
    .community-actions { padding-top: 0; width: 100%; }
    .community-actions .btn { flex: 1; justify-content: center; }
    .community-tabs { padding: 0 8px; overflow-x: auto; }
    .community-tab { padding: 12px 12px; }
    .community-name { font-size: 1.4rem; }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-aside {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .admin-aside-nav { padding: 8px 12px; }
    .admin-aside-section { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
    .admin-aside-title { display: none; }
    .admin-main { padding: 20px 16px 40px; }
    .admin-stats-grid { grid-template-columns: 1fr; }
    .admin-field-row, .admin-field-row.three { grid-template-columns: 1fr; }
    .admin-table { font-size: 0.82rem; }
    .admin-table thead th, .admin-table tbody td { padding: 10px 14px; }
    .admin-page-header h1 { font-size: 1.4rem; }
}

/* ===== Branding & home hero ===== */
.home-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--accent-border);
    border-radius: 16px;
    padding: 34px 32px;
    margin-bottom: 22px;
    background:
        radial-gradient(120% 140% at 0% 0%, var(--accent-soft), transparent 60%),
        radial-gradient(120% 140% at 100% 20%, rgba(176,108,255,0.10), transparent 55%),
        var(--surface);
}
.home-hero-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.home-hero-brand .logo-mark { width: 40px; height: 40px; }
.home-hero-title {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.1;
}
.home-hero-title span { color: var(--accent); }
.home-hero-sub {
    color: var(--text-muted);
    font-size: 1.12rem;
    line-height: 1.55;
    max-width: 620px;
    margin-bottom: 20px;
}
.home-hero-cta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.home-hero-cta .btn { padding: 11px 22px; font-size: 1rem; }
.home-hero-stat { color: var(--text-dim); font-size: 0.95rem; font-weight: 500; }

.section-label {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text);
    margin: 22px 0 12px;
    padding: 9px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
}

@media (max-width: 640px) {
    .home-hero { padding: 26px 20px; }
    .home-hero-title { font-size: 1.9rem; }
    .home-hero-sub { font-size: 1rem; }
}
@media (max-width: 480px) {
    .home-hero { padding: 22px 16px; margin-bottom: 16px; }
    .home-hero-cta { gap: 10px; }
    .home-hero-cta .btn { flex: 1 1 calc(50% - 10px); justify-content: center; text-align: center; padding: 11px 10px; font-size: 0.92rem; white-space: nowrap; }
    .home-hero-stat { flex-basis: 100%; font-size: 0.85rem; }
    .cat-tiles { grid-template-columns: 1fr 1fr; gap: 7px; }
    .cat-tile { padding: 8px 9px; gap: 7px; }
    .cat-tile-name { font-size: 0.8rem; }
}

/* ===== Scraped thumbnails, tech chips & detail tables ===== */
.r-card.has-thumb { display: flex; gap: 16px; align-items: flex-start; }
.r-card-main { flex: 1; min-width: 0; }
.r-thumb {
    flex-shrink: 0;
    width: 132px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    color: var(--text-dim);
}
.r-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.r-thumb.r-thumb-ph {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}
.r-thumb-ph svg { width: 30px; height: 30px; opacity: 0.6; }
.r-thumb-ph .r-thumb-fav { width: 42px; height: 42px; border-radius: 9px; object-fit: contain; background: transparent; }
@media (max-width: 560px) { .r-thumb { width: 94px; height: 78px; } }

.tech-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-chip {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 3px 11px;
}
.tech-chip.sm { font-size: 0.72rem; padding: 2px 8px; }

.scrape-preview {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 18px;
}
.scrape-thumb {
    width: 120px; height: 84px; object-fit: cover; border-radius: 8px;
    flex-shrink: 0; border: 1px solid var(--border-soft);
}
.scrape-info { flex: 1; min-width: 0; }
.scrape-title { font-weight: 700; font-size: 0.98rem; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.scrape-meta { color: var(--text-muted); font-size: 0.88rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }

.detail-hero { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.detail-rows { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 0.95rem; margin: 0; }
.detail-rows.detail-rows-sm { grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 0.88rem; }
.detail-rows dt { color: var(--text-dim); font-weight: 500; }
.detail-rows dd { color: var(--text); margin: 0; word-break: break-word; }
.detail-rows dd a { color: var(--accent); }
@media (max-width: 520px) {
    .detail-rows { grid-template-columns: 1fr; gap: 2px 0; }
    .detail-rows dd { margin-bottom: 10px; }
}

/* ===== Public submission form ===== */
.submit-panel {
    max-width: 720px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 34px 32px;
    background:
        radial-gradient(120% 130% at 0% 0%, var(--accent-soft), transparent 58%),
        var(--surface);
}
.submit-head { text-align: center; margin-bottom: 24px; }
.submit-mark { width: 52px; height: 52px; margin: 0 auto 12px; display: block; }
.submit-title { font-size: 2rem; font-weight: 700; letter-spacing: -0.6px; margin-bottom: 8px; }
.submit-sub { color: var(--text-muted); font-size: 1.05rem; line-height: 1.55; max-width: 560px; margin: 0 auto; }
.submit-sub strong { color: var(--text); font-weight: 600; }

.submit-hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

.submit-input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.submit-url {
    flex: 1;
    min-width: 240px;
    height: 56px;
    padding: 0 20px;
    font-size: 1.05rem;
    background: var(--surface-2);
    border: 1.5px solid var(--border-strong);
    border-radius: 12px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.submit-url:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.submit-btn { height: 56px; padding: 0 26px; font-size: 1.02rem; border-radius: 12px; }
.submit-hint {
    display: flex; align-items: center; gap: 7px;
    color: var(--text-dim); font-size: 0.9rem; margin-top: 12px;
}
.submit-hint svg { width: 15px; height: 15px; color: var(--green); flex-shrink: 0; }
.submit-form.is-busy { opacity: 0.65; pointer-events: none; }

.submit-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid var(--border-soft);
}
.submit-step { display: flex; gap: 12px; align-items: flex-start; }
.submit-step-ico {
    flex-shrink: 0;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.submit-step-ico svg { width: 19px; height: 19px; }
.submit-step-h { font-weight: 600; font-size: 0.95rem; margin-bottom: 3px; }
.submit-step p { color: var(--text-muted); font-size: 0.86rem; line-height: 1.5; }

.submit-foot { margin-top: 24px; text-align: center; color: var(--text-dim); font-size: 0.92rem; display: flex; gap: 10px; justify-content: center; }
.submit-foot a { color: var(--accent); }

@media (max-width: 680px) {
    .submit-panel { padding: 26px 20px; }
    .submit-title { font-size: 1.65rem; }
    .submit-steps { grid-template-columns: 1fr; gap: 14px; }
}

/* ===== Detail page extras (key points, actions, health, swatch) ===== */
.key-points { list-style: none; margin: 0 0 16px; padding: 0; }
.key-points li { display: flex; align-items: flex-start; gap: 9px; color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; margin-bottom: 7px; }
.key-points li .kp-ico { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 3px; color: #22c55e; }

/* Favicon used beside web links / list rows */
.fav { width: 16px; height: 16px; border-radius: 3px; vertical-align: -3px; margin-right: 7px; flex-shrink: 0; background: var(--surface-2); }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-rows .swatch {
    display: inline-block; width: 14px; height: 14px; border-radius: 4px;
    vertical-align: -2px; margin-right: 7px; border: 1px solid var(--border-strong);
}
.tag-chip { text-decoration: none; transition: color 0.12s, border-color 0.12s, background 0.12s; }
.tag-chip:hover, .tag-chip.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.tag-count {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 600;
    background: var(--surface-3);
    color: var(--text-dim);
    border-radius: 8px;
    padding: 0 4px;
    margin-left: 3px;
    vertical-align: middle;
    line-height: 1.6;
}

/* Weighted tag cloud (right column) — font-size scales with frequency. */
.tag-cloud { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 11px; line-height: 1.35; }
.tag-cloud a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.12s, opacity 0.12s;
}
.tag-cloud a:hover { color: var(--accent); opacity: 1 !important; }

/* "Browse all …" link at the foot of a sidebar card. */
.card-more {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}
.card-more:hover { text-decoration: underline; }
.detail-overview { color: var(--text); font-size: 0.98rem; line-height: 1.65; margin: 0; }
.page-outline { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.page-outline li { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; margin-bottom: 4px; break-inside: avoid; }
.page-outline li::marker { color: var(--accent); }
@media (max-width: 560px) { .page-outline { columns: 1; } }

/* ===== Sources directory + A–Z index ===== */
.src-ico {
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--surface-2); color: var(--text-dim);
    display: grid; place-items: center; flex-shrink: 0;
}
.src-ico svg { width: 18px; height: 18px; }
.src-ico img { width: 22px; height: 22px; border-radius: 4px; object-fit: contain; }

.source-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
}
.source-cats { display: flex; gap: 4px; flex-shrink: 0; }
.source-cats .community-dot { width: 18px; height: 18px; font-size: 0.6rem; }
.source-latest { color: var(--text-dim); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.az-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.az-nav a, .az-nav span {
    display: inline-grid; place-items: center;
    min-width: 34px; height: 34px; padding: 0 4px;
    border-radius: 8px; font-weight: 600; font-size: 0.9rem;
    border: 1px solid var(--border-soft);
}
.az-nav a { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); text-decoration: none; }
.az-nav a:hover { background: var(--accent); color: var(--on-accent); }
.az-nav span { color: var(--text-dim); background: var(--surface); opacity: 0.45; }

.az-section { margin-bottom: 24px; scroll-margin-top: 80px; }
.az-letter { font-size: 1.4rem; font-weight: 700; color: var(--accent); border-bottom: 1px solid var(--border-soft); padding-bottom: 6px; margin-bottom: 6px; }
.az-list { list-style: none; }
.az-list li { padding: 9px 2px; border-bottom: 1px solid var(--border-soft); }
.az-list a { color: var(--text); font-weight: 500; }
.az-list a:hover { color: var(--accent); }
.az-list .az-dom { color: var(--text-dim); font-size: 0.85rem; margin-left: 8px; }

.page-intro {
    color: var(--text-muted);
    font-size: 1.02rem;
    line-height: 1.6;
    margin: 0 0 18px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
}

/* ===== Global site footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    margin-top: 48px;
}
.site-footer-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 44px 20px 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: space-between;
}
.site-footer-brand { flex: 1 1 280px; min-width: 240px; max-width: 400px; }
.site-footer-brand .logo {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 1.2rem; font-weight: 700; color: var(--text); text-decoration: none;
}
.site-footer-brand .logo span { color: var(--accent); }
.site-footer-tag { color: var(--text-muted); font-size: 0.92rem; line-height: 1.55; margin-top: 12px; }
.site-footer-tag-sm { font-size: 0.84rem; color: var(--text-dim); margin-top: 8px; }
.site-footer-cols { display: flex; flex-wrap: wrap; gap: 44px; }
.site-footer-col { display: flex; flex-direction: column; gap: 10px; min-width: 110px; }
.site-footer-h {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-dim); font-weight: 600; margin-bottom: 2px;
}
.site-footer-col a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; transition: color 0.12s; }
.site-footer-col a:hover { color: var(--accent); }
.site-footer-bar {
    border-top: 1px solid var(--border);
    max-width: 1300px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-dim);
    font-size: 0.82rem;
}
.site-footer-bar a { color: var(--text-muted); text-decoration: none; }
.site-footer-bar a:hover { color: var(--accent); }
@media (max-width: 600px) {
    .site-footer-inner { gap: 28px; padding-top: 32px; }
    .site-footer-cols { gap: 28px 36px; }
}

/* ===== Static content / legal pages (about, faq, help, privacy, terms) ===== */
.doc { max-width: 768px; margin: 0 auto; padding: 36px 20px 56px; }
.doc-head { margin-bottom: 22px; }
.doc-head h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
.doc-updated { color: var(--text-dim); font-size: 0.85rem; margin-top: 8px; }
.doc-lead { color: var(--text-muted); font-size: 1.08rem; line-height: 1.65; margin-bottom: 20px; }
.doc h2 { font-size: 1.3rem; font-weight: 600; margin: 32px 0 10px; letter-spacing: -0.3px; }
.doc h3 { font-size: 1.02rem; font-weight: 600; margin: 22px 0 6px; }
.doc p { color: var(--text-muted); line-height: 1.72; margin-bottom: 14px; }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 22px; }
.doc li { color: var(--text-muted); line-height: 1.72; margin-bottom: 7px; }
.doc strong { color: var(--text); font-weight: 600; }
.doc a { color: var(--accent); text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc-note {
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 13px 16px;
    color: var(--text-dim);
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 20px 0;
}
.faq-item { border-top: 1px solid var(--border); padding: 18px 0; }
.faq-item:first-of-type { border-top: none; padding-top: 4px; }
.faq-q { display: flex; align-items: flex-start; gap: 8px; font-weight: 600; font-size: 1.04rem; margin-bottom: 7px; color: var(--text); }
.faq-q-ico { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 2px; color: var(--accent); }
.faq-a { color: var(--text-muted); line-height: 1.72; }
.faq-q + .faq-a { padding-left: 25px; }
.faq-a a { color: var(--accent); text-decoration: none; }
.faq-a a:hover { text-decoration: underline; }

/* Contact form (within a .doc page) */
.contact-form { margin-top: 4px; }
.contact-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.contact-field label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.contact-field input,
.contact-field textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    padding: 11px 13px;
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
}
.contact-field input::placeholder,
.contact-field textarea::placeholder { color: var(--text-dim); }
.contact-field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.contact-field input:focus,
.contact-field textarea:focus { border-color: var(--accent); outline: none; }
.contact-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .contact-field-row { grid-template-columns: 1fr; } }

/* ===== Ada — AI assistant chat widget ===== */
.tl-ada { position: fixed; right: 18px; bottom: 18px; z-index: 1200; font-size: 14px; }
.tl-ada__fab {
    display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; text-align: left;
    background: linear-gradient(135deg, var(--accent), #b768ff); color: var(--on-accent);
    border: 0; border-radius: 999px; padding: .45rem .95rem .45rem .45rem; font-weight: 700;
    box-shadow: 0 10px 28px rgba(0,0,0,.32); transition: transform .15s ease, box-shadow .15s ease;
    animation: tl-ada-fab-in .35s ease both;
}
.tl-ada__fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,.42); }
.tl-ada__fab-av {
    position: relative; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); color: var(--accent); font-weight: 800; font-size: 1.05rem;
}
.tl-ada__fab-av::before {
    content: ''; position: absolute; inset: -4px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4); animation: tl-ada-pulse 2.4s ease-out infinite;
}
.tl-ada__fab-dot {
    position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
    background: #22c55e; border: 2px solid var(--on-accent);
}
.tl-ada__fab-txt { display: flex; flex-direction: column; line-height: 1.15; }
.tl-ada__fab-txt strong { font-size: .92rem; }
.tl-ada__fab-txt small { font-size: .68rem; font-weight: 600; opacity: .82; }
.tl-ada--open .tl-ada__fab { display: none; }
@keyframes tl-ada-pulse { 0% { transform: scale(1); opacity: .7; } 70% { transform: scale(1.55); opacity: 0; } 100% { opacity: 0; } }
@keyframes tl-ada-fab-in { from { transform: translateY(12px) scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }

/* One-time greeting teaser above the launcher. */
.tl-ada__teaser {
    position: absolute; right: 2px; bottom: calc(100% + 12px); width: 252px; cursor: pointer;
    display: flex; gap: .55rem; align-items: flex-start;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: 14px; padding: .7rem .85rem .7rem .65rem;
    box-shadow: 0 16px 44px rgba(0,0,0,.32); animation: tl-ada-teaser-in .3s ease both;
}
.tl-ada__teaser[hidden] { display: none; }
.tl-ada__teaser::after {
    content: ''; position: absolute; right: 26px; bottom: -7px; width: 13px; height: 13px;
    background: var(--surface); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
    transform: rotate(45deg);
}
.tl-ada__teaser p { margin: 0; font-size: .82rem; line-height: 1.45; }
.tl-ada__teaser-av {
    flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #b768ff); color: var(--on-accent); font-weight: 800; font-size: .9rem;
}
.tl-ada__teaser-x {
    position: absolute; top: 3px; right: 6px; background: 0; border: 0; color: var(--text-dim);
    font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 2px;
}
.tl-ada__teaser-x:hover { color: var(--text); }
@keyframes tl-ada-teaser-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .tl-ada__fab, .tl-ada__fab-av::before, .tl-ada__teaser { animation: none; }
}

.tl-ada__panel {
    width: min(380px, calc(100vw - 36px)); height: min(560px, calc(100vh - 110px));
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.tl-ada__panel[hidden] { display: none; }
.tl-ada__head {
    display: flex; align-items: center; gap: .6rem; padding: .7rem .85rem;
    background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.tl-ada__avatar {
    width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent), #b768ff); color: var(--on-accent); font-weight: 800;
}
.tl-ada__who { display: flex; flex-direction: column; line-height: 1.2; flex: 1 1 auto; }
.tl-ada__who strong { color: var(--text); font-size: .95rem; }
.tl-ada__who span { color: var(--text-dim); font-size: .72rem; }
.tl-ada__close {
    background: 0; border: 0; color: var(--text-dim); font-size: 1.5rem; line-height: 1;
    cursor: pointer; padding: 0 .25rem;
}
.tl-ada__close:hover { color: var(--text); }

.tl-ada__msgs { flex: 1 1 auto; overflow-y: auto; padding: .85rem; display: flex; flex-direction: column; gap: .5rem; }
.tl-ada-msg { max-width: 85%; padding: .5rem .7rem; border-radius: 12px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.tl-ada-msg--bot  { align-self: flex-start; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-soft); border-bottom-left-radius: 4px; }
.tl-ada-msg--user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.tl-ada-msg a { color: var(--accent); text-decoration: underline; }
.tl-ada-msg--user a { color: var(--on-accent); }
.tl-ada-msg--typing { display: flex; gap: 4px; padding: .7rem; }
.tl-ada-msg--typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim);
    animation: tl-ada-bounce 1.1s infinite ease-in-out;
}
.tl-ada-msg--typing span:nth-child(2) { animation-delay: .15s; }
.tl-ada-msg--typing span:nth-child(3) { animation-delay: .3s; }
@keyframes tl-ada-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.tl-ada__form { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--border); }
.tl-ada__input {
    flex: 1 1 auto; min-width: 0; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; font: inherit; font-size: .9rem;
}
.tl-ada__input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.tl-ada__send {
    flex: 0 0 auto; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 10px;
    padding: 0 .9rem; font-size: 1rem; cursor: pointer; font-weight: 700;
}
.tl-ada__send:hover { filter: brightness(1.08); }
.tl-ada__send:disabled { opacity: .5; cursor: default; }
.tl-ada__foot { padding: .4rem .7rem .6rem; color: var(--text-dim); font-size: .68rem; text-align: center; }
@media (max-width: 480px) {
    .tl-ada { right: 12px; bottom: 12px; }
    .tl-ada__fab-txt { display: none; }
    .tl-ada__fab { padding: .35rem; }
    .tl-ada__teaser { width: min(252px, calc(100vw - 30px)); }
}

/* Admin: assistant chat-log transcript */
.chatlog-thread { display: flex; flex-direction: column; gap: 12px; }
.chatlog-msg { max-width: 90%; }
.chatlog-msg.is-user { align-self: flex-end; }
.chatlog-msg.is-bot { align-self: flex-start; }
.chatlog-msg-who { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 3px; }
.chatlog-msg-who span { opacity: .7; margin-left: 6px; }
.chatlog-msg.is-user .chatlog-msg-who { text-align: right; }
.chatlog-msg-body { padding: 9px 12px; border-radius: 12px; line-height: 1.5; font-size: 0.92rem; word-wrap: break-word; overflow-wrap: anywhere; }
.chatlog-msg.is-bot .chatlog-msg-body { background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text); border-bottom-left-radius: 4px; }
.chatlog-msg.is-user .chatlog-msg-body { background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--text); border-bottom-right-radius: 4px; }

/* ===== Admin: realtime traffic dashboard ===== */
.rt-wrap { display: flex; flex-direction: column; gap: 16px; }
.rt-top { display: grid; grid-template-columns: 260px 1fr; gap: 16px; }
.rt-hero-label { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 0.82rem; font-weight: 600; }
.rt-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; animation: rt-pulse 1.8s infinite; }
@keyframes rt-pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.rt-hero-num { font-size: 3rem; font-weight: 700; line-height: 1.05; margin: 6px 0 2px; color: var(--text); }
.rt-hero-trend { font-size: 0.82rem; color: var(--text-dim); }
.rt-hero-trend.up { color: #22c55e; }
.rt-hero-trend.down { color: var(--red, #e5534b); }
.rt-spark-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--text-dim); font-size: 0.82rem; font-weight: 600; margin-bottom: 12px; }
.rt-updated { font-weight: 400; opacity: .8; }
.rt-spark { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.rt-spark-bar { flex: 1; min-width: 2px; background: var(--accent-soft); border: 1px solid var(--accent-border); border-bottom: 0; border-radius: 3px 3px 0 0; transition: height .3s ease; }
.rt-spark-bar.is-now { background: var(--accent); border-color: var(--accent); }
.rt-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rt-stat-label { color: var(--text-dim); font-size: 0.85rem; margin-top: 2px; }
.rt-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rt-list { display: flex; flex-direction: column; gap: 7px; }
.rt-list-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; overflow: hidden; }
.rt-list-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; }
.rt-list-label { position: relative; z-index: 1; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.88rem; }
.rt-list-label a { color: var(--text); text-decoration: none; }
.rt-list-label a:hover { color: var(--accent); }
.rt-list-val { position: relative; z-index: 1; font-weight: 700; font-size: 0.85rem; color: var(--text-muted); }
.rt-feed { display: flex; flex-direction: column; max-height: 360px; overflow-y: auto; }
.rt-feed-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border-soft); font-size: 0.86rem; }
.rt-feed-row:first-child { border-top: 0; }
.rt-feed-flag { flex: 0 0 auto; }
.rt-feed-bot { flex: 0 0 auto; font-weight: 600; color: var(--accent); font-size: 0.78rem; }
.rt-feed-path { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); text-decoration: none; }
.rt-feed-path:hover { color: var(--accent); }
.rt-feed-time { flex: 0 0 auto; color: var(--text-dim); font-size: 0.76rem; }
.rt-empty { color: var(--text-dim); font-size: 0.88rem; padding: 14px 2px; }
@media (max-width: 860px) {
    .rt-top, .rt-cols, .rt-stats { grid-template-columns: 1fr; }
}

/* Admin: database setup log */
.setup-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.setup-log li { display: flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: 0.9rem; }
.setup-log li svg { width: 15px; height: 15px; flex: 0 0 auto; color: #22c55e; }

/* ===== Category hub: at-a-glance + comparison table ===== */
.cat-glance { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.9rem; margin: 0 0 16px; }
.cat-glance strong { color: var(--text); }
.cat-glance-sep { color: var(--text-dim); }
.cmp-wrap { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--border); border-radius: 12px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.cmp-table th, .cmp-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.cmp-table thead th { background: var(--surface-2); color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; white-space: nowrap; }
.cmp-table tbody tr:last-child td { border-bottom: 0; }
.cmp-table tbody tr:hover { background: var(--surface-2); }
.cmp-name a { color: var(--text); font-weight: 600; text-decoration: none; }
.cmp-name a:hover { color: var(--accent); }
.cmp-dom { color: var(--text-dim); font-size: 0.78rem; margin-top: 2px; }
.cmp-col-type { white-space: nowrap; }
.cmp-cover { color: var(--text-muted); max-width: 360px; }
.cmp-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cmp-tags .tech-chip { font-size: 0.72rem; padding: 1px 7px; }
@media (max-width: 720px) { .cmp-col-cover { display: none; } }
@media (max-width: 520px) { .cmp-col-tags { display: none; } }

/* ===== AI-content disclosure (badge / caption / banner) ===== */
.ai-badge {
    display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; cursor: help;
    font-size: 0.62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-border);
    border-radius: 999px; padding: 1px 7px 1px 5px; margin-left: 7px;
}
.ai-badge svg { width: 10px; height: 10px; }
.ai-caption {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--text-dim); font-size: 0.74rem; margin: -8px 0 16px;
}
.ai-caption svg { width: 11px; height: 11px; color: var(--accent); }
.ai-note {
    display: flex; align-items: flex-start; gap: 9px;
    background: var(--accent-soft); border: 1px solid var(--accent-border);
    border-radius: 9px; padding: 10px 13px; margin: 0 0 16px;
    color: var(--text-muted); font-size: 0.85rem; line-height: 1.55;
}
.ai-note svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; color: var(--accent); }
.ai-note a { color: var(--accent); text-decoration: none; font-weight: 600; }
.ai-note a:hover { text-decoration: underline; }

/* Link detail: pros & cons */
.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.proscons-head { font-size: 0.74rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; margin-bottom: 9px; }
.proscons-head.pros { color: #22c55e; }
.proscons-head.cons { color: var(--red, #e5534b); }
.proscons-list { list-style: none; margin: 0; padding: 0; }
.proscons-list li { display: flex; align-items: flex-start; gap: 8px; color: var(--text-muted); font-size: 0.92rem; line-height: 1.55; margin-bottom: 8px; }
.proscons-list li svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 3px; }
.proscons-list.pros li svg { color: #22c55e; }
.proscons-list.cons li svg { color: var(--red, #e5534b); }
@media (max-width: 560px) { .proscons { grid-template-columns: 1fr; gap: 16px; } }
/* Gemini rating (1-10) + mini-review */
.ai-review { display: flex; gap: 20px; align-items: flex-start; }
.ai-score { flex: 0 0 auto; text-align: center; }
.ai-score-num { font-size: 2.1rem; font-weight: 700; letter-spacing: -1px; line-height: 1; color: var(--accent); }
.ai-score-num span { font-size: 0.95rem; color: var(--text-dim); font-weight: 600; letter-spacing: 0; }
.ai-score-bar { display: flex; gap: 3px; margin-top: 9px; justify-content: center; }
.ai-score-seg { width: 9px; height: 5px; border-radius: 2px; background: var(--surface-3); }
.ai-score-seg.on { background: var(--accent); opacity: .9; }
.ai-review-text { color: var(--text-muted); font-size: 0.96rem; line-height: 1.65; margin: 0; }
.ai-review-foot { color: var(--text-dim); font-size: 0.78rem; margin: 14px 0 0; padding-top: 11px; border-top: 1px solid var(--border-soft); }
@media (max-width: 560px) {
    .ai-review { flex-direction: column; gap: 12px; }
    .ai-score { display: flex; align-items: center; gap: 12px; text-align: left; }
    .ai-score-bar { margin-top: 0; }
}

.sentiment-bar-wrap { margin: 18px 0 2px; }
.sentiment-bar {
    display: flex;
    height: 7px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--border-soft);
    gap: 1px;
}
.sentiment-bar-pros { background: #22c55e; opacity: 0.8; flex-shrink: 0; }
.sentiment-bar-cons { background: var(--red, #e5534b); opacity: 0.65; flex-shrink: 0; }
.sentiment-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    margin-top: 6px;
}
.sentiment-label-pros { color: #22c55e; font-weight: 600; }
.sentiment-label-cons { color: var(--red, #e5534b); font-weight: 600; }
.cmp-vs-header {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 18px;
}
.cmp-vs-side {
    flex: 1;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    min-width: 0;
}
.cmp-vs-side.is-this { background: var(--accent-soft); }
.cmp-vs-badge {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    background: var(--surface-3);
    border-left: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
}
.cmp-vs-meta { min-width: 0; }
.cmp-vs-name { font-size: 0.88rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-vs-domain { font-size: 0.73rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Link detail: topic mind-map (server-rendered SVG; text inherits the site font).
   On phones the scaled-down SVG text is unreadable, so it swaps for plain chips. */
.topic-graph { display: block; width: 100%; height: auto; }
.topic-chips { display: none; }
@media (max-width: 640px) {
    .topic-graph { display: none; }
    .topic-chips { display: flex; }
}
.topic-graph text { font-size: 12.5px; font-weight: 600; }
.topic-graph .tg-line { stroke: var(--border); stroke-width: 1.2; stroke-dasharray: 3 4; }
.topic-graph .tg-hub rect { fill: var(--accent-soft); stroke: var(--accent-border); }
.topic-graph .tg-hub text { fill: var(--accent); }
.topic-graph .tg-node { cursor: pointer; }
.topic-graph .tg-node rect { fill: var(--surface-2); stroke: var(--border-soft); transition: fill .12s, stroke .12s; }
.topic-graph .tg-node text { fill: var(--text-muted); transition: fill .12s; }
.topic-graph .tg-node:hover rect { fill: var(--accent-soft); stroke: var(--accent-border); }
.topic-graph .tg-node:hover text { fill: var(--accent); }

/* Link detail sidebar: health traffic lights */
.health-lights { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.health-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-muted); cursor: default; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.health-dot.good { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.5); }
.health-dot.warn { background: #eab308; box-shadow: 0 0 6px rgba(234,179,8,.45); }
.health-dot.bad  { background: var(--red, #e5534b); box-shadow: 0 0 6px rgba(229,83,75,.5); }

/* Link detail sidebar: directory timeline */
.tml-wrap { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.tml-label { font-size: 0.7rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.tml-track { position: relative; height: 5px; border-radius: 3px; background: var(--border-soft); }
.tml-dot { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); transform: translate(-50%, -50%); }
.tml-ends { display: flex; justify-content: space-between; font-size: 0.68rem; color: var(--text-dim); margin-top: 6px; }

/* 7-day / 8-week sparklines (link detail sidebar + homepage About card) */
.spark-bars { display: flex; align-items: flex-end; gap: 6px; height: 56px; }
.spark-bars.sm { height: 38px; gap: 5px; }
.spark-bar { flex: 1; min-height: 3px; background: var(--accent); opacity: .85; border-radius: 3px 3px 0 0; }
.spark-days { display: flex; gap: 6px; margin-top: 5px; }
.spark-days span { flex: 1; text-align: center; font-size: 0.66rem; color: var(--text-dim); }

/* Homepage: category tiles under the hero */
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 0 0 22px; }
.cat-tile {
    display: flex; align-items: center; gap: 9px; min-width: 0;
    padding: 9px 11px; background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: 10px; text-decoration: none; transition: border-color .12s, background .12s;
}
.cat-tile:hover { border-color: var(--accent-border); background: var(--accent-soft); text-decoration: none; }
.cat-tile-meta { min-width: 0; display: flex; flex-direction: column; }
.cat-tile-name { font-size: 0.84rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-tile:hover .cat-tile-name { color: var(--accent); }
.cat-tile-count { font-size: 0.7rem; color: var(--text-dim); }
.cat-tile-all { justify-content: center; }
.cat-tile-all .cat-tile-name { color: var(--accent); }

/* Homepage sidebar: ranked trending rows */
.trending-ranked { display: flex; align-items: flex-start; gap: 10px; }
.trending-ranked-main { min-width: 0; display: block; }
.trending-ranked-main .trending-row-title, .trending-ranked-main .trending-row-meta { display: block; }
.rank-num {
    flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; background: var(--surface-2); color: var(--text-dim);
    font-size: 0.72rem; font-weight: 700;
}
.trending-ranked:first-of-type .rank-num { background: var(--accent-soft); color: var(--accent); }

/* Inline "?" hint: a click-to-expand explanation. Expands inside the card flow,
   so it can never be clipped by the card's overflow:hidden (unlike a tooltip). */
.info-tip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px; flex-shrink: 0;
    border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.72rem; font-weight: 700; line-height: 1;
    user-select: none; transition: color .12s, border-color .12s, background .12s;
}
.hint { margin-top: 9px; }
.hint summary {
    display: inline-flex; align-items: center; gap: 7px;
    list-style: none; cursor: pointer; user-select: none;
    font-size: 0.8rem; font-weight: 600; color: var(--text-dim);
    transition: color .12s;
}
.hint summary::-webkit-details-marker { display: none; }
.hint summary:hover { color: var(--accent); }
.hint summary:hover .info-tip, .hint[open] .info-tip { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.hint[open] summary { color: var(--accent); margin-bottom: 8px; }
.hint-body {
    font-size: 0.84rem; line-height: 1.6; color: var(--text-muted);
    background: var(--surface-2); border: 1px solid var(--border-soft);
    border-radius: 8px; padding: 10px 12px;
}

/* Link detail sidebar: connectedness gauge (also reused by the Lighthouse scores) */
.gauge { flex-shrink: 0; }
.gauge-track { fill: none; stroke: var(--border-soft); stroke-width: 5; }
.gauge-fill { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.gauge-num { font-size: 11px; font-weight: 700; fill: var(--text); }

/* Link detail: Lighthouse / PageSpeed score gauges */
.psi-grid { display: flex; flex-wrap: wrap; gap: 24px 30px; }
.psi-item { text-align: center; }
.psi-label { margin-top: 6px; font-size: 0.74rem; font-weight: 600; color: var(--text-muted); }

.psi-shot { display: block; width: 58px; height: auto; margin: 0 auto; border-radius: 7px; border: 1px solid var(--border); background: #fff; }

/* Core Web Vitals tiles under the gauges (graded good / needs work / poor) */
.cwv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 18px; }
.cwv-tile { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.cwv-label { color: var(--text-dim); font-size: 0.7rem; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; line-height: 1.35; margin-bottom: 7px; }
.cwv-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.5px; line-height: 1; font-variant-numeric: tabular-nums; }
.cwv-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--text-muted); font-size: 0.74rem; font-weight: 600; }

/* Link detail: "X vs Y" comparison table */
.vs-table .vs-aspect { color: var(--text-dim); font-weight: 600; white-space: nowrap; }
.vs-table thead th a { color: var(--accent); text-decoration: none; }
.vs-table thead th a:hover { text-decoration: underline; }

/* Link detail: AI-suggested "similar sites around the web" rows */
.site-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border-soft); }
.site-row:first-child { border-top: none; padding-top: 2px; }
.site-row-main { flex: 1; min-width: 0; text-decoration: none; }
.site-row-name { color: var(--text); font-weight: 600; font-size: 0.95rem; }
.site-row-main:hover .site-row-name { color: var(--accent); }
.site-row-ext { color: var(--text-dim); font-weight: 400; }
.site-row-why { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; line-height: 1.45; }
.site-row-action {
    flex: 0 0 auto; font-size: 0.8rem; font-weight: 600; text-decoration: none; white-space: nowrap;
    padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); transition: color .12s, background .12s, border-color .12s;
}
.site-row-action.add { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.site-row-action.add:hover { background: var(--accent); color: var(--on-accent); }
.site-row-action.in { color: var(--text-muted); }
.site-row-action.in:hover { color: var(--accent); border-color: var(--accent-border); }
/* Discover page: where a suggestion came from + linkified site name */
a.site-row-name { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
a.site-row-name:hover { color: var(--accent); }
.site-row-src { color: var(--text-dim); font-size: 0.78rem; margin-top: 4px; }
.site-row-src a { color: var(--accent); text-decoration: none; }
.site-row-src a:hover { text-decoration: underline; }

/* Social share bar */
.share-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.share-label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); margin-right: 2px; }
.share-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--border-soft);
    color: var(--text-muted); cursor: pointer; text-decoration: none;
    transition: color .12s, background .12s, border-color .12s, transform .12s;
}
.share-btn:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); transform: translateY(-1px); }
.share-btn svg { width: 16px; height: 16px; }
.share-btn.copied { color: #22c55e; border-color: #22c55e; }

/* Embedded video player (link detail) */
.video-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-facts { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-muted); font-size: 0.88rem; margin: 8px 0 4px; }
.video-facts > svg { width: 15px; height: 15px; color: #ef4444; flex: 0 0 auto; }
.video-facts a { color: var(--accent); text-decoration: none; }
.video-facts a:hover { text-decoration: underline; }

/* Play badge on video cards */
.r-thumb { position: relative; }
.r-thumb-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.r-thumb-play svg { width: 30px; height: 30px; color: #fff; background: rgba(0,0,0,.55); border-radius: 50%; padding: 6px; }
/* Gemini rating — shown under the listing thumbnail, mirroring the link page's
   "Gemini review" score (number + /10 + a 10-segment bar). */
.r-thumb-col { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.r-rating { width: 132px; }
.r-rating-num { display: inline-flex; align-items: center; gap: 4px; font-size: 1rem; font-weight: 800; line-height: 1; }
.r-rating-num svg { width: 12px; height: 12px; }
.r-rating-max { font-size: 0.68rem; font-weight: 600; opacity: 0.55; }
.r-rating-bar { display: flex; gap: 2px; margin-top: 6px; }
.r-rating-seg { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.r-rating.good .r-rating-num, .r-rating.good .r-rating-num svg { color: #22c55e; }
.r-rating.good .r-rating-seg.on { background: #22c55e; }
.r-rating.mid  .r-rating-num, .r-rating.mid  .r-rating-num svg { color: var(--accent); }
.r-rating.mid  .r-rating-seg.on { background: var(--accent); }
.r-rating.low  .r-rating-num, .r-rating.low  .r-rating-num svg { color: var(--red, #e5534b); }
.r-rating.low  .r-rating-seg.on { background: var(--red, #e5534b); }
@media (max-width: 560px) { .r-rating { width: 94px; } .r-rating-num { font-size: 0.9rem; } }

/* Visualization hub (viz.php) */
.viz-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.viz-tab { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--surface);
    color: var(--text-muted); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; transition: all .12s; }
.viz-tab:hover { color: var(--text); border-color: var(--accent-border); }
.viz-tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.viz-hint { color: var(--text-dim); font-size: 0.84rem; margin-bottom: 12px; }
.viz-chart { width: 100%; min-height: 200px; }
.viz-chart svg a { text-decoration: none; }
.viz-chart svg a:hover text { fill: var(--accent) !important; }
.viz-empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }

/* Like + bookmark buttons */
.engage-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.like-btn, .bm-btn {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--text-muted);
    border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 0.85rem; font-weight: 600;
    transition: color .12s, background .12s, border-color .12s;
}
.like-btn svg, .bm-btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.like-btn:hover, .bm-btn:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.like-btn.liked { color: #ef4444; border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.1); }
.like-btn.liked .like-ico { fill: #ef4444; stroke: #ef4444; }
.bm-btn.is-saved { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.bm-btn.is-saved .bm-ico { fill: var(--accent); }

/* Compact bookmark on cards (top-right corner) */
.bm-btn--compact { position: absolute; top: 10px; right: 10px; z-index: 2; width: 30px; height: 30px; padding: 0; justify-content: center; }
.bm-btn--compact .bm-ico { width: 15px; height: 15px; }
.card-likes { color: var(--text-dim); white-space: nowrap; }

/* Link detail: "Who it's for" callout */
.detail-whofor {
    display: flex; align-items: flex-start; gap: 9px;
    background: var(--surface-2); border: 1px solid var(--border-soft);
    border-radius: 9px; padding: 11px 13px; margin: 0 0 16px;
    color: var(--text-muted); font-size: 0.92rem; line-height: 1.55;
}
.detail-whofor svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; color: var(--accent); }
.detail-whofor strong { color: var(--text); font-weight: 600; }
