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

:root {
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99,102,241,0.12);
  --danger: #f87171;
  --danger-hover: #fca5a5;
  --bg: #08080f;
  --card: rgba(16,16,32,0.75);
  --border: rgba(99,102,241,0.12);
  --text: #e4e4f0;
  --text-secondary: #9898b8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.3);
  --header-bg: rgba(8,8,15,0.88);
  --glow: 0 0 24px rgba(99,102,241,0.25);
}

html.light {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: rgba(99,102,241,0.06);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --bg: #f6f6fc;
  --card: rgba(255,255,255,0.9);
  --border: rgba(99,102,241,0.15);
  --text: #18182e;
  --text-secondary: #5a5a78;
  --shadow: 0 1px 2px rgba(15,23,42,0.06), 0 8px 24px rgba(15,23,42,0.06);
  --header-bg: rgba(246,246,252,0.88);
  --glow: none;
}

/* 暗色主题组件覆盖 */
html:not(.light) .upload-area:hover,
html:not(.light) .upload-area.dragover {
  background: var(--primary-soft);
}

html:not(.light) .source-view {
  background: #0d1117;
  color: #c9d1d9;
}

html:not(.light) .btn-small {
  background: rgba(99,102,241,0.08);
  color: var(--text);
  border-color: rgba(99,102,241,0.15);
}
html:not(.light) .btn-small:hover {
  background: rgba(99,102,241,0.15);
}
html:not(.light) .btn-small.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

html:not(.light) .btn-danger {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
}
html:not(.light) .btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
}

html:not(.light) #preview-iframe {
  background: #fff;
}

html:not(.light) .preview-title-strip:hover {
  border-color: rgba(99,102,241,0.25);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .4s, color .4s;
}

/* 主题切换按钮 */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .3s;
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle:hover {
  border-color: var(--primary);
  box-shadow: var(--glow);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
  fill: var(--text-secondary);
  transition: fill .3s;
}
.theme-toggle:hover svg { fill: var(--primary); }
html.light .theme-toggle .icon-moon { display: none; }
html.light .theme-toggle .icon-sun { display: block; }

/* 头部外部工具入口（uTools 等客户端工具），与主题切换按钮同款圆形图标 */
.header-tool-link {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .3s;
  flex-shrink: 0;
  padding: 0;
  color: var(--text-secondary);
  text-decoration: none;
}
.header-tool-link:hover {
  border-color: var(--primary);
  box-shadow: var(--glow);
  color: var(--primary);
}
.header-tool-link svg {
  width: 16px;
  height: 16px;
  transition: all .3s;
}
.theme-toggle .icon-sun { display: none; }

/* Auth */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.auth-box h1 {
  font-size: 24px;
  margin-bottom: 4px;
  text-align: center;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-panel { display: none; }
.auth-panel.active { display: block; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: border-color .2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* .btn 的 display:inline-flex 优先级与 [hidden] 相同，会覆盖 hidden 属性，
   导致带 .btn 类的按钮（如预览页的保存/取消）即使在隐藏状态下也会显示 */
.btn[hidden] { display: none; }

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

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  width: auto;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-small:hover { background: var(--border); }
.btn-small.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
/* 组合按钮（如 .btn-small.btn-danger）保持不收折 */
.btn-small.btn-danger { white-space: nowrap; }
/* 图标按钮（btn-small 内仅放 SVG）：方形、与星标/更多按钮视觉一致 */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; color: var(--text-secondary); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-copy-link:hover { color: var(--primary); }
.btn-copy-link:hover { background: var(--primary); color: #fff; }

.auth-message {
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}
.auth-message.error { color: var(--danger); }
.auth-message.success { color: #16a34a; }

/* Layout */
.layout { min-height: 100vh; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 32px;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text { min-width: 0; }

.header h1 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.02em; }
.header-tagline {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.header h2 { font-size: 16px; font-weight: 500; }

.user-name {
  color: var(--text-secondary);
  font-size: 14px;
}

.main { max-width: 960px; margin: 0 auto; padding: 28px 32px 48px; }

/* Upload */
.toolbar { margin-bottom: 24px; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
  background: var(--card);
  box-shadow: var(--shadow);
}

.upload-area:hover, .upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.12);
}

.upload-area:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.upload-area svg {
  width: 44px;
  height: 44px;
  color: var(--primary);
  opacity: 0.85;
  margin-bottom: 10px;
}

.upload-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.01em; }

.upload-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

/* File list */
.file-list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.file-list-header h2 { font-size: 16px; flex: 1; }

.select-all-wrap { flex-shrink: 0; }

.file-count {
  font-size: 13px;
  color: var(--text-secondary);
}

/* File filter bar */
.file-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 9px 36px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

#search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

#search-input::placeholder {
  color: var(--text-secondary);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

.search-clear:hover {
  background: var(--text-secondary);
  color: var(--card);
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.6;
  pointer-events: none;
  transition: opacity .15s;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--text-secondary);
  color: var(--text);
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.filter-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

html:not(.light) {
  .search-clear {
    background: #475569;
    color: var(--text-secondary);
  }
  .search-clear:hover {
    background: var(--text-secondary);
    color: var(--card);
  }
  .filter-chip:hover {
    border-color: #64748b;
  }
}

@media (max-width: 640px) {
  .file-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrap {
    min-width: 0;
  }
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0 8px;
  flex-wrap: wrap;
}
.pagination-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.pagination-btn:hover:not(:disabled) {
  background: var(--border);
}
.pagination-btn:disabled {
  opacity: .4;
  cursor: default;
}
.pagination-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination-ellipsis {
  padding: 0 6px;
  color: var(--text-secondary);
  user-select: none;
}

/* Custom Checkbox */
.file-checkbox-wrap {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}
.file-checkbox-wrap input { position: absolute; opacity: 0; width: 0; height: 0; }
.file-checkbox-visual {
  width: 18px; height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
  position: relative;
}
.file-checkbox-wrap input:checked + .file-checkbox-visual {
  background: var(--primary);
  border-color: var(--primary);
}
.file-checkbox-wrap input:checked + .file-checkbox-visual::after {
  content: '';
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.file-checkbox-wrap input:focus-visible + .file-checkbox-visual {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
html:not(.light) {
  .file-checkbox-visual { border-color: #475569; }
}

.file-item.selected {
  background: rgba(37, 99, 235, 0.06);
  border-color: var(--primary);
}
html:not(.light) {
  .file-item.selected {
    background: rgba(37, 99, 235, 0.15);
  }
}

/* Batch Toolbar */
.batch-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}
html:not(.light) {
  .batch-toolbar {
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  }
}
.batch-toolbar[hidden] {
  display: none;
}
.batch-category-select {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: inherit;
  cursor: pointer;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow .2s, border-color .2s, transform .15s ease;
}

.file-item:hover {
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
}

html:not(.light) {
  .file-item:hover {
    border-color: #475569;
  }
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  cursor: pointer;
  min-width: 0;
  border-radius: var(--radius-sm);
  padding: 2px 4px 2px 0;
  margin: -2px 0;
}

.file-info:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.file-icon.html { background: linear-gradient(145deg, #fef3c7, #fde68a); color: #b45309; }
.file-icon.md { background: linear-gradient(145deg, #dbeafe, #bfdbfe); color: #1d4ed8; }

html:not(.light) {
  .file-icon.html { background: rgba(251, 191, 36, 0.2); color: #fcd34d; }
  .file-icon.md { background: rgba(96, 165, 250, 0.2); color: #93c5fd; }
}

.file-meta { min-width: 0; }

.file-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-subline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.file-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.file-snippet mark {
  background: #fff3b0;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}
html:not(.light) {
  .file-snippet mark {
    background: #5c4b00;
  }
}

.file-detail {
  font-size: 12px;
  color: var(--text-secondary);
}

.file-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}

.file-badge-type {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.file-badge-public {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
}

.file-badge-private {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
}

html:not(.light) {
  .file-badge-public { background: rgba(22, 163, 74, 0.15); }
  .file-badge-private { background: rgba(248, 113, 113, 0.12); }
}

.file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.file-actions .btn {
  padding: 5px 10px;
  font-size: 12px;
}

/* 文件项更多操作下拉 */
.file-more-dropdown {
  position: relative;
  display: inline-flex;
}

.file-more-trigger {
  min-width: 32px;
  text-align: center;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 1px;
}

.file-more-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
  z-index: 100;
  padding: 4px;
}

.file-more-dropdown.open .file-more-menu {
  display: block;
}

.file-more-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.file-more-item:hover {
  background: var(--border);
}

.file-more-danger {
  color: var(--danger);
}

.file-more-danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.file-more-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover { background: #fee2e2; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: .5;
}

.empty-state-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s;
}

.empty-state-cta:hover { background: var(--primary-hover); }
.empty-state-cta svg { width: 16px; height: 16px; }

/* Preview */
.preview-layout {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.preview-layout .header { flex-shrink: 0; }

.header.header-preview {
  padding: 6px max(12px, env(safe-area-inset-left, 0px)) 8px max(12px, env(safe-area-inset-right, 0px));
  align-items: stretch;
}

.header-preview {
  transition: max-height .32s ease, opacity .22s ease, padding .22s ease, border-width .22s ease;
  max-height: 200px;
  opacity: 1;
  overflow: visible;
}

.preview-topbar {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

/* 仅标题行：点标题展开完整工具栏 */
.preview-title-strip {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.preview-title-strip:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

/* 收起顶栏时：标题条作为展开入口显示（display:flex），完整工具栏隐藏。
   工具栏重构把 .preview-toolbar-compact 并入 .preview-header-collapsed，但
   对应 CSS 未同步，导致收起后无标题条可点、只能靠角落浮标展开（回归）。 */
.preview-layout.preview-header-collapsed .preview-title-strip {
  display: flex;
}

.preview-layout.preview-header-collapsed .preview-toolbar-expanded {
  display: none !important;
}

.preview-title-strip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.preview-title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.preview-title-strip-hint {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.55;
  transition: transform .2s ease, opacity .2s ease;
}

.preview-title-strip:hover .preview-title-strip-hint {
  transform: translateY(2px);
  opacity: 0.8;
}

.preview-toolbar-expanded {
  display: block;
}

.preview-expanded-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-expanded-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.preview-expanded-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-preview #btn-back {
  position: relative;
}

.preview-heading-truncate {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.btn-header-fold {
  padding: 6px 10px;
  min-width: 36px;
  justify-content: center;
}

.btn-header-fold .icon-fold-chevron {
  width: 18px;
  height: 18px;
  display: block;
}

.btn-header-fold .icon-fold-chevron--down { display: none; }

.preview-layout.preview-header-collapsed .btn-header-fold .icon-fold-chevron--up {
  display: none;
}

.preview-layout.preview-header-collapsed .btn-header-fold .icon-fold-chevron--down {
  display: block;
}

.view-toggle { display: flex; gap: 4px; }

/* Preview more dropdown */
.preview-more-dropdown {
  position: relative;
  display: inline-flex;
}

.preview-more-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  min-width: 32px;
}

.preview-more-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
  z-index: 100;
  padding: 4px;
}

.preview-more-dropdown.open .preview-more-menu {
  display: block;
}

/* 收起：顶栏完全折叠不占高度，仅保留屏幕顶部悬浮「展开」 */
.preview-layout.preview-header-collapsed .header.header-preview {
  flex-shrink: 1;
  flex-grow: 0;
  flex-basis: 0;
  min-height: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  border-bottom-width: 0;
  border-bottom-color: transparent;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.preview-expand-floating {
  display: none;
  position: fixed;
  top: max(6px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  border-top: none;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.preview-expand-floating svg {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

.preview-expand-floating:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.preview-layout.preview-header-collapsed .preview-expand-floating {
  display: flex;
}

.preview-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.source-view {
  display: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 20px 32px;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.source-view.active { display: block; }

/* Bundle 源码视图：左侧文件树 + 右侧代码 */
.source-wrap {
  width: 100%;
  height: 100%;
}
.source-wrap.bundle-layout {
  display: flex;
  align-items: stretch;
}
.source-wrap.bundle-layout .source-view {
  width: auto;
  flex: 1;
  min-width: 0;
}

.bundle-tree {
  display: flex;
  flex-direction: column;
  width: 240px;
  flex-shrink: 0;
  background: #252526;
  border-right: 1px solid #3c3c3c;
  color: #cccccc;
  font-size: 13px;
  overflow: hidden;
}
.bundle-tree[hidden] { display: none; }

.bundle-tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #3c3c3c;
  flex-shrink: 0;
}
.bundle-tree-title {
  font-weight: 600;
  color: #d4d4d4;
}
.bundle-tree-count {
  font-size: 11px;
  color: #858585;
}

.bundle-tree-body {
  flex: 1;
  overflow: auto;
  padding: 6px 0;
}

.bundle-node { user-select: none; }
.bundle-children { padding-left: 14px; }
.bundle-node-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 12px;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}
.bundle-node-row:hover { background: rgba(255, 255, 255, 0.06); }
.bundle-node-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.bundle-file-row.active {
  background: rgba(56, 139, 253, 0.18);
  color: #ffffff;
}
.bundle-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.bundle-dir:not(.expanded) .bundle-chevron { transform: rotate(-90deg); }
.bundle-dir:not(.expanded) > .bundle-children { display: none; }
.bundle-file-ic { font-size: 12px; flex-shrink: 0; }
.bundle-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .bundle-tree { width: 180px; }
}

/* Toast */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 14px;
  z-index: 100;
  animation: slideIn .3s ease;
  border-left: 4px solid var(--primary);
  max-width: min(360px, calc(100vw - 40px));
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .file-item { transition: none; }
  .upload-area { transition: none; }
  .header-preview { transition: none; }
}

.toast.error { border-left-color: var(--danger); }

@media (max-width: 600px) {
  .toast {
    top: auto;
    right: auto;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    border-left: none;
    border-radius: 20px;
    text-align: center;
  }
  .toast.error { border-left: none; border-bottom: 3px solid var(--danger); background: rgba(220, 38, 38, 0.08); }
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* List loading */
.file-list.is-loading {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Skeleton */
.skeleton-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
}

.skeleton-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--border) 25%, rgba(0,0,0,.06) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-lines { flex: 1; }

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--border) 25%, rgba(0,0,0,.06) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
}

.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-w60 { width: 60%; }
.skeleton-w40 { width: 40%; }

.skeleton-card { display: block; padding: 0; }
.skeleton-card-thumb { height: 160px; margin-bottom: 12px; border-radius: 6px 6px 0 0; background: linear-gradient(90deg, var(--border) 25%, rgba(0,0,0,.06) 50%, var(--border) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.skeleton-card .skeleton-line { margin: 0 14px 8px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Upload progress */
.upload-progress {
  margin-top: 10px;
  height: 24px;
  position: relative;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  border-radius: 999px;
  width: 0%;
  transition: width .2s ease;
}

.upload-progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  mix-blend-mode: difference;
}

/* Preview spinner */
.preview-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--card);
  z-index: 5;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-icon, .skeleton-line { animation: none; }
  .spinner { animation: none; }
}

/* Responsive */
@media (max-width: 768px) {
  .file-actions { flex-wrap: wrap; }
  .file-item { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .header { padding: 12px 16px; }
  .main { padding: 16px 16px 40px; }
  .auth-box { padding: 28px 20px; }
  .source-view { padding: 16px; }
  .brand-mark { width: 80px; height: 80px; }
  .upload-area { padding: 28px 18px; }
  .preview-expanded-left {
    width: 100%;
  }
  .preview-expanded-right {
    width: 100%;
    justify-content: flex-end;
  }
  .batch-toolbar {
    left: 12px;
    right: 12px;
    transform: none;
    flex-wrap: wrap;
    justify-content: center;
    bottom: 12px;
  }
}

/* Login */
.login-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-main {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form.auth-panel:not(.active) { display: none; }
.login-form.auth-panel.active { display: flex; }

.login-brand {
  text-align: center;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-brand .brand-mark {
  width: 128px;
  height: 128px;
}

.login-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field span {
  font-size: 13px;
  color: var(--text-secondary);
}

.login-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

.login-field select,
.login-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

.login-field select:focus,
.login-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.login-error {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
}

.register-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.register-code-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--card);
  color: var(--text);
  letter-spacing: 4px;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.register-code-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.register-code-row .btn-small {
  white-space: nowrap;
  min-width: 100px;
}
.register-code-tip {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  animation: tipFadeIn .3s ease;
}
.register-username-hint {
  font-size: 13px;
  color: var(--danger);
  margin-top: 4px;
  animation: tipFadeIn .3s ease;
}
@keyframes tipFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-submit {
  margin-top: 4px;
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 500;
  justify-content: center;
}

.login-submit:hover { background: var(--primary-hover); }
.login-submit:disabled { opacity: 0.6; cursor: not-allowed; }

html:not(.light) {
  .login-error {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.35);
  }
}

/* Header right (user + logout) */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Settings dropdown */
.settings-dropdown {
  position: relative;
  display: inline-flex;
}

.btn-settings {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-settings svg {
  width: 16px;
  height: 16px;
  transition: transform .3s ease;
}

.settings-dropdown.open .btn-settings svg {
  transform: rotate(60deg);
}

.settings-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
  z-index: 100;
  padding: 4px;
}

.settings-dropdown.open .settings-menu {
  display: block;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}

.settings-menu-item:hover {
  background: var(--bg);
}

.settings-menu-item svg {
  width: 15px;
  height: 15px;
  opacity: 0.6;
  flex-shrink: 0;
}

.settings-menu-item:hover svg {
  opacity: 1;
}

.header-user {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 2px 8px;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--border);
}

html:not(.light) {
  .header-user {
    background: rgba(255, 255, 255, 0.05);
  }
}

/* Upload privacy checkbox row */
.upload-privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.upload-privacy input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.upload-privacy:hover { color: var(--text); }

/* Lock badge */
.file-lock {
  display: inline-block;
  margin-right: 4px;
  font-size: 0.9em;
  filter: saturate(0.9);
}

/* Skills section */
.skills-section {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.skills-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.skills-header h2 { font-size: 16px; }

.skills-count { font-size: 13px; color: var(--text-secondary); }

.skills-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 14px;
  line-height: 1.6;
}

.skills-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skills-list.is-loading {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 12px 0;
}

.skill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.skill-card-info { flex: 1; min-width: 0; }

.skill-card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.skill-name { font-weight: 600; font-size: 15px; color: var(--text); }

.skill-version {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.skill-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-card-meta { font-size: 12px; color: var(--text-secondary); }

.skill-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.empty-state-sm { padding: 24px 16px; }
.empty-state-sm svg { width: 28px; height: 28px; }
.empty-state-sm p { font-size: 13px; }

/* Modal */
.modal-backdrop[hidden] { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
  max-width: 720px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 16px; margin: 0; }

.modal-close {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 28px;
  justify-content: center;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-body h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 18px 0 8px;
}

.modal-body h3:first-child { margin-top: 0; }

.skill-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.6;
}

.skill-modal-meta code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
}

.skill-file-tree {
  list-style: none;
  padding: 10px 14px;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.skill-file-tree li { padding: 2px 0; }

.skill-modal-source {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
}

.skill-modal-source code { font-family: inherit; }

.skill-install-rendered {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
}

.skill-install-rendered h3 { margin-top: 0; }
.skill-install-rendered h4,
.skill-install-rendered h5 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.skill-install-rendered h5 { font-size: 13px; color: var(--text-secondary); }

.skill-install-rendered p { margin: 0 0 10px; }

.skill-install-rendered ul,
.skill-install-rendered ol { margin: 0 0 12px; padding-left: 22px; }

.skill-install-rendered li { margin: 3px 0; }

.skill-install-rendered pre {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  margin: 0 0 12px;
}

.skill-install-rendered code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.skill-install-rendered pre code { background: none; padding: 0; font-size: inherit; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.modal-footer .btn-primary { width: auto; }
.modal-footer .btn { flex-shrink: 0; }

/* Modal wide variant */
.modal-panel-wide {
  max-width: 860px;
}

/* Modal small variant (prompt / confirm / alert) */
.modal-panel-sm {
  max-width: 440px;
}

.dialog-message {
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

.dialog-field {
  margin-top: 12px;
}

.dialog-field[hidden] {
  display: none;
}

/* Version panel */
.version-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  z-index: 20;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.version-panel.open {
  transform: translateX(0);
}

.version-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.version-panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.version-panel-body {
  overflow-y: auto;
  flex: 1;
  padding: 12px 0;
}

.version-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.version-item:last-child {
  border-bottom: none;
}

.version-item-current {
  background: var(--primary-soft);
}

.version-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.version-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.version-item-current .version-item-dot {
  background: var(--primary);
}

.version-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.version-item-current .version-item-label {
  color: var(--primary);
}

.version-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 16px;
  margin-bottom: 6px;
}

.version-item-actions {
  display: flex;
  gap: 6px;
  margin-left: 16px;
  flex-wrap: wrap;
}

.version-item-actions .btn {
  font-size: 11px;
  padding: 3px 10px;
}

.version-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.file-badge-version {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

/* 上传来源徽章：中性低饱和，仿 file-badge-type 风格 */
.file-badge-source {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* 上传者徽章：柔和的绿色调 */
.file-badge-uploader {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

html:not(.light) {
  .version-panel {
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.35);
  }

  .file-badge-version {
    background: rgba(96, 165, 250, 0.15);
  }

  .file-badge-source {
    background: rgba(255, 255, 255, 0.04);
  }

  .file-badge-uploader {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
  }

  .version-item-current {
    background: rgba(37, 99, 235, 0.12);
  }

  .version-item-dot {
    background: #475569;
  }

  .version-item-current .version-item-dot {
    background: var(--primary);
  }
}

@media (max-width: 640px) {
  .version-panel {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .version-panel {
    transition: none;
  }
}

/* MCP Config Modal */
.mcp-status {
  margin-bottom: 16px;
}

.mcp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.mcp-status-on {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.mcp-status-off {
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.mcp-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mcp-status-on .mcp-status-dot { background: #16a34a; }
.mcp-status-off .mcp-status-dot { background: var(--danger); }

.mcp-info-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.mcp-info-row:last-child { border-bottom: none; }

.mcp-label {
  flex-shrink: 0;
  width: 64px;
  color: var(--text-secondary);
  font-weight: 500;
}

.mcp-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 4px;
  word-break: break-all;
  user-select: all;
}

.mcp-detail h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 20px 0 8px;
}

.mcp-config-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 10px;
  line-height: 1.6;
}

.mcp-config-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.mcp-config-block {
  position: relative;
}

.mcp-config-code {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  overflow-x: auto;
}

.mcp-config-code code { font-family: inherit; }

.mcp-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
}

.mcp-config-path {
  min-height: 18px;
}

.mcp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 12px;
}

.mcp-tab {
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  background: none;
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .2s, border-color .2s;
  margin-bottom: -1px;
}

.mcp-tab:hover {
  color: var(--text);
}

.mcp-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* CLI tab：渲染后的 Markdown 文档（标题/段落/列表/代码块/表格） */
.mcp-cli-doc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.mcp-cli-doc h1 {
  font-size: 18px;
  margin: 0 0 12px;
}
.mcp-cli-doc h2 {
  font-size: 14px;
  margin: 18px 0 8px;
  color: var(--text);
}
.mcp-cli-doc p {
  margin: 0 0 10px;
}
.mcp-cli-doc ul,
.mcp-cli-doc ol {
  margin: 0 0 10px;
  padding-left: 20px;
}
.mcp-cli-doc li {
  margin-bottom: 4px;
}
.mcp-cli-doc blockquote {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-left: 3px solid var(--primary);
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.mcp-cli-doc blockquote p {
  margin: 0;
}
.mcp-cli-doc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
}
/* 代码块（非行内）复用 .mcp-config-code 的样式，保持视觉一致 */
.mcp-cli-doc pre {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 10px;
  overflow-x: auto;
}
.mcp-cli-doc pre code {
  background: none;
  padding: 0;
}
.mcp-cli-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 12px;
}
.mcp-cli-doc th,
.mcp-cli-doc td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.mcp-cli-doc th {
  background: var(--bg);
  font-weight: 600;
}

html:not(.light) {
  .mcp-status-on {
    background: rgba(22, 163, 74, 0.15);
    border-color: rgba(22, 163, 74, 0.35);
  }
  .mcp-status-off {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.3);
  }
}


/* --- Admin-only elements --- */
.admin-only { display: none; }

/* --- Settings menu divider --- */
.settings-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

.settings-menu-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 12px 2px;
  user-select: none;
}

/* --- Users table --- */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.users-table th { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; }
.users-table td { font-size: 14px; }
.users-actions { display: flex; gap: 6px; }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.role-admin { background: #dbeafe; color: #1e40af; }
.role-user { background: #f3f4f6; color: #6b7280; }
html:not(.light) {
  .role-admin { background: #1e3a5f; color: #93c5fd; }
  .role-user { background: #374151; color: #9ca3af; }
}

/* --- Token list --- */
.token-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.token-info { display: flex; flex-direction: column; gap: 2px; }
.token-info strong { font-size: 14px; }
.token-prefix {
  display: inline-block;
  font-family: monospace;
  font-size: 12px;
  padding: 1px 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
  width: fit-content;
}
.token-time { font-size: 12px; color: var(--text-secondary); }
.token-actions { display: flex; gap: 6px; flex-shrink: 0; }
.token-reveal-input {
  width: 100%;
  font-family: monospace;
  font-size: 13px;
  padding: 8px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.btn-danger-outline {
  color: var(--danger);
  border: 1px solid var(--danger);
  background: transparent;
}
.btn-danger-outline:hover { background: var(--danger); color: white; }

/* --- Modal hint --- */
.modal-hint { font-size: 13px; color: var(--text-secondary); margin: 0; }

/* Star button */
.btn-star {
  font-size: 14px;
  color: var(--text-secondary);
  border-color: var(--border);
  min-width: 32px;
  justify-content: center;
}
.btn-star:hover { color: #f59e0b; border-color: #f59e0b; }
.btn-star.starred { color: #f59e0b; border-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }

html:not(.light) {
  .btn-star:hover { color: #fbbf24; border-color: #fbbf24; }
  .btn-star.starred { color: #fbbf24; border-color: #fbbf24; background: rgba(251, 191, 36, 0.12); }
}

/* Tag badge */
.file-badge-tag {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
  cursor: pointer;
}
.file-badge-tag:hover { background: rgba(37, 99, 235, 0.15); }

html:not(.light) {
  .file-badge-tag { background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.25); }
  .file-badge-tag:hover { background: rgba(96, 165, 250, 0.2); }
}

/* Category badge */
.file-badge-category {
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.2);
}

html:not(.light) {
  .file-badge-category { background: rgba(167, 139, 250, 0.12); color: #a78bfa; border-color: rgba(167, 139, 250, 0.25); }
}

/* Filter dropdown */
.filter-dropdown { position: relative; display: inline-flex; }
.filter-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
  z-index: 100;
  padding: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.filter-dropdown.open .filter-dropdown-menu { display: block; }

.filter-dropdown-item {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.filter-dropdown-item:hover { background: var(--bg); }
.filter-dropdown-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }

/* Tag editor modal */
.tag-editor-selected { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; min-height: 28px; }
.tag-editor-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
}
.tag-editor-chip-remove { cursor: pointer; opacity: 0.6; font-size: 14px; line-height: 1; }
.tag-editor-chip-remove:hover { opacity: 1; }

.tag-editor-input-wrap { position: relative; }
#tag-editor-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--card);
  color: var(--text);
}
#tag-editor-input:focus { outline: none; border-color: var(--primary); }

/* Editor */
.editor-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--card);
}


/* .editor-container 的 display:flex 优先级与 [hidden] 相同，会覆盖 hidden 属性，
   导致退出编辑模式回到渲染模式时编辑器仍占据视口、遮挡 iframe（回归）。
   与 .btn[hidden] 同理，需显式补一条规则。 */
.editor-container[hidden] { display: none; }

.editor-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.editor-gutter {
  width: 48px;
  padding: 12px 8px 12px 12px;
  text-align: right;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
  white-space: pre;
  user-select: none;
  opacity: 0.7;
}

.editor-textarea {
  flex: 1;
  padding: 12px 16px;
  border: none;
  outline: none;
  resize: none;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--card);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.editor-statusbar {
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  border-top: 1px solid var(--border);
  text-align: right;
}

html:not(.light) {
  .editor-container {
    background: #0d1117;
  }
  .editor-textarea {
    background: #0d1117;
    color: #c9d1d9;
  }
  .editor-gutter {
    background: #161b22;
    color: #484f58;
    border-right-color: #30363d;
  }
  .editor-statusbar {
    background: #161b22;
    border-top-color: #30363d;
  }
}

.tag-editor-suggestions {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: none;
  max-height: 160px;
  overflow-y: auto;
  z-index: 10;
  list-style: none;
  padding: 4px;
  margin: 0;
}
.tag-editor-suggestions.visible { display: block; }
.tag-editor-suggestions li { padding: 6px 12px; font-size: 13px; cursor: pointer; border-radius: var(--radius-sm); }
.tag-editor-suggestions li:hover { background: var(--bg); }
.tag-create-new { color: var(--primary); font-weight: 500; }

/* Category list */
.category-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  font-size: 14px;
}
.category-list-item:hover { background: var(--bg); }
.category-list-item.selected { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.category-item-actions { display: flex; gap: 4px; }
.category-item-actions .btn { font-size: 11px; padding: 2px 8px; }

/* Template preview card */
.tpl-card {
  display: flex; flex-direction: column; border: 2px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.tpl-card:hover { border-color: var(--text-secondary); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.tpl-card.selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.tpl-preview {
  height: 72px; padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 5px;
  font-size: 0; line-height: 1;
}
.tpl-preview-heading { height: 7px; width: 55%; border-radius: 2px; }
.tpl-preview-line { height: 4px; border-radius: 1px; }
.tpl-preview-line:nth-child(2) { width: 80%; }
.tpl-preview-line:nth-child(3) { width: 60%; }
.tpl-preview-code { height: 14px; width: 40%; border-radius: 2px; margin-top: 2px; }
.tpl-card-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; font-size: 13px; color: var(--text);
  border-top: 1px solid var(--border); background: var(--surface);
}
.tpl-card.selected .tpl-card-label { font-weight: 600; color: var(--primary); }
.tpl-card-check { font-size: 15px; color: var(--primary); display: none; }
.tpl-card.selected .tpl-card-check { display: inline; }
#template-select-list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 4px 0;
}

/* View badge */
.file-badge-views { color: var(--text-secondary); background: transparent; font-size: 11px; padding: 0 4px; }

/* Stats dialog */
.stats-summary { text-align: center; margin-bottom: 12px; }
.stats-total { font-size: 15px; }
.stats-total strong { font-size: 24px; color: var(--primary); margin: 0 4px; }
.stats-section { margin-bottom: 16px; }
.stats-section h4 { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }
.stats-empty { color: var(--text-secondary); font-size: 13px; text-align: center; padding: 12px 0; }
.stats-chart { display: flex; align-items: flex-end; gap: 2px; height: 80px; border-bottom: 1px solid var(--border); padding-bottom: 18px; }
.stats-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; position: relative; }
.stats-bar { width: 100%; max-width: 20px; background: var(--primary); border-radius: 2px 2px 0 0; min-height: 2px; transition: height .3s; }
.stats-bar-val { font-size: 9px; color: var(--text-secondary); line-height: 1; margin-bottom: 2px; }
.stats-bar-label { font-size: 9px; color: var(--text-secondary); position: absolute; bottom: -16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* --- 内容模板市场 --- */
.ct-filter-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ct-filter-bar .search-input-wrap { width: 100%; }
.ct-filter-bar .search-input-wrap input { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 14px; }
.ct-filter-bar .filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ct-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px; cursor: pointer; transition: box-shadow .2s, border-color .2s; display: flex; flex-direction: column; gap: 6px; }
.ct-card:hover { box-shadow: 0 2px 8px var(--shadow); border-color: var(--primary); }
.ct-card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ct-card-title { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ct-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; line-height: 1.4; }
.ct-badge-html { background: #e0f2fe; color: #0369a1; }
.ct-badge-md { background: #dbeafe; color: #1d4ed8; }
.ct-badge-scene { background: var(--primary-light, #ede9fe); color: var(--primary); }
.ct-badge-tag { background: var(--bg-secondary, #f1f5f9); color: var(--text-secondary); }
.ct-card-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin: 0; }
.ct-card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-secondary); margin-top: auto; }
.ct-use-count { color: var(--primary); font-weight: 500; }
.ct-heat-new,
.ct-heat-low,
.ct-heat-mid,
.ct-heat-high { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.4; }
.ct-heat-new { background: var(--bg-secondary, #f1f5f9); color: var(--text-secondary); }
.ct-heat-low { background: #fef3c7; color: #b45309; }
.ct-heat-mid { background: #fee2e2; color: #dc2626; }
.ct-heat-high { background: var(--primary); color: #fff; }
html:not(.light) .ct-heat-low { background: #451a03; color: #fcd34d; }
html:not(.light) .ct-heat-mid { background: #450a0a; color: #fca5a5; }
.ct-owner-mark { color: var(--success, #10b981); font-weight: 500; }
.ct-loading, .ct-empty, .ct-error { text-align: center; padding: 40px; color: var(--text-secondary); font-size: 14px; grid-column: 1 / -1; }
.ct-error strong { display: block; color: var(--danger, #cf222e); margin-bottom: 8px; }
.ct-empty strong { display: block; color: var(--text); margin-bottom: 6px; font-weight: 600; }
.ct-empty-action, .ct-error-action { margin-top: 14px; }
.ct-loading-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; }
.ct-loading-overlay::before { content: ''; position: absolute; inset: 0; background: var(--bg); opacity: 0.85; }
.ct-loading-overlay::after { content: '加载中…'; position: relative; color: var(--text-secondary); font-size: 14px; }
.ct-list-loading, .ct-list-error, .ct-list-empty { text-align: center; padding: 40px; color: var(--text-secondary); font-size: 14px; }
.ct-list-empty strong, .ct-list-error strong { display: block; margin-bottom: 6px; }
.ct-list-error strong { color: var(--danger, #cf222e); }
.ct-list-empty strong { color: var(--text); font-weight: 600; }
.ct-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; grid-column: 1 / -1; padding: 12px 0; }
.ct-page-info { font-size: 13px; color: var(--text-secondary); }
.ct-detail-meta { margin-bottom: 16px; }
.ct-meta-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ct-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 8px 0; }
.ct-meta-info { font-size: 12px; color: var(--text-secondary); }
/* 卡片缩略图 */
.ct-card-thumb { height: 160px; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--bg-secondary, #f1f5f9), var(--border)); margin: -14px -14px 10px; border-radius: 6px 6px 0 0; }
.ct-card-thumb-wrap { width: 1024px; height: 640px; transform: scale(0.25); transform-origin: top left; pointer-events: none; }
.ct-thumb-iframe { width: 100%; height: 100%; border: none; background: #fff; }
.ct-card-thumb-loading { position: absolute; inset: 0; background: linear-gradient(135deg, var(--bg-secondary, #f1f5f9), var(--border)); animation: ct-thumb-pulse 1.5s ease-in-out infinite; }
@keyframes ct-thumb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
html:not(.light) {
  .ct-badge-html { background: #172554; color: #7dd3fc; }
  .ct-badge-md { background: #1e3a5f; color: #93c5fd; }
  .ct-badge-scene { background: #2e1065; color: #c4b5fd; }
  .ct-badge-tag { background: #1e293b; color: #94a3b8; }
  .ct-card-thumb { background: linear-gradient(135deg, #1e293b, #334155); }
}

/* --- 文件列表视图切换 / 卡片视图 --- */
.view-toggle { display: flex; gap: 2px; margin-left: auto; background: var(--bg-secondary, #f1f5f9); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.view-toggle-btn { min-width: 30px; height: 28px; padding: 0 10px; border: none; border-radius: 999px; background: transparent; color: var(--text-secondary); font-size: 16px; line-height: 1; cursor: pointer; transition: background .15s, color .15s; display: inline-flex; align-items: center; justify-content: center; }
.view-toggle-btn:hover { color: var(--text); }
.view-toggle-btn.active { background: var(--card); color: var(--primary); box-shadow: 0 1px 3px var(--shadow); }

.file-list.view-card { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.file-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px; cursor: pointer; transition: box-shadow .2s, border-color .2s; display: flex; flex-direction: column; gap: 8px; }
.file-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.file-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.file-card-thumb { height: 160px; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--bg-secondary, #f1f5f9), var(--border)); margin: -14px -14px 8px; border-radius: 6px 6px 0 0; }
.file-card-thumb-wrap { width: 1024px; height: 640px; transform: scale(0.25); transform-origin: top left; pointer-events: none; opacity: 0; transition: opacity .25s; }
.file-card-thumb-wrap.loaded { opacity: 1; }
.file-card-thumb-iframe { width: 100%; height: 100%; border: none; background: #fff; }
.file-card-thumb-loading { position: absolute; inset: 0; background: linear-gradient(135deg, var(--bg-secondary, #f1f5f9), var(--border)); animation: ct-thumb-pulse 1.5s ease-in-out infinite; }
.file-card-icon-btn { position: absolute; top: 6px; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 999px; background: rgba(255,255,255,.85); color: var(--text-secondary); font-size: 14px; cursor: pointer; z-index: 2; transition: background .15s, color .15s; }
.file-card-icon-btn svg { width: 15px; height: 15px; }
.file-card-star { right: 6px; } /* 星标靠最右 */
.file-card-copy { right: 40px; } /* 复制链接在星标左侧（28 宽 + 6 间距 + 6 边距）*/
.file-card-star.starred { color: #f59e0b; }
.file-card-icon-btn:hover { background: #fff; color: var(--text); }
.file-card-star.starred:hover { color: #f59e0b; }

/* 卡片视图：更多菜单 */
.file-card-more-dropdown { position: absolute; top: 6px; right: 74px; z-index: 3; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.file-card-more-trigger { position: relative; top: auto; right: auto; left: auto; width: 28px; height: 28px; font-size: 16px; letter-spacing: 1px; }
.file-card-more-menu { display: none; position: absolute; top: calc(100% + 4px); right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.15); min-width: 160px; z-index: 50; padding: 4px 0; }
.file-card-more-dropdown.open .file-card-more-menu { display: block; }

/* 卡片视图：复选框 */
.file-card-checkbox { position: absolute; top: 6px; left: 6px; z-index: 3; margin: 0; }
.file-card-checkbox .file-checkbox-visual { background: rgba(255,255,255,.85); border-color: rgba(0,0,0,.15); }

.file-card-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; word-break: break-all; }
.file-card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.file-card-badges .file-badge { font-size: 10px; padding: 1px 6px; line-height: 1.5; }
.file-card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-secondary); margin-top: auto; }
html:not(.light) {
  .file-card-thumb { background: linear-gradient(135deg, #1e293b, #334155); }
  .file-card-icon-btn { background: rgba(30,41,59,.85); color: #94a3b8; }
  .file-card-icon-btn:hover { background: #334155; color: #e2e8f0; }
  .file-card-star.starred { color: #fbbf24; }
  .file-card-more-menu { background: #1e293b; border-color: #334155; }
  .file-card-checkbox .file-checkbox-visual { background: rgba(30,41,59,.85); border-color: rgba(255,255,255,.15); }
}
@media (prefers-reduced-motion: reduce) {
  .file-card-thumb-loading { animation: none; }
}

/* --- 落地页 --- */
.landing-page { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; overflow-x: hidden; }
.landing-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: transparent; transition: background .3s, border-color .3s, box-shadow .3s; border-bottom: 1px solid transparent; }
.landing-nav.scrolled { background: var(--header-bg); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.landing-nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.landing-nav-brand { display: flex; align-items: center; gap: 10px; }
.landing-nav-brand .brand-mark { width: 36px; height: 36px; }
.landing-nav-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.landing-nav-actions { display: flex; align-items: center; gap: 8px; }

.btn-ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost:hover { background: var(--primary); color: #fff; }
.btn-lg { padding: 12px 28px; font-size: 15px; font-weight: 600; }
.btn-sm { padding: 7px 16px; font-size: 13px; font-weight: 500; }

/* ===== Hero ===== */
.landing-hero {
  position: relative; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 120px 24px 80px; gap: 48px;
}
.landing-hero-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.landing-hero-bg .blob {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35;
  animation: blob-float 12s ease-in-out infinite;
}
.blob-1 { width: 600px; height: 600px; background: linear-gradient(135deg, var(--primary), #8b5cf6); top: -120px; left: -120px; animation-delay: 0s; }
.blob-2 { width: 500px; height: 500px; background: linear-gradient(135deg, #06b6d4, #10b981); bottom: -80px; right: -100px; animation-delay: -4s; }
.blob-3 { width: 360px; height: 360px; background: linear-gradient(135deg, #f59e0b, #f472b6); top: 40%; left: 60%; animation-delay: -8s; opacity: .25; }
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(.95); }
}
.landing-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.06) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,.6), transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,.6), transparent 70%);
}
.landing-hero-content { position: relative; z-index: 1; max-width: 820px; }
.landing-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: ui-monospace, "SF Mono", monospace; font-size: 12px;
  letter-spacing: 2px; color: var(--primary); margin-bottom: 24px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.landing-hero-title {
  font-size: clamp(56px, 11vw, 104px); font-weight: 800;
  letter-spacing: -3px; line-height: 1; margin: 0 0 12px;
}
.landing-hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 45%, #06b6d4 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.landing-hero-title small {
  font-weight: 300; font-size: .32em; color: var(--text-secondary); letter-spacing: 4px; vertical-align: super;
}
.landing-hero-sub {
  font-size: clamp(16px, 2.4vw, 22px); color: var(--text);
  font-weight: 500; letter-spacing: 2px; margin: 0 0 20px;
}
.landing-hero-slogan {
  font-size: clamp(15px, 2vw, 19px); font-weight: 400;
  color: var(--text-secondary); margin: 0 auto 36px; line-height: 1.75; max-width: 560px;
}
.landing-hero-actions { display: flex; gap: 14px; justify-content: center; margin-bottom: 40px; }
.landing-hero-actions .btn { display: inline-flex; align-items: center; gap: 8px; }
.landing-hero-actions .btn-primary { width: auto; }
.landing-hero-actions .btn svg { width: 18px; height: 18px; }
.landing-hero-tags { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.landing-tag {
  padding: 6px 14px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--border); font-family: ui-monospace, "SF Mono", monospace;
  font-size: 12px; color: var(--text-secondary); transition: all .3s;
}
.landing-tag:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }

.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== Demo mockup ===== */
.landing-demo {
  position: relative; z-index: 1; width: 100%; max-width: 780px;
  perspective: 1200px; margin-top: 8px;
}
.landing-demo-window {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow), 0 32px 64px rgba(0,0,0,.25);
  overflow: hidden; transform: rotateX(6deg) scale(.98);
  transition: transform .6s ease, box-shadow .6s ease;
  animation: demo-levitate 6s ease-in-out infinite;
}
.landing-demo-window:hover { transform: rotateX(0deg) scale(1); }
@keyframes demo-levitate {
  0%, 100% { transform: rotateX(6deg) translateY(0) scale(.98); }
  50% { transform: rotateX(6deg) translateY(-10px) scale(.98); }
}
.landing-demo-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: rgba(255,255,255,.03); border-bottom: 1px solid var(--border);
}
.landing-demo-dots { display: flex; gap: 6px; }
.landing-demo-dots span { width: 10px; height: 10px; border-radius: 50%; }
.landing-demo-dots span:nth-child(1) { background: #f87171; }
.landing-demo-dots span:nth-child(2) { background: #fbbf24; }
.landing-demo-dots span:nth-child(3) { background: #34d399; }
.landing-demo-title { font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; color: var(--text-secondary); }
.landing-demo-body { display: flex; min-height: 260px; }
.landing-demo-sidebar {
  width: 64px; border-right: 1px solid var(--border); padding: 16px 0;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.demo-logo { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.demo-nav-items { display: flex; flex-direction: column; gap: 8px; }
.demo-nav-items span { width: 24px; height: 6px; border-radius: 3px; background: var(--border); }
.landing-demo-main { flex: 1; padding: 20px; }
.demo-upload {
  border: 2px dashed var(--border); border-radius: 12px; padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--text-secondary); font-size: 13px; margin-bottom: 16px;
  background: rgba(99,102,241,.03);
}
.demo-upload svg { width: 28px; height: 28px; color: var(--primary); }
.demo-file-list { display: flex; flex-direction: column; gap: 8px; }
.demo-file {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px;
}
.demo-file-icon { padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.demo-file-icon.html { background: rgba(251,191,36,.15); color: #fbbf24; }
.demo-file-icon.md { background: rgba(96,165,250,.15); color: #93c5fd; }
.demo-file-icon.zip { background: rgba(167,139,250,.15); color: #c4b5fd; }
.demo-file-name { flex: 1; color: var(--text); font-weight: 500; }
.demo-file-meta { color: var(--text-secondary); font-size: 11px; }

/* ===== 模板展示（保留给弹窗） ===== */
.landing-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.landing-template-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: box-shadow .2s, border-color .2s, transform .2s; }
.landing-template-card:hover { box-shadow: 0 8px 24px var(--shadow); border-color: var(--primary); transform: translateY(-3px); }
.landing-template-thumb { height: 150px; background: linear-gradient(135deg, var(--bg-secondary, #f1f5f9), var(--border)); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.landing-template-thumb::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 40%, rgba(37, 99, 235, 0.06) 100%); }
.landing-template-thumb-placeholder { width: 60px; height: 60px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); position: relative; z-index: 1; }
.landing-template-info { padding: 14px 16px; }
.landing-template-info h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.landing-template-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.landing-template-uses { font-size: 11px; color: var(--text-secondary); }
.landing-template-thumb .ct-card-thumb-wrap { position: relative; z-index: 2; }
.landing-template-thumb .ct-card-thumb-loading { position: absolute; inset: 0; z-index: 1; background: linear-gradient(135deg, var(--bg-secondary, #f1f5f9), var(--border)); animation: ct-thumb-pulse 1.5s ease-in-out infinite; }
.landing-template-empty { text-align: center; padding: 48px; color: var(--text-secondary); font-size: 14px; }
.ct-badge-type { background: #e0f2fe; color: #0369a1; }

/* 模板预览弹窗 */
.modal-panel-lg { max-width: 900px; width: 90vw; max-height: 85vh; display: flex; flex-direction: column; }
.template-preview-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.template-preview-header h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.template-preview-meta { display: flex; gap: 6px; }
.template-preview-body { flex: 1; overflow: hidden; }
.template-preview-body iframe { width: 100%; height: 60vh; border: none; background: #fff; }

/* ===== Sections ===== */
.landing-sec { padding: 100px 24px; position: relative; }
.landing-sec-alt { background: linear-gradient(180deg, transparent, rgba(99,102,241,.03), transparent); }
.landing-sec-inner { max-width: 1000px; margin: 0 auto; }
.landing-sec-tag { font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--primary); margin-bottom: 12px; }
.landing-sec-title { font-size: clamp(30px, 5vw, 48px); font-weight: 700; letter-spacing: -1.5px; margin: 0 0 56px; line-height: 1.15; }

/* Features bento */
.landing-features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.landing-feature-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; transition: all .35s ease; position: relative; overflow: hidden;
}
.landing-feature-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(600px circle at var(--x, 50%) var(--y, 50%), rgba(99,102,241,.12), transparent 40%);
  transition: opacity .3s; pointer-events: none;
}
.landing-feature-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,.35); box-shadow: var(--glow); }
.landing-feature-card:hover::before { opacity: 1; }
.landing-feature-large { grid-column: span 2; }
.landing-feature-wide { grid-column: span 2; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.feature-icon svg { width: 22px; height: 22px; }
.landing-feature-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.landing-feature-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.feature-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.feature-tags span { padding: 3px 10px; border-radius: 999px; font-size: 11px; color: var(--text-secondary); background: var(--bg); border: 1px solid var(--border); }

/* Market preview section */
.landing-sec-market { background: linear-gradient(180deg, rgba(99,102,241,.04), transparent 60%); }
.landing-sec-lead { font-size: 17px; color: var(--text-secondary); line-height: 1.8; max-width: 760px; margin: -36px 0 48px; }
.market-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.market-preview-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; transition: all .35s ease; position: relative; overflow: hidden; }
.market-preview-card:hover { transform: translateY(-4px); border-color: rgba(99,102,241,.35); box-shadow: var(--glow); }
.mp-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 14px; }
.market-preview-card h4 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.market-preview-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.market-preview-cta { display: flex; align-items: center; gap: 20px; margin-top: 40px; flex-wrap: wrap; }
.market-preview-cta .btn { display: inline-flex; align-items: center; gap: 8px; }
.market-preview-cta .btn svg { width: 18px; height: 18px; }
.mp-hint { font-size: 13px; color: var(--text-secondary); }

/* Steps */
.landing-steps { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 16px; }
.landing-step { text-align: center; padding: 32px 24px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; transition: all .35s ease; }
.landing-step:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--glow); }
.step-num { font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; color: var(--primary); margin-bottom: 16px; letter-spacing: 2px; }
.step-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.step-icon svg { width: 24px; height: 24px; }
.landing-step h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.landing-step p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.landing-step-divider { width: 48px; height: 2px; background: linear-gradient(90deg, var(--primary), #8b5cf6); opacity: .35; border-radius: 1px; }

/* Stats */
.landing-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 40px 32px; box-shadow: var(--shadow);
}
.stat { text-align: center; }
.stat strong { display: block; font-size: clamp(26px, 4vw, 38px); font-weight: 700; color: var(--text); letter-spacing: -1px; }
.stat span { font-size: 13px; color: var(--text-secondary); }

/* 版本时间线 */
.landing-versions { display: flex; flex-direction: column; gap: 0; position: relative; }
.landing-versions::before { content: ''; position: absolute; left: 28px; top: 0; bottom: 0; width: 2px; background: linear-gradient(to bottom, var(--primary), #8b5cf6 50%, #06b6d4); opacity: .2; }
.ver { position: relative; padding-left: 68px; padding-bottom: 48px; }
.ver:last-child { padding-bottom: 0; }
.ver-dot { position: absolute; left: 20px; top: 4px; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--primary); background: var(--bg); z-index: 2; transition: all .4s; }
.ver:hover .ver-dot { background: var(--primary); box-shadow: 0 0 18px rgba(99,102,241,.5); transform: scale(1.2); }
.ver:nth-child(2) .ver-dot { border-color: #8b5cf6; }
.ver:nth-child(2):hover .ver-dot { background: #8b5cf6; box-shadow: 0 0 18px rgba(139,92,246,.5); }
.ver:nth-child(3) .ver-dot { border-color: #06b6d4; }
.ver:nth-child(3):hover .ver-dot { background: #06b6d4; box-shadow: 0 0 18px rgba(6,182,212,.5); }
.ver-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px 28px 24px; backdrop-filter: blur(8px); transition: all .4s; }
.ver:hover .ver-card { border-color: var(--primary); box-shadow: var(--glow); }
.ver:nth-child(2):hover .ver-card { border-color: #8b5cf6; box-shadow: 0 0 24px rgba(139,92,246,.2); }
.ver:nth-child(3):hover .ver-card { border-color: #06b6d4; box-shadow: 0 0 24px rgba(6,182,212,.2); }
.ver-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.ver-num { font-family: ui-monospace, "SF Mono", monospace; font-size: 13px; font-weight: 700; letter-spacing: 1px; padding: 4px 10px; border-radius: 6px; color: var(--primary); background: rgba(99,102,241,.12); }
.ver:nth-child(2) .ver-num { color: #8b5cf6; background: rgba(139,92,246,.10); }
.ver:nth-child(3) .ver-num { color: #06b6d4; background: rgba(6,182,212,.10); }
.ver-date { font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; color: var(--text-secondary); }
.ver-title { font-size: 18px; font-weight: 600; flex: 1; }
.ver-desc { font-size: 15px; color: var(--text-secondary); line-height: 1.75; }

/* 设计理念 */
.landing-philos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.phi { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; backdrop-filter: blur(8px); transition: all .4s; position: relative; overflow: hidden; }
.phi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; opacity: 0; transition: opacity .4s; }
.phi:nth-child(1)::before { background: linear-gradient(90deg, var(--primary), #06b6d4); }
.phi:nth-child(2)::before { background: linear-gradient(90deg, #8b5cf6, #f59e0b); }
.phi:nth-child(3)::before { background: linear-gradient(90deg, #06b6d4, var(--primary)); }
.phi:nth-child(4)::before { background: linear-gradient(90deg, #f59e0b, #8b5cf6); }
.phi:hover::before { opacity: 1; }
.phi:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--glow); }
.phi-ico { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 16px; }
.phi:nth-child(1) .phi-ico { background: rgba(99,102,241,.12); }
.phi:nth-child(2) .phi-ico { background: rgba(139,92,246,.10); }
.phi:nth-child(3) .phi-ico { background: rgba(6,182,212,.10); }
.phi:nth-child(4) .phi-ico { background: rgba(245,158,11,.10); }
.phi h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.phi p { font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* CTA */
.landing-sec-cta { padding-bottom: 120px; }
.landing-cta {
  text-align: center; padding: 64px 32px; border-radius: 24px;
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.08));
  border: 1px solid var(--border); position: relative; overflow: hidden;
}
.landing-cta::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(600px circle at 50% 0%, rgba(99,102,241,.15), transparent 60%);
  pointer-events: none;
}
.landing-cta h2 { position: relative; font-size: clamp(26px, 4vw, 38px); font-weight: 700; margin-bottom: 12px; }
.landing-cta p { position: relative; color: var(--text-secondary); font-size: 16px; margin-bottom: 28px; }
.landing-cta .btn { position: relative; }

/* ===== 页脚 ===== */
.landing-footer {
  text-align: center; padding: 40px 24px; font-size: 13px;
  color: var(--text-secondary); border-top: 1px solid var(--border);
}
.landing-footer p { margin: 0; }
.landing-footer a { color: var(--text-secondary); text-decoration: none; transition: color .2s; }
.landing-footer a:hover { color: var(--primary); }
.landing-icp { margin: 8px 0 0; font-size: 12px; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .landing-features-grid { grid-template-columns: repeat(2, 1fr); }
  .landing-feature-large, .landing-feature-wide { grid-column: span 2; }
  .market-preview-grid { grid-template-columns: repeat(2, 1fr); }
  .landing-steps { grid-template-columns: 1fr; }
  .landing-step-divider { display: none; }
  .landing-stats { grid-template-columns: repeat(3, 1fr); }
  .landing-demo-window { transform: rotateX(0deg) scale(1); animation: none; }
}
@media (max-width: 640px) {
  .landing-nav-inner { padding: 0 16px; height: 60px; }
  .landing-hero { padding: 100px 16px 48px; }
  .landing-hero-actions { flex-direction: column; align-items: stretch; }
  .landing-hero-actions .btn { width: 100%; justify-content: center; }
  .landing-features-grid { grid-template-columns: 1fr; }
  .landing-feature-large, .landing-feature-wide { grid-column: span 1; }
  .market-preview-grid { grid-template-columns: 1fr; }
  .landing-sec-lead { margin: -20px 0 28px; }
  .market-preview-cta { flex-direction: column; align-items: flex-start; gap: 12px; }
  .landing-stats { grid-template-columns: repeat(2, 1fr); padding: 28px 20px; }
  .landing-sec { padding: 64px 16px; }
  .landing-sec-title { margin-bottom: 36px; }
  .landing-versions::before { left: 18px; }
  .ver { padding-left: 52px; }
  .ver-dot { left: 10px; }
  .ver-head { gap: 8px; }
  .ver-title { font-size: 16px; }
  .landing-philos { grid-template-columns: 1fr; }
}

/* ===== 落地页深色模式 ===== */
html:not(.light) {
  .ct-badge-type { background: #172554; color: #7dd3fc; }
  .template-preview-body iframe { background: #1e293b; }
  .landing-tag { background: rgba(16, 16, 32, .75); }
  .landing-grid { opacity: .6; }
  .demo-file { background: rgba(255,255,255,.03); }
  .demo-upload { background: rgba(99,102,241,.05); }
  .landing-feature-card::before { background: radial-gradient(600px circle at var(--x, 50%) var(--y, 50%), rgba(99,102,241,.18), transparent 40%); }
}

/* 邮箱验证提示条 */
.email-verify-banner[hidden] { display: none; }
.email-verify-banner:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  background: #fef3c7;
  color: #92400e;
  font-size: 14px;
}
.email-verify-banner .btn { font-size: 12px; }
@media (prefers-color-scheme: dark) {
  .email-verify-banner:not([hidden]) { background: #422006; color: #fbbf24; }
}


/* Batch upload result list (dialog) */
.batch-result-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  text-align: left;
}

.batch-result-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.batch-result-fail {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.batch-result-name {
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.batch-result-error {
  color: var(--danger);
  font-size: 12px;
}

/* ---------- 分享设置弹窗 ---------- */
.modal-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header-title svg {
  color: var(--primary);
  flex-shrink: 0;
}

.modal-header-title h2 {
  font-size: 16px;
  margin: 0;
}

/* 状态徽标 */
.share-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.file-badge-share-lock {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
}

.file-badge-share-expire {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

html:not(.light) {
  .file-badge-share-lock { background: rgba(251, 191, 36, 0.16); color: #fbbf24; }
  .file-badge-share-expire { background: rgba(129, 140, 248, 0.18); color: #a5b4fc; }
}

/* 链接卡片 */
.share-link-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 18px;
}

.share-link-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.share-link-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* 链接行：只读输入框 + 复制按钮 */
.share-link-row {
  display: flex;
  gap: 8px;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.btn-share-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.btn-share-copy svg {
  flex-shrink: 0;
}

/* 设置区块容器 */
.share-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 单个设置区块 */
.share-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color 0.15s;
}

.share-section:hover {
  border-color: var(--primary-soft);
}

.share-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.share-section-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border-radius: 8px;
  color: var(--primary);
  flex-shrink: 0;
}

.share-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.share-section-body {
  margin-bottom: 12px;
}

.share-section-body input[type="text"],
.share-section-body input[type="password"],
.share-section-body input[type="datetime-local"] {
  width: 100%;
  box-sizing: border-box;
}

.share-input-group {
  display: flex;
  gap: 8px;
}

.share-input-group input {
  flex: 1;
  min-width: 0;
}

.share-password-group {
  position: relative;
}

.share-password-group input {
  padding-right: 36px;
}

.share-password-toggle {
  position: absolute;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.share-password-toggle:hover {
  color: var(--text-primary);
}

.share-password-toggle svg {
  width: 16px;
  height: 16px;
}

.share-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.share-section-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* 幽灵按钮 */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--primary-soft);
  border-color: var(--border);
}

/* 弱化危险按钮 */
.btn-danger-soft {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger-soft:hover {
  background: rgba(248, 113, 113, 0.08);
  border-color: var(--danger);
}

html:not(.light) .btn-danger-soft {
  border-color: rgba(248, 113, 113, 0.25);
}


/* ============================================================
   内容模板市场（独立页面 #/market）
   ============================================================ */

.market-page { max-width: 1200px; margin: 0 auto; padding: 20px; }

.market-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.market-header-left { display: flex; align-items: center; gap: 12px; }
.market-back { color: var(--text-secondary); text-decoration: none; font-size: 14px; white-space: nowrap; }
.market-back:hover { color: var(--primary); }
.market-title { font-size: 22px; font-weight: 700; margin: 0; color: var(--text); }
.market-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.market-nav-item {
  padding: 6px 14px; border-radius: 6px; text-decoration: none;
  font-size: 14px; color: var(--text-secondary); border: 1px solid transparent;
}
.market-nav-item:hover { color: var(--primary); background: var(--bg-secondary, #f1f5f9); }
.market-nav-item.active { color: var(--primary); border-color: var(--primary); background: var(--primary-light, #ede9fe); }
.market-nav-item.admin-only { color: var(--danger); }

/* 市场首页工具条 */
.market-toolbar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.market-search-wrap { flex: 1; min-width: 240px; }
.market-search-wrap .search-input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); color: var(--text); font-size: 14px;
}
.market-sort { flex-shrink: 0; }
.market-select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 14px; cursor: pointer;
}

/* 详情页 */
.market-detail { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 768px) { .market-detail { grid-template-columns: 1fr; } }
.market-detail-preview { min-height: 400px; }
.market-detail-iframe {
  width: 100%; height: calc(100vh - 140px); min-height: 500px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.market-detail-meta { display: flex; flex-direction: column; gap: 0; }
.market-detail-title { font-size: 20px; font-weight: 700; margin: 0 0 8px; color: var(--text); line-height: 1.35; }
.market-detail-section { padding: 16px 0; border-bottom: 1px solid var(--border); }
.market-detail-section:first-child { padding-top: 0; }
.market-detail-section:last-child { border-bottom: 0; padding-bottom: 0; }
.market-detail-section-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 10px; }
.market-detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.market-detail-stat { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.market-detail-stat span { color: var(--text-secondary); font-size: 12px; }
.market-detail-stat strong { color: var(--text); font-weight: 600; }
.market-detail-actions.mw-icon-actions { display: flex; flex-direction: column; gap: 10px; }
.market-detail-actions.mw-icon-actions .btn-primary { width: 100%; justify-content: center; height: 40px; font-size: 14px; }
.market-detail-actions.mw-icon-actions > .mw-icon-btn { width: 44px; height: 44px; }
.market-detail-related { display: flex; flex-direction: column; gap: 8px; }
.market-detail-related-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  background: transparent; cursor: pointer; transition: all .15s; text-align: left; width: 100%; font: inherit; color: inherit;
}
.market-detail-related-item:hover { background: var(--primary-soft); border-color: var(--primary); }
.market-detail-related-thumb {
  width: 48px; height: 48px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; flex-shrink: 0; overflow: hidden;
}
.market-detail-related-thumb iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.market-detail-related-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.market-detail-related-title { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-detail-related-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-secondary); }
.market-detail-empty-small { font-size: 13px; color: var(--text-secondary); padding: 8px 0; }

/* 详情页图标按钮组 */
.mw-icon-actions { gap: 6px; }
.mw-icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text-secondary);
  cursor: pointer; padding: 0; transition: all .15s;
}
.mw-icon-btn:hover { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); background: var(--bg-hover, #f5f7fa); }
.mw-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* 收藏按钮：已收藏时填充星形并高亮 */
.mw-icon-btn[data-starred="1"] { color: #f59e0b; border-color: #f59e0b; }
.mw-icon-btn[data-starred="1"] svg { fill: #f59e0b; stroke: #f59e0b; }
/* 主操作按钮（使用模板）实心高亮 */
.mw-icon-btn-primary { background: var(--accent, #2563eb); border-color: var(--accent, #2563eb); color: #fff; }
.mw-icon-btn-primary:hover { background: var(--accent-hover, #1d4ed8); border-color: var(--accent-hover, #1d4ed8); color: #fff; }
.mw-icon-btn-primary svg { stroke: currentColor; }

/* 提交/编辑表单 */
.market-form { max-width: 720px; display: flex; flex-direction: column; gap: 16px; }
.market-form-title { font-size: 16px; font-weight: 600; margin: 0; color: var(--text); }
.market-form-row { display: flex; flex-direction: column; gap: 6px; }
.market-form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.market-input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.market-input-narrow { max-width: 120px; }
.market-textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  resize: vertical; font-family: inherit;
}
.market-textarea-code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px; line-height: 1.6;
}
.market-form-preview { display: flex; flex-direction: column; gap: 6px; }
.market-form-preview-iframe {
  width: 100%; min-height: 300px; border: 1px solid var(--border);
  border-radius: 6px; background: #fff;
}
.market-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.market-form-hint { font-size: 12px; color: var(--text-secondary); margin: 0; }

/* 列表（我的上架 / 管理） */
.market-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.mine-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; flex-wrap: wrap;
}
.mine-item-main { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 200px; }
.mine-item-title { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mine-item-meta { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mine-item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mine-review-note {
  font-size: 12px; color: var(--danger); background: rgba(220, 38, 38, 0.08);
  padding: 6px 10px; border-radius: 4px; margin-top: 4px;
}

/* 状态徽章 */
.ct-status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 500; line-height: 1.4;
}
.ct-status-draft { background: var(--bg-secondary, #f1f5f9); color: var(--text-secondary); }
.ct-status-pending { background: #fef3c7; color: #92400e; }
.ct-status-approved { background: #d1fae5; color: #065f46; }
.ct-status-rejected { background: #fee2e2; color: #991b1b; }
.ct-status-archived { background: var(--bg-secondary, #f1f5f9); color: var(--text-secondary); opacity: 0.7; }

.ct-badge-featured { background: #fef3c7; color: #92400e; }

/* 管理页 */
.market-admin-tabs { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.market-cat-mgr-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.market-cat-add { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.market-cat-add .market-input { flex: 1; min-width: 140px; }

/* 分类管理：拖拽排序 */
.market-cat-hint { font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.market-cat-head-actions { display: flex; gap: 8px; }
.market-cat-list .cat-row { cursor: grab; align-items: center; }
.market-cat-list .cat-row:active { cursor: grabbing; }
.cat-drag-handle {
  color: var(--text-secondary); font-size: 18px; line-height: 1;
  cursor: grab; user-select: none; padding: 0 2px; flex-shrink: 0;
}
.cat-row.cat-dragging { opacity: 0.4; }
.cat-row.cat-drag-over { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.login-field-inline { flex-direction: row; align-items: center; gap: 8px; }

/* 上架到市场弹窗 */
.pub-source { margin: 0 0 8px; font-size: 13px; color: var(--text-secondary); }
.pub-source strong { color: var(--text); }
.pub-current { margin: 0 0 12px; font-size: 12px; color: var(--danger); background: rgba(220, 38, 38, 0.08); padding: 6px 10px; border-radius: 4px; }
.mine-source-file { font-size: 12px; color: var(--text-secondary); }
.mine-source-file a { color: var(--primary); text-decoration: none; }
.mine-source-file a:hover { text-decoration: underline; }

/* --- MakerWorld-style creative market shell --- */
.mw-market-page.market-page {
  max-width: none;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  margin: 0;
  padding: 0;
  background: #f6f7f9;
  color: #17181d;
  /* Market 为固定浅色风格，覆盖全局 dark 主题变量，避免右侧/卡片出现浅色背景配浅色文字 */
  --text: #17181d;
  --text-secondary: #4b5563;
  --bg: #f6f7f9;
  --border: #e5e7eb;
}

.mw-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 14px;
  border-right: 1px solid #e8eaf0;
  background: #fff;
  z-index: 2;
}

.mw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 16px;
  color: #111827;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.1;
}

.mw-brand strong { font-size: 16px; }

.mw-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
}

.mw-side-nav,
.mw-side-section {
  display: grid;
  gap: 4px;
}

.mw-side-nav a,
.mw-side-nav button,
.mw-side-section a,
.mw-side-footer a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #2f3440;
  font-size: 14px;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.mw-side-nav a.active,
.mw-side-nav button:hover,
.mw-side-section a:hover,
.mw-side-section a.active,
.mw-side-footer a:hover {
  background: #f0f2f5;
  color: #111827;
}

.mw-side-section {
  padding-top: 12px;
  border-top: 1px solid #eef0f4;
}

.mw-side-title {
  padding: 0 14px 4px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 750;
}

.mw-side-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #eef0f4;
}

.mw-icp {
  margin: 8px 0 0;
  padding: 0 14px;
  font-size: 11px;
  color: #9ca3af;
}
.mw-icp a { color: inherit; text-decoration: none; }
.mw-icp a:hover { color: #6b7280; text-decoration: underline; }

.mw-main {
  min-width: 0;
  padding: 24px 26px 48px;
}

.mw-topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.mw-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mw-search-wrap {
  max-width: 1000px;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid #e4e7ec;
  border-radius: 23px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.mw-search-wrap span {
  color: #6b7280;
  font-size: 18px;
}

.mw-search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #17181d;
  font-size: 14px;
}

.mw-category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.mw-category-row .filter-chip {
  height: 38px;
  padding: 0 22px;
  border: 0;
  border-radius: 9px;
  background: #eceef2;
  color: #1f2937;
  font-size: 14px;
  font-weight: 750;
}

.mw-category-row .filter-chip.active {
  background: #24262d;
  color: #fff;
}

.mw-hero-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.mw-feature-card {
  min-height: 320px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  padding: 28px;
  border: 0;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.58)),
    linear-gradient(135deg, #d9f99d, #67e8f9 48%, #bef264);
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.mw-feature-card::before {
  content: "";
  position: absolute;
  inset: 22px 28px auto auto;
  width: 180px;
  height: 180px;
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 18px 18px;
  transform: rotate(8deg);
  opacity: 0.65;
}

.mw-feature-card span,
.mw-feature-card strong,
.mw-feature-card small {
  position: relative;
}

.mw-feature-card span {
  font-size: 14px;
  font-weight: 800;
}

.mw-feature-card strong {
  max-width: 520px;
  font-size: 34px;
  line-height: 1.12;
}

.mw-feature-card small {
  max-width: 520px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.86);
}

.mw-explore-card {
  min-height: 320px;
  padding: 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ecffd5, #f8fff0);
}

.mw-explore-card h2 {
  margin: 0 0 18px;
  color: #17211a;
  font-size: 22px;
}

.mw-explore-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mw-explore-grid button {
  min-height: 120px;
  padding: 18px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: #1f2937;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mw-explore-grid strong,
.mw-explore-grid span {
  display: block;
}

.mw-explore-grid strong {
  margin-bottom: 6px;
  font-size: 16px;
}

.mw-explore-grid span {
  color: #6b7280;
  font-size: 13px;
}

.mw-feed-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 8px 0 16px;
}

.mw-feed-head h1 {
  margin: 0 0 4px;
  color: #17181d;
  font-size: 20px;
}

.mw-feed-head p,
.mw-feed-head span {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
}

.mw-grid.ct-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.mw-market-page .mw-card {
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
}

.mw-market-page .mw-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.12);
}

.mw-market-page .ct-card-thumb {
  aspect-ratio: 4 / 3;
  height: auto;
  margin: 0;
  border-radius: 12px 12px 0 0;
  background: #e9edf3;
}

.mw-market-page .ct-card-thumb-wrap {
  transform: scale(0.30);
}

.mw-card-actions {
  position: absolute;
  inset: auto 12px 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s, transform 0.18s;
}

.mw-card:hover .mw-card-actions,
.mw-card:focus-within .mw-card-actions {
  opacity: 1;
  transform: translateY(0);
}

.mw-card-actions button {
  flex: 1;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.mw-card-actions button:last-child {
  background: #00c853;
  border-color: #00c853;
}

.mw-card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 12px 0;
}

.mw-market-page .ct-card-header {
  padding: 8px 12px 0;
}

.mw-market-page .ct-card-title {
  color: #17181d;
  font-size: 15px;
  white-space: normal;
}

.mw-market-page .ct-card-desc {
  min-height: 38px;
  padding: 6px 12px 0;
  color: #6b7280;
  font-size: 13px;
}

.mw-card-author {
  padding: 8px 12px 0;
  color: #6b7280;
  font-size: 12px;
}

.mw-market-page .ct-card-footer {
  padding: 10px 12px 14px;
  color: #6b7280;
  border-top: 0;
}

.mw-market-page .ct-use-count,
.mw-rating {
  color: #4b5563;
}

.mw-rating::before {
  content: "评分 ";
  color: #9ca3af;
}

.mw-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 28px;
  border: 1px dashed #d5dae3;
  border-radius: 14px;
  background: #fff;
  color: #6b7280;
}

.mw-empty strong {
  color: #17181d;
  font-size: 16px;
}

.mw-main .market-detail,
.mw-main .market-form,
.mw-main .market-admin,
.mw-main .market-list,
.mw-main .filter-chips {
  color: #17181d;
}

.mw-main .market-detail {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}

.mw-main .market-detail-meta,
.mw-main .market-form,
.mw-main .market-admin,
.mw-main .mine-item,
.mw-main .market-cat-mgr {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.mw-main .market-detail-meta,
.mw-main .market-form,
.mw-main .market-admin,
.mw-main .market-cat-mgr {
  padding: 18px;
}

.mw-main .market-detail-meta {
  position: sticky;
  top: 20px;
  align-self: start;
  min-height: calc(100vh - 140px);
}

.mw-main .market-detail-iframe {
  border-color: #e5e7eb;
  border-radius: 14px;
  background: #fff;
}
.mw-main .market-detail-related-item { border-color: #e5e7eb; }
.mw-main .market-detail-related-item:hover { background: #f3f4f6; border-color: var(--primary); }
.mw-main .market-detail-related-thumb { border-color: #e5e7eb; }

/* Market 页面内统一 badge / heat 配色，减少风格色数量并确保浅色背景下可读 */
.mw-market-page.market-page .ct-badge,
.mw-market-page.market-page .ct-badge-html,
.mw-market-page.market-page .ct-badge-md,
.mw-market-page.market-page .ct-badge-scene,
.mw-market-page.market-page .ct-badge-tag,
.mw-market-page.market-page .ct-badge-featured {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.mw-market-page.market-page .ct-heat-new,
.mw-market-page.market-page .ct-heat-low,
.mw-market-page.market-page .ct-heat-mid,
.mw-market-page.market-page .ct-heat-high {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.mw-main .filter-chips {
  margin-bottom: 16px;
}

@media (max-width: 980px) {
  .mw-market-page.market-page {
    display: block;
  }

  .mw-sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 14px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid #e8eaf0;
  }

  .mw-brand {
    padding: 0;
  }

  .mw-side-nav,
  .mw-side-section,
  .mw-side-footer {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .mw-side-nav {
    grid-column: 1 / -1;
    order: 3;
  }

  .mw-side-section {
    grid-column: 2;
    justify-content: flex-end;
    padding-top: 0;
    border-top: 0;
  }

  .mw-side-title,
  .mw-side-footer {
    display: none;
  }

  .mw-side-nav a,
  .mw-side-nav button,
  .mw-side-section a {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 0 12px;
    background: #f4f5f7;
  }

  .mw-main {
    padding: 18px 16px 36px;
  }

  .mw-hero-grid,
  .mw-main .market-detail {
    grid-template-columns: 1fr;
  }

  .mw-main .market-detail-meta {
    position: static;
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .mw-topbar {
    grid-template-columns: 1fr;
  }

  .mw-top-actions {
    flex-wrap: wrap;
  }

  .mw-category-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .mw-category-row .filter-chip {
    flex: 0 0 auto;
  }

  .mw-feature-card,
  .mw-explore-card {
    min-height: 250px;
  }

  .mw-feature-card strong {
    font-size: 26px;
  }

  .mw-explore-grid,
  .mw-grid.ct-grid {
    grid-template-columns: 1fr;
  }
}

/* 图标按钮文字提示气泡（比原生 title 更醒目、立即出现） */
.mw-icon-btn[data-tip] { position: relative; }
.mw-icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  white-space: nowrap; padding: 4px 8px;
  background: #111827; color: #fff;
  font-size: 12px; line-height: 1.4; border-radius: 4px;
  pointer-events: none; opacity: 0; transition: opacity .15s;
  z-index: 10;
}
.mw-icon-btn[data-tip]::before {
  content: ''; position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: #111827;
  pointer-events: none; opacity: 0; transition: opacity .15s;
  margin-bottom: 2px;
}
.mw-icon-btn[data-tip]:hover::after,
.mw-icon-btn[data-tip]:hover::before { opacity: 1; }

/* ============================================================
   创作市场首页交互增强（骨架屏 / 分段排序 / 横向分类 / 悬停操作 / 回到顶部）
   ============================================================ */

.hidden { display: none !important; }

/* 顶部工具栏：搜索 + 排序分段 + 类型筛选 + 清除 */
.mw-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.mw-search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 560px;
}

.mw-search-wrap input {
  width: 100%;
  padding: 10px 36px 10px 18px;
  border: 1px solid #e4e7ec;
  border-radius: 23px;
  background: #fff;
  color: #17181d;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.mw-search-wrap input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.mw-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #e4e7ec;
  color: #4b5563;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.mw-search-clear:hover { background: #d1d5db; color: #111827; }

.mw-segmented-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #eceef2;
}

.mw-segmented-tabs button {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.mw-segmented-tabs button:hover { color: #111827; }
.mw-segmented-tabs button.active { background: #fff; color: #111827; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }

.mw-type-chips {
  display: inline-flex;
  gap: 6px;
}

.mw-type-chips button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fff;
  color: #4b5563;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: all .15s;
}

.mw-type-chips button:hover { border-color: #2563eb; color: #2563eb; }
.mw-type-chips button.active { background: #2563eb; border-color: #2563eb; color: #fff; }

.mw-clear-filters {
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.25);
}

.mw-clear-filters:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.4);
}

/* 分类横向滚动容器 */
.mw-category-scroll {
  position: relative;
  margin-bottom: 24px;
}

.mw-category-scroll::before,
.mw-category-scroll::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity .2s;
}

.mw-category-scroll.show-left::before {
  left: 0;
  opacity: 1;
  background: linear-gradient(90deg, #f6f7f9, transparent);
}

.mw-category-scroll.show-right::after {
  right: 0;
  opacity: 1;
  background: linear-gradient(270deg, #f6f7f9, transparent);
}

.mw-category-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 4px;
}

.mw-category-row::-webkit-scrollbar { display: none; }

.mw-cat-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e4e7ec;
  border-radius: 50%;
  background: #fff;
  color: #4b5563;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.mw-cat-scroll-btn:hover { background: #f3f4f6; color: #111827; }
.mw-cat-scroll-btn.left { left: -10px; }
.mw-cat-scroll-btn.right { right: -10px; }
.mw-cat-scroll-btn.hidden { display: none; }

/* 骨架屏（市场卡片） */
.ct-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.ct-skeleton-card {
  min-height: 280px;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.ct-skeleton-thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, #e9edf3 25%, #f1f5f9 50%, #e9edf3 75%);
  background-size: 200% 100%;
  animation: ct-skeleton-shimmer 1.4s ease-in-out infinite;
}

.ct-skeleton-lines {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ct-skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e9edf3 25%, #f1f5f9 50%, #e9edf3 75%);
  background-size: 200% 100%;
  animation: ct-skeleton-shimmer 1.4s ease-in-out infinite;
}

.ct-skeleton-line.w70 { width: 70%; }
.ct-skeleton-line.w40 { width: 40%; }

@keyframes ct-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 列表加载遮罩 */
.ct-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(246, 247, 249, 0.65);
  border-radius: 12px;
  backdrop-filter: blur(2px);
  z-index: 2;
}

.ct-loading-overlay::after {
  content: '';
  width: 28px;
  height: 28px;
  border: 3px solid #e4e7ec;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: ct-spin 0.8s linear infinite;
}

@keyframes ct-spin { to { transform: rotate(360deg); } }

/* 卡片悬停快捷操作扩展：右上角图标组 */
.mw-card-top-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s, transform .18s;
}

.mw-card:hover .mw-card-top-actions,
.mw-card:focus-within .mw-card-top-actions {
  opacity: 1;
  transform: translateY(0);
}

.mw-card-top-actions .mw-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.72);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(12px);
}

.mw-card-top-actions .mw-icon-btn:hover {
  background: rgba(17, 24, 39, 0.88);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.mw-card-top-actions .mw-icon-btn svg {
  width: 18px;
  height: 18px;
}

.mw-card-top-actions .mw-icon-btn.is-loading svg,
.mw-card-actions button.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.mw-card-actions button.is-loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ct-spin 0.7s linear infinite;
  vertical-align: middle;
}

/* 使用模板弹窗：下载源文件 / CLI / MCP 三栏 */
.use-template-dialog { text-align: left; }
.use-template-tip {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  line-height: 1.5;
}
.use-template-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.use-template-option {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.option-icon {
  font-size: 22px;
  line-height: 1;
}
.option-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.option-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}
.btn-download-template {
  justify-content: center;
  width: 100%;
  text-decoration: none;
}
.use-template-field { display: flex; flex-direction: column; gap: 8px; }
.use-template-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.use-template-field-header label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.btn-copy-prompt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
}
.btn-copy-prompt svg { width: 14px; height: 14px; }
.use-template-textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.use-template-hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
@media (max-width: 640px) {
  .use-template-options { grid-template-columns: 1fr; }
  .use-template-option { padding: 12px; }
}

/* 加载更多 / 到底提示 */
.mw-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 24px 0 8px;
}

.mw-load-more-btn {
  min-width: 140px;
  height: 40px;
  padding: 0 24px;
  border: 1px solid #e4e7ec;
  border-radius: 20px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: all .15s;
}

.mw-load-more-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.mw-load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mw-end-msg {
  color: #9ca3af;
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

/* 回到顶部 */
.mw-back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e4e7ec;
  border-radius: 50%;
  background: #fff;
  color: #4b5563;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: opacity .2s, transform .2s;
  z-index: 50;
}

.mw-back-to-top:hover {
  background: #f3f4f6;
  color: #111827;
}

.mw-back-to-top.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

/* 无障碍：实时结果数，仅对读屏可见 */
.mw-aria-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 响应式微调 */
@media (max-width: 980px) {
  .mw-filter-bar { gap: 10px; }
  .mw-search-wrap { max-width: none; width: 100%; }
  .mw-top-actions { width: 100%; }
}

@media (max-width: 640px) {
  .mw-segmented-tabs,
  .mw-type-chips { flex: 1; flex-wrap: wrap; }
  .mw-segmented-tabs button,
  .mw-type-chips button { flex: 1; }
  .mw-cat-scroll-btn { display: none; }
}


/* 使用模板对话框 - 三栏选项优化 */
.use-template-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 12px 0;
}
.use-template-option {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: var(--bg);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.use-template-option:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: var(--primary);
}
.option-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.option-icon { font-size: 18px; }
.option-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}
.btn-download-template {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.option-download {
  background: linear-gradient(180deg, var(--bg) 0%, rgba(79, 70, 229, 0.04) 100%);
}
.use-template-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.5;
}
