:root {
  --bg: #090c15;
  --surface: #111827;
  --surface-2: #1a2030;
  --border: #1e2d40;
  --text: #e2e8f0;
  --text-dim: #64748b;
  --accent: #00d4ff;
  --accent-dim: #0891b2;
  --amber: #f59e0b;
  --red: #ff5757;
  --green: #22c55e;
  --font-head: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
}

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

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

/* Navbar */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  border-bottom: 1px solid var(--border);
}
.nav-brand { font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
nav { display: flex; gap: 24px; }
.nav-link { font-size: 14px; color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
.nav-link:hover, .nav-link.active { color: var(--text); }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 48px 48px 80px; }

/* Page Header */
.page-header { margin-bottom: 40px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-family: var(--font-mono); color: var(--accent);
  background: rgba(0, 212, 255, 0.08); border: 1px solid rgba(0, 212, 255, 0.2);
  padding: 6px 14px; border-radius: 20px; margin-bottom: 16px; width: fit-content;
}
.badge-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.page-header h1 { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 8px; }
.subtitle { color: var(--text-dim); font-size: 16px; }

/* Generator Grid */
.generator-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 64px; }

/* Form Panel */
.form-panel { display: flex; flex-direction: column; gap: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-dim); font-family: var(--font-mono); }
.optional { color: var(--text-dim); opacity: 0.7; }

input, select, textarea {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-family: var(--font-head);
  font-size: 14px; transition: border-color 0.2s; outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 100px; }

/* Buttons */
.actions { display: flex; gap: 12px; margin-top: 4px; }
.btn {
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s; font-family: var(--font-head);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--text-dim); }

/* Preview Panel */
.preview-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; margin-top: 4px;
}
.preview-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; font-family: var(--font-mono); color: var(--text-dim);
}
.close-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; }
.close-btn:hover { color: var(--text); }
.preview-content {
  padding: 14px; font-family: var(--font-mono); font-size: 13px;
  white-space: pre-wrap; word-break: break-word; color: var(--text-dim);
  max-height: 300px; overflow-y: auto;
}

/* Error Banner */
.error-banner {
  background: rgba(255, 87, 87, 0.1); border: 1px solid var(--red);
  color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 14px;
}

/* Loading */
.loading-state {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; color: var(--accent); font-size: 14px;
}
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Output Panel */
.output-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; min-height: 300px;
  display: flex; flex-direction: column;
}
.output-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-dim); gap: 12px;
}
.placeholder-icon { font-size: 32px; color: var(--border); }
.output-content {
  font-size: 14px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; flex: 1;
}

/* Hidden utility */
.hidden { display: none !important; }

/* History Section */
.history-section { border-top: 1px solid var(--border); padding-top: 40px; }
.history-section h2 { font-size: 20px; font-weight: 700; margin-bottom: 24px; letter-spacing: -0.02em; }
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-empty { color: var(--text-dim); font-size: 14px; padding: 20px 0; }
.history-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px;
}
.history-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.history-badge {
  font-size: 11px; font-family: var(--font-mono); padding: 3px 8px;
  background: rgba(0, 212, 255, 0.08); color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.2); border-radius: 4px;
}
.history-badge.technique { background: rgba(245, 158, 11, 0.08); color: var(--amber); border-color: rgba(245, 158, 11, 0.2); }
.history-tag { font-size: 11px; color: var(--text-dim); padding: 3px 6px; }
.history-date { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); margin-left: auto; }
.history-prompt { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.history-output { font-size: 12px; color: var(--text-dim); font-style: italic; }

/* Responsive */
@media (max-width: 768px) {
  .top-nav { padding: 14px 20px; }
  .container { padding: 24px 20px 60px; }
  .generator-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}