/* clawhub.ai 中文版 - 深色主题 */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2236;
  --bg-card-hover: #1f2a42;
  --bg-input: #0f1729;
  --border: #2a3a56;
  --border-hover: #3a5a7a;
  --text-primary: #e8edf5;
  --text-secondary: #8899b4;
  --text-muted: #5a6d85;
  --accent: #4f8cff;
  --accent-hover: #6ba0ff;
  --accent-glow: rgba(79, 140, 255, 0.2);
  --green: #34d399;
  --orange: #fbbf24;
  --red: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* Header */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(17, 24, 39, 0.9);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #6c5ce7);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-text span { color: var(--accent); }

.logo-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: -2px;
}

/* Search */
.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder { color: var(--text-muted); }

/* Filters */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Sort select */
.sort-select {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

/* Main content */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

/* Stats bar */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}

.stats-bar strong { color: var(--text-primary); }

/* Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* Card */
.skill-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.skill-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-2px);
}

.skill-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.skill-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.skill-card-name-zh {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}

.skill-card-name-en {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}

.skill-slug {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Menlo', monospace;
  margin-top: 4px;
}

.stars-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--orange);
  flex-shrink: 0;
}

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

.skill-card-summary-zh {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
}

.skill-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.skill-card-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-item svg { width: 14px; height: 14px; }

.skill-card-slug {
  margin-bottom: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.install-badge {
  font-size: 12px;
  color: var(--accent);
  padding: 3px 10px;
  background: rgba(79, 140, 255, 0.1);
  border-radius: 6px;
  font-family: 'SF Mono', 'Menlo', monospace;
}

/* Detail Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.modal-name-zh {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-name-en {
  font-size: 14px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Menlo', monospace;
  margin-bottom: 16px;
}

.modal-summary {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.modal-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.modal-meta-item {
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.modal-meta-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.modal-meta-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-install {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.install-command {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 14px;
  color: var(--accent);
  flex: 1;
}

.copy-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.copy-btn.copied {
  background: var(--green);
  border-color: var(--green);
}

.install-section {
  margin-top: 12px;
}

.install-section details {
  margin-top: 8px;
}

.install-section details summary {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}

.install-section details summary:hover {
  color: var(--text-secondary);
}

.manual-section ol {
  margin: 4px 0 0 16px;
  padding: 0;
}

.manual-section li {
  margin-bottom: 2px;
}

.manual-section code {
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.modal-skill-detail {
  margin-top: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.modal-skill-detail h3 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.modal-skill-detail p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Tags */
.version-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Menlo', monospace;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* Loading */
.loading {
  text-align: center;
  padding: 80px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .search-wrap { max-width: 100%; order: 3; }
  .filters-bar { overflow-x: auto; padding-bottom: 4px; }
  .skills-grid { grid-template-columns: 1fr; }
  .modal { padding: 24px 20px; }
  .modal-meta { grid-template-columns: 1fr 1fr; }
  .modal-install { flex-direction: column; align-items: stretch; }
  .stats-bar { flex-direction: column; gap: 8px; align-items: flex-start; }
}

/* ── Pagination ── */

.pagination-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--bg-card);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn-active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.page-btn-active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: white;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Category Tag on Cards ── */

.skill-category-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: none;
  z-index: 1;
}

/* ── Detail Page Categories ── */

.category-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 500;
  line-height: 1.4;
  display: inline-block;
}

.detail-section {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.detail-section-title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.detail-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  padding: 3px 10px;
  border-radius: 6px;
  font-family: 'SF Mono', 'Menlo', monospace;
}

/* ── Changelog Formatting ── */

.changelog-block {
  margin-top: 20px;
}

.changelog-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.changelog-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 12px 0 6px;
}

.changelog-item {
  margin-left: 16px;
  margin-bottom: 2px;
  list-style-type: disc;
}

.changelog-text {
  margin-bottom: 4px;
}

/* ── English Details ── */

.en-details {
  margin-bottom: 20px;
}

.en-details summary {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.en-details summary:hover {
  color: var(--text-secondary);
}

.en-details-content {
  margin-top: 8px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Navigation Tabs ── */

.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 4px;
  flex-shrink: 0;
}

.nav-tab {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.nav-tab.active {
  background: var(--accent);
  color: white;
}

/* ── Bundles Grid ── */

.bundles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.bundle-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.25s;
}

.bundle-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.bundle-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.bundle-icon {
  font-size: 42px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 140, 255, 0.1);
  border-radius: 14px;
  flex-shrink: 0;
}

.bundle-title-area {
  flex: 1;
  min-width: 0;
}

.bundle-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bundle-badge {
  font-size: 11px;
  color: var(--accent);
  background: rgba(79, 140, 255, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.bundle-count {
  font-size: 13px;
  color: var(--accent);
  margin-top: 2px;
}

.bundle-expand-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  flex-shrink: 0;
}

.bundle-expand-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.bundle-description {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.bundle-scene {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 12px 16px;
  background: rgba(79, 140, 255, 0.06);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border-left: 3px solid var(--accent);
}

.bundle-skills-list {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.bundle-skills-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.bundle-skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.bundle-skill-item {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.bundle-skill-item:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.bundle-skill-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.bundle-skill-slug {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Menlo', monospace;
}

.bundle-guide {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.bundle-guide-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
  margin-bottom: 8px;
}

.bundle-guide-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.bundle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bundle-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.bundle-btn-primary {
  background: var(--accent);
  color: white;
}

.bundle-btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.bundle-btn-secondary {
  background: rgba(79, 140, 255, 0.1);
  color: var(--accent);
}

.bundle-btn-secondary:hover {
  background: rgba(79, 140, 255, 0.2);
}

.bundle-btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.bundle-btn-outline:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Bundle Script Box */
.bundle-script-box {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--accent);
  overflow-x: auto;
  white-space: pre;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Tutorial View ── */

.tutorial-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.tutorial-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.tutorial-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.tutorial-card ol {
  padding-left: 20px;
}

.tutorial-card li {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 2;
}

.tutorial-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.tutorial-table {
  width: 100%;
  border-collapse: collapse;
}

.tutorial-table td {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.tutorial-table td:first-child {
  font-family: 'SF Mono', 'Menlo', monospace;
  color: var(--accent);
  width: 240px;
}

.tutorial-card code {
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--accent);
}

@media (max-width: 768px) {
  .tutorial-content {
    grid-template-columns: 1fr;
  }
  .bundle-skills-grid {
    grid-template-columns: 1fr;
  }
  .bundle-actions {
    flex-direction: column;
  }
  .bundle-btn {
    width: 100%;
    text-align: center;
  }
  .nav-tabs {
    width: 100%;
    justify-content: center;
  }
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
