/* ============================================================
   Linplayer 插件市场 —— 视觉层（叠加在 layui 之上）
   跟随系统：浅色为默认，prefers-color-scheme: dark 覆写。
   layui 仅用 element(Tab) + layer(弹窗)；卡片/按钮/徽章用自有类，便于双主题与动效。
   ============================================================ */

:root {
  --animate-duration: 600ms;

  --bg: #eef2f9;
  --glow-1: rgba(34, 197, 94, 0.14);
  --glow-2: rgba(59, 130, 246, 0.12);
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-soft: rgba(15, 23, 42, 0.035);
  --elev: rgba(15, 23, 42, 0.05);
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --muted: #5b6577;
  --brand: #16a34a;
  --brand-ink: #04130a;
  --brand-soft: rgba(34, 197, 94, 0.14);
  --brand-grad: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  --accent: #2563eb;
  --danger: #e11d48;
  --shadow: 0 1px 2px rgba(20, 40, 80, 0.06), 0 12px 30px rgba(20, 40, 80, 0.1);
  --shadow-hover: 0 2px 6px rgba(20, 40, 80, 0.12), 0 24px 52px rgba(22, 120, 70, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Segoe UI Variable Text", "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090e1a;
    --glow-1: rgba(34, 197, 94, 0.16);
    --glow-2: rgba(56, 189, 248, 0.12);
    --surface: rgba(19, 26, 43, 0.72);
    --surface-solid: #121a2b;
    --surface-soft: rgba(255, 255, 255, 0.04);
    --elev: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e8eef9;
    --muted: #93a1b8;
    --brand: #34d399;
    --brand-ink: #04130a;
    --brand-soft: rgba(52, 211, 153, 0.15);
    --accent: #60a5fa;
    --danger: #fb7185;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px rgba(0, 0, 0, 0.34);
    --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.4), 0 26px 56px rgba(20, 80, 60, 0.34);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 10% -10%, var(--glow-1), transparent 60%),
    radial-gradient(1000px 560px at 100% 0%, var(--glow-2), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.is-hidden { display: none !important; }
/* 本会话已看过加载动画 → 后续页面切换不再显示全屏 loader,只淡入 */
[data-warm] #preloader { display: none !important; }

/* ---------------- Preloader ---------------- */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--bg);
  background-image:
    radial-gradient(800px 500px at 50% 30%, var(--brand-soft), transparent 60%);
}

#preloader .pl-logo {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(22, 120, 70, 0.28);
}

#preloader .pl-text {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.4px;
}

#preloader .pl-bar {
  width: 168px;
  height: 4px;
  border-radius: 4px;
  background: var(--elev);
  overflow: hidden;
  position: relative;
}

#preloader .pl-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 4px;
  background: var(--brand-grad);
  animation: plslide 1.1s var(--ease) infinite;
}

@keyframes plslide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* ---------------- Topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand__logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: 0 6px 18px rgba(22, 120, 70, 0.22);
  transition: transform 0.4s var(--ease);
}

.brand:hover .brand__logo { transform: rotate(-6deg) scale(1.05); }

.brand__title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__sub { margin-top: 1px; color: var(--muted); font-size: 12px; }

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

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}

.nav a:hover { color: var(--text); background: var(--elev); border-color: var(--border); transform: translateY(-1px); }
.nav a.is-active { color: var(--brand); background: var(--brand-soft); }

/* ---------------- Layout ---------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.search {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px 0 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, box-shadow 0.25s, background 0.2s;
}

.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

.search .ico {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
}

.count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.count b { color: var(--text); font-weight: 800; }

.warn {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.08);
  color: var(--danger);
  font-size: 13px;
}

/* ---------------- layui Tab 覆写 ---------------- */
.layui-tab { margin: 6px 0 0; }
.layui-tab-title { border-bottom: 1px solid var(--border); }
.layui-tab-title li {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  transition: color 0.2s;
}
.layui-tab-title li:hover { color: var(--text); }
.layui-tab-title .layui-this { color: var(--brand); }
.layui-tab-brief > .layui-tab-title .layui-this:after {
  border: none;
  border-radius: 3px 3px 0 0;
  height: 3px;
  background: var(--brand-grad);
}
.layui-tab-content { padding: 22px 0 0; }

/* ---------------- 卡片网格 ---------------- */
.cardgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.pcard {
  position: relative;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 13px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.3s;
}

.pcard::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--brand), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

.pcard:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); border-color: transparent; }
.pcard:hover::before { opacity: 1; }

.pcard__top { display: flex; align-items: start; gap: 13px; }

.pcard__icon {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
  transition: transform 0.4s var(--ease);
}

.pcard:hover .pcard__icon { transform: scale(1.06); }
.pcard__icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard__icon .letter { font-size: 22px; font-weight: 800; color: var(--brand); }

.pcard__id-row { min-width: 0; flex: 1; }
.pcard__title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pcard__title { font-size: 18px; font-weight: 800; line-height: 1.2; }
.pcard__ver {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.pcard__id {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pills { display: flex; flex-wrap: wrap; gap: 7px; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  background: var(--surface-soft);
}
.pill--brand { color: #fff; background: var(--brand-grad); border-color: transparent; font-weight: 600; }
.pill--danger { color: var(--danger); border-color: rgba(225, 29, 72, 0.4); background: rgba(225, 29, 72, 0.1); }

.pcard__desc {
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcard__meta { display: flex; flex-wrap: wrap; gap: 7px; }
.pcard__actions { display: flex; gap: 10px; margin-top: auto; padding-top: 4px; }

/* ---------------- 按钮 ---------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 17px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--elev);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s, box-shadow 0.3s;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn--primary {
  background: var(--brand-grad);
  border-color: transparent;
  color: var(--brand-ink);
  box-shadow: 0 8px 22px rgba(22, 160, 90, 0.32);
}
.btn--primary:hover { box-shadow: 0 12px 30px rgba(22, 160, 90, 0.44); }
.btn--primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s var(--ease);
}
.btn--primary:hover::after { left: 130%; }

.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

/* ---------------- 空状态 ---------------- */
.empty {
  grid-column: 1 / -1;
  padding: 48px 28px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.empty__eyebrow { color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.empty__title { margin: 12px 0 0; font-size: 20px; }
.empty__desc { margin: 10px auto 0; max-width: 460px; color: var(--muted); line-height: 1.65; }

/* ---------------- 详情弹窗（layer type:1 内容） ---------------- */
.detail { padding: 4px 2px 2px; }
.detail__sub {
  color: var(--muted);
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin-bottom: 12px;
  word-break: break-all;
}
.detail__pills { margin-bottom: 12px; }
.detail__desc { color: var(--text); line-height: 1.7; margin: 0 0 16px; }
.detail__h { margin: 16px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); }

.vtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.vtable th, .vtable td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.vtable th { color: var(--muted); font-weight: 600; background: var(--surface-soft); }
.vtable tr:last-child td { border-bottom: none; }
.vtable tbody tr:hover { background: var(--surface-soft); }
.vt-actions { display: flex; gap: 8px; align-items: center; }
.vt-actions .btn { min-height: 32px; padding: 0 11px; font-size: 12px; }
.vt-actions .link { color: var(--muted); cursor: pointer; transition: color 0.2s; }
.vt-actions .link:hover { color: var(--brand); }

.detail__blocked {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(225, 29, 72, 0.4);
  background: rgba(225, 29, 72, 0.08);
  color: var(--danger);
  font-size: 13px;
}

/* ---------------- 页脚 ---------------- */
.foot { margin-top: 22px; color: var(--muted); font-size: 12px; }
.foot details { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.foot summary { cursor: pointer; color: var(--text); font-weight: 600; }
.foot p { line-height: 1.65; margin: 10px 0 0; }

/* ---------------- layui layer 双主题覆写 ---------------- */
.layui-layer { border-radius: var(--radius) !important; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4) !important; max-width: 92vw !important; }
.layui-layer-page .layui-layer-content { background: var(--surface-solid); }
.layui-layer-title {
  background: var(--surface-solid) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--border) !important;
  font-weight: 700 !important;
}
.layui-layer-setwin span { background-position-y: -40px; }
.layui-layer-shade { background-color: rgba(5, 8, 18, 0.55) !important; }

/* ---------------- 指南页排版 ---------------- */
.doc { display: grid; gap: 16px; }
.gcard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.gcard h2 { margin: 0 0 4px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.gcard h2 .step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--brand-grad); color: var(--brand-ink);
  font-size: 13px; font-weight: 800;
}
.gcard p, .gcard li { color: var(--muted); line-height: 1.75; font-size: 14.5px; }
.gcard strong { color: var(--text); }
.gcard a { color: var(--brand); font-weight: 600; }
.gcard pre {
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.gcard pre .c { color: var(--muted); }
.gtable { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
.gtable th, .gtable td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.gtable th { color: var(--muted); font-weight: 600; }
.gtable code { color: var(--brand); font-family: ui-monospace, Consolas, monospace; }
.callout {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-soft);
  background: var(--brand-soft);
  color: var(--text);
  font-size: 14px;
}
.callout a { color: var(--brand); font-weight: 700; }

/* ---------------- 规范页:目录 + Markdown 排版 ---------------- */
.docwrap {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.toc-wrap {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
}
.toc-title { font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc__link {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}
.toc__link:hover { color: var(--text); background: var(--surface-soft); }
.toc__link--l3 { padding-left: 22px; font-size: 12.5px; }
.toc__link.is-active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); font-weight: 600; }

.docmain {
  min-width: 0;
  padding: 26px 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.docstatus { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* 渲染后的 Markdown */
.md { color: var(--text); line-height: 1.75; font-size: 15px; scroll-behavior: smooth; }
.md > *:first-child { margin-top: 0; }
.md h1 { font-size: 27px; font-weight: 800; margin: 0 0 8px; letter-spacing: 0.2px; }
.md h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 38px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 84px;
}
.md h3 { font-size: 16px; font-weight: 700; margin: 26px 0 10px; scroll-margin-top: 84px; }
.md h4 { font-size: 14px; font-weight: 700; margin: 20px 0 8px; color: var(--muted); scroll-margin-top: 84px; }
.md h1:first-child + p { color: var(--muted); }
.md p { margin: 12px 0; color: var(--text); }
.md a { color: var(--brand); font-weight: 600; text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md strong { color: var(--text); font-weight: 700; }
.md ul, .md ol { margin: 12px 0; padding-left: 22px; }
.md li { margin: 6px 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 30px 0; }
.md blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  background: var(--brand-soft);
  color: var(--text);
}
.md blockquote p { margin: 4px 0; }
.md :not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.14em 0.42em;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--brand);
}
.md pre {
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  overflow: auto;
  line-height: 1.6;
}
.md pre code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
}
.md table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.md thead th { background: var(--surface-soft); }
.md th, .md td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md th { color: var(--text); font-weight: 700; }
.md tbody tr:last-child td { border-bottom: none; }
.md tbody tr:hover { background: var(--surface-soft); }
.md td code, .md th code { color: var(--brand); white-space: nowrap; }
.hanchor {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
  opacity: 0;
  text-decoration: none;
  transition: opacity 0.18s;
}
.md h1:hover .hanchor, .md h2:hover .hanchor, .md h3:hover .hanchor, .md h4:hover .hanchor { opacity: 0.6; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .docwrap { grid-template-columns: 1fr; }
  .toc-wrap { display: none; }
  .docmain { padding: 20px 18px; }
}

@media (max-width: 720px) {
  .topbar__inner { flex-direction: column; align-items: start; gap: 10px; }
  .cardgrid { grid-template-columns: 1fr; }
  .pcard__actions { flex-direction: column; }
}

/* ---------------- 无障碍 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
}
