* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { --ios: cubic-bezier(.32, .72, 0, 1); --spring: cubic-bezier(.34, 1.56, .64, 1); }
html, body {
  height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none;
  background: #1f1914; color: #fff;
  font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; -webkit-user-select: none; user-select: none; }

/* ---------- Фон: замъглени снимки в три дълбочини ---------- */
#bg { position: fixed; inset: 0; overflow: hidden; contain: strict; }
.layer { position: absolute; inset: -12%; }
.card {
  position: absolute; width: var(--w); aspect-ratio: var(--ar, 3 / 4);
  left: var(--l); top: var(--t);
  will-change: transform;
  animation: driftX var(--dx) ease-in-out var(--dlx) infinite alternate;
}
.card > i {
  position: absolute; inset: 0; border-radius: 22px;
  background: #3a2f27 center / cover no-repeat;
  will-change: transform;
  animation: driftY var(--dy) ease-in-out var(--dly) infinite alternate;
}
.far .card  { opacity: .7; }
.far .card > i { filter: brightness(.85); }
.mid .card  { opacity: .88; }
@keyframes driftX { from { transform: translate3d(var(--x0), 0, 0); } to { transform: translate3d(var(--x1), 0, 0); } }
@keyframes driftY {
  from { transform: translate3d(0, var(--y0), 0) rotate(var(--r0)) scale(1); }
  to   { transform: translate3d(0, var(--y1), 0) rotate(var(--r1)) scale(var(--s)); }
}
.veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 14, 10, .62) 0%, rgba(31, 22, 15, .26) 32%, rgba(31, 22, 15, .3) 70%, rgba(20, 14, 10, .58) 100%); }
.paused .card, .paused .card > i { animation-play-state: paused; }

/* ---------- Стъкло ---------- */
.glass {
  background: rgba(255, 255, 255, .13);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 12px 32px rgba(0, 0, 0, .25);
  border-radius: 26px;
}

/* ---------- Екрани ---------- */
.screen {
  position: fixed; inset: 0; z-index: 1;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
#home { display: grid; grid-template-rows: auto auto 1fr auto auto; max-width: 440px; margin: 0 auto; }

.brand { display: inline-grid; justify-self: start; margin-top: 10px; }
/* Логото: стрехата — плоча, която излиза над думата и се спуска надясно */
.brand__eave { display: block; width: 146px; height: 23px; margin: 0 0 2px -3px; fill: #fff; }
.brand__name { font-size: 34px; font-weight: bold; letter-spacing: -.02em; line-height: 1; }
.tag { margin: 10px 0 20px; font-size: 18px; opacity: .85; }

.tiles { grid-row: 4; display: grid; gap: 14px; margin-bottom: 18px; }
.tile {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 78px; padding: 8px 10px 8px 20px; text-align: left; cursor: pointer;
  transition: transform .45s var(--spring), background-color .2s;
}
.tile:active { transform: scale(.96); background-color: rgba(255, 255, 255, .2); transition-duration: .12s; }
/* Влизане: плочките изплуват една след друга */
.tile { animation: rise .7s var(--ios) backwards; }
.tile:nth-child(2) { animation-delay: .08s; }
.tile:nth-child(3) { animation-delay: .16s; }
.brand, .tag { animation: rise .7s var(--ios) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.tile__txt { text-shadow: 0 1px 3px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile b { font-size: 21px; letter-spacing: -.01em; white-space: nowrap; }
.tile small { font-size: 14px; opacity: .78; }
.tile--muted { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); box-shadow: none; }
.tile--muted .tile__txt, .tile--muted .draw { opacity: .55; }

/* Чертежите */
.draw { flex: none; width: auto; height: 62px; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.draw text { fill: #fff; stroke: none; font: bold 9px Arial, sans-serif; }
.draw .fill { fill: rgba(255, 255, 255, .85); }
.draw .guide { stroke-width: .8; opacity: .4; stroke-dasharray: 2 3; }
.draw .dash { stroke-dasharray: 5 4; }
.draw--measure .dim { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.4s .4s cubic-bezier(.4, 0, .2, 1) forwards; }
.draw--measure .d2 { animation-delay: .9s; }
.draw--measure .d3 { animation-delay: 1.2s; }
.draw--measure text { opacity: 0; animation: fade .4s 2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* ---------- Стъпки ---------- */
#flow { display: flex; justify-content: center; }
.sheet { position: relative; width: 100%; max-width: 480px; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 10px 4px; }
.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .12); display: grid; place-items: center;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.progress { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.progress i { display: block; height: 100%; background: #fff; border-radius: 2px; transform-origin: left; transform: scaleX(0); transition: transform .5s var(--ios); }

.stage { position: relative; flex: 1; min-height: 0; }
.step {
  position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 20px 24px; display: flex; flex-direction: column;
}
.step .kicker { font-size: 14px; opacity: .7; margin: 0 0 6px; }
.step h1 { font-size: 27px; line-height: 1.15; margin: 0 0 22px; letter-spacing: -.01em; outline: none; }
.step .help { font-size: 14px; opacity: .75; margin: -10px 0 16px; }

.anim-in-push  { animation: inPush .42s var(--ios) both; }
.anim-out-push { animation: outPush .42s var(--ios) both; }
.anim-in-pop   { animation: inPop .32s cubic-bezier(.2, .8, .2, 1) both; }
.anim-out-pop  { animation: outPop .32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes inPush  { from { transform: translateX(100%); } to { transform: none; } }
@keyframes outPush { to { transform: translateX(-30%); opacity: 0; } }
@keyframes inPop   { from { transform: translateX(-30%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes outPop  { to { transform: translateX(100%); } }

/* Опции */
.opts { display: grid; gap: 10px; }
.opts--chips { grid-template-columns: repeat(2, 1fr); gap: 8px; }
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; padding: 14px 18px; border-radius: 18px; cursor: pointer;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
  font-size: 18px; font-weight: bold; text-align: left;
  transition: transform .4s var(--spring), background-color .2s, color .2s;
  animation: optIn .5s var(--ios) backwards; animation-delay: calc(var(--i, 0) * 28ms + 80ms);
}
@keyframes optIn { from { opacity: 0; transform: translateY(14px); } }
.opt.picked { animation: pick .38s var(--spring); }
@keyframes pick { 40% { transform: scale(1.06); } }
.opts--chips .opt { min-height: 50px; padding: 12px 14px; font-size: 16px; border-radius: 15px; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:active { transform: scale(.95); transition-duration: .1s; }
.opt:has(input:checked) { background: #fff; color: #1f1914; border-color: #fff; }
.opt:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: 2px; }
.opt[aria-disabled="true"] { opacity: .35; cursor: default; font-weight: normal; }
.opt[aria-disabled="true"]:active { transform: none; }
.opt .chev { opacity: .6; font-weight: normal; }

.opts--big { grid-template-columns: 1fr 1fr; }
.opts--big .opt { flex-direction: column; justify-content: center; min-height: 150px; gap: 12px; text-align: center; }
.opts--big svg { width: 70px; height: 56px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 18px; border-radius: 14px; background: rgba(0, 0, 0, .22); }
.seg label { position: relative; transition: background-color .25s var(--ios), color .25s; display: grid; place-items: center; min-height: 44px; border-radius: 11px; cursor: pointer; font-weight: bold; font-size: 15px; transition: background-color .2s, color .2s; }
.seg input { position: absolute; opacity: 0; }
.seg label:has(input:checked) { background: #fff; color: #1f1914; }
.seg label:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: 2px; }

/* Полета */
.fld { display: block; margin-bottom: 14px; font-size: 14px; opacity: .95; }
.fld small { opacity: .7; }
.fld input {
  display: block; width: 100%; margin-top: 6px; min-height: 52px; padding: 13px 16px;
  font: inherit; font-size: 17px; color: #1f1914;
  background: rgba(255, 255, 255, .94); border: 2px solid transparent; border-radius: 15px;
  -webkit-appearance: none; appearance: none;
}
.fld input:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.fld input[aria-invalid="true"] { border-color: #ff8a7a; }
.fld .err { display: block; margin-top: 6px; color: #ffb3a8; font-size: 14px; }
.form-err { min-height: 0; margin: 0 0 10px; color: #ffb3a8; font-size: 14px; }
.form-err:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.cta {
  display: block; width: 100%; min-height: 56px; margin-top: auto; padding: 16px;
  border: 0; border-radius: 18px; cursor: pointer;
  background: #fff; color: #1f1914; font-size: 18px; font-weight: bold;
  transition: transform .15s, opacity .15s;
}
.cta:active { transform: scale(.97); }
.cta:disabled { opacity: .6; }
.cta--ghost { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .3); }
form .cta { margin-top: 8px; }

.done { justify-content: center; text-align: center; }
.done h1 { margin-bottom: 10px; }
.done p { opacity: .85; margin: 0 0 32px; }
.check { width: 84px; height: 84px; margin: 0 auto 18px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.check path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .7s .15s cubic-bezier(.4, 0, .2, 1) forwards; }

/* ---------- Купи: долен лист ---------- */
#buy { position: fixed; inset: 0; z-index: 5; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); animation: fadeIn .25s both; }
.buy-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto;
  border-radius: 28px 28px 0 0; border-bottom: 0;
  padding: 10px 20px max(22px, env(safe-area-inset-bottom));
  background: rgba(40, 32, 26, .72);
  animation: up .34s cubic-bezier(.2, .8, .2, 1) both;
}
.grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .35); margin: 0 auto 16px; }
.buy-sheet h2 { font-size: 23px; margin: 0 0 8px; line-height: 1.2; outline: none; }
.buy-sheet p { margin: 0 0 18px; opacity: .85; }
.buy-done { text-align: center; padding: 10px 0 6px; }
.buy-done h2 { margin-bottom: 22px; }
#buy.closing .scrim { animation: fadeOut .22s both; }
#buy.closing .buy-sheet { animation: down .24s ease-in both; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }

button:focus-visible, a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

@media (min-width: 768px) {
  .sheet { height: min(760px, 100%); margin: auto 0; }
  .opts--chips { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 640px) {
  .tag { margin: 6px 0 12px; }
  .tile { height: 66px; }
  .draw { height: 52px; }
  .tile b { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card > i { animation: none; }
  .draw--measure .dim, .draw--measure text, .check path { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .anim-in-push, .anim-out-push, .anim-in-pop, .anim-out-pop, .buy-sheet, .scrim, #buy.closing .scrim, #buy.closing .buy-sheet { animation: none; }
  .tile, .opt, .cta, .brand, .tag { transition: none; animation: none !important; }
}

/* ---------- Нови типове въпроси ---------- */
.why { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: -8px 0 16px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .1); }
.why::before { content: "✓"; font-weight: bold; }
.opt__t { display: flex; flex-direction: column; gap: 3px; }
.opt__t small { font-size: 13px; font-weight: normal; opacity: .75; }
.opt:has(input:checked) .opt__t small { opacity: .7; }
.opt--check { justify-content: flex-start; }
.opt--none { grid-column: 1 / -1; font-weight: normal; }

.wheel { position: relative; margin: 8px -20px 0; }
.wheel::before, .wheel::after { content: ""; position: absolute; top: 0; bottom: 0; width: 18%; z-index: 1; pointer-events: none; }
.wheel__track {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 14px 50%; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.wheel__track::-webkit-scrollbar { display: none; }
.wheel__item {
  flex: none; scroll-snap-align: center; display: grid; place-items: center;
  min-width: 128px; min-height: 96px; padding: 0 18px; border-radius: 22px; cursor: pointer;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
  font-size: 21px; font-weight: bold; white-space: nowrap;
  transition: background-color .25s, color .25s; will-change: transform;
}
.wheel__item input { position: absolute; opacity: 0; pointer-events: none; }
.wheel__item.is-center { background: #fff; color: #1f1914; border-color: #fff; }
.wheel__hint { text-align: center; font-size: 13px; opacity: .6; margin: 6px 0 20px; }

.fld--price .unit { position: relative; display: block; }
.fld--price .unit b { position: absolute; right: 16px; top: 50%; transform: translateY(-30%); color: #1f1914; font-size: 18px; }
.fld--price input { font-size: 24px; font-weight: bold; padding-right: 44px; }
.price { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.price .cta { margin-top: 0; }
.opts--big:has(.opt:nth-child(5)) .opt { min-height: 112px; gap: 8px; }
.opts--big:has(.opt:nth-child(5)) svg { width: 54px; height: 44px; }

.credits-link { grid-row: 5; justify-self: center; margin-top: 8px; padding: 6px 12px; min-height: 32px; border: 0; background: none; color: rgba(255, 255, 255, .6); font-size: 12px; cursor: pointer; }
#credits { position: fixed; inset: 0; z-index: 6; }
.credits-sheet { max-height: 80dvh; display: flex; flex-direction: column; }
.credits-list { overflow-y: auto; margin: 0 0 14px; padding-left: 2.2em; font-size: 13px; line-height: 1.45; opacity: .9; }
.credits-list a { color: #fff; }
#credits.closing .scrim { animation: fadeOut .22s both; }
#credits.closing .buy-sheet { animation: down .24s ease-in both; }

/* „Не знам“ под колелото: колелото посивява, докато не се плъзне */
.wheel.is-off .wheel__item.is-center { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.step[data-kind="wheel"] .cta--ghost { margin-top: 10px; }

/* Карта: карфицата е в центъра, движи се картата */
.map { position: relative; height: min(46vh, 380px); margin: 0 0 14px; border-radius: 18px; overflow: hidden; background: #2a221b; }
.map__canvas { position: absolute; inset: 0; }
.map__pin { position: absolute; left: 50%; top: 50%; width: 32px; height: 44px; margin: -44px 0 0 -16px; z-index: 500; pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); transition: transform .25s var(--spring); }
.map__pin path { fill: #1f1914; stroke: #fff; stroke-width: 2; }
.map__pin circle { fill: #fff; }
.map__pin.lift { transform: translateY(-10px); }
.map__me { position: absolute; right: 10px; bottom: 26px; z-index: 500; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: #1f1914;
  display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .3); }
.map__me svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.map__me:active { transform: scale(.92); }
.map .leaflet-control-attribution { font: 10px Arial, sans-serif; background: rgba(255, 255, 255, .75); }
.step[data-kind="location"] .cta--ghost, .step[data-kind="photos"] .cta--ghost { margin-top: 10px; }

/* Снимки */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; }
.photo { position: relative; margin: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; animation: optIn .35s var(--spring) backwards; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(20, 14, 10, .7); color: #fff; font: bold 18px/1 Arial, sans-serif; }
.photos__add { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed rgba(255, 255, 255, .55); display: grid; place-content: center; justify-items: center; gap: 4px; font-size: 13px; cursor: pointer; }
.photos__add[hidden] { display: none; }
.photos__add input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photos__add svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 2; }
.photos__add:active { transform: scale(.95); }
.photos__add.busy { opacity: .5; pointer-events: none; }
.photos__add:focus-within { outline: 2px solid #fff; outline-offset: 2px; }
.wheel--dense .wheel__item { min-width: 92px; min-height: 84px; padding: 0 10px; font-size: 22px; }
.wheel--dense .wheel__track { gap: 8px; }

/* Стаи, които не пасват на площта */
.opt--far { opacity: .5; }
.opt--far:hover, .opt--far:focus-within { opacity: .8; }
/* „Посочи точно на картата“ — отметка над кварталите */
.opt--pin { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 4px; }
.opt--pin input { position: absolute; opacity: 0; }
.opt--pin .tick { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid rgba(255, 255, 255, .8); }
.opt--pin input:checked ~ .tick { background: #fff; box-shadow: inset 0 0 0 4px #1f1914; }
.opt--pin svg { flex: none; width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; }
.or { margin: 14px 0 8px; font-size: 13px; opacity: .6; }
.fld--other { margin-top: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Съгласие и проверка за човек */
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 6px; font-size: 14px; line-height: 1.35; cursor: pointer; }
.consent input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: #fff; }
.consent a { color: #fff; }
.consent + .err { display: block; margin: 0 0 8px 32px; color: #ffb3a8; font-size: 14px; }
.ts:not(:empty) { margin: 8px 0; }

/* Снимка: качва се / качена / грешка */
.photo__st { position: absolute; left: 6px; bottom: 6px; width: 22px; height: 22px; border-radius: 50%; background: rgba(20, 14, 10, .7); }
.photo.is-up img { opacity: .6; }
.photo.is-up .photo__st { border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; background: none; }
.photo.is-ok .photo__st { background: #fff; }
.photo.is-ok .photo__st::after { content: "✓"; display: grid; place-items: center; height: 100%; color: #1f1914; font: bold 13px Arial, sans-serif; }
.photo.is-err { outline: 2px solid #ff8a7a; cursor: pointer; }
.photo.is-err .photo__st::after { content: "↻"; display: grid; place-items: center; height: 100%; color: #fff; font: bold 14px Arial, sans-serif; }
.ts--quiet:empty { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.num .cta--ghost { margin-top: 10px; }
