:root {
  --bg: #06070e;
  --surface: #0f1120;
  --surface-hover: #161a30;
  --border: #1e2340;
  --border-accent: #2a3060;
  --text: #e2e4ec;
  --text-muted: #8a8fa8;
  --accent: #0099e5;
  --accent-dim: rgba(0, 153, 229, 0.15);
  --green: #2dd4a0;
  --orange: #f59e0b;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 10px;
  --card-radius: 14px;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Auth Gate ─────────────────────────────────────────── */
.auth-gate {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  z-index: 1000;
}

.auth-modal {
  text-align: center;
  padding: 3rem 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  width: 100%; max-width: 380px;
}

.auth-logo {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.auth-modal h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.auth-modal > p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

#auth-form {
  display: flex;
  gap: 0.5rem;
}

#token-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}

#token-input:focus { border-color: var(--accent); }

#auth-form button {
  padding: 0.65rem 1.2rem;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

#auth-form button:hover { opacity: 0.85; }

.auth-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

/* ── Header ────────────────────────────────────────────── */
.header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  background: var(--surface);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  font-size: 1.6rem;
  color: var(--accent);
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.badge {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ── Catalog Grid ──────────────────────────────────────── */
.catalog {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.5rem;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 0;
}

/* ── Demo Card ─────────────────────────────────────────── */
.demo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s;
}

.demo-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

/* ── Carousel ──────────────────────────────────────────── */
.carousel {
  position: relative;
  background: #080a16;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  scroll-snap-type: x mandatory;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.carousel-track::-webkit-scrollbar { display: none; }

.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.carousel-slide .placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0d1025 0%, #141835 100%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.placeholder-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}

.carousel:hover .carousel-btn { opacity: 1; }
.carousel-btn:hover { background: rgba(0, 0, 0, 0.8); }
.carousel-prev { left: 0.5rem; }
.carousel-next { right: 0.5rem; }

.carousel-dots {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.35rem;
  z-index: 2;
}

.carousel-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

/* ── Card Body ─────────────────────────────────────────── */
.card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.card-body h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.card-description {
  color: var(--text-muted);
  font-size: 0.83rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}

/* ── Tech Stack Tags ───────────────────────────────────── */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.tag {
  padding: 0.2rem 0.55rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ── Token Block ───────────────────────────────────────── */
.token-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.token-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.token-value {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--green);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

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

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

/* ── Launch Button ─────────────────────────────────────── */
.launch-btn {
  display: block;
  text-align: center;
  padding: 0.6rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.85rem;
  transition: opacity 0.2s;
}

.launch-btn:hover { opacity: 0.85; }

/* ── Footer ────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .catalog { grid-template-columns: 1fr; padding: 1rem; }
  .header { padding: 1rem; }
}

@media (max-width: 480px) {
  .catalog { grid-template-columns: 1fr; }
  .auth-modal { margin: 1rem; }
  #auth-form { flex-direction: column; }
}
