:root {
  --bg: #0b100d;
  --surface: #111814;
  --surface-2: #151e18;
  --surface-3: #1a241d;
  --ink: #ece7db;
  --dim: #b9b8ab;
  --faint: #8b9086;
  --line: rgba(236, 231, 219, 0.12);
  --line-strong: rgba(236, 231, 219, 0.2);
  --accent: #e07a4f;
  --accent-soft: rgba(224, 122, 79, 0.14);
  --green: #8fae96;
  --gold: #d6b36d;
  --blue: #8fa8b8;
  --red: #c98d7e;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(224, 122, 79, 0.06), transparent 60%),
    #070a08;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(236, 231, 219, 0.07) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.5;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
select,
textarea {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

@media (min-width: 760px) {
  #app {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.35);
  }
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 18px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--faint);
  text-transform: uppercase;
}

.mark {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.who {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.who.is-on {
  border-color: rgba(224, 122, 79, 0.4);
  background: var(--accent-soft);
  color: var(--accent);
}

.banner {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 18px 10px;
  padding: 9px 12px;
  border: 1px solid rgba(214, 179, 109, 0.28);
  border-radius: 10px;
  background: rgba(214, 179, 109, 0.08);
  color: var(--gold);
  font-size: 11px;
  line-height: 1.5;
}

.banner button {
  flex: none;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(214, 179, 109, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  font-size: 10px;
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.view-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 18px 24px;
  scrollbar-width: none;
}

.view-scroll::-webkit-scrollbar {
  display: none;
}

.feed-head {
  padding: 4px 0 16px;
}

.feed-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.feed-head p {
  margin: 7px 0 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--faint);
}

.chips {
  display: flex;
  gap: 6px;
  margin: 0 -18px;
  padding: 0 18px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.chip.is-on {
  border-color: rgba(224, 122, 79, 0.42);
  background: var(--accent-soft);
  color: var(--accent);
}

.feed {
  padding-bottom: 8px;
}

.post-card {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.post-card:hover {
  border-color: var(--line-strong);
}

.post-card:active {
  transform: scale(0.995);
}

.post-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.post-cat {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.post-cat[data-tone="research"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.post-cat[data-tone="notes"] {
  color: var(--green);
  background: rgba(143, 174, 150, 0.12);
}

.post-cat[data-tone="life"] {
  color: var(--gold);
  background: rgba(214, 179, 109, 0.1);
}

.post-cat[data-tone="help"] {
  color: var(--blue);
  background: rgba(143, 168, 184, 0.1);
}

.post-cat[data-tone="notice"] {
  color: var(--red);
  background: rgba(201, 141, 126, 0.1);
}

.post-time {
  font-size: 9px;
  color: var(--faint);
  white-space: nowrap;
}

.post-title {
  display: block;
  margin-bottom: 6px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--ink);
  text-wrap: balance;
}

.post-excerpt {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--dim);
}

.post-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.post-author {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: var(--dim);
}

.avatar-sm {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  color: var(--bg);
  font-family: var(--serif);
  font-size: 9px;
}

.post-stats {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
}

.empty {
  margin: 0;
  padding: 48px 0;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

.load-more {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 2px 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
}

.tabbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: rgba(11, 16, 13, 0.96);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 52px;
  min-height: 48px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 10px;
}

.tab svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab.is-on {
  color: var(--accent);
}

.tab-plus {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-top: -14px;
  border-radius: 50%;
  background: var(--accent);
  color: #0b100d;
  box-shadow: 0 6px 18px rgba(224, 122, 79, 0.35);
}

.tab-plus svg {
  width: 19px;
  height: 19px;
}

.subbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
}

.subbar-title {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.subbar-spacer {
  width: 40px;
  height: 40px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--dim);
}

.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail {
  padding: 18px 0 20px;
}

.detail h2 {
  margin: 10px 0;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.45;
  font-weight: 500;
  text-wrap: balance;
}

.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 10px;
  color: var(--faint);
}

.detail-meta .left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-size: 10px;
}

.like-btn.is-on {
  border-color: rgba(224, 122, 79, 0.4);
  background: var(--accent-soft);
  color: var(--accent);
}

.like-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-body p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--dim);
  white-space: pre-wrap;
  word-break: break-word;
}

.replies {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.replies-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.reply {
  display: flex;
  gap: 9px;
  margin-bottom: 16px;
}

.reply-body {
  flex: 1;
  min-width: 0;
}

.reply-who {
  font-size: 10px;
  color: var(--dim);
}

.reply-text {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.replybar {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.replybar input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.replybar input:focus {
  border-color: rgba(224, 122, 79, 0.5);
}

.send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #0b100d;
}

.send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compose {
  padding: 18px 0 28px;
}

.field {
  display: block;
  margin-bottom: 15px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(224, 122, 79, 0.5);
}

.field textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.75;
}

.hint {
  margin: 0 0 18px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--faint);
}

.primary {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #0b100d;
  font-size: 13px;
  font-weight: 500;
}

.ghost {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--dim);
  font-size: 12px;
}

.searchbar {
  flex: none;
  padding: 12px 18px;
}

.searchbar input {
  width: 100%;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.searchbar input:focus {
  border-color: rgba(224, 122, 79, 0.5);
}

.search-meta {
  padding: 0 0 10px;
  font-size: 10px;
  color: var(--faint);
}

.profile {
  padding: 20px 0 30px;
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 13px;
}

.avatar-lg {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  color: var(--bg);
  font-family: var(--serif);
  font-size: 23px;
}

.profile h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
}

.profile .sub {
  margin: 5px 0 0;
  font-size: 10px;
  color: var(--faint);
}

.stats {
  display: flex;
  gap: 28px;
  margin: 20px 0;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats strong {
  display: block;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
}

.stats span {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.profile-actions {
  display: flex;
  gap: 8px;
}

.profile-actions .primary,
.profile-actions .ghost {
  width: auto;
  flex: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 4, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: 100%;
  max-width: 380px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.modal-card h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
}

.modal-card p {
  margin: 0 0 16px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--dim);
}

.modal-card input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.modal-card input:focus {
  border-color: rgba(224, 122, 79, 0.5);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions .primary {
  flex: 1;
  min-height: 46px;
}

.modal-actions .ghost {
  flex: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100vw - 48px);
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
