:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --ink: #16171a;
  --muted: #6c727f;
  --soft: rgba(255, 255, 255, 0.72);
  --solid: #ffffff;
  --line: rgba(22, 23, 26, 0.12);
  --blue: #007aff;
  --green: #34c759;
  --red: #ff2d55;
  --shadow: 0 22px 70px rgba(31, 35, 41, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(235, 249, 244, 0.92), rgba(244, 247, 255, 0.86) 42%, rgba(255, 246, 250, 0.86)),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 5vw, 4.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 251, 0.74);
  backdrop-filter: blur(24px) saturate(1.25);
}

.home-link,
.search,
.tagbar {
  display: flex;
  align-items: center;
}

.home-link {
  gap: 0.65rem;
  min-width: 0;
}

.home-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border-radius: 8px;
  background: #17181b;
  color: #fff;
  font-weight: 800;
}

.source-label {
  max-width: 14rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.7rem 0 4rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 28rem);
  gap: 1.25rem;
  align-items: end;
  min-height: 12rem;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 36rem;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.search {
  gap: 0.55rem;
  min-height: 3.15rem;
  padding: 0 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.search span {
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.tagbar {
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.25rem 0;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.35rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  box-shadow: 0 10px 32px rgba(31, 35, 41, 0.06);
  backdrop-filter: blur(20px);
}

.tag-chip span {
  color: rgba(108, 114, 127, 0.78);
  font-size: 0.82rem;
}

.tag-chip.active {
  background: #17181b;
  color: #fff;
}

.tag-chip.active span {
  color: rgba(255, 255, 255, 0.72);
}

.content {
  min-height: 20rem;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.post-card {
  position: relative;
  display: flex;
  min-height: 17.5rem;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.58)),
    var(--solid);
  box-shadow: var(--shadow);
  isolation: isolate;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 80px rgba(31, 35, 41, 0.14);
}

.card-glow {
  position: absolute;
  inset: auto -18% -34% 30%;
  z-index: -1;
  height: 9rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), transparent 68%);
  filter: blur(34px);
}

.card-top,
.card-bottom,
.meta,
.section-head,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.card-top,
.card-bottom,
.meta,
.muted,
.empty-note {
  color: var(--muted);
}

.card-top,
.card-bottom {
  justify-content: space-between;
  font-size: 0.86rem;
}

.date-pill,
.source-file {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(22, 23, 26, 0.09);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
}

.source-file {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-card h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.18;
}

.post-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.55rem;
  padding: 0 0.9rem;
  border: 1px solid rgba(22, 23, 26, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  cursor: pointer;
}

.button:hover {
  border-color: color-mix(in srgb, var(--blue), transparent 55%);
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button.ghost {
  background: transparent;
}

.button.liked {
  border-color: color-mix(in srgb, var(--red), transparent 45%);
  color: var(--red);
}

.empty-state {
  display: grid;
  min-height: 18rem;
  place-items: center;
  gap: 0.8rem;
  padding: 2rem;
  border: 1px dashed rgba(22, 23, 26, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  color: var(--ink);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.notice {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 149, 0, 0.28);
  border-radius: 8px;
  background: rgba(255, 249, 235, 0.78);
  color: #8a5a00;
  line-height: 1.7;
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18.5rem;
  gap: 1rem;
  align-items: start;
}

.reader,
.inspector,
.comments {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.reader {
  position: relative;
  overflow: hidden;
  padding: clamp(1.2rem, 4vw, 2.5rem);
}

.reader::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.36rem;
  background: var(--accent);
}

.back-link {
  display: inline-flex;
  margin-bottom: 1.4rem;
  color: var(--blue);
  font-weight: 700;
}

.reader h2 {
  margin: 0.55rem 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.summary {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.article-body {
  margin-top: 2rem;
  line-height: 1.85;
}

.article-body h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.38rem;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body pre {
  margin: 0.9rem 0;
}

.article-body code,
.article-body pre {
  border-radius: 8px;
  background: #1f2328;
  color: #f6f8fa;
}

.article-body code {
  padding: 0.14rem 0.34rem;
}

.article-body pre {
  overflow-x: auto;
  padding: 1rem;
}

.article-body pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 0.92rem;
  line-height: 1.72;
}

.article-body img {
  display: block;
  width: 100%;
  max-height: 30rem;
  object-fit: cover;
  border: 1px solid rgba(22, 23, 26, 0.1);
  border-radius: 8px;
}

.inspector {
  position: sticky;
  top: 5.4rem;
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.inspector h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.stats-panel span {
  display: grid;
  min-height: 3.4rem;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.download-list {
  display: grid;
  gap: 0.55rem;
}

.download-button {
  justify-content: flex-start;
}

.download-button span {
  display: inline-grid;
  min-width: 2.3rem;
  place-items: center;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 700;
}

.comments {
  grid-column: 1 / -1;
  padding: clamp(1rem, 3vw, 1.5rem);
}

.section-head {
  justify-content: space-between;
}

.section-head h3 {
  margin: 0;
  font-size: 1.12rem;
}

.section-head span {
  color: var(--muted);
}

.comment-form {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0 1.2rem;
}

.field {
  width: 100%;
  min-height: 2.85rem;
  padding: 0.8rem;
  border: 1px solid rgba(22, 23, 26, 0.12);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.76);
}

textarea.field {
  min-height: 7.5rem;
  resize: vertical;
}

.comment-list {
  display: grid;
  gap: 0.7rem;
}

.comment {
  padding: 0.85rem;
  border: 1px solid rgba(22, 23, 26, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.comment p {
  margin: 0.45rem 0 0;
  line-height: 1.7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(16, 17, 20, 0.32);
  backdrop-filter: blur(10px);
}

.modal {
  width: min(24rem, 100%);
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 0.45rem;
}

.modal input {
  width: 100%;
  min-height: 2.85rem;
  margin: 0.5rem 0 1rem;
  padding: 0 0.75rem;
  border: 1px solid rgba(22, 23, 26, 0.12);
  border-radius: 8px;
}

@media (max-width: 900px) {
  .topbar,
  .hero,
  .reader-layout {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inspector {
    position: static;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 1rem, 1120px);
    padding-top: 1rem;
  }

  .source-label {
    max-width: 100%;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    font-size: 2.55rem;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-card {
    min-height: 15.5rem;
  }

  .stats-panel {
    grid-template-columns: 1fr;
  }
}
