:root {
  --bg: #0f0f11;
  --surface: #1a1a2e;
  --card: #16213e;
  --card-hover: #1a2745;
  --border: #2a2a4a;
  --text: #e8e8f0;
  --text-dim: #8888aa;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --success: #00b894;
  --danger: #e17055;
  --radius: 12px;
  --radius-sm: 8px;
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.header { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); border-bottom: 1px solid var(--border); padding: 16px 24px; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo { font-size: 22px; font-weight: 700; white-space: nowrap; }
.logo span { color: var(--accent-light); }
.search-box { flex: 1; min-width: 200px; max-width: 500px; position: relative; }
.search-box input { width: 100%; padding: 10px 16px 10px 40px; background: var(--bg); border: 1px solid var(--border); border-radius: 24px; color: var(--text); font-size: 14px; outline: none; transition: border-color .2s; }
.search-box input:focus { border-color: var(--accent); }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
.tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 24px; padding: 3px; }
.tab-btn { padding: 8px 20px; border: none; background: transparent; color: var(--text-dim); cursor: pointer; border-radius: 20px; font-size: 14px; transition: all .2s; }
.tab-btn.active { background: var(--accent); color: #fff; }
.tab-btn:hover:not(.active) { color: var(--text); }
.stats { font-size: 13px; color: var(--text-dim); white-space: nowrap; }

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

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-chip { padding: 6px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; color: var(--text-dim); cursor: pointer; font-size: 13px; transition: all .2s; user-select: none; }
.filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-label { font-size: 13px; color: var(--text-dim); margin-right: 4px; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: all .25s; display: flex; flex-direction: column; gap: 10px; }
.card:hover { background: var(--card-hover); border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.card-header { display: flex; align-items: center; gap: 12px; }
.card-avatar { font-size: 36px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--surface); border-radius: 12px; flex-shrink: 0; }
.card-info { flex: 1; min-width: 0; }
.card-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-author { font-size: 12px; color: var(--text-dim); }
.card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; background: rgba(108,92,231,.15); color: var(--accent-light); border-radius: 10px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-dim); }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; justify-content: center; align-items: center; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 700px; width: 100%; max-height: 85vh; display: flex; flex-direction: column; position: relative; }
.modal-header { padding: 24px 24px 16px; display: flex; gap: 16px; align-items: flex-start; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-avatar { font-size: 48px; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: var(--card); border-radius: 16px; flex-shrink: 0; }
.modal-title-area { flex: 1; }
.modal-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.modal-meta { font-size: 13px; color: var(--text-dim); display: flex; gap: 12px; flex-wrap: wrap; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 24px; cursor: pointer; padding: 4px 8px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-section { margin-bottom: 20px; }
.modal-section-title { font-size: 14px; font-weight: 600; color: var(--accent-light); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.modal-desc { font-size: 14px; line-height: 1.7; color: var(--text); }
.prompt-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow-y: auto; font-family: 'SF Mono', 'Fira Code', monospace; }
.modal-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.opening-questions { list-style: none; }
.opening-questions li { padding: 6px 0; font-size: 13px; color: var(--text-dim); border-bottom: 1px solid var(--border); }
.opening-questions li:last-child { border: none; }
.opening-questions li::before { content: '💬 '; }

/* Import button */
.import-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px; background: var(--accent); color: #fff; border: none; border-radius: 24px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; }
.import-btn:hover { background: var(--accent-light); transform: scale(1.02); }
.import-btn svg { width: 16px; height: 16px; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: transparent; border: 1px solid var(--border); color: var(--text-dim); border-radius: 20px; font-size: 13px; cursor: pointer; transition: all .2s; }
.copy-btn:hover { border-color: var(--accent); color: var(--text); }
.copy-btn.copied { border-color: var(--success); color: var(--success); }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 0; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface); position: sticky; bottom: 0; z-index: 10; }

/* Empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-text { font-size: 16px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-dim); }
.spinner { display: inline-block; width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; background: var(--success); color: #fff; border-radius: var(--radius-sm); font-size: 14px; z-index: 300; transform: translateY(80px); opacity: 0; transition: all .3s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

/* Responsive */
@media (max-width: 768px) {
  .header-inner { gap: 12px; }
  .search-box { order: 10; min-width: 100%; max-width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .modal { max-height: 90vh; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .header { padding: 12px 16px; }
  .main { padding: 16px; }
}
