/* --- tokens ----------------------------------------------------------- */
:root {
  --bg: #09090b;
  --bg-elev: #0f0f12;
  --surface: #141418;
  --surface-2: #1b1b21;
  --surface-hi: #24242b;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-brighter: rgba(255, 255, 255, 0.22);
  --text: #ededf0;
  --text-dim: #a1a1aa;
  --text-mid: #71717a;
  --text-muted: #52525b;
  --accent: #b19eef; /* same hue family as pro.reactbits */
  --accent-strong: #c7b8ff;
  --accent-dim: rgba(177, 158, 239, 0.14);
  --free: #8bc9ff;
  --pro: #ff9fcf;
  --warn: #ffb347;
  --danger: #ff6b6b;
  --radius: 10px;
  --radius-lg: 14px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 280px;
  --header-h: 56px;
  --banner-h: 38px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
code,
pre,
.mono {
  font-family: var(--mono);
}
::selection {
  background: var(--accent-strong);
  color: #000;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #2a2a31;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3a3a44;
}

/* --- banner ----------------------------------------------------------- */
.banner {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--banner-h);
  background: linear-gradient(90deg, rgba(177, 158, 239, 0.14), rgba(255, 159, 207, 0.08));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 24px;
  font-size: 13px;
  color: var(--text);
}
.banner-emoji {
  margin-right: 6px;
}
.banner-close {
  position: absolute;
  right: 16px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.banner-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.banner.hidden {
  display: none;
}

/* --- header ----------------------------------------------------------- */
.site-header {
  position: sticky;
  top: var(--banner-h);
  z-index: 40;
  height: var(--header-h);
  background: rgba(9, 9, 11, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
}
.banner.hidden ~ .site-header {
  top: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 4px;
  border-radius: 8px;
  transition: background 0.12s;
}
.brand:hover {
  background: var(--surface);
}
.brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #b19eef, #8575e8);
  color: #0a0a0a;
}
.brand-name {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 15px;
}
.brand-sep {
  color: var(--text-muted);
  font-weight: 400;
  margin: 0 3px;
}
.brand-tag {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(177, 158, 239, 0.15);
  color: var(--accent);
  letter-spacing: 0.08em;
}

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}
.nav-link {
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-dim);
  transition: all 0.12s;
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}
.nav-link.active {
  color: var(--text);
  background: var(--surface);
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.hdr-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  transition: all 0.12s;
}
.hdr-btn:hover {
  border-color: var(--border-brighter);
}
.hdr-btn-ghost {
  color: var(--text-dim);
}
.hdr-btn-ghost:hover {
  color: var(--text);
}
.hdr-btn-primary {
  background: var(--text);
  color: #000;
  border-color: var(--text);
  font-weight: 600;
}
.hdr-btn-primary:hover {
  filter: brightness(0.92);
}
.hdr-btn-label {
  color: inherit;
}
.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  margin-left: 2px;
}

/* --- layout ----------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h) - var(--banner-h));
}

/* --- sidebar ---------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--banner-h));
  align-self: start;
  height: calc(100vh - var(--header-h) - var(--banner-h));
  overflow-y: auto;
  padding: 20px 14px 32px;
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
}
.banner.hidden ~ .layout .sidebar {
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
}
.side-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.side-card-count {
  color: var(--text-dim);
  font-weight: 500;
  font-family: var(--mono);
  font-size: 12px;
}
.cat-icons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}
.cat-icon {
  aspect-ratio: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  font-size: 14px;
  transition: all 0.12s;
}
.cat-icon:hover {
  color: var(--accent);
  border-color: var(--border-strong);
}
.cat-icon.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(177, 158, 239, 0.3);
}
.side-filter {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  margin-bottom: 20px;
  transition: border 0.12s;
}
.side-filter:focus {
  border-color: var(--border-brighter);
}
.side-filter::placeholder {
  color: var(--text-muted);
}

.side-section {
  margin-bottom: 20px;
}
.side-h {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding: 0 10px;
}
.side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 13px;
  gap: 8px;
  transition: all 0.12s;
}
.side-item:hover {
  background: var(--surface);
  color: var(--text);
}
.side-item.active {
  background: var(--surface);
  color: var(--text);
}
.pill {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-mid);
}

/* --- main ------------------------------------------------------------- */
.main {
  padding: 32px 40px 60px;
  min-width: 0;
}

.page-head {
  margin-bottom: 28px;
}
.page-head h1 {
  font-size: 34px;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
  font-weight: 700;
}
.page-sub {
  color: var(--text-dim);
  max-width: 640px;
  font-size: 14px;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.search {
  flex: 1;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border 0.12s;
}
.search:focus {
  border-color: var(--border-brighter);
}
.sort {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.sort button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
}
.sort button.active {
  background: var(--surface-hi);
  color: var(--text);
}
.sort button:hover:not(.active) {
  color: var(--text);
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  transition: all 0.12s;
}
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.chip.active {
  background: var(--text);
  color: #000;
  border-color: var(--text);
}
.chip .num {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.7;
}

.result-count {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11.5px;
  margin-left: auto;
}

/* --- grid + cards ----------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  background: var(--surface-2);
}
.card-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #000;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-preview .no-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  background: linear-gradient(135deg, #15151a, #0b0b0e);
}
.card-preview .no-preview .np-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 44px;
  opacity: 0.3;
}
.card-arrow {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.card:hover .card-arrow {
  opacity: 1;
}
.card-body {
  padding: 14px 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.badge {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.badge.free {
  background: rgba(139, 201, 255, 0.14);
  color: var(--free);
}
.badge.pro {
  background: rgba(255, 159, 207, 0.14);
  color: var(--pro);
}
.card-desc {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 38px;
}
.card-meta {
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.empty {
  grid-column: 1 / -1;
  padding: 100px 20px;
  text-align: center;
  color: var(--text-dim);
}
.empty h3 {
  color: var(--text);
  font-size: 18px;
  margin: 0 0 8px;
  font-weight: 500;
}
.empty p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}
.empty button {
  margin-top: 20px;
}

/* --- detail view ------------------------------------------------------ */
.detail {
  max-width: 1080px;
  margin: 0 auto;
}
.detail .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.detail .back:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.detail-head {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 32px;
}
.detail-head-info {
  flex: 1;
  min-width: 0;
}
.detail-head-info h1 {
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.detail-head-info .sub {
  color: var(--text-dim);
  margin-bottom: 14px;
  line-height: 1.55;
}
.detail-head-info .meta {
  display: flex;
  gap: 14px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  flex-wrap: wrap;
}
.detail-head-info .meta a {
  color: var(--text-dim);
  text-decoration: underline;
}
.detail-preview {
  width: 420px;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.detail-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.prompt-card {
  background:
    radial-gradient(circle at top right, rgba(177, 158, 239, 0.18), transparent 50%),
    linear-gradient(135deg, rgba(177, 158, 239, 0.1), rgba(177, 158, 239, 0.02));
  border: 1px solid rgba(177, 158, 239, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 32px;
}
.prompt-card h3 {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.prompt-card h4 {
  font-size: 20px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.prompt-card p {
  margin: 0 0 16px;
  color: var(--text-dim);
  max-width: 560px;
  line-height: 1.6;
}
.prompt-card .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
}
.btn:hover {
  border-color: var(--border-brighter);
}
.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.btn-danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.3);
}
.btn-danger:hover {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.5);
}

.section {
  margin-bottom: 36px;
}
.section h2 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin: 0 0 16px;
}

.props-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 12px;
}
.props-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.props-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.props-table tr:last-child td {
  border-bottom: 0;
}
.props-table code {
  color: var(--accent-strong);
  background: rgba(177, 158, 239, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.props-table .desc {
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 12px;
  max-width: 440px;
  line-height: 1.5;
}

.file-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.file-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
}
.file-tab:hover {
  color: var(--text);
}
.file-tab.active {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}
.file-view {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 20px;
  overflow: auto;
  max-height: 600px;
}
.file-view pre {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* --- modal ------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.modal-body {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 520px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.15s ease-out;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-close {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover {
  background: var(--surface);
  color: var(--text);
}
.modal-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.modal-input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border 0.12s;
}
.modal-input:focus {
  border-color: var(--accent);
}
.modal-hint {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 10px 0 20px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-status {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  display: none;
}
.modal-status.show {
  display: block;
}
.modal-status.working {
  background: rgba(255, 179, 71, 0.08);
  color: var(--warn);
  border: 1px solid rgba(255, 179, 71, 0.2);
}
.modal-status.ok {
  background: rgba(177, 158, 239, 0.1);
  color: var(--accent-strong);
  border: 1px solid rgba(177, 158, 239, 0.3);
}
.modal-status.err {
  background: rgba(255, 107, 107, 0.08);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.25);
}

/* --- responsive ------------------------------------------------------- */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .detail-head {
    flex-direction: column;
  }
  .detail-preview {
    width: 100%;
  }
}
@media (max-width: 720px) {
  .main {
    padding: 24px 20px;
  }
  .site-nav {
    display: none;
  }
  .hdr-btn-label {
    display: none;
  }
  .page-head h1 {
    font-size: 26px;
  }
}
