:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1b1b1f);
  --hint: var(--tg-theme-hint-color, #8a8a93);
  --card: var(--tg-theme-secondary-bg-color, #f2f2f6);
  --radius: 18px;
  --ok: #22c55e;
  --bad: #ef4444;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

#app {
  --brand: linear-gradient(135deg, #8b5cf6, #e8336d);
  --brand-solid: #a855f7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#app.theme-love { --brand: linear-gradient(140deg, #ff5a5f, #e5202e 55%, #9b0f1e); --brand-solid: #e5202e; }
#app.theme-friend { --brand: linear-gradient(140deg, #4aa3ff, #1f6fe0 55%, #0f3f9e); --brand-solid: #1f6fe0; }
#app.theme-promo { --brand: linear-gradient(140deg, #ffb703, #fb8500 55%, #e85d04); --brand-solid: #f07800; }
#app.theme-temp { --brand: linear-gradient(140deg, #7c3aed, #c026d3 55%, #f97316); --brand-solid: #a21caf; }
#app.theme-tX { --brand: linear-gradient(140deg, #ff6040, #de2430 55%, #780c24); --brand-solid: #de2430; }
#app.theme-tS { --brand: linear-gradient(140deg, #ffd648, #faa81e 55%, #d67412); --brand-solid: #e08a10; }
#app.theme-tS .btn.primary, #app.theme-tS .hero { text-shadow: 0 1px 3px rgba(120, 60, 0, .55); }
#app.theme-tF { --brand: linear-gradient(140deg, #6ed68c, #20a06e 55%, #0c5c50); --brand-solid: #20a06e; }
#app.theme-tM { --brand: linear-gradient(140deg, #6e96ff, #4054d2 55%, #1e206e); --brand-solid: #4054d2; }

h1, h2, h3, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }

/* --- Hero --- */
.hero {
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: 34px 22px 30px;
  border-radius: 0 0 30px 30px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.22) 0 3px, transparent 4px),
    radial-gradient(circle at 85% 30%, rgba(255,255,255,.25) 0 2px, transparent 3px),
    radial-gradient(circle at 75% 80%, rgba(255,255,255,.18) 0 3px, transparent 4px),
    radial-gradient(circle at 25% 75%, rgba(255,255,255,.2) 0 2px, transparent 3px);
  pointer-events: none;
}
.hero.small { padding: 26px 22px 24px; }
.hero h1 { font-size: 24px; font-weight: 800; line-height: 1.22; margin-top: 8px; }
.hero p { margin-top: 10px; opacity: .93; font-size: 15px; }
.hero-emoji { font-size: 46px; line-height: 1; animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* --- Blocks --- */
.block { margin: 16px 16px 0; background: var(--card); border-radius: var(--radius); padding: 16px; }
.block h2 { font-size: 17px; font-weight: 800; margin-bottom: 12px; }
.lead { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.hint { color: var(--hint); font-size: 13px; }
.center-text { text-align: center; margin: 12px 16px 0; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; padding: 8px 0; }
.steps li::before {
  content: counter(s);
  grid-row: span 2;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.steps b { font-weight: 700; }
.steps span { color: var(--hint); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg); border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 600; }

.checks { list-style: none; margin: 10px 0 0; padding: 0; }
.checks li { padding: 4px 0 4px 26px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 4px; color: var(--brand-solid); font-weight: 800; }
.checks.fix li::before { content: "→"; }
.closing { margin: 12px 0 0; }

.price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.price-row b { font-size: 18px; font-weight: 800; text-align: right; }

.sample { background: var(--brand); color: #fff; border-radius: 16px; padding: 18px; text-align: center; }
.sample-names { font-weight: 700; }
.sample-pct { font-size: 46px; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.sample-title { font-size: 13px; opacity: .92; }

/* --- Home --- */
.cards { padding: 16px; display: grid; gap: 12px; }
.feature {
  display: flex; align-items: center; gap: 14px; width: 100%;
  border: none; border-radius: var(--radius); padding: 18px 16px;
  color: #fff; text-align: left;
}
.feature.temp { background: linear-gradient(140deg, #7c3aed, #c026d3 60%, #f97316); }
.feature.love { background: linear-gradient(140deg, #ff5a5f, #e5202e 60%, #9b0f1e); }
.feature.friend { background: linear-gradient(140deg, #4aa3ff, #1f6fe0 60%, #0f3f9e); }
.feature.promo { background: linear-gradient(140deg, #ffb703, #fb8500 60%, #e85d04); }
.feature.plain { background: var(--card); color: var(--text); }
.feature-emoji { font-size: 34px; }
.feature-body { flex: 1; display: flex; flex-direction: column; }
.feature-body b { font-size: 17px; font-weight: 800; }
.feature-body small { font-size: 13px; opacity: .9; margin-top: 2px; }
.chev { font-size: 28px; opacity: .8; }

/* --- Buttons --- */
.spacer { flex: 1; min-height: 20px; }
.spacer:last-child { min-height: calc(20px + env(safe-area-inset-bottom)); }
.sticky {
  position: sticky; bottom: 0; margin-top: auto;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 28%);
  display: grid; gap: 8px;
}
.btn {
  width: 100%; border: none; border-radius: 15px; padding: 15px 16px;
  font-size: 16px; font-weight: 700; background: var(--card); color: var(--text);
  transition: transform .1s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); color: #fff; box-shadow: 0 8px 22px -10px var(--brand-solid); }
.btn.ghost { background: var(--card); }
.btn.link { background: transparent; color: var(--hint); padding: 10px; font-weight: 600; }
.btn.small { width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; background: var(--brand); color: #fff; }
.btn.busy { opacity: .6; pointer-events: none; }
.btn.offer { font-size: 15px; line-height: 1.3; padding: 12px 14px; }
.btn.offer-love { background: linear-gradient(140deg, #ff5a5f, #e5202e 55%, #9b0f1e); color: #fff; box-shadow: 0 8px 22px -10px #e5202e; }
.btn.offer-friend { background: linear-gradient(140deg, #4aa3ff, #1f6fe0 55%, #0f3f9e); color: #fff; box-shadow: 0 8px 22px -10px #1f6fe0; }
.actions { display: grid; gap: 10px; background: transparent; padding: 0; }

/* --- Forms --- */
.form { display: grid; gap: 10px; }
.label { font-weight: 700; font-size: 14px; margin-top: 4px; }
.input {
  width: 100%; border: 2px solid transparent; border-radius: 14px; padding: 14px;
  font: inherit; font-size: 16px; background: var(--bg); color: var(--text); outline: none;
}
.input:focus { border-color: var(--brand-solid); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-btn { border: 2px solid transparent; border-radius: 14px; padding: 13px; font-size: 15px; font-weight: 700; background: var(--bg); color: var(--text); }
.seg-btn.active { border-color: var(--brand-solid); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--hint); margin-top: 6px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand-solid); flex: none; margin: 0; }
.check a { color: var(--brand-solid); }

/* --- Quiz --- */
.quiz { padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.progress { height: 6px; border-radius: 99px; background: var(--card); overflow: hidden; }
.progress div { height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s ease; }
.quiz-count { color: var(--hint); font-size: 13px; font-weight: 600; }
.question { font-size: 22px; font-weight: 800; line-height: 1.25; }
.options { display: grid; gap: 10px; }
.option {
  border: 2px solid transparent; border-radius: 16px; padding: 16px; text-align: left;
  font-size: 16px; font-weight: 600; background: var(--card); color: var(--text);
  transition: border-color .15s ease, transform .1s ease;
}
.option:active { transform: scale(.99); }
.option.selected { border-color: var(--brand-solid); }
.option.right { border-color: var(--ok); background: rgba(34, 197, 94, .14); }
.option.wrong { border-color: var(--bad); background: rgba(239, 68, 68, .12); }
.swap { align-self: center; width: auto; }
.custom-toggle { color: var(--brand-solid); }
.custom-row { display: grid; gap: 8px; }
.hidden { display: none; }
.date { font-size: 18px; text-align: center; }

/* --- Result --- */
.result-hero { padding-bottom: 34px; }
.names { font-size: 20px; font-weight: 800; }
.heart { display: inline-block; animation: beat 1.2s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.18); } }
.pct { font-size: 76px; font-weight: 800; line-height: 1; margin: 12px 0 6px; text-shadow: 0 6px 24px rgba(0,0,0,.2); }
.result-title { font-weight: 700; font-size: 16px; opacity: .95; }
.result-text { line-height: 1.6; font-size: 15px; }
.result-text b { font-weight: 800; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; position: relative; z-index: 1; }
.scores.one { grid-template-columns: 1fr; }
.score { background: rgba(255,255,255,.18); border-radius: 14px; padding: 10px; }
.score b { display: block; font-size: 26px; font-weight: 800; }
.score span { font-size: 12px; opacity: .9; }

.card-view { padding: 16px; }
.card-img { width: 100%; border-radius: 18px; display: block; box-shadow: 0 12px 30px -16px rgba(0,0,0,.5); background: var(--card); min-height: 200px; }

/* --- Payment --- */
.paylist { display: grid; gap: 10px; background: transparent; padding: 0; }
.pay-btn {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  border: none; border-radius: 16px; padding: 17px 18px; font-size: 16px; font-weight: 700; color: #fff;
}
.pay-btn:disabled { opacity: .45; }
.warn-list { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 6px; }
.offer-box .check { color: var(--text); font-size: 14px; margin-top: 14px; }
.pay-btn.stars { background: linear-gradient(135deg, #f7b500, #f08c00); }
.pay-btn.click { background: linear-gradient(135deg, #1e88e5, #1565c0); }
.pay-btn.payme { background: linear-gradient(135deg, #22c3b5, #0f9d8f); }
.linkbox { display: flex; gap: 10px; align-items: center; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.linkbox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--hint); }

/* --- Lists --- */
.list { display: grid; gap: 8px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; border: none; text-align: left;
  background: var(--bg); color: var(--text); border-radius: 14px; padding: 13px 14px; font-size: 15px;
}
.row .row-main { flex: 1; display: flex; flex-direction: column; }
.row .row-main small { color: var(--hint); font-size: 12px; }
.row .row-side { font-weight: 800; }
.row.buy-love { background: linear-gradient(140deg, #ff5a5f, #e5202e 55%, #9b0f1e); color: #fff; }
.row.buy-friend { background: linear-gradient(140deg, #4aa3ff, #1f6fe0 55%, #0f3f9e); color: #fff; }
.row.buy-love .row-main small, .row.buy-friend .row-main small { color: rgba(255, 255, 255, .88); }
.medal { font-size: 22px; width: 28px; text-align: center; }
.empty { text-align: center; color: var(--hint); padding: 10px 0; }
.big-emoji { font-size: 48px; margin-bottom: 10px; }

/* --- States --- */
.center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px; min-height: 70vh; }
.prepare-bg { position: fixed; inset: -30px; overflow: hidden; pointer-events: none; background: var(--bg); filter: blur(6px) brightness(.62); }
.prepare-bg .hero { filter: blur(12px); }  /* katta harflar kuchliroq blur bilan ham o'qilmaydi */
.prepare-bg .lead, .prepare-bg h2 { filter: blur(3px); }
.prepare-bg * { animation: none !important; }
.unwritten { visibility: hidden; }
.prepare { flex-direction: column; gap: 26px; text-align: center; position: relative; color: #fff; }
.prepare-title { font: italic 700 30px/1.25 "Playfair Display", Georgia, serif; text-shadow: 0 2px 14px rgba(0, 0, 0, .5); }
.prepare-sub { font-size: 16px; font-weight: 600; }
.ring { position: relative; width: 190px; height: 190px; flex: none; }
.ring svg { width: 100%; height: 100%; display: block; animation: spin 1.4s linear infinite; }
.ring.done svg { animation: none; }
.ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: rgba(255, 255, 255, .2); }
.ring-fill { stroke: url(#ringGrad); stroke-linecap: round; }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 42px; font-weight: 800; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--card); border-top-color: var(--brand-solid); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

/* --- Sayt --- */
@media (prefers-color-scheme: dark) {
  html.site { --bg: #17212b; --text: #ffffff; --hint: #8b98a5; --card: #232e3c; }
}
html.site body { background: var(--bg); }
html.site #app { max-width: 560px; margin: 0 auto; min-height: calc(100vh - 52px); width: 100%; }
.site-bar {
  position: sticky; top: 0; z-index: 5; height: 52px; padding: 0 12px;
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 8px;
  background: var(--bg); border-bottom: 1px solid var(--card);
}
.site-bar button { border: none; background: transparent; color: var(--hint); font-size: 14px; font-weight: 600; padding: 8px; }
.site-bar #siteBack { grid-column: 1; font-size: 26px; line-height: 1; color: var(--text); }
.site-bar #siteOut { grid-column: 3; }
.site-logo { grid-column: 2; color: var(--text); font-weight: 800; font-size: 17px; text-decoration: none; text-align: center; }

/* --- Temperament --- */
.temp-name { font-size: 54px; }
.tbar { margin-top: 12px; }
.tbar-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.tbar-track { height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.tbar-fill { height: 100%; border-radius: 99px; background: var(--brand); }
.axis-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--hint); margin-top: 4px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 1px; }
input.mono { text-transform: uppercase; }
.promo-code { font: 800 34px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 4px; margin: 4px 0 14px; }
