/* ============================================================
   TwinLens — image similarity frontend
   ============================================================ */

:root {
  --bg: #07070a;
  --panel: #0f0f16;
  --text: #f4f4f8;
  --muted: #a2a2b4;
  --faint: #6d6d80;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --violet: #a78bfa;
  --indigo: #818cf8;
  --teal: #5eead4;
  --amber: #fbbf24;
  --rose: #fb7185;
  --font-ui: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --shell: 1120px;
  --radius: 26px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

h1, h2, h3, p, figure {
  margin: 0;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img {
  max-width: 100%;
}

::selection {
  background: rgba(167, 139, 250, 0.35);
  color: #fff;
}

:where(button, a, input, [tabindex]):focus-visible {
  outline: 2px solid rgba(167, 139, 250, 0.72);
  outline-offset: 3px;
}

.dropzone:focus-visible {
  outline: none;
}

/* ---------- backdrop ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(920px 560px at 16% -12%, rgba(139, 92, 246, 0.24), transparent 64%),
    radial-gradient(820px 520px at 86% -4%, rgba(45, 212, 191, 0.13), transparent 66%),
    radial-gradient(700px 460px at 50% 108%, rgba(99, 102, 241, 0.09), transparent 70%);
}

.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 68px 68px;
  -webkit-mask-image: radial-gradient(ellipse 85% 58% at 50% 0%, #000 10%, transparent 78%);
  mask-image: radial-gradient(ellipse 85% 58% at 50% 0%, #000 10%, transparent 78%);
  opacity: 0.7;
}

/* ---------- top bar ---------- */

.topbar {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 26px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.brand-name {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.brand-name span,
.footer-brand span {
  color: var(--teal);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--teal);
  box-shadow: 0 0 9px currentColor;
  animation: pulse 3.4s ease-in-out infinite;
}

/* ---------- shell / hero ---------- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 24px 40px;
}

.hero {
  text-align: center;
  padding: 58px 0 34px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.9);
}

.hero h1 {
  margin-top: 22px;
  font-size: clamp(2.7rem, 6.4vw, 4.7rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.hero h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.015em;
  background: linear-gradient(100deg, #ede9fe 0%, #c7d2fe 40%, #99f6e4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.06em;
}

.lede {
  max-width: 560px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.7;
  font-weight: 400;
}

.hero > * {
  animation: rise 0.8s var(--ease) both;
}

.hero h1 { animation-delay: 0.06s; }
.hero .lede { animation-delay: 0.12s; }

/* ---------- workspace ---------- */

.workspace {
  scroll-margin-top: 28px;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: stretch;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 392px;
  padding: 16px;
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.011));
  cursor: pointer;
  outline: none;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s var(--ease);
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: rgba(167, 139, 250, 0.5);
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.06), rgba(255, 255, 255, 0.014));
  box-shadow: 0 24px 60px -40px rgba(139, 92, 246, 0.7);
}

.dropzone:focus-visible {
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.28), 0 24px 60px -40px rgba(139, 92, 246, 0.7);
}

.dropzone.is-dragging {
  border-color: var(--violet);
  background: rgba(167, 139, 250, 0.1);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.12), 0 30px 70px -40px rgba(139, 92, 246, 0.8);
}

.dropzone.has-image {
  border-style: solid;
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 26px 60px -46px rgba(0, 0, 0, 0.9);
}

.dropzone.has-image:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--panel);
}

.slot-chip {
  position: absolute;
  top: 25px;
  left: 25px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 5px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(9, 9, 14, 0.74);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #e3e3ee;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.slot-index {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(167, 139, 250, 0.4), rgba(94, 234, 212, 0.28));
  color: #f6f4ff;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0;
}

.dz-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 18px 24px;
  text-align: center;
}

.dz-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background: radial-gradient(circle at 30% 20%, rgba(167, 139, 250, 0.3), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 30px -24px rgba(139, 92, 246, 0.9);
  color: #d7ccff;
}

.dz-icon svg {
  width: 26px;
  height: 26px;
}

.dz-title {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.dz-hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.84rem;
}

.dz-link {
  color: #d8ccff;
  border-bottom: 1px solid rgba(216, 204, 255, 0.35);
}

.dz-formats {
  margin-top: 20px;
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.dz-preview {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  background: #06060a;
}

.dz-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dz-clear {
  position: absolute;
  top: 23px;
  right: 23px;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(8, 8, 12, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #e8e8f0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dz-clear svg {
  width: 15px;
  height: 15px;
}

.dz-clear:hover {
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(251, 113, 133, 0.18);
  color: #fecdd3;
  transform: scale(1.06);
}

.dz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 44px;
  padding: 13px 6px 1px;
}

.dz-file {
  min-width: 0;
}

.dz-name {
  display: block;
  max-width: 250px;
  overflow: hidden;
  color: #e9e9f2;
  font-size: 0.83rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dz-dims {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 0.7rem;
}

.dz-ready {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.dz-ready::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* scan line while analyzing */

.scanline {
  position: absolute;
  top: -34%;
  left: 0;
  right: 0;
  height: 30%;
  display: none;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(94, 234, 212, 0.14) 42%,
    rgba(167, 139, 250, 0.8) 50%,
    rgba(94, 234, 212, 0.14) 58%,
    transparent
  );
  mix-blend-mode: screen;
}

.dropzone.is-analyzing {
  border-color: rgba(129, 140, 248, 0.4);
}

.dropzone.is-analyzing .scanline {
  display: block;
  animation: scan 1.25s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* swap column */

.swap-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
}

.swap-line {
  flex: 1;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--line-strong), transparent);
}

.swap-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease, transform 0.4s var(--ease), opacity 0.25s ease;
}

.swap-btn svg {
  width: 18px;
  height: 18px;
}

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

.swap-btn:not(:disabled):hover {
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.12);
  color: var(--text);
  transform: rotate(180deg);
}

/* ---------- examples ---------- */

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.examples-label {
  margin-right: 4px;
  color: var(--faint);
  font-size: 0.63rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.example {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 13px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.022);
  text-align: left;
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s var(--ease);
}

.example:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.example:disabled {
  opacity: 0.4;
  cursor: wait;
  transform: none;
}

.ex-thumbs {
  position: relative;
  flex: none;
  width: 44px;
  height: 34px;
}

.ex-thumbs img {
  position: absolute;
  top: 0;
  width: 30px;
  height: 34px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.ex-thumbs img:first-child {
  left: 0;
  transform: rotate(-4deg);
}

.ex-thumbs img:last-child {
  left: 13px;
  transform: rotate(4deg);
}

.ex-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ex-name {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.ex-sub {
  color: var(--faint);
  font-size: 0.67rem;
}

/* ---------- actions ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
}

.privacy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 0.76rem;
}

.privacy svg {
  width: 14px;
  height: 14px;
  color: #8f8fa4;
}

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 52px;
  min-width: 214px;
  padding: 0 8px 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: linear-gradient(180deg, #fdfdfe, #e7e7f0);
  color: #09090e;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 36px -16px rgba(255, 255, 255, 0.4);
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
}

.btn-primary:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 46px -16px rgba(255, 255, 255, 0.42), 0 0 0 5px rgba(167, 139, 250, 0.08);
}

.btn-primary:not(:disabled):active {
  transform: translateY(0) scale(0.99);
}

.btn-arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0a0a10;
  color: #fff;
  transition: transform 0.25s var(--ease);
}

.btn-arrow svg {
  width: 17px;
  height: 17px;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(2px);
}

.spinner {
  display: none;
  flex: none;
  width: 17px;
  height: 17px;
  margin-right: 10px;
  border: 2px solid rgba(10, 10, 16, 0.18);
  border-top-color: #0a0a10;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary.is-loading .btn-arrow {
  display: none;
}

.btn-primary.is-loading .spinner {
  display: block;
}

.btn-primary.is-loading {
  cursor: progress;
  opacity: 0.85;
}

/* ---------- results ---------- */

.results {
  margin-top: 76px;
  scroll-margin-top: 28px;
}

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.results-head h2 {
  margin-top: 10px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.035em;
}

.text-btn {
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 0.78rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.text-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.013));
  padding: 26px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.results:not([hidden]) .results-head {
  animation: rise 0.6s var(--ease) both;
}

.results:not([hidden]) .score-panel {
  animation: rise 0.75s var(--ease) 0.05s both;
}

.results:not([hidden]) .breakdown {
  animation: rise 0.75s var(--ease) 0.12s both;
}

.results:not([hidden]) .viewer {
  animation: rise 0.75s var(--ease) 0.2s both;
}

/* score panel */

.score-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ring-wrap {
  position: relative;
  width: 232px;
  height: 232px;
  margin: 2px auto 16px;
}

.ring-wrap::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.26), transparent 68%);
  filter: blur(18px);
  pointer-events: none;
}

.ring {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ring-ticks {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1.5;
  stroke-dasharray: 1 7;
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.065);
  stroke-width: 9;
}

.ring-value {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 578.05;
  stroke-dashoffset: 578.05;
  transform: rotate(-90deg);
  transform-origin: 110px 110px;
  filter: drop-shadow(0 0 9px rgba(129, 140, 248, 0.5));
  transition: stroke-dashoffset 1.5s var(--ease);
}

.score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.score-number {
  display: flex;
  align-items: baseline;
  font-size: 3.5rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.score-pct {
  margin-left: 2px;
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.score-caption {
  color: var(--faint);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.verdict-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.verdict-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 9px currentColor;
}

.verdict[data-tone="high"] .verdict-pill {
  border-color: rgba(45, 212, 191, 0.3);
  background: rgba(45, 212, 191, 0.1);
  color: #99f6e4;
}

.verdict[data-tone="mid"] .verdict-pill {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.1);
  color: #fcd34d;
}

.verdict[data-tone="low"] .verdict-pill {
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.1);
  color: #fda4af;
}

.verdict h3 {
  margin-top: 17px;
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.verdict p {
  max-width: 35ch;
  margin: 9px auto 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.62;
}

/* breakdown panel */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h3 {
  font-size: 0.93rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.engine-tag {
  flex: none;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--faint);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  cursor: help;
}

.metric-list {
  margin-top: 18px;
}

.metric {
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
}

.metric:first-child {
  padding-top: 2px;
  border-top: 0;
}

.metric:last-child {
  padding-bottom: 10px;
}

.metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  color: #e9e9f2;
  font-size: 0.85rem;
}

.metric-weight {
  margin-left: 9px;
  color: var(--faint);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric-val {
  color: var(--text);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.metric-bar {
  height: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.metric-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a78bfa, #818cf8 55%, #5eead4);
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.4);
  transition: width 1.35s var(--ease);
}

.insight {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 8px;
  padding: 14px 15px;
  border: 1px solid rgba(167, 139, 250, 0.16);
  border-radius: 15px;
  background: rgba(167, 139, 250, 0.065);
}

.insight svg {
  flex: none;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: #c4b5fd;
}

.insight p {
  color: #cfcfdd;
  font-size: 0.78rem;
  line-height: 1.62;
}

.demo-note {
  margin-top: 13px;
  color: var(--faint);
  font-size: 0.66rem;
  line-height: 1.55;
}

/* viewer */

.viewer {
  margin-top: 18px;
  padding: 22px 22px 24px;
}

.viewer-body {
  margin-top: 18px;
}

.view-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.view-split figure {
  min-width: 0;
}

.fig-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%) 0 9px / 18px 18px,
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.018) 75%) 9px -9px / 18px 18px,
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.018) 75%) -9px 0 / 18px 18px,
    #06060a;
}

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

.fig-letter {
  position: absolute;
  top: 11px;
  left: 11px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(8, 8, 12, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #e8e8f2;
  font-size: 0.58rem;
  font-weight: 600;
}

.view-split figcaption {
  margin-top: 9px;
  padding: 0 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.blend-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%) 0 9px / 18px 18px,
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.018) 75%) 9px -9px / 18px 18px,
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.018) 75%) -9px 0 / 18px 18px,
    #06060a;
}

.blend-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#blendImgB {
  opacity: 0.5;
  transition: opacity 0.08s linear;
}

.stage-letter {
  position: absolute;
  bottom: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(8, 8, 12, 0.74);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #e8e8f2;
  font-size: 0.6rem;
  font-weight: 600;
}

.stage-letter.is-a { left: 12px; }
.stage-letter.is-b { right: 12px; }

.blend-control {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 460px;
  margin: 15px auto 0;
  padding: 0 2px;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.blend-control input[type="range"] {
  flex: 1;
  height: 4px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.7), rgba(129, 140, 248, 0.7) 55%, rgba(94, 234, 212, 0.7));
  cursor: grab;
}

.blend-control input[type="range"]:active {
  cursor: grabbing;
}

.blend-control input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  appearance: none;
  -webkit-appearance: none;
  border: 3px solid #13131b;
  border-radius: 50%;
  background: #f4f4f8;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 4px 12px rgba(0, 0, 0, 0.55);
}

.blend-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid #13131b;
  border-radius: 50%;
  background: #f4f4f8;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 4px 12px rgba(0, 0, 0, 0.55);
}

/* segmented control */

.seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
}

.seg-btn {
  padding: 6px 13px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.is-active {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: var(--shell);
  margin: 30px auto 0;
  padding: 26px 24px 42px;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  color: var(--faint);
  font-size: 0.7rem;
}

.footer-brand {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.footer-note {
  letter-spacing: 0.01em;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 100;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #15151f;
  box-shadow: 0 22px 50px -18px rgba(0, 0, 0, 0.9);
  color: #ececf4;
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  border-color: rgba(251, 113, 133, 0.4);
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 200;
  padding: 14px 18px;
  border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: 12px;
  background: #1b1014;
  color: #fecdd3;
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- animations ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scan {
  0% {
    top: -34%;
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    top: 108%;
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 9px currentColor;
  }
  50% {
    opacity: 0.5;
    box-shadow: 0 0 3px currentColor;
  }
}

/* ---------- responsive ---------- */

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

  .swap-col {
    flex-direction: row;
    gap: 16px;
    height: 46px;
    padding: 0 22px;
  }

  .swap-line {
    flex: 1;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  }

  .swap-btn {
    width: 40px;
    height: 40px;
  }

  .swap-btn:not(:disabled):hover {
    transform: rotate(270deg);
  }

  .dropzone {
    min-height: 340px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .score-panel {
    padding-top: 34px;
    padding-bottom: 34px;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 20px 18px 6px;
  }

  .shell {
    padding: 0 18px 32px;
  }

  .hero {
    padding: 40px 0 28px;
  }

  .hero h1 {
    margin-top: 18px;
  }

  .lede {
    max-width: 42ch;
    font-size: 0.9rem;
  }

  .dropzone {
    min-height: 306px;
    padding: 13px;
    border-radius: 22px;
  }

  .slot-chip {
    top: 22px;
    left: 22px;
  }

  .dz-clear {
    top: 20px;
    right: 20px;
  }

  .dz-empty {
    padding: 52px 14px 20px;
  }

  .dz-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 15px;
  }

  .dz-name {
    max-width: 190px;
  }

  .examples {
    justify-content: flex-start;
  }

  .examples-label {
    width: 100%;
    margin-bottom: 2px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-top: 24px;
  }

  .privacy {
    justify-content: center;
    order: 2;
    text-align: center;
  }

  .btn-primary {
    width: 100%;
  }

  .results {
    margin-top: 56px;
  }

  .results-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .panel {
    padding: 20px;
    border-radius: 20px;
  }

  .ring-wrap {
    width: 210px;
    height: 210px;
  }

  .score-number {
    font-size: 3.2rem;
  }

  .viewer {
    padding: 18px;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .view-split {
    grid-template-columns: 1fr;
  }

  .fig-frame {
    aspect-ratio: 16 / 9;
  }

  .metric-weight {
    display: none;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 20px;
    padding: 22px 18px 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
