/* Congruent Optică Medicală — mobile-first */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #1a1c1b;
  --muted: #5c635f;
  --line: #e2e0da;
  --accent: #0f766e;
  --accent-dark: #0b5a54;
  --accent-soft: #d9f2ef;
  --whatsapp: #25d366;
  --whatsapp-dark: #1ebe57;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(26, 28, 27, 0.04), 0 8px 24px rgba(26, 28, 27, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 4.5rem;
  --nav-h: 4.5rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 1rem);
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.9rem 1.1rem 0.85rem;
}

.brand {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.tagline {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

/* App shell */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1.1rem 2rem;
}

.progress {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.55rem;
}

.progress-bar {
  height: 100%;
  width: 16.66%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.step-label {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step {
  display: none;
  animation: fadeIn 0.22s ease;
}

.step.is-active {
  display: block;
}

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

.step h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hint {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Choice cards (audience) */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.choice-card {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem 0.75rem;
  min-height: 6.2rem;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.choice-card:active {
  transform: scale(0.98);
}

.choice-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice-icon {
  display: block;
  font-size: 1.45rem;
  margin-bottom: 0.35rem;
  color: var(--accent);
}

.choice-title {
  display: block;
  font-weight: 650;
  font-size: 1.02rem;
}

.choice-desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Choice rows (material / style) */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.choice-row {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  min-height: 3.6rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.choice-row.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Face shape guide */
.face-guide {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.face-guide summary {
  padding: 0.85rem 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  color: var(--accent-dark);
  -webkit-tap-highlight-color: transparent;
}

.face-guide summary::-webkit-details-marker {
  display: none;
}

.face-guide summary::after {
  content: "+";
  float: right;
  font-weight: 700;
  color: var(--muted);
}

.face-guide[open] summary::after {
  content: "−";
}

.face-guide-body {
  padding: 0 1rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.face-guide-body p {
  margin: 0.75rem 0 0.4rem;
}

.face-guide-body ul {
  margin: 0;
  padding-left: 1.1rem;
}

.face-guide-body li {
  margin-bottom: 0.45rem;
}

.face-guide-body strong {
  color: var(--ink);
}

.face-guide-note {
  font-size: 0.82rem;
  font-style: italic;
}

/* Shape grid */
.shape-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (min-width: 560px) {
  .shape-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.shape-card {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.85rem 0.65rem 0.9rem;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-height: 9.5rem;
}

.shape-card:active {
  transform: scale(0.98);
}

.shape-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.shape-card svg {
  width: 100%;
  max-width: 118px;
  height: 58px;
  margin: 0 auto;
}

.shape-card .choice-title {
  font-size: 0.95rem;
}

.shape-card .choice-desc {
  font-size: 0.78rem;
  line-height: 1.3;
}

.selection-hint {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.selection-hint.is-error {
  color: var(--danger);
  font-weight: 600;
}

/* Swatches */
.swatch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (min-width: 520px) {
  .swatch-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.swatch {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  min-height: 3.4rem;
  text-align: left;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.swatch.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.swatch-dot {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.swatch-dot.is-neutral {
  background: repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 50% / 10px 10px;
}

.swatch-label {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
}

/* Optional fields */
.optional-fields {
  margin-top: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field-label em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
}

.field input,
.field textarea {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: var(--surface);
  resize: vertical;
  min-height: 3rem;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Summary */
.summary {
  margin: 0 0 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.summary > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.35rem 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.summary > div:last-child {
  border-bottom: none;
}

.summary dt {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary dd {
  margin: 0;
  font-weight: 600;
  font-size: 0.98rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
  margin-bottom: 0.65rem;
}

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

.btn-call {
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--line);
  margin-bottom: 1.1rem;
}

.wa-preview-label {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.wa-preview {
  margin: 0;
  padding: 0.85rem 0.95rem;
  background: #eef7f5;
  border: 1px dashed #9ecbc4;
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink);
}

/* Bottom nav */
.nav-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.65rem;
  padding: 0.75rem 1.1rem calc(0.75rem + var(--safe-b));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

.nav-bar.is-summary {
  grid-template-columns: 1fr;
}

.nav-bar.is-summary #btnNext {
  display: none;
}

/* Footer */
.site-footer {
  max-width: 720px;
  margin: 0.5rem auto 0;
  padding: 1.25rem 1.1rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0.2rem 0;
}

.site-footer strong {
  color: var(--ink);
}

.footer-tiktok {
  margin-top: 0.45rem !important;
}

/* Catalog (future) */
.catalog {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.catalog h2 {
  margin: 0 0 0.85rem;
  font-size: 1.2rem;
}

.catalog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (min-width: 800px) {
  .header-inner,
  .app,
  .site-footer {
    max-width: 860px;
  }

  .shape-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .swatch-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ===== Live preview ===== */
.live-preview {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.85rem 1rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow);
}

.live-preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 0.5rem 0.25rem;
  background: linear-gradient(180deg, #fbfaf7 0%, #f0eeea 100%);
  border-radius: 12px;
  color: #1a1a1a;
}

.live-preview-stage svg {
  width: min(100%, 320px);
  height: auto;
  max-height: 150px;
}

.live-preview-caption {
  margin: 0.55rem 0 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

.tryon-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

@media (min-width: 480px) {
  .tryon-actions {
    grid-template-columns: 1.3fr 1fr;
  }
}

.privacy-note,
.disclaimer-note {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
}

.disclaimer-note {
  font-style: italic;
}

/* ===== Try-on overlay ===== */
.tryon-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 20, 18, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.tryon-overlay[hidden] {
  display: none !important;
}

.tryon-panel {
  width: 100%;
  max-width: 560px;
  max-height: 96vh;
  overflow: auto;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  padding: 0.85rem 0.9rem calc(1rem + var(--safe-b));
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
}

@media (min-width: 700px) {
  .tryon-overlay {
    align-items: center;
    padding: 1rem;
  }
  .tryon-panel {
    border-radius: 18px;
    max-height: 90vh;
  }
}

.tryon-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.tryon-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.tryon-close {
  appearance: none;
  border: none;
  background: var(--line);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
}

.tryon-stage {
  position: relative;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 52vh;
}

.tryon-stage video,
.tryon-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tryon-stage canvas {
  z-index: 2;
}

.tryon-status {
  margin: 0.55rem 0 0;
  min-height: 1.2em;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

.tryon-status.is-error {
  color: var(--danger);
  font-weight: 600;
}

.tryon-chips-block {
  margin: 0.75rem 0 0.85rem;
}

.chips-label {
  margin: 0.45rem 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.tryon-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -webkit-overflow-scrolling: touch;
}

.tryon-chip {
  appearance: none;
  flex: 0 0 auto;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tryon-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

body.tryon-open {
  overflow: hidden;
}

body.tryon-open .nav-bar {
  display: none;
}

.shape-icon {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-bottom: 0.2rem;
}
.shape-icon canvas {
  max-height: 58px;
  width: auto !important;
  max-width: 100%;
  margin: 0 auto;
}
.live-preview-stage canvas {
  max-height: 150px;
}
