:root {
  color-scheme: light dark;
  --page: Canvas;
  --ink: #181826;
  --card: #ffffff;
  --line: #e3e0da;
  --muted: #66635c;
  --accent: AccentColor;
  --accent-ink: AccentColorText;
  --up: #c2410c;
  --down: #3b5bdb;
  --danger: #b42318;
  --wash: #f2f2f7;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #ece9e4; --card: #23201d; --line: #38342f; --muted: #a7a29a; --up: #fb923c; --down: #8ea2ff; --danger: #f97066; --wash: #1c1b1a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; display: inline-block; }
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.link { border: 0; background: none; padding: 0; color: var(--muted); }
button.link:hover { color: var(--ink); text-decoration: underline; }
button.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; min-height: 4.5em; }

.topbar { position: sticky; top: 0; z-index: 2; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 20px; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 15px; }
.topnav { display: flex; gap: 16px; }
.topnav a { color: var(--ink); }
.topsearch { margin-left: auto; width: 220px; }
.topsearch input { padding: 5px 10px; }
.me { display: flex; align-items: center; gap: 6px; }

.layout { max-width: 1180px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.sidebar { display: grid; gap: 16px; position: sticky; top: 64px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card h3 { margin: 12px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card .button { margin: 8px 8px 0 0; }
.muted, .dot, .meta, .edited { color: var(--muted); }
.dot { margin: 0 6px; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.stats { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; }
.stats strong { color: var(--ink); }
.notice { max-width: 1180px; margin: 12px auto 0; padding: 10px 16px; border-radius: 8px; }
.notice.error { background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: var(--ink); }
.notice.ok { background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.flag { color: var(--muted); font-style: italic; }
.badge { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; background: var(--wash); color: var(--muted); margin-right: 6px; }
.badge.featured { color: var(--up); }
.badge.op { color: var(--accent); margin: 0 0 0 6px; }
.pronouns { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.user { font-weight: 600; }

.listing-head, .comments-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab { padding: 4px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.tab.current { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.pager { display: flex; justify-content: space-between; margin: 16px 0; }
.community-head h1 { margin: 0; font-size: 24px; }
.community-head p { margin: 0 0 12px; }

.post-list { display: grid; gap: 8px; }
.post-row, .post-full { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.post-title { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.post-title a { color: var(--ink); }
.post-full .post-title { font-size: 22px; }
.domain { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.post-row .meta, .post-full .meta { margin: 2px 0; font-size: 13px; }
.post-actions { margin: 4px 0 0; font-size: 13px; display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); }
.post-actions a { color: var(--muted); font-weight: 600; }
.post-url { margin: 4px 0; font-size: 13px; overflow-wrap: anywhere; }

.votes { display: flex; flex-direction: column; align-items: center; gap: 0; font-weight: 700; font-size: 13px; }
.vote { border: 0; background: none; padding: 2px 6px; color: var(--muted); font-size: 14px; line-height: 1; border-radius: 4px; }
.vote:hover { background: var(--wash); text-decoration: none; }
.votes.up .score, .votes.up .vote.up { color: var(--up); }
.votes.down .score, .votes.down .vote.down { color: var(--down); }
.comment-actions .votes { flex-direction: row; gap: 2px; }

.md { overflow-wrap: anywhere; }
.md p { margin: 6px 0; }
.md pre { background: var(--wash); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md code { font: 13px ui-monospace, "SF Mono", Menlo, monospace; }
.md blockquote { margin: 6px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; }
.md .strike { text-decoration: line-through; }
.md .sup { vertical-align: super; font-size: 75%; }
.md .sub { vertical-align: sub; font-size: 75%; }
.spoiler { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; margin: 6px 0; }
.spoiler summary { cursor: pointer; color: var(--muted); }

.comments { margin-top: 16px; }
.comments-head h2 { font-size: 18px; margin: 0; }
.composer { display: grid; gap: 8px; margin: 8px 0 16px; }
.composer .row { display: flex; gap: 8px; }
.composer button { justify-self: start; }
.composer-signin, .thread-note { color: var(--muted); }
.comment { margin-top: 10px; }
.comment > details > summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; }
.comment > details > summary::-webkit-details-marker { display: none; }
.comment > details > summary::before { content: "−"; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }
.comment > details:not([open]) > summary::before { content: "+"; }
.collapsed-count { display: none; margin-left: 8px; font-style: italic; }
.comment > details:not([open]) > summary .collapsed-count { display: inline; }
.comment-content { padding-left: 22px; }
.comment-body { margin: 2px 0; }
.comment-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.comment-actions .permalink { color: var(--muted); }
.reply-slot.open { padding-left: 22px; }
.children { margin-left: 7px; padding-left: 14px; border-left: 2px solid var(--line); }
.comment.depth-0 > details > .children { border-left-color: #8a8fe0; }
.comment.depth-1 > details > .children { border-left-color: #d9822b; }
.comment.depth-2 > details > .children { border-left-color: #3aa676; }
.comment.depth-3 > details > .children { border-left-color: #c45ab3; }
.comment.depth-4 > details > .children { border-left-color: #3b9fc4; }
.comment.depth-5 > details > .children { border-left-color: #b8a03a; }
.children:empty { display: none; }
.continue { display: inline-block; margin: 8px 0 0 22px; font-size: 13px; }

.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.stack button { justify-self: start; }
.inline-search { display: flex; gap: 8px; margin: 8px 0 16px; }
.inline-search input { flex: 1; }
.communities { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
.communities th, .communities td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.communities th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.profile-head h1 { margin: 0; font-size: 24px; }
.profile-head + .tabs { margin: 12px 0; }
.comment-summary { margin-bottom: 8px; }
.comment-summary .meta { margin: 0 0 4px; font-size: 13px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .topnav { display: none; }
  .topsearch { width: 140px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto; transition: none; } }
.community-card > .community { display: block; margin-bottom: 4px; }
