:root {
  --bg: #0a0b10;
  --bg-elev: #10121a;
  --surface: #14161f;
  --surface-2: #1b1e29;
  --line: #262a37;
  --line-soft: #1e2230;
  --text: #eef0f6;
  --muted: #98a0b6;
  --accent: #e5384f;
  --accent-strong: #ff4d66;
  --accent-soft: rgba(229, 56, 79, 0.14);
  --gold: #f3b64a;
  --ok: #35c48d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1100px 520px at 82% -8%, rgba(229, 56, 79, 0.14), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 11, 16, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), #7d1327);
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em;
}
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.brand-name span { color: var(--accent-strong); }

.search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.search input, .search select {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 9px 14px; font-size: 14px; min-width: 0;
}
.search input { flex: 1; }
.search select { max-width: 150px; }
.search input::placeholder { color: var(--muted); }

.topnav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.navlink {
  padding: 8px 12px; border-radius: 999px; font-size: 14px; color: var(--muted);
}
.navlink:hover { color: var(--text); background: var(--surface); }
.auth-area { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-search { border-radius: 999px; padding: 9px 13px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Layout ---------- */
.app { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
.section { margin-top: 34px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px;
  border: 1px solid var(--line-soft); background: var(--bg-elev);
  display: grid; grid-template-columns: 1.1fr 0.9fr; min-height: 340px;
  box-shadow: var(--shadow);
}
.hero-body { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.hero-kicker { color: var(--accent-strong); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.hero-title { font-size: clamp(26px, 4vw, 44px); line-height: 1.08; margin: 0; letter-spacing: -0.03em; }
.hero-desc { color: var(--muted); max-width: 46ch; margin: 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.hero-media { position: relative; background: #05060a; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0.92; }
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg-elev) 2%, rgba(16, 18, 26, 0.25) 60%, transparent);
}

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- Card rows & grids ---------- */
.row-scroll {
  display: grid; grid-auto-flow: column; grid-auto-columns: 158px;
  gap: 14px; overflow-x: auto; padding-bottom: 10px;
  scroll-snap-type: x proximity;
}
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; scroll-snap-align: start;
  transition: transform 0.15s ease, border-color 0.15s ease;
  text-align: left; padding: 0; width: 100%;
}
.card:hover { transform: translateY(-3px); border-color: var(--line); }
.cover-wrap { position: relative; aspect-ratio: 2 / 3; background: var(--surface-2); overflow: hidden; }
.cover-wrap img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 12px;
  background: linear-gradient(160deg, #232838, #14161f); text-align: center;
  font-weight: 700; font-size: 14px; color: var(--muted);
}
.cover-tag {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  background: rgba(10, 11, 16, 0.78); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 600;
}
.cover-ep {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  background: rgba(229, 56, 79, 0.9); border-radius: 8px; padding: 3px 8px;
  font-size: 11px; font-weight: 700;
}
.card-body { padding: 10px 12px 13px; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { font-size: 12px; color: var(--muted); }

/* ---------- Skeletons ---------- */
.sk { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); }
.sk-card { height: 300px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Drama detail ---------- */
.detail { display: grid; grid-template-columns: 300px 1fr; gap: 30px; }
.detail-cover { border-radius: var(--radius); overflow: hidden; aspect-ratio: 2/3; background: var(--surface-2); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-body h1 { font-size: clamp(24px, 3.4vw, 36px); margin: 0 0 10px; letter-spacing: -0.03em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.detail-desc { color: var(--muted); max-width: 70ch; margin: 0 0 20px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.back-link:hover { color: var(--text); }

.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 10px; margin-top: 8px; }
.ep-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px 6px; font-weight: 600; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.ep-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.ep-btn .ep-num { font-size: 15px; }
.ep-btn .ep-play { font-size: 11px; color: var(--muted); }

/* ---------- Plans ---------- */
.status-card {
  background: linear-gradient(140deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 22px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.status-card .big { font-size: 22px; font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill-ok { background: rgba(53, 196, 141, 0.14); color: var(--ok); }
.pill-off { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.plan-card {
  position: relative; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 22px 20px; display: flex; flex-direction: column; gap: 10px;
}
.plan-card.feature { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow); }
.plan-badge {
  position: absolute; top: -11px; right: 18px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.plan-label { font-size: 17px; font-weight: 700; }
.plan-tagline { color: var(--muted); font-size: 13px; min-height: 38px; }
.plan-price { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.plan-price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan-card .btn { margin-top: auto; }

/* ---------- Order ---------- */
.order-card { max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.order-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.order-row:last-of-type { border-bottom: 0; }
.order-row .k { color: var(--muted); }
.order-total { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.qris-box { margin: 18px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.qris-box img { width: 240px; border-radius: 14px; border: 1px solid var(--line); background: #fff; padding: 8px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.note { background: var(--accent-soft); border: 1px solid rgba(229, 56, 79, 0.35); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; }
.success-mark { width: 54px; height: 54px; border-radius: 999px; display: grid; place-items: center; background: rgba(53, 196, 141, 0.16); color: var(--ok); font-size: 26px; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 5, 9, 0.78); backdrop-filter: blur(4px); }
.modal {
  position: relative; z-index: 2; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow);
}
.modal.modal-wide { max-width: 920px; }
.modal h3 { margin: 0 0 6px; font-size: 20px; }
.modal-close {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center;
}
.modal-close:hover { background: var(--surface-2); }
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.tg-steps { color: var(--muted); font-size: 14px; margin: 14px 0 0; padding-left: 18px; }
.tg-steps li { margin: 5px 0; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent-strong); border-radius: 999px; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Player ---------- */
.player-wrap { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16/9; }
.player-wrap video { width: 100%; height: 100%; background: #000; }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-right: 40px; }
.player-head h3 { font-size: 17px; }
.player-controls { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }

/* ---------- Toast ---------- */
.toast-root { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow);
  animation: toastin 0.18s ease;
}
.toast.error { border-color: rgba(229, 56, 79, 0.5); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Misc ---------- */
.loader { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 26px 0; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }
.demo-banner {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  background: rgba(243, 182, 74, 0.1); border: 1px solid rgba(243, 182, 74, 0.35);
  color: #f0d7a3; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 20px;
}
.footer { border-top: 1px solid var(--line-soft); padding: 24px 20px; text-align: center; font-size: 13px; color: var(--muted); }
.footer p { margin: 4px 0; }
.noscript { text-align: center; padding: 40px 20px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-media { min-height: 240px; }
  .hero-media::after { background: linear-gradient(0deg, var(--bg-elev) 4%, rgba(16,18,26,0.3) 55%, transparent); }
  .detail { grid-template-columns: 1fr; }
  .detail-cover { max-width: 260px; }
}

@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .search { order: 3; width: 100%; flex-basis: 100%; }
  .topnav { margin-left: auto; }
  .app { padding: 18px 14px 50px; }
  .hero-body { padding: 26px 20px; }
  .row-scroll { grid-auto-columns: 138px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
  .grow-name { display: none; }
}
