:root {
  --bg: #0a0a0a;
  --card: #131313;
  --card-2: #1a1a1a;
  --border: #262626;
  --text: #ffffff;
  --text-dim: #8a8a8a;
  --red: #e5142b;
  --red-dark: #a80f20;
  --red-glow: rgba(229, 20, 43, 0.35);
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html {
  background: var(--bg);   /* фон уходит на html */
}
body {
  background: transparent; /* body прозрачный — под ним видно watermark-layer */
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif;
  min-height: 100vh;
  overscroll-behavior: none;
}

#app {
  position: relative;         /* ← новый */
  z-index: 1;                 /* ← над watermark */
  padding: 20px 16px 100px;
  max-width: 520px;
  margin: 0 auto;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.counter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.counter .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

/* ---------- Menu grid ---------- */
.menu { display: grid; gap: 12px; }
.menu-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform .15s, border-color .15s, background .15s;
}
.menu-btn:active { transform: scale(.98); }
.menu-btn:hover { border-color: #333; background: var(--card-2); }
.menu-btn.primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-color: transparent;
  box-shadow: 0 6px 24px var(--red-glow);
}
.menu-btn .icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.menu-btn.primary .icon { background: rgba(255, 255, 255, 0.15); }
.menu-btn .icon svg { width: 20px; height: 20px; }
.menu-btn .sub {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 2px;
}
.menu-btn.primary .sub { color: rgba(255, 255, 255, 0.75); }

/* ---------- Page header ---------- */
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
}
.back-btn svg { width: 18px; height: 18px; }
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---------- Steps ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.step {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
}
.step.active {
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}
.step.done { background: var(--red-dark); }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.card-sub { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ---------- Upload zone ---------- */
.upload {
  display: block;
  width: 100%;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--card);
  transition: border-color .15s, background .15s;
}
.upload:hover { border-color: var(--red); background: var(--card-2); }
.upload .icon-lg {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: rgba(229, 20, 43, 0.1);
  color: var(--red);
  display: grid;
  place-items: center;
}
.upload .icon-lg svg { width: 26px; height: 26px; }
.upload h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.upload p { font-size: 12px; color: var(--text-dim); }

/* ---------- Buttons ---------- */
.actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.btn:active { transform: scale(.97); }
.btn:hover { background: var(--card-2); }
.btn svg { width: 18px; height: 18px; }
.btn.primary {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-color: transparent;
  box-shadow: 0 4px 20px var(--red-glow);
}
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; pointer-events: none; }

/* ---------- Photo preview ---------- */
.photo-preview {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-preview .overlay-wheels {
  position: absolute;
  width: 22%;
  pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}
.car-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rechange {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

/* ---------- Tabs (категории) ---------- */
.tabs {
  display: flex;
  gap: 8px;
  background: var(--card);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.tab.active {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  box-shadow: 0 4px 16px var(--red-glow);
}

/* ---------- Wheels horizontal scroll ---------- */
.wheels-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wheels-scroll::-webkit-scrollbar { display: none; }
.wheel-card {
  flex: 0 0 130px;
  scroll-snap-align: start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.wheel-card:active { transform: scale(.97); }
.wheel-card:hover { border-color: var(--red); }
.wheel-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: 8px;
}
.wheel-card-name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Chips (R / посадка / занижение / финиш) ---------- */
.param-block { margin-top: 14px; }
.param-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.chip:active { transform: scale(.96); }
.chip.active {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px var(--red-glow);
}

/* ---------- Lead (заявка) ---------- */
.lead-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.lead-row:last-child { border-bottom: none; }
.lead-row span { color: var(--text-dim); }
.lead-row b { color: var(--text); font-weight: 600; }

/* ---------- Tariffs ---------- */
.tariff {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  cursor: pointer;
  transition: .15s;
}
.tariff:hover { border-color: var(--red); }
.tariff.selected { border-color: var(--red); background: rgba(229, 20, 43, .05); }
.tariff .left { display: flex; align-items: center; gap: 12px; }
.tariff .badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  background: rgba(229, 20, 43, .1);
  color: var(--red);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
}
.tariff .label { font-size: 15px; font-weight: 600; }
.tariff .hint { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.tariff .price { font-size: 16px; font-weight: 700; color: var(--red); }

/* ---------- Auth ---------- */
.auth-wrap { padding-top: 40px; text-align: center; }
.auth-wrap .logo-lg {
  width: 100%;
  max-width: 340px;
  margin: 0 auto 20px;
  padding: 0 20px;
  display: block;
  background: none;
  filter: drop-shadow(0 0 30px var(--red-glow));
}
.auth-wrap .logo-lg img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}
.auth-wrap .logo-lg svg { width: 40px; height: 40px; }
.auth-wrap h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.auth-wrap p.sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 28px;
  padding: 0 20px;
}

.input {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: .15s;
}
.input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}
.input::placeholder { color: #555; }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 20px;
  text-align: left;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  background: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: .15s;
}
.checkbox.on { background: var(--red); border-color: var(--red); }
.checkbox svg { width: 14px; height: 14px; opacity: 0; }
.checkbox.on svg { opacity: 1; }
.consent a { color: var(--red); text-decoration: none; }

/* ---------- History ---------- */
.history-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  align-items: center;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.history-item:active { transform: scale(.98); }
.history-item:hover { border-color: var(--red); }
.history-item .info { flex: 1; min-width: 0; }
.history-item .name { font-size: 14px; font-weight: 600; }
.history-item .date { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.history-item .status {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(229, 20, 43, .15);
  color: var(--red);
  font-weight: 700;
}
.history-thumb {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background: var(--card-2);
  display: grid;
  place-items: center;
  font-size: 24px;
  overflow: hidden;
  flex-shrink: 0;
}
.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.history-arrow {
  font-size: 22px;
  color: var(--text-dim);
  font-weight: 300;
  padding-left: 4px;
}

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
}
.sheet-backdrop.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 32px;
  z-index: 101;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  max-width: 520px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}
.sheet.on { transform: translateY(0); }
.sheet-handle {
  width: 40px;
  height: 4px;
  background: #333;
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  background: var(--card-2);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 200;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Loader ---------- */
.loader {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  animation: spin .8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Slot picker overlay (legacy) ---------- */
.slot-controls { display: flex; gap: 8px; margin-top: 12px; }
.slot-controls .btn { flex: 1; padding: 10px; font-size: 12px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.lightbox.on { opacity: 1; pointer-events: auto; }

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 1;
  transition: background .15s;
}
.lightbox-close:active { background: rgba(255, 255, 255, 0.2); }

.lightbox-body {
  width: 100%;
  max-width: 520px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  overflow: hidden;
}
.lightbox img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
.lightbox-info { text-align: center; max-width: 100%; }
.lb-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.lb-meta { font-size: 13px; color: rgba(255, 255, 255, 0.6); }

.lightbox-share {
  max-width: 520px;
  margin-top: 20px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  border: none;
  color: #fff;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px var(--red-glow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.lightbox-share:active { transform: scale(.97); }
.lightbox-share svg { width: 18px; height: 18px; }

/* ---------- Watermark background ---------- */
.watermark-layer {
  position: fixed;
  inset: -60%;
  z-index: 0;                 /* ← было -1, стало 0 */
  pointer-events: none;
  background-image: url('/logo.svg');
  background-repeat: repeat;
  background-size: 240px 72px;
  background-position: 0 0;
  opacity: 0.035;             /* ← подняли с 0.025 до 0.035 */
  transform: rotate(-30deg);
  transform-origin: center center;
  will-change: transform;
}

/* ---------- Loading overlay ---------- */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
#loading-overlay.on {
  opacity: 1;
  pointer-events: auto;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  min-width: 240px;
  max-width: 90vw;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  animation: spin .8s linear infinite;
}

.loading-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.loading-progress {
  width: 200px;
  height: 6px;
  border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}
.loading-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--red), var(--red-dark));
  border-radius: 3px;
  transition: width .2s ease-out;
}

.loading-percent {
  font-size: 12px;
  color: var(--red);
  font-weight: 700;
  letter-spacing: 0.5px;
}