/* 固定深色：与主站 AG glass（黑蓝底 + 毛玻璃卡片）一致，不跟随系统明暗 */
:root {
  --bg: oklch(0.07 0.02 262);
  --fg: oklch(0.985 0 0);
  --muted-fg: oklch(0.72 0.025 250);
  --muted: oklch(0.22 0.035 262 / 0.4);
  --border: oklch(1 0 0 / 10%);
  --primary: oklch(0.546 0.215 262.88);
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 55% at 15% 20%, rgba(37, 99, 235, 0.28) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 10%, rgba(56, 189, 248, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 45% 35% at 50% 90%, rgba(29, 78, 216, 0.15) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--primary); }
.top { position: sticky; top: 0; z-index: 10; height: 56px; background: oklch(0.07 0.02 262 / 0.6); border-bottom: 1px solid var(--border); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.top-inner { display: flex; align-items: center; gap: 16px; height: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; font-weight: 700; color: var(--fg); text-decoration: none; white-space: nowrap; }
.brand-logo { width: 20px; height: 20px; margin-right: 6px; }
.brand-mark {
  background: linear-gradient(to right, #ffffff, #bae6fd, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.brand-sub { font-weight: 400; color: var(--muted-fg); margin-left: 6px; }
.top-links { margin-left: auto; display: flex; gap: 16px; font-size: 14px; white-space: nowrap; }
.top-links a { text-decoration: none; }
main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px; }
h1 { font-size: 28px; margin: 0 0 4px; }
.lead { margin: 0; color: var(--muted-fg); }
h2 { font-size: 20px; margin: 36px 0 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; }
/* 主站 .ag-glass 的卡片质感 */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.07) 0%, rgba(37, 99, 235, 0.07) 42%, rgba(255, 255, 255, 0.02) 100%);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.05) inset, 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 80px rgba(37, 99, 235, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.card:hover, .card[open] { border-color: var(--primary); }
.card summary { display: block; padding: 16px 18px; cursor: pointer; list-style: none; }
.card summary::-webkit-details-marker { display: none; }
.card summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius); }
.card-name { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.card-desc { display: block; margin-top: 6px; color: var(--muted-fg); font-size: 14px; }
.card-body { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 18px 16px; border-top: 1px solid var(--border); }
.btn { display: inline-block; padding: 5px 16px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.btn:hover { filter: brightness(1.15); }
.repo { font-size: 14px; text-decoration: none; }
.repo:hover { text-decoration: underline; }
.empty { margin: 0; padding: 28px 18px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted-fg); text-align: center; }
@media (max-width: 600px) {
  .top-inner { padding: 0 16px; }
  .top-links a:not(:first-child) { display: none; }
  main { padding: 20px 16px 60px; }
}

button.card {
  appearance: none;
  display: block;
  width: 100%;
  padding: 16px 18px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.card summary { display: none; }
/* display 只在打开时设。dialog 关闭态靠 UA 的 display:none；
   这里写死 :not([open])，避免 author 的 display:flex 把关闭后的弹层留在文档流底部。 */
dialog.sheet:not([open]) {
  display: none;
}
dialog.sheet[open] {
  display: flex;
}
dialog.sheet {
  flex-direction: column;
  width: min(520px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  margin: auto;
  padding: 22px 22px 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  background:
    radial-gradient(ellipse 80% 55% at 12% 0%, rgba(37, 99, 235, 0.28) 0%, transparent 62%),
    radial-gradient(ellipse 55% 40% at 92% 8%, rgba(56, 189, 248, 0.12) 0%, transparent 58%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.07) 0%, rgba(37, 99, 235, 0.07) 42%, rgba(255, 255, 255, 0.02) 100%),
    oklch(0.07 0.02 262 / 0.9);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.05) inset, 0 10px 40px rgba(0, 0, 0, 0.35), 0 0 80px rgba(37, 99, 235, 0.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
dialog.sheet::backdrop {
  background: oklch(0.07 0.02 262 / 0.72);
}
.sheet-top { display: flex; align-items: flex-start; justify-content: space-between; }
.sheet-logo { width: 36px; height: 36px; }
.sheet-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-fg);
  font: 22px/1 sans-serif;
  cursor: pointer;
}
.sheet-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--fg); }
dialog.sheet h3 { margin: 14px 0 6px; font-size: 22px; }
.sheet-lead { margin: 0 0 16px; color: var(--muted-fg); }
.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(560px, calc(100vh - 280px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(37, 99, 235, 0.08) 42%, rgba(255, 255, 255, 0.02) 100%);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.05) inset;
}
.sheet-body p { margin: 0 0 14px; }
.sheet-body h4 { margin: 16px 0 8px; font-size: 15px; }
.sheet-body ul { margin: 0; padding-left: 18px; }
.sheet-body li + li { margin-top: 4px; }
.sheet-note { margin-bottom: 0; color: var(--muted-fg); font-size: 13px; }
.sheet-body table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sheet-body th, .sheet-body td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.sheet-body th { color: var(--muted-fg); font-weight: 600; }
.sheet-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.sheet-foot { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 16px; }
@media (max-width: 600px) {
  dialog.sheet { padding: 16px; }
  .sheet-body { max-height: calc(100vh - 240px); }
}
