:root {
  --bg: #0b0f1a;
  --bg2: #121826;
  --card: #151c2c;
  --border: #243049;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #6366f1;
  --primary2: #8b5cf6;
  --accent: #22d3ee;
  --green: #34d399;
  --red: #f43f5e;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius: 18px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg); color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  min-height: 100%; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,15,26,.88); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.1rem; letter-spacing: -.03em;
}
.brand .logo {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(99,102,241,.4);
}
.brand .logo svg { width: 16px; height: 16px; fill: #fff; }
.header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem;
}
.user-av {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: linear-gradient(135deg, var(--primary), #ec4899);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem;
}

.container { max-width: 560px; margin: 0 auto; padding: 16px 14px 100px; }

.search-panel {
  display: none; padding: 0 0 14px;
}
.search-panel.open { display: block; }
.search-panel form { display: flex; gap: 0; }
.search-panel input {
  flex: 1; height: 44px; border-radius: 14px 0 0 14px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); padding: 0 14px; outline: none; font-size: .95rem;
}
.search-panel button {
  width: 52px; height: 44px; border-radius: 0 14px 14px 0; border: 1px solid var(--border); border-left: 0;
  background: var(--bg2); color: var(--text); cursor: pointer;
}

.grid { display: flex; flex-direction: column; gap: 14px; }
.vcard {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s;
  animation: fadeUp .35s ease both;
}
.vcard:active { transform: scale(.98); }
.vcard .thumb { aspect-ratio: 16/9; background: var(--bg2); position: relative; }
.vcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.vcard .thumb .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(transparent 40%, rgba(0,0,0,.55));
  opacity: .9;
}
.vcard .thumb .play span {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.15); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.vcard .body { padding: 14px; display: flex; gap: 12px; }
.vcard .av {
  width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.vcard h3 {
  font-size: .95rem; font-weight: 700; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vcard .meta { margin-top: 5px; font-size: .78rem; color: var(--muted); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; }

.player-shell { background: #000; position: relative; min-height: 180px; }
.player-shell .poster {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; opacity: .85;
}
.locked-layer {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(99,102,241,.25), rgba(11,15,26,.92));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 8px;
}
.locked-layer .badge {
  width: 64px; height: 64px; border-radius: 20px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; margin-bottom: 4px;
}
.back-btn {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  width: 40px; height: 40px; border-radius: 12px; border: none;
  background: rgba(255,255,255,.12); color: #fff; font-size: 1.1rem; cursor: pointer;
  backdrop-filter: blur(8px);
}

.watch-body { padding: 16px 14px 120px; max-width: 560px; margin: 0 auto; }
.watch-body h1 { font-size: 1.15rem; font-weight: 800; line-height: 1.35; margin-bottom: 8px; }
.stats { color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.actions { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 650; font-size: .85rem;
  cursor: pointer; font-family: inherit;
}
.chip.on { background: linear-gradient(135deg, var(--primary), var(--primary2)); border-color: transparent; }
.desc {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; font-size: .88rem; line-height: 1.55; color: #cbd5e1; white-space: pre-wrap; margin-bottom: 14px;
}

.unlock-card {
  background: linear-gradient(160deg, #1a2236, #151c2c);
  border: 1px solid var(--border); border-radius: 20px; padding: 20px; box-shadow: var(--shadow);
}
.unlock-card h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 6px; }
.unlock-card .sub { color: var(--muted); font-size: .88rem; line-height: 1.5; margin-bottom: 14px; }
.progress-labels {
  display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-bottom: 6px;
}
.progress-labels b { color: var(--text); }
.bar {
  height: 10px; background: rgba(99,102,241,.15); border-radius: 99px; overflow: hidden; margin-bottom: 14px;
}
.bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 99px; transition: width .4s ease;
}
.net-grid { display: grid; gap: 10px; }
.net-grid.two { grid-template-columns: 1fr 1fr; }
.btn-net {
  padding: 14px 12px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-weight: 700; font-size: .85rem;
  cursor: pointer; font-family: inherit; text-align: center;
  transition: transform .12s, border-color .12s;
}
.btn-net:active { transform: scale(.97); }
.btn-net small { display: block; margin-top: 4px; font-weight: 500; color: var(--muted); font-size: .75rem; }
.btn-net:disabled { opacity: .45; }
.btn-net.done { border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.1); color: var(--green); }
.btn-watch {
  width: 100%; margin-top: 12px; padding: 15px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff; font-weight: 800; font-size: 1rem; cursor: pointer; font-family: inherit;
  box-shadow: 0 12px 30px rgba(99,102,241,.35);
}
.btn-watch:active { transform: scale(.98); }

.banner-slot {
  background: var(--bg2); min-height: 48px; display: flex; align-items: center; justify-content: center;
  padding: 6px; overflow: hidden; border-bottom: 1px solid var(--border);
}
.banner-slot.bottom {
  border-bottom: 0; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; z-index: 40; background: var(--bg2);
}

.popup-ad {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6); align-items: center; justify-content: center; padding: 16px;
}
.popup-ad.show { display: flex; }
.popup-ad .box {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; width: 100%; max-width: 360px; position: relative; min-height: 80px;
}
.popup-ad .close {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--bg2); color: var(--text); cursor: pointer;
}

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #1e293b; color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: .85rem; opacity: 0; transition: .25s; z-index: 300; pointer-events: none;
  border: 1px solid var(--border);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.unlock-success { animation: popIn .4s ease; }
@keyframes popIn {
  0% { transform: scale(.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
