/* ==========================================================================
   AI-Design Audit — unified stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Palette (umamii brand: light grey, ink, brand blue) */
  --bg: #f9f9f9;
  --ink: #2c2d37;
  --ink-strong: #1e1e1c;
  --muted: #717171;
  --taste: #3a39ff;
  --taste-strong: #2f2ee0;
  --line: #e2e2e0;
  --surface: #ffffff;
  --surface-raised: #f3f3f2;
  --chip-bg: #ffffff;
  --placeholder: #a3a3a0;
  --btn-text: #f5f5f4;
  --header-border: rgb(30 30 28 / 0.07);

  /* Severity */
  --sev-high: #ff5b23;
  --sev-med: #3a39ff;
  --sev-low: #73716c;
  --error: #C44A38;

  /* Typography */
  --font-sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --font-display: var(--font-sans);
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-label: var(--font-sans);
  --tracking: -0.025em;
  --tracking-display: -0.035em;
  --tracking-mono-caps: 0.03em;
  --text-xs: 12px;
  --text-sm: 16px;
  --text-md: 20px;
  --text-lg: 24px;
  --text-xl: 32px;
  --text-2xl: 40px;

  /* Layout */
  --wrap-pad: 28px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 16px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 3px rgb(20 17 13 / 0.08);
  --shadow-md: 0 10px 28px -18px rgb(20 17 13 / 0.16);
  --shadow-lg: 0 18px 48px -24px rgb(20 17 13 / 0.2);
  --shadow-pop: 0 10px 40px -12px rgb(20 17 13 / 0.22);
  --ease: 0.18s ease;
  --ease-slow: 0.35s ease-in-out;
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.5;
  letter-spacing: var(--tracking);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

::selection {
  color: var(--bg);
  background: var(--ink-strong);
}

/* Inverted surfaces (blue cards) — flip so selection stays readable */
.result-card ::selection,
#upload .drop ::selection,
.btn ::selection {
  color: var(--ink);
  background: var(--bg);
}

body.page-standalone {
  display: block;
  padding: var(--wrap-pad);
}

main {
  flex: 1 0 auto;
}

main.layout-column {
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1,
h2 {
  font-family: var(--font-display);
}

h1 {
  font-weight: 600;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: var(--tracking-display);
}

h2 {
  font-weight: 600;
  font-size: 22px;
  letter-spacing: var(--tracking-display);
}

.lede {
  font-size: clamp(15px, 1.7vw, 17px);
  color: var(--muted);
  max-width: 82ch;
  margin: 14px auto 0;
  text-wrap: balance;
}

.mono {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
}

.sub {
  color: var(--muted);
  margin-top: 4px;
  max-width: 70ch;
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.wrap,
.wrap-upload,
.wrap-wide,
.wrap--results,
.wrap--admin {
  margin-inline: auto;
  padding-inline: var(--wrap-pad);
}

.wrap { max-width: 760px; }
.wrap-upload { max-width: 960px; }
.wrap-wide { max-width: 1120px; }
.wrap--results { max-width: 1080px; }
.wrap--admin { max-width: 1200px; }

/* --------------------------------------------------------------------------
   Page states (index flow)
   -------------------------------------------------------------------------- */
.page-state {
  display: none;
}

.page-state.show {
  display: block;
}

#state-upload.show {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

#state-analyzing.show {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: flex-start;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(to bottom, #ffffff, var(--bg));
  border-bottom: 1px solid var(--header-border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 16px;
}

/* Header inner carries the page's wrap class so its left/right edges line up
   with the body content. Fallback width when no wrap class is present. */
.topbar-inner:not([class*="wrap"]) {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: var(--wrap-pad);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 104px;
  height: auto;
}

.brand-sep {
  width: 1px;
  height: 19px;
  background: var(--line);
}

.brand-tool,
.topbar-link {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
}

.brand-tool {
  color: var(--ink);
}

.topbar-link {
  color: var(--muted);
  text-decoration: none;
}

.topbar-link:hover {
  color: var(--ink);
}

.badge-local {
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px 10px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--text-sm);
  line-height: 1;
  border: none;
  border-radius: 100px;
  padding: 16px 22px;
  cursor: pointer;
  text-decoration: none;
  background: var(--ink);
  color: var(--bg);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn:hover {
  background: var(--taste);
}

.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.ghost {
  background: var(--chip-bg);
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.btn.ghost:hover {
  background: var(--surface-raised);
  border-color: var(--muted);
}

.btn.copied {
  background: var(--taste);
}

.btn-sm {
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 7px 12px;
}

.btn-sm .btn-icon {
  width: 13px;
  height: 13px;
}

.btn-icon {
  flex: none;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-icon * {
  fill: none;
  stroke: inherit;
  stroke-width: inherit;
  stroke-linecap: inherit;
  stroke-linejoin: inherit;
}

.link-btn {
  font-family: inherit;
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: var(--tracking);
  color: var(--ink);
}

.field input,
.field textarea {
  width: 100%;
  padding: 13px 15px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: var(--tracking);
  color: var(--ink);
  background: var(--chip-bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
}

.field textarea {
  min-height: 64px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--placeholder);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--muted);
}

/* --------------------------------------------------------------------------
   Drop zone — simple (admin / compare)
   -------------------------------------------------------------------------- */
.drop {
  padding: 20px 24px;
  font-size: 14px;
  cursor: pointer;
  background: var(--chip-bg);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-md);
}

.drop:hover {
  background: var(--surface-raised);
  border-color: var(--muted);
}

.drop input[type="file"],
.drop input {
  display: none;
}

/* Drop zone — upload (index) */
#upload .drop {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(16px, 4vw, 28px);
  width: 100%;
  aspect-ratio: 3 / 2;
  padding: 24px 28px;
  text-align: left;
  color: #fff;
  background: var(--taste);
  border: 1.5px dashed color-mix(in srgb, #fff 38%, var(--taste));
  border-radius: var(--radius-xl);
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease), transform var(--ease);
}

.drop-art {
  position: relative;
  flex: none;
  align-self: center;
  width: min(52%, 240px);
  aspect-ratio: 1;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.drop-art-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.drop-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

#upload .drop .drop-title {
  margin-top: 0;
  color: #fff;
}

#upload .drop .drop-hint {
  max-width: 26ch;
  color: color-mix(in srgb, #fff 72%, transparent);
}

#upload .drop .drop-formats {
  justify-content: flex-start;
}

#upload .drop .drop-pill {
  color: color-mix(in srgb, #fff 88%, transparent);
  background: color-mix(in srgb, #fff 12%, transparent);
  border-color: color-mix(in srgb, #fff 35%, transparent);
}

#upload .drop:hover {
  background: var(--taste-strong);
  border-color: color-mix(in srgb, #fff 48%, var(--taste-strong));
  box-shadow: var(--shadow-md);
}

#upload .drop.over {
  background: var(--taste-strong);
  border-color: color-mix(in srgb, #fff 58%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, #fff 16%, transparent);
  transform: scale(1.005);
}

#upload .drop:focus-within {
  outline: none;
  border-color: color-mix(in srgb, #fff 58%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, #fff 16%, transparent);
}

.drop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  color: var(--taste);
  background: color-mix(in srgb, var(--taste) 9%, var(--surface-raised));
  border: 1px solid color-mix(in srgb, var(--taste) 18%, var(--line));
  border-radius: var(--radius-sm);
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}

#upload .drop:hover .drop-icon,
#upload .drop.over .drop-icon {
  background: color-mix(in srgb, var(--taste) 14%, var(--surface-raised));
  border-color: color-mix(in srgb, var(--taste) 35%, var(--line));
}

#upload .drop.over .drop-icon {
  transform: translateY(-2px);
}

.drop-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-title {
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: var(--tracking);
}

.drop-hint {
  max-width: 28ch;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

.drop-formats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}

.drop-pill {
  padding: 4px 9px;
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 100px;
}

/* --------------------------------------------------------------------------
   Preview
   -------------------------------------------------------------------------- */
.preview {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.preview.show {
  display: flex;
}

.preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.preview-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.preview-del {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  background: rgb(255 255 255 / 0.94);
  border: none;
  border-radius: 100px;
  box-shadow: var(--shadow-sm);
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.preview-del:hover {
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: 0 2px 6px rgb(20 17 13 / 0.12);
}

/* --------------------------------------------------------------------------
   Upload layout & trust line
   -------------------------------------------------------------------------- */
.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 56px;
  align-items: start;
  padding: 64px 0 8px;
}

.upload-copy {
  padding-top: 6px;
}

.upload-copy h1,
.upload-copy .lede {
  text-align: left;
}

.upload-copy h1 {
  font-size: clamp(36px, 4.8vw, 52px);
  letter-spacing: var(--tracking-display);
  line-height: 1.05;
  max-width: 12ch;
}

.upload-copy h1 .hero-em {
  color: var(--taste);
  font-style: normal;
}

.upload-copy .lede {
  max-width: 46ch;
  margin: 14px 0 0;
  font-weight: 400;
  font-size: clamp(18px, 2vw, 22px);
}

form#upload {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 32px;
}

.submit-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 2px 0;
}

.small-note {
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  color: var(--muted);
}

.trust-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.trust-item::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 100px;
  background: var(--taste);
  opacity: 0.55;
}

/* --------------------------------------------------------------------------
   Alerts & status messages
   -------------------------------------------------------------------------- */
.err {
  display: none;
  padding: 12px 15px;
  font-size: 14px;
  color: var(--error);
  background: var(--surface-raised);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
}

.err.show {
  display: block;
}

.status {
  padding: 20px 0;
  font-size: 14px;
  color: var(--muted);
}

.status.err {
  color: var(--error);
}

.runs-summary {
  margin: 4px 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
}

.runs-summary strong {
  color: var(--ink-strong);
  font-weight: 600;
}

.runs-summary .rs-cost {
  display: inline-block;
  margin-top: 6px;
}

.runs-summary .rs-verify {
  margin-top: 2px;
}

.runs-summary code {
  font-family: var(--font-mono);
  font-size: 12px;
}

.rs-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  vertical-align: middle;
}

.rs-tag--ok {
  border-color: var(--ink);
  color: var(--ink);
}

.thumb-img { cursor: zoom-in; }

/* ---- lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px;
  background: rgb(30 30 28 / 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox.open { display: flex; }

.lb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 1100px);
  max-height: 90vh;
  margin: 0;
}

.lb-stage img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
  background: var(--surface-raised);
}

.lb-caption {
  font-family: var(--font-label);
  font-size: 12px;
  letter-spacing: var(--tracking-mono-caps);
  color: rgb(255 255 255 / 0.82);
}

.lb-nav,
.lb-close {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(255 255 255 / 0.25);
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lb-nav {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 26px;
  line-height: 1;
}

.lb-nav:hover,
.lb-close:hover {
  background: rgb(255 255 255 / 0.22);
  border-color: rgb(255 255 255 / 0.5);
}

.lb-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 24px;
  line-height: 1;
}

.loading,
.load-err {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

.load-err {
  color: var(--error);
}

.clean,
.clean-note {
  padding: 20px 22px;
  text-align: center;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */
.faq {
  width: 100%;
  max-width: 640px;
  margin: auto auto 32px;
  padding-top: 48px;
}

.faq-title {
  margin-bottom: 20px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}

.faq-item {
  border-top: 1px solid var(--line);
}

.faq-item:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 18px 4px;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking);
  text-align: left;
  color: inherit;
  cursor: pointer;
  background: none;
  border: none;
}

.faq-q:hover {
  color: var(--taste);
}

.faq-q .faq-sign {
  flex: none;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  transition: transform var(--ease-slow);
}

.faq-item.is-open .faq-q .faq-sign {
  transform: rotate(45deg);
}

.faq-answer {
  height: 0;
  overflow: hidden;
  transition: height var(--ease-slow);
}

.faq-answer-inner {
  padding: 0 4px 20px;
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
  color: var(--muted);
  opacity: 0;
  transition: opacity var(--ease-slow);
}

.faq-item.is-open .faq-answer-inner {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Analyzing / scan
   -------------------------------------------------------------------------- */
.analyzing {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 0 72px;
  text-align: center;
}

.analyzing h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.08;
  letter-spacing: var(--tracking-display);
}

/* Caught-you screen for a self-audit. */
.easter {
  max-width: 560px;
  margin: 0 auto;
  padding: 56px 0 80px;
  text-align: center;
}

.easter-gif {
  width: min(100%, 320px);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 0 auto 32px;
  display: block;
}

.easter h1 {
  font-size: clamp(26px, 4.5vw, 36px);
  line-height: 1.12;
  letter-spacing: var(--tracking-display);
  margin-bottom: 12px;
}

.easter .small-note {
  margin-bottom: 28px;
}

.scan-stage {
  width: min(100%, 440px);
  margin: 0 auto 36px;
  padding: 18px 0;
}

.scan-tilt {
  transform-origin: center center;
  animation: float 3.6s cubic-bezier(0.42, 0, 0.58, 1) infinite;
  will-change: transform;
}

@keyframes float {
  0%, 100% {
    transform: translate3d(0, 3px, 0) rotate(-1.2deg) scale(1);
  }
  18% {
    transform: translate3d(4px, -12px, 0) rotate(1deg) scale(1.006);
  }
  38% {
    transform: translate3d(-5px, -18px, 0) rotate(1.4deg) scale(1.008);
  }
  58% {
    transform: translate3d(6px, -10px, 0) rotate(-0.6deg) scale(1.005);
  }
  78% {
    transform: translate3d(-3px, -14px, 0) rotate(-1deg) scale(1.007);
  }
}

.scan-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  animation: float-shadow 3.6s cubic-bezier(0.42, 0, 0.58, 1) infinite;
  box-shadow:
    0 12px 32px -18px rgb(20 17 13 / 0.24),
    0 5px 14px -7px rgb(20 17 13 / 0.11);
}

@keyframes float-shadow {
  0%, 100% {
    box-shadow:
      0 10px 28px -18px rgb(20 17 13 / 0.2),
      0 4px 12px -6px rgb(20 17 13 / 0.1);
  }
  38% {
    box-shadow:
      0 24px 52px -16px rgb(20 17 13 / 0.34),
      0 12px 28px -8px rgb(20 17 13 / 0.16);
  }
}

.scan-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: grayscale(0.25) brightness(0.98);
}

.scan-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.checks {
  display: inline-block;
  margin-top: 22px;
  text-align: left;
  list-style: none;
}

.checks li {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 10px 0;
  font-size: 15px;
  color: var(--muted);
}

.check-dot {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 100px;
  transition: background var(--ease-slow), border-color var(--ease-slow);
}

.check-dot svg {
  width: 10px;
  height: 10px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity var(--ease-slow), transform var(--ease-slow);
}

.checks li.done {
  color: var(--ink);
}

.checks li.done .check-dot {
  background: var(--taste);
  border-color: var(--taste);
}

.checks li.done .check-dot svg {
  opacity: 1;
  transform: scale(1);
}

.checks li.doing {
  color: var(--ink);
}

.checks li.doing .check-dot {
  border-color: var(--taste);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Severity utilities
   -------------------------------------------------------------------------- */
.dot.high, .pin.high, .issue-num.high, .pop-num.high, .note-dot.high, .fnum.high { background: var(--sev-high); }
.dot.medium, .pin.medium, .issue-num.medium, .pop-num.medium, .note-dot.medium, .fnum.medium { background: var(--sev-med); }
.dot.low, .pin.low, .issue-num.low, .pop-num.low, .note-dot.low, .fnum.low { background: var(--sev-low); }

.issue-sev.high, .pop-sev.high { color: var(--sev-high); }
.issue-sev.medium, .pop-sev.medium { color: var(--sev-med); }
.issue-sev.low, .pop-sev.low { color: var(--sev-low); }

.fnum.global,
.issue-num.global {
  background: var(--placeholder);
}

/* --------------------------------------------------------------------------
   Markers (map pins, issue badges)
   -------------------------------------------------------------------------- */
.dot,
.pin,
.issue-num,
.pop-num,
.fnum {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-label);
  font-weight: 600;
  color: #fff;
  border-radius: 100px;
}

.dot,
.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
  transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dot {
  width: 26px;
  height: 26px;
  font-size: var(--text-xs);
}

.pin {
  z-index: 2;
  width: 30px;
  height: 30px;
  font-size: 13px;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.4);
}

.dot:hover,
.dot.active,
.pin:hover,
.pin.active {
  transform: translate(-50%, -50%) scale(1.15);
}

.dot:hover,
.dot.active {
  transform: translate(-50%, -50%) scale(1.18);
}

.pin:hover,
.pin.active {
  z-index: 4;
}

.issue-num,
.pop-num {
  flex: none;
  align-self: center;
}

.issue-num {
  width: 22px;
  height: 22px;
  font-size: 11px;
}

.pop-num {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.fnum {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  font-size: 10px;
}

/* Admin/compare smaller markers */
.col .dot {
  width: 20px;
  height: 20px;
  font-size: 10px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
}

/* --------------------------------------------------------------------------
   Score & report header
   -------------------------------------------------------------------------- */
.report-head {
  padding: 40px 0 8px;
}

.report-body {
  padding-top: 32px;
  padding-bottom: 8px;
}

.score-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.score-block {
  flex: none;
  min-width: 132px;
}

.score-block .btn-sm {
  position: absolute;
  right: 24px;
  bottom: 24px;
  margin-top: 0;
}

.score-num {
  font-size: 64px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--tracking-display);
}

.score-of {
  font-size: var(--text-md);
  color: var(--muted);
}

.score-label {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 11px;
  font-family: var(--font-label);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: capitalize;
  color: var(--taste);
  border: 1px solid color-mix(in srgb, var(--taste) 35%, transparent);
  border-radius: 0;
}

.gauge {
  position: relative;
  max-width: 320px;
  height: 6px;
  margin-top: 16px;
  background: var(--line);
  border-radius: 100px;
}

.gauge .mark {
  position: absolute;
  top: -3px;
  width: 12px;
  height: 12px;
  background: var(--taste);
  border: 2px solid var(--bg);
  border-radius: 100px;
  transform: translateX(-50%);
}

.gscale {
  display: flex;
  justify-content: space-between;
  max-width: 320px;
  margin-top: 7px;
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  color: var(--placeholder);
}

.score-summary {
  flex: 1;
  min-width: 260px;
  font-size: var(--text-md);
  line-height: 1.4;
  text-wrap: pretty;
  color: var(--muted);
}

/* Result card (inverted hero) */
.result-card {
  position: relative;
  margin-bottom: 28px;
  padding: 36px 40px;
  color: #fff;
  background: var(--taste);
  border-radius: var(--radius-lg);
}

.band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 40px 48px;
  align-items: start;
}

.band-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 6px;
}

.result-card .score-num {
  color: #fff;
}

.result-card .score-of {
  font-size: 17px;
  font-weight: 500;
  color: color-mix(in srgb, #fff 42%, transparent);
}

.result-card .score-label {
  margin-top: 14px;
  padding: 5px 12px;
  font-size: 10px;
  color: color-mix(in srgb, #fff 75%, transparent);
  background: color-mix(in srgb, #fff 14%, transparent);
  border-color: color-mix(in srgb, #fff 40%, transparent);
}

.result-card .summary {
  max-width: 58ch;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.45;
  text-wrap: pretty;
  color: color-mix(in srgb, #fff 88%, transparent);
}

.result-card .summary-count {
  margin-top: -8px;
  font-size: var(--text-sm);
  color: color-mix(in srgb, #fff 62%, transparent);
}

.result-card .summary-count:empty {
  display: none;
}

.result-card .btn {
  color: var(--taste);
  background: #fff;
}

.result-card .btn:hover,
.result-card .btn.copied {
  color: #fff;
  background: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Audit grid & issues
   -------------------------------------------------------------------------- */
.audit-grid {
  display: grid;
  grid-template-columns: minmax(0, 440px) 1fr;
  gap: 32px;
  align-items: start;
  margin: 38px 0 20px;
}

.shot-col {
  position: sticky;
  top: 24px;
}

.shot-frame,
.shot {
  position: relative;
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.shot-frame {
  border-radius: var(--radius-md);
}

.shot {
  width: 100%;
  max-width: 100%;
  box-shadow: 0 1px 0 rgb(20 17 13 / 0.04);
}

.shot-frame img,
.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shotcap {
  margin-top: 8px;
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  color: var(--muted);
}

.stage {
  position: relative;
  margin: 0 0 8px;
}

/* Portrait (phone) screenshots: cap the width and centre so they don't
   stretch to the full report column. */
.stage--portrait .shot {
  max-width: 420px;
  margin-inline: auto;
}

/* Escape hatch when the phone guess is wrong: expand back to full width. */
.stage--portrait.stage--expanded .shot {
  max-width: 100%;
}

.shot-expand {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-raised) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s, border-color 0.15s;
}

.stage--portrait .shot-expand {
  display: flex;
}

.shot-expand:hover {
  background: var(--surface-raised);
  border-color: var(--muted);
}

.shot-expand svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.issues {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.global-note {
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  color: var(--placeholder);
}

.issue,
.note {
  padding: 16px 18px;
  background: var(--chip-bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
}

.issue {
  scroll-margin-top: 24px;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.issue.active {
  background: var(--surface-raised);
  border-color: var(--ink);
}

.issue-head,
.note-head,
.pop-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.issue-head {
  gap: 10px;
}

.pop-head {
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 8px;
  padding-right: 22px;
}

.pop-headtext {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pop-head .pop-sev {
  align-self: flex-start;
  margin-left: 0;
  color: var(--muted);
}

.issue-title,
.pop-title,
.note-title {
  font-weight: 600;
  line-height: 1.25;
}

.issue-title,
.note-title {
  font-size: var(--text-sm);
  letter-spacing: var(--tracking);
}

.pop-title {
  font-size: 15px;
}

.issue-sev,
.pop-sev,
.note-sev {
  align-self: center;
  margin-left: auto;
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
}

.note-sev {
  color: var(--muted);
}

.issue-evidence,
.pop-evidence,
.note-evidence {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.pop-evidence {
  font-size: 13.5px;
}

.issue-evidence {
  color: var(--ink);
}

.issue-fix,
.pop-fix,
.note-fix {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.issue-fix {
  font-size: 13.5px;
}

/* --------------------------------------------------------------------------
   Prompt blocks & copy button
   -------------------------------------------------------------------------- */
.prompt,
.pop-prompt,
.note-prompt {
  position: relative;
  margin-top: 11px;
  padding: 11px 12px 36px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.prompt {
  margin-top: 12px;
  padding: 12px 14px 38px;
  color: var(--ink);
}

.pop-prompt {
  max-height: 150px;
  overflow: auto;
  font-size: 11.5px;
  background: var(--chip-bg);
}

.copy {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 4px 8px;
  font-family: var(--font-label);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.prompt .copy {
  right: 8px;
  bottom: 8px;
  font-size: 10px;
  background: var(--chip-bg);
}

.copy:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.copy.copied {
  color: var(--taste);
  border-color: color-mix(in srgb, var(--taste) 40%, transparent);
}

/* --------------------------------------------------------------------------
   Popover
   -------------------------------------------------------------------------- */
.pop {
  position: absolute;
  z-index: 5;
  width: 320px;
  max-width: calc(100% - 24px);
  padding: 16px 16px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
}

.pop-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 100px;
}

.pop-close:hover {
  color: var(--ink);
  border-color: var(--muted);
}

/* --------------------------------------------------------------------------
   Notes section (results)
   -------------------------------------------------------------------------- */
.notes {
  margin-top: 36px;
  padding: 30px 0 8px;
  border-top: 1px solid var(--line);
}

.notes-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.note-dot {
  flex: none;
  align-self: center;
  width: 9px;
  height: 9px;
  border-radius: 100px;
}

/* --------------------------------------------------------------------------
   CTAs
   -------------------------------------------------------------------------- */
.report-cta {
  margin-top: 40px;
  padding: 28px 0;
  text-align: center;
  border-top: 1px solid var(--line);
}

.bottom-cta {
  display: flex;
  justify-content: center;
  margin-top: 40px;
  padding: 30px 0 8px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer {
  flex-shrink: 0;
  margin-top: 60px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1240px;
  margin-inline: auto;
  padding: 38px var(--wrap-pad);
  color: var(--muted);
}

.footer-inner .foot-brand {
  display: block;
  width: 104px;
  height: auto;
}

.footer-inner a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-inner a:hover {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */
.wrap--admin h1 {
  font-size: 26px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 24px 0 10px;
}

.tab {
  padding: 8px 16px;
  font-family: var(--font-label);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  background: var(--chip-bg);
  border: 1.5px solid var(--line);
  border-radius: 100px;
}

.tab[aria-selected="true"] {
  color: #fff;
  background: var(--taste);
  border-color: var(--taste);
}

.view {
  display: none;
  padding: 14px 0 60px;
}

.view.show {
  display: block;
}

table {
  width: 100%;
  margin-top: 16px;
  font-size: 13.5px;
  border-collapse: collapse;
}

th {
  padding: 8px 10px;
  font-family: var(--font-label);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--tracking-mono-caps);
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
  border-bottom: 1.5px solid var(--line);
}

td {
  padding: 10px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

tr:hover td {
  background: var(--chip-bg);
}

td.thumb {
  width: 74px;
}

td.thumb img {
  display: block;
  width: 64px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.score-pill {
  font-family: var(--font-label);
  font-size: var(--text-xs);
  font-weight: 600;
}

.model-cell {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.row-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Compare grid (admin + compare page)
   -------------------------------------------------------------------------- */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  margin: 18px 0;
}

.page-standalone .controls {
  margin: 24px 0;
}

.models {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 560px;
}

.mchip {
  padding: 7px 13px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  background: var(--chip-bg);
  border: 1.5px solid var(--line);
  border-radius: 100px;
}

.mchip[aria-selected="true"],
.mchip[aria-pressed="true"] {
  color: #fff;
  background: var(--taste);
  border-color: var(--taste);
}

.previewbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.page-standalone .previewbar {
  margin-bottom: 20px;
}

.previewbar img {
  height: 66px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.page-standalone .previewbar img {
  height: 72px;
}

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

.page-standalone .grid {
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.col {
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.col.pending .col-body,
.pending .col-body {
  display: flex;
  align-items: center;
  min-height: 70px;
}

.page-standalone .pending .col-body {
  min-height: 80px;
}

.col-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.page-standalone .col-head {
  padding: 14px 16px;
}

.col-model {
  font-size: 14px;
  font-weight: 600;
}

.page-standalone .col-model {
  font-size: 15px;
}

.col-meta {
  margin-top: 3px;
  font-family: var(--font-label);
  font-size: 11px;
  color: var(--muted);
}

.page-standalone .col-meta {
  margin-top: 4px;
  font-size: var(--text-xs);
  text-transform: none;
}

.col-shot {
  position: relative;
  border-bottom: 1px solid var(--line);
}

.col-shot img {
  display: block;
  width: 100%;
}

.col-body {
  padding: 13px 15px;
}

.page-standalone .col-body {
  padding: 14px 16px;
}

.scorebig {
  font-size: 30px;
  font-weight: 600;
}

.page-standalone .scorebig {
  font-size: 34px;
}

.scorebig span {
  font-size: 14px;
  color: var(--muted);
}

.page-standalone .scorebig span {
  font-size: 15px;
}

.col-body .summary {
  margin: 7px 0 11px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
}

.page-standalone .col-body .summary {
  margin: 8px 0 12px;
  font-size: 13px;
}

.flist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
}

.page-standalone .flist {
  gap: 7px;
}

.flist li {
  display: flex;
  gap: 8px;
  font-size: var(--text-xs);
  line-height: 1.35;
}

.page-standalone .flist li {
  font-size: 12.5px;
}

.fname {
  font-weight: 600;
}

.fev {
  color: var(--muted);
}

.page-standalone h1 {
  font-size: 30px;
}

.page-standalone .sub {
  margin-top: 6px;
}

.page-standalone .status {
  font-size: 13px;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .scan-tilt,
  .scan-frame {
    animation: none;
  }

  .faq-answer,
  .faq-answer-inner,
  .faq-q .faq-sign,
  .check-dot,
  .check-dot svg {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (min-width: 821px) {
  #state-analyzing.show {
    justify-content: center;
  }

  .analyzing {
    padding: 32px 0;
  }

  .wrap-upload {
    max-width: 1080px;
  }

  .upload-layout {
    flex: 1;
    align-items: center;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 460px);
    gap: clamp(64px, 7vw, 108px);
    padding: clamp(48px, 9vh, 112px) 0 clamp(24px, 4vh, 48px);
  }

  .upload-copy {
    padding-top: clamp(24px, 5vh, 64px);
  }

  form#upload {
    margin-top: 80px;
  }

  .upload-copy h1 {
    max-width: 12ch;
    font-size: clamp(44px, 4.8vw, 64px);
  }

  .upload-copy .lede {
    max-width: 42ch;
    margin-top: 20px;
    font-size: clamp(16px, 1.5vw, 18px);
  }
}

@media (min-width: 1100px) {
  .upload-layout {
    gap: 96px;
  }
}

@media (max-width: 820px) {
  .audit-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .shot-col {
    position: static;
  }

  .upload-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 44px;
  }

  .upload-copy {
    padding-top: 0;
  }

  .upload-layout form#upload {
    max-width: 440px;
  }
}

@media (max-width: 720px) {
  .band {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  /* Flatten so Copy can sit after the summary instead of overlapping it */
  .score-block {
    display: contents;
    min-width: 0;
  }

  .score-row {
    order: 1;
  }

  .score-label {
    order: 2;
    width: fit-content;
  }

  .band-right {
    order: 3;
    gap: 18px;
    padding-top: 0;
  }

  .score-block .btn-sm {
    position: static;
    order: 4;
    align-self: flex-end;
    margin-top: 4px;
  }

  .result-card .summary {
    max-width: none;
  }
}

@media (max-width: 600px) {
  .score-num {
    font-size: 52px;
  }

  .result-card {
    padding: 28px 24px;
    border-radius: var(--radius-lg);
  }

  .pop {
    width: 280px;
  }
}

@media (max-width: 520px) {
  .upload-layout {
    padding-top: 36px;
  }

  .scan-stage {
    width: min(100%, 340px);
    margin-bottom: 28px;
    padding: 12px 0;
  }

  .analyzing {
    padding: 36px 0 56px;
  }
}

@media (max-width: 360px) {
  .head-tag {
    display: none;
  }
}
