@font-face {
  font-family: 'GiaoLong';
  src: url('/fonts/giao_long.ttf') format('truetype');
  font-display: swap;
}

:root {
  --bg: #0B0C0F;
  --surface: #16181D;
  --surface2: #1F2228;
  --surface3: #2E323A;
  --line: #2A2E36;
  --text: #F2F3F5;
  --dim: #9AA0AA;
  --faint: #5E646E;
  --accent: #8B7CFF;
  --ok: #6FDC9A;
  --warn: #FFB86B;
  --err: #FF7A7A;
  --rail: 76px;
  --gutter: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
img { display: block; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
svg.i { width: 22px; height: 22px; fill: currentColor; flex: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- điều hướng ---------- */
#nav {
  position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--rail);
  padding: calc(36px + var(--safe-t)) 14px 36px calc(14px + var(--safe-l));
  display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(90deg, rgba(11,12,15,.8), rgba(11,12,15,0));
  transition: width .2s, background .2s;
  overflow: hidden;
}
#nav:hover, #nav:focus-within {
  width: 220px;
  background: linear-gradient(90deg, rgba(11,12,15,.95), rgba(11,12,15,.9) 70%, rgba(11,12,15,0));
}
#nav .logo { display: flex; align-items: center; gap: 10px; height: 40px; padding-left: 12px; margin-bottom: 24px; white-space: nowrap; font-weight: 700; font-size: 17px; }
#nav .logo img { height: 26px; width: auto; }
#nav .logo span, #nav .item span { opacity: 0; transition: opacity .2s; }
#nav:hover .logo span, #nav:hover .item span, #nav:focus-within .item span, #nav:focus-within .logo span { opacity: 1; }
#nav .item {
  display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 12px; border-radius: 12px;
  color: var(--dim); white-space: nowrap; font-weight: 600; font-size: 14px;
}
#nav .item:hover { background: var(--surface2); color: #fff; }
#nav .item.on { color: var(--accent); }
#nav .item.on span { color: #fff; }
#view { padding-left: var(--rail); min-height: 100vh; }

@media (max-width: 899px) {
  :root { --gutter: 16px; }
  #nav {
    top: auto; right: 0; width: auto; height: calc(60px + var(--safe-b));
    flex-direction: row; justify-content: space-around; align-items: flex-start; gap: 0;
    padding: 6px var(--safe-r) var(--safe-b) var(--safe-l);
    background: rgba(14,15,19,.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }
  #nav:hover, #nav:focus-within { width: auto; background: rgba(14,15,19,.94); }
  #nav .logo { display: none; }
  #nav .item { flex-direction: column; gap: 2px; height: 48px; padding: 4px 10px; font-size: 11px; justify-content: center; }
  #nav .item span { opacity: 1 !important; }
  #nav .item:hover { background: none; }
  #view { padding-left: 0; padding-bottom: calc(76px + var(--safe-b)); }
}

/* ---------- chung ---------- */
.page { padding: calc(32px + var(--safe-t)) var(--gutter) 40px; }
.page h1 { font-size: 26px; margin: 0 0 6px; }
.center-msg { padding: 60px var(--gutter); color: var(--dim); text-align: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 22px;
  background: var(--surface2); color: #fff; font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform .15s, background .15s;
}
.pill:hover { background: var(--surface3); }
.pill:active { transform: scale(.97); }
.pill.primary { background: var(--accent); }
.pill.primary:hover { background: #9a8dff; }
.pill svg.i { width: 20px; height: 20px; }
.pill.small { height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn { width: 40px; height: 40px; border-radius: 20px; background: var(--surface2); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface3); }
.icon-btn svg.i { width: 20px; height: 20px; }
.field {
  width: 100%; height: 48px; padding: 0 16px 0 44px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); font-size: 16px;
}
.field:focus { border-color: #fff; }
.field-wrap { position: relative; }
.field-wrap svg.i { position: absolute; left: 14px; top: 13px; color: var(--dim); }

/* ---------- hàng phim ---------- */
.row { margin-top: 22px; }
.row h2 { font-size: 17px; margin: 0 0 10px; padding: 0 var(--gutter); font-weight: 650; }
.scroller-wrap { position: relative; }
.scroller {
  display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden; padding: 6px var(--gutter) 10px;
  scroll-snap-type: x proximity; scroll-padding: 0 var(--gutter); scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; flex: none; }
.arrow {
  position: absolute; top: 6px; bottom: 10px; width: 44px; z-index: 2; display: grid; place-items: center;
  background: linear-gradient(90deg, rgba(11,12,15,.9), rgba(11,12,15,0)); opacity: 0; transition: opacity .2s;
}
.arrow.r { right: 0; background: linear-gradient(270deg, rgba(11,12,15,.9), rgba(11,12,15,0)); }
.arrow.l { left: 0; }
.scroller-wrap:hover .arrow { opacity: 1; }
@media (hover: none) { .arrow { display: none; } }
/* danh sách tập xoay vòng: luôn hiện nút ‹ › (cả trên điện thoại) */
.scroller-wrap.loop .arrow { display: grid; opacity: 1; width: 40px; }
.scroller-wrap.loop .arrow svg.i { width: 30px; height: 30px; filter: drop-shadow(0 1px 3px #000); }

.card { position: relative; border-radius: 12px; overflow: hidden; background: var(--surface); cursor: pointer; transition: transform .18s, box-shadow .18s; }
.card:hover, .card:focus-visible { transform: scale(1.04); box-shadow: 0 0 0 3px #fff; outline: none; z-index: 1; }
.card img { width: 100%; height: 100%; object-fit: cover; }
.card.poster { width: 150px; aspect-ratio: 2/3; }
.card.landscape { width: 280px; aspect-ratio: 16/9; }
.card.square { width: 170px; aspect-ratio: 1; }
.card .noimg { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; text-align: center; font-weight: 600; color: var(--dim); }
.card.cont { width: 300px; aspect-ratio: 16/9; }
.card.cont .fit { position: absolute; inset: 0; }
.card.cont .shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.85), rgba(0,0,0,0) 60%); }
.card.cont .cap { position: absolute; left: 12px; right: 12px; bottom: 14px; }
.card.cont .cap b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.cont .cap small { color: #cfd3da; font-size: 12px; }
.card.cont .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.2); }
.card.cont .bar i { display: block; height: 100%; background: var(--accent); }
.card .rm {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(0,0,0,.6); opacity: 0; transition: opacity .15s;
}
.card:hover .rm { opacity: 1; }
@media (hover: none) { .card .rm { opacity: .9; } .card:hover { transform: none; box-shadow: none; } }
@media (max-width: 899px) {
  .card.poster { width: 112px; }
  .card.landscape { width: 220px; }
  .card.square { width: 130px; }
  .card.cont { width: 240px; }
  .scroller { gap: 10px; }
}

/* ảnh vừa khung: cùng tỉ lệ thì lấp đầy, khác tỉ lệ thì hiện trọn trên nền mờ */
.fit { position: relative; overflow: hidden; background: var(--surface2); }
.fit img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fit img.blur { filter: blur(18px) brightness(.45); transform: scale(1.2); display: none; }
.fit.mismatch img.blur { display: block; }
.fit.mismatch img.main { object-fit: contain; }

/* ---------- trang chủ ---------- */
.home { position: relative; }
.hero { position: relative; min-height: 330px; }
.hero .backdrop { position: absolute; right: 0; top: 0; width: 78%; aspect-ratio: 16/9; max-height: 82vh; overflow: hidden; }
.hero .backdrop img { width: 100%; height: 100%; object-fit: cover; object-position: right top; transition: opacity .5s; }
.hero .backdrop::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, var(--bg) 0%, rgba(11,12,15,.6) 30%, rgba(11,12,15,0) 55%); }
.hero .backdrop::after { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(11,12,15,0) 50%, rgba(11,12,15,.9) 85%, var(--bg)); }
.hero .info { position: relative; z-index: 2; padding: calc(32px + var(--safe-t)) var(--gutter) 0; max-width: 640px; min-height: 280px; }
.hero .info .logo { max-height: 70px; max-width: 320px; object-fit: contain; object-position: left center; }
.title-cali { font-family: 'GiaoLong', serif; font-weight: normal; font-size: 46px; line-height: 1.25; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metaline { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin-top: 10px; color: #fff; font-size: 15px; }
.metaline .dot { color: var(--faint); }
.metaline .star { color: #FFC94D; }
.genres { color: var(--dim); font-size: 13px; margin-top: 4px; }
.desc { color: #C9CDD4; font-size: 14px; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.home .rows { position: relative; z-index: 2; padding-bottom: 60px; }
@media (max-width: 899px) {
  .hero { min-height: 0; }
  .hero .backdrop { position: relative; width: 100%; max-height: none; }
  .hero .backdrop::before { background: linear-gradient(180deg, rgba(11,12,15,.4), rgba(11,12,15,0) 25%); }
  .hero .info { margin-top: -90px; min-height: 0; padding-top: 0; }
  .title-cali { font-size: 36px; }
  .desc { -webkit-line-clamp: 3; }
}

/* ---------- trang phim ---------- */
.detail { position: relative; min-height: 100vh; }
.detail .bg { position: fixed; inset: 0 0 0 var(--rail); z-index: 0; }
.detail .bg img { width: 100%; height: 100%; object-fit: cover; }
.detail .bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--bg) 0%, rgba(11,12,15,.9) 45%, rgba(11,12,15,.2) 100%), linear-gradient(180deg, rgba(11,12,15,0) 50%, var(--bg)); }
.detail .content { position: relative; z-index: 1; padding: calc(36px + var(--safe-t)) var(--gutter) 60px; }
.detail .back { display: none; }
.detail .title-cali { font-size: 52px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.detail .desc { max-width: 820px; -webkit-line-clamp: 4; font-size: 15px; }
.detail .cast { color: var(--dim); font-size: 13px; margin-top: 10px; max-width: 820px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; align-items: center; }
.season-dd { position: relative; }
.season-menu {
  position: absolute; top: 52px; left: 0; z-index: 20; width: 200px; max-height: 300px; overflow-y: auto;
  padding: 10px; border-radius: 16px; background: rgba(24,26,32,.97); box-shadow: 0 12px 40px rgba(0,0,0,.5);
  display: flex; flex-direction: column; gap: 6px;
}
.season-menu button { height: 38px; border-radius: 19px; background: var(--surface2); font-weight: 600; }
.season-menu button:hover { background: var(--surface3); }
.season-menu button.on { background: #F2F3F5; color: #0B0C0F; }
.eps { margin-top: 30px; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); }
.ep {
  width: 196px; height: 132px; flex: none; display: flex; border-radius: 12px; overflow: hidden;
  background: var(--surface); text-align: left; transition: transform .18s, box-shadow .18s;
}
.ep:hover, .ep:focus-visible { transform: scale(1.04); box-shadow: 0 0 0 3px #fff; outline: none; }
.ep .fit { width: 88px; height: 100%; flex: none; }
.ep .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 14px; }
.ep .meta b { font-size: 16px; }
.ep .meta .t { font-size: 12px; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.ep .meta .sp { flex: 1; }
.ep .meta .w { font-size: 12px; color: var(--accent); }
.ep .meta .d { font-size: 12px; color: var(--dim); }
@media (max-width: 899px) {
  .detail .bg { position: absolute; inset: 0 0 auto 0; height: 62vw; }
  .detail .bg::after { background: linear-gradient(180deg, rgba(11,12,15,.3), rgba(11,12,15,.2) 40%, var(--bg)); }
  .detail .content { padding-top: calc(38vw + var(--safe-t)); }
  .detail .back { display: inline-grid; position: absolute; top: calc(12px + var(--safe-t)); left: 12px; z-index: 3; background: rgba(0,0,0,.45); }
  .detail .title-cali { font-size: 40px; }
  .actions { gap: 10px; }
  .actions .pill { height: 42px; padding: 0 16px; }
  .actions .pill.primary { flex: 1 1 100%; justify-content: center; }
}

/* ---------- bảng chọn nguồn (trang phim) ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); }
.sheet {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: 470px; max-width: 100%;
  background: linear-gradient(90deg, rgba(16,17,21,.95), rgba(16,17,21,.99));
  padding: calc(40px + var(--safe-t)) 28px calc(30px + var(--safe-b)); overflow-y: auto;
}
.sheet h3 { margin: 0; font-size: 22px; }
.src {
  display: block; width: 100%; text-align: left; margin-top: 10px; padding: 14px; border-radius: 12px; background: var(--surface);
}
.src:hover { background: var(--surface2); }
.src b { display: block; font-size: 14px; }
.src small { display: block; color: var(--dim); font-size: 12px; white-space: pre-line; }
.src .tag { color: var(--accent); font-size: 12px; }
.src .bad { color: var(--err); font-size: 12px; }
@media (max-width: 899px) {
  .sheet { top: auto; left: 0; width: 100%; max-height: 80vh; border-radius: 18px 18px 0 0; padding-top: 24px; }
}

/* ---------- addon ---------- */
.addons { display: grid; grid-template-columns: 1fr 380px; gap: 40px; }
.addons > * { min-width: 0; }
.addon-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 12px; background: var(--surface); margin-top: 10px; }
.addon-row .logo { width: 44px; height: 44px; border-radius: 10px; background: var(--surface2); display: grid; place-items: center; flex: none; overflow: hidden; font-weight: 700; }
.addon-row .logo img { width: 34px; height: 34px; object-fit: contain; }
.addon-row .txt { flex: 1; min-width: 0; }
.addon-row .txt b { overflow-wrap: anywhere; }
.addon-row .txt b { font-size: 15px; }
.addon-row .txt small { display: block; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addon-row .btns { display: flex; gap: 8px; }
.box { background: var(--surface); border-radius: 16px; padding: 22px; }
.msg { margin-top: 10px; font-size: 13px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--err); }
@media (max-width: 899px) {
  .addons { grid-template-columns: 1fr; gap: 24px; }
  .addons .add-col { order: -1; }
}

/* ---------- thư viện ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-top: 12px; }
.grid .card.poster { width: auto; }
@media (max-width: 899px) { .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; } }

/* ---------- thông báo nhỏ ---------- */
#toast {
  position: fixed; z-index: 90; right: 48px; bottom: calc(40px + var(--safe-b)); padding: 12px 20px; border-radius: 12px;
  background: rgba(16,17,21,.95); color: #fff; font-weight: 600; font-size: 14px; opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px);
}
#toast.on { opacity: 1; transform: none; }
@media (max-width: 899px) { #toast { right: 16px; left: 16px; bottom: calc(76px + var(--safe-b)); text-align: center; } }

/* ---------- trình phát ---------- */
.player { position: fixed; inset: 0; z-index: 60; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.player .loading { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: #000; transition: opacity .45s; }
.player .loading img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; filter: blur(2px); }
.player .loading::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(0,0,0,.75), rgba(0,0,0,.55), rgba(0,0,0,.9)); }
.player .loading .box2 { position: relative; z-index: 2; width: min(520px, 86vw); text-align: center; }
.player .loading .lt { font-family: 'GiaoLong', serif; font-size: 54px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .loading .prog { height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); margin-top: 22px; overflow: hidden; }
.player .loading .prog i { display: block; height: 100%; width: 5%; background: var(--accent); transition: width .3s; }
.player .loading .st { margin-top: 14px; color: #ddd; font-size: 15px; min-height: 22px; }
.player.started .loading { opacity: 0; pointer-events: none; }

.player .subs {
  position: absolute; left: 6%; right: 6%; z-index: 6; text-align: center; pointer-events: none;
  bottom: calc(8% + var(--sub-pos, 0%));
}
.player .subs span {
  display: inline; white-space: pre-line; color: #fff; padding: 2px 8px; line-height: 1.5;
  font-size: calc(clamp(18px, 3.6vh, 44px) * var(--sub-scale, 1));
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.player .subs.bg0 span { background: #000; }
.player .subs.bg1 span { background: rgba(0,0,0,.55); }
.player .subs.bg2 span { background: none; text-shadow: 0 0 3px #000, 0 0 3px #000, 1px 1px 2px #000, -1px -1px 2px #000; }

.player .ui { position: absolute; inset: 0; z-index: 10; transition: opacity .25s; }
.player.hide-ui .ui { opacity: 0; pointer-events: none; }
.player.hide-ui { cursor: none; }
.player .top {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; gap: 16px;
  padding: calc(24px + var(--safe-t)) calc(40px + var(--safe-r)) 48px calc(40px + var(--safe-l));
  background: linear-gradient(180deg, rgba(0,0,0,.8), rgba(0,0,0,0));
}
.player .top .t { flex: 1; min-width: 0; }
.player .top .t b { display: block; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .top .t small { display: block; color: rgba(255,255,255,.8); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .top .t .inf { color: rgba(255,255,255,.7); font-size: 13px; margin-top: 4px; }
.player .tb { display: flex; gap: 12px; flex: none; }
.pbtn { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 18px; border-radius: 12px; background: rgba(40,43,50,.7); font-size: 15px; font-weight: 600; white-space: nowrap; }
.pbtn:hover { background: rgba(70,74,84,.9); }
.player .bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 40px calc(28px + var(--safe-r)) calc(18px + var(--safe-b)) calc(28px + var(--safe-l));
  background: linear-gradient(0deg, rgba(0,0,0,.85), rgba(0,0,0,0));
}
.seek { position: relative; height: 22px; cursor: pointer; touch-action: none; }
.seek .track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
.seek .buf { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.35); border-radius: 2px; }
.seek .pos { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; border-radius: 2px; }
.seek .knob { position: absolute; top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 8px; background: #fff; }
.seek .hint { position: absolute; bottom: 24px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.8); font-size: 13px; display: none; }
.seek:hover .hint { display: block; }
.ctrl { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ctrl .time { font-size: 15px; font-variant-numeric: tabular-nums; margin-left: 8px; white-space: nowrap; }
.ctrl .time span { color: rgba(255,255,255,.65); }
.ctrl .sp { flex: 1; }
.cbtn { width: 46px; height: 46px; border-radius: 23px; display: grid; place-items: center; }
.cbtn:hover { background: rgba(255,255,255,.12); }
.cbtn svg.i { width: 28px; height: 28px; }
.cbtn.big svg.i { width: 34px; height: 34px; }
.player .center-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 11; width: 84px; height: 84px; border-radius: 42px; background: rgba(0,0,0,.55); display: grid; place-items: center; }
.player .center-play svg.i { width: 46px; height: 46px; }
.player .badge { position: absolute; top: 50%; z-index: 12; transform: translateY(-50%); padding: 10px 18px; border-radius: 22px; background: rgba(0,0,0,.65); font-weight: 700; font-size: 18px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.player .badge.on { opacity: 1; }
.player .badge.r { right: 10%; } .player .badge.l { left: 10%; }
.player .upnext {
  position: absolute; right: calc(40px + var(--safe-r)); bottom: calc(130px + var(--safe-b)); z-index: 12; padding: 14px 18px; border-radius: 14px;
  background: rgba(16,17,21,.92); border: 2px solid #fff; text-align: left; max-width: 340px;
}
.player .upnext b { display: block; font-size: 16px; }
.player .upnext small { display: block; color: var(--dim); }
.player .upnext em { display: block; font-style: normal; margin-top: 6px; color: var(--accent); font-weight: 700; }

.ppanel {
  position: absolute; z-index: 20; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%;
  background: rgb(14,15,19); padding: calc(30px + var(--safe-t)) calc(24px + var(--safe-r)) calc(30px + var(--safe-b)) 24px; overflow-y: auto;
}
.ppanel h3 { margin: 0 0 4px; font-size: 22px; display: flex; align-items: center; justify-content: space-between; }
.ppanel .sec { color: rgba(255,255,255,.65); font-size: 12px; font-weight: 700; letter-spacing: .04em; margin: 18px 4px 8px; }
.ppanel .opt { display: block; width: 100%; text-align: left; padding: 12px 16px; border-radius: 12px; background: rgba(40,43,50,.6); margin-bottom: 8px; font-size: 15px; }
.ppanel .opt:hover { background: rgba(70,74,84,.8); }
.ppanel .opt.on::before { content: '✓  '; }
.ppanel .stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ppanel .stepper .opt { margin: 0; text-align: center; flex: 1; font-weight: 700; }
.ppanel .stepper .icon-btn { width: 46px; height: 46px; border-radius: 12px; font-size: 18px; font-weight: 700; }
.ppanel .hintx { color: rgba(255,255,255,.55); font-size: 12px; margin: 4px 4px 0; }
.ppanel .note { font-size: 13px; padding: 2px 4px 6px; }
.ppanel .src { background: rgba(40,43,50,.6); }
.ppanel .src.on b::before { content: '✓  '; }
.eppanel {
  position: absolute; z-index: 20; left: 0; right: 0; bottom: 0; padding: 48px 0 calc(28px + var(--safe-b));
  background: linear-gradient(0deg, rgba(0,0,0,.95), rgba(0,0,0,.8) 60%, rgba(0,0,0,0));
}
.eppanel h4 { margin: 0 0 10px; padding: 0 48px; font-size: 18px; }
.eppanel .scroller { padding-left: 44px; padding-right: 44px; }
.eppanel .ep { width: 190px; height: 116px; }
.eppanel .ep .fit { width: 72px; }
.eppanel .ep.cur { box-shadow: 0 0 0 2px var(--accent); }

@media (max-width: 899px) {
  .player .top { padding: calc(12px + var(--safe-t)) calc(14px + var(--safe-r)) 40px calc(14px + var(--safe-l)); gap: 8px; }
  .player .top .t b { font-size: 17px; }
  .player .top .t small, .player .top .t .inf { font-size: 12px; }
  .pbtn { height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
  .pbtn .lbl { display: none; }
  .player .bottom { padding: 30px calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); }
  .cbtn { width: 42px; height: 42px; }
  .cbtn svg.i { width: 24px; height: 24px; }
  .ctrl { gap: 0; }
  .ctrl .time { font-size: 13px; margin-left: 4px; }
  .ppanel { top: auto; left: 0; width: 100%; max-height: 75%; border-radius: 18px 18px 0 0; padding-top: 22px; }
  .eppanel h4 { padding: 0 16px; }
  .eppanel .scroller { padding-left: 16px; padding-right: 16px; }
  .player .upnext { right: 12px; bottom: calc(100px + var(--safe-b)); max-width: 260px; }
  .player .loading .lt { font-size: 40px; }
}
@media (max-width: 899px) and (orientation: landscape) {
  .ppanel { top: 0; left: auto; width: 380px; max-height: none; border-radius: 0; }
}
