/* O'z palitramiz (kun / tun): Telegram mavzusidan qat'i nazar foydalanuvchi tanlagan rejim ishlaydi.
   Rejim <html class="dark"> bilan almashadi; Telegram sarlavhasi va tugmasi JS'da shu ranglarga moslanadi. */
:root {
  color-scheme: light;
  --bg: #efeff4;
  --card: #ffffff;
  --text: #0f0f0f;
  --hint: #8e8e93;
  --link: #2481cc;
  --btn: #2481cc;
  --btn-text: #ffffff;
  --sep: rgba(128, 128, 128, .22);
  --shimmer: rgba(128, 128, 128, .14);
  --ok: #34c759;
  --warn: #ff9f0a;
  --err: #ff3b30;
  --radius: 16px;
  --pill-bg: #fff1cf;
  --pill-text: #b86e00;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }   /* iOS tugma chekinishi — kartada oq chet qoldirardi */
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.view { min-height: 100vh; padding-bottom: calc(24px + var(--safe-b)); }

/* ---------------- yuqori panel */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center;
  padding: 10px 12px 6px; background: var(--bg); }
.col-btn { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px 6px 6px;
  background: var(--card); border-radius: 14px; text-align: left; }
.col-img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.col-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.col-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
.col-text small { color: var(--hint); font-size: 12px; }
.chev { color: var(--hint); font-size: 13px; }
.icon-btn { position: relative; width: 50px; height: 50px; border-radius: 14px; background: var(--card); font-size: 22px; }
.icon-btn i { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--err); }

/* ---------------- bosh sahifa: kolleksiyalar */
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 10px; }
.home-titles { min-width: 0; }
.home-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.hdr-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; background: var(--card); font-size: 19px; }
.hdr-btn.lang { width: 46px; font-size: 14px; font-weight: 800; letter-spacing: .3px; color: var(--link); }
.hdr-btn i { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--err); }
.home-title { margin: 0; font-size: 24px; font-weight: 800; }
.home-sub { margin-top: 2px; color: var(--hint); font-size: 13px; }
.col-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 10px; }
.col-card { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 12px 6px 10px;
  border-radius: var(--radius); background: var(--card); animation: pop .25s ease both; }
.col-card.over { opacity: .55; }
.col-card.skeleton { height: 158px; background: linear-gradient(100deg, var(--card) 30%, rgba(128, 128, 128, .12) 50%, var(--card) 70%);
  background-size: 300% 100%; animation: shimmer 1.2s infinite linear; }
.col-media { position: relative; width: 78%; aspect-ratio: 1; }
.col-thumb { display: block; width: 100%; height: 100%; object-fit: contain; }
.col-thumb.cover { object-fit: cover; border-radius: 14px; }
.col-card-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.col-card-price { display: inline-flex; align-items: baseline; gap: 3px; padding: 4px 10px; border-radius: 12px;
  background: var(--pill-bg); color: var(--pill-text); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.col-card-price small { font-size: 10px; font-weight: 600; opacity: .85; }
.home-retry { margin-top: 14px; padding: 0 22px; }

/* ---------------- filtr chiplari */
.chips { position: sticky; top: 62px; z-index: 4; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 12px 10px; background: var(--bg); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 18px; background: var(--card); font-weight: 600; font-size: 14px; white-space: nowrap;
  max-width: 62vw; }
.chip .chip-label { overflow: hidden; text-overflow: ellipsis; }
.chip.active { background: var(--btn); color: var(--btn-text); }
.chip.active .chev { color: var(--btn-text); }
.chip-ico { font-size: 15px; }
.summary { padding: 0 14px 8px; color: var(--hint); font-size: 12.5px; }

/* ---------------- kartalar to'ri (3 ustun) */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 10px; }
.gift { position: relative; aspect-ratio: 0.8; border-radius: var(--radius); overflow: hidden;
  background: var(--card); animation: pop .25s ease both; }
.gift .gift-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gift .ribbon, .gift .price { z-index: 2; }
.gift.over { opacity: .55; }
.gift.skeleton { background: linear-gradient(100deg, var(--card) 30%, var(--shimmer) 50%, var(--card) 70%);
  background-size: 300% 100%; animation: shimmer 1.2s infinite linear; }
.ribbon { position: absolute; top: 9px; right: -26px; width: 92px; transform: rotate(45deg); text-align: center;
  padding: 2px 0; font-size: 10px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .3);
  letter-spacing: .2px; }   /* fonni xiralashtirish (blur) yo'q: 30+ kartada iOS aylantirishni qotirardi */
.price { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: inline-flex; gap: 3px;
  align-items: baseline; padding: 4px 10px; border-radius: 12px; background: rgba(0, 0, 0, .4); color: #fff;
  font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.price small { font-weight: 600; font-size: 10px; opacity: .85; }
.sentinel { height: 40px; }
.empty { padding: 40px 20px; text-align: center; color: var(--hint); }

/* ---------------- sovg'a sahifasi */
.hero { position: relative; aspect-ratio: 1; margin: 10px 12px 0; border-radius: 22px; overflow: hidden; background: var(--card); }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* .tgs — to'liq kompozitsiya (fon + naqsh + model, 512x512), rasm ustiga to'liq yopiladi */
.hero-anim { position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity .25s ease; }
.hero-anim svg { display: block; width: 100% !important; height: 100% !important; }
.hero.animated .hero-anim { opacity: 1; }
.hero-num { position: absolute; z-index: 3; top: 12px; right: 12px; padding: 3px 10px; border-radius: 10px;
  background: rgba(0, 0, 0, .3); color: #fff; font-weight: 700; font-size: 13px; }
.card-body { margin: 12px; padding: 16px; background: var(--card); border-radius: var(--radius); }
.card-body h1 { margin: 0 0 12px; font-size: 21px; }
.attrs { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin-bottom: 14px; }
.attrs dt { color: var(--hint); }
.attrs dd { margin: 0; font-weight: 600; text-align: right; }
.price-box { padding: 12px 0; border-top: 1px solid var(--sep); border-bottom: 1px solid var(--sep); margin-bottom: 14px; }
.price-main { font-size: 26px; font-weight: 800; }
.price-main small { font-size: 15px; font-weight: 600; color: var(--hint); }
.field { display: block; }
.field > span { display: block; margin-bottom: 6px; color: var(--hint); font-size: 13px; }
.field-row { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 12px; background: var(--bg); }
.field-row .at { color: var(--hint); font-weight: 700; }
.field-row input { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: none; color: var(--text); font-size: 16px; }
.field-hint { display: block; margin-top: 6px; color: var(--hint); font-size: 12px; }
.field-hint.error { color: var(--err); }
.ghost { padding: 8px 12px; border-radius: 10px; color: var(--link); font-weight: 600; font-size: 14px; }

/* ---------------- buyurtma */
.order-head { display: flex; gap: 12px; align-items: center; margin: 12px; padding: 12px; background: var(--card); border-radius: var(--radius); }
.order-img { width: 64px; height: 80px; border-radius: 12px; object-fit: cover; background: var(--bg); }
.order-title { font-weight: 700; font-size: 16px; }
.order-meta { margin-top: 3px; color: var(--hint); font-size: 13px; }
.status-pill { margin: 0 12px 10px; padding: 10px 14px; border-radius: 12px; background: var(--card); font-weight: 600; }
.status-pill.ok { color: var(--ok); } .status-pill.warn { color: var(--warn); } .status-pill.err { color: var(--err); }
.note { margin: 0 12px 10px; padding: 12px 14px; border-radius: 12px; background: var(--card); color: var(--hint); font-size: 13.5px; }
.progress, .report { margin: 0 12px 10px; padding: 14px; border-radius: var(--radius); background: var(--card);
  font-size: 14px; line-height: 1.55; word-break: break-word; }
.report code { font-size: 11.5px; word-break: break-all; }
.actions { display: flex; flex-direction: column; gap: 8px; margin: 4px 12px; }
.btn { height: 48px; border-radius: 12px; background: var(--btn); color: var(--btn-text); font-weight: 700; }
.btn.secondary { background: var(--card); color: var(--link); }
.btn.danger { background: var(--card); color: var(--err); }

/* ---------------- to'lov oynasi (bot rejimi: karta / Paynet Mini App ichida) */
.pay { margin: 0 12px 10px; padding: 14px; border-radius: var(--radius); background: var(--card); }
.pay-title { margin-bottom: 8px; font-weight: 700; font-size: 16px; }
.pay-methods { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--sep); }
.pay-kv { display: flex; flex-direction: column; min-width: 0; }
.pay-kv .k { color: var(--hint); font-size: 12.5px; }
.pay-kv .v { font-size: 17px; font-weight: 700; letter-spacing: .2px; word-break: break-word; }
.pay-copy { flex: 0 0 auto; padding: 8px 12px; border-radius: 10px; background: var(--bg); color: var(--link);
  font-weight: 600; font-size: 13.5px; }
.pay-copy:active { opacity: .6; }
.pay-warn { margin: 12px 0 4px; padding: 10px 12px; border-radius: 12px; white-space: pre-line; font-size: 13.5px;
  background: rgba(255, 159, 10, .13); }
.pay-warn:first-child { margin-top: 0; }
.pay-field { margin-top: 12px; }
.pay-field > .k { display: block; margin-bottom: 6px; color: var(--hint); font-size: 13px; }
.pay-field input { font-size: 18px; font-weight: 700; letter-spacing: .3px; }
.pay-confirm { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .55; }
.pay-timer { margin-top: 12px; font-weight: 700; font-size: 15px; }
.pay-timer.low { color: var(--err); }
.pay-wait { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; color: var(--hint); font-size: 13.5px; }
.spin { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--sep); border-top-color: var(--link); animation: spin .9s linear infinite; }
.pay-support { margin-top: 10px; color: var(--hint); font-size: 13px; }
.pay-link { display: block; margin: 12px auto 0; padding: 6px 10px; color: var(--link); font-weight: 600; font-size: 14px; }
.home-pay { display: block; width: calc(100% - 20px); margin: 0 10px 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--pill-bg); color: var(--pill-text); font-weight: 700; font-size: 14px; text-align: left; }

/* ---------------- buyurtmalarim */
.section-title { margin: 14px 14px 8px; font-size: 20px; }
.orders-list { display: flex; flex-direction: column; gap: 8px; padding: 0 12px; }
.order-row { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--card); text-align: left; }
.order-row img { width: 44px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.order-row .t { font-weight: 600; } .order-row .s { color: var(--hint); font-size: 12.5px; margin-top: 2px; }

/* ---------------- pastki oyna */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .35); animation: fade .15s ease both; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 78vh; display: flex; flex-direction: column;
  padding: 8px 0 calc(8px + var(--safe-b)); border-radius: 18px 18px 0 0; background: var(--card); animation: up .2s ease both; }
.sheet-grip { width: 38px; height: 5px; margin: 0 auto 8px; border-radius: 3px; background: var(--sep); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 16px 8px; font-size: 17px; }
.sheet-search { flex: 0 0 auto; margin: 0 12px 8px; height: 38px; padding: 0 12px; border: 0; border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 16px; outline: 0; -webkit-appearance: none; appearance: none; }
.sheet-list { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 16px; text-align: left; }
.opt + .opt { border-top: 1px solid var(--sep); }
.opt img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; background: var(--bg); }
.opt .o-main { flex: 1; min-width: 0; }
.opt .o-main b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt .o-main small { color: var(--hint); font-size: 12px; }
.opt.sel .o-check { color: var(--btn); font-weight: 800; }
.opt .o-check { flex: 0 0 18px; text-align: right; }
.o-line { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.o-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.o-num { flex: 0 0 auto; font-weight: 700; font-size: 15px; }
/* filtr ikonkalari: model — rasm, naqsh — bir rangli belgi, fon — rangli doira */
.opt img.o-art { flex: 0 0 36px; width: 36px; height: 36px; object-fit: contain; border-radius: 0; background: none; }
.opt img.o-art.art-b { border-radius: 50%; }
.opt img.o-art.ph, .attr-ico.ph { border-radius: 50%; background: var(--bg); }
.attr-ico { display: inline-block; width: 22px; height: 22px; margin-right: 7px; vertical-align: -6px; object-fit: contain; }
.attr-ico.art-b { border-radius: 50%; }
.rarity { display: inline-block; margin-left: 7px; padding: 2px 8px; border-radius: 10px; vertical-align: 1px;
  background: color-mix(in srgb, var(--link) 14%, transparent); color: var(--link); font-size: 12.5px; font-weight: 600; }
@supports not (color: color-mix(in srgb, red 50%, blue)) { .rarity { background: rgba(36, 129, 204, .14); } }
.dark .art-s { filter: invert(1); }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 40; transform: translateX(-50%);
  max-width: 88vw; padding: 10px 16px; border-radius: 12px; background: rgba(20, 20, 20, .88); color: #fff;
  font-size: 14px; text-align: center; animation: fade .15s ease both; }
.fatal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 30px; background: var(--bg); color: var(--hint); text-align: center; font-size: 15px; }

:root.dark {
  color-scheme: dark;
  --bg: #0e0e10;
  --card: #1c1c1e;
  --text: #f2f2f7;
  --hint: #8e8e93;
  --link: #5ea8ff;
  --btn: #3a8df0;
  --btn-text: #ffffff;
  --sep: rgba(255, 255, 255, .09);
  --shimmer: rgba(255, 255, 255, .07);
  --pill-bg: rgba(255, 176, 32, .16);
  --pill-text: #ffbf47;
}
html, body { transition: background-color .2s ease, color .2s ease; }


@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
