:root {
  --paper: #FAF7F2;
  --card: #FFFFFF;
  --ink: #1C1C1C;
  --slate: #5A5F66;
  --mist: #E6E2DA;
  --teal: #0F6B6B;
  --teal-dark: #094E4E;
  --red: #B3261E;
  --amber: #A86A00;
  --green: #1F6B3A;
  --focus: #1A66D9;
  --radius: 12px;
  --radius-lg: 20px;
  --gap: 24px;
  --gap-lg: 48px;
  --tap: 56px;
  --primary-h: 64px;
  --max-w: 480px;
  --fade: 120ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.app {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 20px 32px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 32px; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
p { margin: 0; }

.muted { color: var(--slate); }
.example { color: var(--slate); font-style: italic; font-size: 18px; }

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  gap: 12px;
}
.header .title { font-size: 24px; font-weight: 700; }
.header .spacer { flex: 1; }

.iconbtn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.iconbtn:active { background: var(--mist); }
.iconbtn svg { width: 32px; height: 32px; }
.iconbtn--subtle { color: var(--slate); opacity: 0.7; }
.iconbtn--subtle svg { width: 22px; height: 22px; }
.iconbtn--subtle:active { background: transparent; opacity: 1; color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--primary-h);
  padding: 12px 20px;
  font: inherit;
  font-size: 22px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color var(--fade) ease, color var(--fade) ease;
}
.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:active { background: var(--teal-dark); }
.btn-secondary {
  background: var(--paper);
  color: var(--teal);
  border-color: var(--teal);
}
.btn-secondary:active { background: var(--mist); }
.btn-ghost {
  background: transparent;
  color: var(--slate);
  min-height: var(--tap);
  font-size: 20px;
  font-weight: 500;
}
.btn-ghost:active { color: var(--ink); }
.btn-danger {
  background: var(--paper);
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:active { background: #fce9e8; }

.btn-stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Inputs ---------- */
label.field { display: flex; flex-direction: column; gap: 8px; }
label.field > span { font-size: 18px; color: var(--ink); font-weight: 500; }
input[type="text"], input[type="tel"] {
  font: inherit;
  font-size: 20px;
  min-height: var(--primary-h);
  padding: 0 16px;
  border-radius: var(--radius);
  border: 2px solid var(--mist);
  background: var(--card);
  color: var(--ink);
  width: 100%;
}
input[type="text"]:focus, input[type="tel"]:focus {
  border-color: var(--teal);
  outline: none;
}

/* ---------- Focus ring (keyboard) ---------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--mist);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.nudge {
  background: var(--card);
  border-left: 6px solid var(--teal);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Progress dots ---------- */
.dots { display: flex; gap: 10px; align-items: center; }
.dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--mist);
}
.dots .dot.active { background: var(--teal); }
.dots .dot.done { background: var(--teal); opacity: 0.55; }

/* ---------- Question screen ---------- */
.question {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  flex: 1;
}
.question .prompt {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
}

/* ---------- Verdict ---------- */
.verdict-card {
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.verdict-card.scam { background: var(--red); }
.verdict-card.careful { background: var(--amber); }
.verdict-card.okay { background: var(--green); }
.verdict-tag {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.9;
  font-weight: 600;
}
.verdict-headline {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.15;
}
.flag-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 18px;
}
.flag-list li::before {
  content: "•  ";
  opacity: 0.85;
}

.do-now {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.do-now .label {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.75;
}
.do-now .text {
  font-size: 22px;
  line-height: 1.35;
}
.do-now .btn-primary { background: #fff; color: var(--ink); }
.do-now .btn-primary:active { background: var(--mist); }
.do-now .btn-secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.6);
}

.contact-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-actions + .contact-actions {
  margin-top: 16px;
}

/* ---------- Contacts (settings, onboarding) ---------- */
.contact-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
}
.contact-row .row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.fav-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  color: var(--slate);
  min-height: var(--tap);
}
.fav-radio input { width: 24px; height: 24px; }
.fav-radio input:checked + span { color: var(--teal); font-weight: 600; }
.trash-btn {
  background: transparent;
  border: none;
  color: var(--red);
  font-size: 18px;
  min-height: var(--tap);
  padding: 0 12px;
  cursor: pointer;
}

/* ---------- Lang picker (onboarding step 0) ---------- */
.lang-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.lang-options .btn { font-size: 24px; }

/* ---------- Settings rows ---------- */
.setting-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--mist);
  border-radius: var(--radius);
}
.setting-row .label { font-size: 18px; color: var(--slate); }
.radio-group {
  display: flex;
  gap: 24px;
}
.radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  font-size: 20px;
}
.radio-group input { width: 24px; height: 24px; }

/* ---------- Confirm dialog ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.dialog {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dialog .title { font-size: 22px; font-weight: 600; }

/* ---------- Animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fade var(--fade) ease-out; }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.spacer-flex { flex: 1; }
