:root {
  color-scheme: light;
  --bg: #f4efe6;
  --bg-accent: #e8dfcf;
  --surface: #fffdf9;
  --surface-2: #f7f1e7;
  --ink: #1a1612;
  --muted: #6a6156;
  --faint: #8a8174;
  --line: rgba(36, 28, 18, 0.1);
  --line-strong: rgba(36, 28, 18, 0.16);
  --accent: #9a3a22;
  --seal: #a33b2b;
  --shadow: 0 1px 0 rgba(36, 28, 18, 0.04), 0 14px 36px rgba(70, 46, 22, 0.08);
  --shadow-hover: 0 1px 0 rgba(36, 28, 18, 0.05), 0 18px 44px rgba(70, 46, 22, 0.12);
  --chip: #efe7da;
  --chip-on: #1a1612;
  --chip-on-ink: #fffdf9;
  --danger: #9a3a22;
  --ok: #1f6a4d;
  --radius: 20px;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --tag-models: #9a3a22;
  --tag-agents: #5b3d8f;
  --tag-tools: #176455;
  --tag-ui: #b04d7a;
  --tag-components: #2f6f9f;
  --tag-industry: #2a4a78;
  --tag-opinions: #8a5a12;
  --tag-other: #6a6156;
  --filters-bg: color-mix(in srgb, var(--bg) 82%, transparent);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11100e;
  --bg-accent: #1f1b16;
  --surface: #1a1815;
  --surface-2: #221f1a;
  --ink: #f5f0e7;
  --muted: #b8ae9f;
  --faint: #908678;
  --line: rgba(245, 240, 231, 0.1);
  --line-strong: rgba(245, 240, 231, 0.16);
  --accent: #e8a28e;
  --seal: #e08a72;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 1px 0 rgba(255, 255, 255, 0.04), 0 20px 48px rgba(0, 0, 0, 0.5);
  --chip: #2a2621;
  --chip-on: #f5f0e7;
  --chip-on-ink: #171410;
  --danger: #f0a090;
  --ok: #9ddec0;
  --tag-models: #f0b2a2;
  --tag-agents: #c9b4ef;
  --tag-tools: #8ed0c0;
  --tag-ui: #f0b4cf;
  --tag-components: #9ec7ea;
  --tag-industry: #a9c4ee;
  --tag-opinions: #efcf8b;
  --tag-other: #cbbfae;
  --filters-bg: color-mix(in srgb, var(--bg) 88%, transparent);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  background:
    radial-gradient(920px 460px at 0% -8%, var(--bg-accent), transparent 58%),
    radial-gradient(720px 400px at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 52%),
    var(--bg);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.page {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

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

.brand {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
}

.brand-copy { min-width: 0; }

.seal {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  margin-top: 6px;
  display: grid;
  place-items: center;
  border: 2px solid var(--seal);
  color: var(--seal);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  transform: rotate(-7deg);
  background: color-mix(in srgb, var(--seal) 9%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--seal) 18%, transparent);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: none;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: 0; }

h1 {
  margin: 0;
  font-size: clamp(30px, 5.6vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.lede, .summary, .foot p, .hint { color: var(--muted); }
.lede { margin: 10px 0 0; max-width: 40em; font-size: 15.5px; }

.ghost, .solid, .danger {
  border-radius: 999px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.ghost:hover, .solid:hover, .danger:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.theme-btn { flex: 0 0 auto; }

.solid {
  background: var(--chip-on);
  color: var(--chip-on-ink);
  border-color: transparent;
}

.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.filters-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 26px -8px 0;
  padding: 10px 8px 8px;
  background: linear-gradient(180deg, var(--filters-bg), color-mix(in srgb, var(--bg) 70%, transparent));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

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

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

.chip[aria-pressed="true"] {
  background: var(--chip-on);
  color: var(--chip-on-ink);
  border-color: transparent;
}

.summary {
  min-height: 1.4em;
  margin: 10px 0 18px;
  font-size: 14.5px;
}

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
  align-items: stretch;
}

.feed > .state-empty {
  grid-column: 1 / -1;
}

.card, .panel, .state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
  height: 100%;
  padding: 18px 18px 16px;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

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

.card-top, .author-row, .admin-row, .split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  --tag: var(--tag-other);
  color: var(--tag);
  border: 1px solid color-mix(in srgb, var(--tag) 38%, transparent);
  background: color-mix(in srgb, var(--tag) 12%, transparent);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11.5px;
  line-height: 1.45;
  letter-spacing: 0.02em;
}

.tag[data-slug="models"] { --tag: var(--tag-models); }
.tag[data-slug="agents"] { --tag: var(--tag-agents); }
.tag[data-slug="tools"] { --tag: var(--tag-tools); }
.tag[data-slug="ui"] { --tag: var(--tag-ui); }
.tag[data-slug="components"] { --tag: var(--tag-components); }
.tag[data-slug="industry"] { --tag: var(--tag-industry); }
.tag[data-slug="opinions"] { --tag: var(--tag-opinions); }
.tag[data-slug="other"] { --tag: var(--tag-other); }

.when {
  color: var(--faint);
  font-size: 12.5px;
  white-space: nowrap;
}

.summary-body {
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
}

.original-block {
  margin-top: 10px;
}

.original-toggle {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  min-height: auto;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.original-toggle:hover { text-decoration: underline; }

.original-body {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.body {
  margin: 0;
  color: color-mix(in srgb, var(--ink) 88%, var(--muted));
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15.5px;
}

.note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  color: var(--muted);
  font-size: 14px;
}

.note span {
  display: inline-block;
  margin-right: 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.author-row {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.who { display: flex; align-items: center; gap: 10px; min-width: 0; }

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 16px;
}

.who p { margin: 0; min-width: 0; }
.who strong { display: block; font-weight: 600; font-size: 14.5px; }
.who em { color: var(--faint); font-style: normal; font-size: 12.5px; }

.open {
  flex: 0 0 auto;
  text-decoration: none;
  font-size: 13.5px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.open:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
}

.more { display: flex; justify-content: center; margin-top: 22px; }

.state { padding: 36px 22px; text-align: center; }
.state h2 { margin: 0 0 8px; font-size: 26px; }
.state p { margin: 0; color: var(--muted); }
.state button { margin-top: 16px; }

.skeleton {
  height: 168px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--chip), var(--surface), var(--chip));
  background-size: 200% 100%;
  animation: sheen 1.2s ease infinite;
}

@keyframes sheen {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.foot p { margin: 0; }
.foot a { text-decoration: none; }

.stack { display: grid; gap: 14px; margin-top: 22px; }
.panel { padding: 16px; }
.panel h2 { margin: 0 0 6px; font-size: 24px; }
.hint { margin: 0 0 12px; }

label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }

input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}

.actions, .inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.grow { flex: 1 1 180px; }
.status { min-height: 1.4em; margin: 8px 0 0; color: var(--ok); }
.status[data-kind="error"] { color: var(--danger); }

.admin-card { padding: 12px 0; border-top: 1px solid var(--line); }
.admin-card:first-child { border-top: 0; padding-top: 0; }
.admin-card p { margin: 6px 0; }
.back { font-size: 14px; text-decoration: none; }

@media (min-width: 720px) {
  .page { width: min(1320px, calc(100% - 48px)); padding-top: 44px; }
  .filters { flex-wrap: wrap; overflow: visible; }
  .card { padding: 20px 18px 16px; }
  .feed { gap: 18px; }
}

@media (min-width: 1100px) {
  .page { width: min(1360px, calc(100% - 64px)); }
  .feed { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
}

@media (max-width: 560px) {
  .page { width: calc(100% - 24px); }
  .top { align-items: stretch; }
  .card { min-height: 0; }
  .card-top, .author-row, .split { align-items: flex-start; flex-direction: column; }
  .when { white-space: normal; }
  .filters-wrap { margin-left: -4px; margin-right: -4px; }
  .feed { grid-template-columns: 1fr; gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .card, .ghost, .solid, .chip, .open { transition: none; }
  html { scroll-behavior: auto; }
}


.card-top { margin-bottom: 10px; }
.card .tags { margin-bottom: 2px; }
.card-top .who strong { font-size: 15px; }
.card-top .avatar { width: 40px; height: 40px; }
.author-row {
  justify-content: space-between;
}


/* Grid card polish */
.card .summary-body {
  -webkit-line-clamp: 4;
  line-clamp: 4;
  flex: 1 1 auto;
}
.card .original-block { margin-top: 8px; }
.card .author-row { margin-top: auto; }
.skeleton { min-height: 220px; height: auto; }
