* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-sans); }
a { color: var(--violet-text); }
h1, h2, h3, p { margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--space-4); }
.top { background: var(--surface); border-bottom: 1px solid var(--line); padding-top: var(--space-3); }
.top-in { display: flex; align-items: center; gap: var(--space-6); padding-bottom: var(--space-3); flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); line-height: 1.1; }
.brand .display { font-size: 24px; }
.brand .caption { color: var(--ink-muted); }
.nav { display: flex; gap: var(--space-4); flex: 1; }
.nav a { color: var(--ink-muted); text-decoration: none; padding: var(--space-1) 0; font-weight: 600; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.who { color: var(--ink-muted); }
.top .polr-band { margin-bottom: -2px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-6); padding-top: var(--space-6); padding-bottom: 64px; align-items: start; }
#side { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } #side { position: static; } }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.muted { color: var(--ink-muted); }
.page-head { display: flex; flex-direction: column; gap: var(--space-2); }
.crumbs { font-size: 14px; color: var(--ink-muted); }

/* Section lists */
.section-card { display: block; padding: var(--space-4) var(--space-6); text-decoration: none; color: inherit; }
.section-card:hover h3 { text-decoration: underline; }
.section-card.featured { border-color: var(--accent); }
.section-card .count { margin-left: auto; color: var(--ink-muted); }

/* Thread list */
.thread-list { padding: 0; overflow: hidden; }
.thread-row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-4); padding: var(--space-4) var(--space-6); text-decoration: none; color: inherit; border-top: 1px solid var(--line); }
.thread-row:first-child { border-top: 0; }
.thread-row:hover { background: var(--ground); }
.thread-row .t { font-weight: 600; }
.thread-row .meta { color: var(--ink-muted); font-size: 14px; display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-top: var(--space-1); }
.thread-row .stats { text-align: right; color: var(--ink-muted); }

/* Posts */
.post { padding: var(--space-4) var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.post.op { border-left: 0; }
.post-head { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.post-head .name { font-weight: 700; }
.post-body { max-width: 65ch; line-height: 1.55; white-space: pre-wrap; }
.votes { margin-left: auto; color: var(--ink-muted); }

/* Reply composer */
.composer textarea { width: 100%; min-height: 110px; font: inherit; padding: var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); resize: vertical; }
.composer textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Agent panel */
.agent { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.agent .prompt { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; margin: 0; }
.agent .modes { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.mode { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; transition: background-color 140ms ease-out; }
.mode[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--violet); color: var(--violet-text); font-weight: 600; }
.mode:focus-visible, .polr-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.steps { margin: 0; padding-left: 18px; color: var(--ink-muted); font-size: 14px; line-height: 1.5; }

/* History */
.hist { padding: var(--space-4) var(--space-6); display: grid; gap: var(--space-2); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--surface); padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); opacity: 0; pointer-events: none; transition: opacity 140ms ease-out, transform 140ms ease-out; font-weight: 600; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
[hidden] { display: none !important; }
