:root {
  --bg: #080b10;
  --bg2: #0d1219;
  --panel: #121821;
  --border: #1c2736;
  --text: #e8eef6;
  --muted: #8494ab;
  --accent: #3d8bfd;
  --accent-dim: #1e3a5f;
  --ok: #2dd4a8;
  --warn: #f0b429;
  --danger: #f07178;
  --radius: 10px;
  --side: 220px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
code { font-family: var(--mono); font-size: 0.85em; color: var(--ok); }
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--side);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display: flex; gap: 10px; align-items: center; }
.logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(145deg, #3d8bfd, #1a4a8a);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.75rem; letter-spacing: 0.02em;
}
.tag { font-size: 0.7rem; color: var(--muted); }
nav { display: flex; flex-direction: column; gap: 4px; }
.nav {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}
.nav:hover { background: var(--panel); color: var(--text); }
.nav.active { background: var(--accent-dim); color: var(--accent); }
.side-foot { margin-top: auto; }
.pill {
  display: inline-block;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-bottom: 6px;
}
.pill.live { border-color: #1f6f55; color: var(--ok); }
.pill.demo { border-color: #6b5420; color: var(--warn); }
.main { flex: 1; padding: 28px 32px 48px; overflow: auto; max-width: 1200px; }
.view { display: none; }
.view.active { display: block; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.02em; }
.lead { color: var(--muted); margin-top: 6px; max-width: 52ch; }
.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { margin-top: 0; margin-left: auto; text-align: right; }
  .builder-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; margin-top: 10px; }
label:first-child { margin-top: 0; }
.opt { opacity: 0.7; }
input, textarea {
  width: 100%;
  background: #0a0f16;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  resize: vertical;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip {
  background: #0a0f16;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #2a3d55; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.actions.tight { margin-top: 0; }
.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  color: inherit;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.ghost:hover { border-color: #2a3d55; }
.log {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  min-height: 1.2em;
  white-space: pre-wrap;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.hidden { display: none !important; }
.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.result-head h2 { font-size: 1.1rem; }
.h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.split {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  min-height: 360px;
}
@media (max-width: 700px) {
  .split { grid-template-columns: 1fr; }
}
.tree {
  list-style: none;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.tree li {
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--muted);
}
.tree li:hover { background: #0a0f16; color: var(--text); }
iframe {
  width: 100%;
  height: 360px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #000;
}
.muted { color: var(--muted); }
.tiny { font-size: 0.75rem; }
.project-list { display: flex; flex-direction: column; gap: 8px; }
.proj {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.proj h3 { font-size: 0.95rem; }
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a2433;
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  max-width: 360px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.toast.warn { border-color: #6b5420; color: var(--warn); }
