/* Prompt Planet — 2026-09-22 图库式重设计。
 *
 * 单一样式表，不再依赖 ai-radar 的 style.css。视觉参照：Pexels（白底、图片按原比例
 * 铺瀑布流、卡片静态零文字、hover 浮出信息、黑色胶囊主按钮）；导航壳参照 Pinterest
 * 登录版的窄图标栏。L2 参数在 :root 里一次定完，组件只引用 token，不各写各的数。
 */

:root {
  color-scheme: light;

  /* 色彩角色 */
  --bg: #ffffff;
  --ink: #191919;
  --ink-2: #4a4a4a;
  --muted: #767676;
  --line: #e5e5e5;
  --line-strong: #cfcfcf;
  --surface: #f2f2f2;
  --surface-hover: #e6e6e6;
  --surface-pressed: #dcdcdc;
  --primary: #191919;
  --primary-hover: #000000;
  --primary-contrast: #ffffff;
  --success: #05a081;
  --danger: #c0392b;
  --overlay: rgba(0, 0, 0, 0.55);
  --focus: #191919;

  /* 字体：系统栈，不引外部字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;

  /* type ramp：每档字号配自己的整数行高 */
  --fs-xs: 12px; --lh-xs: 16px;
  --fs-sm: 13px; --lh-sm: 18px;
  --fs-md: 15px; --lh-md: 22px;
  --fs-lg: 18px; --lh-lg: 26px;
  --fs-xl: 24px; --lh-xl: 32px;
  --fs-2xl: 32px; --lh-2xl: 40px;
  --fs-3xl: 40px; --lh-3xl: 48px;

  /* spacing ladder：4 的倍数，闭合 */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* radius family：内 8 · 控件 12 · 图片/卡片 16 · 胶囊 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* 控件高度由 line-height + 垂直 padding 推出 */
  --control-h: 48px;
  --control-h-sm: 36px;

  /* motion */
  --dur: 160ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --rail-w: 80px;
  --gutter: 16px;
  --tile-w: 300px;
  --page-x: 32px;
}

/* 场景目录需要常显名称和子项入口，沿用站点的颜色、字号与间距。 */
.scenario-card { border: 1px solid var(--line); }
.scenario-card .scenario-preview { display: block; }
.scenario-card-body { padding: var(--s-4); }
.scenario-card-body h3 { margin: 0; font-size: var(--fs-lg); line-height: var(--lh-lg); }
.scenario-card-body p { margin: var(--s-2) 0 var(--s-3); color: var(--ink-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.scenario-links { list-style: none; margin: 0; padding: 0; }
.scenario-links li { display: flex; align-items: baseline; gap: var(--s-2); padding-block: var(--s-2); border-top: 1px solid var(--line); }
.scenario-links li[hidden] { display: none; }
.scenario-links a { flex: 1; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.scenario-links span, .suite-modules > li > span { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.scenario-card a:hover, .suite-directory a:hover { text-decoration: underline; }
.suite-directory, .suite-rules { padding: var(--s-5); }
.suite-directory h2, .suite-rules h2 { margin-top: 0; }
.suite-pages { list-style: none; padding: 0; margin: var(--s-4) 0 0; }
.suite-pages > li { padding-block: var(--s-4); border-top: 1px solid var(--line); }
.suite-pages > li > a { font-size: var(--fs-lg); font-weight: 600; }
.suite-pages p { margin: var(--s-2) 0; color: var(--ink-2); }
.suite-modules { margin-top: var(--s-3); padding-left: var(--s-5); border-left: 2px solid var(--line); list-style: none; }
.suite-modules > li > span { display: block; }
.suite-rules li + li { margin-top: var(--s-3); }

/* 两款 HTML 封面的组合预览，沿用站点的控件与间距。 */
.cover-intro { color: var(--ink-2); margin: 0 0 var(--s-5); }
.cover-config-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.cover-preview { padding: var(--s-4); min-width: 0; background: var(--surface); }
.cover-preview-stage { width: 100%; max-width: 600px; margin: auto; overflow: hidden; }
.cover-preview-stage iframe { display: block; width: 600px; height: 800px; max-width: none; border: 0; transform-origin: top left; background: white; }
.cover-preview-caption { margin: var(--s-3) 0 0; text-align: center; font-size: var(--fs-xs); color: var(--ink-2); }
.cover-controls { padding: var(--s-5); }
.cover-controls fieldset { border: 0; padding: 0; margin: 0 0 var(--s-5); min-width: 0; }
.cover-controls legend { font-size: var(--fs-md); font-weight: 600; margin-bottom: var(--s-3); }
.cover-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.cover-option { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3); min-height: 44px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.cover-option:hover { background: var(--surface); }
.cover-option[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--surface); }
.cover-option:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cover-option small { font: var(--fs-xs) var(--font-mono); color: var(--ink-2); }
.cover-swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); flex: 0 0 18px; }
.cover-selection-description { color: var(--ink-2); font-size: var(--fs-sm); line-height: 1.7; }
.cover-status { font-size: var(--fs-sm); min-height: 2.8em; }
.cover-configurator[data-state="error"] .cover-status { color: var(--danger); }
.cover-prompt-link { font-size: var(--fs-sm); }
button[data-copy-target]:disabled { opacity: .45; cursor: wait; }
@media (max-width: 760px) {
  .cover-config-grid { grid-template-columns: minmax(0, 1fr); }
  .cover-controls { padding: var(--s-4); }
}

/* ---------- 基础 ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  display: flex;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 400 var(--fs-md)/var(--lh-md) var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

button { font-family: inherit; }

h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 700; }
h1 { font-size: var(--fs-2xl); line-height: var(--lh-2xl); }
h2 { font-size: var(--fs-xl); line-height: var(--lh-xl); }
h3 { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; }
h4 { font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }

p { margin: 0; }

svg { display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- 左侧窄图标栏（Pinterest 形态） ---------- */

.prompt-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex: 0 0 var(--rail-w);
  flex-direction: column;
  align-items: center;
  width: var(--rail-w);
  height: 100vh;
  padding: var(--s-4) 0;
  background: var(--bg);
  border-right: 1px solid var(--line);
}

.sidebar-close { display: none; }

.sidebar-brand {
  display: flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-4);
  border-radius: var(--r-pill);
}

.sidebar-brand:hover { background: var(--surface); }

.brand-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--ink);
  font: 800 9px/10px var(--font-mono);
  letter-spacing: 0.06em;
}

.brand-logo-orbit {
  position: relative;
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.brand-logo-orbit-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.app-mobile-brand .brand-logo {
  flex-direction: row;
  gap: 5px;
  font-size: 14px;
  line-height: 16px;
}

.divider { display: none; }
.side-group-label { display: none; }

.side-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
}

.side-nav + .side-nav { margin-top: auto; }

.side-link {
  position: relative;
  display: flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--ink);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.side-link:hover { background: var(--surface); }
.side-link:active { background: var(--surface-pressed); }

.side-link-active,
.side-link-active:hover {
  color: var(--primary-contrast);
  background: var(--primary);
}

.side-icon {
  display: block;
  width: 22px;
  height: 22px;
}

.side-icon svg { width: 100%; height: 100%; }

.side-label,
.nav-muted { display: none; }

/* 图标栏里名称靠 hover 提示：不靠 title 的原生延迟，自己画一个 */
.side-link::after {
  content: attr(data-label);
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  z-index: 30;
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-sm);
  color: var(--primary-contrast);
  background: var(--ink);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-4px, -50%);
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.side-link:hover::after,
.side-link:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.sidebar-foot { display: none; }

/* ---------- 主区 ---------- */

.prompt-main {
  flex: 1;
  min-width: 0;
  padding: var(--s-5) var(--page-x) var(--s-8);
}

.app-mobile-bar,
.m-tabbar,
.mobile-menu-button { display: none; }

.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.page-subtitle {
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: var(--lh-md);
}

.overview-header,
.type-header:has(> .image-template-search) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  align-items: center;
  gap: var(--s-5);
}

/* 搜索框：48px 高、浅灰底、无边框、左侧放大镜 */
.global-search,
.type-search {
  position: relative;
  display: block;
}

.global-search input,
.type-search input {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--s-4) 0 48px;
  border: 0;
  border-radius: var(--r-md);
  color: var(--ink);
  background: var(--surface);
  font: 400 var(--fs-md)/var(--lh-md) var(--font-sans);
  appearance: none;
  transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.global-search input::placeholder,
.type-search input::placeholder { color: var(--muted); }

.global-search input:hover,
.type-search input:hover { background: var(--surface-hover); }

.global-search input:focus-visible,
.type-search input:focus-visible {
  outline: 0;
  background: var(--bg);
  box-shadow: 0 0 0 2px var(--focus);
}

.global-search::before,
.type-search::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 16px;
  width: 20px;
  height: 20px;
  background: currentColor;
  color: var(--muted);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>') center / contain no-repeat;
  transform: translateY(-50%);
  pointer-events: none;
}

.image-template-search { width: min(640px, 100%); }

/* ---------- 分区标题 ---------- */

.overview-section,
.axis-section { margin-top: var(--s-6); }

.overview-section:first-child,
.axis-section:first-child { margin-top: 0; }

.section-heading,
.axis-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}

.section-heading h2 span,
.section-heading > span {
  margin-left: var(--s-2);
  color: var(--muted);
  font-size: var(--fs-md);
  font-weight: 500;
}

.section-heading a {
  flex: none;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.section-heading a:hover { color: var(--ink); }

.axis-heading { flex-direction: column; align-items: flex-start; gap: var(--s-1); }
.axis-heading p { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }

/* ---------- 瀑布流与卡片 ---------- */

/* 无 JS 时的退路：CSS 多列一次排全。JS 起来后换成下面的分批追加列（见 prompts.js initMasonry） */
.template-grid {
  columns: var(--tile-w);
  column-gap: var(--gutter);
}

.template-grid-js { columns: auto; column-gap: 0; }

.template-grid-columns {
  display: flex;
  align-items: flex-start;
  gap: var(--gutter);
}

.template-grid-col {
  flex: 1 1 0;
  min-width: 0;
}

.template-grid-sentinel {
  margin: 0;
  padding: var(--s-5) 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  text-align: center;
}

.template-grid-sentinel:empty { padding: 0; min-height: 1px; }

.template-card {
  position: relative;
  display: block;
  margin: 0 0 var(--gutter);
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--bg);
  color: inherit;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  transition: transform var(--dur) var(--ease);
}

.template-card:focus-visible { outline-offset: 0; }

.template-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2; /* 图片卡片由 style 属性按原图比例覆盖 */
  overflow: hidden;
  background: #fff;
  border-radius: var(--r-lg);
}

.template-preview > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* 盒子已按原图比例，这里只吸收亚像素取整 */
  background: #fff;
  transition: transform 320ms var(--ease);
}

/* 同一图片在各预览入口使用同一底板，不随页面改变透明区域观感。 */
.image-lightbox-trigger img,
.lightbox img { background: #fff; }

/* 静态零文字；hover / 键盘焦点时底部渐变浮出名称与动作 */
.template-card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: linear-gradient(to top, var(--overlay) 0%, rgba(0, 0, 0, 0.25) 40%, rgba(0, 0, 0, 0) 70%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.template-card-name {
  min-width: 0;
  color: #fff;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: var(--lh-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.template-card-cta {
  flex: none;
  display: inline-flex;
  height: var(--control-h-sm);
  align-items: center;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  color: var(--ink);
  background: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: var(--lh-sm);
}

@media (hover: hover) {
  .template-card:hover .template-card-overlay,
  .template-card:focus-visible .template-card-overlay { opacity: 1; }
  .template-card:hover .template-preview > img { transform: scale(1.03); }
}

@media (hover: none) {
  /* 触屏没有 hover：点击即进详情，覆盖层不出现（Pexels 移动端同此） */
  .template-card-overlay { display: none; }
}

.template-preview-webui {
  aspect-ratio: 3 / 2;
  background: #e7eaee;
}

.iframe-card-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.iframe-card-frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 853px;
  border: 0;
  background: #fff;
  pointer-events: none;
  transform: scale(var(--preview-scale, 0.25));
  transform-origin: top left;
}

.template-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--ink-2);
  background: var(--surface);
}

.template-placeholder span {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: 0.08em;
}

/* ---------- chips / 属性 ---------- */

.chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: var(--lh-sm);
  white-space: nowrap;
}

.chip-style,
.chip-composition,
.chip-default,
.chip-layer {
  color: var(--primary-contrast);
  background: var(--primary);
}

.chip-muted { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

.attribute-link {
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.attribute-link:hover { background: var(--surface-hover); }

.template-properties {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin: var(--s-4) 0 0;
  font-size: var(--fs-sm);
}

.template-properties > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.template-properties dt {
  color: var(--muted);
  font-weight: 500;
}

.template-properties dd {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  margin: 0;
  color: var(--ink-2);
}

/* ---------- 筛选行（常驻、单行、横向滚动） ---------- */

.template-filters {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin: 0 calc(-1 * var(--page-x));
  padding: var(--s-1) var(--page-x);
  overflow-x: auto;
  scrollbar-width: none;
  /* 单行横向滚动：右缘渐隐提示还有选项，滚到底时由 JS 去掉 */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent);
}

.template-filters[data-scroll-end] {
  -webkit-mask-image: none;
  mask-image: none;
}

.template-filters::-webkit-scrollbar { display: none; }

.attribute-filter-group {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  border: 0;
}

.attribute-filter-group + .attribute-filter-group {
  padding-left: var(--s-4);
  border-left: 1px solid var(--line);
}

.attribute-filter-label {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
}

.attribute-filter-options {
  display: flex;
  gap: var(--s-2);
}

.attribute-filter {
  min-height: var(--control-h-sm);
  padding: 0 var(--s-4);
  cursor: pointer;
  color: var(--ink);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.attribute-filter:hover { background: var(--surface-hover); }
.attribute-filter:active { background: var(--surface-pressed); }

.attribute-filter[aria-pressed="true"] {
  color: var(--primary-contrast);
  background: var(--primary);
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-4) 0 var(--s-5);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.filter-reset {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: 600 var(--fs-sm)/var(--lh-sm) var(--font-sans);
}

.filter-reset:hover { text-decoration: underline; }
.filter-reset:disabled { color: var(--muted); cursor: default; text-decoration: none; }

.filter-empty {
  display: grid;
  min-height: 200px;
  margin-top: var(--s-5);
  place-content: center;
  justify-items: center;
  gap: var(--s-2);
  color: var(--muted);
  text-align: center;
}

.filter-empty strong { color: var(--ink); font-size: var(--fs-lg); }
.filter-empty .filter-reset { margin-top: var(--s-2); }

/* Web UI 轴切换：黑胶囊 tab */
.type-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.seg-list {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.seg-list::-webkit-scrollbar { display: none; }

.seg-item {
  flex: none;
  height: var(--control-h);
  padding: 0 var(--s-5);
  border: 0;
  border-radius: var(--r-pill);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: 600 var(--fs-md)/var(--lh-md) var(--font-sans);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.seg-item:hover { background: var(--surface); }
.seg-item-active,
.seg-item-active:hover { color: var(--primary-contrast); background: var(--primary); }

.type-search { width: min(360px, 40vw); }

/* ---------- 通用卡片 / 空态 ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
}

.collection-empty {
  display: flex;
  min-height: 160px;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-5);
  border-style: dashed;
  color: var(--muted);
}

.collection-empty-icon,
.placeholder-page-icon { display: block; width: 28px; height: 28px; }
.collection-empty-icon svg,
.placeholder-page-icon svg { width: 100%; height: 100%; }

.placeholder-page {
  display: grid;
  min-height: 400px;
  padding: var(--s-6);
  place-content: center;
  justify-items: center;
  gap: var(--s-3);
  color: var(--muted);
  text-align: center;
}

.placeholder-page-icon { width: 44px; height: 44px; color: var(--ink); }
.placeholder-page p { max-width: 460px; }
.placeholder-page > div { display: flex; gap: var(--s-3); margin-top: var(--s-2); }

.placeholder-page a,
.primary-link,
.text-cover-html {
  display: inline-flex;
  height: var(--control-h);
  align-items: center;
  padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  color: var(--ink);
  background: var(--surface);
  font-weight: 600;
  transition: background-color var(--dur) var(--ease);
}

.placeholder-page a:hover,
.text-cover-html:hover { background: var(--surface-hover); }

.primary-link,
.placeholder-page .primary-link {
  color: var(--primary-contrast);
  background: var(--primary);
}

.primary-link:hover,
.placeholder-page .primary-link:hover { background: var(--primary-hover); }

.about-content {
  display: grid;
  width: min(760px, 100%);
  gap: var(--s-4);
}

.about-content section { padding: var(--s-5); }
.about-content h2 { font-size: var(--fs-lg); line-height: var(--lh-lg); }
.about-content p,
.about-content ol { margin: var(--s-3) 0 0; color: var(--ink-2); line-height: 26px; }

/* ---------- 详情页 ---------- */

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0 0 var(--s-4);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.breadcrumbs a:hover { color: var(--ink); }

.detail-page {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.detail-header { margin-bottom: var(--s-5); }

.detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4);
}

.detail-title-row h1 { font-size: var(--fs-2xl); line-height: var(--lh-2xl); }

.detail-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--s-2);
}

.button-primary,
.button-secondary {
  display: inline-flex;
  height: var(--control-h);
  align-items: center;
  gap: var(--s-2);
  padding: 0 var(--s-5);
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  font: 600 var(--fs-md)/var(--lh-md) var(--font-sans);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.button-primary { color: var(--primary-contrast); background: var(--primary); }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { color: var(--ink); background: var(--surface); }
.button-secondary:hover { background: var(--surface-hover); }
.button-primary svg,
.button-secondary svg { width: 18px; height: 18px; }
.button-primary[data-copy-state="success"] { background: var(--success); }
.button-primary[data-copy-state="error"] { background: var(--danger); }

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.detail-section { margin-top: var(--s-7); }
.detail-section .section-heading h2 { font-size: var(--fs-xl); line-height: var(--lh-xl); }

/* Exemplar：图片优先，不套卡片边框，按原比例居中；标题只留给读屏，视觉上图直接跟在标题行下 */
.exemplar-section { margin-top: var(--s-5); }

.exemplar-section > .section-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.image-exemplar-list { display: grid; gap: var(--s-4); }

.image-exemplar { margin: 0; border: 0; border-radius: 0; }

.detail-meta { margin-top: var(--s-5); }
.detail-meta .detail-chips { margin-top: 0; }

.reproduction-line {
  margin: var(--s-3) 0 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  line-height: 22px;
}

.reproduction-line strong { color: var(--ink); }
.reproduction-line a { text-decoration: underline; }

.copy-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.copy-button-agent { color: var(--primary-contrast); border-color: var(--primary); background: var(--primary); }
.copy-button-agent:hover { background: var(--primary-hover); }
.copy-button-agent[data-copy-state="success"] { background: var(--success); border-color: var(--success); color: #fff; }

.image-lightbox-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.image-lightbox-trigger img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 78vh;
  margin: 0 auto;
  border-radius: var(--r-lg);
  object-fit: contain;
}

.image-exemplar figcaption { margin-top: var(--s-3); }

.image-exemplar details,
.iframe-borrow {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

.description-card {
  padding: var(--s-5);
}

.description-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.description-card h2 { font-size: var(--fs-lg); line-height: var(--lh-lg); }

.description-card > p {
  margin: var(--s-3) 0 0;
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 26px;
}

.description-card dl { display: grid; gap: var(--s-2); margin: var(--s-4) 0 0; }
.description-card dl > div {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: var(--s-3);
  padding-top: var(--s-2);
  border-top: 1px solid var(--line);
}
.description-card dt { color: var(--muted); font-weight: 600; }
.description-card dd { margin: 0; color: var(--ink-2); }

.template-boundary {
  margin-bottom: var(--s-4);
  padding: var(--s-4) var(--s-5);
}
.template-boundary h2 { font-size: var(--fs-md); line-height: var(--lh-md); }
.template-boundary p { margin-top: var(--s-2); color: var(--ink-2); line-height: 24px; }

/* Prompt 卡 */
.prompt-list { display: grid; gap: var(--s-4); }

.prompt-card { overflow: hidden; }

.prompt-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}

.prompt-card > header > div { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); }

.prompt-card pre,
.layer-prompt-part pre,
.layer-prompt-final pre,
.layer-frozen pre {
  margin: 0;
  padding: var(--s-4);
  overflow-x: auto;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: var(--fs-sm)/22px var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prompt-card pre { margin: var(--s-3); }

/* 文本模型模板卡里折叠的 HTML 种子：上千行，展开后在自己的滚动区里看，不把整页拉到两万像素 */
.prompt-seed .layer-prompt-final pre { max-height: 60vh; margin: 0; overflow: auto; }

.copy-button {
  display: inline-flex;
  height: var(--control-h-sm);
  align-items: center;
  gap: 6px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--ink);
  background: var(--bg);
  cursor: pointer;
  font: 600 var(--fs-sm)/var(--lh-sm) var(--font-sans);
  appearance: none;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.copy-button:hover { background: var(--surface); }
.copy-button svg { width: 15px; height: 15px; }
.copy-button[data-copy-state="success"] { color: var(--success); border-color: var(--success); }
.copy-button[data-copy-state="error"] { color: var(--danger); border-color: var(--danger); }

.prompt-alternates > summary { border-radius: var(--r-md); background: var(--surface); }
.prompt-alternates[open] > summary { margin-bottom: var(--s-4); }
.prompt-alternates .prompt-card + .prompt-card { margin-top: var(--s-4); }

/* 三层对照 */
.layer-frozen { padding: var(--s-4) var(--s-5); margin-bottom: var(--s-4); }
.layer-frozen p { color: var(--ink-2); font-size: var(--fs-sm); line-height: 22px; }
.layer-frozen p + p,
.layer-frozen details { margin-top: var(--s-2); }
.layer-frozen pre { margin-top: var(--s-2); font-size: var(--fs-xs); line-height: 18px; }
.layer-disclaimer { padding-top: var(--s-2); border-top: 1px solid var(--line); }

.layer-missing {
  margin: 0 0 var(--s-4);
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 22px;
}

.layer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  align-items: start;
}

.layer-card { overflow: hidden; }

.layer-card-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
}

.layer-figure {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #fff;
  cursor: zoom-in;
}

.layer-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0;
  object-fit: contain;
}

.layer-figure-pending {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  color: var(--muted);
  background: var(--surface);
  font-size: var(--fs-sm);
  cursor: default;
}

.layer-prompt,
.layer-reference {
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
}

/* details/summary：展开状态必须看得出来——chevron 随 open 翻转 */
.detail-page details > summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  padding: var(--s-3) var(--s-4);
  list-style: none;
  cursor: pointer;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: var(--lh-sm);
  transition: background-color var(--dur) var(--ease);
}

.detail-page details > summary::-webkit-details-marker { display: none; }

.detail-page details > summary::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: auto;
  margin-right: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--muted);
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
}

.detail-page details > summary:hover { background: var(--surface); }
.detail-page details > summary:focus-visible { outline-offset: -3px; }
.detail-page details[open] > summary { background: var(--surface); }
.detail-page details[open] > summary::after { color: inherit; transform: rotate(45deg); }

.image-exemplar details { border: 1px solid var(--line); border-radius: var(--r-md); }
.image-exemplar details > summary { border-radius: var(--r-md); }
.image-exemplar details > p,
.iframe-borrow > p { margin: var(--s-3) var(--s-4) var(--s-4); overflow-wrap: anywhere; }

.layer-prompt[open],
.layer-reference[open] { padding-bottom: var(--s-4); }

.layer-prompt > :not(summary),
.layer-reference > :not(summary) { margin-left: var(--s-4); margin-right: var(--s-4); }

.layer-reference > figure { margin: var(--s-3) var(--s-4) 0; }
.layer-reference > .layer-figure { width: calc(100% - 2 * var(--s-4)); margin-top: var(--s-3); }
.layer-reference figcaption { margin-top: var(--s-2); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); overflow-wrap: anywhere; }

.layer-prompt-parts { display: grid; gap: var(--s-3); margin-top: var(--s-3); }
.layer-prompt-part { padding-left: var(--s-3); border-left: 2px solid var(--ink); }
.layer-prompt-part h4 { margin: 0 0 var(--s-2); color: var(--ink-2); font-size: var(--fs-xs); line-height: var(--lh-xs); letter-spacing: 0.04em; }
.layer-prompt-part pre,
.layer-prompt-final pre { padding: var(--s-3); font-size: var(--fs-xs); line-height: 18px; }

.layer-prompt-final { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.layer-prompt-final > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  font-weight: 600;
}

.usage-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding: var(--s-4) var(--s-5);
  color: var(--ink-2);
  background: var(--surface);
  border-color: transparent;
  line-height: 24px;
}

.usage-note strong { color: var(--ink); }
.usage-note a { text-decoration: underline; }

/* 文本封面样例 */
.text-cover-samples { display: grid; gap: var(--s-5); }
.text-cover-sample { padding: var(--s-5); min-width: 0; }
.text-cover-sample h3 { margin: 0 0 var(--s-4); }
.text-cover-sample > .image-lightbox-trigger { max-width: 100%; margin: 0 auto var(--s-4); }
.text-cover-sample img { max-height: 640px; }
.text-cover-html { margin-top: var(--s-4); }
.skill-example { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Web UI 详情 ---------- */

.webui-exemplar { overflow: hidden; }

.iframe-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}

.iframe-toolbar code { color: var(--muted); font: var(--fs-xs)/var(--lh-xs) var(--font-mono); overflow-wrap: anywhere; }
.iframe-toolbar > a { color: var(--ink); font-size: var(--fs-sm); font-weight: 600; }
.iframe-toolbar > a:hover { text-decoration: underline; }

.iframe-presets {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-pill);
  background: var(--surface);
}

.iframe-preset {
  min-height: 32px;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
  font: 600 var(--fs-xs)/var(--lh-xs) var(--font-sans);
  appearance: none;
}

.iframe-preset-active { color: var(--primary-contrast); background: var(--primary); }

.iframe-detail-stage {
  display: flex;
  width: 100%;
  min-height: 70vh;
  justify-content: flex-start;
  overflow: auto;
  padding: var(--s-4);
  background: var(--surface);
}

.iframe-detail-stage iframe {
  display: block;
  margin-inline: auto;
  width: 1280px;
  min-width: 1280px;
  height: 70vh;
  border: 1px solid var(--line);
  background: #fff;
  transition: width var(--dur) var(--ease), min-width var(--dur) var(--ease);
}

.iframe-borrow { margin: 0; padding: 0; border-top: 1px solid var(--line); }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  padding: var(--s-7);
  place-items: center;
  background: rgba(0, 0, 0, 0.88);
}

.lightbox img {
  display: block;
  max-width: 96vw;
  max-height: 90vh;
  border-radius: var(--r-md);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  padding: 12px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  cursor: pointer;
  appearance: none;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox-close svg { width: 100%; height: 100%; }

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

@media (max-width: 1200px) {
  :root { --tile-w: 260px; }
}

@media (max-width: 960px) {
  /* tile 宽不在这里再压：960 视口多半是 133% 缩放，压小会让放大反而看得更小 */
  :root { --page-x: 16px; }

  body { flex-direction: column; }

  /* 窄屏：图标栏变成抽屉，抽屉里显示文字标签 */
  .prompt-sidebar {
    position: fixed;
    z-index: 1200;
    top: 0;
    bottom: 0;
    left: 0;
    flex: none;
    align-items: stretch;
    width: min(280px, 86vw);
    height: 100dvh;
    padding: var(--s-4);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    transform: translateX(-105%);
    transition: transform 200ms var(--ease);
  }

  .prompt-sidebar.is-open { transform: translateX(0); }

  .sidebar-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: block;
    width: 40px;
    height: 40px;
    padding: 10px;
    border: 0;
    border-radius: 50%;
    color: var(--ink);
    background: transparent;
    cursor: pointer;
  }

  .sidebar-close:hover { background: var(--surface); }
  .sidebar-close svg { width: 100%; height: 100%; }

  .sidebar-brand { width: auto; height: 48px; justify-content: flex-start; padding: 0 var(--s-3); }
  .brand-logo { flex-direction: row; gap: 5px; font-size: 14px; line-height: 16px; }

  .side-group-label {
    display: block;
    padding: var(--s-3) var(--s-3) var(--s-1);
    color: var(--muted);
    font-size: var(--fs-xs);
    line-height: var(--lh-xs);
    letter-spacing: 0.08em;
  }

  .side-nav { align-items: stretch; gap: var(--s-1); }

  .side-link {
    width: auto;
    height: 44px;
    justify-content: flex-start;
    gap: var(--s-3);
    padding: 0 var(--s-3);
    border-radius: var(--r-md);
  }

  .side-link::after { display: none; }
  .side-label { display: block; font-size: var(--fs-md); font-weight: 500; }
  .nav-muted { display: block; margin-left: auto; color: var(--muted); font-size: var(--fs-xs); }
  .side-link-active .nav-muted { color: inherit; }

  body.sidebar-open::after {
    content: "";
    position: fixed;
    z-index: 1100;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
  }

  .prompt-main { padding: var(--s-4) var(--page-x) calc(var(--s-8) + 56px); }

  .app-mobile-bar {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin: calc(-1 * var(--s-4)) calc(-1 * var(--page-x)) var(--s-4);
    padding: var(--s-2) var(--page-x);
    border-bottom: 1px solid var(--line);
  }

  .mobile-menu-button {
    display: block;
    width: 40px;
    height: 40px;
    padding: 9px;
    border: 0;
    border-radius: 50%;
    color: var(--ink);
    background: transparent;
    cursor: pointer;
    appearance: none;
  }

  .mobile-menu-button svg { width: 100%; height: 100%; }
  .app-mobile-brand { display: flex; align-items: center; }
  .app-mobile-brand-text { font: 800 14px/16px var(--font-mono); letter-spacing: 0.06em; }
  .app-mobile-date { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); }

  .m-tabbar {
    position: fixed;
    z-index: 900;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    height: 56px;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg);
    border-top: 1px solid var(--line);
  }

  .m-tab {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 14px;
  }

  .m-tab-icon { display: block; width: 22px; height: 22px; }
  .m-tab-icon svg { width: 100%; height: 100%; }
  .m-tab-active { color: var(--ink); font-weight: 600; }

  .overview-header,
  .type-header:has(> .image-template-search) { grid-template-columns: 1fr; gap: var(--s-3); }
  .type-toolbar { align-items: stretch; flex-direction: column; }
  .type-search { width: 100%; }
  .layer-grid { grid-template-columns: 1fr; }
  .iframe-toolbar { grid-template-columns: 1fr auto; }
  .iframe-presets { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
}

@media (max-width: 480px) {
  /* 手机：两列（Pinterest 移动端形态）；640 档留给桌面 200% 缩放，那时仍按 260 排 */
  :root { --tile-w: 150px; --gutter: 12px; }
}

@media (max-width: 640px) {
  h1 { font-size: var(--fs-xl); line-height: var(--lh-xl); }
  .detail-title-row h1 { font-size: var(--fs-xl); line-height: var(--lh-xl); }
  .detail-title-row { align-items: flex-start; flex-direction: column; }
  .detail-actions { width: 100%; }
  .detail-actions .button-primary { flex: 1; justify-content: center; }
  .description-card { padding: var(--s-4); }
  .description-card dl > div { grid-template-columns: 1fr; gap: 3px; }
  .prompt-card > header { align-items: flex-start; }
  .usage-note { grid-template-columns: 1fr; }
  .lightbox { padding: 56px 10px 16px; }
  .iframe-toolbar { grid-template-columns: 1fr; }
  .iframe-toolbar > a { grid-row: 2; }
  .iframe-presets { grid-row: 3; justify-content: flex-start; overflow-x: auto; }
  .placeholder-page > div { flex-direction: column; }
  .template-properties { flex-direction: column; gap: var(--s-2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Web UI 模板详情：GitHub Primer。作用域不进入示例 iframe 或其它站点页面。 */
.webui-template-page {
  --ink: #1f2328;
  --ink-2: #25292e;
  --muted: #59636e;
  --line: #d1d9e0;
  --line-strong: #d1d9e0;
  --surface: #f6f8fa;
  --surface-hover: #eff2f5;
  --surface-pressed: rgba(129, 139, 152, .15);
  --primary: #1f883d;
  --primary-hover: #1c8139;
  --success: #1a7f37;
  --danger: #d1242f;
  --focus: #0969da;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-sm: 14px; --lh-sm: 21px;
  --fs-md: 14px; --lh-md: 21px;
  --fs-lg: 16px; --lh-lg: 24px;
  --r-sm: 6px; --r-md: 6px; --r-lg: 6px;
  --control-h: 32px; --control-h-sm: 28px;
  --dur: 120ms;
  --ease: ease;
}

.webui-template-page :is(h1, h2, h3, h4) { font-weight: 600; letter-spacing: normal; }
.webui-template-page .detail-title-row h1 { font-size: 32px; line-height: 1.25; }
.webui-template-page .detail-header { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.webui-template-page .detail-meta { margin-top: 16px; }
.webui-template-page .breadcrumbs { width: min(1120px, 100%); margin: 0 auto 24px; }
.webui-template-page .breadcrumbs a,
.webui-template-page .webui-detail a { color: var(--focus); }
.webui-template-page .breadcrumbs a:hover,
.webui-template-page .webui-detail a:hover { text-decoration: underline; }
.webui-template-page .detail-section { margin-top: 32px; }
.webui-template-page .detail-section > h2,
.webui-template-page .section-heading {
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.webui-template-page .detail-section > h2,
.webui-template-page .section-heading h2 { font-size: 24px; line-height: 1.5; }
.webui-template-page .exemplar-section > .section-heading {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}
.webui-template-page .section-heading > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.webui-template-page .chip {
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  line-height: 18px;
  box-shadow: none;
}
.webui-template-page :is(.chip-style, .chip-preset, .chip-default) { color: var(--focus); border-color: var(--focus); }
.webui-template-page :is(.button-primary, .button-secondary, .copy-button) {
  padding-inline: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}
.webui-template-page .button-primary { border-color: rgba(31, 35, 40, .15); }
.webui-template-page .copy-button { background: var(--surface); }
.webui-template-page .copy-button:hover { background: var(--surface-hover); }
.webui-template-page .copy-button svg { width: 16px; height: 16px; }

.webui-template-page .description-card { padding: 16px; }
.webui-template-page .description-card h2 { margin: 0; padding: 0; border: 0; font-size: 16px; line-height: 24px; }
.webui-template-page .description-card > p { font-size: 16px; line-height: 1.75; }
.webui-template-page .description-card dl { gap: 12px; margin-top: 16px; }
.webui-template-page .description-card dl > div { grid-template-columns: 112px minmax(0, 1fr); padding-top: 12px; }
.webui-template-page .description-card dd { line-height: 1.75; overflow-wrap: anywhere; }
.webui-template-page .webui-detail ul { margin-block: 8px; padding-left: 24px; }
.webui-template-page .webui-detail li + li { margin-top: 8px; }
.webui-template-page .about-content { width: 100%; gap: 0; border: 1px solid var(--line); border-radius: 6px; }
.webui-template-page .about-content > .card { min-width: 0; padding: 16px; border: 0; border-radius: 0; background: transparent; }
.webui-template-page .about-content > .card + .card { border-top: 1px solid var(--line); }
.webui-template-page .about-content h3 { font-size: 16px; line-height: 24px; }
.webui-template-page .about-content p,
.webui-template-page .about-content li { color: var(--ink); font-size: 16px; line-height: 1.75; overflow-wrap: anywhere; }
.webui-template-page .about-content p { margin-top: 8px; }
.webui-template-page .card { min-width: 0; }
.webui-template-page .card > details > summary { padding: 12px 16px; }
.webui-template-page .card > details > p,
.webui-template-page .iframe-borrow > p { padding: 0 16px 16px; line-height: 1.75; }
.webui-template-page .card > details > ul { padding: 0 32px 16px; overflow-wrap: anywhere; }
.webui-template-page summary { cursor: pointer; font-weight: 500; }
.webui-template-page summary:hover { background: var(--surface); }

.webui-template-page .iframe-toolbar { grid-template-columns: minmax(0, 1fr) auto; background: var(--surface); }
.webui-template-page .iframe-presets { justify-self: start; gap: 0; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; }
.webui-template-page .iframe-preset { min-height: 28px; padding: 0 12px; border-radius: 0; font-weight: 500; }
.webui-template-page .iframe-preset + .iframe-preset { border-left: 1px solid var(--line); }
.webui-template-page .iframe-preset:first-child { border-radius: 5px 0 0 5px; }
.webui-template-page .iframe-preset:last-child { border-radius: 0 5px 5px 0; }
.webui-template-page .iframe-preset:hover { background: var(--surface-hover); }
.webui-template-page .iframe-preset-active,
.webui-template-page .iframe-preset-active:hover { color: #fff; background: var(--focus); }
.webui-template-page .iframe-detail-stage iframe { border-radius: 6px; }
.webui-template-page .iframe-borrow { color: var(--muted); font-size: 14px; }
.webui-template-page .prompt-card > header { flex-wrap: wrap; padding: 12px 16px; background: var(--surface); }
.webui-template-page .prompt-card pre { margin: 0; padding: 16px; border-radius: 0; font-size: 13.6px; line-height: 1.75; }

/* Keep the site's rail, mobile drawer and brand; use Primer navigation roles. */
.webui-template-page .side-link { width: 40px; height: 32px; border-radius: 6px; color: var(--ink-2); }
.webui-template-page .side-icon { width: 16px; height: 16px; }
.webui-template-page .side-link:hover { background: rgba(129, 139, 152, .10); }
.webui-template-page .side-link-active,
.webui-template-page .side-link-active:hover { background: rgba(129, 139, 152, .15); font-weight: 600; }
.webui-template-page .side-link-active .side-label { font-weight: 600; }
.webui-template-page .side-link-active::before { content: ""; position: absolute; left: -8px; width: 4px; height: 24px; border-radius: 6px; background: var(--focus); }
.webui-template-page .side-link::after { color: #fff; background: #25292e; }
.webui-template-page .mobile-menu-button,
.webui-template-page .sidebar-close { border-radius: 6px; }
.webui-template-page .side-group-label { letter-spacing: normal; }
.webui-template-page .app-mobile-bar { background: var(--surface); }
.webui-template-page .m-tab { font-size: 12px; line-height: 18px; }
.webui-template-page .m-tab-active { color: var(--focus); background: rgba(129, 139, 152, .15); }

@media (max-width: 960px) {
  .webui-template-page .side-link { width: auto; }
  .webui-template-page .iframe-presets { grid-column: auto; grid-row: auto; }
}
@media (max-width: 640px) {
  .webui-template-page .detail-title-row h1 { font-size: 24px; line-height: 1.5; }
  .webui-template-page .detail-section > h2,
  .webui-template-page .section-heading h2 { font-size: 20px; }
  .webui-template-page .description-card dl > div { grid-template-columns: 1fr; gap: 4px; }
  .webui-template-page .description-card > h2 { margin: 0; padding: 0; border: 0; font-size: 16px; line-height: 24px; }
  .webui-template-page .iframe-toolbar { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .webui-template-page .iframe-toolbar > a { grid-row: 2; }
  .webui-template-page .iframe-presets { grid-column: 1; grid-row: 1; max-width: 100%; }
  .webui-template-page .iframe-preset { padding-inline: 8px; white-space: nowrap; }
}
