:root {
  --bg: #f6f3ec;
  --card: #fffdf8;
  --ink: #2b2723;
  --soft: #8a8178;
  --line: #e7e0d4;
  --accent: #9c7a54;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; }
.screen { padding: 0 18px 48px; min-height: 100vh; }
.center { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; text-align: center; }

.brand { font-size: 34px; font-weight: 600; letter-spacing: .04em; }
.hint { color: var(--soft); margin: 8px 0 28px; font-size: 15px; }
.form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.input {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); font-size: 16px; outline: none; width: 100%;
}
.input:focus { border-color: var(--accent); }
.btn { padding: 14px 16px; border: none; border-radius: 14px; background: var(--ink); color: #fff; font-size: 16px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.more { margin: 18px auto 0; display: block; padding: 10px 22px; }
.link { background: none; border: none; color: var(--soft); font-size: 14px; cursor: pointer; margin-top: 14px; }
.msg { color: var(--accent); font-size: 14px; min-height: 18px; margin: 4px 2px 0; }

.topbar { display: flex; align-items: center; gap: 10px; padding: 22px 0 10px; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.back { font-size: 26px; color: var(--soft); text-decoration: none; line-height: 1; }
.title { font-size: 20px; font-weight: 600; }

/* open card (no login): the reader leads with who shared it, and there is no
   "back" — this page is the whole destination. */
.pub-head { padding: 30px 0 4px; }
.pub-from { color: var(--soft); font-size: 13px; margin-bottom: 7px; }
.pub-from:empty { display: none; }
.pub-title { font-size: 23px; font-weight: 600; line-height: 1.35; }
.pub-foot { color: var(--soft); font-size: 12.5px; text-align: center; padding: 40px 20px 6px; }

.list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; text-decoration: none; color: var(--ink);
}
.card-title { font-size: 17px; }
.card-go { color: var(--soft); font-size: 22px; }
.empty { color: var(--soft); text-align: center; padding: 64px 20px; line-height: 1.9; font-size: 15px; }
.bottom { margin-top: 24px; display: flex; flex-direction: column; align-items: center; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 14px; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 7px 14px; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; font-size: 14px; color: var(--soft); cursor: pointer; white-space: nowrap;
}
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.feed { display: flex; flex-direction: column; gap: 14px; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 16px; }
.note-body { font-size: 16px; line-height: 1.85; font-family: Georgia, "Songti SC", serif; }
.note-body:empty { display: none; }
/* markdown blocks (light structure) */
.note-body > :first-child { margin-top: 0; }
.note-body > :last-child { margin-bottom: 0; }
.note-body p { margin: 0 0 .8em; }
.note-body h1, .note-body h2, .note-body h3,
.note-body h4, .note-body h5, .note-body h6 { margin: .2em 0 .5em; line-height: 1.4; }
.note-body h1 { font-size: 1.3em; }
.note-body h2 { font-size: 1.18em; }
.note-body h3, .note-body h4, .note-body h5, .note-body h6 { font-size: 1.06em; }
.note-body ul, .note-body ol { margin: 0 0 .8em; padding-left: 1.4em; }
.note-body li { margin: .15em 0; }
.note-body blockquote {
  margin: 0 0 .8em; padding: 2px 0 2px 12px;
  border-left: 2px solid var(--accent); color: var(--soft);
}
.note-body code {
  font-family: ui-monospace, Menlo, monospace; font-size: .88em;
  background: rgba(43, 39, 35, .06); padding: 1px 5px; border-radius: 5px;
}
.note-body pre { overflow-x: auto; background: rgba(43, 39, 35, .06); padding: 10px 12px; border-radius: 8px; }
.note-body pre code { background: none; padding: 0; }
.note-body a { color: var(--accent); }
.note-body hr { border: none; border-top: 1px solid var(--line); margin: 1em 0; }
.note-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.note-images:empty { display: none; }
.note-images img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; }
.note-meta { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.date { color: var(--soft); font-size: 12.5px; }
.chip { font-size: 12px; color: var(--accent); background: rgba(156, 122, 84, .1); padding: 3px 9px; border-radius: 999px; }
.loading { color: var(--soft); text-align: center; padding: 40px; }
