:root {
  --bg: #f6eef3;
  --ink: #1b1216;
  --muted: #8a7680;
  --line: #eadfe6;
  --pink: #ff2d78;
  --pink-2: #ff4d8d;
  --nav: 72px;
  --safe-top: var(--tg-safe-area-inset-top, 0px);
  --safe-bot: var(--tg-safe-area-inset-bottom, 0px);
  --font: "Manrope", system-ui, sans-serif;
  --display: "Unbounded", "Manrope", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body { overflow: hidden; }
button, input { font-family: inherit; }
.hidden { display: none !important; }

#app {
  height: 100dvh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 260px at 90% -10%, #ffd2e4 0%, transparent 55%),
    var(--bg);
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(8px + var(--safe-top)) 16px calc(var(--nav) + 16px + var(--safe-bot));
}

.screen.active { display: block; }
.screen.no-nav { padding-bottom: calc(16px + var(--safe-bot)); }
.screen.has-dock { padding-bottom: calc(var(--nav) + 84px + var(--safe-bot)); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--pink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.brand img { width: 28px; height: 28px; border-radius: 9px; }

.badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 18px rgba(27, 18, 22, 0.06);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 800;
}

.h-block, .display {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.h-block { font-size: clamp(28px, 8vw, 36px); margin: 4px 2px 8px; }

.lead {
  color: var(--muted);
  font-size: 14px;
  margin: 0 2px 14px;
  line-height: 1.4;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 2px 10px;
}

.block-head h2 {
  font-family: var(--display);
  font-size: 24px;
  letter-spacing: -0.04em;
}

.block-head small { color: var(--muted); font-weight: 700; }

.media {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  min-height: 240px;
  max-height: min(52dvh, 430px);
  aspect-ratio: 4 / 5;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: 0 16px 36px rgba(255, 45, 120, 0.14);
}

.media.compact {
  aspect-ratio: 16 / 9;
  min-height: 150px;
  max-height: 190px;
  margin-top: 12px;
}

.media .shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 8, 14, 0.05) 20%, rgba(20, 8, 14, 0.78) 100%);
}

.media .copy, .media .dots {
  position: relative;
  z-index: 1;
}

.media .copy { padding: 18px 18px 20px; }
.media h1, .media h2 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.92;
  margin-top: 8px;
}
.media h1 { font-size: clamp(28px, 7.5vw, 40px); }
.media h2 { font-size: 22px; }
.media p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.86);
  max-width: 34ch;
}

.tone-age, .tone-home, .tone-welcome, .tone-empty, .tone-upsell, .tone-lock, .offer {
  background:
    radial-gradient(circle at 72% 18%, #ff79a8 0%, transparent 38%),
    radial-gradient(circle at 18% 78%, #7a123f 0%, transparent 42%),
    linear-gradient(160deg, #ff2d78 0%, #8b123f 58%, #1b0a14 100%);
}

.tone-home { filter: saturate(1.05); }
.tone-upsell {
  background:
    radial-gradient(circle at 30% 30%, #ff9ec0 0%, transparent 40%),
    linear-gradient(150deg, #d62163, #3a0c22);
}
.tone-lock {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(160deg, #ff5a96, #4a1028 70%);
}
.tone-empty { filter: grayscale(0.15) saturate(0.9); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dots {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: flex;
  gap: 5px;
}
.dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
.dots i.on { background: #fff; }

.card {
  background: #fff;
  border-radius: 28px;
  padding: 16px 18px;
  box-shadow: 0 10px 28px rgba(40, 16, 28, 0.05);
}

.promo {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.promo-copy { min-width: 0; flex: 1; }
.promo-copy b { display: block; font-size: 15px; }
.promo-copy span, .promo span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.price { color: var(--pink); font-size: 22px; }

.rules { display: grid; gap: 12px; color: #4a3b42; font-size: 14px; line-height: 1.45; }

.search-box {
  margin-top: 12px;
  background: #fff;
  border-radius: 999px;
  padding: 6px;
  display: flex;
  gap: 8px;
  box-shadow: 0 10px 28px rgba(40, 16, 28, 0.06);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 12px 14px;
  font-size: 16px;
}

.inside {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 8px;
}

.tile {
  background: #fff;
  border-radius: 24px;
  padding: 14px 12px 16px;
  min-height: 148px;
  box-shadow: 0 10px 24px rgba(40, 16, 28, 0.04);
}

.tile.pink { background: var(--pink); color: #fff; }
.tile .ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: var(--bg);
  color: var(--pink);
  font-weight: 800;
}
.tile.pink .ico { background: rgba(255, 255, 255, 0.18); color: #fff; }
.tile b { display: block; font-size: 14px; line-height: 1.2; margin-bottom: 6px; }
.tile p { font-size: 11px; line-height: 1.35; color: var(--muted); }
.tile.pink p { color: rgba(255, 255, 255, 0.82); }

.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin: 0 -16px 4px;
  padding: 0 16px 10px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.offer {
  flex: 0 0 78%;
  scroll-snap-align: start;
  border: 0;
  text-align: left;
  min-height: 250px;
  max-height: 300px;
  aspect-ratio: 3 / 4;
}

.offer.picked { outline: 3px solid #fff; box-shadow: 0 0 0 3px var(--pink), 0 16px 36px rgba(255, 45, 120, 0.2); }
.offer.free { filter: saturate(0.85); }
.offer.premium { }
.offer.ultimate { filter: hue-rotate(-8deg) saturate(1.1); }

.compare { margin-top: 4px; overflow: hidden; padding: 0; }
.compare table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare th, .compare td { padding: 12px 12px; border-bottom: 1px solid var(--line); text-align: center; }
.compare tr:last-child td { border-bottom: 0; }
.compare th:first-child, .compare td:first-child { text-align: left; color: var(--muted); font-weight: 600; }
.compare th { font-size: 12px; color: var(--ink); }
.ok { color: var(--pink); font-weight: 800; }
.no { color: #c9b7bf; }

.id-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, #ff4d8d, #ff2d78);
  color: #fff;
  border-radius: 28px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 14px 32px rgba(255, 45, 120, 0.2);
}
.id-card .ava {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 22px;
}
.id-card small { display: block; opacity: 0.8; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 800; }
.id-card b { display: block; font-size: 22px; margin-top: 2px; }
.id-card span { display: block; opacity: 0.85; font-size: 13px; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.stats div {
  background: #fff;
  border-radius: 22px;
  padding: 14px 12px;
  box-shadow: 0 10px 24px rgba(40, 16, 28, 0.04);
}
.stats small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.stats b { display: block; margin-top: 8px; font-size: 18px; text-transform: lowercase; }

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 800;
}
.btn:active { transform: scale(0.98); }
.btn-pink {
  background: linear-gradient(180deg, var(--pink-2), var(--pink));
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 45, 120, 0.28);
}
.btn-lg { width: 100%; min-height: 54px; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-search { min-width: 100px; height: 46px; padding: 0 16px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.stack, .cta-flow { display: grid; gap: 10px; }
.cta-flow { margin-top: 14px; }
.cta-dock {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav) + 8px + var(--safe-bot));
  z-index: 16;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 22px;
  padding: 16px 18px;
  font-weight: 800;
  margin: 14px 0 10px;
}
.check-row input { width: 22px; height: 22px; accent-color: var(--pink); }

.fine { text-align: center; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 12px; }

.nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(8px + var(--safe-bot));
  height: 64px;
  padding: 6px;
  background: #fff;
  border-radius: 999px;
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  align-items: center;
  box-shadow: 0 16px 40px rgba(40, 16, 28, 0.14);
  z-index: 20;
}

.nav button {
  height: 52px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 10px;
  font-weight: 700;
}

.nav button.pill {
  background: var(--pink);
  color: #fff;
  border-radius: 999px;
  flex-direction: row;
  gap: 6px;
  font-size: 12px;
}

.nav svg { width: 18px; height: 18px; }

.back {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  font-size: 20px;
}

.result-media { padding: 0; }
.result-media canvas,
.result-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.loader { text-align: center; padding-top: 22vh; }
.pulse {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: var(--pink);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(0.9); opacity: 0.75; } }
.status-line { color: var(--muted); margin-top: 8px; }
.error { color: #e01863; font-weight: 700; font-size: 13px; padding: 8px 6px 0; }
