:root {
  --paper: #f4efe3;
  --paper-deep: #ebe3d2;
  --card: #fffdf7;
  --ink: #24251f;
  --ink-soft: #4d4c42;
  --muted: #7b7668;
  --line: #ded4c0;
  --line-soft: #ebe3d2;
  --accent: #9c3b2b;
  --worth: #2f6b4f;
  --maybe: #a9791c;
  --no: #a8442f;
  --worth-soft: #e3eee6;
  --maybe-soft: #f6ecd6;
  --no-soft: #f6e3dd;
  --shadow: 0 1px 0 rgba(36, 37, 31, .04), 0 10px 26px -18px rgba(36, 37, 31, .5);
  --radius: 14px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "STSong", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16150f;
    --paper-deep: #1d1c14;
    --card: #211f17;
    --ink: #eee7d7;
    --ink-soft: #cfc7b4;
    --muted: #a29a86;
    --line: #3a362a;
    --line-soft: #2c2a20;
    --accent: #e0806a;
    --worth: #7cc39c;
    --maybe: #e0b45f;
    --no: #e78f79;
    --worth-soft: #22322a;
    --maybe-soft: #332a19;
    --no-soft: #35231e;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 30px -22px #000;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(156, 59, 43, .06), transparent 42%),
    radial-gradient(circle at 88% 4%, rgba(47, 107, 79, .07), transparent 38%);
}

.wrap {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.stamp-logo {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--accent);
  border-radius: 5px;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1;
  transform: rotate(-3deg);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--accent);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: .18em;
  line-height: 1.25;
  font-weight: 600;
}
.brand-text small {
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--muted);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-stats {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  flex: none;
}
.topbar-stats span {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- hero ---------- */

.hero { padding: 34px 0 22px; }

.hero h1 {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.28;
  letter-spacing: .01em;
}

.hero p {
  margin: 0;
  max-width: 40em;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.75;
}

/* ---------- composer ---------- */

.composer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}

.composer::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(var(--accent), transparent 78%);
  opacity: .7;
}

.composer-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.composer-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .04em;
}

.composer-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
.field-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.field-grow { flex: 1 1 200px; }
.field-price { flex: 0 1 128px; min-width: 108px; }

.field label {
  font-size: 12.5px;
  letter-spacing: .04em;
  color: var(--muted);
}
.opt { color: var(--muted); opacity: .72; font-size: 11px; }

.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 62px; line-height: 1.65; }
.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: .78; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.price-input { display: flex; align-items: center; gap: 6px; }
.price-input span { color: var(--muted); font-size: 14px; }
.price-input input { padding-left: 8px; }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.form-msg { margin: 0; font-size: 12.5px; color: var(--muted); min-height: 1.5em; flex: 1; }
.form-msg.is-error { color: var(--no); }
.form-msg.is-ok { color: var(--worth); }

.btn {
  font: inherit;
  font-size: 14.5px;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 11px 22px;
  min-height: 44px;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--accent); color: #fffaf3; font-weight: 600; letter-spacing: .04em; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #1a1108; } }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-primary[disabled] { opacity: .55; cursor: default; }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
  font-size: 13.5px;
  padding: 9px 16px;
  min-height: 40px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- board ---------- */

.board { padding: 30px 0 10px; }

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.board-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .05em;
}

.sorts { display: flex; gap: 4px; padding: 3px; background: var(--paper-deep); border-radius: 999px; }
.sort-btn {
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  min-height: 34px;
}
.sort-btn.is-active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 15px;
  margin-bottom: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.6;
}
.banner.is-shown { display: flex; }
.banner-text { min-width: 0; }
.banner-text strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  letter-spacing: .02em;
}
.banner-text p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }

.feed { display: flex; flex-direction: column; gap: 16px; }

.skeleton-card {
  height: 190px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--card) 20%, var(--paper-deep) 40%, var(--card) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 22px;
  text-align: center;
  background: color-mix(in srgb, var(--card) 60%, transparent);
}
.empty h3 { margin: 0 0 8px; font-family: var(--font-serif); font-size: 18px; font-weight: 600; }
.empty p { margin: 0 auto; max-width: 26em; color: var(--muted); font-size: 13.5px; }

/* ---------- card ---------- */

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 14px;
}
.card.is-fresh { animation: pop .5s ease; }
@keyframes pop {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: none; }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title-block { min-width: 0; }

.card-title {
  margin: 0;
  font-size: 18.5px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: .01em;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}

.price-chip {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 5px;
  padding: 2px 8px;
  letter-spacing: .02em;
}

.mine-tag { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 4px; padding: 1px 6px; font-size: 11px; }

.verdict {
  flex: none;
  font-family: var(--font-serif);
  font-size: 12.5px;
  letter-spacing: .16em;
  padding: 5px 9px;
  border: 1.5px solid var(--muted);
  border-radius: 4px;
  color: var(--muted);
  transform: rotate(2deg);
  white-space: nowrap;
  margin-top: 2px;
}
.verdict[data-tone="worth"] { color: var(--worth); border-color: var(--worth); }
.verdict[data-tone="maybe"] { color: var(--maybe); border-color: var(--maybe); }
.verdict[data-tone="no"] { color: var(--no); border-color: var(--no); }
.verdict[data-tone="split"] { color: var(--accent); border-style: dashed; border-color: var(--accent); }

.card-reason {
  margin: 14px 0 0;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink);
}
.card-doubt {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}
.card-doubt b { color: var(--ink-soft); font-weight: 600; margin-right: 4px; }

/* vote area */

.vote-block { margin-top: 16px; }

.bar {
  display: flex;
  height: 7px;
  border-radius: 99px;
  background: var(--line-soft);
  overflow: hidden;
  gap: 2px;
}
.bar span { display: block; height: 100%; transition: width .45s ease; }
.bar .seg-worth { background: var(--worth); }
.bar .seg-maybe { background: var(--maybe); }
.bar .seg-no { background: var(--no); }

.vote-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.vote-btn {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 4px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.vote-btn .v-label { font-size: 13px; letter-spacing: .03em; }
.vote-btn .v-count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vote-btn:hover { border-color: var(--muted); }
.vote-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vote-btn[aria-pressed="true"] { font-weight: 600; }
.vote-btn[aria-pressed="true"] .v-count { color: inherit; opacity: .85; }

.vote-btn[data-choice="worth"][aria-pressed="true"] { background: var(--worth-soft); border-color: var(--worth); color: var(--worth); }
.vote-btn[data-choice="maybe"][aria-pressed="true"] { background: var(--maybe-soft); border-color: var(--maybe); color: var(--maybe); }
.vote-btn[data-choice="no"][aria-pressed="true"] { background: var(--no-soft); border-color: var(--no); color: var(--no); }

.vote-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.vote-foot .vote-hint { min-width: 0; }

.toggle-comments {
  font: inherit;
  font-size: 12.5px;
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
}
.toggle-comments .chev { transition: transform .2s ease; font-size: 10px; }
.toggle-comments[aria-expanded="true"] .chev { transform: rotate(180deg); }
.toggle-comments:hover { color: var(--accent); }
.toggle-comments:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* comments */

.comments { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 12px; }
.comments[hidden] { display: none; }

.comment-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comments-empty { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.comment {
  display: flex;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.65;
}
.avatar {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-family: var(--font-serif);
  color: var(--card);
  background: var(--ink-soft);
  margin-top: 2px;
}
.comment-body { min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-name { font-weight: 600; font-size: 12.5px; color: var(--ink); }
.comment-time { font-size: 11px; color: var(--muted); }
.comment-text { margin: 2px 0 0; color: var(--ink-soft); white-space: pre-wrap; }

.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form .row { display: flex; gap: 8px; align-items: flex-start; }
.comment-form input,
.comment-form textarea {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
.comment-form input { flex: 0 1 132px; min-width: 96px; }
.comment-form textarea { flex: 1 1 auto; min-width: 0; resize: vertical; min-height: 40px; line-height: 1.6; }
.comment-form input:focus,
.comment-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.comment-form .send-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comment-msg { font-size: 12px; color: var(--muted); margin: 0; }
.comment-msg.is-error { color: var(--no); }
.btn-small { padding: 9px 18px; min-height: 40px; font-size: 13.5px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: min(90vw, 420px);
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */

.foot {
  margin-top: 34px;
  padding: 22px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.foot p { margin: 0; }
.foot-mark { margin-top: 8px !important; font-family: var(--font-serif); letter-spacing: .08em; }

/* ---------- small screens ---------- */

@media (max-width: 520px) {
  .wrap { padding: 0 15px; }
  .hero { padding: 24px 0 18px; }
  .composer { padding: 16px 14px 14px; }
  .composer-hint { display: none; }
  .card { padding: 16px 14px 12px; }
  .card-title { font-size: 17.5px; }
  .field-price { flex: 1 1 118px; }
  .composer-foot { flex-direction: column-reverse; align-items: stretch; }
  .composer-foot .btn-primary { width: 100%; }
  .form-msg { min-height: 0; }
  .topbar-stats span:last-child { display: none; }
  .vote-row { gap: 6px; }
  .vote-btn { padding: 8px 2px; }
  .vote-btn .v-label { font-size: 12.5px; }
  .comment-form .row { flex-wrap: wrap; }
  .comment-form input { flex: 1 1 120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
