:root {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17271f;
  background: #f7faf6;
  font-synthesis: none;
  --canvas: #f7faf6;
  --rail: #eef4ee;
  --surface: #ffffff;
  --surface-soft: #f2f7f2;
  --line: #dce7dd;
  --line-strong: #c9d9cb;
  --ink: #17271f;
  --muted: #607267;
  --subtle: #87988b;
  --brand: #236044;
  --brand-strong: #174b33;
  --brand-soft: #e2f0e4;
  --focus: #0f766e;
  --danger: #9b472d;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
}

button, input, textarea { font: inherit; }
button, a, label.attach-button { -webkit-tap-highlight-color: transparent; }
button, label.attach-button { cursor: pointer; touch-action: manipulation; }
button { border: 0; }
a { color: inherit; }

button:disabled {
  opacity: .55;
  cursor: wait;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, white);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.sr-only,
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-input:focus-visible {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
  margin: 0;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  text-decoration: none;
  transition: transform 150ms ease;
}

.skip-link:focus { transform: translateY(0); }

.sidebar {
  width: 256px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 16px;
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 34px;
  color: var(--ink);
  font-size: 29px;
  font-weight: 750;
  letter-spacing: -1.6px;
  text-decoration: none;
}

.brand-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #cfe0d1;
  border-radius: 10px;
  background: #e2eee2;
  color: var(--brand);
  font-size: 23px;
  letter-spacing: 0;
}

.brand-dot { color: #84a46d; }

.workspace-label,
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 1.4px;
}

.workspace-label { margin: 0 8px 14px; }

.workspace-label span {
  padding: 4px 6px;
  border-radius: 5px;
  background: #e0ebe0;
  color: #607b64;
  font-size: 8px;
  letter-spacing: 1px;
}

.primary,
.secondary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.primary {
  padding: 10px 15px;
  background: var(--brand);
  color: white;
  box-shadow: 0 1px 2px #174b3318;
}

.primary:hover { background: var(--brand-strong); }
.primary:active { transform: translateY(1px); }

.new-topic {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 13px;
}

.new-topic > span { font-size: 19px; font-weight: 400; }

kbd {
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid #ffffff2b;
  border-radius: 4px;
  color: #c5dbca;
  font: 10px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 19px 0 25px;
  padding: 0 3px 11px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--subtle);
}

.search > span { font-size: 22px; line-height: 1; }

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.search input::placeholder { color: var(--subtle); }

.search kbd {
  margin-left: 0;
  border-color: var(--line-strong);
  color: var(--subtle);
}

.section-label { margin: 0 8px 11px; }
.section-label span { letter-spacing: 0; }

#topics {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.topic-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin-bottom: 4px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: background 150ms ease, color 150ms ease;
}

.topic-item:hover { background: #e3eee3; color: var(--ink); }
.topic-item.active { background: var(--brand-soft); color: var(--brand-strong); }

.topic-icon {
  color: #79927d;
  font-size: 16px;
}

.topic-item.active .topic-icon { color: var(--brand); }

.topic-name {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-item small { color: var(--subtle); font-size: 11px; }

.no-topics {
  margin: 0;
  padding: 10px;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1.7;
}

.sidebar-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 17px 4px 2px;
  border-top: 1px solid var(--line-strong);
}

.public-symbol { color: #729178; font-size: 22px; }
.sidebar-bottom strong { color: #58705d; font-size: 12px; font-weight: 650; }
.sidebar-bottom p { margin: 3px 0 0; color: var(--subtle); font-size: 11px; }

main {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  flex-shrink: 0;
  padding: 0 38px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.topbar-context { color: var(--subtle); }

.connection {
  display: inline-flex;
  align-items: center;
  color: #66806a;
  font-size: 11px;
  white-space: nowrap;
}

.connection::before,
.visibility-badge::before {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #7ca16f;
  content: "";
}

.connection.offline { color: #a26444; }
.connection.offline::before { background: #b87852; }

.welcome {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 48px 28px 36px;
  text-align: center;
}

.welcome-content { max-width: 700px; }

.welcome-mark {
  position: relative;
  width: max-content;
  margin: 0 auto 28px;
  transform: rotate(-7deg);
}

.welcome-mark > span {
  display: grid;
  width: 66px;
  height: 70px;
  place-items: center;
  border: 1px solid #d3e1d3;
  border-radius: 16px;
  background: #e6f0e4;
  color: #6b8e69;
  font-size: 40px;
}

.welcome-mark i {
  position: absolute;
  right: -10px;
  bottom: -5px;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 3px solid var(--canvas);
  border-radius: 10px;
  background: var(--brand);
  color: white;
  font-size: 17px;
  font-style: normal;
}

.eyebrow {
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
}

.eyebrow > span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #8ca877;
  vertical-align: middle;
}

.welcome h1 {
  margin: 22px 0 19px;
  color: var(--ink);
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 700;
  letter-spacing: -3.8px;
  line-height: 1.02;
}

.welcome h1 em {
  color: var(--brand);
  font-style: normal;
}

.welcome-content > p:not(.welcome-hint) {
  max-width: 500px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.welcome-hint {
  display: inline-block;
  margin: 28px 0 0;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.welcome-hint strong { color: var(--brand-strong); font-weight: 700; }

.thread {
  display: flex;
  align-self: center;
  width: 100%;
  max-width: 1120px;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 28px 38px 16px;
}

.thread-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 21px;
  border-bottom: 1px solid var(--line);
}

.thread-title-group { min-width: 0; }

.thread-heading h1 {
  margin: 7px 0 5px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 29px;
  font-weight: 720;
  letter-spacing: -1.2px;
  line-height: 1.15;
}

.thread-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.thread-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.visibility-badge {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 11px;
}

.visibility-badge::before { display: none; }
.visibility-badge > span { margin-right: 5px; color: #719078; font-size: 15px; }

.secondary {
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.secondary:hover { border-color: #9fbaa4; background: var(--surface-soft); color: var(--brand-strong); }

.feed {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 3px 22px 0;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.older { display: block; margin: 0 auto 18px; }

.empty-thread {
  padding: 52px 0;
  color: var(--subtle);
  text-align: center;
}

.empty-thread > span { color: #91ac91; font-size: 31px; }
.empty-thread h2 { margin: 11px 0 6px; color: #55705a; font-size: 21px; font-weight: 650; }
.empty-thread p { margin: 0; font-size: 13px; }

.post {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.post-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  color: var(--muted);
  font-size: 11px;
}

.post-head strong { color: #5d7663; font-size: 12px; font-weight: 650; }

.post-badge {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-soft);
  color: #719078;
  font-size: 13px;
}

.post time { margin-left: auto; color: var(--subtle); font-size: 10px; }

.post-text {
  margin: 0;
  padding: 0 15px 16px;
  overflow-wrap: anywhere;
  color: #354b3c;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.post-image-link { display: block; padding: 0 15px 15px; }

.post-image {
  display: block;
  max-width: 100%;
  max-height: 400px;
  border-radius: 6px;
  background: #f2f5f1;
  object-fit: contain;
}

.post-actions {
  display: flex;
  gap: 10px;
  padding: 7px 11px;
  border-top: 1px solid #edf2ed;
}

.post-actions button,
.post-actions a {
  padding: 5px 4px;
  background: transparent;
  color: #6f8774;
  font-size: 11px;
  text-decoration: none;
}

.post-actions button:hover,
.post-actions a:hover { color: var(--brand-strong); }

.composer {
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface);
}

.composer:focus-within { border-color: #82a88a; }

.composer textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  max-height: 220px;
  padding: 15px 16px 9px;
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  color: #2e4937;
  font-size: 15px;
  line-height: 1.6;
}

.composer textarea::placeholder { color: #87998c; }

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 10px;
  border-top: 1px solid #edf2ed;
}

.toolbar-leading { display: flex; align-items: center; gap: 11px; }

.attach-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 7px 6px;
  color: #66816b;
  font-size: 12px;
}

.attach-button:hover { color: var(--brand-strong); }
.attach-button > span:first-child { font-size: 18px; }
.send-hint { color: var(--subtle); font-size: 11px; }
.composer .primary { min-width: 86px; }

.attachment {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.attachment img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.attachment strong { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.attachment span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.attachment button { margin-left: auto; padding: 6px 9px; background: transparent; color: #728977; font-size: 22px; }

#notice {
  position: fixed;
  z-index: 4;
  bottom: 22px;
  left: 50%;
  max-width: min(90vw, 560px);
  padding: 11px 16px;
  transform: translateX(-50%);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 12px;
  box-shadow: 0 8px 25px #17271f22;
}

#notice.error { background: var(--danger); }

dialog {
  width: min(420px, calc(100% - 32px));
  padding: 25px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--canvas);
  color: var(--ink);
  box-shadow: 0 25px 70px #17271f24;
}

dialog::backdrop { background: #17271f55; backdrop-filter: blur(3px); }

.dialog-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-top h2 { margin: 9px 0 0; font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.dialog-top button { padding: 0 3px; background: transparent; color: var(--subtle); font-size: 25px; line-height: 1; }
dialog > form > p { margin: 13px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
dialog label { display: block; margin: 21px 0 8px; color: var(--ink); font-size: 12px; font-weight: 650; }
dialog input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
dialog .dialog-note { margin-top: 8px; color: var(--subtle); font-size: 11px; }
dialog .primary { width: 100%; margin-top: 14px; justify-content: space-between; }
#topic-error { color: var(--danger); }

.dragging .composer { outline: 2px dashed #6e9b75; outline-offset: 4px; }

@media (max-width: 900px) {
  .sidebar { width: 224px; padding-right: 14px; padding-left: 14px; }
  .topbar { padding-right: 25px; padding-left: 25px; }
  .thread { padding-right: 25px; padding-left: 25px; }
  .welcome h1 { font-size: 55px; }
}

@media (max-width: 620px) {
  body { flex-direction: column; }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 10px;
    width: 100%;
    padding: 11px 15px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand { margin: 0; font-size: 25px; gap: 8px; }
  .brand-icon { width: 30px; height: 30px; border-radius: 8px; font-size: 19px; }
  .workspace-label, .sidebar-bottom, .section-label, .search { display: none; }
  .new-topic { width: auto; min-height: 38px; padding: 6px 12px; font-size: 12px; }
  .new-topic kbd { display: none; }

  #topics {
    grid-column: 1 / -1;
    display: flex;
    gap: 5px;
    max-height: 44px;
    overflow-x: auto;
  }

  .topic-item { width: auto; max-width: 210px; flex-shrink: 0; min-height: 36px; margin: 0; padding: 6px 10px; white-space: nowrap; }
  .topic-item small { display: none; }
  .no-topics { margin: 0; padding: 0; font-size: 11px; }

  main { min-height: 0; }
  .topbar { height: 44px; padding: 0 17px; font-size: 11px; }
  .welcome { padding: 35px 20px 25px; }
  .welcome-mark { margin-bottom: 23px; }
  .welcome h1 { margin-top: 18px; font-size: 45px; letter-spacing: -2.4px; }
  .welcome-content > p:not(.welcome-hint) { font-size: 14px; }
  .welcome-hint { margin-top: 22px; font-size: 11px; }

  .thread { padding: 19px 15px 12px; }
  .thread-heading { gap: 12px; padding-bottom: 15px; }
  .thread-heading h1 { font-size: 24px; }
  .thread-heading p { font-size: 11px; }
  .thread-actions { gap: 4px; }
  .visibility-badge { display: none; }
  .thread-actions .secondary { padding: 7px 9px; }
  .thread-actions .secondary span { display: none; }
  .feed { padding-top: 17px; }
  .empty-thread { padding: 25px 0; }
  .post-text { font-size: 13px; }
  .composer textarea { min-height: 76px; padding: 12px; font-size: 16px; }
  .composer-toolbar { padding: 6px 8px 8px; }
  .send-hint { display: none; }
  .attachment strong { max-width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
