:root {
  color-scheme: dark;
  --void: #08090d;
  --card: #0f1117;
  --cyan: #06b6d4;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --emerald: #10b981;
  --rose: #f43f5e;
  --text: #e4e4e7;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(15, 17, 23, 0.78);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--void); }
html, body, button, input, select, textarea {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 12% -10%, rgba(16, 185, 129, 0.12), transparent 56%),
    radial-gradient(900px 520px at 92% 6%, rgba(6, 182, 212, 0.12), transparent 54%),
    var(--void);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: #67e8f9; }
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.grid-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 18%, transparent 74%);
}
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
}
.mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
  color: var(--void);
  font-weight: 900;
}
nav { display: flex; gap: 20px; color: var(--faint); font-size: 14px; }
nav a { color: inherit; }
nav a:hover { color: #fff; }
.pill {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  border-radius: 999px;
  padding: 4px 12px;
}

main { position: relative; z-index: 1; padding-bottom: 80px; }
.hero { padding: 56px 0 20px; max-width: 760px; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
}
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--emerald); }
h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
}
.lede { margin: 16px 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.7; max-width: 640px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  color: var(--muted);
}
.badge.emph {
  border-color: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.08);
}

.model-card, .panel, .prose-card {
  border: 1px solid var(--line);
  background: rgba(15, 17, 23, 0.72);
  border-radius: 24px;
  padding: 18px;
}
.model-card {
  margin: 12px 0 18px;
  display: grid;
  gap: 12px;
}
.model-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.model-card h2 { margin: 0; color: #fff; font-size: 1.05rem; }
.model-card p { margin: 6px 0 0; color: var(--faint); font-size: 14px; line-height: 1.55; }
.model-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ai-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
}
.ai-status .pulse {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--faint);
}
.ai-status[data-state="ready"] .pulse { background: var(--emerald); }
.ai-status[data-state="loading"] .pulse { background: var(--amber); }
.ai-status[data-state="unsupported"] .pulse,
.ai-status[data-state="error"] .pulse,
.ai-status[data-state="out_of_memory"] .pulse { background: var(--rose); }
.ai-status[data-state="supported"] .pulse { background: var(--faint); }

.progress-wrap { display: grid; gap: 8px; }
.bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
}
.bar > span.indeterminate { width: 32%; }
.progress-label { color: #fff; font-size: 13px; font-weight: 600; }
#capability-note, #limit-note { color: var(--faint); font-size: 13px; line-height: 1.5; margin: 0; }

.workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.panel h2 { margin: 0; color: #fff; font-size: 1rem; }
.counts { color: var(--faint); font-size: 12px; display: flex; gap: 10px; }
textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  background: #090b10;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  line-height: 1.55;
  color: var(--text);
}
.result {
  min-height: 320px;
  background: #090b10;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow: auto;
  line-height: 1.55;
  color: var(--text);
}

.row-actions, .file-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.primary, .ghost, .danger, .quiet {
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid transparent;
}
.primary {
  background: linear-gradient(90deg, var(--cyan), #22d3ee);
  color: var(--void);
  font-weight: 700;
}
.ghost {
  background: rgba(255,255,255,.05);
  border-color: var(--line);
  color: #fff;
}
.danger {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.28);
  color: #fecdd3;
}
.quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0 12px;
}
.tabs button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
}
.tabs button.is-active {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.1);
  color: #fff;
}
.mode-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: rgba(255,255,255,.02);
}
.chip:has(input:checked) {
  border-color: rgba(6, 182, 212, 0.4);
  color: #fff;
  background: rgba(6, 182, 212, 0.08);
}
.chip input { accent-color: var(--cyan); }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
#custom-instruction {
  min-height: 72px;
  width: 100%;
  background: #090b10;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.risk {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
}
.risk[data-risk="LOW"] { color: #6ee7b7; border-color: rgba(16,185,129,.35); }
.risk[data-risk="MEDIUM"] { color: #fcd34d; border-color: rgba(245,158,11,.35); }
.risk[data-risk="HIGH"] { color: #fecdd3; border-color: rgba(244,63,94,.4); }
.findings { display: grid; gap: 8px; margin-top: 12px; }
.finding {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.finding header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.finding .type { color: #fff; font-weight: 650; text-transform: capitalize; }
.finding .src, .finding .tag {
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.finding p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.finding .preview code {
  color: #a5f3fc;
  font-size: 12px;
}
.finding .action { color: #e4e4e7; }
.empty-findings { color: var(--faint); font-size: 14px; }

.banner, .error, .notice {
  margin: 8px 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
}
.error {
  border: 1px solid rgba(244, 63, 94, 0.28);
  background: rgba(244, 63, 94, 0.08);
  color: #fecdd3;
}
.notice {
  border: 1px solid rgba(6, 182, 212, 0.22);
  background: rgba(6, 182, 212, 0.07);
  color: #a5f3fc;
}
#run-stats { color: var(--faint); font-size: 12px; margin: 8px 0 0; }

.prose { margin-top: 56px; display: grid; gap: 18px; }
.prose-card h2 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 1.35rem;
}
.prose-card p, .prose-card li { color: var(--muted); line-height: 1.7; font-size: 15px; }
.prose-card ul { padding-left: 18px; }
.faq details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.faq summary { cursor: pointer; color: #fff; font-weight: 600; }
.faq details p { margin: 8px 0 0; }
.engine a { color: var(--cyan); }

footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--faint);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  nav { display: none; }
  .workspace { grid-template-columns: 1fr; }
  textarea, .result { min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
