:root {
  color-scheme: light;
  --bg: #fff;
  --fg: #000;
  --line: #d8d8d8;
  --muted: #666;
  --soft: #f6f6f6;
  --danger: #b00020;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, textarea, select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--fg);
  background: var(--bg);
  padding: 10px 14px;
  border-radius: 12px;
}
button.primary { background: var(--fg); color: var(--bg); }
button.secondary { background: var(--bg); color: var(--fg); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 12px;
  border-radius: 12px;
}
textarea { min-height: 180px; resize: vertical; }
code { background: var(--soft); padding: 2px 6px; border-radius: 6px; }
.container { width: min(1180px, calc(100vw - 32px)); margin: 0 auto; }
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 18px 0; }
#siteTitle { margin: 0; font-size: 28px; line-height: 1.2; }
.subtle, .hint, .meta, .helper { color: var(--muted); }
.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; padding: 20px 0 40px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: var(--bg); box-shadow: var(--shadow); }
.section-head { display: flex; align-items: center; gap: 12px; }
.section-head.between { justify-content: space-between; }
.section-head h2 { margin: 0; font-size: 20px; }
.auth-grid { display: grid; gap: 10px; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.topics-list, .posts-list, .attachments-list, .sections-list { display: flex; flex-direction: column; gap: 12px; }
.topic-item, .post-item, .section-item, .attachment-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: var(--bg);
}
.topic-item.active { border-color: var(--fg); }
.topic-item-title { margin: 0 0 6px; font-size: 18px; }
.topic-item button.linklike {
  border: 0; padding: 0; background: transparent; text-align: left; width: 100%;
}
.post-content { white-space: pre-wrap; word-break: break-word; }
.attachments-list img { max-width: 280px; max-height: 220px; display: block; border-radius: 12px; border: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.error { color: var(--danger); }
.empty { padding: 20px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 30;
}
.modal-backdrop.hidden { display: none; }
.modal {
  width: min(760px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.modal-head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 16px 18px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.compose-grid { display: grid; gap: 12px; }
.attach-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pending-attachment {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}
