/* ============================================================
   一亿小精灵 · 文章详情页样式
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #060814;
  --surface: #0c1124;
  --surface-2: #111834;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #eef1ff;
  --text-2: #c9d0e8;
  --muted: #98a1bf;
  --gold: #ffc247;
  --gold-deep: #ff9f1a;
  --violet: #7c5cff;
  --green: #4ade80;
  --radius: 20px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, "Courier New", monospace;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60% 38% at 50% -8%, rgba(124, 92, 255, .22), transparent 70%),
    radial-gradient(40% 24% at 88% 8%, rgba(255, 194, 71, .10), transparent 70%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

::selection { background: rgba(255, 194, 71, .30); }

/* 阅读进度 */
.reading-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 100;
  background: rgba(255, 255, 255, .06);
}
.reading-bar i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--gold));
  box-shadow: 0 0 12px rgba(255, 194, 71, .55);
}

/* 头部 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 8, 20, .74);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 66px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 18px;
  background: linear-gradient(150deg, #ffe9a8, #ffb52e);
  box-shadow: 0 6px 16px -6px rgba(255, 170, 40, .7), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 14px; letter-spacing: .02em; }
.brand-text small { font-size: 10px; color: var(--muted); letter-spacing: .08em; }

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: 8px;
  font-size: 13px;
  color: var(--muted);
}
.nav a { transition: color .2s; }
.nav a:hover { color: var(--text); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.btn-soft,
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform .15s, background .2s, box-shadow .2s;
}
.btn-soft {
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  background: rgba(255, 255, 255, .04);
}
.btn-soft:hover { background: rgba(255, 255, 255, .09); }
.btn-gold {
  color: #2b1802;
  background: linear-gradient(160deg, #ffe9a8, #ffc247 55%, #ffab1f);
  box-shadow: 0 8px 20px -8px rgba(255, 170, 40, .8);
}
.btn-gold:hover { transform: translateY(-1px); }

/* 主体 */
.post-wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 38px 24px 0;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 22px;
}
.crumbs a { color: var(--muted); transition: color .2s; }
.crumbs a:hover { color: var(--gold); }
.crumbs span { opacity: .45; }

.post-head h1 {
  margin: 12px 0 0;
  font-size: clamp(1.75rem, 4.4vw, 2.6rem);
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -.005em;
  color: #fff;
  text-wrap: balance;
}
.post-badges {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--muted);
}
.cat {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 194, 71, .12);
  border: 1px solid rgba(255, 194, 71, .28);
  color: #ffd98a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
}
.dek {
  margin: 14px 0 0;
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--muted);
}

.byline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  background: linear-gradient(145deg, #dfd7ff, #a78bfa);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
  flex: none;
}
.avatar.lg { width: 48px; height: 48px; font-size: 22px; }
.by-name { display: flex; flex-direction: column; line-height: 1.3; }
.by-name { font-size: 12.5px; font-weight: 700; }
.by-name small { font-size: 10.5px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.by-meta { margin-left: auto; font-size: 11px; color: var(--muted); }

/* 封面 */
.post-cover {
  position: relative;
  display: grid;
  place-items: center;
  height: 250px;
  margin: 26px 0 0;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .10);
  background:
    radial-gradient(90% 100% at 50% 46%, rgba(6, 8, 20, .20), rgba(6, 8, 20, .64)),
    linear-gradient(135deg, var(--a), var(--b));
}
.post-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(80% 80% at 50% 50%, #000 20%, transparent 75%);
  mask-image: radial-gradient(80% 80% at 50% 50%, #000 20%, transparent 75%);
  pointer-events: none;
}
.cover-emoji {
  position: relative;
  z-index: 2;
  font-size: 78px;
  line-height: 1;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .45));
}
.cover-caption {
  position: absolute;
  left: 18px;
  bottom: 15px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(6, 8, 20, .55);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.cover-grid {
  position: absolute;
  width: 140px;
  height: 140px;
  border: 1px dashed rgba(255, 255, 255, .18);
  border-radius: 50%;
  z-index: 1;
}
.cover-grid::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px dashed rgba(255, 255, 255, .12);
  border-radius: 50%;
}

/* 正文 */
.post-body {
  margin-top: 30px;
  font-size: 17px;
  line-height: 1.95;
  color: var(--text-2);
  letter-spacing: .008em;
}
.post-body > p { margin: 18px 0; }
.post-body b { color: #fff; font-weight: 700; }
.post-body a { color: var(--gold); border-bottom: 1px dashed rgba(255, 194, 71, .45); }
.post-body h2 {
  position: relative;
  margin: 38px 0 14px;
  padding-left: 14px;
  font-size: 1.32rem;
  line-height: 1.45;
  color: #fff;
  font-weight: 800;
  letter-spacing: .01em;
}
.post-body h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: .28em;
  bottom: .22em;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(var(--gold), var(--gold-deep));
  box-shadow: 0 0 12px rgba(255, 180, 50, .4);
}
.post-body blockquote {
  margin: 26px 0;
  padding: 16px 18px;
  border-left: 3px solid var(--gold);
  border-radius: 0 14px 14px 0;
  background: linear-gradient(135deg, rgba(255, 194, 71, .08), rgba(124, 92, 255, .06));
  color: #e6e9fb;
  font-size: 15.5px;
  line-height: 1.8;
}
.post-body ul,
.post-body ol {
  margin: 18px 0;
  padding-left: 24px;
}
.post-body li { margin: 8px 0; }
.post-body li::marker { color: var(--gold); font-weight: 700; }
.post-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(124, 92, 255, .16);
  border: 1px solid rgba(124, 92, 255, .22);
  color: #ded9ff;
  font-family: var(--mono);
  font-size: .84em;
}
.post-body pre.code {
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #1e2549;
  background: #080c1a;
  overflow-x: auto;
  line-height: 1.8;
}
.post-body pre.code code {
  padding: 0;
  border: 0;
  background: none;
  color: #c9d3ff;
  font-size: 12.5px;
  white-space: pre;
}
.callout {
  position: relative;
  margin: 24px 0;
  padding: 14px 16px 14px 42px;
  border-radius: 14px;
  border: 1px solid rgba(255, 194, 71, .20);
  background: rgba(255, 194, 71, .07);
  font-size: 14px;
  line-height: 1.8;
  color: #ffeec4;
}
.callout::before {
  content: "💡";
  position: absolute;
  left: 15px;
  top: 13px;
  font-size: 15px;
}
.callout code {
  background: rgba(0, 0, 0, .25);
  border-color: rgba(255, 255, 255, .12);
  color: #ffe9a8;
}

/* 标签 / 操作 */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.post-tags span {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted);
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.like-btn, .share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.like-btn:hover, .share-btn:hover { background: rgba(255, 255, 255, .09); }
.like-btn:active, .share-btn:active { transform: scale(.97); }
.like-btn .heart { color: #ff6b81; font-size: 13px; }
.like-btn.liked {
  color: #ffd7de;
  border-color: rgba(255, 107, 129, .45);
  background: rgba(255, 107, 129, .14);
}
.like-btn b { font-weight: 800; color: #fff; }
.to-mini {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}
.to-mini:hover { text-decoration: underline; }

/* 作者卡 / 下一站 */
.author-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 30px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.author-card b { font-size: 13px; }
.author-card small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.author-card p { margin: 7px 0 0; font-size: 12px; line-height: 1.7; color: var(--muted); }

.next-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 194, 71, .28);
  background:
    radial-gradient(80% 160% at 0% 0%, rgba(255, 194, 71, .16), transparent 60%),
    linear-gradient(140deg, #171c3c, #0c1124);
  transition: transform .2s, border-color .2s;
}
.next-card:hover { transform: translateY(-2px); border-color: rgba(255, 194, 71, .55); }
.next-kicker {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 5px;
  background: rgba(255, 194, 71, .15);
  color: #ffd98a;
  font-size: 9.5px;
  letter-spacing: .08em;
}
.next-card b { display: block; margin-top: 7px; font-size: 14.5px; color: #fff; }
.next-card small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.next-arrow {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  background: linear-gradient(160deg, #ffe9a8, #ffb52e);
  color: #2b1802;
  font-weight: 800;
}

/* 相关 */
.related {
  width: 100%;
  max-width: 1160px;
  margin: 54px auto 0;
  padding: 0 24px;
}
.related-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.related-head h2 { margin: 0; font-size: 1.12rem; letter-spacing: .01em; }
.related-head a { font-size: 11.5px; color: var(--muted); }
.related-head a:hover { color: var(--gold); }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.related-card {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition: transform .2s, border-color .2s;
}
.related-card:hover { transform: translateY(-3px); border-color: rgba(255, 194, 71, .35); }
.related-card .r-emoji {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 20px;
  background: linear-gradient(145deg, var(--a, #7c5cff), var(--b, #ffb52e));
  margin-bottom: 12px;
}
.related-card .r-cat { font-size: 9.5px; letter-spacing: .08em; color: var(--gold); }
.related-card b { display: block; margin-top: 5px; font-size: 13px; line-height: 1.55; color: var(--text); }
.related-card small { display: block; margin-top: 6px; font-size: 10.5px; color: var(--muted); }

/* 算法推荐卡片 */
.rec-flag {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 6px;
  border: 1px solid rgba(124, 92, 255, .35);
  border-radius: 5px;
  background: rgba(124, 92, 255, .16);
  color: #c9c2ff;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  vertical-align: middle;
}

.rec-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition: transform .2s, border-color .2s;
}
.rec-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 194, 71, .35);
}
.rec-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.rec-cover {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  font-size: 18px;
  background: linear-gradient(145deg, var(--a, #7c5cff), var(--b, #ffb52e));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}

.rec-body { min-width: 0; flex: 1; }
.rec-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.rec-cat { font-size: 9px; letter-spacing: .04em; color: var(--gold); white-space: nowrap; }
.rec-index { font-size: 8.5px; color: #ffd98a; white-space: nowrap; }
.rec-body b {
  display: -webkit-box;
  margin-top: 4px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
  color: #eef1ff;
}
.rec-body small { display: block; margin-top: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 9px; color: var(--muted); }

.rec-skeleton {
  position: relative;
  height: 88px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .04);
}
.rec-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  animation: recShimmer 1.4s infinite;
}
@keyframes recShimmer { 100% { transform: translateX(100%); } }

.rec-empty { grid-column: 1 / -1; margin: 0; padding: 10px 0; font-size: 11px; color: var(--muted); }
.rec-empty a { color: var(--gold); border-bottom: 1px dashed rgba(255, 194, 71, .4); }

/* 页脚 */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: rgba(6, 8, 20, .6);
}
.site-footer .wrap { padding-top: 26px; padding-bottom: 28px; }
.foot-top {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.foot-top nav { display: flex; gap: 16px; margin-left: auto; }
.foot-top nav a:hover { color: var(--gold); }
.site-footer p { margin: 12px 0 0; font-size: 11px; color: #6f7896; line-height: 1.8; }
.site-footer .fine { font-size: 10px; color: #565f7c; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  max-width: 86vw;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(16, 20, 42, .95);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 11.5px;
  text-align: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 响应式 */
@media (max-width: 760px) {
  .nav { display: none; }
  .site-header .wrap { gap: 12px; min-height: 60px; }
  .header-actions .btn-soft { display: none; }
  .post-wrap { padding-top: 24px; }
  .post-cover { height: 190px; border-radius: 18px; }
  .cover-emoji { font-size: 58px; }
  .post-body { font-size: 16px; line-height: 1.9; }
  .by-meta { width: 100%; margin-left: 48px; margin-top: -6px; }
  .byline { flex-wrap: wrap; }
  .related-grid { grid-template-columns: 1fr; }
  .rec-card { padding: 12px; }
  .rec-cover { width: 38px; height: 38px; }
  .to-mini { margin-left: 0; width: 100%; padding-top: 6px; }
  .site-footer { margin-top: 46px; }
  .foot-top nav { margin-left: 0; width: 100%; }
}

@media (max-width: 380px) {
  .btn-gold { padding: 8px 12px; }
  .post-body { font-size: 15.5px; }
  .post-head h1 { font-size: 1.55rem; }
}

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