/* a4zbabz · 样式表
 * 视觉参考 OneCat：紫(靛)主色 + 浅蓝灰纸面 + 圆角卡片 + 淡紫描边。
 * 字体仍用自托管的 Tektur / InstrumentSans / GeistMono。
 * 浅色 / 深色两套令牌，由 <html data-theme="light|dark"> 切换（默认跟随系统）。
 */

/* ---------- 自托管字体（不依赖 Google Fonts，国内可直连） ---------- */
@font-face {
  font-family: "Tektur";
  src: url("../fonts/Tektur-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Tektur";
  src: url("../fonts/Tektur-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "InstrumentSans";
  src: url("../fonts/InstrumentSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "InstrumentSans";
  src: url("../fonts/InstrumentSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "GeistMono";
  src: url("../fonts/GeistMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* ================================================================
   设计令牌 · 浅色
   ================================================================ */
:root {
  --bg: #f0f2f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f3ff;
  --bg-input: #ffffff;
  --bg-modal: #ffffff;
  --bg-sunk: #e9ebf3;

  --accent: #7c3aed;
  --accent-light: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-soft: rgb(124 58 237 / 0.12);
  --accent-soft-2: rgb(124 58 237 / 0.2);
  --accent-ring: rgb(124 58 237 / 0.22);

  --border: #ddd6fe;
  --border-strong: #c4b5fd;
  --border-focus: #7c3aed;

  --text: #1e1b4b;
  --text-sub: #4b5563;
  --text-muted: #9ca3af;
  --text-on-accent: #ffffff;

  --success: #059669;
  --error: #dc2626;
  --warning: #d97706;
  --info: #2563eb;

  --tint-green: rgb(5 150 105 / 0.12);
  --tint-amber: rgb(217 119 6 / 0.12);
  --tint-red: rgb(220 38 38 / 0.1);
  --tint-blue: rgb(37 99 235 / 0.1);

  --header-bg: linear-gradient(135deg, #ede9fe 0%, #f0f2f8 100%);
  --banner-bg: linear-gradient(180deg, rgb(237 233 254 / 0.85) 0%, transparent 100%);
  --footer-bg: rgb(237 233 254 / 0.4);

  --grid-line: rgb(124 58 237 / 0.09);
  --shadow-card: 0 1px 4px rgb(124 58 237 / 0.08);
  --shadow-pop: 0 10px 32px -14px rgb(30 27 75 / 0.28);
  --shadow-lift: 0 12px 26px -18px rgb(124 58 237 / 0.5);

  --radius: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-pill: 999px;
  --wrap: 1200px;

  --font-display: "Tektur", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-body: "InstrumentSans", "Segoe UI", "PingFang SC", "Microsoft YaHei",
    "Noto Sans CJK SC", "Hiragino Sans GB", sans-serif;
  --font-mono: "GeistMono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  color-scheme: light;
}

/* ================================================================
   设计令牌 · 深色
   ================================================================ */
[data-theme="dark"] {
  --bg: #0d0d1a;
  --bg-card: #141428;
  --bg-card-hover: #1c1c38;
  --bg-input: #1a1a30;
  --bg-modal: #181830;
  --bg-sunk: #0a0a16;

  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-hover: #6d28d9;
  --accent-soft: rgb(124 58 237 / 0.18);
  --accent-soft-2: rgb(124 58 237 / 0.28);
  --accent-ring: rgb(167 139 250 / 0.25);

  --border: #2a2a4a;
  --border-strong: #3d3d63;
  --border-focus: #7c3aed;

  --text: #f1f5f9;
  --text-sub: #94a3b8;
  --text-muted: #64748b;

  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
  --info: #60a5fa;

  --tint-green: rgb(16 185 129 / 0.15);
  --tint-amber: rgb(245 158 11 / 0.15);
  --tint-red: rgb(239 68 68 / 0.15);
  --tint-blue: rgb(96 165 250 / 0.15);

  --header-bg: linear-gradient(135deg, #1a0a3a 0%, #0d0d1a 100%);
  --banner-bg: linear-gradient(180deg, rgb(26 10 58 / 0.6) 0%, transparent 100%);
  --footer-bg: rgb(0 0 0 / 0.2);

  --grid-line: rgb(124 58 237 / 0.16);
  --shadow-card: none;
  --shadow-pop: 0 12px 34px -14px rgb(0 0 0 / 0.7);
  --shadow-lift: 0 12px 26px -18px rgb(0 0 0 / 0.8);

  color-scheme: dark;
}

/* ================================================================
   基础
   ================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 手机点击不要那个灰色高亮块（本站所有可点元素都有自己的反馈） */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(15px, 0.6vw + 13.5px, 16.5px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* 播放器固定在底部，给页面留出空间 */
/* 播放器固定在底部，给页面留出空间（再加一条底部安全区，免得被手机的小横条压住） */
body.has-player {
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}

main {
  flex: 1;
}

/* ---------------- 换页过渡（pjax） ----------------
 * 只动 opacity 与一点点位移，两帧内完成；比原来瞬间替换 DOM 的手感稳得多，
 * 而且不会因为动画时间太长而让音频在换页时抖动。
 */
#main {
  animation: page-in 0.18s ease-out both;
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* 署名（作品 / 笔记的作者，发布时可自定义，留空则不生成这个元素） */
.byline {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.byline::before {
  content: "— ";
}

a {
  color: var(--accent-light);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}
[data-theme="dark"] a:hover {
  color: var(--accent-light);
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

img {
  max-width: 100%;
  display: block;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  z-index: 200;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip:focus {
  left: 0;
  top: 0;
}

/* ================================================================
   页头
   ================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand:hover {
  color: var(--text);
  text-decoration: none;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  flex: none;
  object-fit: cover;
  border: 1px solid var(--border);
}
.brand-name {
  background: linear-gradient(90deg, var(--accent-light), #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}
.site-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-sub);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.18s ease, background-color 0.18s ease;
}
.site-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
  text-decoration: none;
}
.site-nav a[aria-current="page"] {
  color: var(--accent-light);
  background: var(--accent-soft-2);
  font-weight: 700;
}

/* 右上角：登录 / 用户区 */
.header-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.user-chip {
  font-size: 0.8rem;
  color: var(--accent-light);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip[data-role="admin"]::before {
  content: "★ ";
}

/* ================================================================
   按钮
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.14s ease;
}
.btn:hover {
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn[disabled],
.btn[aria-busy="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);
}
.btn--primary:hover {
  background: var(--accent-hover);
  color: var(--text-on-accent);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-sub);
}
.btn--ghost:hover {
  border-color: var(--accent-light);
  color: var(--text);
}

.btn--soft {
  background: var(--accent-soft);
  border-color: var(--accent-soft-2);
  color: var(--accent-light);
}
.btn--soft:hover {
  background: var(--accent-soft-2);
}

.btn--danger {
  background: var(--tint-red);
  border-color: rgb(220 38 38 / 0.3);
  color: var(--error);
}
.btn--danger:hover {
  background: rgb(220 38 38 / 0.2);
}

.btn--sm {
  padding: 5px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}
.btn--block {
  width: 100%;
}

/* ================================================================
   Hero
   ================================================================ */
.hero {
  background: var(--banner-bg);
  border-bottom: 1px solid var(--border);
  padding: clamp(34px, 5vw, 62px) 0 clamp(26px, 4vw, 42px);
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(26px, 4vw, 56px);
  align-items: center;
}
.hero-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
  font-family: var(--font-mono);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 1.14;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  color: var(--text);
  text-wrap: balance;
}
.hero p.lead {
  font-size: clamp(15.5px, 1vw + 14px, 17.5px);
  color: var(--text-sub);
  max-width: 34em;
  margin: 0 0 22px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 列表页用的紧凑版 hero（原来是靠行内 style 覆盖的） */
.hero--compact {
  padding: clamp(22px, 3.4vw, 38px) 0 clamp(18px, 3vw, 28px);
}
.hero--compact .wrap {
  display: block;
}
.hero--compact h1 {
  font-size: clamp(21px, 2.6vw, 31px);
  margin-bottom: 10px;
}
.hero--compact p.lead {
  margin-bottom: 0;
  font-size: clamp(14.5px, 0.8vw + 13px, 16px);
}

/* 右侧「工作台」货架 */
.shelf {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 100% 22px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 22px 100%,
    var(--bg-card);
  padding: 16px;
  box-shadow: var(--shadow-card);
}
.shelf-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.shelf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.shelf-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 58px;
}
.shelf-item img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  flex: none;
}
.shelf-item .n {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
}
.shelf-item .p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}
.shelf-item--wide {
  grid-column: span 2;
  justify-content: space-between;
}
.shelf-qr {
  width: 58px;
  height: 58px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: #fff;
  padding: 3px;
}

/* ================================================================
   区块
   ================================================================ */
.section {
  padding: clamp(28px, 4vw, 48px) 0;
}
.section + .section {
  border-top: 1px solid var(--border);
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
}
.section-head h2 {
  font-size: clamp(18px, 1.5vw + 14px, 22px);
  margin: 0;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--text);
}
.section-head .more {
  margin-left: auto;
  font-size: 0.85rem;
  white-space: nowrap;
}
.section-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ================================================================
   作品卡片
   ================================================================ */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}
.work {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 17px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, transform 0.16s ease, box-shadow 0.2s ease,
    background-color 0.2s ease;
}
.work:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}
.work-top {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.work-top img {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  flex: none;
  border: 1px solid var(--border);
}
.work h3 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--text);
}
.work h3 a {
  color: var(--text);
}
.work h3 a:hover {
  color: var(--accent-light);
  text-decoration: none;
}
.work .tagline {
  color: var(--accent-light);
  font-size: 0.83rem;
  font-weight: 700;
  margin: 2px 0 0;
}
.work .desc {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.9rem;
}
.work-foot {
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.work-foot .meta {
  margin-left: auto;
}

/* ---------- 卡片封面（点进去就是 demo）---------- */
.work-cover {
  display: block;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-sunk);
  margin-bottom: 2px;
}
.work-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}
a.work-cover:hover img {
  transform: scale(1.04);
}

/* 卡片底部那个「试玩 →」按钮 */
.work-launch {
  align-self: flex-start;
}

/* ================================================================
   标签 / 徽章 / 状态
   ================================================================ */
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  line-height: 1;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--text-sub);
  background: var(--bg-input);
  white-space: nowrap;
}
.chip--platform {
  border-color: var(--accent-soft-2);
  color: var(--accent-light);
  background: var(--accent-soft);
}
.chip--tag {
  background: transparent;
  border-style: dashed;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 9px;
  border-radius: var(--radius-xs);
  color: var(--text-sub);
  background: var(--bg-sunk);
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status[data-s="在线"] {
  background: var(--tint-green);
  color: var(--success);
}
.status[data-s="在线"]::before {
  background: var(--success);
}
.status[data-s="开发中"] {
  background: var(--tint-amber);
  color: var(--warning);
}
.status[data-s="开发中"]::before {
  background: var(--warning);
}
.status[data-s="已下线"]::before {
  background: var(--text-muted);
}

.meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent-light);
}
.badge--green {
  background: var(--tint-green);
  color: var(--success);
}
.badge--red {
  background: var(--tint-red);
  color: var(--error);
}
.badge--amber {
  background: var(--tint-amber);
  color: var(--warning);
}
.badge--muted {
  background: var(--bg-sunk);
  color: var(--text-muted);
}

/* ================================================================
   筛选条
   ================================================================ */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 22px;
}
.filter {
  font: inherit;
  font-size: 0.83rem;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.16s ease;
}
.filter:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.filter[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.count {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  margin-left: auto;
  align-self: center;
}

/* ================================================================
   笔记列表
   ================================================================ */
.notes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.note-row {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 18px;
  align-items: baseline;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, transform 0.16s ease, background-color 0.2s ease;
}
.note-row:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateX(2px);
}
.note-row .date {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}
.note-row h3 {
  margin: 0 0 3px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.note-row h3 a {
  color: var(--text);
}
.note-row:hover h3 a {
  color: var(--accent-light);
  text-decoration: none;
}
.note-row .excerpt {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.9rem;
  max-width: 62ch;
}
.note-row .chips {
  justify-content: flex-end;
}

/* ================================================================
   文章正文
   ================================================================ */
.article {
  padding: clamp(28px, 5vw, 52px) 0 60px;
}
.article .wrap {
  max-width: 780px;
}
.article header {
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.article h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.22;
  letter-spacing: -0.02em;
  margin: 8px 0 12px;
  color: var(--text);
}
.article .back {
  font-size: 0.85rem;
}
.prose {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-sub);
}
.prose h2 {
  color: var(--text);
  font-size: 1.25rem;
  margin: 34px 0 12px;
  letter-spacing: -0.01em;
}
.prose p {
  margin: 0 0 17px;
}
.prose ul {
  margin: 0 0 17px;
  padding-left: 1.2em;
}
.prose li {
  margin: 5px 0;
}
.prose li::marker {
  color: var(--accent);
}
.prose strong {
  color: var(--text);
}
.prose a {
  color: var(--accent-light);
}
.prose .btn--primary {
  background: #673ab7;
  color: #fff;
  font-weight: 700;
  white-space: normal;
}
.prose .btn--primary:hover,
.prose .btn--primary:focus-visible {
  background: #54289e;
  color: #fff;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
}
.compiler-log {
  max-height: 24rem;
  overflow: auto;
  padding: 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.85rem;
}

.prose pre {
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 15px 17px;
  border-radius: var(--radius-md);
  overflow: auto;
  margin: 0 0 19px;
}
[data-theme="dark"] .prose pre {
  background: #080812;
}
.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* 笔记附件：::pdf 内嵌（点开直接看内容）/ ::page 单开一个网页 */
.note-file-directory,
.note-file-target {
  scroll-margin-top: 112px;
}
.note-file-directory {
  margin: 0 0 24px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.note-file-directory h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.note-file-directory ol {
  margin: 0;
  padding-inline-start: 1.5em;
}
.note-file-directory a,
.note-file-back a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.note-file-back {
  font-size: 0.85rem;
}
.note-embed {
  margin: 0 0 19px;
}
.note-embed iframe {
  width: 100%;
  height: min(78vh, 920px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.note-embed figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
}
.note-embed figcaption:first-child {
  margin: 0 0 8px;
}
/* 图片笔记：::img —— 容器内滚动（长图不会把页面撑爆），点开看原图 */
.note-figure {
  margin: 0 0 19px;
}
.note-figure-scroll {
  max-height: 78vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}
.note-figure-scroll img {
  display: block;
  width: 100%;
  height: auto;
}
.note-figure figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
}
.note-tags {
  margin-top: 10px;
}
.note-tags .chip {
  text-decoration: none;
}
.note-page-link {
  margin: 4px 0 22px;
}

/* ================================================================
   关于
   ================================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: clamp(26px, 4vw, 56px);
  align-items: start;
}
.fact-list {
  list-style: none;
  margin: 0;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.fact-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.fact-list li:last-child {
  border-bottom: 0;
}
.fact-list .k {
  color: var(--text-muted);
}
.fact-list .v {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
}

/* ================================================================
   页脚
   ================================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 26px 0 34px;
  background: var(--footer-bg);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
}
.site-footer .sep {
  flex: 1;
}
.site-footer a {
  color: var(--text-sub);
}

/* ================================================================
   入场动效（一次，克制）
   ================================================================ */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(12px);
    animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  }
  .d1 {
    animation-delay: 0.05s;
  }
  .d2 {
    animation-delay: 0.13s;
  }
  .d3 {
    animation-delay: 0.21s;
  }
  .d4 {
    animation-delay: 0.29s;
  }
  @keyframes rise {
    to {
      opacity: 1;
      transform: none;
    }
  }
}

/* ================================================================
   深浅色切换按钮 —— 在页头最左侧
   （原来是右下角的悬浮按钮；悬浮在左上会盖住 logo，所以改成页头里的行内元素）
   ================================================================ */
.theme-toggle {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.25s ease;
}
.theme-toggle:hover {
  transform: scale(1.08);
  border-color: var(--accent);
}

/* ================================================================
   模态框（登录 / 控制台 / 聊天室共用）
   —— 原来只在 admin.css 里，聊天室用不到就变成了「弹窗没样式」。
      凡是多个页面共用的基础件都放这里，避免再出现同样的问题。
   ================================================================ */
/* ---------------- 模态框 ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(15 12 40 / 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 250;
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.1rem;
  width: 100%;
  max-width: 30rem;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.modal-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
}

.modal-close:hover {
  background: var(--bg-sunk);
  color: var(--text);
}

.modal-text {
  margin: 0 0 0.7rem;
  font-size: 0.87rem;
  color: var(--text-sub);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

/* ================================================================
   底部迷你播放器
   ================================================================ */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px -18px rgb(124 58 237 / 0.6);
  backdrop-filter: blur(10px);
}
.player-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.player-cover {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  flex: none;
  object-fit: cover;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
}
.player-meta {
  min-width: 0;
  flex: 1;
}
.player-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-artist {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: all 0.16s ease;
}
.player-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
}
.player-btn--main {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.player-btn--main:hover {
  background: var(--accent-hover);
  color: #fff;
}
/* 浮窗播放按钮的「已开启」态 */
.player-btn.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-light);
}
.player-progress {
  flex: 2;
  min-width: 90px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.player-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  flex: none;
  min-width: 34px;
}
.player-bar {
  flex: 1;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.player-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.15s linear;
}
.player-list {
  max-height: 0;
  overflow: hidden;
  border-top: 0 solid var(--border);
  transition: max-height 0.28s ease;
}
.player-list.is-open {
  max-height: 46vh;
  overflow-y: auto;
  border-top-width: 1px;
}
.player-list-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 8px 20px 14px;
}
.player-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.player-item:hover {
  background: var(--accent-soft);
}
.player-item[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-soft-2);
  color: var(--accent-light);
  font-weight: 700;
}
.player-item img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  flex: none;
  object-fit: cover;
  background: var(--bg-sunk);
}
.player-item .pi-title {
  font-size: 0.85rem;
}
.player-item .pi-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.player-item .pi-dur {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}
.player-empty {
  padding: 14px 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ================================================================
   响应式
   ================================================================ */
@media (max-width: 900px) {
  .hero .wrap {
    grid-template-columns: 1fr;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .player-progress {
    display: none;
  }
}
@media (max-width: 640px) {
  .wrap {
    padding: 0 16px;
  }
  /* 手机端头部改两行：第一行 = 主题 / logo / 用户区，第二行 = 导航条。
     一行放不下 —— 登录后右上角是「用户名 + 控制台 + 退出」，会把 .site-nav
     挤到只剩几十像素，而它是 overflow: hidden：等于 5 个入口有 4 个既看不见、
     也滑不到（用户反馈的「控制台被用户名挡住」就是这一类）。
     导航独占一行后可以横向滑动（滚动条隐藏，靠手势）。 */
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 0 4px;
    gap: 8px;
    row-gap: 4px;
  }
  .site-nav {
    order: 3; /* 排到第二行（DOM 里它在 brand 之后、用户区之前） */
    flex: 1 0 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .site-nav::-webkit-scrollbar {
    display: none;
  }
  .site-nav a {
    flex: none;
  }
  .brand-name {
    display: none;
  }
  .site-nav a {
    padding: 6px 9px;
    font-size: 0.82rem;
  }
  .note-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 14px;
  }
  .note-row .chips {
    justify-content: flex-start;
  }
  .section-head {
    flex-wrap: wrap;
  }
  .section-head .more {
    margin-left: 0;
  }
  .theme-toggle {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }
  .user-chip {
    max-width: 84px;
  }
  .player-cover {
    width: 40px;
    height: 40px;
  }
  /* 手机上的几处细节 */
  .player {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .toast-host {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  /* iOS 只在字号 ≥16px 时才不放大整页，输入框一律顶到 1rem */
  input,
  textarea,
  select {
    font-size: 1rem;
  }
  /* 手指比鼠标粗，链接与按钮的最小可点区域拉高一点 */
  .site-nav a,
  .btn,
  .theme-toggle {
    min-height: 34px;
  }
}
@media (max-width: 380px) {
  /* 极窄屏（≤380px）：用户名 chip 再收一点，保证「控制台 / 退出」不会被顶出去 */
  .user-chip {
    max-width: 64px;
  }
  .site-nav a {
    padding: 6px 7px;
    font-size: 0.78rem;
  }
}

/* ================================================================
   轻提示（A4.toast）
   ================================================================ */
.toast-host {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 96px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: var(--shadow-pop);
  max-width: min(90vw, 30rem);
  animation: toast-in 0.2s ease;
}
.toast.is-out {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.toast--ok {
  border-color: var(--success);
  color: var(--success);
}
.toast--error {
  border-color: var(--error);
  color: var(--error);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

