:root {
  --gradient-primary: linear-gradient(135deg, #800e3d, #b31c3e, #e8385d);
  --wine: #800e3d;
  --wine-light: #e8385d;
  --brand-red: #953223;
  --brand-ink: #3a3a3a;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --bg: #f4f5f7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  background: #fff;
  color: var(--brand-ink);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 0 0;
}

.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.brand-e {
  color: var(--brand-red);
}

.topbar-title {
  font-size: 0.9rem;
  color: var(--muted);
  flex: 1;
  border-left: 1px solid var(--line);
  padding-left: 10px;
  margin-left: 2px;
}

.topbar-action {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#compare-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 80px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.card-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-card {
  margin-top: 24px;
}

.field {
  display: block;
  margin-top: 16px;
}

.field span {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

.field input:focus {
  outline: 2px solid var(--wine-light);
  outline-offset: 1px;
  border-color: transparent;
}

.step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.step-number {
  flex: 0 0 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 190px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  padding: 16px;
}

.dropzone.filled {
  border-style: solid;
  border-color: var(--wine);
  padding: 0;
  background: #000;
}

.dropzone-label {
  font-weight: 600;
  color: var(--wine);
  text-align: center;
}

.dropzone.filled .dropzone-label {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}

.preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 13px 18px;
  cursor: pointer;
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--wine);
  border: 1px solid var(--line);
}

.btn-block {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.btn-lg {
  padding: 17px 18px;
  font-size: 1.05rem;
}

.action-bar {
  position: sticky;
  bottom: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.action-bar .btn {
  margin-top: 0;
  box-shadow: 0 6px 18px rgba(128, 14, 61, 0.28);
}

.alert {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  margin-top: 16px;
}

.loading {
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
}

.loading-text {
  margin: 8px 0 0;
  font-weight: 600;
}

.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--wine);
  animation: spin 0.9s linear infinite;
}

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

.result-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
}

.result-banner.is-ok {
  background: var(--success-soft);
  color: var(--success);
}

.result-banner.is-issue {
  background: var(--danger-soft);
  color: var(--danger);
}

.result-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.result-headline {
  margin: 0;
  font-size: 1.2rem;
}

.result-summary {
  margin: 16px 0 0;
  font-size: 1.02rem;
}

.findings {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.finding {
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 10px;
  padding: 12px 14px;
}

.finding.alta {
  border-left-color: var(--danger);
}

.finding.media {
  border-left-color: var(--warn);
}

.finding.baixa {
  border-left-color: var(--muted);
}

.finding-title {
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
}

.tag.alta {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag.media {
  background: var(--warn-soft);
  color: var(--warn);
}

.tag.baixa {
  background: #f1f5f9;
  color: var(--muted);
}

.finding-detail {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 720px) {
  .page {
    padding-top: 28px;
  }

  .dropzone {
    min-height: 240px;
  }
}
