/* UI Warehouse — 活的画廊（苹果灰阶） */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --fg: #1d1d1f;
  --sub: #86868b;
  --faint: #aeaeb2;
  --muted: var(--sub);
  --line: rgba(0, 0, 0, .06);
  --glass-line: var(--line);
  --accent: #0071e3;
  --shadow: 0 2px 8px rgba(0, 0, 0, .05), 0 12px 32px -12px rgba(0, 0, 0, .08);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, .06), 0 24px 48px -16px rgba(0, 0, 0, .16);
  --ease: cubic-bezier(.28, .11, .32, 1);
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(0, 113, 227, .18); }

/* 通用面板（markup 中的 .glass 钩子，本主题为白色卡片） */
.glass {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

/* 顶栏：通栏 sticky + 背景模糊 */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 245, 247, .8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.hbar { display: flex; align-items: center; gap: 32px; max-width: 1280px; margin: 0 auto; padding: 0 28px; height: 56px; }
.logo {
  font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap;
  color: var(--fg); text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.logo-mark { width: 20px; height: 20px; flex: none; color: var(--fg); }
a.logo:hover { opacity: .8; }
.type-nav { display: flex; gap: 4px; }
.type-nav a {
  color: var(--sub); text-decoration: none; font-size: 13.5px;
  padding: 5px 13px; border-radius: 999px; transition: .25s var(--ease); white-space: nowrap;
}
.type-nav a:hover { color: var(--fg); }
.type-nav a.is-active, .type-nav a.is-here { color: var(--fg); font-weight: 600; background: rgba(0, 0, 0, .05); }
.search {
  margin-left: auto; width: 216px; height: 32px;
  background: rgba(0, 0, 0, .045); border: 1px solid transparent; border-radius: 999px;
  padding: 0 14px; font: inherit; font-size: 13px; color: var(--fg); outline: none;
  transition: background .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease), width .35s var(--ease);
}
.search::placeholder { color: var(--faint); }
.search:focus { background: #fff; border-color: rgba(0, 113, 227, .5); box-shadow: 0 0 0 3.5px rgba(0, 113, 227, .14); width: 256px; }
.crumb { margin-left: auto; color: var(--faint); font-size: 12.5px; white-space: nowrap; }

main { max-width: 1280px; margin: 0 auto; padding: 0 28px; }

/* Hero */
.hero { padding: 88px 0 0; }
.hero h1 { font-size: 44px; font-weight: 700; letter-spacing: -.028em; line-height: 1.12; }
.hero .sub { margin-top: 16px; font-size: 17px; color: var(--sub); letter-spacing: -.01em; max-width: 640px; }
.hero .hint { margin-top: 26px; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--faint); letter-spacing: .01em; }
.hint-dot { width: 6px; height: 6px; border-radius: 50%; background: #30d158; animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(48, 209, 88, .35); }
  55% { opacity: .75; box-shadow: 0 0 0 5px rgba(48, 209, 88, 0); }
}

/* 类型分区 */
.sec { padding: 40px 0 60px; scroll-margin-top: 72px; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; }
.sec-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.sec-head .count { font-size: 13px; color: var(--faint); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 14px; }

/* 分类筛选 chips */
.chips { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 26px; }
.chip {
  font-size: 13px; color: var(--fg); background: #fff; border: none; border-radius: 999px;
  padding: 7px 16px; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, .08); }
.chip.is-active { background: var(--fg); color: #fff; font-weight: 500; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }

/* 卡片 */
.grid, .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 22px; }
.card {
  display: block; text-decoration: none; color: var(--fg);
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.cover {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  background: #fff; border-bottom: 1px solid var(--line);
  font-size: 24px; font-weight: 700; color: rgba(255, 255, 255, .92);
}
/* 活封面：缩放嵌入实时 Demo，默认禁交互，悬停时恢复 */
.cover-live iframe {
  width: 200%; height: 200%; border: 0;
  transform: scale(.5); transform-origin: 0 0;
  pointer-events: none; display: block; background: #fff;
  opacity: 0; transition: opacity .6s var(--ease);
}
.cover-live iframe.is-ready { opacity: 1; }
/* 试玩模式：封面点击交给 Demo（默认整卡可点进详情） */
.card.is-playing .cover-live iframe { pointer-events: auto; }
.badge-touch {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  padding: 4px 12px; border: none; cursor: pointer; font: inherit;
  background: rgba(29, 29, 31, .78);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 11px; border-radius: 999px;
  opacity: 0; transform: translateY(4px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.card:hover .badge-touch, .card.is-playing .badge-touch { opacity: 1; transform: translateY(0); }
.card.is-playing .badge-touch { background: var(--accent); }
/* 触屏设备没有悬停：试玩按钮常显，否则功能不可达 */
@media (hover: none) {
  .badge-touch { opacity: 1; transform: none; }
}
/* 占位渐变封面（无 demo 资产）：字母居中 */
.g1, .g2, .g3, .g4 { display: grid; place-items: center; }
.g1 { background: linear-gradient(135deg, #5b7ff0, #31479e); }
.g2 { background: linear-gradient(135deg, #3fae8c, #1d5c49); }
.g3 { background: linear-gradient(135deg, #e06a8c, #8c2d51); }
.g4 { background: linear-gradient(135deg, #8a93a3, #454e5c); }
.cover-stripes { background: #fff; }
.stripes { display: flex; width: 100%; height: 100%; }
.stripes span { flex: 1; }
.card .body { display: block; text-decoration: none; color: inherit; padding: 15px 18px 17px; }
.card .body h3 { font-size: 15px; font-weight: 600; letter-spacing: -.012em; text-wrap: pretty; }
.card .meta { font-size: 13px; color: var(--sub); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
footer { padding: 34px 28px 60px; text-align: center; color: var(--faint); font-size: 12.5px; border-top: 1px solid var(--line); margin-top: 20px; }

/* 详情页 */
.detail-layout { display: flex; gap: 26px; align-items: flex-start; padding-top: 34px; padding-bottom: 26px; }
.demo-pane { flex: 1.25; min-width: 0; position: sticky; top: 80px; }
.stage { border-radius: 18px; display: grid; place-items: center; padding: 12px; }
.demo-frame { width: 100%; min-height: 420px; display: block; border: none; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.source-panel { margin-top: 14px; border-radius: 14px; font-size: 13px; color: var(--sub); }
.source-panel summary { cursor: pointer; padding: 12px 18px; }
.source-panel pre { margin: 0 18px 14px; background: rgba(0, 0, 0, .03); border-radius: 10px; padding: 12px; font-size: 12px; overflow: auto; max-height: 320px; color: #48484a; }
.info-pane { flex: 1; min-width: 0; padding: 26px 28px; border-radius: 18px; }
.info-pane h1 { font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.info-pane h2 { font-size: 12.5px; font-weight: 700; letter-spacing: .14em; margin: 26px 0 4px; text-transform: uppercase; color: var(--faint); }
.info-pane ul { list-style: none; padding: 0; }
.info-pane li { font-size: 14px; line-height: 1.85; padding: 12px 0; border-top: 1px solid var(--line); color: #48484a; }
.info-pane li b { color: var(--fg); }
.source-link { font-size: 14px; padding-top: 12px; }
.source-link a { color: var(--accent); text-decoration: none; }
.source-link a:hover { text-decoration: underline; }
.tags { display: flex; gap: 6px; margin: 18px 0 22px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 4px 12px; border-radius: 999px; background: rgba(0, 0, 0, .045); color: var(--sub); font-weight: 500; }
.copy-btn { width: 100%; padding: 14px; border: none; border-radius: 12px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 10px 24px -10px rgba(0, 113, 227, .55); transition: filter .2s, transform .15s; }
.copy-btn:hover { filter: brightness(1.08); }
.copy-btn:active { transform: scale(.98); }
#copy-status { display: block; margin-top: 8px; font-size: 13px; color: var(--accent); text-align: center; min-height: 18px; }
#prompt-fallback { width: 100%; height: 160px; margin-top: 8px; font-size: 12px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .03); color: var(--fg); }

/* AI 改造面板 */
.ai-panel { margin-top: 4px; }
#ai-request, #ai-intake-request { width: 100%; resize: vertical; font: inherit; font-size: 13.5px; line-height: 1.6; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .03); color: var(--fg); outline: none; transition: border-color .2s, box-shadow .2s; }
#ai-request::placeholder, #ai-intake-request::placeholder { color: var(--faint); }
#ai-request:focus, #ai-intake-request:focus { border-color: rgba(0, 113, 227, .5); box-shadow: 0 0 0 3.5px rgba(0, 113, 227, .14); background: #fff; }
.ai-btn { width: 100%; margin-top: 10px; padding: 12px; border: none; border-radius: 12px; background: var(--fg); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; transition: filter .2s, transform .15s; }
.ai-btn:hover { filter: brightness(1.12); }
.ai-btn:active { transform: scale(.98); }
.ai-btn:disabled { opacity: .55; cursor: default; }
.ai-btn--ghost { background: rgba(0, 0, 0, .05); color: var(--fg); }
.ai-btn--ghost:hover { background: rgba(0, 0, 0, .09); filter: none; }
#ai-status, #ai-intake-status { margin-top: 8px; font-size: 13px; color: var(--sub); text-align: center; min-height: 18px; }
#ai-result, #ai-intake-result { margin-top: 12px; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; line-height: 1.7; padding: 14px; border-radius: 12px; background: rgba(0, 0, 0, .03); border: 1px solid var(--line); color: #48484a; }

/* AI 改造结果（通栏：左预览右提示词） */
.ai-output { margin: 0 0 80px; padding: 22px 24px 24px; border-radius: 18px; }
.ai-output-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.ai-output-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
#ai-output-status { font-size: 13px; color: var(--sub); }
.ai-output-head .ai-btn { width: auto; margin: 0 0 0 auto; padding: 9px 18px; font-size: 13px; }
.ai-output-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
#ai-preview { width: 100%; height: 460px; display: block; border: none; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.ai-output #ai-result { margin-top: 0; max-height: none; height: 460px; box-sizing: border-box; }

/* 首页 AI 收录入口 + 弹层 */
.ai-intake-btn { flex: none; border: none; border-radius: 999px; background: var(--fg); color: #fff; font: inherit; font-size: 13px; font-weight: 600; padding: 7px 16px; cursor: pointer; transition: filter .2s, transform .15s; }
.ai-intake-btn:hover { filter: brightness(1.15); }
.ai-intake-btn:active { transform: scale(.97); }
.ai-modal { position: fixed; inset: 0; z-index: 200; background: rgba(29, 29, 31, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; }
.ai-modal[hidden] { display: none; }
.ai-modal-panel { width: 100%; max-width: 560px; max-height: 86vh; overflow: auto; background: #fff; border-radius: 20px; box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .3); padding: 24px 26px 26px; }
.ai-modal-head { display: flex; align-items: center; justify-content: space-between; }
.ai-modal-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.ai-modal-close { border: none; background: rgba(0, 0, 0, .05); color: var(--sub); width: 30px; height: 30px; border-radius: 50%; font-size: 13px; cursor: pointer; }
.ai-modal-close:hover { background: rgba(0, 0, 0, .09); color: var(--fg); }
.ai-modal-tip { font-size: 13px; line-height: 1.7; color: var(--sub); margin: 10px 0 14px; }
.ai-modal-panel--wide { max-width: 920px; }

/* AI 收录草稿区（预览 + 规格摘要 + 入库） */
.ai-draft-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; margin-top: 14px; }
#ai-intake-preview { width: 100%; height: 360px; display: block; border: none; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.ai-draft-info h3 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 4px; }
.ai-draft-meta { font-size: 12.5px; color: var(--faint); margin: 0 0 8px; }
#ai-intake-highlights { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow: auto; }
#ai-intake-highlights li { font-size: 13px; line-height: 1.7; padding: 9px 0; border-top: 1px solid var(--line); color: #48484a; }
#ai-intake-highlights li b { color: var(--fg); }
.ai-draft-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.ai-draft-actions .ai-btn { margin-top: 0; }
.ai-draft-view { flex: none; font-size: 13.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.ai-draft-view:hover { text-decoration: underline; }

/* 配色资产 */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; width: 100%; }
.swatch { height: 96px; border: none; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; padding: 10px; color: #fff; text-shadow: 0 1px 2px rgb(0 0 0 / .4); font-size: 13px; gap: 2px; transition: transform .2s; }
.swatch:hover { transform: translateY(-3px); }
.swatch--light { color: #1f2329; text-shadow: none; }
.swatch.copied { outline: 2px solid var(--accent); outline-offset: 2px; }
.color-roles { margin-top: 14px; border-radius: 14px; padding: 14px 18px; list-style: none; font-size: 13px; color: var(--muted); line-height: 1.9; }
.color-roles code { color: var(--fg); font-weight: 600; }

/* 响应式 */
@media (max-width: 900px) {
  .hero { padding: 48px 0 0; }
  .hero h1 { font-size: 32px; }
  .hero .sub { font-size: 15.5px; }
  .detail-layout { flex-direction: column; }
  .demo-pane { position: static; width: 100%; }
  /* 顶栏三行：第一行 logo + AI 收录（详情页是面包屑），第二行类型导航横向滚动，第三行搜索 */
  .hbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px 12px; }
  .logo { flex: 1 1 auto; }
  .ai-intake-btn { order: 2; }
  .crumb { order: 2; width: auto; margin-left: 0; }
  .type-nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .type-nav::-webkit-scrollbar { display: none; }
  .search { order: 4; width: 100%; margin-left: 0; }
  .search:focus { width: 100%; }
  main { padding: 0 16px; }
  .sec { padding: 28px 0 44px; }
  /* 触控目标放大 */
  .chip { padding: 9px 16px; }
  .type-nav a { padding: 7px 14px; }
  .demo-frame { min-height: 340px; }
  .ai-output-grid { grid-template-columns: 1fr; }
  .ai-output-head { flex-wrap: wrap; }
  .ai-output-head .ai-btn { margin-left: 0; width: 100%; }
  #ai-preview, .ai-output #ai-result { height: 380px; }
  /* 弹层贴边、草稿区单列 */
  .ai-modal { padding: 12px; }
  .ai-modal-panel { max-height: 92vh; }
  .ai-draft-grid { grid-template-columns: 1fr; }
  .ai-draft-actions { flex-wrap: wrap; }
}
