:root {
  color-scheme: dark;
  --bg: #0b1120;
  --panel: #111b2d;
  --panel-hover: #152138;
  --inset: #0d1626;
  --line: #23324a;
  --text: #e3eaf5;
  --muted: #95a5bf;
  --blue: #7ab2ff;
  --green: #66d9ba;
  --yellow: #f1cb7a;
  --red: #ff9caa;
  --radius: 10px;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--blue); text-underline-offset: 3px; }
button, select { border: 1px solid var(--line); border-radius: 6px; background: var(--inset); }
button:hover:not(:disabled), select:hover { background: var(--panel-hover); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex="-1"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
button { min-height: 32px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 12px; z-index: 20; padding: 10px 18px; border-radius: 6px; background: var(--blue); color: var(--bg); }
.skip-link:focus { top: 10px; }
.muted { color: var(--muted); }
.eyebrow { display: block; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .12em; }
kbd { font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; border: 1px solid #34435c; border-radius: 4px; padding: 1px 5px; color: #b0bfd5; }

.topbar { display: flex; align-items: center; gap: 38px; min-height: 78px; padding: calc(14px + env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) 14px max(28px, env(safe-area-inset-left)); background: #0e1728; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; min-width: 192px; text-decoration: none; color: #eff5ff; font-size: 24px; font-weight: 750; letter-spacing: -.9px; line-height: 1.1; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 39px; border: 1px solid #426caf; border-radius: 11px; background: #1c3861; color: #b5d5ff; font: 750 30px/1 ui-monospace, Menlo, monospace; position: relative; padding-bottom: 6px; }
.brand-mark span { color: #80c9ff; position: absolute; right: 3px; bottom: 0; }
.brand-caption { display: block; margin-top: 6px; font-size: 10px; font-weight: 450; letter-spacing: .025em; color: var(--muted); }
.search-wrap { position: relative; flex: 1; max-width: 660px; }
.search-wrap input { width: 100%; min-height: 39px; border: 1px solid #2a3b57; border-radius: 7px; background: var(--bg); color: var(--text); padding: 8px 40px; font-size: 13px; }
.search-wrap input::placeholder { color: #8496b1; }
.search-icon { position: absolute; left: 13px; top: 12px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 1.7; pointer-events: none; }
.search-key { position: absolute; right: 12px; top: 10px; pointer-events: none; }
.topbar-meta { display: flex; align-items: center; gap: 15px; margin-left: auto; font-size: 11px; }
.read-only { display: inline-flex; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 5px; color: #b4c6e3; border: 1px solid #2a3b55; overflow-wrap: anywhere; }
.read-only > span { color: var(--blue); }
.read-only[data-writable="true"] { color: var(--green); border-color: #336252; }
.auth-button { padding: 4px 10px; font-size: 11px; }
.connection { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); flex-shrink: 0; box-shadow: 0 0 0 3px #f1cb7a0c; }
.connection[data-state="live"] .status-dot { background: var(--green); box-shadow: 0 0 0 3px #66d9ba10; }
.connection[data-state="error"] .status-dot { background: var(--red); box-shadow: none; }
.connection[data-state="idle"] .status-dot { background: var(--muted); box-shadow: none; }
.mobile-tools { display: none; }

.composer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; margin-bottom: 14px; }
.composer h2 { font-size: 15px; margin: 0 0 12px; }
.composer summary { cursor: pointer; color: var(--blue); font-size: 13px; font-weight: 600; }
.composer details[open] summary { margin-bottom: 12px; }
.composer-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.composer label { display: block; color: var(--muted); font-size: 11px; }
.composer input, .composer textarea { display: block; width: 100%; border: 1px solid #304563; border-radius: 6px; background: var(--bg); color: var(--text); padding: 8px 10px; margin-top: 5px; font-size: 13px; }
.composer textarea { resize: vertical; min-height: 80px; }
.composer input:disabled, .composer textarea:disabled { opacity: .7; }
.composer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.composer-actions button { padding: 5px 12px; font-size: 11px; }
.composer-actions button[type="submit"] { color: #c4ddff; border-color: #416897; background: #1a304f; }
.form-feedback { color: var(--yellow); font-size: 12px; overflow-wrap: anywhere; }
.form-feedback:empty { display: none; }
.reply-composer { margin: 12px 0 0; background: var(--inset); }

.layout { display: grid; grid-template-columns: 202px minmax(0, 1fr) 236px; gap: 30px; max-width: 1550px; margin: 0 auto; padding: 30px 28px 35px; }
.layout > * { min-width: 0; }
.sidebar, .activity-rail { position: sticky; align-self: start; top: calc(102px + env(safe-area-inset-top)); max-height: calc(100dvh - 130px - env(safe-area-inset-top)); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #304360 transparent; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px; }
.sidebar-heading h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .11em; font-weight: 650; margin: 0; color: var(--muted); }
.small-count { color: var(--muted); background: #1c2a41; font-size: 10px; min-width: 20px; padding: 0 5px; border-radius: 4px; text-align: center; }
.boards { display: grid; gap: 5px; margin-top: 15px; }
.board-button { width: 100%; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; background: transparent; text-align: left; padding: 8px 10px; color: #a1b1cb; min-height: 39px; }
.board-button[aria-current="page"] { color: #c3dcff; background: #172e4f; border-color: #2d4e7c; }
.board-symbol { font: 18px/1 ui-monospace, Menlo, monospace; color: #6887b5; }
.board-button[aria-current="page"] .board-symbol { color: var(--blue); }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-loaded-count { margin-left: auto; font-size: 10px; color: #aacdff; }
.sidebar-placeholder { font-size: 12px; padding: 0 8px; }
.sidebar-section { margin: 23px 8px 0; padding-top: 21px; border-top: 1px solid var(--line); }
.sidebar-section select { display: block; margin-top: 11px; width: 100%; padding: 8px 9px; color: #becce1; font-size: 12px; text-overflow: ellipsis; }
.field-note { color: var(--muted); font-size: 10px; line-height: 1.6; margin: 8px 0 0; }
.identity { margin: 10px 0 5px; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.backend-label { display: inline-block; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; color: var(--muted); font-size: 10px; }
.sidebar-note { margin: 27px 8px 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.note-symbol { color: #587ba9; font-size: 24px; }
.sidebar-note p { margin: 7px 0 13px; }
.key-hints { display: flex; gap: 15px; font-size: 10px; }
.key-hints kbd { margin-right: 3px; }

.feed-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 85px; margin-bottom: 19px; }
.feed-heading .eyebrow { margin: 0 0 5px; color: #7695c1; }
h1 { margin: 0; font-size: 27px; line-height: 1.3; font-weight: 720; letter-spacing: -.7px; overflow-wrap: anywhere; }
.feed-heading .muted { margin: 7px 0 0; font-size: 12px; }
.icon-button { width: 33px; height: 33px; flex-shrink: 0; font-size: 20px; color: var(--muted); }
.feed-toolbar { display: flex; align-items: center; gap: 15px; padding: 0 0 14px; border-bottom: 1px solid var(--line); font-size: 11px; }
.sort-control { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: #0e1728; gap: 3px; }
.sort-control button { border: 0; background: transparent; padding: 4px 15px; font-size: 11px; color: var(--muted); min-height: 27px; }
.sort-control button[aria-pressed="true"] { color: #d9e8ff; background: #233d61; }
.feed-toolbar-spacer { flex: 1; }
.text-button { background: transparent; border: 0; color: var(--blue); padding: 3px 5px; font-size: 11px; }
.search-scope { margin: 11px 0 15px; color: var(--muted); font-size: 10px; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #262438; border: 1px solid #665437; border-radius: 8px; color: var(--yellow); margin: 0 0 13px; padding: 12px 14px; font-size: 12px; overflow-wrap: anywhere; }
.notice p { margin: 0; }
.notice button { flex-shrink: 0; padding: 4px 9px; color: var(--yellow); border-color: #665437; }
.feed-state { border: 1px dashed #2b3e5a; border-radius: var(--radius); min-height: 242px; text-align: center; padding: 43px 22px; color: var(--muted); }
.state-symbol { display: block; font-size: 29px; color: #7399ce; }
.feed-state h2 { color: var(--text); font-size: 16px; font-weight: 600; margin: 12px 0 7px; }
.feed-state p { max-width: 400px; margin: 0 auto; font-size: 12px; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.thread-card { display: grid; grid-template-columns: 35px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: clip; scroll-margin-top: 105px; }
.thread-card:hover { border-color: #354c6f; }
.thread-card.is-expanded { border-color: #355988; }
.thread-marker { display: flex; justify-content: center; padding-top: 19px; background: #10192a; border-right: 1px solid #1e2e45; color: #4e74a5; font: 15px/1 ui-monospace, Menlo, monospace; }
.thread-content { padding: 13px 15px 10px; min-width: 0; }
.thread-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--muted); font-size: 10px; }
.thread-path { color: #82a9db; font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; text-decoration: none; }
.meta-dot { color: #566d90; }
.author-button { background: none; border: 0; padding: 0; min-height: auto; font-size: inherit; overflow-wrap: anywhere; text-align: left; }
.thread-title { margin: 7px 0 0; font-size: 15px; font-weight: 650; line-height: 1.5; letter-spacing: -.12px; }
.thread-toggle { background: none; border: 0; text-align: left; padding: 0; min-height: 0; font: inherit; line-height: inherit; width: 100%; overflow-wrap: anywhere; }
.thread-toggle:hover:not(:disabled) { background: none; color: #bcd8ff; }
.thread-excerpt { margin: 7px 0 9px; color: #acb9ce; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.excerpt-label { font-size: 10px; color: var(--blue); margin: 8px 0 0; }
.thread-actions { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; border-top: 1px solid #213149; padding-top: 6px; margin-top: 10px; }
.action-button { color: var(--muted); font-size: 10px; background: none; border: 0; padding: 3px 0; min-height: 25px; }
.action-button:hover:not(:disabled) { background: transparent; color: var(--blue); }
.action-button[aria-expanded="true"] { color: var(--blue); }
.loaded-label { margin-left: auto; font-size: 9px; color: var(--muted); }
.history-notice { padding: 10px 8px; margin: 13px 0 0; font-size: 10px; color: var(--muted); line-height: 1.8; text-align: center; }
.history-notice.is-bounded { color: var(--yellow); }

.thread-detail { border-top: 1px solid var(--line); margin-top: 11px; padding-top: 10px; }
.thread-detail-heading { color: var(--muted); font-size: 10px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px; }
.messages { display: grid; gap: 8px; }
.message { border-left: 2px solid #2c4569; padding: 8px 0 8px 13px; min-width: 0; scroll-margin-top: 110px; }
.message.is-root { border-left-color: #6a9ada; background: #16233a; border-radius: 0 6px 6px 0; padding-right: 11px; }
.message.is-linked { outline: 1px solid var(--blue); outline-offset: 4px; border-radius: 2px; }
.message-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 10px; }
.message-kind { color: #92b8ec; background: #203655; border-radius: 3px; font-size: 9px; padding: 0 5px; }
.message-meta .action-button { margin-left: auto; padding: 0 4px; }
.markdown { color: #c3cfe1; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.markdown > :first-child { margin-top: 7px; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 10px 0; white-space: pre-wrap; }
.markdown h3, .markdown h4, .markdown h5 { color: var(--text); font-size: 14px; margin: 15px 0 6px; }
.markdown ul, .markdown ol { padding-left: 22px; margin: 8px 0; }
.markdown li { padding-left: 2px; white-space: pre-wrap; }
.markdown blockquote { border-left: 2px solid #57739b; color: #a9bad2; margin: 10px 0; padding: 0 12px; white-space: pre-wrap; }
.markdown pre { background: #0a1220; border: 1px solid #263651; border-radius: 6px; overflow: auto; padding: 12px; max-height: 420px; line-height: 1.7; }
.markdown code { font: 11px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #0b1424; border-radius: 3px; padding: 2px 4px; }
.markdown pre code { padding: 0; background: transparent; }
.mention { color: #a8caff; background: #233b5e; padding: 1px 3px; border-radius: 3px; }
mark { color: #fff0be; background: #69542d; border-radius: 2px; }
.thread-load-state { margin: 12px 0 5px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.thread-load-state.is-error { color: var(--yellow); }
.load-more { margin: 11px 0 3px; color: var(--blue); padding: 6px 12px; font-size: 11px; border-color: #355784; }
.deep-link-note { margin: 9px 0; color: var(--yellow); font-size: 11px; }

.activity-rail { padding-left: 21px; border-left: 1px solid var(--line); }
.activity-rail .sidebar-heading { padding: 0; }
.rail-label { color: #7891b4; font-size: 8px; letter-spacing: .04em; white-space: nowrap; }
.activity-intro { color: var(--muted); font-size: 11px; margin: 8px 0 21px; }
.activity-list { margin: 0; padding: 0; list-style: none; }
.activity-item { position: relative; padding: 0 0 18px 17px; border-left: 1px solid #2b405f; margin-left: 4px; }
.activity-item::before { position: absolute; content: ""; width: 5px; height: 5px; left: -3px; top: 6px; background: #527fb7; border-radius: 50%; box-shadow: 0 0 0 4px var(--bg); }
.activity-item:first-child::before { background: var(--blue); }
.activity-link { display: block; color: inherit; text-decoration: none; border-radius: 3px; }
.activity-link:hover .activity-title { color: var(--blue); }
.activity-meta { display: flex; gap: 7px; justify-content: space-between; font-size: 9px; color: var(--muted); }
.activity-author { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.activity-meta time { flex-shrink: 0; }
.activity-title { margin: 4px 0; color: #c2cfe3; font-size: 11px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.activity-description { color: #899bb6; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.activity-empty { color: var(--muted); font-size: 11px; padding: 5px 0 20px; }
.rail-footer { display: flex; align-items: center; gap: 12px; margin-top: 15px; border-top: 1px solid var(--line); padding-top: 18px; color: #7589a7; font-size: 10px; }
.rail-footer p { margin: 0; line-height: 1.7; }
.mini-mark { font: 700 23px/1 ui-monospace, Menlo, monospace; color: #52739f; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; max-width: min(90vw, 560px); padding: 11px 18px; border-radius: 8px; border: 1px solid #3a5d8d; background: #1a304f; color: #d9e9ff; box-shadow: 0 8px 28px #0005; font-size: 12px; overflow-wrap: anywhere; }

@media (min-width: 1450px) {
  .layout { gap: 38px; grid-template-columns: 210px minmax(0, 1fr) 245px; }
  .topbar { gap: 46px; }
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 176px minmax(0, 1fr); gap: 22px; padding: 24px 20px; }
  .activity-rail { display: none; }
  .topbar { gap: 24px; padding-right: 20px; padding-left: 20px; }
  .brand { min-width: 174px; }
  .topbar-meta { gap: 14px; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 15px; padding: calc(13px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 13px max(16px, env(safe-area-inset-left)); position: relative; }
  .brand { min-width: 0; font-size: 23px; }
  .brand-mark { width: 31px; height: 35px; font-size: 27px; }
  .brand-caption { font-size: 9px; }
  .topbar-meta { margin-left: auto; gap: 8px; font-size: 10px; flex-wrap: wrap; justify-content: flex-end; white-space: normal; }
  .read-only { padding: 3px 6px; }
  .search-wrap { order: 3; flex-basis: 100%; max-width: none; }
  .search-wrap input { font-size: 16px; min-height: 43px; }
  .search-icon { top: 14px; }
  .search-key { top: 12px; }
  .mobile-tools { display: flex; gap: 8px; padding: 11px 16px 0; }
  .mobile-tools button { padding: 5px 11px; color: var(--muted); font-size: 11px; }
  .mobile-tools button[aria-expanded="true"] { color: #bed9ff; border-color: #436591; background: #1a304f; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 18px max(12px, env(safe-area-inset-right)) 25px max(12px, env(safe-area-inset-left)); }
  .sidebar, .activity-rail { display: none; position: static; max-height: none; }
  .sidebar.is-open { display: block; padding: 17px 10px; background: #0e182a; border: 1px solid var(--line); border-radius: var(--radius); }
  .boards { display: flex; flex-wrap: wrap; gap: 6px; }
  .board-button { width: auto; max-width: 100%; }
  .sidebar-section { margin-top: 15px; padding-top: 15px; }
  .sidebar-section select { font-size: 16px; }
  .sidebar-note { margin-top: 15px; }
  .sidebar-note > .note-symbol, .sidebar-note > p { display: none; }
  .activity-rail.is-open { display: block; grid-row: 1; padding: 15px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
  .activity-list { max-height: 280px; overflow-y: auto; }
  .rail-footer { display: none; }
  .feed-heading { margin: 0 5px 18px; min-height: 77px; }
  h1 { font-size: 25px; }
  .feed-toolbar { gap: 10px; }
  .thread-card { grid-template-columns: 25px minmax(0, 1fr); scroll-margin-top: 12px; }
  .thread-content { padding: 12px 12px 8px; }
  .thread-title { font-size: 15px; }
  .thread-meta, .message-meta { font-size: 11px; }
  .thread-path { font-size: 10px; }
  .thread-actions { gap: 14px; }
  .action-button { min-height: 34px; font-size: 11px; }
  .thread-excerpt, .markdown { font-size: 13px; }
  .message { padding-left: 10px; scroll-margin-top: 12px; }
  .notice { align-items: flex-start; }
  .composer-fields { grid-template-columns: minmax(0, 1fr); }
  .composer input, .composer textarea { font-size: 16px; }
}
@media (max-width: 370px) {
  .brand-caption { display: none; }
  .topbar-meta { gap: 7px; }
  .read-only { font-size: 9px; }
  .loaded-label { display: none; }
}
@media (pointer: coarse) {
  button { min-height: 40px; }
  .sort-control button { min-height: 34px; }
  .author-button { padding: 5px 0; min-height: 30px; }
  .thread-toggle { min-height: 34px; }
}
@media (prefers-reduced-motion: no-preference) {
  button, .thread-card { transition: background-color 120ms ease, border-color 120ms ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
