:root {
  --page: #0d0f12;
  --bg: #181b20;
  --surface: #23272e;
  --surface-2: #2e333b;
  --line: rgba(255, 255, 255, .08);
  --ink: #f4f5f7;
  --muted: #9aa2ad;
  --primary: #1f8a65;
  --primary-hover: #25a077;
  --primary-soft: rgba(31, 138, 101, .18);
  --accent: #f2b544;
  --radius: 18px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  --app-w: 480px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); color-scheme: dark; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--page);
  line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
.muted { color: var(--muted); font-size: .85rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Ilova "telefon" ustuni: kompyuterda ham telefon kengligida turadi */
.app {
  position: relative; max-width: var(--app-w); min-height: 100vh; min-height: 100dvh;
  margin: 0 auto; background: var(--bg); overflow-x: clip;
  padding-bottom: calc(78px + var(--safe-b));
}
.app.on-detail { padding-bottom: calc(92px + var(--safe-b)); }
@media (min-width: 520px) {
  .app { box-shadow: 0 0 0 1px var(--line), 0 30px 90px rgba(0, 0, 0, .55); }
}

/* ---------- Umumiy tugmalar ---------- */
.sq-btn {
  flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: transform .15s, background .2s;
}
.sq-btn:active { transform: scale(.92); }
.sq-btn-light { background: rgba(255, 255, 255, .92); color: #1b1e23; border: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(15, 17, 20, .45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; font-weight: 700; font-size: .85rem; cursor: pointer;
}
.pill-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }
.link-btn { justify-self: start; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; font-size: .88rem; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 54px; padding: 0 18px; border-radius: 16px; border: 0; cursor: pointer;
  font-weight: 800; font-size: .98rem; transition: background .2s, transform .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 22px rgba(31, 138, 101, .35); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-soft { background: var(--surface-2); color: var(--ink); }
.btn-soft:hover { background: #383e47; }
.btn.disabled { opacity: .4; pointer-events: none; box-shadow: none; }

/* ---------- Qidiruv ---------- */
.search {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px;
  border-radius: 15px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  transition: border-color .2s;
}
.search:focus-within { border-color: var(--primary); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none;
  color: var(--ink); font: 500 .95rem var(--font);
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: invert(.7); }

/* ---------- Hero / video ---------- */
.hero {
  position: relative; height: 62svh; min-height: 420px; max-height: 620px;
  overflow: hidden; border-radius: 0 0 30px 30px; background: #0d2a24; color: #fff;
}
.hero video, .hero-fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-fallback {
  background:
    radial-gradient(circle at 74% 24%, rgba(242, 181, 68, .6), transparent 20%),
    linear-gradient(180deg, #2f6f7a 0%, #6fa3a0 45%, #d9b98a 100%);
}
.hero-fallback svg { position: absolute; inset: auto 0 0; width: 100%; height: 78%; }
.hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.5) 0%, rgba(0,0,0,0) 28%, rgba(0,0,0,.1) 55%, rgba(0,0,0,.78) 100%);
}
.hero-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-t)) 16px 0;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font: 700 1rem var(--display); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--accent); color: #1b1b1b; font-size: .85rem;
}
.hero-content { position: absolute; left: 20px; right: 20px; bottom: 26px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 800; }
.hero h1 { font: 700 clamp(2.6rem, 13vw, 3.7rem)/1 var(--display); letter-spacing: -.03em; }
.hero-sub { margin: 10px 0 0; font-size: 1rem; opacity: .9; }

/* ---------- Bosh sahifa tanasi ---------- */
.home-body { display: grid; gap: 22px; padding: 20px 16px 8px; }

.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat { display: grid; justify-items: center; gap: 7px; text-align: center; font-weight: 700; font-size: .86rem; }
.cat-ring { position: relative; }
.cat-circle {
  position: relative; width: 78px; height: 78px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; color: var(--accent);
  background: radial-gradient(circle at 30% 25%, #3a404a, var(--surface-2) 70%);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--surface-2);
  transition: transform .15s, box-shadow .2s;
}
.cat-badge {
  position: absolute; right: -4px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--primary); color: #fff;
  box-shadow: 0 0 0 3px var(--bg); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.cat:hover .cat-badge { transform: scale(1.12) rotate(-8deg); }
.cat-circle img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cat:hover .cat-circle { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--primary); }
.cat:active .cat-circle { transform: scale(.94); }
.cat small { display: block; margin-top: -5px; color: var(--muted); font-weight: 500; font-size: .74rem; }

.about { display: grid; gap: 8px; padding: 18px; border-radius: var(--radius); background: var(--surface); }
.about h2 { font-size: 1.08rem; line-height: 1.3; }
.about p { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.65; white-space: pre-line; }
.about.clamped p { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head h2 { font-size: 1.15rem; }
.credit { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: .78rem; opacity: .7; }

/* ---------- Kartochkalar (2 ustun) ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.page-grid { padding: 4px 16px 8px; }
.cp {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 18px; background: var(--surface);
  animation: rise .35s ease both;
}
.cp-media { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--surface-2); overflow: hidden; }
.cp-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.cp-media:active img { transform: scale(1.04); }
.cp-tag {
  position: absolute; top: 8px; left: 8px; padding: 3px 9px; border-radius: 999px;
  background: rgba(15, 17, 20, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-size: .68rem; font-weight: 800; color: #fff;
}
.cp-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 10px 10px 10px; }
.cp-name {
  font-weight: 800; font-size: .95rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cp-meta { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: .76rem; }
.cp-meta svg { flex: none; }
.cp-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: auto; padding-top: 8px; }
.mini-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 34px; padding: 0 6px; border: 0; border-radius: 11px; cursor: pointer;
  background: var(--surface-2); color: var(--ink); font-size: .76rem; font-weight: 800; white-space: nowrap;
  transition: background .2s, transform .15s;
}
.mini-btn:active { transform: scale(.95); }
.mini-btn:hover { background: #383e47; }
.mini-btn.primary { background: var(--primary); color: #fff; }
.mini-btn.primary:hover { background: var(--primary-hover); }
.mini-btn.disabled { opacity: .4; pointer-events: none; }
@media (max-width: 340px) { .grid { grid-template-columns: 1fr; } }

.empty {
  grid-column: 1 / -1; padding: 44px 20px; text-align: center; color: var(--muted);
  border: 1.5px dashed var(--surface-2); border-radius: var(--radius); font-size: .92rem;
}
.empty strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 1.02rem; }
.error-box { grid-column: 1 / -1; padding: 14px 16px; border-radius: 14px; background: rgba(220, 70, 50, .15); color: #ffb4a8; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Bo'lim sarlavhasi ---------- */
.page-head {
  position: sticky; top: 0; z-index: 20; display: grid; gap: 12px;
  padding: calc(12px + var(--safe-t)) 16px 14px;
  background: rgba(24, 27, 32, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.title-row { display: flex; align-items: center; gap: 12px; }
.title-row h1 { font-size: 1.45rem; line-height: 1.2; letter-spacing: -.01em; }
.title-row p { margin: 1px 0 0; color: var(--muted); font-size: .82rem; }

/* ---------- Joy sahifasi ---------- */
.detail-media { position: relative; height: 46svh; min-height: 300px; max-height: 460px; background: var(--surface-2); }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-media::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 120px; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.4), transparent);
}
.detail-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; padding: calc(14px + var(--safe-t)) 16px 0;
}
.sheet {
  position: relative; z-index: 3; display: grid; gap: 14px;
  margin-top: -34px; padding: 30px 20px 24px;
  border-radius: 30px 30px 0 0; background: var(--bg);
  animation: rise .35s ease both;
}
.sheet::before {
  content: ""; position: absolute; top: 10px; left: 50%; width: 42px; height: 4px;
  border-radius: 4px; background: var(--surface-2); transform: translateX(-50%);
}
.tag { justify-self: start; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); color: #5fd6a8; font-size: .76rem; font-weight: 800; }
.sheet h1 { font-size: 1.65rem; line-height: 1.2; letter-spacing: -.02em; }
.sheet .desc { margin: 0; color: var(--muted); line-height: 1.65; white-space: pre-line; }

.info { margin: 0; padding: 0; list-style: none; overflow: hidden; border-radius: 18px; background: var(--surface); }
.info li { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.info li + li { border-top: 1px solid var(--line); }
.info-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.info small { display: block; color: var(--muted); font-size: .74rem; }
.info strong, .info a { font-weight: 700; font-size: .95rem; }
.info a { color: #5fd6a8; }

.menu-block { display: grid; gap: 10px; }
.menu-strip {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -20px; padding: 2px 20px 6px; scrollbar-width: none;
}
.menu-strip::-webkit-scrollbar { display: none; }
.menu-strip button {
  flex: none; width: 118px; aspect-ratio: 3 / 4; padding: 0; overflow: hidden;
  border: 0; border-radius: 14px; background: var(--surface-2); cursor: pointer; scroll-snap-align: start;
}
.menu-strip img { width: 100%; height: 100%; object-fit: cover; }

/* Pastki tugmalar paneli (joy sahifasida) */
.action-bar {
  position: fixed; left: 50%; bottom: 0; z-index: 40; transform: translateX(-50%);
  width: min(var(--app-w), 100%); display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(24, 27, 32, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

/* ---------- Pastki menyu (tab bar) ---------- */
.tabbar {
  position: fixed; left: 50%; bottom: 0; z-index: 40; transform: translateX(-50%);
  width: min(var(--app-w), 100%); display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px calc(8px + var(--safe-b));
  background: rgba(30, 33, 39, .95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  display: grid; justify-items: center; gap: 3px; padding: 2px 0;
  color: var(--muted); font-size: .7rem; font-weight: 700; transition: color .2s;
}
.tab-ic { position: relative; width: 56px; height: 32px; display: grid; place-items: center; }
.tab-ic::before {
  content: ""; position: absolute; inset: 0; border-radius: 999px; background: var(--primary);
  opacity: 0; transform: scale(.35);
  transition: transform .4s cubic-bezier(.3, 1.5, .5, 1), opacity .2s;
}
.tab-ic svg { position: relative; transition: transform .15s; }
.tab:hover { color: var(--ink); }
.tab:active .tab-ic svg { transform: scale(.82); }
.tab.active { color: #fff; }
.tab.active .tab-ic::before { opacity: 1; transform: none; box-shadow: 0 6px 16px rgba(31, 138, 101, .45); }

/* ---------- Ikonkalar va animatsiyalar ---------- */
.ico { flex: none; overflow: visible; }
.ico * { transform-box: fill-box; }
.ico .fill { fill: currentColor; stroke: none; opacity: .22; }
.ico .dots { stroke-width: 2.8; }

/* Bug' (piyola, osh, choynak) */
.ico .steam { opacity: 0; transform-origin: center bottom; }
.tab.active .steam, .cat-circle .steam, .cat-badge .steam, .cp-meta .steam {
  animation: steam 2.4s ease-in-out infinite;
}
.ico .steam.s2 { animation-delay: .8s; }
.ico .steam.s3 { animation-delay: 1.6s; }
@keyframes steam {
  0% { opacity: 0; transform: translateY(2.5px) scaleY(.6); }
  35% { opacity: .95; }
  100% { opacity: 0; transform: translateY(-3px) scaleY(1.15); }
}

/* Choynak qopqog'i qaynab silkinadi */
.ico .lid { transform-origin: center bottom; }
.tab.active .lid, .cat-circle .lid, .cat-badge .lid { animation: lid 2.4s ease-in-out infinite; }
@keyframes lid {
  0%, 58%, 100% { transform: none; }
  64% { transform: translateY(-1.2px) rotate(-9deg); }
  70% { transform: translateY(-1.2px) rotate(7deg); }
  76% { transform: translateY(-.6px) rotate(-4deg); }
  82% { transform: none; }
}

/* Bo'lim tanlanganda ikonka "sakraydi" */
.tab.active .tab-ic svg { animation: pop .6s cubic-bezier(.3, 1.7, .5, 1); }
.tab.active .roof { animation: roof .7s cubic-bezier(.3, 1.8, .5, 1); }
.tab.active .door { transform-origin: center bottom; animation: grow .45s .2s both cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(.55) translateY(4px); } 100% { transform: none; } }
@keyframes roof { 0% { transform: translateY(-4px); } 100% { transform: none; } }
@keyframes grow { 0% { transform: scaleY(0); } 100% { transform: none; } }

/* Bosh sahifadagi dumaloq bo'limlar — ikonka sekin suzadi */
.cat-circle > .ico { animation: float 3.2s ease-in-out infinite; }
.cat:nth-child(2) .cat-circle > .ico { animation-delay: .5s; }
.cat:nth-child(3) .cat-circle > .ico { animation-delay: 1s; }
@keyframes float { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-3px); } }

/* Joy sahifasi: soat mili aylanadi, belgi tebranadi, telefon jiringlaydi */
.info .hand { transform-origin: center bottom; animation: spin 6s linear infinite; }
.info .hand-h { transform-origin: left top; animation: spin 72s linear infinite; }
.info .ico-pin { animation: bob 2.6s ease-in-out infinite; }
.info .ico-phone { animation: ring 3.2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.5px); } }
@keyframes ring {
  0%, 78%, 100% { transform: none; }
  82% { transform: rotate(-14deg); } 86% { transform: rotate(12deg); }
  90% { transform: rotate(-9deg); } 94% { transform: rotate(6deg); }
}

/* Menyu tugmasi: qatorlar yozilayotgandek chiziladi */
.btn-primary .ico-menu .ln { stroke-dasharray: 7; animation: write 3s ease-in-out infinite; }
.btn-primary .ico-menu .l2 { animation-delay: .2s; }
.btn-primary .ico-menu .l3 { animation-delay: .4s; }
@keyframes write {
  0% { stroke-dashoffset: 7; }
  25%, 80% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -7; }
}

/* Tugma ustiga kelganda ikonka siljiydi */
.mini-btn:hover .ico, .btn:hover .ico { animation: nudge .5s ease; }
@keyframes nudge { 40% { transform: translateY(-2px) rotate(-6deg); } }

/* Ovoz tugmasi: yoqilganda to'lqinlar harakatlanadi */
.ico-sound .wave { opacity: 0; }
.pill-btn[aria-pressed="true"] .ico-sound .x { display: none; }
.pill-btn[aria-pressed="true"] .ico-sound .wave { animation: wave 1.3s ease-in-out infinite; }
.pill-btn[aria-pressed="true"] .ico-sound .w2 { animation-delay: .25s; }
@keyframes wave { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }

/* ---------- Oynalar ---------- */
dialog { padding: 0; border: 0; color: var(--ink); background: var(--bg); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }
.sheet-dlg {
  width: min(var(--app-w), 100%); max-width: 100%; max-height: 92dvh;
  margin: auto auto 0; border-radius: 26px 26px 0 0; overflow: hidden;
}
.sheet-dlg[open] { display: flex; flex-direction: column; animation: slide-up .3s cubic-bezier(.2, .8, .2, 1); }
.dlg-head {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 14px 12px 20px; border-bottom: 1px solid var(--line);
}
.dlg-head::before {
  content: ""; position: absolute; top: 8px; left: 50%; width: 42px; height: 4px;
  border-radius: 4px; background: var(--surface-2); transform: translateX(-50%);
}
.dlg-head h3 { font-size: 1.05rem; }
.dlg-body { display: grid; gap: 12px; overflow: auto; padding: 16px 16px calc(20px + var(--safe-b)); }
.dlg-body img { width: 100%; border-radius: 14px; background: var(--surface-2); }
.dlg-body .btn { width: 100%; }

.photo-dlg { width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0; background: rgba(0, 0, 0, .95); }
.photo-dlg[open] { display: grid; place-items: center; animation: fade .2s ease; }
.photo-dlg img { max-width: 100%; max-height: 100dvh; object-fit: contain; }
.photo-dlg .sq-btn { position: fixed; top: calc(14px + var(--safe-t)); right: 16px; z-index: 2; }

@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
