@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,500;0,600;1,500;1,600&display=swap');

:root {
  --navy: #07152f;
  --navy2: #0b1f46;
  --blue: #1e5eff;
  --cyan: #49b7ff;
  --text: #eef5ff;
  --muted: #91a4c3;
  --line: rgba(145, 164, 195, .16);
  --good: #43e0a0;
  --warn: #ffc857;
  --bad: #ff6b7a;
}

* { box-sizing: border-box; }

html { background: var(--navy); }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(30, 94, 255, .22), transparent 55%),
    radial-gradient(900px 420px at -10% 20%, rgba(73, 183, 255, .12), transparent 50%),
    var(--navy);
  min-height: 100vh;
  color: var(--text);
  font-family: 'DM Sans', Arial, Helvetica, sans-serif;
}

.topbar {
  height: 92px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 max(24px, calc((100% - 1120px) / 2));
  gap: 14px;
  background: rgba(7, 21, 47, .92);
  backdrop-filter: blur(12px);
}

.brand-logo {
  height: 70px;
  width: auto;
  max-width: 380px;
  object-fit: contain;
  background: transparent;
}

.local-pill {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 9px 13px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(11, 31, 70, .7);
}

.local-pill span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  margin-right: 7px;
  box-shadow: 0 0 8px var(--good);
}

main {
  max-width: 1120px;
  margin: auto;
  padding: 54px 24px 26px;
}

.intro {
  max-width: 640px;
  margin: 0 auto 42px;
  text-align: center;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: .2em;
  font-weight: 700;
  color: var(--cyan);
  margin: 0 0 12px;
}

.intro h1 {
  font-size: clamp(42px, 6vw, 68px);
  line-height: 1.03;
  letter-spacing: -.055em;
  margin: 0;
  font-weight: 600;
}

.intro h1 em {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 500;
  color: var(--cyan);
}

.lede {
  max-width: 500px;
  margin: 20px auto 0;
  line-height: 1.7;
  color: var(--muted);
  font-size: 14px;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.upload-card,
.settings-card,
.result-section {
  background: var(--navy2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.card-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.step {
  font-size: 11px;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(73, 183, 255, .12);
  padding: 7px 8px;
  border-radius: 6px;
}

.card-heading h2,
.settings-card h2,
.result-head h2 {
  font-size: 17px;
  margin: 1px 0 5px;
  letter-spacing: -.02em;
}

.card-heading p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.dropzone {
  height: 275px;
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  background: rgba(7, 21, 47, .55);
  border: 1px dashed rgba(73, 183, 255, .35);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--cyan);
  background: rgba(30, 94, 255, .08);
}

.dropzone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-content {
  text-align: center;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
}

.upload-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  font-size: 24px;
}

.upload-content strong { font-size: 13px; }
.upload-content span { font-size: 10px; color: var(--muted); }

.preview {
  height: 100%;
  width: 100%;
  object-fit: contain;
  padding: 10px;
}

.hidden { display: none !important; }

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  margin-top: 12px;
  padding: 3px;
  cursor: pointer;
}

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

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

.camera-actions { display: flex; align-items: center; gap: 8px; }

.capture-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(7, 21, 47, .5);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.capture-button:hover { border-color: var(--cyan); }
.camera-toggle[aria-pressed="true"] {
  border-color: rgba(73, 183, 255, .5);
  background: rgba(73, 183, 255, .12);
  color: var(--cyan);
}
.upload-actions .text-button { margin-top: 0; }
.capture-button:focus-visible,
.text-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.settings-card {
  margin-top: 18px;
  padding: 26px;
}

.settings-card > div:first-child h2 { margin: 0 0 20px; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.settings-grid label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.settings-grid select {
  display: block;
  width: 100%;
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--navy);
  padding: 12px 10px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
}

.settings-grid select:focus { border-color: var(--cyan); }

.privacy-note {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(67, 224, 160, .08);
  border: 1px solid rgba(67, 224, 160, .18);
  border-radius: 8px;
  padding: 13px 15px;
  margin: 22px 0;
}

.privacy-note > span { font-size: 22px; color: var(--good); }

.privacy-note p {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

.privacy-note strong { color: var(--text); }

.generate-button {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.generate-button:hover { filter: brightness(1.08); }
.generate-button:disabled { opacity: .6; cursor: wait; }
.generate-button b { font-size: 19px; font-weight: 400; }

.status {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  margin: 13px 0 0;
  line-height: 1.6;
}

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

.result-section {
  margin-top: 28px;
  padding: 25px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.result-head h2 { margin: 0; }

.download-button {
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 7px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.result-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.result-compare figure {
  margin: 0;
  background: rgba(7, 21, 47, .55);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.result-compare img {
  max-height: 420px;
  max-width: 100%;
  object-fit: contain;
}

.result-main img { max-height: 560px; }


.result-compare figcaption {
  margin-top: 10px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.fineprint {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin: 14px 0 0;
}

.history-count {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: .08em;
}

footer span:last-child { letter-spacing: 0; }

@media (max-width: 800px) {
  .result-compare { grid-template-columns: 1fr; }
  .result-compare img,
  .result-main img { max-height: 360px; }
}

@media (max-width: 700px) {
  main { padding: 36px 15px 22px; }
  .upload-grid { grid-template-columns: 1fr; }
  .dropzone { height: 245px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card { padding: 20px; }
  .intro { margin-bottom: 30px; }
  .result-head { align-items: flex-start; flex-direction: column; }
  .local-pill { font-size: 0; }
  .local-pill span { margin: 0; }
  .topbar { padding: 0 16px; }
  footer { flex-direction: column; }
}

/* ==================================================================== */
/* Tabs                                                                  */
/* ==================================================================== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 21, 47, .7);
}

.tabs + .local-pill { margin-left: 0; }

.tab {
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color .2s, background .2s;
}

.tab:hover { color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.tab[aria-selected="true"] {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 4px 16px rgba(30, 94, 255, .35);
}

.tab-badge {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  background: rgba(145, 164, 195, .18);
  color: var(--text);
}

.tab[aria-selected="true"] .tab-badge { background: rgba(255, 255, 255, .22); }

.view { animation: view-in .35s ease both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

form.is-busy { opacity: .55; filter: saturate(.7); transition: opacity .3s; }

/* ==================================================================== */
/* Progress card                                                         */
/* ==================================================================== */
.progress-card {
  position: relative;
  margin-top: 28px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px;
  padding: 28px;
  border-radius: 16px;
  background:
    radial-gradient(600px 220px at 100% 0%, rgba(73, 183, 255, .10), transparent 60%),
    var(--navy2);
  border: 1px solid rgba(73, 183, 255, .28);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .04);
  overflow: hidden;
  animation: view-in .4s ease both;
}

.progress-visual { position: relative; align-self: start; }

.scan-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: var(--navy);
  border: 1px solid var(--line);
}

.scan-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.55) brightness(.8);
  animation: breathe 3.2s ease-in-out infinite;
}

.scan-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(73, 183, 255, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(73, 183, 255, .10) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent);
}

.scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 38%;
  top: -38%;
  background: linear-gradient(to bottom, transparent, rgba(73, 183, 255, .28) 85%, rgba(160, 220, 255, .9) 100%);
  animation: scan 2.6s cubic-bezier(.45, 0, .55, 1) infinite;
}

.garment-chip {
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 78px;
  height: 78px;
  padding: 5px;
  border-radius: 12px;
  background: var(--navy2);
  border: 1px solid rgba(73, 183, 255, .35);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
}

.garment-chip img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

@keyframes scan { to { top: 100%; } }
@keyframes breathe { 50% { filter: saturate(.75) brightness(.92); } }

.progress-body { min-width: 0; display: flex; flex-direction: column; }

.progress-headline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.progress-headline h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -.03em;
  font-weight: 600;
}

.progress-pct {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

.progress-pct small { font-size: .45em; margin-left: 2px; color: var(--muted); }

.progress-sub {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  min-height: 1.6em;
}

.bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(7, 21, 47, .8);
  border: 1px solid var(--line);
  overflow: hidden;
}

.bar-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 18px rgba(73, 183, 255, .55);
  overflow: hidden;
}

.bar-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .45) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: sheen 1.8s ease-in-out infinite;
}

@keyframes sheen { to { transform: translateX(100%); } }

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 11px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-meta #progress-step { color: var(--text); font-weight: 600; }
.progress-meta .dot { margin: 0 7px; opacity: .6; }

.stage-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stage-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  opacity: .45;
  transition: opacity .3s;
}

.stage-list li.active,
.stage-list li.done { opacity: 1; }

.stage-list i {
  flex: none;
  position: relative;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1.5px solid rgba(145, 164, 195, .45);
}

.stage-list li.active i {
  border-color: rgba(73, 183, 255, .25);
  border-top-color: var(--cyan);
  animation: spin .9s linear infinite;
}

.stage-list li.done i {
  border-color: var(--good);
  background: var(--good);
}

.stage-list li.done i::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid var(--navy);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

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

.stage-list strong { display: block; font-size: 12px; font-weight: 600; }
.stage-list span { display: block; font-size: 10px; color: var(--muted); line-height: 1.45; margin-top: 3px; }

.progress-card.is-done { border-color: rgba(67, 224, 160, .45); }
.progress-card.is-done .bar-fill { background: linear-gradient(90deg, #22c487, var(--good)); box-shadow: 0 0 18px rgba(67, 224, 160, .5); }
.progress-card.is-done .progress-pct { color: var(--good); }
.progress-card.is-done .scan-beam,
.progress-card.is-error .scan-beam,
.progress-card.is-done .bar-sheen,
.progress-card.is-error .bar-sheen { display: none; }
.progress-card.is-error { border-color: rgba(255, 107, 122, .5); }
.progress-card.is-error .eyebrow,
.progress-card.is-error .progress-pct { color: var(--bad); }
.progress-card.is-error .bar-fill { background: var(--bad); box-shadow: none; }
.progress-card.is-error .stage-list li.active i { animation: none; border-color: var(--bad); }

/* ==================================================================== */
/* Buttons                                                               */
/* ==================================================================== */
.result-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(7, 21, 47, .5);
  color: var(--text);
  border-radius: 7px;
  padding: 10px 14px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.ghost-button:hover { border-color: var(--cyan); }

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(7, 21, 47, .5);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-button:hover:not(:disabled) { border-color: var(--cyan); }
.icon-button:disabled { opacity: .35; cursor: default; }

.generate-button.compact { width: auto; gap: 24px; height: 46px; margin-top: 8px; }

/* ==================================================================== */
/* Results tab                                                           */
/* ==================================================================== */
.results-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 0 0 30px;
}

.results-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -.05em;
  font-weight: 600;
}

.results-hero h1 em {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  color: var(--cyan);
}

.results-empty {
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed rgba(73, 183, 255, .3);
  border-radius: 16px;
  background: rgba(11, 31, 70, .5);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.results-empty h2 { margin: 16px 0 6px; font-size: 18px; }
.results-empty p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.result-card {
  border: 1px solid var(--line);
  background: var(--navy2);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  transition: transform .25s ease, border-color .25s, box-shadow .25s;
  animation: view-in .45s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.result-card:hover,
.result-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(73, 183, 255, .55);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  outline: none;
}

.result-card-media {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--navy);
  overflow: hidden;
}

.result-card-media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform .5s ease;
}

.result-card:hover .result-card-media > img { transform: scale(1.04); }

.result-card-media::after {
  content: '';
  position: absolute;
  inset: 55% 0 0;
  background: linear-gradient(to bottom, transparent, rgba(7, 21, 47, .85));
  pointer-events: none;
}

.result-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  background: rgba(7, 21, 47, .75);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.result-card-chips {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  display: flex;
  gap: 6px;
}

.result-card-chips img {
  width: 40px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1.5px solid rgba(238, 245, 255, .7);
  background: var(--navy);
}

.result-card-open {
  position: absolute;
  right: 10px;
  bottom: 12px;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .25s, transform .25s;
}

.result-card:hover .result-card-open,
.result-card:focus-visible .result-card-open { opacity: 1; transform: none; }

.result-card-meta {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-card-meta strong { font-size: 13px; font-weight: 600; }
.result-card-meta span { font-size: 11px; color: var(--muted); }

/* ==================================================================== */
/* Viewer dialog                                                         */
/* ==================================================================== */
.viewer {
  width: min(1080px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid rgba(73, 183, 255, .3);
  border-radius: 16px;
  background: var(--navy2);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  overflow: auto;
}

.viewer[open] { animation: view-in .3s ease both; }
.viewer::backdrop { background: rgba(3, 9, 22, .75); backdrop-filter: blur(4px); }

.viewer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: rgba(11, 31, 70, .96);
  border-bottom: 1px solid var(--line);
}

.viewer-head .eyebrow { margin-bottom: 6px; }
.viewer-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.viewer-actions { display: flex; gap: 8px; align-items: center; }

.viewer-body {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 18px;
  padding: 22px;
}

.viewer figure {
  margin: 0;
  background: rgba(7, 21, 47, .55);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.viewer-main img { max-width: 100%; max-height: 68vh; object-fit: contain; border-radius: 6px; }
.viewer-side { display: flex; flex-direction: column; gap: 12px; }
.viewer-side img { max-width: 100%; max-height: 180px; object-fit: contain; border-radius: 6px; }

.viewer-side figcaption {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.viewer-details { margin: 0; display: grid; gap: 1px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.viewer-details div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; background: rgba(7, 21, 47, .45); font-size: 11px; }
.viewer-details dt { color: var(--muted); }
.viewer-details dd { margin: 0; font-weight: 600; text-align: right; }

/* ==================================================================== */
/* Responsive + motion                                                   */
/* ==================================================================== */
@media (max-width: 860px) {
  .stage-list { grid-template-columns: repeat(2, 1fr); }
  .viewer-body { grid-template-columns: 1fr; }
  .viewer-side { flex-direction: row; flex-wrap: wrap; }
  .viewer-side figure { flex: 1 1 140px; }
  .viewer-details { flex: 1 1 100%; }
}

@media (max-width: 700px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px; row-gap: 10px; }
  .brand-logo { height: 52px; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .tab { flex: 1; justify-content: center; }
  .tabs + .local-pill { margin-left: auto; }
  .progress-card { grid-template-columns: 1fr; padding: 20px; gap: 22px; }
  .progress-visual { width: 150px; }
  .results-hero { flex-direction: column; align-items: flex-start; }
  .results-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .viewer-head { flex-wrap: wrap; padding: 14px 16px; }
  .viewer-body { padding: 16px; }
}

@media (max-width: 480px) {
  .topbar {
    padding: calc(8px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  }
  .brand-logo { height: 46px; max-width: min(58vw, 260px); }
  .local-pill { padding: 9px; }
  .tab { min-height: 44px; }
  .download-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  main { padding: 28px 12px calc(22px + env(safe-area-inset-bottom)); }
  .intro { margin-bottom: 24px; }
  .intro h1 { font-size: clamp(36px, 11vw, 48px); }
  .lede { font-size: 13px; }
  .upload-card,
  .settings-card,
  .result-section { padding: 16px; border-radius: 12px; }
  .dropzone { height: 220px; }
  .settings-grid select { min-height: 46px; font-size: 16px; }
  .generate-button { min-height: 48px; }
  .text-button { min-height: 44px; margin-top: 6px; }
  .capture-button { min-height: 44px; }
  .upload-actions { margin-top: 4px; }
  .privacy-note { align-items: flex-start; padding: 12px; margin: 18px 0; }
  .result-actions { width: 100%; }
  .result-actions > * { flex: 1 1 auto; text-align: center; }
  .results-hero { gap: 14px; margin-bottom: 22px; }
  .results-hero h1 { font-size: clamp(32px, 9vw, 42px); }
  .results-hero > .ghost-button { min-height: 44px; }
  .results-grid { grid-template-columns: 1fr; gap: 14px; }
  .result-card-media { aspect-ratio: 4 / 3; }
  .progress-card { padding: 16px; gap: 18px; }
  .progress-visual { width: min(150px, 55vw); }
  .progress-meta { flex-wrap: wrap; font-size: 10px; }
  .progress-meta > span:last-child { display: flex; flex-wrap: wrap; }
  .stage-list { grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
  .stage-list li { align-items: center; }
  .stage-list span { font-size: 11px; }
  .viewer {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 12px;
  }
  .viewer-head { gap: 10px; padding: 12px; }
  .viewer-actions { width: 100%; justify-content: flex-end; gap: 6px; }
  .viewer-actions .download-button { margin-right: auto; }
  .viewer-body { gap: 12px; padding: 12px; }
  .viewer-main img { max-height: 48dvh; }
  .viewer-side figure { flex-basis: 120px; }
  .viewer-side img { max-height: 130px; }
  .icon-button { width: 44px; height: 44px; }
  footer { padding-bottom: env(safe-area-inset-bottom); line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .scan-beam, .bar-sheen { display: none; }
}
