/* Medição de DP pela câmera. Tudo escopado em .mdp para não vazar no app. */
.mdp {
  --mdp-bg: #eef2f1;
  --mdp-surface: #ffffff;
  --mdp-text: #16302e;
  --mdp-muted: #5b6f6c;
  --mdp-line: #d5dedc;
  --mdp-primary: #146b73;
  --mdp-primary-hover: #0f5960;
  --mdp-primary-soft: #e3f0f0;
  --mdp-guide: #f2c230;
  --mdp-ok: #2fbf71;
  --mdp-warn-bg: #fff6e0;
  --mdp-warn: #8a5a00;
  --mdp-danger: #b3261e;
  --mdp-radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--mdp-text);
  -webkit-font-smoothing: antialiased;
}
.mdp *, .mdp *::before, .mdp *::after { box-sizing: border-box; }

/* Modal da loja */
.mdp-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 28, 27, 0.55);
  padding: 16px;
}
.mdp-panel {
  position: relative;
  width: 100%; max-width: 430px;
  height: min(880px, calc(100dvh - 32px));
  background: var(--mdp-bg);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mdp-page .mdp-panel {
  height: 100dvh; max-width: 480px; margin: 0 auto;
  border-radius: 0; box-shadow: none;
}
@media (max-width: 560px) {
  .mdp-overlay { padding: 0; }
  .mdp-panel { height: 100dvh; max-width: none; border-radius: 0; }
}

.mdp-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 16px 18px 6px;
  flex: none;
}
.mdp-brand { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; min-width: 0; }
.mdp-brand img { height: 26px; width: auto; border-radius: 6px; }
.mdp-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mdp-brand strong { font-weight: 700; }
.mdp-header-actions { display: flex; align-items: center; gap: 6px; }
.mdp-chip-btn {
  border: 1px solid var(--mdp-line); background: var(--mdp-surface); color: var(--mdp-text);
  border-radius: 999px; padding: 6px 12px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.mdp-chip-btn[aria-pressed="false"] { color: var(--mdp-muted); }
.mdp-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--mdp-line); background: var(--mdp-surface); color: var(--mdp-text);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}

.mdp-body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.mdp-body:focus { outline: none; }
/* O corpo rola; os blocos nunca encolhem para caber. */
.mdp-body > * { flex-shrink: 0; }

.mdp h2 { font-size: 1.55rem; line-height: 1.15; margin: 4px 0 0; font-weight: 750; letter-spacing: -0.01em; }
.mdp h3 { font-size: 1.15rem; margin: 2px 0 0; font-weight: 700; }
.mdp p { margin: 0; }
.mdp-lead { color: var(--mdp-muted); font-size: 0.9rem; line-height: 1.45; }
.mdp-client { font-size: 0.8rem; color: var(--mdp-primary); font-weight: 600; }

.mdp-steps { list-style: none; margin: 0; padding: 0; }
.mdp-steps li {
  display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start;
  padding: 12px 0; border-top: 1px solid var(--mdp-line);
  font-size: 0.9rem; line-height: 1.4;
}
.mdp-steps li:last-child { border-bottom: 1px solid var(--mdp-line); }
.mdp-step-num {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--mdp-primary); color: var(--mdp-primary);
  display: grid; place-items: center; font-size: 0.78rem; font-weight: 700;
}
.mdp-privacy { font-size: 0.78rem; color: var(--mdp-muted); display: flex; gap: 8px; align-items: flex-start; }
.mdp-privacy::before { content: "🔒"; }

.mdp-btn {
  display: block; width: 100%;
  border-radius: 10px; padding: 13px 16px;
  font-size: 0.95rem; font-weight: 650; font-family: inherit;
  cursor: pointer; text-align: center;
  border: 1px solid var(--mdp-line); background: var(--mdp-surface); color: var(--mdp-primary);
  transition: background 0.15s;
}
.mdp-btn:hover { background: var(--mdp-primary-soft); }
.mdp-btn-primary { background: var(--mdp-primary); border-color: var(--mdp-primary); color: #fff; }
.mdp-btn-primary:hover { background: var(--mdp-primary-hover); }
.mdp-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.mdp-btn:focus-visible, .mdp-link:focus-visible, .mdp-chip-btn:focus-visible, .mdp-nudge:focus-visible, .mdp-close:focus-visible {
  outline: 3px solid var(--mdp-guide); outline-offset: 2px;
}
.mdp-link {
  background: none; border: none; color: var(--mdp-primary); text-decoration: underline;
  font-weight: 600; font-size: 0.88rem; cursor: pointer; font-family: inherit; padding: 4px;
  text-align: center; line-height: 1.4;
}
.mdp-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 4px; }

.mdp-alert {
  border-radius: 10px; padding: 10px 12px; font-size: 0.83rem; line-height: 1.45;
  background: var(--mdp-warn-bg); color: var(--mdp-warn);
}
.mdp-alert-error { background: #fdecea; color: var(--mdp-danger); }
.mdp-alert ul { margin: 4px 0 0; padding-left: 18px; }

/* Captura */
.mdp-stage {
  position: relative; width: 100%;
  aspect-ratio: 3 / 4; max-height: 58dvh;
  border-radius: 16px; overflow: hidden;
  background: #1c2a29;
  flex: none;
}
.mdp-stage video, .mdp-stage canvas.mdp-overlay-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);
}
.mdp-countdown {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 7rem; font-weight: 800; color: var(--mdp-guide);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.mdp-stage-msg {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: #fff; font-weight: 600; padding: 24px; background: rgba(20, 40, 38, 0.55);
}
.mdp-spinner {
  width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: #fff;
  animation: mdp-spin 0.9s linear infinite;
}
@keyframes mdp-spin { to { transform: rotate(360deg); } }
.mdp-progress { height: 6px; border-radius: 99px; background: var(--mdp-line); overflow: hidden; flex: none; }
.mdp-progress > div { height: 100%; width: 0; background: var(--mdp-primary); transition: width 0.12s linear; }
.mdp-hint { text-align: center; font-size: 0.82rem; color: var(--mdp-muted); line-height: 1.4; margin-top: -6px; }
.mdp-caption {
  text-align: center; font-weight: 650; font-size: 1rem; line-height: 1.4; min-height: 2.8em;
}

/* Ajuste das bordas */
.mdp-crop-wrap { position: relative; width: 100%; border-radius: 12px; overflow: hidden; background: #000; flex: none; }
.mdp-crop { display: block; width: 100%; touch-action: none; cursor: ew-resize; }
.mdp-loupe {
  position: absolute; top: 8px; width: 96px; height: 96px; border-radius: 50%;
  border: 3px solid var(--mdp-guide); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: none; background: #000;
}
.mdp-nudge-row { display: grid; grid-template-columns: 44px 1fr 44px; gap: 10px; align-items: center; }
.mdp-nudge {
  height: 44px; border-radius: 10px; border: 1px solid var(--mdp-line);
  background: var(--mdp-surface); font-size: 1.2rem; cursor: pointer; color: var(--mdp-text);
}
.mdp-nudge-info { text-align: center; font-size: 0.82rem; color: var(--mdp-muted); line-height: 1.35; }
.mdp-line-toggle { display: flex; gap: 8px; justify-content: center; }
.mdp-line-toggle button[aria-pressed="true"] { background: var(--mdp-primary); color: #fff; border-color: var(--mdp-primary); }

/* Resultado */
.mdp-dp-big { font-size: 3.6rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.mdp-dp-big small { font-size: 1rem; font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.mdp-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--mdp-surface); border: 1px solid var(--mdp-line); border-radius: var(--mdp-radius);
  overflow: hidden;
}
.mdp-grid > div { padding: 12px 14px; border-bottom: 1px solid var(--mdp-line); }
.mdp-grid > div:nth-child(odd) { border-right: 1px solid var(--mdp-line); }
.mdp-grid > div:nth-last-child(-n+2) { border-bottom: none; }
.mdp-grid strong { display: block; font-size: 1.08rem; }
.mdp-grid span { font-size: 0.75rem; color: var(--mdp-muted); }
.mdp-ruler {
  background: var(--mdp-surface); border: 1px solid var(--mdp-line); border-radius: var(--mdp-radius);
  padding: 8px 6px 2px;
}
.mdp-ruler svg { display: block; width: 100%; height: auto; }
.mdp-note {
  border-left: 3px solid var(--mdp-primary); padding: 2px 0 2px 12px;
  font-size: 0.8rem; color: var(--mdp-muted); line-height: 1.45;
}
.mdp-pill {
  display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 0.74rem; font-weight: 700;
  background: var(--mdp-primary-soft); color: var(--mdp-primary);
}
.mdp-pill-media { background: #fff3d6; color: #8a5a00; }
.mdp-pill-baixa { background: #fdecea; color: var(--mdp-danger); }
.mdp-done { text-align: center; padding-top: 30px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.mdp-done-icon {
  width: 64px; height: 64px; border-radius: 50%; background: var(--mdp-primary); color: #fff;
  display: grid; place-items: center; font-size: 2rem;
}
.mdp-consent { display: flex; gap: 10px; font-size: 0.85rem; line-height: 1.45; align-items: flex-start; }
.mdp-consent input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--mdp-primary); }
.mdp-calib { font-family: ui-monospace, Consolas, monospace; font-size: 0.72rem; color: var(--mdp-muted); word-break: break-all; }
.mdp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .mdp-spinner { animation-duration: 2.5s; }
  .mdp-progress > div { transition: none; }
}
