:root {
  --canvas: #fefbf2;
  --surface: #ffffff;
  --surface-hover: #fff6ea;
  --line: #efe4d6;
  --ink: #2b2118;
  --muted: #8a7464;
  --accent: #5b2468;
  --accent-dim: rgba(91, 36, 104, 0.10);
  --peach: #ffe8d6;
  --shadow: 0 1px 2px rgba(43, 33, 24, 0.04), 0 6px 20px rgba(91, 36, 104, 0.05);
  --radius: 14px;
  --col: 720px;
  --spring: 220ms cubic-bezier(0.34, 1.2, 0.64, 1);
  --font: "Noto Sans SC", "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--canvas) 92%, #fff);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topnav-inner {
  max-width: var(--col);
  margin: 0 auto;
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink);
  flex-shrink: 0;
}
.tabs {
  display: flex;
  gap: 4px;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tab {
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  padding: 0 12px;
  height: 100%;
  cursor: pointer;
  position: relative;
  border-radius: 0;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

main {
  max-width: var(--col);
  margin: 0 auto;
  padding: 20px 20px 64px;
}

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

.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background var(--spring), border-color 120ms ease-out;
}
.item:hover { background: var(--surface-hover); }
.item.is-open {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  box-shadow: var(--shadow), 0 0 0 3px var(--accent-dim);
}

.item-head {
  width: 100%;
  text-align: left;
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: start;
}
.item-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  grid-column: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item.is-open .item-title {
  white-space: normal;
}
.chev {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 28px;
  height: 28px;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: transform var(--spring), color 120ms ease-out;
}
.item.is-open .chev {
  transform: rotate(180deg);
  color: var(--accent);
}
.chev svg { width: 16px; height: 16px; }

.item-meta {
  grid-column: 1;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.item-meta .dot { opacity: 0.45; }

.item-summary {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item.is-open .item-summary { -webkit-line-clamp: unset; }

.item-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}
.item.is-open .item-body { display: block; }

.action-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 550;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 9999px;
}

.md {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.md > :first-child { margin-top: 12px; }
.md h1, .md h2, .md h3, .md h4 {
  font-size: 14px;
  font-weight: 650;
  margin: 16px 0 8px;
}
.md ul, .md ol { padding-left: 1.25em; margin: 8px 0; }
.md li { margin: 4px 0; }
.md p { margin: 8px 0; }
.md a { color: var(--accent); }
.md table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 10px 0;
  display: block;
  overflow-x: auto;
}
.md th, .md td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  white-space: nowrap;
}
.md th {
  background: color-mix(in srgb, var(--peach) 55%, #fff);
  font-weight: 600;
}
.md code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: color-mix(in srgb, var(--peach) 40%, #fff);
  padding: 1px 5px;
  border-radius: 4px;
}
.md pre {
  background: #2b2118;
  color: #fefbf2;
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
}
.md pre code { background: none; color: inherit; padding: 0; }
.md blockquote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.empty {
  margin-top: 48px;
  padding: 36px 24px;
  text-align: center;
  background: var(--peach);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 550;
}

.panel[hidden] { display: none !important; }

.loading {
  margin-top: 48px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 480px) {
  .topnav-inner { padding: 0 14px; gap: 16px; }
  .tab { padding: 0 10px; font-size: 13px; }
  main { padding: 14px 14px 48px; }
  .item-head { padding: 12px 14px; }
  .item-body { padding: 0 14px 14px; }
}

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