:root {
  --brand: #E9801F;
  --brand-dark: #C9670C;
  --brand-soft: #FDF1E5;
  --text: #1F2329;
  --muted: #6B7280;
  --line: #E8EAED;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --danger: #D9412F;
  --radius: 20px;
  --tabbar-h: 64px;
  /* Запрет автоматического затемнения (Android WebView в тёмной теме) */
  color-scheme: only light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
a { color: var(--brand-dark); }
button { font: inherit; color: inherit; }

/* ---------- Заставка ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff;
  transition: opacity .35s ease, visibility .35s;
}
.splash.is-hidden { opacity: 0; visibility: hidden; }
.splash__logo {
  width: min(64vw, 280px); color: var(--brand);
  animation: logo-in .9s cubic-bezier(.2, .9, .3, 1.2) both;
}
.splash__caption {
  margin-top: 20px; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  animation: fade-up .6s .45s both;
}
.splash__dots { display: flex; gap: 6px; margin-top: 28px; animation: fade-up .4s .8s both; }
.splash__dots span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
  animation: dot 1s infinite ease-in-out;
}
.splash__dots span:nth-child(2) { animation-delay: .15s; }
.splash__dots span:nth-child(3) { animation-delay: .3s; }
@keyframes logo-in { from { opacity: 0; transform: scale(.82) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

.splash__logo, .logo-sm, .logo-md { display: block; height: auto; }

/* ---------- Экраны ---------- */
.app { min-height: 100%; }
.screen {
  min-height: 100vh;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  animation: fade-up .3s both;
}
.screen--center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.screen--tabs { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
.title { font-size: 24px; line-height: 1.2; margin: 12px 0 8px; }
.page-title { font-size: 26px; margin: 4px 4px 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.logo-sm { width: 140px; color: var(--brand); margin-bottom: 8px; }
.logo-md { width: 170px; color: var(--brand); margin: 8px auto 4px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 22px; border-radius: 14px; border: 0;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform .1s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:active { background: var(--brand-dark); }
.btn--primary:disabled { opacity: .45; }
.btn--ghost { background: var(--brand-soft); color: var(--brand-dark); }
.btn--block { width: 100%; }
.btn.is-loading { pointer-events: none; opacity: .7; }
.link-btn { border: 0; background: none; color: var(--brand-dark); font-weight: 600; padding: 10px 16px; cursor: pointer; }

/* ---------- Подключение ---------- */
#screen-onboarding { display: flex; flex-direction: column; }
.hero { text-align: center; padding: 8px 4px 4px; }
.steps { list-style: none; margin: 20px 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.steps li {
  position: relative; padding: 14px 16px 14px 60px; background: var(--card); border-radius: 16px;
  display: flex; flex-direction: column; counter-increment: step;
}
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center; font-weight: 700;
}
.steps span { color: var(--muted); font-size: 14px; }
.bottom-bar { margin-top: auto; display: grid; gap: 14px; padding-top: 8px; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.consent input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--brand); }
.notice {
  background: #FFF4F2; border: 1px solid #F6CFC8; color: #8A2A1E;
  border-radius: 16px; padding: 14px 16px; margin-bottom: 12px;
}
.notice p { margin: 0 0 12px; }
.notice__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notice__actions .btn { min-height: 42px; padding: 0 14px; font-size: 14px; }

/* ---------- Карта и QR ---------- */
.card-sheet {
  background: var(--card); border-radius: var(--radius); padding: 22px 16px 8px; text-align: center;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.sheet-title { font-size: 21px; line-height: 1.25; margin: 0 0 6px; }
.card-sheet .muted { margin: 0 0 18px; font-size: 15px; }
.qr-box { position: relative; width: min(72vw, 270px); aspect-ratio: 1; margin: 0 auto; }
.qr {
  width: 100%; height: 100%; display: grid; place-items: center;
  transition: filter .3s, opacity .3s;
}
.qr img { width: 100%; height: 100%; display: block; border-radius: 12px; background: #fff; }
.qr.is-expired { filter: blur(6px); opacity: .35; }
.qr-skeleton {
  width: 100%; height: 100%; border-radius: 12px;
  background: linear-gradient(90deg, #f0f1f3 25%, #e6e8eb 37%, #f0f1f3 63%); background-size: 400% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.qr-overlay { position: absolute; inset: 0; display: grid; place-items: center; }
.qr-code { margin-top: 8px; font: 13px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); letter-spacing: .06em; min-height: 13px; }
.timer { margin: 16px auto 4px; width: min(72vw, 270px); }
.timer__bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.timer__fill { height: 100%; width: 100%; background: var(--brand); transform-origin: left; transition: transform 1s linear, background .3s; }
.timer__fill.is-low { background: var(--danger); }
.timer__text { margin-top: 8px; font-size: 14px; color: var(--muted); }

.discount-card {
  margin-top: 12px; border-radius: var(--radius); padding: 18px;
  background: linear-gradient(135deg, #F39A3D 0%, #E9801F 55%, #D96F10 100%);
  color: #fff; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  box-shadow: 0 8px 20px rgba(233, 128, 31, .25);
}
.discount-card__label { font-size: 13px; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.discount-card__value { font-size: 30px; font-weight: 800; line-height: 1.1; margin-top: 4px; word-break: break-word; }
.discount-card__meta { text-align: right; font-size: 14px; }
.discount-card__meta .muted { color: rgba(255, 255, 255, .8); font-variant-numeric: tabular-nums; }

/* ---------- Списки ---------- */
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.list__item {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; text-decoration: none; color: var(--text); cursor: pointer;
}
.list__item:last-child { border-bottom: 0; }
.list__item:active { background: #fafafa; }
.list__item b { display: block; font-weight: 600; }
.list__item small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.list__icon {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-dark);
  display: grid; place-items: center;
}
.list__icon svg { width: 22px; height: 22px; }
.info { background: var(--card); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.info h2 { font-size: 18px; margin: 0 0 8px; }
.info ol { margin: 0 0 8px; padding-left: 20px; }
.info li { margin: 4px 0; }
.info p { margin: 8px 0 0; }
#screen-privacy .info p { margin: 0 0 10px; }

/* ---------- Таббар ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: #9AA0A6; cursor: pointer;
}
.tabbar button svg { width: 26px; height: 26px; }
.tabbar button.active { color: var(--brand); }

/* ---------- Уведомление ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%); max-width: calc(100% - 32px);
  background: rgba(31, 35, 41, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  animation: fade-up .2s both;
}
