:root {
  --bg: #090b12;
  --surface: #121523;
  --surface-2: #181c2e;
  --border: rgba(196, 180, 240, 0.16);
  --text: #f3f1fb;
  --muted: #b5adc9;
  --accent: #a78bfa;
  --accent-strong: #c4b5fd;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 18% 0%, rgba(124, 58, 237, 0.18), transparent 45%),
    radial-gradient(circle at 86% 12%, rgba(56, 189, 248, 0.12), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(9, 11, 18, 0.84);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  color: #fff;
}

.brand svg {
  width: 24px;
  height: 20px;
  color: var(--accent-strong);
}

.brand span.sub {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--muted);
  padding-left: 10px;
  border-left: 1px solid var(--border);
}

.topbar-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 550;
}

.pill.primary {
  background: #e7d7ff;
  border-color: #f2e6ff;
  color: #1f1630;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 64px;
}

.hero {
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  margin: 0 0 8px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn[aria-selected="true"] {
  background: rgba(167, 139, 250, 0.18);
  border-color: var(--accent);
  color: #fff;
}

.tab-panel[hidden] {
  display: none;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(290px, 380px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: linear-gradient(150deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.card h2,
.card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

select,
textarea,
input[type="file"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d101b;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: 0.9rem;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

.ai-review-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.36);
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.08), rgba(15, 18, 32, 0.9));
}

.ai-review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.ai-review-body {
  font-size: 0.9rem;
  color: #e9e4f8;
  line-height: 1.55;
}

.ai-review-body p {
  margin: 0 0 8px;
}

.ai-review-body ul {
  margin: 4px 0 10px;
  padding-left: 18px;
}

.turnaround-stage {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 35%, #1c223b, #0b0d16);
  text-align: center;
}

.turnaround-stage img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.dropzone {
  border: 1.5px dashed rgba(167, 139, 250, 0.45);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: rgba(167, 139, 250, 0.06);
  margin-bottom: 14px;
  cursor: pointer;
}

.dropzone.drag {
  border-color: #fff;
  background: rgba(167, 139, 250, 0.16);
}

.dropzone p {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 9px 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: #e7d7ff;
  border-color: #f3e8ff;
  color: #1f1630;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.samples-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.viewport-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 35%, #1c223b, #0b0d16);
  height: 360px;
}

#critic-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.viewport-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.viewport-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.score-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 750;
}

.grade-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  background: rgba(52, 211, 153, 0.16);
  color: var(--good);
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.grade-pill.warn {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.4);
}

.grade-pill.bad {
  background: rgba(248, 113, 113, 0.16);
  color: var(--bad);
  border-color: rgba(248, 113, 113, 0.4);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.metric-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.metric-box span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.metric-box strong {
  font-size: 0.98rem;
  color: #fff;
}

.directives-list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: #e4dff5;
  font-size: 0.9rem;
}

.directives-list li + li {
  margin-top: 6px;
}

.pbr-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.pbr-outputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.canvas-preview {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: repeating-conic-gradient(#1a1e2e 0% 25%, #121521 0% 50%) 50% / 18px 18px;
  display: block;
  margin-bottom: 10px;
}

.code-block {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: #0a0c14;
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 460px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #ddd6fe;
  white-space: pre;
}

table.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin: 12px 0;
}

table.ref-table th,
table.ref-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

table.ref-table th {
  color: var(--muted);
  font-weight: 600;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.gallery-card {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0c0e17;
}

.gallery-card img {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-card figcaption {
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

pre.json-out {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: #0b0d16;
  border: 1px solid var(--border);
  max-height: 240px;
  overflow: auto;
  font-size: 0.8rem;
  color: #cbd5e1;
}
