
/* 首页顶栏常驻（文章页随页面滚走，见 base.css） */
.topbar { position: fixed; }
/* ---- 背景：地平线一层淡淡的群系色，向上融进页面底色 ---- */
.js body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, color-mix(in srgb, var(--tint) 32%, transparent) 100%);
  pointer-events: none;
}
/* 大屏：卡片和快捷栏按 --ui（world.ts 按屏幕尺寸算，1440x900 为 1）整体放大，和变粗的像素世界相称 */
.js .panel > * { zoom: var(--ui, 1); }
#sky {
  position: fixed; inset: 0; display: none; pointer-events: none;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.js #sky { display: block; }
#world, #hero {
  position: fixed;
  inset: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: none;
  /* 像素世界自下而上淡出 */
  -webkit-mask-image: linear-gradient(to bottom, transparent 38%, rgb(0 0 0 / 0.12) 52%, rgb(0 0 0 / 0.55) 66%, #000 82%);
  mask-image: linear-gradient(to bottom, transparent 38%, rgb(0 0 0 / 0.12) 52%, rgb(0 0 0 / 0.55) 66%, #000 82%);
  filter: var(--world-filter);
  transition: filter 0.3s;
}
.js #world, .js #hero { display: block; }
#hero { pointer-events: none; }
.js #world, .js #hero { will-change: transform, translate; }
html.js { scroll-snap-type: y mandatory; scroll-behavior: smooth; overscroll-behavior-x: none; }
@media (prefers-reduced-motion: reduce) { html.js { scroll-behavior: auto; } body, #world, #hero { transition: none; } }

/* ---- 每屏 ---- */
.stage { min-height: 100vh; min-height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; padding: 72px 16px 24px; }
.js .stage { height: 100vh; height: 100dvh; padding: 0; }

.panel { max-width: 760px; margin: 0 auto 28px; }
.js .panel {
  position: fixed; z-index: 2;
  top: 72px; bottom: var(--stage);
  --pw: min(calc(760px * var(--ui, 1)), calc(100vw - 32px));
  left: 50%; width: var(--pw); max-width: none; margin-left: calc(var(--pw) / -2);
  display: flex; flex-direction: column; justify-content: flex-end;
  will-change: transform, opacity;
}

/* 起点 */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.avatar {
  width: 104px; height: 104px; border-radius: 26px; padding: 6px; background: var(--surface);
  box-shadow: 6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light);
  image-rendering: auto;
}
.hero-name { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: 0.2px; }
.hero-tag { margin: 0 0 10px; color: var(--muted); font-family: var(--mono); font-size: 14px; }
.hero-meta { margin: 0; font-size: 13px; color: var(--muted); }
.hint { grid-column: 1 / -1; margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.hint span[aria-hidden] { display: inline-block; color: var(--accent); animation: bob 1.4s ease-in-out infinite; }
.hint-keys { font-size: 12px; opacity: 0.8; }
@keyframes bob { 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .hint span[aria-hidden] { animation: none; } }

/* 博文：悬停时「按下去」 */
.post-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; }
.post-list a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; text-decoration: none;
  padding: 10px 14px; border-radius: 14px; transition: box-shadow 0.15s;
}
.post-list a:hover, .post-list a:focus-visible { box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light); }
.post-list a:hover .post-title { color: var(--accent); }
.post-title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 0.15s; }
.post-meta { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pin { color: var(--accent); background: var(--accent-soft); font-size: 11px; padding: 2px 7px; border-radius: 6px; margin-right: 8px; }
.more { margin: 0; }

/* 工具 / 友链：小凸块 */
.grid { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.slot-link {
  display: flex; gap: 12px; align-items: center; height: 100%; text-decoration: none;
  padding: 12px 14px; border-radius: 16px; background: var(--surface);
  box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light);
  transition: box-shadow 0.15s;
}
.slot-link:hover { box-shadow: 2px 2px 6px var(--sh-dark), -2px -2px 6px var(--sh-light); }
.slot-link:hover .item-name { color: var(--accent); }
.slot-link:active { box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light); }
.slot-link img, .noicon { width: 36px; height: 36px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface-lo); }
.noicon { display: grid; place-items: center; font-weight: 700; color: var(--accent); }
.item-name { display: block; font-weight: 600; transition: color 0.15s; }
.item-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

/* 服务器：凹槽数据格 */
.server-desc { margin: 0 0 16px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 0 0 14px; }
.stats div { padding: 12px 14px; border-radius: 16px; box-shadow: inset 4px 4px 10px var(--sh-dark), inset -4px -4px 10px var(--sh-light); }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 6px 0 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-online='1'] .stats dd[data-k='state'] { color: var(--accent); }
[data-online='0'] .stats dd[data-k='state'] { color: #d9534f; }
.server-foot { margin: 0; font-size: 12px; color: var(--muted); }

.about p { margin: 0 0 12px; }
.about p:not(.hero-name):not(.more) { color: var(--muted); }

/* ---- 底部板块切换：凸起底座，当前项按下 ---- */
.hotbar { display: none; }
.js .hotbar {
  position: fixed; z-index: 3; left: 50%; transform: translateX(-50%);
  bottom: max(10px, calc(var(--ground) / 2 - 26px));
  display: flex; gap: 4px; padding: 6px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 8px 8px 20px rgb(0 0 0 / 0.22), -4px -4px 12px var(--sh-light), inset 1px 1px 0 var(--edge);
}
.hb-slot {
  position: relative; min-width: calc(62px * var(--ui, 1)); height: calc(40px * var(--ui, 1)); padding: 0 calc(12px * var(--ui, 1)); display: grid; place-items: center;
  text-decoration: none; color: var(--muted); font-size: calc(13px * var(--ui, 1)); border-radius: calc(13px * var(--ui, 1));
  transition: box-shadow 0.15s, color 0.15s;
}
.hb-slot:hover { color: var(--text); }
.hb-slot.is-active { color: var(--accent); font-weight: 600; box-shadow: inset 3px 3px 7px var(--sh-dark), inset -3px -3px 7px var(--sh-light); }

@media (max-width: 640px) {
  .js .panel { top: 62px; width: calc(100vw - 28px); margin-left: calc((100vw - 28px) / -2); }
  .hero { grid-template-columns: 72px 1fr; gap: 16px; }
  .avatar { width: 72px; height: 72px; border-radius: 20px; padding: 4px; }
  .hero-name { font-size: 20px; }
  .hero-tag { font-size: 12px; }
  .post-list a { flex-direction: column; gap: 3px; padding: 9px 10px; }
  .post-title { max-width: 100%; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14px; }
  .panel .post-list li:nth-child(n + 5) { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .grid.friends { grid-template-columns: 1fr 1fr; }
  .friends .item-desc { display: none; }
  .friends .slot-link { padding: 9px 10px; gap: 8px; border-radius: 14px; }
  .friends .slot-link img, .friends .noicon { width: 28px; height: 28px; border-radius: 8px; }
  .friends .item-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .friends .slot-link > span:last-child { min-width: 0; }
  .hotbar { gap: 2px !important; padding: 4px !important; }
  .hb-slot { min-width: 0; padding: 0 8px; height: 36px; font-size: 12px; white-space: nowrap; }
  .hint-keys { display: none; }
}


/* ---- 阅读面板：在世界上方展开，底部露出一条地面和坐着看书的小人 ---- */
.reader[hidden] { display: none !important; }
.reader { max-width: 860px; margin: 0 auto; padding: 80px 16px 48px; }
.has-reader .stages { display: none; } /* 无 JS：有正文的页面只显示正文 */
.js .has-reader .stages { display: block; }
.js .reader {
  position: fixed; z-index: 4; top: 70px; bottom: var(--strip); left: 50%;
  width: min(860px, calc(100vw - 32px)); margin: 0; padding: 0; transform: translateX(-50%);
}
.reader-card { padding: 0; }
.js .reader-card { height: 100%; max-height: none; display: flex; flex-direction: column; overflow: hidden; }
.reader-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 4px; }
.reader-back {
  font-size: 13px; color: var(--muted); text-decoration: none; padding: 7px 13px; border-radius: 12px; background: var(--surface);
  box-shadow: 4px 4px 10px var(--sh-dark), -4px -4px 10px var(--sh-light); transition: box-shadow 0.15s, color 0.15s;
}
.reader-back:hover { color: var(--accent); }
.reader-back:active { box-shadow: inset 3px 3px 7px var(--sh-dark), inset -3px -3px 7px var(--sh-light); }
.reader-hint { font-size: 12px; color: var(--muted); opacity: 0.7; }
.js .reader-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; outline: none; }
.reader-scroll .prose h2, .reader-scroll .prose h3, .reader-scroll .prose h4 { scroll-margin-top: 16px; }

/* 阅读时：页面不再滚动，板块卡片和快捷栏让位，世界下沉成一条 */
html.js.reading { overflow: hidden; }
.reading .stages { opacity: 0; pointer-events: none; }
.reading .hotbar { opacity: 0; pointer-events: none; visibility: hidden; }
.hotbar { transition: opacity 0.25s, visibility 0.25s; }
.reading body::before { opacity: 0.5; }
.js #world, .js #hero { transition: filter 0.3s, transform 0.55s cubic-bezier(0.3, 0.7, 0.2, 1); }
.reading #world, .reading #hero { transform: translateY(var(--sink)); }
.stages, .hotbar { transition: opacity 0.25s; }

@media (prefers-reduced-motion: reduce) {
  .js #world, .js #hero, .stages, .hotbar { transition: none; }
}

@media (max-width: 640px) {
  .js .reader { top: 60px; width: calc(100vw - 16px); }
  .reader-bar { padding: 10px 12px 2px; }
  .reader-hint { display: none; }
}
/* 正文滚到面板上沿时淡出，不和返回按钮硬切 */
.js .reader-scroll { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px); mask-image: linear-gradient(to bottom, transparent 0, #000 18px); }

/* ---- 阅读面板两侧：左目录、右文章信息。正文卡片只放标题和正文 ---- */
.reader-bar-end { display: flex; align-items: center; gap: 12px; }
.toc-btn {
  display: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; border: 0;
  padding: 7px 13px; border-radius: 12px; background: var(--surface);
  box-shadow: 4px 4px 10px var(--sh-dark), -4px -4px 10px var(--sh-light); transition: box-shadow 0.15s, color 0.15s;
}
.toc-btn:hover { color: var(--accent); }
.toc-btn[aria-expanded='true'] { color: var(--accent); box-shadow: inset 3px 3px 7px var(--sh-dark), inset -3px -3px 7px var(--sh-light); }

.reader-side { padding: 18px 16px; margin-bottom: 16px; }
.side-title { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0.5px; }
.read-progress { height: 6px; border-radius: 3px; margin: 0 2px 12px; box-shadow: inset 1px 1px 3px var(--sh-dark), inset -1px -1px 3px var(--sh-light); overflow: hidden; }
.read-progress span { display: block; height: 100%; width: calc(var(--read, 0) * 100%); background: var(--accent); border-radius: 3px; transition: width 0.1s linear; }
.toc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13px; line-height: 1.45; }
.toc-list a { display: block; padding: 5px 10px; border-radius: 10px; text-decoration: none; color: var(--muted); transition: color 0.15s, box-shadow 0.15s; }
.toc-list .lv3 a { padding-left: 22px; font-size: 12.5px; }
.toc-list .lv4 a { padding-left: 34px; font-size: 12px; }
.toc-list a:hover { color: var(--text); }
.toc-list a.is-active { color: var(--accent); font-weight: 600; box-shadow: inset 2px 2px 5px var(--sh-dark), inset -2px -2px 5px var(--sh-light); }
.meta-list { margin: 0 0 6px; display: grid; gap: 10px; }
.meta-list div { display: grid; grid-template-columns: 36px 1fr; gap: 8px; font-size: 13px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.meta-cats { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.meta-cats a { text-decoration: none; }
.meta-cats a:hover, .side-tags a:hover { color: var(--accent); }
.side-right .side-title { margin-top: 16px; }
.side-right .side-tags { margin: 0; gap: 8px; }
.side-tags .tag { font-size: 12px; padding: 4px 10px; }

/* 有 JS：两侧卡片绝对定位在面板外侧，有没有目录都不影响正文位置 */
.js .reader-side { display: none; position: absolute; top: 0; z-index: 1; width: 220px; max-height: 100%; margin: 0; overflow: auto; }
.js .side-left { right: calc(100% + 20px); }
.js .side-right { left: calc(100% + 20px); max-height: calc(100% - 40px); }

@media (min-width: 1000px) {
  .js .inline-meta { display: none; }
  .js .reader:has(.side-right) { left: calc(50% - 120px); width: min(760px, calc(100vw - 340px)); }
  .js .side-right { display: block; }
  .js .post-head { margin-bottom: 20px; }
}
@media (min-width: 1280px) {
  .js .reader:has(.side-right), .js .reader:has(.side-left) { left: 50%; width: min(800px, calc(100vw - 560px)); }
  .js .side-left { display: flex; flex-direction: column; }
  .js .side-left .toc-list { overflow: auto; min-height: 0; scrollbar-width: thin; }
}
/* 窄一些时：目录收进顶栏按钮，点开是浮在正文上的卡片 */
@media (max-width: 1279.98px) {
  .js .toc-btn { display: inline-block; }
  .js .side-left.is-open {
    display: flex; flex-direction: column; right: auto; left: 16px; top: 58px; z-index: 6;
    width: min(320px, calc(100% - 32px)); max-height: min(60%, 460px);
    box-shadow: 14px 14px 32px var(--sh-dark), -8px -8px 22px var(--sh-light), inset 1px 1px 0 var(--edge);
  }
  .js .side-left.is-open .toc-list { overflow: auto; min-height: 0; }
}
@media (max-width: 640px) {
  .js .side-left.is-open { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 65%; }
}

/* ---- 列表类页面：归档、分类、标签、工具、友链、关于 ---- */
.page-sub { margin: 0; color: var(--muted); font-size: 14px; }
.page-note { margin: 22px 0 0; color: var(--muted); font-size: 14px; }
.post-list.rows { margin: 0 -14px 8px; }
.year-block + .year-block { margin-top: 26px; }
.year-title { display: flex; align-items: baseline; gap: 12px; margin: 0 0 8px; font-size: 22px; font-variant-numeric: tabular-nums; scroll-margin-top: 16px; }
.year-title span { font-size: 13px; font-weight: 400; color: var(--muted); }
.post h2#categories, .post h2#tags { font-size: 18px; margin: 8px 0 14px; color: var(--muted); }
.post h2#tags { margin-top: 30px; }
.cat-grid { list-style: none; margin: 0; padding: 0; display: grid; align-items: start; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.cat-card { padding: 14px 16px; border-radius: 16px; box-shadow: 5px 5px 12px var(--sh-dark), -5px -5px 12px var(--sh-light); }
.cat-name { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; text-decoration: none; }
.cat-name:hover { color: var(--accent); }
.cat-name span, .tag span { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; }
.cat-subs { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-subs .tag { font-size: 12px; padding: 3px 10px; }
.tag-cloud { margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tag-cloud .tag { font-size: calc(12px + var(--w, 0.5) * 4px); }
.side-links { margin: 16px 0 0; }
.side-links .btn { margin: 0; font-size: 13px; padding: 7px 13px; }
.grid.big { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 0; }
.friends-full .slot-link img, .friends-full .noicon { width: 48px; height: 48px; border-radius: 14px; }

.about-hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; margin-bottom: 28px; }
.about-hero h1 { margin: 0 0 8px; font-size: 28px; }
.about-hero .more { margin-top: 14px; }
.about-photo { width: 132px; height: 132px; object-fit: cover; border-radius: 50%; padding: 6px; background: var(--surface); box-shadow: 8px 8px 18px var(--sh-dark), -8px -8px 18px var(--sh-light); }
.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.about-card { padding: 18px 20px; border-radius: 18px; box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light); font-size: 15px; line-height: 1.75; }
.about-card.wide { grid-column: 1 / -1; }
.about-card h2 { margin: 0 0 10px; font-size: 16px; }
.about-card p { margin: 0 0 10px; }
.about-card p:last-child { margin-bottom: 0; }
.about-card .tags { margin: 0; gap: 8px; }
.about-card .tag { font-size: 13px; }
.flag { margin-right: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---- 评论 ---- */
.comments { margin: 0 48px 40px; padding-top: 8px; }
.comments-off { color: var(--muted); font-size: 14px; }
.giscus, .giscus-frame { width: 100%; }
.giscus-frame { opacity: 0; transition: opacity 0.3s ease; }
.giscus-frame.is-ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .giscus-frame { transition: none; } }
.giscus:empty::before { content: '评论加载中…'; display: block; color: var(--muted); font-size: 14px; padding: 12px 0; }

@media (max-width: 640px) {
  .comments { margin: 0 20px 28px; }
  .post-list.rows { margin: 0 -10px 8px; }
  .about-hero { grid-template-columns: 1fr; justify-items: start; gap: 16px; }
  .about-photo { width: 96px; height: 96px; }
  .about-grid { grid-template-columns: 1fr; }
}
/* 内容短的页面（工具、分类）面板按内容收高，不撑满 */
.js .reader-card { height: auto; max-height: 100%; }
.js .reader-scroll { flex: 0 1 auto; }
/* 没有侧栏的短页面贴近地面，和首页卡片的位置一致 */
.js .reader:not(:has(.reader-side)) { display: flex; flex-direction: column; justify-content: flex-end; }

/* 工具 */
.tool .item-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool-badge { font-size: 11px; font-weight: 500; color: var(--muted); padding: 1px 8px; border-radius: 999px; box-shadow: inset 1px 1px 3px var(--sh-dark), inset -1px -1px 3px var(--sh-light); }
.tool-badge.on { color: var(--accent); }
.group-title { font-size: 15px; color: var(--muted); margin: 6px 0 12px; }
.group-title ~ .group-title { margin-top: 26px; }
.grid.tools { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .grid.tools { grid-template-columns: 1fr; } .grid.tools li:nth-child(n + 3) { display: none; } }

/* ---- 首页卡片不滚动：内容按屏幕高度裁成能放下的条数，完整内容在面板页里 ---- */
.js .panel .card { overflow: hidden; }
.panel .grid.friends li:nth-child(n + 7) { display: none; }
@media (max-height: 820px) {
  .panel .post-list li:nth-child(n + 5) { display: none; }
  .panel .grid.friends li:nth-child(n + 4) { display: none; }
}
@media (max-height: 700px) {
  .panel .post-list li:nth-child(n + 4) { display: none; }
  .panel .grid.tools li:nth-child(n + 3) { display: none; }
  .panel .hero .hint { display: none; }
}
@media (max-width: 640px) {
  .panel .grid.friends li:nth-child(n + 5) { display: none; }
}
@media (max-width: 640px) and (max-height: 760px) {
  .panel .post-list li:nth-child(n + 4) { display: none; }
  .panel .grid.friends li:nth-child(n + 3) { display: none; }
}
.graveyard .slot-link { opacity: 0.6; filter: grayscale(1); }
.graveyard .slot-link:hover { opacity: 0.85; }
.graveyard .noicon { color: var(--muted); font-weight: 400; }
@media (max-width: 640px) and (max-height: 700px) {
  .panel .post-list li:nth-child(n + 3) { display: none; }
}
.grid.big + .group-title { margin-top: 30px; }

/* ---- 搜索：浮在一切之上的卡片 ---- */
.search[hidden] { display: none !important; }
.search {
  position: fixed; inset: 0; z-index: 8; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
html.searching { overflow: hidden; }
.search-card { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; padding: 16px; overflow: hidden; }
.search-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light);
}
.search-bar svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.search-bar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--text); }
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-bar kbd { font: 11px var(--mono); color: var(--muted); padding: 2px 6px; border-radius: 6px; box-shadow: 1px 1px 3px var(--sh-dark), -1px -1px 3px var(--sh-light); }
.search-hint { margin: 12px 4px 6px; font-size: 12px; color: var(--muted); }
.search-results { list-style: none; margin: 0; padding: 0 2px 2px; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 4px; }
.search-results a { display: block; padding: 10px 12px; border-radius: 12px; text-decoration: none; transition: box-shadow 0.15s; }
.search-results a:hover, .search-results a.is-active, .search-results a:focus-visible { box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light); }
.search-results a:hover .sr-title, .search-results a.is-active .sr-title { color: var(--accent); }
.sr-title { display: block; font-weight: 600; }
.sr-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sr-excerpt { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.search-results mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; }
@media (max-width: 640px) { .search { padding-top: 64px; } .search-card { max-height: calc(100dvh - 80px); } }
.spark-box { margin: 0 0 12px; padding: 8px 12px 6px; border-radius: 14px; color: var(--accent); box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light); }
.spark-box svg { display: block; width: 100%; height: 36px; }
.spark-box figcaption { font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (max-height: 760px) { .spark-box { display: none; } }
.spark-box { margin: 0 0 12px; padding: 8px 12px 6px; border-radius: 14px; color: var(--accent); box-shadow: inset 3px 3px 8px var(--sh-dark), inset -3px -3px 8px var(--sh-light); }
.spark-box[hidden] { display: none; }
.spark-box svg { display: block; width: 100%; height: 36px; }
.spark-box figcaption { font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (max-height: 760px) { .spark-box { display: none; } }
.qq-chip {
  position: relative; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; border: 0;
  margin-left: 4px; padding: 2px 10px; border-radius: 10px; background: var(--surface);
  box-shadow: 3px 3px 8px var(--sh-dark), -3px -3px 8px var(--sh-light); font-variant-numeric: tabular-nums;
}
.qq-chip:active { box-shadow: inset 2px 2px 5px var(--sh-dark), inset -2px -2px 5px var(--sh-light); }
.qq-copied { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* ---- 彩蛋 ---- */
html.js { touch-action: manipulation; } /* 双击路牌 / 门时不触发浏览器的双击缩放 */
html.secret-open { overflow: hidden; }
html.world-hover body { cursor: pointer; }
.secret-panel { display: none; }
.js .secret-panel { display: flex; visibility: hidden; }
.secret-text { margin: 0 0 8px; font-size: 15px; }
.secret-text.muted { color: var(--muted); font-size: 14px; }
.secret-open .hotbar { opacity: 0.4; }
.qq-line { display: inline-block; white-space: nowrap; margin-left: 4px; }

/* ---- 弹弓（悬停 / 长按快捷栏的「起点」） ---- */
.slingshot[hidden] { display: none; }
.slingshot { position: fixed; z-index: 6; width: 48px; height: 60px; pointer-events: none; }
.slingshot > * { pointer-events: none; }
.slingshot.ss-in { animation: ss-pop-in 0.22s cubic-bezier(0.3, 1.6, 0.5, 1) both; transform-origin: 50% 100%; }
.slingshot.ss-out { animation: ss-pop-out 0.2s ease-in both; transform-origin: 50% 100%; }
@keyframes ss-pop-in { from { transform: scale(0.2) translateY(20px); opacity: 0; } }
@keyframes ss-pop-out { to { transform: scale(0.4) translateY(16px); opacity: 0; } }
.slingshot canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.ss-fork { position: absolute; inset: 0; width: 48px; height: 60px; filter: drop-shadow(3px 3px 0 rgb(0 0 0 / 0.15)); }
.ss-bands { position: absolute; left: -90px; top: -90px; width: 228px; height: 240px; }
.ss-aim { position: absolute; left: 0; top: 0; width: 48px; height: 60px; overflow: visible; }
.ss-aim rect { fill: var(--accent); opacity: 0.85; }
.ss-ball {
  position: absolute; left: 18px; top: 16px; width: 12px; height: 12px; pointer-events: auto; cursor: grab; touch-action: none;
  filter: drop-shadow(3px 3px 0 rgb(0 0 0 / 0.18));
}
.ss-drag .ss-ball { cursor: grabbing; }
.ss-ball.ss-pop { animation: ss-ball-pop 0.5s ease-out forwards; }
.ss-ball.ss-miss { animation: ss-ball-miss 0.5s ease-in forwards; }
.ss-ball.ss-reload { animation: ss-ball-reload 0.32s 0.12s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
@keyframes ss-ball-reload { from { scale: 0.2; opacity: 0; } }
@keyframes ss-ball-pop { 30% { scale: 1.8; opacity: 1; } 100% { scale: 0.2; opacity: 0; } }
@keyframes ss-ball-miss { to { transform: translateY(30px); opacity: 0; } } /* 位置占用了 translate 属性，这里用 transform 往下掉 */
.hb-slot.ss-target { color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent), 3px 3px 7px var(--sh-dark), -3px -3px 7px var(--sh-light); }
.hb-slot.ss-hit { animation: ss-hit 0.3s ease-out; }
@keyframes ss-hit { 40% { transform: translateY(3px) scale(0.94); } }
@media (prefers-reduced-motion: reduce) { .slingshot.ss-in, .slingshot.ss-out, .ss-ball.ss-pop, .ss-ball.ss-miss, .ss-ball.ss-reload, .hb-slot.ss-hit { animation: none; } }

/* ---- 过渡：所有出现 / 消失都有动画，不突变（减少动态效果时全部关闭） ---- */
.search { opacity: 0; transition: opacity 0.2s ease; }
.search.is-open { opacity: 1; }
.search-card { transform: translateY(-10px) scale(0.98); transition: transform 0.24s cubic-bezier(0.3, 0.7, 0.2, 1); }
.search.is-open .search-card { transform: none; }
.search-results li { animation: fade-up 0.2s ease both; }
.search-results li:nth-child(2) { animation-delay: 0.02s; }
.search-results li:nth-child(3) { animation-delay: 0.04s; }
.search-results li:nth-child(n + 4) { animation-delay: 0.06s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 1279.98px) {
  .js .side-left.is-open { opacity: 0; transform: translateY(-8px); transition: opacity 0.18s ease, transform 0.18s ease; }
  .js .side-left.is-open.is-shown { opacity: 1; transform: none; }
}
@media (max-width: 640px) {
  .js .side-left.is-open { transform: translateY(16px); }
}

/* 不支持 View Transitions 时阅读面板的开合 */
.reader-card.reader-in { animation: reader-in 0.3s cubic-bezier(0.3, 0.7, 0.2, 1) both; }
.reader-card.reader-out { animation: reader-out 0.18s ease-in both; }
@keyframes reader-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@keyframes reader-out { to { opacity: 0; transform: translateY(12px) scale(0.98); } }

.qq-copied { opacity: 0; transition: opacity 0.2s; }
.qq-copied.on { opacity: 1; }
.spark-box:not([hidden]) { animation: fade-up 0.3s ease both; }
[data-mc-status] dd { transition: color 0.3s; }

/* 深浅色切换的整页交叉淡化稍慢一点 */
.theme-switching::view-transition-old(root), .theme-switching::view-transition-new(root) { animation-duration: 0.35s; }

@media (prefers-reduced-motion: reduce) {
  .search, .search-card, .js .side-left.is-open, .hotbar, .qq-copied { transition: none; }
  .search-results li, .reader-card.reader-in, .reader-card.reader-out, .spark-box:not([hidden]) { animation: none; }
}
