/*
 * Color meaning (keep consistent across all pages):
 *   --primary  brand pink   -> main CTA buttons, like/favorite, active/selected state
 *   --gold     gold/amber   -> VIP, coin, rating, promotional info
 *   --success  green        -> free/unlocked, positive status, confirmed
 *   --danger   red          -> destructive actions, errors
 *   --text-muted / --text-faint -> neutral/secondary actions (e.g. logout), never a brand color
 */
:root {
  --bg: #0b0b12;
  --bg-elevated: #15151f;
  --bg-card: #1a1a26;
  --bg-input: #20202e;
  --border: #2a2a3a;
  --text: #f2f2f7;
  --text-muted: #9a9aad;
  --text-faint: #6b6b7d;
  --primary: #ff3b6b;
  --primary-dark: #d92a58;
  --accent: #ffb020;
  --gold: #ffd166;
  --success: #2ecc71;
  --danger: #ff4d4d;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --nav-height: 62px;
}

* { box-sizing: border-box; }

/* ---------- Minimal utility classes (replaces Bootstrap CSS on the frontend) ---------- */
.d-flex { display: flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.gap-2 { gap: .5rem; }
.text-center { text-align: center; }
.text-decoration-none { text-decoration: none; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.my-3 { margin-top: 1rem; margin-bottom: 1rem; }
.px-3 { padding-left: 1rem; padding-right: 1rem; }
.w-100 { width: 100%; }

/* ---------- Icon color helpers (Ionicons) ---------- */
ion-icon { vertical-align: middle; }
.icon-primary { color: var(--primary); }
.icon-gold { color: var(--gold); }
.icon-success { color: var(--success); }
.icon-danger { color: var(--danger); }
.icon-muted { color: var(--text-muted); }
.icon-white { color: #fff; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: calc(var(--nav-height) + 12px);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }

::-webkit-scrollbar { height: 0; width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.container-app {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: var(--bg);
  min-height: 100vh;
}

@media (min-width: 481px) {
  .container-app {
    box-shadow: 0 0 60px rgba(0,0,0,.5);
  }
}

/* ---------- Top App Bar ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11,11,18,.9);
  backdrop-filter: blur(10px);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.app-logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-logo span.mark {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.search-bar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text-muted);
}
.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  flex: 1;
  font-size: .9rem;
}
.search-bar input::placeholder { color: var(--text-faint); }

.icon-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  flex-shrink: 0;
  font-size: 1.1rem;
  padding: 0;
}
.icon-btn ion-icon { font-size: 1.1rem; }

/* ---------- Coin badge ---------- */
.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #3a2c0f, #221b0a);
  border: 1px solid #4a3a15;
  color: var(--gold);
  font-weight: 600;
  font-size: .78rem;
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---------- Section ---------- */
.section { padding: 18px 16px 4px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title h2 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title a.see-all {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}
.scroll-row::-webkit-scrollbar { display: none; }

/* ---------- Drama Card ---------- */
.drama-card {
  flex: 0 0 auto;
  width: 130px;
  scroll-snap-align: start;
}
.drama-card .poster-wrap {
  position: relative;
  width: 130px;
  height: 185px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
}
.drama-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.drama-card .title {
  margin-top: 8px;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.drama-card .meta {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: .65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  z-index: 2;
}
.badge-vip { background: linear-gradient(135deg, var(--gold), var(--accent)); color: #201400; }
.badge-new { background: var(--primary); color: #fff; }
.badge-rank {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.6);
  color: var(--gold);
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  z-index: 2;
}

.rating-chip {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: .68rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  z-index: 2;
}

.poster-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,.75) 100%);
}

/* ---------- Grid (search/library) ---------- */
.drama-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 10px;
}
.drama-grid .drama-card { width: 100%; }
.drama-grid .poster-wrap { width: 100%; height: 150px; }

/* ---------- Banner Slider ---------- */
.banner-slider { padding: 14px 16px 6px; }
.banner-slide {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 220px;
  background: var(--bg-card);
}
.banner-slide img { width: 100%; height: 100%; object-fit: cover; }
.banner-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.85));
}
.banner-info h3 { font-size: 1.15rem; font-weight: 800; margin: 0 0 4px; }
.banner-info p { font-size: .78rem; color: var(--text-muted); margin: 0 0 10px; max-width: 90%; }
.banner-tags { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.banner-tags span {
  font-size: .68rem;
  background: rgba(255,255,255,.12);
  padding: 3px 9px;
  border-radius: 999px;
}
.carousel-indicators-custom {
  position: absolute; bottom: 90px; left: 16px;
  display: flex; gap: 5px; z-index: 3;
}
.carousel-indicators-custom span {
  width: 16px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.3);
}
.carousel-indicators-custom span.active { background: var(--primary); width: 22px; }

/* ---------- Continue Watching ---------- */
.cw-card {
  flex: 0 0 auto;
  width: 260px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  height: 130px;
  background: var(--bg-card);
}
.cw-card img { width: 100%; height: 100%; object-fit: cover; }
.cw-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.75) 40%, rgba(0,0,0,.1));
  display: flex; flex-direction: column; justify-content: center;
  padding: 14px;
}
.cw-overlay h4 { font-size: .88rem; font-weight: 700; margin: 0 0 4px; }
.cw-overlay p { font-size: .74rem; color: var(--text-muted); margin: 0 0 10px; }
.cw-progress { height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; width: 140px; overflow: hidden; }
.cw-progress > div { height: 100%; background: var(--primary); }
.cw-play {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Buttons ---------- */
.btn-primary-app,
.btn-outline-app,
.btn-gold {
  border-radius: 12px;
  padding: 13px;
  width: 100%;
  font-size: .95rem;
  text-align: center;
  box-sizing: border-box;
  line-height: 1.2;
}
.btn-primary-app {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: 1px solid transparent;
  color: #fff;
  font-weight: 700;
}
.btn-outline-app {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--accent));
  color: #201400;
  border: 1px solid transparent;
  font-weight: 700;
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: var(--nav-height);
  background: rgba(15,15,22,.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: .68rem;
  font-weight: 600;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--primary); }

/* ---------- Category Pills ---------- */
.pill-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 16px 14px;
}
.pill-row::-webkit-scrollbar { display: none; }
.pill {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Drama Detail ---------- */
.detail-back {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
}
.genre-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.genre-tags span {
  font-size: .7rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--text-muted);
}

.episode-list { padding: 16px; }
.episode-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
}
.episode-item .ep-name { font-weight: 600; font-size: .88rem; display: flex; align-items: center; gap: 8px; }
.episode-item .ep-badge-free {
  font-size: .65rem; font-weight: 700; color: var(--success);
  background: rgba(46,204,113,.12); padding: 2px 8px; border-radius: 6px;
}
.episode-item .ep-badge-lock {
  font-size: .72rem; font-weight: 700; color: var(--gold);
  display: flex; align-items: center; gap: 4px;
}
.episode-item.watched { opacity: .55; }

/* ---------- Payment method radio card ---------- */
.radio-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.radio-card:has(input:checked) {
  border-color: var(--primary);
  background: rgba(255,59,107,.06);
}
.radio-card .label {
  font-weight: 600;
  font-size: .88rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.radio-card .label ion-icon { font-size: 1.2rem; }
.radio-card input[type="radio"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: grid;
  place-content: center;
  margin: 0;
}
.radio-card input[type="radio"]::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform .1s;
  background: var(--primary);
}
.radio-card input[type="radio"]:checked {
  border-color: var(--primary);
}
.radio-card input[type="radio"]:checked::before {
  transform: scale(1);
}

/* ---------- Player ---------- */
/* ---------- Vertical fullscreen player (short-drama style) ---------- */
.player-vertical {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
  z-index: 10;
}
.player-vertical video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.player-poster-fallback {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* In fullscreen, controls auto-hide after a few seconds of no interaction
   so the video is unobstructed; tapping the video (or any interaction)
   brings them back via player.js toggling this class off. Only applies
   while :fullscreen — the normal in-page player always shows controls. */
.player-vertical.is-fullscreen.controls-hidden .player-scrim-top,
.player-vertical.is-fullscreen.controls-hidden .player-topbar,
.player-vertical.is-fullscreen.controls-hidden .player-rail,
.player-vertical.is-fullscreen.controls-hidden .player-info-overlay,
.player-vertical.is-fullscreen.controls-hidden .player-center-btn {
  opacity: 0;
  pointer-events: none;
}
.player-scrim-top, .player-topbar, .player-rail, .player-info-overlay {
  transition: opacity .3s ease;
}
.player-scrim-top {
  position: absolute; top: 0; left: 0; right: 0; height: 140px;
  background: linear-gradient(180deg, rgba(0,0,0,.7), transparent);
  pointer-events: none; z-index: 4;
}
.player-topbar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
  z-index: 5;
}
.player-topbar-title {
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.player-topbar-title span { color: rgba(255,255,255,.7); font-weight: 500; }
.icon-btn-glass {
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
}

.player-info-overlay {
  position: absolute; left: 0; right: 76px; bottom: 0;
  padding: 28px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.75));
  z-index: 5;
  pointer-events: none;
}
.player-info-overlay > * { pointer-events: auto; }

.locked-overlay {
  position: absolute; inset: 0;
  background: rgba(5,5,10,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; z-index: 6;
}
.locked-overlay .lock-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,176,32,.12); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

/* ---------- Tap zone + center play/pause ---------- */
.player-tap-zone {
  position: absolute; inset: 0;
  z-index: 3;
  background: none; border: none; padding: 0; margin: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.player-center-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255,255,255,.4);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem;
  opacity: 0;
  transition: opacity .2s;
}
.player-tap-zone:hover .player-center-btn,
.player-tap-zone:active .player-center-btn { opacity: 1; }
.player-center-btn.is-playing { opacity: 0; }
.player-tap-zone:active .player-center-btn.is-playing { opacity: .9; }
.player-center-btn ion-icon[name="play"] { margin-left: 4px; }

/* ---------- Scrub progress bar ---------- */
.player-progress-row {
  display: flex; align-items: center; gap: 8px;
}
.time-current, .time-total {
  color: rgba(255,255,255,.8); font-size: .68rem; font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.player-progress-bar {
  position: relative;
  flex: 1;
  height: 16px;
  display: flex; align-items: center;
  cursor: pointer;
}
.player-progress-bar::before {
  content: '';
  position: absolute; left: 0; right: 0;
  height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.25);
}
.player-progress-buffer, .player-progress-fill {
  position: absolute; left: 0;
  height: 3px; border-radius: 2px;
}
.player-progress-buffer { background: rgba(255,255,255,.4); width: 0%; }
.player-progress-fill { background: var(--primary); width: 0%; }
.player-progress-fill::after {
  content: '';
  position: absolute; right: -5px; top: 50%; transform: translateY(-50%);
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,59,107,.25);
}

/* ---------- Right-side vertical icon rail ---------- */
.player-rail {
  position: absolute;
  right: 10px;
  bottom: 130px;
  z-index: 6;
  display: flex; flex-direction: column; gap: 18px;
  align-items: center;
}
.rail-btn {
  background: none; border: none; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: .64rem; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.rail-btn ion-icon {
  font-size: 1.55rem;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
}

/* ---------- Swipe hint ---------- */
.swipe-hint {
  position: absolute; left: 50%; bottom: 145px;
  transform: translate(-50%, 10px);
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  color: #fff; font-size: .72rem; font-weight: 500;
  padding: 8px 14px; border-radius: 999px;
  z-index: 6;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
  white-space: nowrap;
}
.swipe-hint.show { opacity: 1; transform: translate(-50%, 0); }
.swipe-hint ion-icon { animation: swipe-bounce 1.4s ease-in-out infinite; }
@keyframes swipe-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ---------- Episode drawer (right-side sliding panel) ---------- */
.side-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: none;
}
.side-drawer-backdrop.open { display: block; }
.side-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 82%; max-width: 340px;
  background: var(--bg-elevated);
  z-index: 201;
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .25s ease;
}
.side-drawer.open { transform: translateX(0); }
.side-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.side-drawer-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.episode-number-grid-drawer { padding: 0; }

/* ---------- Subtitle settings bottom sheet ---------- */
.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .25s ease;
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 6px auto 14px;
}
.subtitle-setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: .9rem; font-weight: 600;
}
.toggle-switch {
  width: 46px; height: 26px; border-radius: 999px;
  background: var(--border); border: none; position: relative;
  transition: background .2s;
}
.toggle-switch .toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.toggle-switch.on { background: var(--success); }
.toggle-switch.on .toggle-knob { transform: translateX(20px); }

.subtitle-setting-group { margin-bottom: 18px; }
.subtitle-setting-label { font-size: .78rem; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; display: block; }
.subtitle-option-row { display: flex; gap: 8px; }
.subtitle-option {
  flex: 1;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
  font-size: .8rem; font-weight: 600;
  padding: 10px; border-radius: 10px;
}
.subtitle-option.active { border-color: var(--success); color: var(--success); background: rgba(46,204,113,.08); }

.subtitle-unavailable-note {
  display: flex; align-items: center; gap: 8px;
  font-size: .76rem; color: var(--text-muted);
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 10px 12px; border-radius: 10px;
  margin-top: 4px;
}

@media (min-width: 901px) {
  .player-vertical {
    position: relative;
    max-width: 480px;
    height: 100vh;
    margin: 0 auto;
    inset: auto;
  }
  .side-drawer, .side-drawer-backdrop, .bottom-sheet { position: absolute; }
  .bottom-sheet { max-width: none; }
}

/* ---------- Forms ---------- */
.auth-wrap { padding: 40px 24px; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.form-control-app {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  width: 100%;
  font-size: .9rem;
  margin-bottom: 12px;
}
.form-control-app:focus { outline: none; border-color: var(--primary); background: var(--bg-input); color: var(--text); }
.form-control-app::placeholder { color: var(--text-faint); }
label.form-label-app { font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; display: block; }

.divider-text {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-faint); font-size: .78rem; margin: 18px 0;
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; width: 100%; font-weight: 600; font-size: .85rem;
  margin-bottom: 10px;
}

/* ---------- Coin / VIP Cards ---------- */
.coin-card, .vip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.coin-card .amount { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; }
.coin-card .bonus { font-size: .72rem; color: var(--success); }
.coin-card .price { font-weight: 700; color: var(--primary); }

.vip-card.popular { border-color: var(--gold); position: relative; }
.vip-card.popular::before {
  content: 'POPULER';
  position: absolute; top: -9px; right: 14px;
  background: var(--gold); color: #201400;
  font-size: .62rem; font-weight: 800; padding: 3px 9px; border-radius: 6px;
}
.vip-benefits { list-style: none; padding: 0; margin: 10px 0 0; }
.vip-benefits li { font-size: .78rem; color: var(--text-muted); padding: 3px 0; display: flex; gap: 6px; align-items: center; }

/* ---------- Account ---------- */
.profile-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 16px;
  background: linear-gradient(135deg, #1c1428, #150e1e);
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 66px; height: 66px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--primary);
}

/* =====================================================================
   Provider-multi-platform redesign (dramacina.vip-style)
   ===================================================================== */

/* ---------- Desktop wide layout ---------- */
@media (min-width: 901px) {
  body { padding-bottom: 0; }
  .container-app {
    max-width: 1180px;
    box-shadow: none;
  }
  .bottom-nav { display: none; }
  .app-header { padding: 16px 28px; }
  .search-bar { max-width: 420px; margin-left: auto; margin-right: auto; }
  .platform-bar { padding: 12px 28px; }
  .section { padding: 22px 28px 4px; }
  .pgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; padding: 0 28px 16px; }
  .episode-number-grid, .detail-synopsis-v2, .detail-actions-v2, .like-share-row, .list-heading-row, .genre-tags-row, .detail-card { padding-left: 28px; padding-right: 28px; }
  .detail-card .detail-poster-v2 { width: 140px; height: 198px; }
  .episode-number-grid { grid-template-columns: repeat(10, 1fr); }
}

/* ---------- Language dropdown + VIP button row ---------- */
.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.lang-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .8rem;
  color: var(--text-muted);
}
.lang-pill ion-icon { font-size: 1rem; }
.btn-vip-pill {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, var(--gold), var(--accent));
  color: #201400;
  font-weight: 700;
  font-size: .78rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  white-space: nowrap;
}

/* ---------- Platform bar (shows active platform, opens modal) ---------- */
.platform-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  margin: 10px 16px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
}
.platform-bar .left { display: flex; align-items: center; gap: 10px; }
.platform-bar .logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.platform-bar .name { font-weight: 700; font-size: .95rem; }
.platform-bar .chevron { color: var(--text-faint); transition: transform .2s; }

/* ---------- Platform picker modal (bottom sheet) ---------- */
.platform-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 200; display: none;
}
.platform-modal-backdrop.open { display: block; }
.platform-modal {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  z-index: 201;
  max-height: 82vh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .25s ease;
}
@media (min-width: 901px) {
  .platform-modal { max-width: 520px; }
}
.platform-modal.open { transform: translateY(0); }
.platform-modal-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 10px auto;
}
.platform-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 20px 14px;
}
.platform-modal-header h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.platform-modal-search {
  margin: 0 20px 14px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}
.platform-modal-search input {
  background: transparent; border: none; outline: none;
  color: var(--text); flex: 1; font-size: .85rem;
}
.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0 20px 24px;
  overflow-y: auto;
}
@media (min-width: 560px) {
  .platform-grid { grid-template-columns: repeat(4, 1fr); }
}
.platform-grid form { display: contents; }
.platform-tile {
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  font-family: inherit;
}
.platform-tile.active { border-color: var(--success); background: rgba(46,204,113,.08); }
.platform-tile img {
  width: 44px; height: 44px; border-radius: 10px; object-fit: cover;
}
.platform-tile .tile-name { font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.2; }
.platform-tile .check-mark {
  position: absolute; top: 6px; right: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem;
}
.platform-tile.is-coming-soon {
  cursor: default;
}
.platform-tile.is-coming-soon img { filter: grayscale(70%); opacity: .5; }
.platform-tile.is-coming-soon .tile-name { color: var(--text-faint); }
.coming-soon-badge {
  position: absolute; top: 6px; right: 6px;
  background: var(--gold); color: #201400;
  font-size: .56rem; font-weight: 800;
  padding: 3px 7px; border-radius: 999px;
  letter-spacing: .01em;
  white-space: nowrap;
}

/* ---------- "Semua Drama" heading + server toggle ---------- */
.list-heading-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
}
.list-heading-row h2 { font-size: 1.05rem; font-weight: 800; margin: 0; }
.drama-count { font-size: .78rem; color: var(--text-muted); font-weight: 600; }

.load-more-row { display: flex; justify-content: center; padding: 4px 16px 20px; }
.load-more-row .btn-outline-app {
  width: auto; padding: 10px 24px;
  display: inline-flex; align-items: center; gap: 8px;
}
.load-more-row .btn-outline-app:disabled { opacity: .6; }
.load-more-row .btn-outline-app:disabled ion-icon { animation: spin-anim 1s linear infinite; }
@keyframes spin-anim { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- Provider-grid drama card (badge top corners) ---------- */
.pgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 8px;
  padding: 0 16px 16px;
}
@media (min-width: 400px) and (max-width: 900px) {
  .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.pcard { display: block; min-width: 0; }
.pcard .poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
}
.pcard .poster-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .badge-provider {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  color: #fff; font-size: .56rem; font-weight: 700;
  padding: 2px 6px; border-radius: 5px; letter-spacing: .02em;
  max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pcard .badge-eps {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: var(--success); color: #06210f;
  font-size: .58rem; font-weight: 800;
  padding: 2px 6px; border-radius: 5px;
}
.pcard .title {
  margin-top: 6px; font-size: .76rem; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- Continue watching promo card (VIP upsell banner) ---------- */
.vip-promo-card {
  margin: 16px; padding: 22px 18px;
  background: linear-gradient(160deg, rgba(46,204,113,.12), rgba(11,11,18,0));
  border: 1px solid rgba(46,204,113,.35);
  border-radius: 18px;
  text-align: center;
}
.vip-promo-card .crown {
  width: 48px; height: 48px; border-radius: 14px;
  background: rgba(46,204,113,.15); color: var(--success);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; font-size: 1.3rem;
}
.vip-promo-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.vip-promo-card p { font-size: .78rem; color: var(--text-muted); margin-bottom: 14px; }
.vip-promo-card .btn-gold { width: auto; padding: 10px 26px; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Drama detail v2 (banner theme + overlay poster) ---------- */
.detail-hero {
  position: relative;
  min-height: 210px;
  padding-top: max(14px, env(safe-area-inset-top));
  overflow: hidden;
}
.detail-hero .hero-backdrop {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center 20%;
  filter: blur(18px) brightness(.5) saturate(1.1);
  transform: scale(1.15);
}
.detail-hero .hero-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,11,18,.35) 0%, var(--bg) 96%);
}
.detail-hero .detail-back { position: relative; z-index: 2; margin: 0 16px; }

.detail-card {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 14px;
  padding: 14px 16px 0;
  margin-top: 10px;
}
.detail-card .detail-poster-v2 {
  width: 108px; height: 152px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.08);
}
.detail-card .detail-poster-v2 img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-card .detail-info { min-width: 0; padding-top: 4px; }
.detail-card h1 {
  font-size: 1.08rem; font-weight: 800; margin: 0 0 8px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.detail-meta-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.meta-chip {
  font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 3px;
}
.meta-chip.eps { background: rgba(46,204,113,.15); color: var(--success); }
.meta-chip.views { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border); }

.genre-tags-row { padding: 12px 16px 0; }

.detail-synopsis-v2 {
  font-size: .84rem; color: var(--text-muted); line-height: 1.6;
  padding: 12px 16px 0;
}
.detail-synopsis-v2 .toggle-link { color: var(--gold); font-weight: 600; }

.detail-actions-v2 { display: flex; gap: 10px; padding: 16px; }
.detail-actions-v2 .btn-primary-app { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; }
.detail-actions-v2 .btn-gold { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; }

.like-share-row {
  display: flex; gap: 10px; padding: 0 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.like-share-row button, .like-share-row a {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600;
  padding: 8px 14px; border-radius: 999px;
}
.like-share-row button.liked { color: var(--primary); border-color: var(--primary); background: rgba(255,59,107,.08); }

/* ---------- Episode number grid (unlocked vs locked) ---------- */
.episode-notice {
  margin: 0 16px 14px;
  background: rgba(255,176,32,.08);
  border: 1px solid rgba(255,176,32,.25);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .78rem;
  color: var(--gold);
  display: flex; align-items: center; gap: 8px;
}
.episode-notice a { color: var(--gold); text-decoration: underline; font-weight: 700; }

.episode-number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 0 16px 24px;
}
@media (min-width: 560px) {
  .episode-number-grid { grid-template-columns: repeat(8, 1fr); }
}
.episode-number-grid a, .episode-number-grid span {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-size: .82rem; font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.episode-number-grid a.watched { background: rgba(255,59,107,.15); border-color: var(--primary); color: var(--primary); }
.episode-number-grid a.locked {
  color: var(--text-faint);
  background: var(--bg);
  border-color: var(--border);
  position: relative;
}
.episode-number-grid .ep-lock-badge {
  position: absolute; bottom: 3px; right: 3px; font-size: .6rem; color: var(--text-faint);
}
.stat-row { display: flex; gap: 10px; padding: 14px 16px; }
.stat-box {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; text-align: center;
}
.stat-box .v { font-weight: 800; font-size: 1.05rem; }
.stat-box .l { font-size: .68rem; color: var(--text-muted); margin-top: 2px; }

.menu-list a, .menu-list button {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem; font-weight: 500;
  width: 100%; background: none; border-left: none; border-right: none; border-top: none; color: var(--text);
  text-align: left;
}
.menu-list .left { display: flex; align-items: center; gap: 12px; }

.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: 10px; }

.toast-flash {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  max-width: 440px; width: calc(100% - 32px);
  z-index: 100;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: .85rem;
  font-weight: 600;
}
.toast-flash.success { background: #123521; color: #4ade80; border: 1px solid #1e5c37; }
.toast-flash.error { background: #3a1420; color: #ff6b8a; border: 1px solid #6b1f35; }

.platform-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 999px; font-size: .7rem; font-weight: 600; color: var(--text-muted);
}
.platform-chip img { width: 14px; height: 14px; border-radius: 3px; }
