:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0d1424;
  --line: #1c2a44;
  --text: #e8eefc;
  --muted: #8b9bb8;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --ok: #34d399;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100vh; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 20, 36, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand strong { display: block; letter-spacing: -0.02em; }
.brand .muted, .muted { color: var(--muted); font-size: 12px; }
.mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  font-weight: 800; font-size: 12px;
}
nav { display: flex; gap: 16px; }
nav a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; }
nav a:hover { color: #fff; }

.grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  padding: 18px;
  max-width: 1400px;
  margin: 0 auto;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.03em; }
h2 { margin: 18px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.lede { color: #c5d0e8; line-height: 1.5; }
code { font-family: var(--mono); font-size: 12px; color: var(--accent-2); }

.drop {
  margin: 16px 0;
  border: 1px dashed #2a3d63;
  border-radius: 14px;
  padding: 16px;
  background: #0a1120;
}
.drop strong { display: block; margin-bottom: 4px; }
.pickers { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.pickers label, .opts label { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.editors {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.editors label, .title-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
textarea, input[type="text"] {
  width: 100%;
  background: #070b14;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 12px;
}
.editors textarea { min-height: 220px; resize: vertical; }
#out { min-height: 280px; width: 100%; }
.opts { display: flex; flex-wrap: wrap; gap: 12px 18px; margin: 14px 0; }
.title-field { min-width: 180px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: white;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
#download-btn, #preview-btn, #ask-btn { background: #1e293b; color: #e2e8f0; border: 1px solid var(--line); }
.stats {
  background: #070b14;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  color: #cbd5e1;
}
.small { line-height: 1.55; }
#status.ok { color: var(--ok); }
#status.err { color: #f87171; }

@media (max-width: 980px) {
  .grid, .editors { grid-template-columns: 1fr; }
  .top { flex-direction: column; align-items: flex-start; gap: 8px; }
}
