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

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --sidebar: #111;
  --border: #252525;
  --text: #e0e0e0;
  --muted: #666;
  --accent: #7c6af7;
  --accent-hover: #6b5ae6;
  --danger: #e05252;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
.hidden { display: none !important; }
.view { min-height: 100vh; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 60px;
  background: rgba(13,13,13,.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.nav-logo { font-size: 18px; font-weight: 700; letter-spacing: -.4px; }
.btn-nav { padding: 8px 18px; font-size: 13px; }

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 120px 20px 60px;
  text-align: center;
}
.hero-inner { max-width: 700px; }
.hero-tag {
  display: inline-block; font-size: 12px; font-weight: 500; letter-spacing: .8px;
  text-transform: uppercase; color: var(--accent); background: rgba(124,106,247,.1);
  border: 1px solid rgba(124,106,247,.2); padding: 5px 12px; border-radius: 20px;
  margin-bottom: 28px;
}
.hero-title {
  font-size: clamp(42px, 7vw, 72px); font-weight: 800; letter-spacing: -2.5px;
  line-height: 1.05; margin-bottom: 22px;
  background: linear-gradient(135deg, #fff 40%, #888);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-desc {
  font-size: 17px; color: var(--muted); line-height: 1.65; margin-bottom: 36px;
}
.btn-hero {
  display: inline-block; padding: 14px 32px; font-size: 15px; font-weight: 600;
  background: var(--accent); color: #fff; border: none; border-radius: 8px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-hero:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-hero:active { transform: none; }

/* ── Demo window ─────────────────────────────────────────────────────────── */
.hero-demo { margin-top: 60px; width: 100%; max-width: 820px; }
.demo-window {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; display: grid; grid-template-columns: 180px 1fr;
  box-shadow: 0 40px 80px rgba(0,0,0,.6); text-align: left;
}
.demo-sidebar {
  background: #0f0f0f; border-right: 1px solid var(--border);
  padding: 16px 0;
}
.demo-sidebar-title {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); padding: 0 14px 10px;
}
.demo-item {
  padding: 8px 14px; font-size: 12px; color: var(--muted); cursor: default;
}
.demo-item.active { color: var(--text); background: rgba(124,106,247,.1); }
.demo-main { display: flex; flex-direction: column; }
.demo-preview { flex: 1; }
.demo-browser-bar {
  display: flex; align-items: center; gap: 6px; padding: 10px 14px;
  background: #111; border-bottom: 1px solid var(--border);
}
.demo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.demo-url { font-size: 11px; color: var(--muted); margin-left: 4px; }
.demo-content { padding: 20px; background: #fff; min-height: 140px; }
.demo-app-preview { font-family: sans-serif; }
.demo-app-title { font-size: 13px; font-weight: 700; color: #111; margin-bottom: 10px; }
.demo-app-q { font-size: 12px; color: #333; margin-bottom: 10px; }
.demo-app-opts { display: flex; flex-direction: column; gap: 6px; }
.demo-opt { font-size: 11px; padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; color: #333; cursor: default; }
.demo-opt.correct { background: #e8f5e9; border-color: #4caf50; color: #2e7d32; }
.demo-prompt-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-top: 1px solid var(--border); background: var(--surface);
}
.demo-prompt-text { flex: 1; font-size: 12px; color: var(--muted); font-style: italic; }
.demo-btn {
  font-size: 11px; font-weight: 600; background: var(--accent); color: #fff;
  padding: 5px 12px; border-radius: 4px;
}

/* ── Features ────────────────────────────────────────────────────────────── */
.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.feature {
  background: var(--bg); padding: 40px 36px;
}
.feature-num { font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: .5px; margin-bottom: 14px; }
.feature h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.feature p { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 60px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted);
}
.footer-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; }
.footer-link:hover { text-decoration: underline; }

/* ── App layout ──────────────────────────────────────────────────────────── */
#view-app {
  display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 1fr 72px;
  height: 100vh; overflow: hidden;
}
.sidebar {
  grid-row: 1 / 3; background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; position: relative;
}
#sb-projects, #sb-versions { display: flex; flex-direction: column; height: 100%; }
.main { grid-row: 1; overflow: hidden; display: flex; flex-direction: column; }
.prompt-bar {
  grid-row: 2; grid-column: 2; border-top: 1px solid var(--border);
  background: var(--surface); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sb-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 12px 8px; flex-shrink: 0;
}
.sb-logo { font-weight: 700; font-size: 15px; letter-spacing: -.3px; }
.sb-project-title {
  padding: 4px 12px 8px; font-size: 11px; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px; flex-shrink: 0;
}
.nav-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.nav-item {
  padding: 8px; border-radius: var(--radius); cursor: pointer; display: flex;
  align-items: center; gap: 6px; color: var(--text); transition: background .1s;
}
.nav-item:hover { background: var(--border); }
.nav-item.active { background: #1e1a3a; color: var(--accent); }
.nav-item .item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.nav-item .item-meta { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.nav-item.auto-fix .item-meta { color: #f0a050; }
.sb-bottom {
  padding: 8px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.sb-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 7px 8px; border-radius: var(--radius); font-size: 13px; text-align: left; width: 100%;
}
.sb-btn:hover { background: var(--border); color: var(--text); }
.sb-btn-danger:hover { color: var(--danger); }
.btn-back { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 0; }
.btn-back:hover { color: var(--text); }
.btn-icon {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 18px; width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; border-radius: var(--radius);
}
.btn-icon:hover { background: var(--border); color: var(--text); }

/* ── Main / Empty ────────────────────────────────────────────────────────── */
.empty-state {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-align: center;
}
.empty-title { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-sub { font-size: 13px; margin-bottom: 20px; }

/* ── Project view ────────────────────────────────────────────────────────── */
.project-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.preview-bar {
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.version-label { font-size: 12px; color: var(--muted); }
.preview-actions { display: flex; align-items: center; gap: 12px; }
.toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--muted); }
.toggle input { accent-color: var(--accent); cursor: pointer; }
.btn-sm {
  font-size: 12px; color: var(--muted); text-decoration: none; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.btn-sm:hover { color: var(--text); border-color: var(--text); }
#preview-iframe { flex: 1; border: none; background: #fff; }

/* ── Prompt bar ──────────────────────────────────────────────────────────── */
.prompt-inner { display: flex; gap: 8px; align-items: flex-end; }
#prompt-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 14px; padding: 9px 12px; resize: none; outline: none;
  font-family: var(--font); min-height: 40px; max-height: 120px;
}
#prompt-input:focus { border-color: var(--accent); }
.prompt-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
#model-select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: var(--radius); font-size: 13px; cursor: pointer;
}
.prompt-status { font-size: 12px; padding: 2px 0; }
.prompt-status.loading { color: var(--accent); }
.prompt-status.error { color: var(--danger); }
.prompt-status.autofix { color: #f0a050; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent); color: #fff; border: none; padding: 9px 18px;
  border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: var(--radius); font-size: 13px; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--text); }
.btn-ghost { background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 0; text-decoration: underline; }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 8px 14px; border-radius: var(--radius); font-size: 13px; cursor: pointer; }
.btn-row { display: flex; gap: 8px; }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,.65); }
.modal-box {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; width: 440px; max-width: calc(100vw - 32px);
}
.modal-sm { width: 360px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px 20px 20px; }
.field-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.modal-body input[type="text"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 9px 12px; font-size: 14px; outline: none; font-family: var(--font);
}
.modal-body input:focus, .modal-body textarea:focus { border-color: var(--accent); }
.modal-body textarea { resize: vertical; }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.hint a { color: var(--accent); text-decoration: none; }
.hint a:hover { text-decoration: underline; }
.settings-email { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.tier-badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500; margin-top: 10px;
}
.tier-badge.free { background: #1a2e1a; color: #6abf6a; border: 1px solid #2a4a2a; }
.tier-badge.paid { background: #1e1a3a; color: var(--accent); border: 1px solid #2a2560; }
.tier-badge.unknown { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.msg { padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.msg.success { background: #1a2e1a; color: #4caf50; border: 1px solid #2a4a2a; }
.msg.error { background: #2e1a1a; color: var(--danger); border: 1px solid #4a2a2a; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.tab { background: none; border: none; color: var(--muted); padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ── File drop ───────────────────────────────────────────────────────────── */
.file-drop {
  display: block; border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center; cursor: pointer; color: var(--muted);
  font-size: 13px; transition: border-color .15s;
}
.file-drop:hover, .file-drop.drag-over { border-color: var(--accent); color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav { padding: 16px 20px; }
  .hero-desc br { display: none; }
  .features { grid-template-columns: 1fr; }
  .footer { padding: 20px; }
  .hero-demo { display: none; }
  .demo-window { grid-template-columns: 1fr; }
}
