/* nav 首页样式 — light/dark via <html data-theme>，参考 van-nav 观感 */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f1f3;
  --text: #1f2329; --text-2: #646a73; --border: #e5e6eb;
  --primary: #2932e1; --primary-soft: #eef0ff;
  --warn: #d9303e; --warn-border: #f3c3c7;
  --note-cyan: #009688;   /* 个人笔记「⋯/G」按钮色（青色，区别于主色蓝紫） */
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.12);
  --radius: 10px;
}
html[data-theme="dark"] {
  --bg: #141416; --surface: #1f1f23; --surface-2: #2a2a30;
  --text: #e8e8ea; --text-2: #9aa0a6; --border: #33333a;
  --primary: #5b6cff; --primary-soft: #2a2f5a;
  --warn: #e05a64; --warn-border: #5a3038;
  --note-cyan: #26a69a;   /* 暗色下青色提亮一档保对比度 */
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
.inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ── 顶部通栏菜单（默认展开，前后台同构；include _menu.html）── */
.menu-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow); }
.menu-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; }
.menu-nav a { padding: 5px 13px; border-radius: 999px; font-size: 13px;
  color: var(--text-2); text-decoration: none; white-space: nowrap; transition: all .15s; }
.menu-nav a:hover { color: var(--primary); background: var(--primary-soft); }
.menu-nav a.active { color: #fff; background: var(--primary); }
.menu-sep { width: 1px; height: 16px; margin: 0 6px; background: var(--border); }
.menu-bar-right { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.menu-login { font-size: 12px; color: var(--text-2); text-decoration: none;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); }
.menu-login:hover { color: var(--primary); border-color: var(--primary); }
.menu-login.logout { color: #d9303e; }
.menu-login.logout:hover { border-color: #d9303e; }

/* ── 顶栏：搜索 + 分类 ── */
/* 顶部有 fixed .menu-bar（约 42px），搜索区整体下移避让 */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: 64px; }
.topbar .inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.search { width: 100%; max-width: 640px; }
.search input {
  width: 100%; height: 46px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 15px; outline: none; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tag-selector { width: 100%; max-width: 980px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tag {
  padding: 5px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border);
  transition: all .15s; user-select: none;
}
.tag:hover { color: var(--primary); border-color: var(--primary); }
.tag.active { color: #fff; background: var(--primary); border-color: var(--primary); }

/* ── 卡片网格 ── */
.content-wraper { padding: 24px 0 80px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card-box {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none;
  color: var(--text); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.card-left { flex: 0 0 auto; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.card-left img { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; }
.logo-badge { width: 32px; height: 32px; border-radius: 6px; color: #fff; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; }
.card-right { flex: 1 1 auto; min-width: 0; }
.card-right-top { display: flex; align-items: center; gap: 8px; }
.card-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-tag { flex: 0 0 auto; font-size: 11px; color: var(--text-2); background: var(--surface-2);
  padding: 1px 7px; border-radius: 4px; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc { margin-top: 4px; font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-index { position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--text-2);
  background: var(--surface-2); border-radius: 4px; padding: 0 5px; }
.card-box.engine { border-left: 3px solid var(--primary); }

/* ── 卡片右下角「个人笔记」圆圈按钮（M=已有笔记；G=管理员创建笔记）── */
.card-note-btn { position: absolute; right: 7px; bottom: 5px; width: 22px; height: 22px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; line-height: 1; color: var(--text-2); background: var(--surface-2);
  cursor: pointer; opacity: .5; transition: opacity .15s, background .15s, color .15s;
  user-select: none; }
.card-box:hover .card-note-btn { opacity: .9; }
/* M：常态即青色字母（已有笔记，内容入口），hover 加深不填充 */
.card-note-btn { color: var(--note-cyan); }
.card-note-btn:hover { opacity: 1; }
/* 「G」创建按钮：与 M 互斥同位；灰色弱化（创建入口），hover 仅加深仍灰（显式覆盖 M 的青色） */
.card-note-btn.card-note-create { opacity: .5; color: var(--text-2); }
.card-note-btn.card-note-create:hover { opacity: 1; color: var(--text-2); }

/* ── 备案 + 浮动按钮 ── */
/* 备案固定左下角（对照主页 dmego 的 .beian 定位），ICP 与公安备案并排 */
.record-wraper { position: fixed; left: 12px; bottom: 10px; z-index: 25;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 70vw; }
.record-wraper a { color: var(--text-2); font-size: 12px; text-decoration: none; opacity: .75; }
.record-wraper a:hover { color: var(--primary); opacity: 1; }
.float-btn { position: fixed; right: 24px; z-index: 30; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 18px; box-shadow: var(--shadow); transition: transform .15s; }
.float-btn:hover { transform: scale(1.08); }
#theme-toggle { bottom: 24px; }
#jump-toggle { bottom: 76px; }
#jump-toggle.self { opacity: .55; }

/* ── 登录页 ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 340px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-hover); padding: 32px 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; color: var(--text); }
.login-sub { margin: 0 0 18px; font-size: 13px; color: var(--text-2); }
.login-error { margin: 0 0 12px; font-size: 13px; color: #d9303e; }
.login-card label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 14px; }
.login-card label input { display: block; width: 100%; height: 38px; margin-top: 5px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 14px; outline: none; }
.login-card label input:focus { border-color: var(--primary); }
.login-btn { width: 100%; height: 38px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 14px; }
.login-btn:hover { opacity: .92; }
.login-back { display: block; margin-top: 16px; text-align: center; font-size: 12px;
  color: var(--text-2); text-decoration: none; }
.login-back:hover { color: var(--primary); }

/* ── 视频收藏页：bilibili 风格封面卡片 ── */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.v-card { position: relative; display: block; text-decoration: none; color: var(--text);
  transition: transform .15s; }
.v-card:hover { transform: translateY(-3px); }
.v-cover { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius);
  overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow); }
.v-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-card:hover .v-cover { box-shadow: var(--shadow-hover); }
.v-title-row { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-right: 4px; }
.v-title { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 500; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v-note-btn { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; line-height: 1;
  color: var(--text-2); background: var(--surface-2); cursor: pointer; opacity: .5;
  transition: opacity .15s, background .15s, color .15s; user-select: none; }
.v-card:hover .v-note-btn { opacity: .9; }
/* M：常态即青色字母（与工具卡片同语义），hover 加深不填充 */
.v-note-btn { color: var(--note-cyan); }
.v-note-btn:hover { opacity: 1; }
/* 「G」创建按钮（管理员）：与 M 互斥同位，灰色弱化，hover 仅加深仍灰（显式覆盖 M 的青色） */
.v-note-btn.v-note-create { opacity: .5; color: var(--text-2); }
.v-note-btn.v-note-create:hover { opacity: 1; color: var(--text-2); }
.v-meta { margin-top: 4px; }
.v-cate { font-size: 11px; color: var(--text-2); background: var(--surface-2);
  padding: 1px 7px; border-radius: 4px; }

@media (max-width: 600px) {
  .topbar { padding-top: 88px; }   /* 窄屏菜单折两行，多让一截 */
  .cards { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .record-wraper { max-width: 60vw; flex-direction: column; align-items: flex-start; gap: 2px; }
}
