:root {
  --ink: #171717;
  --muted: #6b7280;
  --line: #e8eaed;
  --bg: #f5f6f8;
  --card: #fff;
  --blue: #2563eb;
  --pink: #ec4899;
  --purple: #8b5cf6;
  --orange: #f97316;
  --green: #10b981;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font: 15px/1.7 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.page { min-height: 100vh; }

/* —— 顶栏 —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 60px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, #60a5fa, #a78bfa 45%, #f472b6);
  flex-shrink: 0;
}

.logo strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.logo small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.pill-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.pill:hover,
.pill:focus-visible {
  filter: brightness(1.08);
}

.pill.is-active { background: #334155; }
.pill-pink { background: linear-gradient(135deg, #f43f5e, #ec4899); }
.pill-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.pill-orange { background: linear-gradient(135deg, #ea580c, #fb923c); }
.pill-green { background: linear-gradient(135deg, #059669, #34d399); }

/* —— 内容壳 —— */
.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.banner {
  margin-bottom: 14px;
}

.banner-art {
  position: relative;
  border-radius: 18px;
  min-height: clamp(240px, 48vw, 420px);
  overflow: hidden;
  background:
    radial-gradient(800px 240px at 15% 20%, rgba(255, 255, 255, 0.18), transparent 55%),
    radial-gradient(500px 260px at 85% 70%, rgba(236, 72, 153, 0.35), transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 42%, #7c3aed 78%, #f472b6 100%);
  box-shadow: var(--shadow);
}

.banner-slides {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.banner-slides .slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease;
}

.banner-slides .slide.is-active {
  opacity: 1;
}

.banner-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 0 0 2px;
}

.banner-nav:hover,
.banner-nav:focus-visible {
  background: rgba(255, 255, 255, 0.32);
  outline: none;
}

.banner-prev { left: 12px; }
.banner-next { right: 12px; }

.banner-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.08) 40.5%, transparent 41%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.05) 50%);
  pointer-events: none;
}

.banner-copy {
  position: relative;
  z-index: 2;
  padding: clamp(24px, 5vw, 48px);
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.banner-copy p {
  margin: 0 0 10px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  opacity: 0.85;
}

.banner-copy h1 {
  margin: 0;
  font: 500 clamp(32px, 7vw, 52px)/1.12 Georgia, "Songti SC", serif;
}

/* 功能卡 */
.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 18px;
}

.feature-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.feature-card:hover,
.feature-card:focus-visible {
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
}

.feature-card strong {
  display: block;
  font-size: 14px;
}

.feature-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 14px;
}

.fi-1 { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.fi-2 { background: linear-gradient(135deg, #8b5cf6, #c4b5fd); }
.fi-3 { background: linear-gradient(135deg, #f97316, #fdba74); }
.fi-4 { background: linear-gradient(135deg, #10b981, #6ee7b7); }

.lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

/* 筛选 */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: 13px "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  cursor: pointer;
}

.filter.is-active {
  background: #111;
  border-color: #111;
  color: #fff;
}

/* 作品列表 */
.list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 0;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  position: relative;
}

.card:active { transform: scale(0.995); }

.cover {
  height: 140px;
  overflow: hidden;
  background: #e5e7eb;
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 140px;
  background: #1f2937;
  color: #d1d5db;
  font-size: 12px;
  text-align: center;
  padding: 12px;
}

.info { padding: 12px 14px 14px; }

.info h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.info .card-desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.info .card-time {
  margin: 6px 0 0;
  color: #9ca3af;
  font-size: 11px;
  font-family: ui-monospace, Consolas, monospace;
}

.card-play {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  pointer-events: none;
}

.empty-panel {
  border: 1px dashed #d1d5db;
  border-radius: var(--radius);
  background: #fff;
  padding: 36px 16px;
  text-align: center;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}

.empty-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* 关于 / 联系面板 */
.panel {
  margin-top: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

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

.mail-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.mail-btn:hover,
.mail-btn:focus-visible {
  background: var(--blue);
}

.site-foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px calc(24px + var(--safe-b));
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.site-foot a:hover { color: var(--blue); }

/* —— 详情层 —— */
.sheet[hidden] { display: none; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  overflow: auto;
  background: var(--bg);
  border-radius: 16px 16px 0 0;
  padding-bottom: calc(16px + var(--safe-b));
}

.sheet-panel.media-only .sheet-body {
  display: none !important;
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
}

.sheet-media {
  background: #0a0a0a;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.sheet-media.is-empty { display: none; }

.viewer { background: #0a0a0a; }

.viewer-main,
.viewer-video {
  display: block;
  width: 100%;
  max-height: min(56vh, 420px);
  object-fit: contain;
  background: #0a0a0a;
  margin: 0 auto;
}

.video-viewer {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 12px 12px;
  background: #0a0a0a;
}

.thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #222;
}

.thumb.is-active { border-color: #60a5fa; }

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sheet-body { padding: 16px 18px; }

.sheet-body h2 {
  margin: 6px 0 8px;
  font-size: 22px;
}

.sheet-body p {
  margin: 0 0 10px;
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

.c1 { background: linear-gradient(145deg, #2563eb, #67e8f9); }
.c2 { background: linear-gradient(160deg, #7c3aed, #111); }
.c3 { background: linear-gradient(145deg, #0f766e, #ecfeff); }
.c4 { background: linear-gradient(145deg, #f59e0b, #7c2d12); }
.c5 { background: linear-gradient(145deg, #111, #334155); }
.c6 { background: linear-gradient(145deg, #fb7185, #111); }

/* —— 博客页 —— */
.top {
  padding: 28px 16px 8px;
  max-width: 720px;
  margin: 0 auto;
}

.top h1 {
  margin: 0;
  font: 500 32px/1.2 Georgia, "Songti SC", serif;
}

.top p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 8px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--blue);
}

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

.back {
  color: var(--muted);
  font-size: 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.back:hover { color: var(--blue); }

body > main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

body > footer:not(.site-foot) {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 16px 16px calc(24px + var(--safe-b));
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
}

.post-card .info h3 { margin-top: 2px; }

.post-card .summary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.post-card .info .mono { margin: 0 0 4px; }

#post-content {
  color: var(--muted);
  line-height: 1.75;
}

#post-content p { margin: 0 0 12px; }

#post-content ul,
#post-content ol {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

#post-content code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  color: var(--ink);
}

@media (min-width: 768px) {
  .feature-row {
    grid-template-columns: repeat(4, 1fr);
  }

  .list {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .cover { height: 150px; }

  .sheet-panel {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: min(640px, calc(100% - 40px));
    border-radius: 16px;
    transform: translate(-50%, -50%);
  }

  .sheet-media { border-radius: 16px 16px 0 0; }

  .viewer-main,
  .viewer-video {
    max-height: min(52vh, 400px);
  }

  .list:has(.post-card) {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
}
