/* ============================================================
   萌新 MENGXIN · 教程站样式
   主题色改动点：--green / --green-dark
   ============================================================ */

:root {
  --green: #4f8a7b;
  --green-dark: #3d6f62;
  --green-soft: #e6f4f0;
  --green-line: #c8e5dd;

  --bg: #f3fbf8;
  --bg-alt: #edf7f3;
  --surface: #fbfffd;
  --surface-2: #e9f4f0;
  --border: #d7ebe4;
  --border-strong: #bfdcd3;

  --text: #213b34;
  --text-2: #3e5a51;
  --muted: #6f8a81;

  --code-bg: #0f1a15;
  --code-text: #e4efe8;
  --code-bar: #16241d;

  --amber: #a9762f;
  --red: #a33a2b;
  --shadow-sm: 0 1px 2px rgba(30, 80, 65, .06);
  --shadow-md: 0 8px 24px rgba(30, 80, 65, .10);
  --shadow-lg: 0 20px 50px rgba(30, 80, 65, .16);

  --radius: 10px;
  --radius-sm: 7px;
  --topbar-h: 60px;
  --maxw: 1320px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --green: #93dcc8;
  --green-dark: #6fc2ae;
  --green-soft: #1e4a3e;
  --green-line: #3f7a68;

  --bg: #19352d;
  --bg-alt: #142a23;
  --surface: #21443a;
  --surface-2: #2a5246;
  --border: #3c6a5c;
  --border-strong: #4f8172;

  --text: #f0f8f4;
  --text-2: #d4e8df;
  --muted: #a9c7bd;

  --code-bg: #08110c;
  --code-text: #dfeae3;
  --code-bar: #0d1912;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { color: var(--green); text-decoration: underline; }

img, svg, iframe { max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--green); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 10px; }

/* ---------------- 顶栏 ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(12px);
}

.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 18px;
}

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(140deg, var(--green), var(--green-dark));
  color: #fff; font-weight: 700; font-size: 17px;
  display: grid; place-items: center; letter-spacing: -.5px;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; font-weight: 700; font-size: 17px; }
.brand-text em {
  font-style: normal; font-size: 9px; letter-spacing: 2.4px;
  color: var(--muted); font-weight: 600;
}

.topnav { display: flex; gap: 4px; margin-left: 14px; }
.topnav a {
  padding: 6px 11px; border-radius: 8px; color: var(--text-2);
  font-size: 14px; font-weight: 500;
}
.topnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.topnav a.active { color: var(--green-dark); background: var(--green-soft); font-weight: 600; }
[data-theme="dark"] .topnav a.active { color: var(--green); }

.search-btn {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  min-width: 220px; padding: 7px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted); font-size: 13.5px;
}
.search-btn:hover { border-color: var(--green-line); color: var(--text-2); }
.search-ico { font-size: 16px; line-height: 1; }
.search-btn kbd {
  margin-left: auto; font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--border-strong); border-radius: 5px;
  padding: 0 5px; color: var(--muted); background: var(--surface);
}

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 9px;
  color: var(--text-2); font-size: 17px; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); text-decoration: none; color: var(--text); }
.menu-btn { display: none; }

.scroll-progress { height: 2px; background: transparent; }
.scroll-progress span {
  display: block; height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--green), #7bd6a4);
  transition: width .1s linear;
}

/* ---------------- 三栏布局 ---------------- */

.layout {
  max-width: var(--maxw); margin: 0 auto;
  display: grid; grid-template-columns: 252px minmax(0, 1fr) 220px;
  gap: 0; align-items: start;
}

.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar-inner { padding: 18px 12px 60px; }

.side-group { margin-bottom: 18px; }
.side-group h3 {
  margin: 0 0 6px; padding: 0 10px; font-size: 11.5px;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.side-link {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 7px; font-size: 13.5px;
  color: var(--text-2); border-left: 2px solid transparent;
}
.side-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.side-link.active {
  background: var(--green-soft); color: var(--green-dark);
  border-left-color: var(--green); font-weight: 600;
}
[data-theme="dark"] .side-link.active { color: var(--green); }

.side-badge {
  flex: none; width: 32px; height: 20px; border-radius: 4px;
  display: grid; place-items: center; font-size: 9.5px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); letter-spacing: .3px;
  border: 1px solid var(--border);
}
.side-link.active .side-badge { background: var(--green); color: #fff; border-color: var(--green); }

.side-chapters { margin: 2px 0 6px 20px; border-left: 1px dashed var(--border); padding-left: 8px; }
.side-chapters a {
  display: block; padding: 3px 6px; font-size: 12.5px; color: var(--muted);
  border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-chapters a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-chapters a.active { color: var(--green-dark); font-weight: 600; background: var(--green-soft); }

/* ---------------- 主内容 ---------------- */

.main { min-width: 0; padding: 26px 34px 80px; }

.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--green-dark); }
.breadcrumb span { margin: 0 6px; opacity: .6; }

.article { max-width: 840px; }

.article > h1 {
  margin: 0 0 6px; font-size: 30px; line-height: 1.3; letter-spacing: -.4px;
}
.chapter-meta { margin: 0 0 22px; color: var(--muted); font-size: 12.5px; }

.article h2 {
  margin: 34px 0 12px; padding-left: 12px; font-size: 21px; line-height: 1.4;
  border-left: 4px solid var(--green); border-radius: 2px;
}
.article h3 { margin: 24px 0 8px; font-size: 17px; }
.article p { margin: 0 0 12px; }
.article ul, .article ol { margin: 0 0 14px; padding-left: 22px; }
.article li { margin: 4px 0; }
.article strong { color: var(--text); }

.article code:not(pre code) {
  font-family: var(--mono); font-size: 12.8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; color: var(--green-dark);
}
[data-theme="dark"] .article code:not(pre code) { color: var(--green); }

.code-block {
  position: relative; margin: 16px 0 20px;
  background: var(--code-bg); border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .06);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.code-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; background: var(--code-bar);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  font-family: var(--mono); font-size: 11px; color: #8ea99a;
  text-transform: uppercase; letter-spacing: .8px;
}
.code-dots { display: flex; gap: 5px; }
.code-dots i { width: 8px; height: 8px; border-radius: 50%; background: #3a4b41; display: block; }
.code-copy {
  margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,.14);
  color: #a8c2b2; border-radius: 5px; font-size: 10.5px; padding: 2px 8px;
  font-family: var(--mono); letter-spacing: .5px;
}
.code-copy:hover { background: rgba(255,255,255,.08); color: #fff; }
.code-block pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.65; color: var(--code-text);
  tab-size: 2;
}
.code-block code { font: inherit; white-space: pre; }

.tk-com { color: #6f8b7c; font-style: italic; }
.tk-str { color: #a8d58f; }
.tk-kw { color: #8fb8ff; }
.tk-num { color: #f0b37e; }
.tk-fn { color: #d9c48f; }
.tk-tag { color: #7fd1c2; }
.tk-attr { color: #c9d78f; }
.tk-prop { color: #8fb8ff; }

.article table {
  width: 100%; border-collapse: collapse; margin: 16px 0 20px;
  font-size: 13.5px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.article th, .article td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.article th { background: var(--surface-2); font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.article tr:last-child td { border-bottom: none; }

.note {
  margin: 16px 0; padding: 12px 15px; border-radius: var(--radius);
  background: var(--green-soft); border-left: 3px solid var(--green);
  font-size: 14px;
}
.note.warn { background: #fff7e6; border-left-color: #e0a100; }
[data-theme="dark"] .note.warn { background: #2a2213; }

.chapter-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border);
}
.chapter-nav a {
  display: block; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  transition: border-color .15s, transform .15s;
}
.chapter-nav a:hover { border-color: var(--green); text-decoration: none; transform: translateY(-1px); }
.chapter-nav .dir { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.chapter-nav .ttl { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.chapter-nav a.next { text-align: right; }

/* ---------------- 右侧目录 ---------------- */

.toc { position: sticky; top: var(--topbar-h); max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; }
.toc-inner { padding: 30px 16px 40px 8px; border-left: 1px solid var(--border); }
.toc h3 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: 1.2px; color: var(--muted); text-transform: uppercase; }
.toc a {
  display: block; padding: 3px 0 3px 10px; font-size: 12.5px; color: var(--muted);
  border-left: 2px solid transparent; margin-left: -6px; line-height: 1.5;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--green-dark); border-left-color: var(--green); font-weight: 600; }
.toc a.lvl3 { padding-left: 22px; font-size: 12px; }
[data-theme="dark"] .toc a.active { color: var(--green); }
.toc.empty { display: none; }

/* ---------------- 首页 ---------------- */

.hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 40px; align-items: center;
  padding: 44px 0 38px; border-bottom: 1px solid var(--border);
}
.hero .pill {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-dark);
  font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px;
  border: 1px solid var(--green-line);
}
[data-theme="dark"] .hero .pill { color: var(--green); }
.hero h1 {
  margin: 14px 0 12px; font-size: 40px; line-height: 1.22;
  letter-spacing: -1px; font-weight: 800;
}
.hero h1 em { font-style: normal; color: var(--green); }
.hero p.lead { margin: 0 0 22px; color: var(--text-2); font-size: 15.5px; max-width: 46ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-size: 14px;
  font-weight: 600; text-decoration: none;
}
.btn:hover { border-color: var(--green); color: var(--green-dark); text-decoration: none; }
.btn.primary {
  background: linear-gradient(140deg, var(--green), var(--green-dark));
  border-color: transparent; color: #fff; box-shadow: var(--shadow-sm);
}
.btn.primary:hover { filter: brightness(1.06); color: #fff; text-decoration: none; }
.btn.ghost { background: transparent; }

.hero-stats { display: flex; gap: 22px; margin-top: 26px; color: var(--muted); font-size: 12.5px; }
.hero-stats b { display: block; font-size: 19px; color: var(--text); font-weight: 700; }

.hero-card {
  background: var(--code-bg); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.07);
  transform: perspective(1200px) rotateY(-3deg) rotateX(2deg);
}
.hero-card .bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 13px;
  background: var(--code-bar); border-bottom: 1px solid rgba(255,255,255,.06);
}
.hero-card .bar i { width: 9px; height: 9px; border-radius: 50%; background: #3d5045; }
.hero-card .bar span { margin-left: 6px; font-family: var(--mono); font-size: 11px; color: #7f9a8b; }
.hero-card pre {
  margin: 0; padding: 18px; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.7; color: #cfe4d8; overflow-x: auto;
}

.section { padding: 36px 0 6px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -.3px; }
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }

.tutorial-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 14px; }

.tut-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 17px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  color: var(--text);
}
.tut-card:hover {
  text-decoration: none; border-color: var(--green-line);
  transform: translateY(-2px); box-shadow: var(--shadow-md);
}
.tut-card .top { display: flex; align-items: center; gap: 10px; }
.tut-badge {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  background: var(--green-soft); color: var(--green-dark); border: 1px solid var(--green-line);
}
[data-theme="dark"] .tut-badge { color: var(--green); }
.tut-card h3 { margin: 0; font-size: 15.5px; }
.tut-card .meta { font-size: 11.5px; color: var(--muted); }
.tut-card p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.6; flex: 1; }
.tut-card .more { font-size: 12px; color: var(--green-dark); font-weight: 600; }
[data-theme="dark"] .tut-card .more { color: var(--green); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.feature {
  padding: 18px; border-radius: 12px; background: var(--bg-alt);
  border: 1px solid var(--border);
}
.feature h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.feature p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.65; }
.feature .ico { font-size: 17px; }

/* ---------------- 教程列表页 ---------------- */

.page-head { padding: 20px 0 22px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.5px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; }

.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 22px; }
.chip {
  padding: 5px 13px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
}
.chip:hover { border-color: var(--green-line); color: var(--green-dark); }
.chip.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }

/* ---------------- 音乐台 ---------------- */

.music-head {
  position: relative; overflow: hidden;
  padding: 30px 28px; border-radius: 16px; margin-bottom: 22px;
  background: linear-gradient(135deg, #123a28, #1d6b45 55%, #2f9e5e);
  color: #fff; box-shadow: var(--shadow-md);
}
.music-head::after {
  content: "♫"; position: absolute; right: 18px; bottom: -34px;
  font-size: 150px; opacity: .10; line-height: 1;
}
.music-head h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.5px; }
.music-head p { margin: 0; max-width: 62ch; color: rgba(255,255,255,.85); font-size: 13.5px; }
.music-head .head-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.music-head .head-tags span {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
}

.music-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.music-tab {
  padding: 9px 14px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: -1px;
}
.music-tab:hover { color: var(--text); }
.music-tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
[data-theme="dark"] .music-tab.active { color: var(--green); }

.panel { margin-bottom: 26px; }
.panel-sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

.embed-builder {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 14px; background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.embed-builder label { font-size: 12.5px; color: var(--muted); }
.embed-builder select, .embed-builder input, .cfg-form input {
  padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13.5px; outline: none;
}
.embed-builder input { min-width: 200px; }
.embed-builder input:focus, .cfg-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.embed-stage {
  margin-top: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 18px; display: grid; place-items: center; min-height: 130px;
  background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center;
}
.embed-stage iframe { border: 0; border-radius: 8px; background: #fff; }
.embed-note { margin-top: 10px; font-size: 12px; color: var(--muted); }

.playlist-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.playlist-table th, .playlist-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.playlist-table th { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.playlist-table tr:hover td { background: var(--surface-2); }
.playlist-table .num { color: var(--muted); font-family: var(--mono); font-size: 12px; width: 34px; }
.pl-title { display: flex; align-items: center; gap: 9px; }
.pl-play {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 10px; display: grid; place-items: center; color: var(--text-2);
}
.pl-play:hover { background: var(--green); color: #fff; border-color: var(--green); }
.demo-tag {
  font-size: 10px; color: var(--amber); border: 1px solid currentColor;
  padding: 0 5px; border-radius: 4px; margin-left: 6px;
}
.pl-del {
  background: none; border: none; color: var(--muted); font-size: 13px;
}
.pl-del:hover { color: var(--red); }

.add-form {
  display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 8px;
  margin-top: 14px; padding: 14px; background: var(--bg-alt);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.add-form input {
  padding: 7px 10px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface); font-size: 13px; outline: none; min-width: 0;
}
.add-form input:focus { border-color: var(--green); }

/* 在线搜索 */
.source-chips { display: flex; gap: 6px; margin-bottom: 10px; }
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar input {
  flex: 1; min-width: 0; padding: 9px 12px; font-size: 14px; outline: none;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text);
}
.search-bar input:focus, .import-bar input:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft);
}
.song-list {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; max-height: 470px; overflow-y: auto;
}
.song-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 13px; border-bottom: 1px solid var(--border);
}
.song-row:last-child { border-bottom: none; }
.song-row:hover { background: var(--surface-2); }
.song-index { width: 24px; flex: none; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.song-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.45; }
.song-info b {
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-info small {
  font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-actions { display: flex; gap: 6px; flex: none; }
.mini-btn {
  padding: 4px 10px; border-radius: 6px; font-size: 11.5px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
}
.mini-btn:hover { border-color: var(--green); color: var(--green-dark); }
.mini-btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.list-empty { margin: 0; padding: 24px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.import-bar { display: flex; gap: 8px; margin-top: 12px; }
.import-bar input {
  flex: 1; min-width: 0; padding: 9px 12px; font-size: 13px; outline: none;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--surface); color: var(--text);
}
@media (max-width: 560px) {
  .search-bar, .import-bar { flex-direction: column; }
  .song-actions { flex-direction: column; }
  .mini-btn { padding: 3px 8px; }
}

.account-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  padding: 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-alt);
}
.account-card .acc-icon { font-size: 30px; line-height: 1; }
.account-card h3 { margin: 0 0 3px; font-size: 15px; }
.account-card p { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 60ch; }
.account-card .btn { margin-left: auto; }

/* 联系站主 */
.contact-head .pill { display: inline-block; margin-bottom: 10px; }
.contact-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px; margin: 18px 0 22px;
}
.contact-card {
  padding: 22px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.contact-ico {
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 10px;
  display: grid; place-items: center; font-weight: 700;
  background: var(--green-soft); color: var(--green-dark);
  border: 1px solid var(--green-line);
}
.contact-card h2 { margin: 0 0 6px; font-size: 16px; }
.contact-account {
  margin: 0 0 14px; font-family: var(--mono); font-size: 20px;
  letter-spacing: .5px; color: var(--text); user-select: all;
}

/* ---------------- 播放器 ---------------- */

.player-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 -6px 24px rgba(10, 30, 20, .10);
  animation: player-in .22s ease-out;
}
@keyframes player-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.player-inner {
  max-width: var(--maxw); margin: 0 auto; height: 68px; padding: 0 16px;
  display: flex; align-items: center; gap: 18px;
}
.player-meta { display: flex; align-items: center; gap: 10px; min-width: 0; width: 240px; }
.disc {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 50% 50%, #0d1912 0 22%, #2f9e5e 23% 58%, #16301f 59%);
  display: grid; place-items: center; color: #fff; font-size: 15px;
  animation: spin 8s linear infinite; animation-play-state: paused;
}
.disc.spinning { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-titles { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.player-titles strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-titles span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-controls { display: flex; align-items: center; gap: 6px; }
.pbtn {
  background: transparent; border: none; color: var(--text-2);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-size: 14px;
}
.pbtn:hover { background: var(--surface-2); color: var(--text); }
.pbtn-play {
  width: 40px; height: 40px; background: var(--green); color: #fff; font-size: 14px;
}
.pbtn-play:hover { background: var(--green-dark); color: #fff; }
.pbtn-mode { width: auto; padding: 0 10px; font-size: 11.5px; border-radius: 999px; border: 1px solid var(--border); }

.player-progress { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 120px; }
.player-progress span { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px;
  background: var(--border-strong); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--green);
}
input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px; border-radius: 50%; background: var(--green); border: none;
}
#seek { flex: 1; }
#volume { width: 88px; }

.player-extra { display: flex; align-items: center; gap: 8px; }

/* ---------------- 遮罩 / 弹窗 ---------------- */

.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 22, 15, .45);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px;
}
.overlay[hidden] { display: none; }

.search-modal {
  width: min(680px, 100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop-in .16s ease-out;
}
@keyframes pop-in { from { transform: translateY(-6px) scale(.99); opacity: 0; } }

.search-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search-input-row input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 16px; color: var(--text);
}
.kbd-btn {
  font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--muted); border-radius: 5px; padding: 3px 7px;
}
.search-results { max-height: 58vh; overflow-y: auto; padding: 8px; }
.search-group-title { font-size: 11px; color: var(--muted); letter-spacing: 1px; padding: 8px 10px 4px; text-transform: uppercase; }
.search-item { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border-radius: 8px; color: var(--text); }
.search-item:hover, .search-item.active { background: var(--green-soft); text-decoration: none; }
.search-item .s-badge {
  font-family: var(--mono); font-size: 9.5px; padding: 2px 6px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.search-item .s-main { display: flex; flex-direction: column; min-width: 0; }
.search-item .s-main b { font-size: 13.5px; font-weight: 600; }
.search-item .s-main small { font-size: 11.5px; color: var(--muted); }
.search-empty { padding: 26px 12px; text-align: center; color: var(--muted); font-size: 13px; }

.modal {
  position: relative; width: min(620px, 100%); max-height: 84vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); padding: 26px 26px 24px;
  animation: pop-in .16s ease-out;
}
.modal h2 { margin: 0 0 4px; font-size: 21px; }
.modal-sub { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  color: var(--muted);
}
.modal-close:hover { color: var(--text); border-color: var(--border-strong); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 8px 12px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 600; margin-bottom: -1px;
}
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); }
[data-theme="dark"] .tab.active { color: var(--green); }

.tab-panel { font-size: 13.5px; color: var(--text-2); }
.tab-panel p { margin: 0 0 10px; }
.tab-panel.hidden { display: none; }
.check-list { margin: 0 0 16px; padding-left: 20px; font-size: 13px; color: var(--muted); }
.check-list li { margin: 3px 0; }

.cfg-form { display: flex; flex-direction: column; gap: 10px; }
.cfg-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.cfg-form input { width: 100%; }
.form-hint { margin: 0; font-size: 11.5px; color: var(--muted); }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cfg-status { font-size: 12px; color: var(--green-dark); }
.mini-code {
  margin: 14px 0 0; padding: 10px 12px; background: var(--code-bg); color: #9fc4ad;
  border-radius: 8px; font-family: var(--mono); font-size: 11px; overflow-x: auto;
}

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: #14251c; color: #e8f5ec; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; z-index: 120; box-shadow: var(--shadow-md);
  animation: pop-in .15s ease-out;
}
.toast[hidden] { display: none; }

/* ---------------- 页脚 / 滚动条 ---------------- */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); margin-top: 20px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 22px 18px 90px; }
.site-footer p { margin: 0 0 4px; font-size: 12.5px; color: var(--text-2); }
.site-footer .footer-dim { color: var(--muted); font-size: 11.5px; }

.sidebar::-webkit-scrollbar, .toc::-webkit-scrollbar, .search-results::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb, .toc::-webkit-scrollbar-thumb, .search-results::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 999px;
}
.sidebar::-webkit-scrollbar-track, .toc::-webkit-scrollbar-track { background: transparent; }

.scrim { position: fixed; inset: 0; background: rgba(8, 18, 13, .45); z-index: 55; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
  .main { padding: 24px 26px 80px; }
}

@media (max-width: 900px) {
  .topnav { display: none; }
  .menu-btn { display: grid; }
  .search-btn { min-width: 0; padding: 7px 10px; }
  .search-btn .search-label, .search-btn kbd { display: none; }
  .layout { display: block; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 58;
    width: 272px; height: auto; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { padding: 20px 18px 90px; }
  .hero { grid-template-columns: 1fr; gap: 26px; padding: 26px 0 30px; }
  .hero h1 { font-size: 31px; }
  .hero-card { transform: none; }
  .hero-stats { gap: 16px; }
  .player-meta { width: auto; flex: 1; min-width: 0; }
  .player-progress { display: none; }
  .player-extra #volume { display: none; }
  .add-form { grid-template-columns: 1fr 1fr; }
  .add-form input[type="url"] { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .brand-text em { display: none; }
  .article > h1 { font-size: 24px; }
  .article h2 { font-size: 18.5px; }
  .hero h1 { font-size: 27px; }
  .player-bar .player-controls { gap: 0; }
  .player-extra .pbtn-mode { display: none; }
  .chapter-nav { grid-template-columns: 1fr; }
  .playlist-table th:nth-child(2), .playlist-table td:nth-child(2) { display: none; }
}

/* ============================================================
   动态视觉层
   统一使用绿 / 薄荷 / 青三色，动画均为低幅度、长周期。
   ============================================================ */

body {
  overflow-x: hidden;
  background-image:
    radial-gradient(1100px 520px at 82% -8%, rgba(47, 158, 94, .07), transparent 62%),
    radial-gradient(900px 460px at 4% 8%, rgba(127, 209, 194, .07), transparent 60%);
  background-repeat: no-repeat;
}

::selection { background: rgba(47, 158, 94, .22); }

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

.layout, .site-footer { position: relative; z-index: 1; }

/* 顶栏滚动态 */
.topbar { transition: box-shadow .28s ease, background .28s ease; }
.topbar.scrolled { box-shadow: 0 8px 26px -14px rgba(16, 40, 28, .45); }
[data-theme="dark"] .topbar.scrolled { box-shadow: 0 8px 30px -12px rgba(0, 0, 0, .85); }

/* 导航下划线 */
.topnav a { position: relative; }
.topnav a::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, var(--green), #7bd6a4);
  transform: scaleX(0); transform-origin: left; transition: transform .24s ease;
}
.topnav a:hover::after, .topnav a.active::after { transform: scaleX(1); }

/* 首页极光 */
.hero { position: relative; isolation: isolate; }
.aurora { position: absolute; inset: -70px -30px; z-index: -1; pointer-events: none; overflow: hidden; }
.aurora i {
  position: absolute; display: block; border-radius: 50%; filter: blur(58px);
  opacity: .55; will-change: transform;
}
.aurora i:nth-child(1) { width: 340px; height: 340px; background: #9be7bd; top: -70px; left: -40px; animation: drift-a 19s ease-in-out infinite; }
.aurora i:nth-child(2) { width: 300px; height: 300px; background: #7fd1c2; bottom: -110px; right: 8%; animation: drift-b 23s ease-in-out infinite; }
.aurora i:nth-child(3) { width: 250px; height: 250px; background: #dcf5c7; top: 18%; right: -70px; animation: drift-c 27s ease-in-out infinite; }
[data-theme="dark"] .aurora i { opacity: .2; }

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(46px, 28px, 0) scale(1.08); }
}
@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-52px, -24px, 0) scale(1.1); }
}
@keyframes drift-c {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-30px, 34px, 0) scale(1.06); }
}

.hero > div:not(.aurora) { position: relative; z-index: 1; }

/* 标题渐变流动 */
.hero h1 em {
  background: linear-gradient(100deg, var(--green) 0%, #6fd3a0 32%, #2fa88a 58%, var(--green) 100%);
  background-size: 240% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: grad-pan 8s ease-in-out infinite;
}
@keyframes grad-pan {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* 代码卡轻浮 */
.hero-card {
  animation: floaty 8s ease-in-out infinite;
  box-shadow: 0 34px 70px -28px rgba(47, 158, 94, .55), var(--shadow-lg);
}
@keyframes floaty {
  0%, 100% { transform: perspective(1200px) rotateY(-3deg) rotateX(2deg) translateY(0); }
  50% { transform: perspective(1200px) rotateY(-1.5deg) rotateX(1deg) translateY(-9px); }
}

/* 滚动入场 */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity .55s ease, transform .55s cubic-bezier(.22, .8, .3, 1);
  transition-delay: var(--d, 0ms);
}

/* 卡片聚光 + 悬停 */
.tut-card, .feature { position: relative; overflow: hidden; }
.tut-card::before, .feature::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), rgba(47, 158, 94, .16), transparent 62%);
  transition: opacity .25s ease;
}
.tut-card:hover::before, .feature:hover::before { opacity: 1; }
.tut-card .top, .tut-card p, .tut-card .more, .feature > * { position: relative; }
.tut-card:hover .tut-badge { transform: rotate(-4deg) scale(1.05); }
.tut-badge { transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }

/* 按钮扫光 */
.btn { position: relative; overflow: hidden; }
.btn.primary::after {
  content: ""; position: absolute; top: 0; left: -130%; width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-18deg); transition: left .6s ease; pointer-events: none;
}
.btn.primary:hover::after { left: 140%; }

/* 代码块 */
.code-block { transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.code-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -16px rgba(8, 22, 15, .7);
  border-color: rgba(123, 214, 164, .28);
}

/* 右侧目录高亮块 */
.toc a { transition: color .18s ease, background .18s ease; border-radius: 0 6px 6px 0; }
.toc a.active { background: linear-gradient(90deg, var(--green-soft), transparent 92%); }

/* 页面切换 */
@keyframes page-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
.main.page-in { animation: page-in .38s cubic-bezier(.22, .8, .3, 1); }

/* 音乐台渐变呼吸 */
.music-head {
  background-size: 180% 180%;
  animation: gradient-pan 14s ease-in-out infinite;
}
.music-head h1 { text-shadow: 0 2px 18px rgba(0, 0, 0, .18); }

/* 播放器均衡器 */
.eq { display: flex; align-items: flex-end; gap: 2.5px; height: 18px; width: 16px; flex: none; }
.eq span {
  display: block; width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, #7bd6a4, var(--green));
  height: 30%; animation: eq-bounce 1.05s ease-in-out infinite;
}
.eq span:nth-child(2) { animation-delay: .18s; }
.eq span:nth-child(3) { animation-delay: .36s; }
.eq span:nth-child(4) { animation-delay: .54s; }
.eq.paused span { animation-play-state: paused; height: 22%; opacity: .5; }
@keyframes eq-bounce {
  0%, 100% { height: 24%; }
  50% { height: 100%; }
}

/* 唱片外圈呼吸 */
.disc.spinning { box-shadow: 0 0 0 0 rgba(47, 158, 94, .35); animation: spin 8s linear infinite, disc-pulse 2.4s ease-out infinite; }
@keyframes disc-pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 158, 94, .35); }
  70% { box-shadow: 0 0 0 10px rgba(47, 158, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 158, 94, 0); }
}

/* 光标光晕 */
.cursor-glow {
  position: fixed; left: 0; top: 0; width: 420px; height: 420px; z-index: 0;
  margin: -210px 0 0 -210px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(47, 158, 94, .10), transparent 62%);
  opacity: 0; transition: opacity .4s ease; will-change: transform;
}
.cursor-glow.on { opacity: 1; }
[data-theme="dark"] .cursor-glow { background: radial-gradient(circle, rgba(69, 192, 122, .12), transparent 62%); }

/* 回到顶部 */
.backtop {
  position: fixed; right: 20px; bottom: 24px; z-index: 66;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); box-shadow: var(--shadow-md);
  display: grid; place-items: center; padding: 0;
  opacity: 0; transform: translateY(12px) scale(.94); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, border-color .2s ease, bottom .25s ease;
}
.backtop.show { opacity: 1; transform: none; pointer-events: auto; }
.backtop:hover { border-color: var(--green); color: var(--green-dark); }
.backtop-arrow { font-size: 16px; line-height: 1; position: relative; z-index: 1; }
.backtop-ring {
  position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--p, 0) * 1%), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}
body.player-open .backtop { bottom: 88px; }

/* 弹层动画 */
.overlay { animation: overlay-in .2s ease; }
@keyframes overlay-in { from { opacity: 0; } }

/* 音符悬浮（音乐台装饰） */
.music-head::before {
  content: ""; position: absolute; inset: -40%; pointer-events: none;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .16), transparent 45%);
  animation: drift-b 18s ease-in-out infinite;
}

/* 触摸设备 / 窄屏关闭光标光晕 */
@media (hover: none), (pointer: coarse) {
  .cursor-glow { display: none; }
}

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

/* 移动端抽屉导航（≤900px 顶栏导航隐藏时使用） */
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .mobile-nav {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 12px 12px 2px;
  }
  .mobile-nav a {
    flex: 1 1 auto; text-align: center; padding: 9px 10px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); font-size: 13.5px; color: var(--text);
  }
  .mobile-nav a:hover { text-decoration: none; border-color: var(--green); }
  .mobile-nav a.active {
    color: var(--green-dark); background: var(--green-soft);
    border-color: transparent; font-weight: 600;
  }
  [data-theme="dark"] .mobile-nav a.active { color: var(--green); }
}
