:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-strong: #edf3fb;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-elevated: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(238, 242, 247, 0.92);
  --line: rgba(217, 225, 236, 0.86);
  --line-strong: rgba(143, 177, 255, 0.36);
  --text: #18202a;
  --muted: #5b6878;
  --accent: #2563eb;
  --accent-2: #14b8a6;
  --accent-warm: #f59e0b;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --ring-soft: rgba(37, 99, 235, 0.18);
  --glow-soft: 0 0 0 1px rgba(116, 154, 255, 0.32), 0 24px 56px rgba(37, 99, 235, 0.14);
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --shadow-float: 0 30px 60px rgba(15, 23, 42, 0.14);
  --radius: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 45%, #f2f6fb 100%);
  position: relative;
}
body.annotation-modal-open {
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.4;
  z-index: -3;
  pointer-events: none;
}

body::before {
  top: -8rem;
  right: -6rem;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.22), transparent 65%);
}

body::after {
  left: -8rem;
  bottom: -10rem;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.18), transparent 68%);
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: 3px;
  transform-origin: left center;
  transform: scaleX(var(--progress, 0));
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-warm));
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.28);
}

.cursor-beacon {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  width: 18px;
  height: 18px;
  margin-left: 12px;
  margin-top: 12px;
  pointer-events: none;
  opacity: 0;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18) inset,
    0 6px 14px rgba(37, 99, 235, 0.08);
  transform: translate3d(-999px, -999px, 0);
  transition:
    opacity 180ms ease-out,
    width 180ms ease-out,
    height 180ms ease-out,
    margin 180ms ease-out,
    border-color 180ms ease-out,
    box-shadow 180ms ease-out,
    background-color 180ms ease-out;
}

.cursor-beacon::before {
  content: "";
  position: absolute;
  left: -10px;
  top: -10px;
  width: 10px;
  height: 10px;
  border-left: 1px solid rgba(37, 99, 235, 0.18);
  border-top: 1px solid rgba(37, 99, 235, 0.18);
  border-top-left-radius: 10px;
  opacity: 0.7;
  pointer-events: none;
}

.cursor-beacon::after {
  content: none;
}

.cursor-beacon-core {
  display: none;
}

.cursor-beacon.is-visible {
  opacity: 1;
}

.cursor-beacon.is-active {
  width: 24px;
  height: 24px;
  margin-left: 14px;
  margin-top: 14px;
  border-color: rgba(20, 184, 166, 0.34);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.24) inset,
    0 8px 18px rgba(20, 184, 166, 0.12);
}

.cursor-beacon.is-active::before {
  border-left-color: rgba(20, 184, 166, 0.24);
  border-top-color: rgba(20, 184, 166, 0.24);
}

.cursor-beacon.is-pressed {
  width: 16px;
  height: 16px;
  margin-left: 11px;
  margin-top: 11px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

svg { display: block; width: 100%; height: 100%; }
svg * { stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.shell { width: min(1140px, calc(100vw - 32px)); margin: 0 auto; position: relative; z-index: 1; }
.shell.note-page-shell { width: min(1560px, calc(100vw - 24px)); }
.site-backdrop { position: fixed; inset: 0; pointer-events: none; z-index: -2; overflow: hidden; }
.site-orb { position: absolute; border-radius: 999px; filter: blur(20px); opacity: 0.55; }
.orb-a { width: 22rem; height: 22rem; top: 5rem; left: -6rem; background: radial-gradient(circle, rgba(245, 158, 11, 0.2), transparent 65%); }
.orb-b { width: 18rem; height: 18rem; top: 18rem; right: -4rem; background: radial-gradient(circle, rgba(37, 99, 235, 0.18), transparent 68%); }
.site-grid {
  position: absolute;
  inset: 0;
  opacity: 0.25;
  background-image: linear-gradient(rgba(255,255,255,0.55) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.55) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(246, 248, 251, 0.7);
  border-bottom: 1px solid rgba(217, 225, 236, 0.78);
  transition: background-color 180ms ease-out, border-color 180ms ease-out, box-shadow 180ms ease-out;
}

.site-header.is-scrolled {
  background: rgba(246, 248, 251, 0.86);
  border-bottom-color: rgba(143, 177, 255, 0.3);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.55rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(20, 184, 166, 0.14));
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65);
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: transform 180ms ease-out, background-color 180ms ease-out, color 180ms ease-out, box-shadow 180ms ease-out;
}

.nav-link:hover {
  transform: translateY(-1px);
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.nav-link.is-current {
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(116, 154, 255, 0.22), 0 8px 22px rgba(15, 23, 42, 0.06);
}

.nav-link:focus-visible,
button:focus-visible,
.button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring-soft);
}

.nav-icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--accent);
}

.page-shell { padding: 42px 0 72px; }
.site-footer { padding: 0 0 48px; }
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(217, 225, 236, 0.78);
}
.footer-copy { color: var(--muted); max-width: 34rem; }
.footer-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.65);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: transform 200ms cubic-bezier(.2,.75,.2,1), background 200ms ease-out, box-shadow 200ms ease-out;
}
.footer-pill:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.88);
  box-shadow: 0 8px 22px rgba(15,23,42,0.06);
}
.footer-pill-icon { color: var(--accent-warm); }

.hero, .stack-header { margin-bottom: 28px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 24px;
  align-items: stretch;
}

.hero-copy-block,
.hero-panel,
.note-hero-main,
.note-hero-side { position: relative; z-index: 1; }

.hero h1, .stack-header h1 {
  font-size: clamp(2.4rem, 4vw, 4.1rem);
  line-height: 1.03;
  margin: 10px 0;
  letter-spacing: -0.045em;
}

.section-head h2,
.note-layout h2,
.panel h2,
.auth-panel h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.hero-copy, .muted, .build-meta, .card-meta { color: var(--muted); }
.hero-copy { font-size: 1.08rem; max-width: 40rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  margin: 0;
}

.hero-badge,
.feature-pill,
.panel-chip,
.tag,
.empty-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(116, 154, 255, 0.24);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
  color: var(--muted);
}

.hero-badge-icon { width: 1rem; height: 1rem; color: var(--accent-warm); }
.hero-actions, .feature-pills, .admin-actions, .panel-title-row, .sidebar-title-row, .list-meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-actions { margin-top: 22px; }
.feature-pills { margin-top: 18px; }
.feature-pill, .panel-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(217, 225, 236, 0.85);
  color: var(--muted);
  font-size: 0.92rem;
  transition: transform 200ms cubic-bezier(.2,.75,.2,1), background 200ms ease-out, box-shadow 200ms ease-out, border-color 200ms ease-out;
}
.feature-pill:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.92);
  border-color: rgba(143,177,255,0.36);
  box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}
.panel-chip { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
/* ── 吉祥物面板 ── */
.hero-mascot-panel {
  display: flex;
  flex-direction: column;
  min-height: 460px;
  padding: 16px;
  isolation: isolate;
  --mascot-size: clamp(120px, 28vw, 150px);
}

/* ── 吉祥物舞台 ── */
.mascot-stage {
  display: grid;
  place-items: center;
  padding: 18px 0 10px;
  z-index: 1;
  pointer-events: auto;
}

/* ── 吉祥物主体 ── */
.mascot {
  position: relative;
  width: var(--mascot-size);
  height: calc(var(--mascot-size) * 0.88);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 300ms cubic-bezier(.2,.75,.2,1);
}
.mascot:hover {
  transform: scale(1.06);
}
.mascot:active {
  transform: scale(0.96);
}

/* 耳朵 */
.mascot-ear {
  position: absolute;
  width: 26%;
  height: 30%;
  top: -16%;
  border-radius: 50% 50% 12% 12%;
  background: linear-gradient(170deg, #dbeafe 30%, #bfdbfe 100%);
  box-shadow: inset 0 -2px 6px rgba(59,130,246,0.08);
  z-index: 1;
  transition: transform 300ms cubic-bezier(.2,.75,.2,1);
}
.mascot-ear::after {
  content: "";
  position: absolute;
  inset: 22% 24% 30% 24%;
  border-radius: inherit;
  background: rgba(251,113,133,0.28);
}
.mascot-ear-l {
  left: 12%;
  transform: rotate(-12deg);
}
.mascot-ear-r {
  right: 12%;
  transform: rotate(12deg);
}
.mascot:hover .mascot-ear-l { transform: rotate(-18deg) translateY(-2px); }
.mascot:hover .mascot-ear-r { transform: rotate(18deg) translateY(-2px); }

/* 脸部 */
.mascot-face {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 48% 48% / 46% 46% 54% 54%;
  background: linear-gradient(175deg, #eff6ff 0%, #dbeafe 40%, #bfdbfe 100%);
  box-shadow:
    inset 0 -6px 16px rgba(59,130,246,0.1),
    inset 0 2px 4px rgba(255,255,255,0.9),
    0 10px 30px rgba(59,130,246,0.15);
  overflow: hidden;
}

/* 眼睛 */
.mascot-eye {
  position: absolute;
  width: 24%;
  height: 28%;
  top: 30%;
  border-radius: 50%;
  background: white;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.06);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: width 250ms, height 250ms, border-radius 250ms, top 250ms;
}
.mascot-eye-l { left: 18%; }
.mascot-eye-r { right: 18%; }

.mascot-pupil {
  font-size: calc(var(--mascot-size) * 0.11);
  line-height: 1;
  color: #1e293b;
  transition: transform 80ms ease-out, color 250ms, font-size 250ms;
  transform: translate(var(--pupil-x, 0px), var(--pupil-y, 0px));
  pointer-events: none;
}

/* 腮红 */
.mascot-blush {
  position: absolute;
  top: 52%;
  font-size: calc(var(--mascot-size) * 0.12);
  line-height: 1;
  color: rgba(251,113,133,0.3);
  pointer-events: none;
  transition: color 300ms, font-size 300ms;
}
.mascot-blush-l { left: 6%; }
.mascot-blush-r { right: 6%; }

/* 嘴巴 */
.mascot-mouth {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  font-size: calc(var(--mascot-size) * 0.16);
  line-height: 1;
  color: #64748b;
  pointer-events: none;
  transition: font-size 250ms, color 250ms, bottom 250ms;
}

/* 浮动标签 */
.mascot-label {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 300ms ease-out, transform 300ms ease-out;
  pointer-events: none;
}
.mascot-label.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(100%) translateY(4px);
}

/* ── 表情状态 ── */

/* 眨眼：眼睛变窄成线 */
.mascot.expr-blink .mascot-eye {
  height: 6%;
  top: 40%;
  border-radius: 999px;
}

/* 开心：眯眼笑 */
.mascot.expr-happy .mascot-eye {
  height: 8%;
  top: 38%;
  border-radius: 999px;
}
.mascot.expr-happy .mascot-blush {
  color: rgba(251,113,133,0.5);
  font-size: calc(var(--mascot-size) * 0.14);
}

/* 惊讶：眼睛放大 */
.mascot.expr-surprised .mascot-eye {
  width: 28%;
  height: 34%;
  top: 27%;
}
.mascot.expr-surprised .mascot-mouth {
  font-size: calc(var(--mascot-size) * 0.2);
}

/* 爱心：瞳孔变成爱心 */
.mascot.expr-love .mascot-pupil {
  color: #f43f5e;
  font-size: calc(var(--mascot-size) * 0.14);
}
.mascot.expr-love .mascot-blush {
  color: rgba(244,63,94,0.4);
}

/* 得意：一只眼闭合 */
.mascot.expr-smug .mascot-eye-l {
  height: 6%;
  top: 40%;
  border-radius: 999px;
}

/* 瞌睡：两眼半闭 */
.mascot.expr-sleepy .mascot-eye {
  height: 10%;
  top: 38%;
  border-radius: 999px;
}

/* 弹跳动画 */
@keyframes mascot-bounce {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(0.92); }
  60% { transform: scale(1.08); }
  80% { transform: scale(0.98); }
}
.mascot.is-bouncing {
  animation: mascot-bounce 450ms cubic-bezier(.2,.75,.2,1);
}

.hero-panel-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  padding: 6px;
}

.hero-panel-copy-block {
  display: grid;
  gap: 10px;
}

.metric-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(246, 248, 251, 0.8);
  border: 1px solid rgba(217, 225, 236, 0.8);
  transition: transform 200ms cubic-bezier(.2,.75,.2,1), background 200ms ease-out, box-shadow 200ms ease-out, border-color 200ms ease-out;
}
.metric-card:hover {
  background: rgba(255,255,255,0.95);
  border-color: rgba(143,177,255,0.32);
  box-shadow: 0 8px 22px rgba(37,99,235,0.08);
}
.metric-card strong { display: block; font-size: 1rem; margin-bottom: 4px; }
.metric-card span { color: var(--muted); font-size: 0.92rem; }
.signal-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 0 6px rgba(20, 184, 166, 0.12);
  animation: signal-pulse 2.4s ease-in-out infinite;
}

@keyframes signal-pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(20, 184, 166, 0.12); }
  50% { box-shadow: 0 0 0 10px rgba(20, 184, 166, 0.06), 0 0 16px rgba(20, 184, 166, 0.18); }
}
.hero-panel-top { display: flex; justify-content: space-between; align-items: center; }
.hero-panel-copy { margin: 12px 0 0; font-size: 1.02rem; color: var(--text); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.stack-list { display: grid; gap: 16px; }
.card, .panel, .list-card, .note-card, .sidebar-card, .search-panel, .note-hero {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.card, .panel, .list-card, .note-card, .sidebar-card, .search-panel, .note-hero { padding: 22px; }

.interactive-card,
.card,
.list-card,
.panel,
.note-card,
.sidebar-card,
.note-hero {
  transition:
    transform 200ms cubic-bezier(.2,.75,.2,1),
    box-shadow 200ms cubic-bezier(.2,.75,.2,1),
    border-color 200ms ease-out,
    background-color 200ms ease-out;
}

.interactive-card::before,
.card::before,
.list-card::before,
.panel::before,
.note-card::before,
.sidebar-card::before,
.note-hero::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255,255,255,0.8), rgba(37,99,235,0.16), rgba(20,184,166,0.12));
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}

.interactive-card:hover,
.card:hover,
.list-card:hover,
.panel:hover,
.note-card:hover,
.sidebar-card:hover,
.note-hero:hover {
  transform: translateY(-4px) scale(1.015);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-float);
  background: var(--surface-elevated);
}

.interactive-card:hover::before,
.card:hover::before,
.list-card:hover::before,
.panel:hover::before,
.note-card:hover::before,
.sidebar-card:hover::before,
.note-hero:hover::before {
  opacity: 1;
}

.interactive-card > *,
.card > *,
.list-card > *,
.panel > *,
.note-card > *,
.sidebar-card > *,
.note-hero > * {
  position: relative;
  z-index: 1;
}

.interactive-card-subtle:hover {
  transform: translateY(-2px) scale(1.008);
}

.build-log li {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(217, 225, 236, 0.72);
}

.build-log-entry {
  position: relative;
  z-index: 1;
  display: block;
}


.card-accent {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-warm));
  background-size: 200% 100%;
  animation: accent-shift 6s ease-in-out infinite;
}

@keyframes accent-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.card-head, .card-foot, .section-head, .panel-title-row, .sidebar-title-row, .note-hero { display: flex; }
.card-head, .card-foot { align-items: center; justify-content: space-between; }
.sidebar-title-row {
  position: relative;
  padding-left: 12px;
}
.card h2, .list-card h2, .list-card h3 { margin: 10px 0; letter-spacing: -0.03em; }
.card p, .list-card p, .panel p { margin: 0; }
.card-meta { font-size: 0.88rem; }
.card-foot { margin-top: 18px; }

.copy-code-button {
  position: absolute;
  right: 14px;
  top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(15, 23, 42, 0.74);
  color: #f8fafc;
  box-shadow: none;
  opacity: 0.65;
}

.copy-code-button:hover {
  opacity: 1;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
}

.copy-code-button.copied {
  background: rgba(20, 184, 166, 0.9);
}

.copy-code-button.copy-failed {
  background: rgba(220, 38, 38, 0.9);
}
.arrow-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  font-weight: 700;
  transition: transform 200ms cubic-bezier(.2,.75,.2,1), background 200ms ease-out;
}
.card:hover .arrow-badge {
  transform: translateX(4px);
  background: rgba(37, 99, 235, 0.16);
}

.surface-icon {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  padding: 0.45rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37,99,235,0.14), rgba(20,184,166,0.12));
  color: var(--accent);
}
.surface-icon.small { width: 1.7rem; height: 1.7rem; padding: 0.35rem; }
.header-icon {
  width: 3rem;
  height: 3rem;
  padding: 0.7rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(37,99,235,0.14), rgba(20,184,166,0.1));
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.7);
}
.enhanced-header { display: flex; gap: 16px; align-items: flex-start; }
.section-head { justify-content: space-between; align-items: flex-end; margin: 34px 0 18px; }
.section-link {
  color: var(--muted);
  font-weight: 600;
  transition: color 200ms ease-out, transform 200ms ease-out;
}
.section-link:hover {
  color: var(--accent);
  transform: translateX(3px);
}

.tag-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.category-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.tag {
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37,99,235,0.09), rgba(20,184,166,0.08));
  color: var(--accent);
  font-size: 0.9rem;
  border: 1px solid rgba(116,154,255,0.22);
  transition: transform 200ms cubic-bezier(.2,.75,.2,1), background 200ms ease-out, box-shadow 200ms ease-out, border-color 200ms ease-out, color 200ms ease-out;
}
.tag:hover {
  transform: translateY(-2px) scale(1.05);
  background: linear-gradient(135deg, rgba(37,99,235,0.18), rgba(20,184,166,0.14));
  border-color: rgba(116,154,255,0.42);
  box-shadow: 0 6px 18px rgba(37,99,235,0.14);
  color: #1d4ed8;
}
.category-tag {
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37,99,235,0.14), rgba(20,184,166,0.12));
  color: var(--accent);
  font-size: 1rem;
  font-weight: 500;
  border: 1.5px solid rgba(116,154,255,0.3);
  transition: transform 200ms cubic-bezier(.2,.75,.2,1), background 200ms ease-out, box-shadow 200ms ease-out, border-color 200ms ease-out, color 200ms ease-out;
}
.category-tag:hover {
  transform: translateY(-2px) scale(1.08);
  background: linear-gradient(135deg, rgba(37,99,235,0.24), rgba(20,184,166,0.2));
  border-color: rgba(116,154,255,0.5);
  box-shadow: 0 8px 22px rgba(37,99,235,0.18);
  color: #1d4ed8;
}

.list-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.list-card-body { flex: 1; min-width: 0; }
.list-card-side { display: flex; align-items: center; }
.list-meta-row { color: var(--muted); font-size: 0.88rem; }

.note-hero {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(248,250,255,0.98));
}
.note-hero-side { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.hero-stat {
  min-width: 110px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(246,248,251,0.82);
  border: 1px solid rgba(217,225,236,0.8);
}
.hero-stat strong { display: block; font-size: 1.15rem; }
.hero-stat span { color: var(--muted); font-size: 0.9rem; }
.note-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  grid-template-areas: "sidebar article rail";
  gap: 20px;
  align-items: start;
  min-width: 0;
}
.note-article {
  grid-area: article;
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}
.note-article.interactive-card:hover {
  transform: none;
}
.note-article-body {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: 100%;
}
.note-sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: stretch;
  min-width: 0;
}
.toc-sticky-panel {
  position: sticky;
  top: 96px;
}
.annotation-rail { grid-area: rail; position: relative; min-width: 0; }
.annotation-rail-card {
  position: sticky;
  top: 96px;
  overflow: visible;
}
.annotation-comment-lane {
  position: relative;
  min-height: 220px;
}
.annotation-empty {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(116,154,255,0.35);
  background: rgba(255,255,255,0.7);
  color: var(--muted);
}
.annotation-comment-card {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 0;
  border-radius: 16px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(217,225,236,0.88);
  box-shadow: 0 4px 16px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.05);
  overflow: hidden;
  transition: box-shadow 200ms ease-out, border-color 200ms ease-out, transform 200ms cubic-bezier(.2,.75,.2,1);
}
.annotation-comment-card:hover {
  box-shadow: 0 8px 28px rgba(15,23,42,0.12);
  border-color: color-mix(in srgb, var(--annotation-color, var(--accent)) 40%, rgba(217,225,236,0.9));
  transform: translateY(-1px);
}
/* 顶部颜色条 */
.annotation-comment-card::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--annotation-color, var(--accent));
  opacity: 0.75;
}
/* 内容区 padding 包裹 */
.annotation-comment-head,
.annotation-comment-quote,
.annotation-comment-body {
  padding-left: 13px;
  padding-right: 13px;
}
.annotation-comment-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-top: 10px;
}
.annotation-comment-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--annotation-color, var(--accent)) 18%, rgba(37,99,235,0.1));
  color: color-mix(in srgb, var(--annotation-color, var(--accent)) 80%, #1e293b);
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--annotation-color, var(--accent)) 25%, rgba(217,225,236,0.8));
}
.annotation-comment-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}
.annotation-comment-username {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.annotation-comment-visibility {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.annotation-comment-visibility.is-public {
  background: rgba(20,184,166,0.1);
  color: #0d9488;
  border: 1px solid rgba(20,184,166,0.2);
}
.annotation-comment-visibility.is-private {
  background: rgba(100,116,139,0.08);
  color: var(--muted);
  border: 1px solid rgba(100,116,139,0.16);
}
.annotation-comment-quote {
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  border-left: 2px solid color-mix(in srgb, var(--annotation-color, var(--accent)) 55%, transparent);
  padding-left: 10px;
  margin-left: 13px;
  margin-right: 13px;
  padding-right: 0;
  font-style: italic;
  /* 超长引用截断为两行 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.annotation-comment-body {
  margin: 0;
  padding-bottom: 12px;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.88rem;
  color: var(--text);
}
@keyframes annotation-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.annotation-comment-card {
  animation: annotation-card-in 220ms cubic-bezier(.2,.7,.2,1) both;
}
.annotation-auth-actions,
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.annotation-helper {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.annotation-auth-actions form,
.account-actions form {
  margin: 0;
}
.annotation-auth-actions > * {
  flex: 1 1 auto;
}
.note-annotation {
  position: relative;
  border-radius: 0.35em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: box-shadow 180ms ease-out, transform 180ms ease-out, background-color 180ms ease-out;
}
.note-annotation.has-highlight {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.52), rgba(255,255,255,0.08)),
    var(--annotation-color, #fde68a);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45);
}
.note-annotation.has-comment {
  border-bottom: 2px dashed var(--annotation-color, rgba(37,99,235,0.6));
  padding-bottom: 0.06em;
}
.note-annotation.annotation-segment-end.has-comment::after {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-left: 0.18rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  color: var(--annotation-color, var(--accent));
  font-size: 0.72rem;
  box-shadow: 0 3px 10px rgba(15,23,42,0.12);
}
.note-annotation.is-active {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.65),
    0 0 0 3px rgba(37,99,235,0.15);
}

/* 文章内注释文字闪烁：亮→暗 3 次 */
@keyframes annotation-text-flash {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 0 0 3px rgba(37,99,235,0.15); filter: brightness(1); }
  20%       { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.9),  0 0 0 5px rgba(37,99,235,0.35); filter: brightness(1.18); }
  40%       { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 0 0 3px rgba(37,99,235,0.15); filter: brightness(1); }
  60%       { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.9),  0 0 0 5px rgba(37,99,235,0.35); filter: brightness(1.18); }
  80%       { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 0 0 3px rgba(37,99,235,0.15); filter: brightness(1); }
}
.note-annotation.is-flashing {
  animation: annotation-text-flash 700ms ease-in-out both;
}

/* 评论卡片闪烁：边框 + 背景色 3 次 */
@keyframes annotation-card-flash {
  0%, 100% { box-shadow: 0 4px 16px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.05); background-color: rgba(255,255,255,0.96); }
  20%       { box-shadow: 0 0 0 3px color-mix(in srgb, var(--annotation-color, var(--accent)) 55%, transparent), 0 8px 24px rgba(15,23,42,0.12); background-color: color-mix(in srgb, var(--annotation-color, var(--accent)) 10%, rgba(255,255,255,0.96)); }
  40%       { box-shadow: 0 4px 16px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.05); background-color: rgba(255,255,255,0.96); }
  60%       { box-shadow: 0 0 0 3px color-mix(in srgb, var(--annotation-color, var(--accent)) 55%, transparent), 0 8px 24px rgba(15,23,42,0.12); background-color: color-mix(in srgb, var(--annotation-color, var(--accent)) 10%, rgba(255,255,255,0.96)); }
  80%       { box-shadow: 0 4px 16px rgba(15,23,42,0.07), 0 1px 3px rgba(15,23,42,0.05); background-color: rgba(255,255,255,0.96); }
}
.annotation-comment-card.is-flashing {
  animation: annotation-card-flash 700ms ease-in-out both;
}
.note-summary { color: var(--muted); font-size: 1.06rem; max-width: 48rem; }
.sidebar-card h2 { margin: 0; }
.sidebar-title-row {
  margin-bottom: 14px;
}
.sidebar-panel .sidebar-title-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.65;
}
.toc-list, .link-list, .build-log { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.toc-list a, .link-list a { color: var(--text); }
.toc-sticky-panel .toc-list { max-height: 50vh; overflow-y: auto; scroll-behavior: smooth; }
.toc-list a {
  display: inline-block;
  font-size: 0.97rem;
  font-weight: 500;
  transition: font-size 160ms ease-out, font-weight 160ms ease-out, color 160ms ease-out, transform 160ms ease-out;
}
.toc-list a:hover {
  font-size: 1.03rem;
  font-weight: 700;
  color: var(--accent);
  transform: translateX(2px);
}
.toc-list a.is-active {
  color: var(--accent);
  font-weight: 700;
}
.toc-level-2 { padding-left: 12px; }
.toc-level-3, .toc-level-4, .toc-level-5, .toc-level-6 { padding-left: 24px; }

.prose { line-height: 1.8; min-width: 0; max-width: 100%; overflow-wrap: break-word; }
.prose h1, .prose h2, .prose h3 { letter-spacing: -0.03em; }
.prose img { max-width: 100%; border-radius: 16px; box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12); }
.prose :where(img, video, iframe, figure, table, pre) { max-width: 100%; }
.responsive-image {
  display: block;
  max-width: 100%;
  margin: 1.5rem 0;
}
.responsive-image img {
  width: 100%;
  height: auto;
}
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.4rem 0; }
.prose hr { border: none; height: 1px; background: linear-gradient(90deg, transparent, rgba(37,99,235,0.24), transparent); margin: 28px 0; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem 0.75rem 1.2rem;
  border-left: 3px solid rgba(37,99,235,0.45);
  background: rgba(37,99,235,0.05);
  border-radius: 0 14px 14px 0;
}
.prose pre {
  position: relative;
  overflow-x: auto;
  padding: 18px 18px 52px;
  background: linear-gradient(180deg, #111827, #0f172a);
  color: #f8fafc;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}
.prose code { background: rgba(37, 99, 235, 0.08); padding: 2px 6px; border-radius: 8px; font-variant-ligatures: none; }
.prose pre code { background: transparent; padding: 0; display: block; font-variant-ligatures: none; }
.broken-link { color: var(--danger); font-weight: 600; }

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 420ms cubic-bezier(.2,.7,.2,1) var(--reveal-delay, 0ms),
    transform 420ms cubic-bezier(.2,.7,.2,1) var(--reveal-delay, 0ms);
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.search-form, .stack-form, .auth-shell form { display: grid; gap: 14px; }
.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 18px;
}

input, textarea, select, button { font: inherit; }
input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.84);
  transition: border-color 180ms ease-out, box-shadow 180ms ease-out, background-color 180ms ease-out;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(37,99,235,0.38);
  box-shadow: 0 0 0 4px var(--ring-soft);
  background: white;
}
textarea { min-height: 120px; resize: vertical; }
.turnstile-lazy {
  min-height: 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.turnstile-lazy[data-turnstile-error="true"] {
  color: var(--danger);
}
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: white;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(37,99,235,0.18);
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, filter 180ms ease-out;
  position: relative;
  overflow: hidden;
}

button::before,
.button::before,
.nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(140px circle at var(--pointer-x, 50%) var(--pointer-y, 50%), rgba(255, 255, 255, 0.28), transparent 45%);
  opacity: 0;
  transition: opacity 180ms ease-out;
  pointer-events: none;
}
button:hover, .button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(37,99,235,0.24);
  filter: saturate(1.03);
}

button:hover::before,
.button:hover::before,
.nav-link:hover::before,
.nav-link.is-current::before {
  opacity: 1;
}
button.secondary, .button.secondary {
  background: rgba(255,255,255,0.82);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.auth-shell { max-width: 1040px; margin: 32px auto 48px; }
.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 24px;
  align-items: center;
}
.auth-copy h1 { font-size: clamp(2rem, 4vw, 3.5rem); margin: 10px 0; letter-spacing: -0.04em; }
.auth-panel { max-width: 430px; width: 100%; }
.account-shell { display: grid; gap: 24px; }
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.account-form-stack,
.account-status-panel {
  display: grid;
  gap: 16px;
}
.auth-switch {
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}
.auth-switch a {
  color: var(--primary);
  text-decoration: none;
}
.auth-switch a:hover {
  text-decoration: underline;
}
.account-panel { min-width: 0; }
.account-pill {
  display: grid;
  gap: 2px;
  min-width: 180px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(217,225,236,0.9);
}
.error-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(180,35,24,0.1);
  color: var(--danger);
}
.success-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
}

.admin-header, .polished-admin-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.admin-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.editor-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; }
.editor-textarea { min-height: 620px; font-family: "SFMono-Regular", ui-monospace, Menlo, monospace; }
.admin-panel-stack { display: grid; gap: 16px; }
.admin-form-hint { font-size: 0.92rem; }
.admin-banner { margin-bottom: 20px; }
.admin-users-grid,
.admin-user-detail-grid { align-items: start; }
.admin-empty-state { padding: 12px 0 4px; }
.admin-user-row { gap: 20px; align-items: center; }
.admin-user-copy { display: grid; gap: 12px; min-width: 0; }
.admin-user-metrics { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-user-pill { min-width: 132px; }
.admin-danger-zone { gap: 12px; }
.admin-danger-button {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  box-shadow: 0 14px 30px rgba(180, 35, 24, 0.18);
}
.admin-danger-button:hover {
  box-shadow: 0 18px 34px rgba(180, 35, 24, 0.24);
}
.compact { gap: 12px; }
.list-card.compact { align-items: center; }
.admin-note-row { background: rgba(255,255,255,0.62); }
.wide, .wide-editor { min-width: 0; }
.annotation-toolbar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.98);
  color: var(--text);
  border: 1px solid rgba(217,225,236,0.92);
  box-shadow: 0 20px 48px rgba(15,23,42,0.16);
  backdrop-filter: blur(16px);
}
.annotation-toolbar[hidden] {
  display: none;
}
.annotation-toolbar button,
.annotation-toolbar .button {
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: none;
}
.annotation-toolbar-button {
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: white;
}
.annotation-toolbar button.secondary {
  background: rgba(248,250,252,0.96);
  color: var(--text);
  border: 1px solid rgba(217,225,236,0.92);
}
.annotation-toolbar-button.danger {
  background: linear-gradient(135deg, var(--danger), #e53e3e);
  color: white;
}
.annotation-color-input {
  width: 42px;
  min-width: 42px;
  height: 42px;
}
.annotation-toolbar input[type="color"] {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(217,225,236,0.92);
  background: rgba(255,255,255,0.98);
  cursor: pointer;
}
.annotation-toolbar input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.annotation-toolbar input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}
.annotation-modal-shell[hidden] {
  display: none;
}
.annotation-modal-shell {
  position: fixed;
  inset: 0;
  z-index: 90;
}
.annotation-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.32);
  backdrop-filter: blur(8px);
}
.annotation-modal {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  margin: min(12vh, 96px) auto 0;
  display: grid;
  gap: 16px;
  padding: 24px;
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(217,225,236,0.92);
  box-shadow: 0 30px 80px rgba(15,23,42,0.22);
}
.annotation-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.annotation-modal-head h2 {
  margin: 6px 0 0;
}
.annotation-modal-quote {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(37,99,235,0.06);
  color: var(--muted);
  line-height: 1.6;
}
.annotation-modal-field {
  display: grid;
  gap: 8px;
}
.annotation-modal-field span {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
}
.annotation-modal textarea {
  min-height: 140px;
}
.annotation-visibility-select,
.annotation-modal-visibility {
  width: 100%;
  min-width: 0;
  background: rgba(255,255,255,0.98);
  color: var(--text);
}
.annotation-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.empty-state {
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(255,255,255,0.8);
  border: 1px dashed rgba(116,154,255,0.35);
  color: var(--muted);
}

.math-inline .katex {
  font-size: 1.04em;
}

.math-display,
.math-block {
  margin: 1.6rem 0;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(217, 225, 236, 0.9);
  overflow-x: auto;
}

.math-block {
  padding: 0.2rem 1rem;
}

.math-display .katex-display,
.math-block .katex-display {
  margin: 0;
}

/* 卡片指针追踪光效 */
.card::after,
.list-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px circle at var(--card-glow-x, 50%) var(--card-glow-y, 50%), rgba(37,99,235,0.06), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease-out;
  z-index: 0;
}
.card:hover::after,
.list-card:hover::after {
  opacity: 1;
}

/* 品牌标记悬浮动效 */
.brand-mark {
  transition: transform 300ms cubic-bezier(.2,.75,.2,1), box-shadow 300ms ease-out;
}
.brand:hover .brand-mark {
  transform: rotate(-6deg) scale(1.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.65), 0 8px 20px rgba(37,99,235,0.12);
}

/* 页面加载淡入 */
@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-shell {
  animation: page-enter 400ms cubic-bezier(.2,.7,.2,1) both;
}

@media (max-width: 980px) {
  .hero-grid,
  .admin-grid,
  .editor-grid,
  .auth-grid,
  .account-grid,
  .footer-row {
    grid-template-columns: 1fr;
  }

  .note-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "article"
      "sidebar"
      "rail";
  }

  .search-panel { grid-template-columns: 1fr; }
  .list-card, .note-hero { flex-direction: column; align-items: stretch; }
  .list-card-side { justify-content: flex-start; }
  .annotation-rail-card {
    position: relative;
    top: auto;
  }
  .annotation-comment-lane {
    min-height: 0;
    display: grid;
    gap: 12px;
  }
  .annotation-comment-card {
    position: relative;
    left: auto;
    right: auto;
    top: auto !important;
  }
  .hero-mascot-panel {
    min-height: 380px;
    --mascot-size: 110px;
  }

  .hero-panel-copy-block {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-beacon {
    display: none;
  }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .interactive-card:hover,
  .card:hover,
  .list-card:hover,
  .panel:hover,
  .note-card:hover,
  .sidebar-card:hover,
  .note-hero:hover,
  button:hover,
  .button:hover,
  .nav-link:hover {
    transform: none;
  }
}

/* Mobile Navigation Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 5px;
}

.nav-toggle-bar {
  display: block;
  width: 1.25rem;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: transform 200ms ease, opacity 200ms ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-links {
  position: fixed;
  top: 0;
  right: 0;
  padding: 16px calc((100vw - min(1140px, 100vw - 32px)) / 2 + 16px) 16px 16px;
  z-index: 25;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(280px, 85vw);
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    padding: 5rem 1.5rem 2rem;
    gap: 0.5rem;
    background: var(--surface-elevated);
    backdrop-filter: blur(20px);
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
    transform: translateX(100%);
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    overflow-y: auto;
  }

  .nav-links.is-open {
    transform: translateX(0);
  }

  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: 12px;
    flex-wrap: nowrap;
  }

  .nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease;
    z-index: 40;
  }

  .nav-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Audio Player */
.audio-player {
  margin: 1.5rem 0;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.audio-player-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.audio-play-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 200ms ease, transform 150ms ease;
}
.audio-play-btn:hover {
  background: #1d4ed8;
  transform: scale(1.05);
}
.audio-play-btn:active {
  transform: scale(0.95);
}
.audio-play-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.audio-play-btn .audio-icon-pause {
  display: none;
}
.audio-play-btn.is-playing .audio-icon-play {
  display: none;
}
.audio-play-btn.is-playing .audio-icon-pause {
  display: block;
}
.audio-play-btn svg * {
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.audio-icon-play path {
  fill: currentColor;
  stroke: none;
}
.audio-icon-pause rect {
  fill: currentColor;
  stroke: none;
}
.audio-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.audio-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audio-time {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.audio-progress-wrap {
  flex: 2;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.audio-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 100ms linear;
}
.audio-progress-wrap:hover .audio-progress-bar {
  background: #1d4ed8;
}

/* Video Player */
.video-player {
  margin: 1.8rem 0;
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.06), rgba(37, 99, 235, 0.08)),
    var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  contain: inline-size layout paint;
}
.video-player-frame {
  position: relative;
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  aspect-ratio: 16 / 9;
  max-block-size: min(68vh, 720px);
  background: #020617;
  overflow: hidden;
  /* 为控制条相对单位设置基准字体大小 */
  font-size: clamp(12px, 1.5vw, 14px);
}
/* 全屏样式适配 */
.video-player:fullscreen {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #000;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-player:fullscreen .video-player-frame {
  width: 100%;
  height: 100%;
  max-block-size: none;
  aspect-ratio: auto;
}
.video-player:fullscreen .video-player-media {
  object-fit: contain;
}
.video-player-media {
  position: absolute;
  inset: 0;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: 100%;
  max-block-size: 100%;
  min-inline-size: 0;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.video-danmaku-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.video-danmaku-item {
  position: absolute;
  left: 100%;
  top: var(--danmaku-top, 12%);
  max-width: 80%;
  white-space: nowrap;
  color: #fff;
  font-size: var(--danmaku-font-size, 1.25rem);
  font-weight: 800;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.55);
  animation: danmaku-fly 7.5s linear forwards;
}
@keyframes danmaku-fly {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-100vw - 100%)); }
}
.video-player-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.6em;
  padding: 0.8em;
  pointer-events: none;
  opacity: 0;
  transform: translateY(1em);
  transition: opacity 250ms ease-out, transform 250ms cubic-bezier(0.2, 0.7, 0.2, 1);
  /* 设置基准字体大小，相对于视频容器宽度 */
  font-size: clamp(10px, 2.2cqw, 15px);
}
.video-player.is-controls-visible .video-player-ui,
.video-player:not(.is-playing) .video-player-ui {
  opacity: 1;
  transform: translateY(0);
}
.video-player-ui > * {
  pointer-events: auto;
}
.video-controls {
  display: grid;
  /* 播放 | 进度 | 时间 | 音量 | 速度 | 字号 | 全屏 */
  grid-template-columns: auto minmax(2em, 1fr) auto auto auto auto auto;
  gap: 0.5em;
  align-items: center;
  padding: 0.6em 0.8em;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  color: #1f2937;
}
.video-control-button {
  min-width: 2.4em;
  min-height: 2.4em;
  padding: 0;
  border-radius: 0.75em;
  background: rgba(0, 174, 236, 0.08);
  box-shadow: none;
  color: #00a1d6;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-control-button::before { content: none; }
.video-control-button:hover { background: rgba(0, 174, 236, 0.15); }

.video-progress {
  height: 0.5em;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  cursor: pointer;
  position: relative;
}
.video-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #00a1d6;
}
.video-time {
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #475569;
}
.video-volume-control {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.85em;
  color: #475569;
}
.video-volume-control input[type="range"] {
  width: 4em;
  padding: 0;
  accent-color: #00a1d6;
}
.video-speed-select,
.video-danmaku-size-select {
  padding: 0.3em 0.5em;
  border-radius: 0.6em;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: transparent;
  color: #1f2937;
  font-size: 0.85em;
  cursor: pointer;
}
.video-fullscreen-button svg {
  width: 1.1em;
  height: 1.1em;
  stroke: currentColor;
  stroke-width: 2.2;
}
.video-danmaku-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5em;
  padding: 0.5em;
  border-radius: 1em;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  display: none; /* 默认隐藏，通过 .is-enabled 显示 */
}
.video-danmaku-form.is-enabled {
  display: grid;
}
.video-danmaku-color {
  width: 2.2em;
  height: 2.2em;
  padding: 0.2em;
  border-radius: 0.6em;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.video-danmaku-form input[type="text"] {
  height: 2.2em;
  padding: 0 0.8em;
  border-radius: 0.6em;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(0, 0, 0, 0.04);
  color: #1f2937;
}
.video-danmaku-form input[type="text"]::placeholder {
  color: #94a3b8;
}
.video-danmaku-form button {
  height: 2.2em;
  padding: 0 1em;
  border-radius: 0.6em;
  background: #00a1d6;
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}
.video-danmaku-login {
  align-self: flex-end;
  padding: 0.5em 1em;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 0.85em;
  backdrop-filter: blur(4px);
}
.video-load-button {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 0.8em 1.5em;
  border-radius: 1em;
  background: #00a1d6;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(0, 161, 214, 0.3);
  transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1), background-color 200ms ease, box-shadow 200ms ease;
}
.video-load-button::before {
  content: none;
}
.video-load-button:hover {
  transform: translate(-50%, -50%) scale(1.05);
  background: #00aeec;
  box-shadow: 0 15px 32px rgba(0, 161, 214, 0.4);
}
.video-load-button:active {
  transform: translate(-50%, -50%) scale(0.96);
}
.video-player.is-loaded .video-load-button {
  display: none;
}

.upload-progress-container {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.upload-progress-bar-bg {
  flex: 1;
  height: 6px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent-2);
  transition: width 0.2s ease;
}
.upload-progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-2);
  min-width: 3em;
  text-align: right;
}

@media (max-width: 640px) {
  .video-player-ui {
    padding: 0.4em;
    gap: 0.3em;
  }
  .video-controls {
    grid-template-columns: auto auto 1fr auto auto auto;
    grid-template-rows: auto auto;
    padding: 0.4em 0.6em;
    gap: 0.3em 0.5em;
  }
  .video-progress {
    grid-column: 1 / -1; /* 进度条占满首行 */
    order: -1;
    height: 0.4em;
    margin-bottom: 0.2em;
  }
  .video-play-toggle {
    grid-row: 2;
  }
  .video-time {
    grid-row: 2;
    font-size: 0.75em;
    padding: 0;
  }
  .video-volume-control {
    grid-row: 2;
    gap: 0.2em;
  }
  .video-volume-control input[type="range"] {
    width: 3em;
  }
  .video-speed-select,
  .video-danmaku-size-select {
    grid-row: 2;
    display: block;
    padding: 0.2em 0.3em;
    font-size: 0.75em;
    min-width: 0;
  }
  .video-fullscreen-button {
    grid-row: 2;
  }
}
