/* KINO TV — iOS 14 (Cupertino) uslubi */
:root, [data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #1c1c1e;
  --cell: #1c1c1e;
  --cell-press: #2c2c2e;
  --fill: rgba(118, 118, 128, .24);
  --fill2: rgba(118, 118, 128, .18);
  --label: #ffffff;
  --label2: rgba(235, 235, 245, .6);
  --label3: rgba(235, 235, 245, .3);
  --sep: rgba(84, 84, 88, .65);
  --blue: #0a84ff;
  --yellow: #ffd60a;
  --bar: rgba(22, 22, 24, .78);
  --seg-thumb: #636366;
  --sheet: #1c1c1e;
  --cell2: #2c2c2e;
  --dim: rgba(0, 0, 0, .48);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f2f2f7;
  --bg-elev: #ffffff;
  --cell: #ffffff;
  --cell-press: #d1d1d6;
  --fill: rgba(118, 118, 128, .12);
  --fill2: rgba(118, 118, 128, .08);
  --label: #000000;
  --label2: rgba(60, 60, 67, .6);
  --label3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .29);
  --blue: #007aff;
  --yellow: #ffcc00;
  --bar: rgba(249, 249, 249, .86);
  --seg-thumb: #ffffff;
  --sheet: #f2f2f7;
  --cell2: #ffffff;
  --dim: rgba(0, 0, 0, .3);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--label); overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px; line-height: 1.29; letter-spacing: -.41px;
  -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; letter-spacing: inherit; color: var(--label); }
svg { fill: currentColor; }

/* ── Ko'rinishlar (har biri o'z aylantirishi bilan) ── */
.view { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.view .scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: calc(44px + env(safe-area-inset-top)) 0 calc(83px + env(safe-area-inset-bottom));
}
.view.push { z-index: 8; box-shadow: -10px 0 30px rgba(0,0,0,.35); }
.view.push.kirish { animation: push-in .38s cubic-bezier(.2, .9, .25, 1); }
.view.push.chiqish { animation: push-out .3s cubic-bezier(.4, 0, .6, 1) forwards; }
@keyframes push-in { from { transform: translateX(100%); } }
@keyframes push-out { to { transform: translateX(100%); } }

/* ── Navigatsiya paneli ── */
.navbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  height: calc(44px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-bottom: .5px solid transparent; transition: background .2s, border-color .2s;
}
.navbar.tinch, .navbar.solid { background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom-color: var(--sep); }
.nav-title { font-size: 17px; font-weight: 600; opacity: 0; transition: opacity .2s; max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navbar.tinch .nav-title, .navbar.solid .nav-title { opacity: 1; }
.nav-side { display: flex; align-items: center; min-width: 0; }
.nav-side.right { justify-content: flex-end; }
.nav-back, .nav-btn, .nav-icon { color: var(--blue); display: flex; align-items: center; gap: 5px; height: 44px; padding: 0 8px; }
.nav-back svg { width: 12px; height: 21px; flex: none; }
.nav-back span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28vw; }
.nav-icon svg { width: 22px; height: 22px; }
.nav-back:active, .nav-btn:active, .nav-icon:active { opacity: .35; }

/* ── Katta sarlavha ── */
.lt { padding: 3px 16px 8px; }
.lt h1 { margin: 0; font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; }
.lt p { margin: 2px 0 0; color: var(--label2); font-size: 15px; letter-spacing: -.24px; }
.lt.small h1 { font-size: 28px; line-height: 34px; letter-spacing: .36px; }

/* ── Qidiruv maydoni ── */
.searchrow { display: flex; align-items: center; gap: 0; padding: 0 16px 8px; }
.searchfield {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px;
  border-radius: 10px; background: var(--fill); color: var(--label2); text-align: left;
}
.searchfield.fake { margin: 0 16px 8px; width: calc(100% - 32px); }
.searchfield > svg { width: 17px; height: 17px; flex: none; }
.searchfield span { font-size: 17px; }
.searchfield input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; padding: 0; -webkit-user-select: text; user-select: text; }
.searchfield input::placeholder { color: var(--label2); }
.searchfield input::-webkit-search-cancel-button { display: none; }
.sf-clear { color: var(--label3); display: grid; place-items: center; width: 22px; height: 22px; }
.sf-clear svg { width: 17px; height: 17px; }
.sf-cancel { color: var(--blue); max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width .25s, opacity .2s, padding .25s; }
.searchrow.faol .sf-cancel { max-width: 90px; opacity: 1; padding-left: 10px; }

/* ── Bo'lim sarlavhalari va tokchalar ── */
.sec { margin: 22px 16px 8px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: .35px; }
h3.sec { font-size: 20px; margin: 24px 0 8px; }
.shelf-h { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 16px 10px; }
.shelf-h h2 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: .35px; }
.shelf-h button { color: var(--blue); font-size: 17px; display: flex; align-items: center; gap: 4px; }
.shelf-h button svg { width: 8px; height: 13px; }
.shelf-h button:active { opacity: .35; }
.shelf {
  display: flex; gap: 12px; overflow-x: auto; padding: 0 16px; scroll-snap-type: x mandatory; scroll-padding: 16px;
  scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf .tile { width: 62vw; max-width: 260px; flex: none; scroll-snap-align: start; }
.shelf.katta .tile { width: 84vw; max-width: 360px; }

/* ── Plitka (16:9 poster + matn) ── */
.tile { display: block; text-align: left; }
.art { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--fill); }
.art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 .5px rgba(255,255,255,.08); }
.tile:active .art { filter: brightness(.7); }
.art .rt {
  position: absolute; right: 6px; bottom: 6px; display: flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600; letter-spacing: 0; color: #fff; padding: 2px 6px; border-radius: 6px;
  background: rgba(0,0,0,.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.art .rt svg { width: 11px; height: 11px; fill: var(--yellow); }
.t-nom { margin-top: 6px; font-size: 15px; line-height: 20px; letter-spacing: -.24px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { font-size: 13px; line-height: 18px; letter-spacing: -.08px; color: var(--label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px 14px; text-align: center; }
.ph span { color: rgba(255,255,255,.55); font-weight: 700; font-size: 40px; line-height: 1; letter-spacing: 1px; }

.shelf.tik .art, .tiles.tik .art, .row.media .art.tik { aspect-ratio: 2 / 3; }
.shelf.tik .tile { width: 31vw; max-width: 150px; }
.tiles.tik { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
@media (min-width: 600px) { .tiles.tik { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tiles.tik .t-nom { font-size: 13px; line-height: 17px; }
.tiles.tik .t-sub { font-size: 12px; }
.row.media .art.tik { width: 52px; }
.hero.tik { aspect-ratio: 4 / 3; }
.hero .bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(28px) brightness(.5) saturate(1.2); }
.hero img.fg { position: relative; z-index: 1; height: 100%; width: auto; margin: 0 auto; padding: 16px 0 26px; object-fit: contain; filter: drop-shadow(0 10px 24px rgba(0,0,0,.5)); }
.hero.tik::after { z-index: 2; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; padding: 8px 16px 0; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── Guruhlangan ro'yxat (inset grouped) ── */
.group { margin: 0 16px; border-radius: 10px; overflow: hidden; background: var(--cell); }
.group:empty { display: none; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px;
  padding: 0 16px; text-align: left; background: var(--cell);
}
.row:active { background: var(--cell-press); }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--ind, 16px); border-top: .5px solid var(--sep); }
.row .grow { flex: 1; min-width: 0; padding: 11px 0; }
.row .r-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-s { font-size: 15px; letter-spacing: -.24px; color: var(--label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-v { color: var(--label2); white-space: nowrap; text-align: right; }
.row .chev { width: 8px; height: 13px; color: var(--label3); flex: none; }
.row.media { --ind: 124px; padding-top: 8px; padding-bottom: 8px; }
.row.media .art { width: 96px; flex: none; border-radius: 6px; }
.row.media .ph span { font-size: 20px; }
.row.media .grow { padding: 0; }
.row.info { pointer-events: none; }
.row.info .r-t { flex: none; }
.row.info .r-v { flex: 1; min-width: 0; white-space: normal; padding: 11px 0; }
.row .ico { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; font-size: 17px; flex: none; }
.row.bolim { --ind: 57px; }
mark { background: none; color: var(--blue); }

/* ── Janr plitkalari (Apple Music «Browse» kabi) ── */
.genres { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 16px; }
.genre {
  position: relative; height: 92px; border-radius: 10px; overflow: hidden; padding: 10px 12px; text-align: left;
  color: #fff; font-size: 17px; font-weight: 700; display: flex; align-items: flex-end;
}
.genre small { position: absolute; top: 9px; left: 12px; font-size: 13px; font-weight: 500; opacity: .75; }
.genre .g-t { position: relative; z-index: 1; max-width: 58%; line-height: 1.15; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.genre img { position: absolute; right: -8px; bottom: -10px; border-radius: 6px; transform: rotate(16deg);
  box-shadow: 0 6px 16px rgba(0,0,0,.45); object-fit: cover; }
.genre img.tk { width: 44%; aspect-ratio: 2 / 3; }
.genre img.yt { width: 62%; aspect-ratio: 16 / 9; right: -14px; bottom: -4px; }
.genre:active { filter: brightness(.8); }

/* ── Segmentli boshqaruv ── */
.seg { display: flex; margin: 0 16px 8px; padding: 2px; border-radius: 9px; background: var(--fill2); position: relative; }
.seg button { flex: 1; height: 28px; font-size: 13px; font-weight: 500; letter-spacing: -.08px; border-radius: 7px; position: relative; z-index: 1; }
.seg button[aria-selected="true"] { background: var(--seg-thumb); font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }
.count { margin: 6px 32px 6px; font-size: 13px; color: var(--label2); text-transform: uppercase; letter-spacing: -.08px; }

/* ── Bo'sh holat (ContentUnavailable) ── */
.unavail { text-align: center; padding: 48px 32px; color: var(--label2); }
.unavail svg { width: 52px; height: 52px; fill: var(--label3); }
.unavail b { display: block; color: var(--label); font-size: 22px; line-height: 28px; margin: 10px 0 6px; }
.unavail p { margin: 0; font-size: 15px; letter-spacing: -.24px; }
.link { color: var(--blue); margin-top: 14px; font-size: 17px; }
.link:active { opacity: .35; }
.foot { text-align: center; color: var(--label2); font-size: 13px; margin: 28px 16px 0; }

/* ── Tab paneli ── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; height: calc(49px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #999; padding-top: 2px; }
[data-theme="dark"] .tabbar button { color: #7d7d7d; }
.tabbar svg { width: 27px; height: 27px; }
.tabbar span { font-size: 10px; font-weight: 500; letter-spacing: .1px; }
.tabbar button[aria-selected="true"] { color: var(--blue); }

/* ── Sahifa varag'i (page sheet) ── */
.sheet, .asheet { position: fixed; inset: 0; z-index: 20; }
.dim { position: absolute; inset: 0; background: var(--dim); animation: fade .3s ease; }
.sheet.yopil .dim, .asheet.yopil .dim { animation: fade-out .25s ease forwards; }
.page {
  position: absolute; left: 0; right: 0; bottom: 0; top: calc(10px + env(safe-area-inset-top));
  margin: 0 auto; max-width: 600px; background: var(--sheet); border-radius: 12px 12px 0 0; overflow: hidden;
  animation: sheet-up .42s cubic-bezier(.2, .9, .25, 1);
}
.sheet.yopil .page { animation: sheet-down .28s cubic-bezier(.4, 0, .8, .6) forwards; }
.page-in { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
.grab { position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--label3); z-index: 2; }
.close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.4); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.close svg { width: 30px; height: 30px; fill: rgba(255,255,255,.85); }
.hero { position: relative; aspect-ratio: 16 / 9; margin: 0 -16px; background: var(--fill); overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .ph span { font-size: 72px; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: linear-gradient(transparent, var(--sheet)); }
.d-nom { margin: -6px 0 0; position: relative; font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: .36px; -webkit-user-select: text; user-select: text; }
.d-asl { margin: 2px 0 0; color: var(--label2); font-size: 15px; letter-spacing: -.24px; }
.d-asl:empty { display: none; }
.d-line { margin: 6px 0 0; color: var(--label2); font-size: 15px; letter-spacing: -.24px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; }
.d-line svg { width: 13px; height: 13px; fill: var(--yellow); vertical-align: -1px; }
.d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.d-actions .filled { grid-column: 1 / -1; }
.btn.tinted.on { color: var(--label); }
.btn { height: 50px; border-radius: 12px; font-size: 17px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 7px; }
.btn svg { width: 18px; height: 18px; }
.btn.filled { background: var(--blue); color: #fff; }
.btn.tinted { background: var(--fill); color: var(--blue); }
.btn:active { opacity: .6; }
.d-mazmun { margin: 16px 0 0; font-size: 15px; line-height: 20px; letter-spacing: -.24px; -webkit-user-select: text; user-select: text; }
.d-mazmun:empty { display: none; }
.page .group { margin: 0; background: var(--cell2); }
.page .row { background: var(--cell2); }
.page .sec { margin-left: 0; }

/* ── Action sheet ── */
.as-wrap { position: absolute; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); max-width: 420px; margin: 0 auto; animation: sheet-up .35s cubic-bezier(.2, .9, .25, 1); }
.asheet.yopil .as-wrap { animation: sheet-down .25s ease forwards; }
.as-group { border-radius: 13px; overflow: hidden; background: var(--bar); backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px); max-height: 60vh; overflow-y: auto; }
[data-theme="dark"] .as-group { background: rgba(37, 37, 37, .86); }
.as-title { margin: 0; padding: 14px 16px; text-align: center; font-size: 13px; font-weight: 600; color: var(--label2); border-bottom: .5px solid var(--sep); }
.as-opt { display: block; width: 100%; height: 57px; font-size: 20px; color: var(--blue); letter-spacing: .38px; }
.as-opt + .as-opt { border-top: .5px solid var(--sep); }
.as-opt.on { font-weight: 600; }
.as-opt:active, .as-cancel:active { background: var(--fill); }
.as-cancel { display: block; width: 100%; height: 57px; margin-top: 8px; border-radius: 13px; font-size: 20px; font-weight: 600; color: var(--blue); background: var(--bg-elev); letter-spacing: .38px; }

/* ── YANGI belgisi ── */
.art .yb {
  position: absolute; left: 6px; top: 6px; font-size: 10px; font-weight: 700; letter-spacing: .3px; color: #fff;
  padding: 2px 6px; border-radius: 5px; background: #ff3b30;
}

/* ── Qismlar to'ri ── */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 14px; border-radius: 16px; background: var(--fill); font-size: 15px; letter-spacing: -.24px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--blue); color: #fff; font-weight: 600; }
.eps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.ep { height: 40px; border-radius: 9px; background: var(--cell2); font-size: 15px; font-variant-numeric: tabular-nums; }
.ep:active { background: var(--fill); }
.ep.korilgan { color: var(--label3); }
.ep.joriy { background: var(--blue); color: #fff; font-weight: 600; }
#d-qismlar .sec { margin-top: 22px; }

/* ── Skelet (birinchi ochilishda, katalog kelguncha) ── */
.skel { margin-top: 24px; }
.sk-h { width: 46%; height: 22px; border-radius: 6px; margin: 0 16px 12px; background: var(--fill); }
.art.sk, .sk-h { animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { 50% { opacity: .45; } }
.skel .shelf { overflow: hidden; }

/* katta ro'yxatlarda ekrandan tashqaridagi kartochkalar chizilmaydi (tez aylanadi) */
.tiles .tile { content-visibility: auto; contain-intrinsic-size: auto 260px; }
.group .row.media { content-visibility: auto; contain-intrinsic-size: auto 72px; }

@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }

@media (min-width: 700px) {
  .view .scroll > * { max-width: 900px; margin-left: auto; margin-right: auto; }
  .searchfield.fake { width: auto; }
  .shelf .tile { width: 260px; }
  .shelf.katta .tile { width: 380px; }
}
