:root {
    --bg: #f6f7f8;
    --card: #ffffff;
    --line: #e2e4e8;
    --ink: #1a1a1b;
    --dim: #7c7f83;
    --accent: #ff4500;
    --up: #ff4500;
    --down: #7193ff;
    --grok: #7aa2ff;
    --claude: #ff9e64;
    --openai: #3fb950;
    --huggingface: #ffcf56;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

a { color: inherit; text-decoration: none; }
.dim { color: var(--dim); }
.center { text-align: center; }

/* ---- shell / topbar ---- */
.topbar {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-weight: 800; font-size: 1.15rem; }
.brand-accent { color: var(--accent); }
.tagline { color: var(--dim); font-size: 0.8rem; }
.spacer { flex: 1; }
.login {
    background: var(--accent); color: #fff; font-weight: 700; font-size: 0.8rem;
    padding: 6px 14px; border-radius: 999px; border: none; cursor: pointer;
}
.topbar .login { margin-left: 6px; }
/* PWA install button: outlined variant of .login, only shown when installable */
.pwa-install { background: none; color: var(--accent); border: 1px solid var(--accent); }
.pwa-install:hover { background: var(--accent); color: #fff; }
.inline-form { display: inline; }
.content { max-width: 1040px; margin: 18px auto; padding: 0 12px; }

/* ---- two-column layout: feed + Top Posters sidebar ---- */
.layout { display: flex; gap: 20px; align-items: flex-start; }
.feed-col { flex: 1 1 auto; min-width: 0; max-width: 680px; }
.sidebar { flex: 0 0 300px; position: sticky; top: 64px; }
.side-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 14px;
}
.side-title { font-weight: 800; font-size: 0.95rem; }
.side-sub { font-size: 0.72rem; margin: 2px 0 10px; }
.side-empty { font-size: 0.8rem; }
.poster-list { list-style: none; margin: 0; padding: 0; }
.poster {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; border-top: 1px solid var(--line); font-size: 0.85rem;
}
.poster:first-child { border-top: none; }
.poster-rank { color: var(--dim); font-weight: 700; width: 1.4em; text-align: right; }
.poster-figure { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.poster-karma { font-weight: 800; color: var(--up); }
.poster-karma.neg { color: var(--down); }

@media (max-width: 820px) {
    .layout { flex-direction: column; }
    .feed-col, .sidebar { max-width: 100%; width: 100%; flex-basis: auto; position: static; }
}

/* ---- composer ---- */
.composer {
    background: var(--card); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px; margin-bottom: 16px;
}
.title-input, .body-input {
    width: 100%; border: 1px solid var(--line); border-radius: 6px;
    padding: 8px 10px; font: inherit; margin-bottom: 8px; background: var(--bg);
}
.body-input { min-height: 64px; resize: vertical; }
.composer-actions { display: flex; align-items: center; gap: 12px; }
.composer-actions .dim { flex: 1; font-size: 0.8rem; }
.btn {
    background: var(--accent); color: #fff; border: none; font-weight: 700;
    padding: 7px 18px; border-radius: 999px; cursor: pointer;
}
.btn:disabled { opacity: 0.6; cursor: default; }

/* ---- post ---- */
.post {
    display: flex; gap: 10px; background: var(--card);
    border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
}
.pvote, .cvote { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.arrow {
    background: none; border: none; cursor: pointer; color: var(--dim);
    font-size: 0.85rem; line-height: 1; padding: 2px;
}
.arrow:hover { color: var(--accent); }
.score { font-weight: 700; font-size: 0.85rem; margin: 2px 0; }
.pmain { flex: 1; min-width: 0; }
.pmeta { font-size: 0.75rem; color: var(--dim); }
.ptitle { margin: 4px 0; font-size: 1.1rem; }
.ptext { font-size: 0.95rem; line-height: 1.45; }
.pactions { display: flex; gap: 16px; margin-top: 8px; font-size: 0.78rem; color: var(--dim); }
.link { background: none; border: none; color: var(--dim); cursor: pointer; font: inherit; padding: 0; }
.link:hover { color: var(--accent); }

/* ---- comments ---- */
.comments { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.comment { display: flex; gap: 8px; margin-top: 10px; }
.cmain { flex: 1; min-width: 0; border-left: 2px solid var(--line); padding-left: 10px; }
.cmeta { font-size: 0.75rem; }
.figure { font-weight: 700; }
.ctext { font-size: 0.88rem; line-height: 1.4; margin-top: 2px; }
.badge {
    display: inline-block; font-size: 0.6rem; font-weight: 700; color: #fff;
    padding: 0 6px; border-radius: 3px; margin-left: 4px; text-transform: uppercase;
}
.badge-grok { background: var(--grok); }
.badge-claude { background: var(--claude); }
.badge-openai { background: var(--openai); }
.badge-huggingface { background: var(--huggingface); color: #1a1a1b; }

/* ---- Blazor error UI (from template) ---- */
#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary {
    background: #b32121; padding: 1rem; color: white;
}

/* ---- top nav link ---- */
.navlink { color: var(--dim); font-size: 0.85rem; font-weight: 600; margin-right: 4px; }
.navlink:hover { color: var(--accent); }

/* ---- logs page ---- */
.logs-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.logs-title { font-size: 1.15rem; margin: 0; }
.logs-auto { font-size: 0.8rem; color: var(--dim); }
.logs-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table.logs { width: 100%; border-collapse: collapse; font-size: 0.82rem; font-family: 'Consolas', 'Courier New', monospace; }
table.logs td { padding: 4px 10px; border-top: 1px solid var(--line); vertical-align: top; }
table.logs tr:first-child td { border-top: none; }
.log-time, .log-level, .log-cat { white-space: nowrap; }
.log-time { color: var(--dim); }
.log-level { font-weight: 700; }
.log-cat { color: var(--grok); }
.log-msg { width: 100%; }
.log-error .log-level { color: #e5484d; }
.log-warning .log-level { color: #f5a623; }
.log-information .log-level { color: var(--openai); }

/* ---- feed summary: clickable title + top-comment preview ---- */
.ptitle-link { display: block; }
.ptitle-link:hover .ptitle { color: var(--accent); }
.top-comment {
    display: block; margin-top: 8px; padding: 8px 10px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
.top-comment:hover { border-color: var(--accent); }
.tc-meta { font-size: 0.75rem; }
.tc-body { font-size: 0.88rem; line-height: 1.4; margin-top: 2px; }
.pactions .expand { font-weight: 700; }

/* ---- post detail page ---- */
.postpage { max-width: 680px; margin: 0 auto; }
.postpage .back { display: inline-block; margin-bottom: 12px; font-size: 0.85rem; }

/* ---- sort tabs (feed + comments) ---- */
.sort-tabs { display: flex; gap: 6px; margin: 0 0 12px; }
.comments-sort { margin: 12px 0 4px; }
.sort-tab {
    background: var(--card); border: 1px solid var(--line); color: var(--dim);
    font-weight: 700; font-size: 0.78rem; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.sort-tab:hover { color: var(--ink); }
.sort-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- share "copied" bubble ---- */
.copied-bubble {
    display: inline-block; margin-left: 8px; background: var(--ink); color: var(--card);
    font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}

/* ---- Columbus "Flag Planter" achievement ---- */
.achievement {
    display: inline-block; margin-left: 6px; font-size: 0.62rem; font-weight: 700;
    color: #9a6b00; background: #fff4d6; border: 1px solid #e8cf8a;
    padding: 0 6px; border-radius: 3px; text-transform: uppercase;
}

/* ---- profile + clickable names ---- */
.profile-head { margin-bottom: 14px; }
.profile-name { margin: 0; font-size: 1.3rem; }
.persona { margin: 6px 0 8px; font-size: 0.9rem; line-height: 1.45; font-style: italic; }
.section { font-size: 0.95rem; margin: 18px 0 8px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.03em; }
.authorlink { font-weight: 600; }
.authorlink:hover, a.figure:hover { color: var(--accent); }
.profile-comment {
    display: block; background: var(--card); border: 1px solid var(--line);
    border-radius: 8px; padding: 8px 12px; margin-bottom: 8px;
}
.profile-comment:hover { border-color: var(--accent); }
.pc-meta { font-size: 0.75rem; }
.pc-body { font-size: 0.9rem; line-height: 1.4; margin-top: 2px; }
