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

/* ===== Theme: Dark (default) ===== */
:root, [data-theme="dark"] {
  --bg: #09090b;
  --surface: rgba(24, 24, 27, 0.65);
  --surface-solid: #18181b;
  --surface-2: #27272a;
  --border: #27272a;
  --border-hover: #3f3f46;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --primary: #7c3aed;
  --primary-light: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.15);
  --accent: #06b6d4;
  --gradient: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 0 0 1px var(--border);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px var(--border-hover);
  --grid-color: rgba(255,255,255,0.025);
  --code-bg: #0a0a0a;
  --code-text: #d4d4d8;
  color-scheme: dark;
}

/* ===== Theme: Light ===== */
[data-theme="light"] {
  --bg: #ffffff;
  --surface: rgba(244, 244, 245, 0.7);
  --surface-solid: #f4f4f5;
  --surface-2: #e4e4e7;
  --border: #e4e4e7;
  --border-hover: #d4d4d8;
  --text: #09090b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --primary: #7c3aed;
  --primary-light: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.08);
  --accent: #0891b2;
  --gradient: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --danger: #dc2626;
  --success: #16a34a;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px var(--border);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.08), 0 0 0 1px var(--border-hover);
  --grid-color: rgba(0,0,0,0.03);
  --code-bg: #fafafa;
  --code-text: #3f3f46;
  color-scheme: light;
}

/* ===== Base ===== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Background effects ===== */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 30%, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

.hero-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, var(--primary-glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== Layout ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 80px 24px 48px;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
}

.theme-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text);
  box-shadow: var(--shadow-hover);
}

[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ===== Hero ===== */
.hero {
  text-align: center;
  margin-bottom: 48px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.brand {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-light);
  background: var(--primary-glow);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(2rem, 5.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--text);
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 480px;
  margin: 0 auto;
}

/* ===== Generator Card ===== */
.generator-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s;
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.at-sign {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  user-select: none;
  flex-shrink: 0;
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  padding: 14px 10px;
  min-width: 0;
}

.input-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

#generateBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gradient);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

#generateBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}
#generateBtn:active { transform: translateY(0) scale(0.98); }
#generateBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-icon { transition: transform 0.2s; flex-shrink: 0; }
#generateBtn:hover .btn-icon { transform: translateX(2px); }

/* ===== Options Row ===== */
.options-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.model-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.model-selector label {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.model-selector select {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.model-selector select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.toggle-option input { display: none; }

.toggle-switch {
  width: 40px;
  height: 22px;
  background: var(--surface-2);
  border-radius: 11px;
  position: relative;
  transition: background 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s;
}

.toggle-option input:checked + .toggle-switch {
  background: var(--primary);
}

.toggle-option input:checked + .toggle-switch::after {
  transform: translateX(18px);
  background: white;
}

.toggle-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== Showcase Slider ===== */
.showcase {
  margin-bottom: 24px;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.showcase h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 16px;
  text-align: center;
}

.showcase-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
}

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

.showcase-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 220px;
  max-width: 260px;
  flex-shrink: 0;
  scroll-snap-align: start;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.showcase-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.showcase-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
}

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

.showcase-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.showcase-handle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.showcase-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s, color 0.2s;
}

.showcase-item:hover .showcase-arrow {
  color: var(--primary-light);
  transform: translateX(2px);
}

/* ===== Status Card ===== */
.status-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.status-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-2);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
  transition: border-color 0.3s;
}

.status-avatar:has(img) {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.status-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-info { min-width: 0; }

.status-header h2 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.status-step {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 4px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

/* ===== Timeline ===== */
.steps-timeline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 24px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.timeline-item.active {
  color: var(--text);
  background: var(--primary-glow);
}

.timeline-item.done {
  color: var(--success);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-2);
  flex-shrink: 0;
  transition: all 0.3s;
}

.timeline-item.active .timeline-dot {
  background: var(--primary-light);
  box-shadow: 0 0 0 4px var(--primary-glow);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.timeline-item.done .timeline-dot {
  background: var(--success);
}

.timeline-check {
  margin-left: auto;
  color: var(--success);
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== Visit Button ===== */
.visit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--gradient);
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 16px 24px;
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.15s, box-shadow 0.25s;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.25);
  animation: celebrateIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes celebrateIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.visit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.35);
}
.visit-btn:active { transform: translateY(0) scale(0.98); }

.error-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--danger);
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ===== How It Works ===== */
.how-it-works {
  text-align: center;
  margin-top: 64px;
}

.how-it-works h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 32px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.step-card {
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 16px 24px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.step-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.2s;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.step-card:hover::before { opacity: 1; }

.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-glow);
  color: var(--primary-light);
  margin-bottom: 16px;
}

.step-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.step-card p {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 32px 24px 40px;
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 24px;
  border-top: 1px solid var(--border);
  max-width: 680px;
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-socials a {
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
  display: flex;
}

.footer-socials a:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.footer-logo {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}

.brand-sm {
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-sep { opacity: 0.3; }

/* ===== Live Output Panel ===== */
.live-output {
  margin-top: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.live-output.streaming {
  border-color: var(--primary);
  box-shadow: 0 0 24px var(--primary-glow);
}

.live-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--code-bg);
  border-bottom: 1px solid var(--border);
}

.live-output-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-2);
  transition: all 0.3s;
}

.streaming .live-dot {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 1.5s infinite;
}

.live-output-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-output-phase {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary-light);
  background: var(--primary-glow);
  padding: 3px 10px;
  border-radius: 100px;
}

.live-output-code {
  background: var(--code-bg);
  color: var(--code-text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.7;
  padding: 16px;
  margin: 0;
  max-height: 450px;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
  white-space: pre-wrap;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-2) transparent;
}

.live-output-code::-webkit-scrollbar { width: 6px; }
.live-output-code::-webkit-scrollbar-track { background: transparent; }
.live-output-code::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 3px; }

.live-output-code .hl-file {
  display: block;
  color: var(--success);
  font-weight: 700;
  padding: 10px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}

.live-output-code .hl-file:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

/* ===== Focus States ===== */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary-light);
}

input:focus-visible, select:focus-visible { box-shadow: 0 0 0 3px var(--primary-glow); }

/* ===== Animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container { padding: 64px 20px 40px; }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 540px) {
  .container { padding: 56px 16px 32px; max-width: 100%; }
  .hero h1 { font-size: 1.75rem; }
  .subtitle { font-size: 0.95rem; }
  .generator-card { padding: 20px; }
  .status-card { padding: 20px; }
  .input-group { flex-wrap: wrap; }
  .input-group input { width: 100%; }
  #generateBtn { width: 100%; justify-content: center; margin-top: 4px; }
  .options-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .model-selector { width: 100%; }
  .toggle-option { justify-content: space-between; }
  .steps-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .step-card { padding: 20px 12px 16px; }
  .footer-inner { flex-direction: column; gap: 4px; }
  .footer-sep { display: none; }
}

@media (max-width: 360px) {
  .steps-grid { grid-template-columns: 1fr; }
}
