:root {
  --bg: #0f1220;
  --card: #151a2e;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #7c3aed;
  --accent2: #22d3ee;
  --border: rgba(148, 163, 184, 0.2);
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --orange: #f97316;
}

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

body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(circle at top left, #1f2440, #0b0d18 65%);
  color: var(--text);
  min-height: 100vh;
  padding: 40px 24px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
}

header { margin-bottom: 32px; }

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
  margin-bottom: 16px;
}

.back:hover { color: var(--accent2); }

h1 { font-size: 2rem; margin-bottom: 8px; }

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

/* Cards */
.card {
  background: rgba(21, 26, 46, 0.7);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}

/* Input Section */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-row {
  display: flex;
  gap: 12px;
}

.input-row input {
  flex: 1;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.input-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.input-row input:first-child { flex: 2; }

/* Buttons */
.btn {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover { background: #6d28d9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.btn-small {
  padding: 10px 18px;
  font-size: 0.9rem;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 50%;
}

.timeline-content {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.timeline-title {
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-type {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.timeline-type.github { background: rgba(138, 43, 226, 0.3); color: #a855f7; }
.timeline-type.url { background: rgba(34, 211, 238, 0.3); color: var(--accent2); }
.timeline-type.screenshot { background: rgba(249, 115, 22, 0.3); color: var(--orange); }
.timeline-type.demo { background: rgba(34, 197, 94, 0.3); color: var(--green); }

.timeline-url {
  font-size: 0.85rem;
  color: var(--accent2);
  text-decoration: none;
  word-break: break-all;
}

.timeline-url:hover { text-decoration: underline; }

.timeline-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.timeline-item:hover .timeline-remove { opacity: 1; }
.timeline-remove:hover { color: var(--red); }

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

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

/* Templates */
.templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.template-btn {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.template-btn:hover { background: rgba(124, 58, 237, 0.1); color: var(--text); }
.template-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  color: var(--muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Story Output */
.story-output {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.7;
  max-height: 500px;
  overflow-y: auto;
}

.actions {
  display: flex;
  gap: 12px;
}

/* Responsive */
@media (max-width: 600px) {
  .input-row { flex-direction: column; }
  .input-row input:first-child { flex: 1; }
  .templates { flex-direction: column; }
  .actions { flex-direction: column; }
}
