/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #2563EB;
  --blue-lt: #EFF6FF;
  --green:   #16A34A;
  --green-lt:#F0FDF4;
  --yellow:  #CA8A04;
  --yellow-lt:#FEFCE8;
  --red:     #DC2626;
  --red-lt:  #FEF2F2;
  --gray-50: #F8FAFC;
  --gray-100:#F1F5F9;
  --gray-200:#E2E8F0;
  --gray-400:#94A3B8;
  --gray-600:#475569;
  --gray-800:#1E293B;
  --radius:  16px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Splash ===== */
.splash {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh;
}
.splash__logo {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.splash__logo span {
  font-size: 1.5rem; font-weight: 700; color: var(--blue);
}

/* ===== Layout ===== */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
}
.page--scan {
  display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100dvh - 3.5rem);
  padding-top: 0.5rem; padding-bottom: 5.5rem;
}

/* ===== Bottom Nav ===== */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 100;
}
.nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 10px 0; gap: 3px;
  text-decoration: none; color: var(--gray-400);
  font-size: 0.65rem; cursor: pointer;
  border: none; background: none;
  transition: color 0.15s;
}
.nav__item.active, .nav__item:hover { color: var(--blue); }
.nav__icon { display: flex; align-items: center; justify-content: center; }
.nav__icon svg { width: 22px; height: 22px; }

/* ===== Cards ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0.75rem 1.5rem;
  border-radius: 12px; border: none;
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn--primary { background: var(--blue); color: #fff; width: 100%; }
.btn--outline { background: transparent; border: 2px solid var(--blue); color: var(--blue); }
.btn--danger  { background: var(--red); color: #fff; }

/* ===== Form ===== */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.875rem; font-weight: 500;
               color: var(--gray-600); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-200); border-radius: 10px;
  font-size: 1rem; color: var(--gray-800); background: #fff;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--blue);
}
.field .error { font-size: 0.8rem; color: var(--red); margin-top: 4px; }

/* ===== Verdict colors ===== */
.verdict--safe    { color: var(--green); background: var(--green-lt); }
.verdict--neutral { color: var(--yellow); background: var(--yellow-lt); }
.verdict--danger  { color: var(--red);   background: var(--red-lt); }

/* ===== Score ring ===== */
.score-ring {
  width: 100px; height: 100px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 700;
}
.score-ring__num { font-size: 2rem; line-height: 1; }
.score-ring__label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== Ingredient list ===== */
.ingredient {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 0.75rem 0; border-bottom: 1px solid var(--gray-100);
}
.ingredient:last-child { border-bottom: none; }
.ingredient__dot {
  width: 10px; height: 10px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}
.ingredient__dot--safe    { background: var(--green); }
.ingredient__dot--neutral { background: var(--yellow); }
.ingredient__dot--danger  { background: var(--red); }
.ingredient__name { font-weight: 500; font-size: 0.9rem; }
.ingredient__reason { font-size: 0.8rem; color: var(--gray-600); margin-top: 2px; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 200; animation: fadeIn .2s;
}
.modal {
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
  width: 100%; max-width: 480px;
  animation: slideUp .25s;
}
@keyframes fadeIn  { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); } }

/* ===== Pull to refresh ===== */
.ptr {
  position: fixed; left: 50%; top: -44px;
  transform: translateX(-50%);
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; z-index: 500;
  transition: top .2s ease, opacity .15s;
}
.ptr--ready  { background: var(--blue-lt); }
.ptr__spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--gray-200);
  border-top-color: var(--blue);
}
.ptr--loading .ptr__spin { animation: spin .65s linear infinite; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  background: var(--gray-800); color: #fff;
  padding: 0.6rem 1.2rem; border-radius: 100px;
  font-size: 0.875rem; z-index: 300;
  animation: fadeIn .2s;
  white-space: nowrap;
}

/* ===== Loader ===== */
.loader {
  display: flex; align-items: center; justify-content: center;
  min-height: 200px;
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Not found ===== */
.not-found {
  text-align: center; padding: 4rem 1rem;
}
.not-found h1 { font-size: 4rem; color: var(--gray-200); }
.not-found a { color: var(--blue); }

/* ===== Auth pages ===== */
.auth-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #EFF6FF 0%, #fff 60%);
}
.auth-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 4px 32px rgba(37,99,235,.12);
  padding: 2rem;
  width: 100%; max-width: 400px;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.25rem; font-weight: 700; color: var(--blue);
  margin-bottom: 1.75rem;
}
.auth-title {
  font-size: 1.5rem; font-weight: 800;
  letter-spacing: -0.02em; margin-bottom: 0.25rem;
}
.auth-sub {
  color: var(--gray-600); font-size: 0.9rem; margin-bottom: 1.5rem;
}
.auth-alt {
  text-align: center; font-size: 0.875rem;
  color: var(--gray-600); margin-top: 1.25rem;
}
.auth-alt a { color: var(--blue); text-decoration: none; font-weight: 500; }
.auth-forgot {
  display: block; text-align: right; font-size: 0.8rem;
  color: var(--gray-600); text-decoration: none;
  margin: -0.5rem 0 1rem; cursor: pointer;
}
.auth-forgot:hover { color: var(--blue); }

.form-error {
  background: var(--red-lt); color: var(--red);
  border-radius: 10px; padding: 0.65rem 0.9rem;
  font-size: 0.875rem; margin-bottom: 1rem;
}

.field-pass {
  position: relative;
}
.field-pass input { padding-right: 3rem; }
.pass-toggle {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  display: flex; align-items: center; color: var(--gray-400);
}
.pass-toggle svg { width: 18px; height: 18px; }

.auth-success { text-align: center; padding: 1rem 0; }
.auth-success__icon { display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.auth-success__icon svg { width: 64px; height: 64px; color: var(--blue); }
.auth-success h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.auth-success p  { color: var(--gray-600); font-size: 0.9rem; }

/* ===== App header ===== */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem 0;
  max-width: 480px; margin: 0 auto;
}
.app-header__title {
  font-family: 'Poppins', -apple-system, sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--blue);
  line-height: 1;
}
.header-domain {
  font-weight: 700;
  font-size: 0.75em;
  opacity: 0.45;
  letter-spacing: 0;
}
.app-header__back {
  background: var(--gray-100); border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.app-header__back svg { width: 16px; height: 16px; }

/* ===== Home ===== */
.home-hero {
  padding: 1.75rem 1.5rem;
  background: linear-gradient(145deg, #1e40af 0%, #2563eb 55%, #38bdf8 100%);
  color: #fff; border-radius: var(--radius); margin-bottom: 1.5rem;
  position: relative; overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute; top: -70px; right: -50px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.08); pointer-events: none;
}
.home-hero::after {
  content: '';
  position: absolute; bottom: -40px; left: -30px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,.05); pointer-events: none;
}
.home-hero__greeting { font-size: 1.35rem; font-weight: 800; opacity: 1; margin-bottom: 0.2rem; text-align: left; }
.home-hero__email { font-size: 0.8rem; font-weight: 400; margin-bottom: 0; opacity: .7; text-align: left; }
.home-scans { font-size: 0.85rem; opacity: .9; margin-bottom: 1.25rem; }

/* Hero topbar */
.home-hero__topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.home-hero__label {
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  opacity: 0.6;
}

/* Calorie progress */
.home-cal { margin: 0.9rem 0 0.5rem; }
.home-cal__row { display: flex; align-items: baseline; gap: 6px; margin-bottom: 7px; }
.home-cal__num { font-size: 2.4rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.home-cal__goal { font-size: 0.78rem; font-weight: 500; opacity: .7; }
.home-cal__bar { height: 6px; background: rgba(255,255,255,.2); border-radius: 100px; overflow: hidden; margin-bottom: 5px; }
.home-cal__fill { height: 100%; background: rgba(255,255,255,.9); border-radius: 100px; transition: width .5s ease; max-width: 100%; }
.home-cal__fill--over { background: #FCA5A5; }
.home-cal__remain { font-size: 0.72rem; opacity: .75; margin-bottom: 0.9rem; }

/* Macros strip */
.home-macros { display: flex; gap: 20px; margin-bottom: 1rem; }
.home-macro__val { font-size: 0.9rem; font-weight: 700; display: block; }
.home-macro__lbl { font-size: 0.62rem; opacity: .65; display: block; margin-top: 1px; }

/* Weekly strip */
.home-week { display: flex; justify-content: space-between; margin-bottom: 1.1rem; }
.home-week__day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.home-week__name { font-size: 0.58rem; font-weight: 500; opacity: .6; text-transform: uppercase; letter-spacing: .04em; }
.home-week__day--today .home-week__name { opacity: 1; font-weight: 700; }
.home-week__dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.2); flex-shrink: 0; }
.home-week__dot--filled { background: rgba(255,255,255,.88); }
.home-week__day--today .home-week__dot { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.home-week__cal { font-size: 0.52rem; opacity: .6; min-height: 0.52rem; }

/* Scan note */
.home-scan-note { font-size: 0.7rem; opacity: .65; text-align: center; margin-top: 6px; }
.home-scan-btn {
  background: rgba(255,255,255,.2) !important;
  border: 1.5px solid rgba(255,255,255,.4);
  backdrop-filter: blur(8px);
  color: #fff !important;
}
.home-scan-btn:hover { background: rgba(255,255,255,.3) !important; }
.home-scan-btn svg { width: 20px; height: 20px; }

.section-label {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--gray-600); margin-bottom: 0.75rem;
}

/* ===== Badges ===== */
.badge { display: inline-block; padding: 0.25rem 0.8rem; border-radius: 100px; font-size: 0.8rem; font-weight: 600; }
.badge--premium { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.badge--free { background: var(--gray-100); color: var(--gray-600); }

/* ===== Scan card ===== */
.scan-card {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: box-shadow 0.15s;
  padding: 1rem 1.25rem;
  border-left: 4px solid transparent;
  overflow: hidden;
}
.scan-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); }
.scan-card--green  { border-left-color: var(--green); }
.scan-card--yellow { border-left-color: var(--yellow); }
.scan-card--red    { border-left-color: var(--red); }
.scan-card--removing {
  opacity: 0; transform: translateX(16px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.scan-card__delete {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--gray-100);
  color: var(--gray-400); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.scan-card__delete:hover { background: var(--red-lt); color: var(--red); }
.scan-card__delete svg { width: 15px; height: 15px; }
.scan-card__left { display: flex; align-items: center; gap: 12px; }
.scan-card__emoji { display: flex; align-items: center; justify-content: center; width: 44px; flex-shrink: 0; }
.scan-card__emoji svg { width: 28px; height: 28px; color: var(--gray-600); }
.scan-card__thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}
@keyframes imgFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.scan-card__text  { font-size: 0.9rem; font-weight: 500; }
.scan-card__date  { font-size: 0.75rem; color: var(--gray-600); margin-top: 2px; }

.verdict-badge {
  font-size: 0.75rem; font-weight: 700; padding: 0.3rem 0.75rem;
  border-radius: 100px; white-space: nowrap;
}
.verdict-badge--green  { background: var(--green-lt);  color: var(--green); }
.verdict-badge--yellow { background: var(--yellow-lt); color: var(--yellow); }
.verdict-badge--red    { background: var(--red-lt);    color: var(--red); }

/* ===== Empty state ===== */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: var(--gray-600);
}
.empty-state__icon { display: flex; align-items: center; justify-content: center; margin-bottom: 0.75rem; }
.empty-state__icon svg { width: 48px; height: 48px; color: var(--gray-400); }

/* ===== Profile ===== */
.profile-card { text-align: center; padding: 2rem; margin-bottom: 1rem; }
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--blue-lt); color: var(--blue);
  font-size: 1.5rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.75rem;
}
.profile-email { font-weight: 500; margin-bottom: 0.5rem; }
.profile-plan  { display: inline-block; }

.promo-card {
  background: linear-gradient(135deg, #EFF6FF, #F5F3FF);
  border: 1.5px solid var(--blue);
  margin-bottom: 1rem; text-align: center;
}
.promo-card__title { font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; }
.promo-card__sub   { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 1rem; }

/* ===== Scan page ===== */
/* ===== Scan page ===== */
.upload-zone {
  border: 2px dashed var(--gray-200); border-radius: var(--radius);
  padding: 3rem 1.5rem 2.5rem; text-align: center;
  background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 1rem;
}
.upload-zone:hover { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.05); }
.upload-zone__icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--blue-lt); margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
}
.upload-zone__icon svg { width: 34px; height: 34px; color: var(--blue); }
.upload-zone__title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; }
.upload-zone__sub   { font-size: 0.85rem; color: var(--gray-600); margin-bottom: 1.75rem; }
.upload-zone__btns  { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* Scan frame with animation */
.scan-frame {
  position: relative; border-radius: var(--radius); overflow: hidden;
  margin-bottom: 0.75rem; background: #000; line-height: 0;
  animation: frameGlow 1.8s ease-in-out infinite;
}
@keyframes frameGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(56,189,248,0); }
  50%       { box-shadow: 0 0 0 3px rgba(56,189,248,.45), 0 0 28px rgba(56,189,248,.18); }
}
.scan-frame img {
  width: 100%; max-height: 300px; object-fit: cover;
  display: block; opacity: 0.82;
  animation: imgZoom 7s ease-in-out infinite;
}
@keyframes imgZoom {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.045); }
}
.scan-beam {
  position: absolute; left: 0; right: 0; top: 0;
  height: 4px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(56,189,248,.55) 18%,
    #38bdf8 50%,
    rgba(56,189,248,.55) 82%,
    transparent 100%);
  box-shadow: 0 0 20px 7px rgba(56,189,248,.5);
  animation: beamSweep 1.2s linear infinite;
}
.scan-beam-2 {
  position: absolute; left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(56,189,248,.25) 20%,
    rgba(56,189,248,.6) 50%,
    rgba(56,189,248,.25) 80%,
    transparent 100%);
  box-shadow: 0 0 10px 3px rgba(56,189,248,.25);
  animation: beamSweep 1.2s linear infinite;
  animation-delay: 0.6s;
}
@keyframes beamSweep {
  0%   { top: 3%;  opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 97%; opacity: 0; }
}
.scan-corners { position: absolute; inset: 0; pointer-events: none; }
.scan-corners i {
  position: absolute; width: 22px; height: 22px;
  border-color: rgba(255,255,255,.95); border-style: solid; display: block;
  opacity: 0; animation: cornerLock 0.35s cubic-bezier(.34,1.56,.64,1) forwards;
}
.scan-corners i:nth-child(1) { top: 12px; left: 12px; border-width: 3px 0 0 3px; border-radius: 3px 0 0 0; animation-delay: .05s; }
.scan-corners i:nth-child(2) { top: 12px; right: 12px; border-width: 3px 3px 0 0; border-radius: 0 3px 0 0; animation-delay: .12s; }
.scan-corners i:nth-child(3) { bottom: 12px; left: 12px; border-width: 0 0 3px 3px; border-radius: 0 0 0 3px; animation-delay: .19s; }
.scan-corners i:nth-child(4) { bottom: 12px; right: 12px; border-width: 0 3px 3px 0; border-radius: 0 0 3px 0; animation-delay: .26s; }
@keyframes cornerLock {
  from { opacity: 0; transform: scale(1.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* Status row */
.scan-status {
  display: flex; align-items: center; gap: 12px;
  padding: 0.9rem 1.1rem; background: #fff;
  border-radius: 12px; margin-bottom: 0.6rem;
  box-shadow: var(--shadow);
}
.scan-status__dots { display: flex; gap: 5px; flex-shrink: 0; }
.scan-status__dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--blue);
  animation: dotPulse 1s ease-in-out infinite;
}
.scan-status__dots span:nth-child(2) { animation-delay: .18s; }
.scan-status__dots span:nth-child(3) { animation-delay: .36s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.2; transform: scale(0.7); }
  50%       { opacity: 1;   transform: scale(1.25); }
}
.scan-status__text {
  font-size: 0.9rem; font-weight: 600; color: var(--gray-800);
  transition: opacity 0.22s ease;
}

/* Scan progress bar */
.scan-progress-wrap {
  height: 5px; background: var(--gray-100);
  border-radius: 100px; overflow: hidden; margin-bottom: 1rem;
}
.scan-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: 100px;
  transition: width 0.12s linear;
  box-shadow: 0 0 8px rgba(56,189,248,.5);
}

/* Category pills */
.cat-pills {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 4px; margin-bottom: 1rem;
  scrollbar-width: none;
}
.cat-pills::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0; padding: 0.45rem 1rem; border-radius: 100px;
  border: 1.5px solid var(--gray-200); background: #fff;
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  color: var(--gray-600); transition: all 0.15s; white-space: nowrap;
}
.cat-pill.active {
  border-color: var(--blue); background: var(--blue);
  color: #fff; font-weight: 600;
}

/* Кнопка с анимацией загрузки */
.btn-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.6s linear infinite; vertical-align: middle;
}

/* ===== Result page ===== */
.res-page {
  max-width: 480px; margin: 0 auto;
  padding-bottom: 6rem;
}

/* Photo hero */
.res-photo-hero {
  position: relative; height: 260px; overflow: hidden;
  background: var(--gray-200);
}
.res-photo-hero--nophoto { display: flex; align-items: center; justify-content: center; }
.res-photo-hero--nophoto.verdict--safe    { background: var(--green-lt); }
.res-photo-hero--nophoto.verdict--neutral { background: var(--yellow-lt); }
.res-photo-hero--nophoto.verdict--danger  { background: var(--red-lt); }
.res-photo-hero__img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  animation: imgFadeIn 0.35s ease;
}
.res-photo-hero__placeholder svg {
  width: 72px; height: 72px; opacity: 0.3;
}
.res-photo-hero__overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.18) 0%,
    transparent 40%,
    transparent 55%,
    rgba(0,0,0,.35) 100%);
  pointer-events: none;
}
.res-back-btn {
  position: absolute; top: calc(1rem + env(safe-area-inset-top)); left: 1rem;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.35); backdrop-filter: blur(6px);
  border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.res-back-btn svg { width: 18px; height: 18px; }
.res-verdict-pill {
  position: absolute; bottom: 1rem; left: 1rem;
  padding: 0.3rem 0.9rem; border-radius: 100px;
  font-size: 0.82rem; font-weight: 700;
  backdrop-filter: blur(6px);
}
.res-verdict-pill--safe    { background: rgba(22,163,74,.85);  color: #fff; }
.res-verdict-pill--neutral { background: rgba(202,138,4,.85);  color: #fff; }
.res-verdict-pill--danger  { background: rgba(220,38,38,.85);  color: #fff; }

/* Content area */
.res-content { padding: 1rem 1rem 0; }

/* Branding strip */
.res-brand {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.55rem 1rem;
  margin-bottom: 0.75rem;
}
.res-brand__logo {
  font-family: 'Poppins', -apple-system, sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--blue);
  letter-spacing: -0.02em;
  line-height: 1;
}
.res-brand__domain {
  font-weight: 700;
  font-size: 0.72em;
  opacity: 0.4;
}

/* Score row */
.res-score-row {
  display: flex; align-items: center; gap: 1rem;
  background: #fff; border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}
.res-score-ring {
  position: relative; flex-shrink: 0;
  width: 64px; height: 64px;
}
.res-score-ring__svg { width: 64px; height: 64px; }
.res-score-ring__num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; font-weight: 800; line-height: 1;
}
.res-score-meta { flex: 1; min-width: 0; }
.res-score-meta__name { font-size: 1rem; font-weight: 700; color: var(--gray-800); line-height: 1.2; }
.res-score-meta__verdict { font-size: 0.8rem; font-weight: 600; color: var(--gray-600); margin-top: 2px; }
.res-score-meta__cat {
  font-size: 0.8rem; color: var(--gray-600); margin-top: 2px;
  display: flex; align-items: center; gap: 4px;
}
.res-score-meta__cat svg { width: 13px; height: 13px; }
.res-score-meta__count    { font-size: 0.75rem; color: var(--gray-400); margin-top: 2px; }
.res-score-meta__calories { font-size: 1.05rem; font-weight: 800; color: var(--blue); margin-top: 2px; line-height: 1.2; }
.res-fav-btn {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--gray-200); background: #fff;
  color: var(--gray-400); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.res-fav-btn svg { width: 18px; height: 18px; }
.res-fav-btn--active { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-lt); }

/* Stats row */
.res-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 0.75rem;
}
.res-stat {
  background: #fff; border-radius: 12px; padding: 0.75rem 0.5rem;
  text-align: center; box-shadow: var(--shadow);
}
.res-stat__num { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.res-stat__lbl { font-size: 0.68rem; color: var(--gray-600); margin-top: 3px; }
.res-stat--safe    .res-stat__num { color: var(--green); }
.res-stat--neutral .res-stat__num { color: var(--yellow); }
.res-stat--danger  .res-stat__num { color: var(--red); }
.res-stat--protein .res-stat__num { color: var(--green); }
.res-stat--fat     .res-stat__num { color: #EA580C; }
.res-stat--carbs   .res-stat__num { color: var(--blue); }
.res-stat--edit    { cursor: pointer; transition: box-shadow 0.15s; }
.res-stat--edit:hover { box-shadow: 0 0 0 2px var(--blue); }
.res-score-ring--edit { cursor: pointer; }
.res-score-ring--edit:hover svg circle:last-child { opacity: 0.75; }

/* Summary */
.res-summary {
  background: #fff; border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}
.res-summary__label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-400); margin-bottom: 6px;
}
.res-summary__text { font-size: 0.9rem; line-height: 1.55; color: var(--gray-800); }

/* Ingredients */
.res-section-header {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--gray-400);
  margin-bottom: 8px; padding-left: 2px;
}
.res-ingredients {
  background: #fff; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); margin-bottom: 0.75rem;
}
.res-ingredient {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--gray-100);
}
.res-ingredient:last-child { border-bottom: none; }
.res-ingredient__badge {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 800; margin-top: 1px;
}
.res-ingredient__badge--safe    { background: var(--green-lt);  color: var(--green); }
.res-ingredient__badge--neutral { background: var(--yellow-lt); color: var(--yellow); }
.res-ingredient__badge--danger  { background: var(--red-lt);    color: var(--red); }
.res-ingredient__name   { font-size: 0.9rem; font-weight: 600; color: var(--gray-800); }
.res-ingredient__reason { font-size: 0.8rem; color: var(--gray-600); margin-top: 2px; line-height: 1.4; }

/* Actions */
.res-actions { display: flex; flex-direction: column; gap: 0.75rem; }

.card-title { font-weight: 700; margin-bottom: 1rem; }
.fav-btn--active { background: #FEFCE8 !important; border-color: var(--yellow) !important; color: var(--yellow) !important; }

/* ===== History ===== */
.history-notice {
  font-size: 0.82rem; color: var(--gray-600);
  background: var(--blue-lt); border-radius: 10px;
  padding: 0.6rem 0.9rem; margin-bottom: 1rem;
}
.history-notice a { color: var(--blue); font-weight: 600; text-decoration: none; }

.filter-row {
  display: flex; gap: 8px; overflow-x: auto; margin-bottom: 1rem;
  padding-bottom: 4px; scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-btn {
  padding: 0.4rem 1rem; border-radius: 100px; white-space: nowrap;
  border: 1.5px solid var(--gray-200); background: #fff;
  font-size: 0.82rem; cursor: pointer; transition: all 0.15s;
}
.filter-btn.active { border-color: var(--blue); background: var(--blue-lt); color: var(--blue); font-weight: 600; }

/* ===== Pricing page ===== */
.pricing-toggle {
  display: flex; gap: 8px; margin-bottom: 1.25rem;
  background: var(--gray-100); border-radius: 12px; padding: 4px;
}
.ptoggle-btn {
  flex: 1; padding: 0.6rem; border-radius: 10px;
  border: none; background: transparent;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  color: var(--gray-600); transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.ptoggle-btn.active { background: #fff; color: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.ptoggle-sale {
  background: #DCFCE7; color: var(--green);
  font-size: 0.7rem; padding: 1px 6px; border-radius: 100px; font-weight: 700;
}

.plan-card { margin-bottom: 1rem; position: relative; }
.plan-card--premium { border: 2px solid var(--blue); }
.plan-card__badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff;
  padding: 0.2rem 1rem; border-radius: 100px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.plan-card__name { font-weight: 700; font-size: 1rem; margin-bottom: 0.5rem; }
.plan-card__price-wrap { display: flex; align-items: baseline; gap: 6px; margin-bottom: 1.25rem; }
.plan-card__price  { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; }
.plan-card__period { font-size: 0.82rem; color: var(--gray-600); }
.plan-card__features { list-style: none; margin-bottom: 1.25rem; }
.plan-card__features li {
  padding: 0.4rem 0; font-size: 0.88rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 8px;
}
.plan-card__features li:last-child { border-bottom: none; }
.plan-card__features li.ok::before { content: '✓'; color: var(--green); font-weight: 700; }
.plan-card__features li.no::before { content: '✗'; color: var(--gray-400); }
.plan-card__features li.no { color: var(--gray-400); }
.plan-card__current {
  text-align: center; font-size: 0.85rem; color: var(--gray-600);
  padding: 0.6rem; background: var(--gray-100); border-radius: 10px;
}
.pricing-note {
  font-size: 0.78rem; color: var(--gray-600);
  text-align: center; margin-top: 0.5rem; line-height: 1.5;
}

.premium-active-card {
  text-align: center; padding: 1.5rem;
  background: linear-gradient(135deg, #FEFCE8, #FEF9C3);
  border: 1.5px solid var(--yellow); border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.premium-active-card__icon  { display: flex; align-items: center; justify-content: center; margin-bottom: 0.5rem; }
.premium-active-card__icon svg { width: 40px; height: 40px; color: var(--yellow); }
.premium-active-card__title { font-weight: 700; margin-bottom: 0.25rem; }
.premium-active-card__sub   { font-size: 0.85rem; color: var(--gray-600); }

/* ===== Profile updates ===== */
.badge--premium-dark {
  display: inline-block; padding: 0.25rem 0.9rem; border-radius: 100px;
  background: linear-gradient(135deg, #CA8A04, #B45309);
  color: #fff; font-size: 0.8rem; font-weight: 700;
}
.profile-expires { font-size: 0.8rem; color: var(--gray-600); margin-top: 6px; }
.profile-stat-card { margin-bottom: 0.75rem; }
.profile-stat { display: flex; align-items: center; gap: 12px; }
.profile-stat__icon  { display: flex; align-items: center; justify-content: center; width: 32px; flex-shrink: 0; }
.profile-stat__icon svg { width: 28px; height: 28px; color: var(--blue); }
.profile-stat__label { font-size: 0.8rem; color: var(--gray-600); }
.profile-stat__val   { font-weight: 600; font-size: 0.95rem; }
.btn--logout { color: var(--red) !important; border-color: var(--red) !important; }

/* ===== Home improvements ===== */
.home-hero__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1rem;
}
.home-scans-badge {
  font-size: 1.6rem; font-weight: 800; color: rgba(255,255,255,.95);
  line-height: 1;
}
.home-scans-badge span { font-size: 0.9rem; font-weight: 500; opacity: .75; }

.home-progress {
  height: 6px; background: rgba(255,255,255,.25);
  border-radius: 100px; margin-bottom: 6px; overflow: hidden;
}
.home-progress__bar {
  height: 100%; background: #fff;
  border-radius: 100px; transition: width 0.4s;
}
.home-progress__label {
  font-size: 0.75rem; color: rgba(255,255,255,.8); margin-bottom: 1.25rem;
}

.quick-actions {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 1.5rem;
}
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: #fff; border: 1.5px solid var(--gray-200); border-radius: 12px;
  padding: 0.75rem 0.5rem; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--gray-600);
}
.quick-btn svg { width: 26px; height: 26px; }
.quick-btn span { font-size: 0.68rem; color: var(--gray-600); font-weight: 500; }
.quick-btn:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(37,99,235,.1); }

.home-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.section-link {
  font-size: 0.82rem; color: var(--blue); font-weight: 600; text-decoration: none; cursor: pointer;
}

.home-promo {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1rem; cursor: pointer;
  background: linear-gradient(135deg, #EFF6FF, #F5F3FF);
  border: 1.5px solid var(--blue);
}
.home-promo__title { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.home-promo__sub   { font-size: 0.78rem; color: var(--gray-600); }
.home-promo__price { font-weight: 800; color: var(--blue); font-size: 0.95rem; white-space: nowrap; }

/* ===== Result locked btn ===== */
.btn--locked {
  color: var(--gray-400) !important;
  border-color: var(--gray-200) !important;
  cursor: pointer;
}

/* ===== iOS safe area для нижней навигации ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .page { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
}

/* ===== Инлайновые SVG-иконки ===== */
.btn svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.cat-pill svg { width: 14px; height: 14px; vertical-align: -2px; }
.filter-btn svg { width: 14px; height: 14px; vertical-align: -2px; }
.badge--premium-dark svg { width: 12px; height: 12px; vertical-align: -1px; }
.home-promo__title svg { width: 14px; height: 14px; vertical-align: -2px; }
.history-notice svg { width: 14px; height: 14px; vertical-align: -2px; flex-shrink: 0; }
.profile-plan-badge svg { width: 12px; height: 12px; vertical-align: -1px; }
.fav-btn svg { width: 16px; height: 16px; vertical-align: -3px; }
