:root {
  color-scheme: light;
  --ink: #102231;
  --ink-soft: #405563;
  --muted: #687b87;
  --background: linear-gradient(145deg, #eaf4fa 0%, #f7fafc 44%, #ffffff 100%);
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --line: #cfdee6;
  --line-strong: #a9c2cf;
  --blue: #087cb8;
  --blue-dark: #075985;
  --blue-soft: #e6f4fa;
  --green: #167a3c;
  --green-soft: #eaf7ef;
  --gold: #9a681c;
  --gold-soft: #fff7df;
  --red: #b42318;
  --red-soft: #fff0ef;
  --shadow: 0 10px 30px rgba(30, 70, 91, 0.07);
  --shadow-soft: 0 6px 18px rgba(30, 70, 91, 0.06);
  --radius-large: 22px;
  --radius: 14px;
  --header-height: 76px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--background);
  background-attachment: fixed;
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a,
input,
canvas {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 3px solid rgba(8, 124, 184, 0.38);
  outline-offset: 3px;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

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

h1,
h2,
h3 {
  text-wrap: balance;
}

[tabindex="-1"]:focus {
  outline: none;
}

p {
  text-wrap: pretty;
}

.app-shell {
  width: min(100%, 1280px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 52px) 40px;
}

.flow-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(104px, 1fr) auto minmax(104px, 1fr);
  align-items: center;
  min-height: var(--header-height);
  gap: 18px;
}

.brand {
  position: absolute;
  left: 50%;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  transform: translateX(-50%);
  white-space: nowrap;
}

.detekt-wordmark {
  white-space: nowrap;
}

.registered-mark {
  position: relative;
  top: -0.42em;
  margin-left: 0.04em;
  font-size: 0.5em;
  font-weight: 650;
  line-height: 0;
  letter-spacing: 0;
  vertical-align: baseline;
}

.header-action {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.header-action:hover {
  background: var(--blue-soft);
  color: var(--ink);
}

.back-action {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  width: 48px;
  padding: 0;
  font-size: 25px;
}

.start-over-action {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  padding: 0 16px;
}

.debug-ledger-link {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--ink-soft);
  text-decoration: none;
}

.debug-ledger-link:not(.hidden) + .start-over-action:not(.hidden) {
  transform: translateX(-104px);
}

.progress-dots {
  position: absolute;
  top: calc(100% - 2px);
  left: 50%;
  display: flex;
  transform: translateX(-50%);
  gap: 7px;
}

.progress-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #c7d6dd;
  transition: width 180ms ease, background-color 180ms ease;
}

.progress-dot.complete {
  background: #77adc5;
}

.progress-dot.current {
  width: 16px;
  background: var(--blue);
}

.flow-view {
  animation: view-enter 420ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

#step-welcome {
  position: relative;
}

.step-reveal {
  opacity: 0;
  filter: blur(5px);
  pointer-events: none;
  transform: translateY(12px);
  animation: step-reveal 760ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
  animation-delay: calc(100ms + (var(--reveal-order) * 160ms));
}

.reveal-1 { --reveal-order: 0; }
.reveal-2 { --reveal-order: 1; }
.reveal-3 { --reveal-order: 2; }
.reveal-4 { --reveal-order: 3; }
.reveal-5 { --reveal-order: 4; }
.reveal-6 { --reveal-order: 5; }

.flow-step,
.status-view {
  display: grid;
  align-items: center;
  min-height: calc(100vh - var(--header-height) - 48px);
  padding: clamp(28px, 6vh, 68px) 0;
}

.step-content {
  width: 100%;
  margin: 0 auto;
}

.step-content-narrow {
  max-width: 560px;
  text-align: center;
}

.step-content-medium {
  max-width: 660px;
  text-align: center;
}

.outcome-content .primary-action,
.outcome-content .secondary-action {
  width: min(100%, 440px);
  margin-right: auto;
  margin-left: auto;
}

.outcome-content .secondary-action {
  margin-top: 12px;
}

.success-symbol {
  border-color: #a9d9b8;
  background: #edf8f0;
  color: #157a3c;
}

.welcome-content h1 {
  margin-bottom: 20px;
  font-size: clamp(46px, 7vw, 76px);
  font-weight: 600;
}

.welcome-content > .primary-action {
  width: min(100%, 400px);
  min-height: 56px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  animation: welcome-cta 440ms cubic-bezier(0.2, 0.75, 0.25, 1) 1280ms forwards;
}

.welcome-support-link {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 400px);
  gap: 7px;
  margin: 14px auto 0;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  cursor: pointer;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  animation: welcome-context 380ms ease 1580ms forwards;
}

.welcome-support-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.welcome-support-link:focus-visible {
  border-radius: 8px;
  outline: 3px solid rgba(13, 134, 190, 0.28);
  outline-offset: 4px;
}

.welcome-word {
  display: inline-flex;
  justify-content: center;
}

.welcome-word > span {
  display: inline-block;
  opacity: 0;
  filter: blur(7px);
  transform: translateY(16px) scale(0.97);
  animation: welcome-letter 540ms cubic-bezier(0.16, 0.84, 0.24, 1) forwards;
  animation-delay: calc(var(--letter-index) * 32ms);
}

.welcome-context {
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  animation: welcome-context 380ms ease 940ms forwards;
}

.welcome-acronym {
  margin-bottom: 8px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.045em;
  line-height: 1.4;
  text-transform: uppercase;
}

.welcome-intro {
  max-width: 430px;
  margin: 0 auto 30px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.5;
}

.cta-arrow {
  display: inline-block;
  margin-left: 8px;
  transition: transform 180ms ease;
}

.primary-action:hover .cta-arrow {
  transform: translateX(3px);
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.flow-step h1,
.status-view h1,
.report-header h1 {
  margin-bottom: 16px;
  font-size: clamp(38px, 4.6vw, 56px);
  font-weight: 650;
  letter-spacing: -0.042em;
  line-height: 1.06;
}

.step-intro,
.status-content > p:not(.eyebrow) {
  max-width: 580px;
  margin: 0 auto 28px;
  color: var(--ink-soft);
  font-size: clamp(17px, 1.7vw, 19px);
  line-height: 1.5;
}

.field-group {
  margin: 30px 0 18px;
  text-align: left;
}

.field-group label {
  display: block;
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 650;
}

input[type="email"] {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  padding: 13px 17px;
  color: var(--ink);
  font-size: 17px;
}

input[type="email"]::placeholder {
  color: #8798a2;
}

input[type="email"].field-invalid {
  border-color: var(--red);
  background: var(--red-soft);
}

.field-message {
  min-height: 18px;
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.field-message.error,
.form-error {
  color: var(--red);
}

.form-error {
  min-height: 22px;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.crop-status-container {
  margin: 0 0 20px;
}

.crop-status-container .form-error {
  margin: 0;
}

.crop-status-container.crop-warning {
  padding: 12px 14px;
  border: 1px solid rgba(179, 53, 53, 0.35);
  border-radius: 14px;
  background: var(--red-soft);
}

.crop-status-container.crop-warning .form-error {
  color: #8b2424;
  font-weight: 800;
  line-height: 1.45;
}

.crop-retry-actions {
  margin-top: 14px;
  text-align: center;
}

.crop-retry-actions p {
  margin: 0 0 12px;
  color: #8b2424;
  line-height: 1.45;
}

.primary-action,
.secondary-action,
.danger-action,
.quiet-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  border-radius: 12px;
  padding: 13px 22px;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.primary-action {
  border: 1px solid #066a9e;
  background: var(--blue);
  color: #fff;
  box-shadow: none;
  transition: background-color 180ms ease, transform 180ms ease;
}

.primary-action:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.primary-action:active {
  transform: translateY(0);
}

.secondary-action,
.quiet-action {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--blue-dark);
  box-shadow: none;
}

.secondary-action:hover,
.quiet-action:hover {
  border-color: #7baabd;
  background: var(--surface-solid);
}

.danger-action {
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
}

.privacy-note,
.legal-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.legal-note .text-link {
  font-weight: inherit;
}

.privacy-note {
  max-width: 500px;
  margin: 16px auto 5px;
}

.legal-note {
  max-width: 500px;
  margin-right: auto;
  margin-bottom: 0;
  margin-left: auto;
}

#email-disclosure {
  margin-top: 28px;
}

.step-content > .primary-action {
  display: flex;
  width: min(100%, 360px);
  margin-right: auto;
  margin-left: auto;
}

#step-welcome .primary-action {
  width: min(100%, 400px);
}

.text-link {
  display: inline;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: rgba(7, 89, 133, 0.35);
  text-underline-offset: 3px;
}

.analysis-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 440px);
  margin: 28px auto 22px;
  border: 0;
  background: transparent;
  padding: 0;
}

.analysis-card {
  position: relative;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: none;
  text-align: center;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.analysis-card:hover {
  border-color: #91bbcd;
  background: #fff;
}

.analysis-card:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
  box-shadow: none;
}

.analysis-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.analysis-card:has(input:focus-visible) {
  outline: 3px solid rgba(8, 124, 184, 0.38);
  outline-offset: 3px;
}

.analysis-card-copy {
  display: block;
}

.analysis-card-copy strong {
  font-size: 18px;
  letter-spacing: -0.025em;
}

.photo-example {
  overflow: hidden;
  width: min(100%, 460px);
  margin: 22px auto 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.photo-example img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

.photo-example figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.photo-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 460px);
  margin: 0 auto;
}

.desktop-copy {
  display: none;
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.status-content {
  display: grid;
  justify-items: center;
}

.activity-indicator {
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  border: 4px solid rgba(8, 124, 184, 0.16);
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: activity-spin 900ms linear infinite;
}

.status-symbol {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 30px;
  font-weight: 800;
}

.status-content .primary-action,
.status-content .secondary-action {
  max-width: 440px;
}

.status-content .secondary-action {
  margin-top: 12px;
}

.localization-warning-content .status-symbol {
  margin-bottom: 18px;
}

.localization-warning-content .primary-action {
  margin-top: 8px;
}

.attempt-note,
.analysis-reference {
  color: var(--muted);
  font-size: 13px;
}

.debug-panel {
  margin: 22px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.debug-panel summary {
  cursor: pointer;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 700;
}

.debug-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.debug-panel pre {
  overflow: auto;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.contact-symbol {
  background: var(--green-soft);
  color: var(--green);
}

.crop-step-content {
  max-width: 1120px;
}

.crop-heading {
  display: block;
  max-width: 760px;
  margin: 0 auto 20px;
  text-align: center;
}

.crop-heading h1 {
  margin-bottom: 0;
}

.crop-heading > p {
  margin: 12px auto 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.5;
}

.crop-border-guidance {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto 18px;
  padding: 14px 16px;
  border: 1px solid #c7dce9;
  border-radius: 16px;
  background: rgba(236, 247, 253, 0.82);
  color: var(--ink-soft);
}

.crop-border-guidance-icon {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.crop-border-guidance p {
  margin: 1px 0 0;
  font-size: 14px;
  line-height: 1.45;
}

.crop-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 14px 0 2px;
}

.crop-toolbar .quiet-action {
  width: auto;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  padding: 8px 4px;
  text-decoration: underline;
  text-decoration-color: rgba(7, 89, 133, 0.28);
  text-underline-offset: 3px;
}

.crop-submit {
  max-width: 540px;
  margin: 0 auto;
}

.results-view {
  padding: 34px 0 72px;
}

.results-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.report {
  padding: 0;
}

.report-header {
  margin-bottom: 28px;
}

.report-header h1 {
  margin-bottom: 12px;
  font-size: clamp(38px, 5vw, 64px);
}

.result-complete {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: -3px 0 14px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.result-complete span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink-soft);
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.report-header > p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 18px;
}

.result-preview {
  margin: 0 0 30px;
}

.result-preview img {
  display: block;
  width: 100%;
  max-height: 360px;
  border-radius: 18px;
  object-fit: contain;
  background: #eaf1f4;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 22px;
}

.result-card,
.bacteria-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 24px;
}

.result-card.strong,
.result-card.suggested {
  border-color: var(--line);
  background: #fff;
}

.result-card.likely,
.result-card.alternative {
  border-color: var(--line);
  background: #fff;
}

.result-card.additional {
  border-color: var(--line);
  background: #fff;
}

.bacteria-heading > span {
  display: inline-flex;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--blue);
  padding: 7px 11px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-card .result-match-label {
  /* Every result card reads with the same visual weight regardless of
     match confidence (strong/likely/suggested/tentative) — only the label
     text itself ("Strong match", "Probable match", "Possible additional
     growth", etc.) conveys confidence. This is intentional: a lower-
     confidence card should still read as an honest, taken-seriously
     finding, not a visually de-emphasized afterthought. */
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-card.tentative {
  border-color: var(--line);
  background: #fff;
}

.result-card h2,
.bacteria-card h2 {
  margin-bottom: 10px;
  font-size: clamp(25px, 3vw, 36px);
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.result-reference-preview {
  margin: 0 0 20px;
}

.result-reference-preview > h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-reference-preview .reference-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.result-reference-preview .reference-card {
  border-radius: 10px;
}

.result-reference-preview .reference-card img,
.result-reference-preview .reference-placeholder {
  height: 118px;
}

.result-card p,
.detail-list p,
.bacteria-card p {
  color: var(--ink-soft);
  line-height: 1.55;
}

.result-caution {
  margin: 16px 0 4px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-soft);
}

.result-caution strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.result-caution p {
  margin: 0;
  color: #64502a;
  font-size: 14px;
}

.crop-sensitive-lead {
  width: 100%;
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  text-align: left;
}

.crop-sensitive-lead > p {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crop-sensitive-lead h2 { margin: 0 0 8px; font-size: 28px; }
.crop-sensitive-lead > span { color: var(--ink-soft); line-height: 1.5; }
.crop-sensitive-lead details { margin-top: 14px; }
.crop-sensitive-lead summary { color: var(--blue-dark); font-weight: 750; cursor: pointer; }
.crop-sensitive-lead .reference-strip { margin-top: 12px; }

.result-disclaimer {
  margin: 12px 0 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tentative-colonies {
  margin-top: 18px;
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink-soft);
  line-height: 1.5;
}

.debug-result-feedback {
  margin-top: 24px;
  padding: 18px;
  border: 1px dashed rgba(8, 124, 184, 0.45);
  border-radius: 14px;
  background: rgba(238, 247, 252, 0.7);
}

.debug-result-feedback label {
  display: block;
  font-weight: 750;
}

.debug-result-feedback textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
}

.debug-result-feedback span {
  margin-left: 10px;
  color: var(--green);
  font-size: 14px;
}

.result-spray-ad {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  margin: 0 0 26px;
  border: 1px solid rgba(8, 124, 184, 0.38);
  border-radius: var(--radius);
  background: var(--ink);
  padding: clamp(22px, 3vw, 32px);
  box-shadow: var(--shadow-soft);
}

.result-spray-ad > div > span {
  display: block;
  margin-bottom: 8px;
  color: #8cdbad;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-spray-ad h2 {
  margin-bottom: 10px;
  color: #fff;
  font-size: clamp(25px, 3vw, 36px);
  letter-spacing: -0.035em;
}

.result-spray-ad p {
  margin-bottom: 0;
  color: #d7e5eb;
  line-height: 1.55;
}

.result-spray-ad a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 15px;
  background: var(--blue);
  padding: 13px 18px;
  color: #fff;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.result-spray-ad a:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.result-shop {
  display: grid;
  gap: 34px;
  margin-bottom: 30px;
}

.product-collection {
  display: grid;
  gap: 18px;
}

.product-collection-heading > p {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-collection-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -0.035em;
}

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

.product-card {
  position: relative;
  display: flex;
  min-height: 196px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 22px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.product-card:hover {
  border-color: rgba(8, 124, 184, 0.48);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.product-card h3 {
  margin: 0 0 10px;
  color: var(--blue-dark);
  font-size: 19px;
  line-height: 1.25;
}

.product-card p {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.product-card > span:last-child {
  margin-top: auto;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 800;
}

.product-badge {
  align-self: flex-start;
  margin-bottom: 10px;
  border-radius: 999px;
  background: #e8f7ee;
  padding: 4px 8px;
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-collection-secondary {
  border-top: 1px solid var(--line);
  padding-top: 30px;
}

.bacteria-beta {
  margin-bottom: 26px;
}

.bacteria-card.minimal,
.bacteria-card.low,
.bacteria-card.moderate,
.bacteria-card.high,
.bacteria-card.very-high {
  border-color: var(--line);
  background: #fff;
}

.bacteria-gradient {
  margin: 32px 0 20px;
}

.gradient-track {
  position: relative;
  height: 24px;
  border: 1px solid rgba(16, 34, 49, 0.12);
  border-radius: 999px;
  background: linear-gradient(90deg, #12843c 0%, #63b63c 24%, #f0c539 50%, #ed7b2f 74%, #b91c1c 100%);
}

.gradient-marker {
  position: absolute;
  top: -18px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-right: 11px solid transparent;
  border-left: 11px solid transparent;
  border-top: 17px solid var(--ink);
}

.gradient-labels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.gradient-labels span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.gradient-labels span.current {
  color: var(--ink);
}

.bacteria-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.bacteria-info-grid section,
.detail-list section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.bacteria-info-grid h3,
.detail-list h3 {
  margin-bottom: 8px;
  color: var(--blue-dark);
  font-size: 16px;
  text-transform: uppercase;
}

.bacteria-coliform-warning {
  margin-top: 20px;
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  padding: 16px 18px;
}

.bacteria-coliform-warning strong {
  display: block;
  margin-bottom: 6px;
  color: #7a531b;
}

.bacteria-coliform-warning p {
  margin-bottom: 0;
  font-size: 14px;
}

.coliform-reference-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.coliform-reference-images figure {
  margin: 0;
}

.coliform-reference-images img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
}

.coliform-reference-images figure:first-child img {
  object-position: 50% 52%;
}

.coliform-reference-images figure:last-child img {
  object-position: 52% 48%;
}

.coliform-reference-images figcaption {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 12px;
}

.detail-list {
  display: grid;
  gap: 18px;
}

.result-details {
  margin: 20px -24px -24px;
  border-top: 1px solid var(--line);
}

.result-details summary {
  padding: 18px 24px;
  color: var(--blue-dark);
  cursor: pointer;
  font-weight: 800;
}

.result-details-content {
  border-top: 1px solid var(--line);
  padding: 24px;
}

.result-details-content > h3 {
  margin-top: 24px;
}

.next-step {
  margin: 18px 0;
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  background: #f7fbfd;
  padding: 15px 17px;
  color: var(--ink-soft);
  line-height: 1.5;
}

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

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

.reference-card img,
.reference-placeholder {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: contain;
}

.reference-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.liability {
  margin: 20px auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.result-actions {
  display: grid;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

.result-actions a {
  text-decoration: none;
}

.result-email-fallback {
  max-width: 420px;
  margin: 14px auto 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-solid);
  padding: 14px 16px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.result-email-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin-top: 8px;
}

.result-email-copy-text {
  width: 100%;
  min-height: 180px;
  margin-top: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px;
  color: var(--ink);
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: left;
  resize: vertical;
}

.app-dialog {
  width: min(92vw, 620px);
  max-height: min(86vh, 780px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(16, 34, 49, 0.3);
}

.app-dialog::backdrop {
  background: rgba(12, 31, 42, 0.52);
  backdrop-filter: blur(5px);
}

.dialog-content {
  position: relative;
  padding: clamp(24px, 5vw, 42px);
}

.dialog-content h2 {
  margin-bottom: 14px;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.04em;
}

.dialog-content p {
  color: var(--ink-soft);
  line-height: 1.58;
}

.dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.dialog-close {
  position: absolute;
  top: 15px;
  right: 15px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #edf3f6;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 28px;
}

.legal-dialog {
  width: min(92vw, 760px);
}

.dialog-content .legal-updated {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.legal-section {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.legal-section h3 {
  margin-bottom: 9px;
  font-size: 18px;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section a {
  color: var(--blue-dark);
  font-weight: 700;
}

.legal-emphasis p {
  font-size: 13px;
}

.legal-dialog .primary-action[data-dialog-close] {
  margin-top: 30px;
}

.customer-care-dialog {
  width: min(92vw, 560px);
}

.customer-care-action {
  margin-top: 26px;
  text-decoration: none;
}

.dialog-content .customer-care-email {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.crop-example-image {
  display: block;
  width: min(100%, 460px);
  max-height: 560px;
  margin: 22px auto;
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--line), 0 14px 34px rgba(30, 70, 91, 0.14);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes step-reveal {
  to {
    opacity: 1;
    filter: blur(0);
    pointer-events: auto;
    transform: translateY(0);
  }
}

@keyframes welcome-letter {
  60% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(-2px) scale(1.01);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

@keyframes welcome-cta {
  to {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
}

@keyframes welcome-context {
  to {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (min-width: 761px) {
  .camera-action,
  .mobile-copy {
    display: none;
  }

  .desktop-copy {
    display: inline;
  }

  .photo-actions {
    grid-template-columns: 1fr;
  }

  .photo-actions .secondary-action {
    border-color: #066a9e;
    background: var(--blue);
    color: #fff;
  }

  .photo-actions .secondary-action:hover {
    background: var(--blue-dark);
  }
}

@media (max-width: 920px) {
  .result-cards,
  .reference-strip,
  .bacteria-info-grid {
    grid-template-columns: 1fr;
  }

  .coliform-reference-images {
    grid-template-columns: 1fr;
  }

  .result-spray-ad {
    grid-template-columns: 1fr;
  }

  .result-spray-ad a {
    width: 100%;
  }

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

  .product-card {
    min-height: 0;
  }

  .crop-heading {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 68px;
  }

  .app-shell {
    padding-right: 16px;
    padding-left: 16px;
  }

  .flow-header {
    grid-template-columns: minmax(82px, 1fr) auto minmax(82px, 1fr);
    gap: 8px;
  }

  .brand {
    font-size: 12px;
  }

  .start-over-action {
    padding: 0 8px;
    font-size: 13px;
  }

  .flow-step,
  .status-view {
    align-items: start;
    min-height: calc(100vh - var(--header-height));
    padding: clamp(28px, 5vh, 48px) 0 40px;
  }

  #step-welcome {
    align-items: center;
    padding-top: 0;
    padding-bottom: var(--header-height);
  }

  .flow-step h1,
  .status-view h1 {
    font-size: clamp(34px, 10vw, 44px);
  }

  .welcome-content h1 {
    font-size: clamp(42px, 12vw, 58px);
  }

  .step-intro,
  .status-content > p:not(.eyebrow) {
    font-size: 17px;
  }

  .analysis-card {
    min-height: 56px;
    padding: 11px 12px;
  }

  .photo-actions,
  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .crop-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
  }

  .crop-toolbar .quiet-action {
    width: auto;
  }

  #choose-different-photo {
    flex-basis: 100%;
  }

  .result-preview {
    grid-template-columns: 1fr;
  }

  .result-preview img {
    max-height: 300px;
  }

  .gradient-labels {
    gap: 3px;
  }

  .gradient-labels span {
    font-size: 9px;
  }

  .dialog-actions .danger-action {
    order: -1;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .flow-step h1,
  .status-view h1 {
    font-size: 36px;
  }

  .welcome-content h1 {
    font-size: 44px;
  }

  .welcome-acronym {
    font-size: 11px;
  }

  .welcome-intro {
    max-width: 330px;
    font-size: 16px;
  }

}

@media (max-width: 360px) {
  .brand {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .welcome-word > span {
    animation: none !important;
    opacity: 1;
    filter: none;
    transform: none;
  }

  .welcome-content > .primary-action,
  .welcome-support-link {
    animation: none !important;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .welcome-context {
    animation: none !important;
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  .step-reveal {
    animation: none !important;
    opacity: 1;
    filter: none;
    pointer-events: auto;
    transform: none;
  }
}

/*
 * When embedded in an iframe (see index.html), 100vh resolves to the
 * iframe's own height. The embedded app reports its body's natural height
 * to the Shopify host. Any vh-based min-height would make that measurement
 * depend on the current iframe height and create a resize feedback loop.
 */
html.detekt-embedded body,
html.detekt-embedded .app-shell,
html.detekt-embedded .flow-step,
html.detekt-embedded .status-view {
  min-height: 0;
}
