/* Qavat — ketchup va gorchitsa: rang sahnaning oʻzidan */
:root {
  --mustard: #e7b445;
  --mustard-deep: #c98a1e;
  --ketchup: #c9311c;
  --ketchup-dark: #a52411;
  --espresso: #2b1a0f;
  --crust: #8a4d1c;
  --cream: #fff3d6;
  --leaf: #7fb13a;
  --display: 'Bagel Fat One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --text: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--espresso);
  color: var(--cream);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--cream); color: var(--espresso); padding: 10px 14px; border-radius: 10px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- sahna ---------- */
.stage { position: relative; height: 640vh; }
.sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }

.backdrop {
  position: absolute; inset: -40px;
  background: url('/img/sahna-xira.webp') center 70% / cover no-repeat, var(--mustard-deep);
  filter: saturate(1.1);
}
.backdrop::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 60%, transparent 30%, rgba(43, 26, 15, 0.55) 100%); }

.scene {
  position: absolute; left: 0; top: 0;
  width: 944px; height: 1680px;
  transform-origin: 0 0;
  will-change: transform;
}
.scene.edged { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%); }
.scene .bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }

/* taxtadagi soya: burger yigʻilgan sari qoyulashadi */
.shadow {
  position: absolute; left: 205px; top: 1392px; width: 525px; height: 78px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(40, 18, 4, 0.75), rgba(40, 18, 4, 0.35) 60%, transparent);
  mix-blend-mode: multiply;
  opacity: 0.4;
}

.layers { position: absolute; inset: 0; }
.layer { position: absolute; will-change: transform; transform-origin: 50% 100%; }
.layer img { position: absolute; display: block; user-select: none; pointer-events: none; transition: opacity 0.55s ease; }
.layer .fin { opacity: 0; }
.melted .layer .fin { opacity: 1; }
.melted .layer .flo { opacity: 0; }
.melted .layer.same .flo { transition-delay: 0.1s; }

/* «pishdi» lahzasi: burger ustida iliq yorugʻlik bir marta yonib oʻchadi */
.glow {
  position: absolute; left: 140px; top: 820px; width: 660px; height: 700px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 214, 140, 0.75), rgba(255, 180, 80, 0.25) 55%, transparent);
  mix-blend-mode: screen; opacity: 0; pointer-events: none;
}
.melted .glow { animation: glow 1.1s ease-out; }
@keyframes glow { 25% { opacity: 1; } 100% { opacity: 0; } }
.steam { position: absolute; left: 160px; top: 560px; width: 620px; height: 520px; pointer-events: none; }

/* masalliq nomlari */
.labels { position: absolute; inset: 0; pointer-events: none; }
.label {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap;
  color: var(--cream);
  text-shadow: 0 1px 2px rgba(60, 30, 5, 0.55), 0 0 12px rgba(120, 60, 10, 0.35);
  will-change: transform, opacity;
}
.label::before { content: ''; width: 14px; height: 1.5px; background: currentColor; opacity: 0.8; border-radius: 1px; }

/* ---------- yuqori qator ---------- */
.top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
}
.brand {
  font-family: var(--display); font-size: 30px; line-height: 1; text-decoration: none;
  color: var(--cream); letter-spacing: -0.01em;
  text-shadow: 0 2px 0 var(--crust), 0 4px 14px rgba(80, 40, 5, 0.45);
}
.pill {
  font-weight: 600; font-size: 15px; text-decoration: none;
  color: var(--cream); background: var(--ketchup);
  padding: 9px 16px; border-radius: 999px;
  box-shadow: 0 3px 0 var(--ketchup-dark), 0 8px 18px rgba(90, 20, 5, 0.3);
}
.pill:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ketchup-dark); }

.hint {
  position: absolute; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 4;
  margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 14px; font-weight: 600; color: var(--cream);
  text-shadow: 0 1px 3px rgba(40, 20, 5, 0.7);
  transition: opacity 0.4s ease;
}
.hint span { background: rgba(43, 26, 15, 0.42); padding: 6px 12px; border-radius: 999px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.hint svg { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(5px); } }
.hint.gone { opacity: 0; }

/* ---------- yakuniy karta ---------- */
.card {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 26px 20px calc(22px + env(safe-area-inset-bottom));
  background: var(--mustard);
  color: var(--espresso);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 40px rgba(43, 26, 15, 0.3);
  transform: translateY(105%);
  will-change: transform;
}
.card::before {
  /* gorchitsa ustidan ketchup chizigʻi */
  content: ''; position: absolute; left: 20px; right: 20px; top: 12px; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, transparent, var(--ketchup) 12%, var(--ketchup) 88%, transparent);
  opacity: 0.85;
}
.card-title { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 8.6vw, 44px); line-height: 1.02; margin: 6px 0 10px; letter-spacing: -0.01em; }
.card-text { margin: 0 0 18px; font-size: 15.5px; line-height: 1.55; max-width: 36ch; color: #4a2c14; }
.card-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 26px; border-radius: 16px;
  background: var(--ketchup); color: var(--cream);
  font-weight: 700; font-size: 17px; text-decoration: none;
  box-shadow: 0 4px 0 var(--ketchup-dark), 0 10px 22px rgba(120, 30, 5, 0.28);
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ketchup-dark); }
.again {
  background: none; border: 0; padding: 8px 2px; font: inherit; font-weight: 600; font-size: 15px;
  color: var(--espresso); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: pointer;
}

/* ---------- kompyuter: yon ustunlar ---------- */
.side { display: none; }
@media (min-width: 1160px) {
  .side { display: block; position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; }
  .side-l { left: max(48px, calc(50% - 600px)); width: 300px; }
  .side-r { right: max(48px, calc(50% - 600px)); width: 260px; }
  .top .brand, .hint { display: none; }
  .top { justify-content: flex-end; padding: 24px 32px; }
  .brand-big {
    font-family: var(--display); font-size: 88px; line-height: 0.9; margin: 0 0 18px;
    color: var(--cream); text-shadow: 0 4px 0 var(--crust), 0 10px 30px rgba(60, 30, 5, 0.5);
  }
  .lede { font-family: var(--display); font-size: 32px; line-height: 1.08; margin: 0 0 14px; color: var(--mustard); text-shadow: 0 2px 10px rgba(40, 20, 5, 0.5); }
  .note { margin: 0; font-size: 16px; color: rgba(255, 243, 214, 0.85); max-width: 30ch; }
  .list-title { margin: 0 0 12px; font-weight: 600; font-size: 14px; color: rgba(255, 243, 214, 0.75); display: flex; justify-content: space-between; }
  .count { font-variant-numeric: tabular-nums; color: var(--cream); }
  .build { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
  .build li {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px;
    font-size: 16px; color: rgba(255, 243, 214, 0.55);
    transition: background 0.3s ease, color 0.3s ease;
  }
  .build li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; flex: none; display: grid; place-items: center; font-style: normal; font-size: 12px; }
  .build li.done { color: var(--cream); }
  .build li.done i { background: var(--leaf); border-color: var(--leaf); color: var(--espresso); }
  .build li.done i::before { content: '✓'; font-weight: 700; }
  .build li.now { background: rgba(255, 243, 214, 0.1); color: var(--cream); }
  .card {
    left: max(48px, calc(50% - 600px)); right: auto; bottom: 50%; width: 340px;
    border-radius: 24px; padding: 28px 26px 26px;
    transform: translateY(50%) scale(0.96); opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  .card.on { opacity: 1; transform: translateY(50%); pointer-events: auto; }
  .card-title { font-size: 40px; }
  .side-l.off { opacity: 0; transition: opacity 0.3s ease; }
}

/* ---------- pastki yozuv ---------- */
.foot {
  padding: 28px 20px calc(30px + env(safe-area-inset-bottom));
  text-align: center; font-size: 14.5px; color: rgba(255, 243, 214, 0.78);
  background: var(--espresso);
}
.foot p { margin: 4px auto; max-width: 52ch; }
.foot b { color: var(--cream); }
.foot a { color: var(--mustard); font-weight: 600; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .stage { height: auto; }
  .sticky { position: relative; }
  .hint { display: none; }
  .hint svg { animation: none; }
  .layer img { transition: none; }
  .melted .glow { animation: none; }
}
