:root {
  --bg: #0a0712;
  --card: #150f22;
  --line: #2b2140;
  --text: #f4f4f6;
  --muted: #a79fba;
  --accent: #ff2d95;
  --accent-2: #2ee6ff;
  --started: #ff8a3d;
  --fill: linear-gradient(90deg, #e0187d, #7a3cff);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; }
input, textarea, select { font: inherit; }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: rgba(10,7,18,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 900; font-size: 22px; letter-spacing: .5px; }
.search { flex: 1; max-width: 320px; margin-left: 16px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); outline: none; }
.search:focus { border-color: var(--accent); }

/* ---------- Home ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 18px 16px 60px; }
.hero { position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 26px; min-height: 260px; display: flex; align-items: flex-end;
  background: var(--card) center/cover no-repeat; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,0,0,.92) 10%, rgba(0,0,0,.15) 70%); }
.hero-body { position: relative; z-index: 1; padding: 22px; max-width: 560px; }
.hero h1 { font-size: clamp(24px, 4vw, 38px); line-height: 1.1; margin: 6px 0 8px; }
.hero p { color: #d4d4dc; font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; padding: 4px 10px; border-radius: 999px; background: rgba(255,45,149,.2); color: #ff9fd0; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-weight: 700;
  background: var(--fill); color: #fff; margin-top: 14px; }
.btn.ghost { background: var(--card); border: 1px solid var(--line); }
.section-title { font-size: 18px; margin: 4px 0 14px; }
.genres { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 4px; }
.genres button { white-space: nowrap; padding: 7px 14px; border-radius: 999px; background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.genres button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card { cursor: pointer; }
.poster { position: relative; aspect-ratio: 9/16; border-radius: 12px; overflow: hidden; background: var(--card) center/cover no-repeat;
  border: 1px solid var(--line); transition: transform .2s; }
.card:hover .poster { transform: translateY(-3px); }
.poster .eps { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: rgba(0,0,0,.7); }
.poster .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 900; color: #333; padding: 10px; text-align: center; }
.card h3 { font-size: 14px; margin-top: 8px; line-height: 1.3; }
.card small { color: var(--muted); font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 80px 20px; }
.empty b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }

/* ---------- Player (vertical swipe) ---------- */
.player { position: fixed; inset: 0; z-index: 50; background: #000; display: none; }
.player.open { display: block; }
.feed { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.slide { position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; }
.slide video { height: 100%; width: 100%; max-width: calc(100dvh * 9 / 16); object-fit: contain; background: #000; }
.slide .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 16px 26px; pointer-events: none;
  background: linear-gradient(0deg, rgba(0,0,0,.85), transparent); max-width: calc(100dvh * 9 / 16); margin: 0 auto; }
.slide .info b { font-size: 16px; }
.slide .info div { font-size: 13px; color: #ccc; margin-top: 4px; }
.slide .paused { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; font-size: 64px; color: rgba(255,255,255,.85); }
.slide.is-paused .paused { display: grid; }
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.15); max-width: calc(100dvh * 9 / 16); margin: 0 auto; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.p-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 14px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,.7), transparent); }
.p-top .t { flex: 1; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 18px; display: grid; place-items: center; flex: none; }
.side { position: absolute; right: 12px; bottom: 110px; z-index: 2; display: flex; flex-direction: column; gap: 14px; }
.side .icon-btn { width: 46px; height: 46px; }
.drawer { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; background: #111117; border-radius: 18px 18px 0 0; padding: 18px 16px 26px;
  transform: translateY(100%); transition: transform .25s; max-height: 60dvh; overflow-y: auto; max-width: 560px; margin: 0 auto; }
.drawer.open { transform: none; }
.drawer h4 { margin-bottom: 12px; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.ep-grid button { aspect-ratio: 1; border-radius: 10px; background: var(--card); color: var(--text); font-weight: 700; border: 1px solid var(--line); }
.ep-grid button.on { background: var(--accent); border-color: var(--accent); }
.ep-grid button.seen { color: var(--muted); }
.tap-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 4; background: rgba(0,0,0,.7); padding: 12px 18px; border-radius: 12px; font-size: 14px; }

/* ---------- Admin ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 17px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field textarea { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); outline: none; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }
.a-series { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.a-series:first-of-type { border-top: 0; }
.a-series .poster { width: 80px; flex: none; }
.a-series .body { flex: 1; min-width: 0; }
.a-series h3 { font-size: 16px; }
.a-series p { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.ep-list { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ep-list li { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.ep-list li .n { font-weight: 800; color: var(--accent); width: 34px; }
.ep-list li input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--text); outline: none; }
.ep-list li small { color: var(--muted); white-space: nowrap; }
.mini { padding: 6px 12px; border-radius: 8px; background: var(--line); color: var(--text); font-size: 12px; font-weight: 600; }
.mini.red { background: rgba(255,59,92,.15); color: #ff8fa3; }
.drop { display: block; border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; margin-top: 10px; }
.drop.over { border-color: var(--accent); color: var(--text); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 8px; display: none; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #222; border: 1px solid var(--line); padding: 10px 18px; border-radius: 10px; z-index: 99; font-size: 14px; display: none; }
.err { color: #ff8fa3; font-size: 13px; margin-top: 6px; min-height: 1em; }

/* ---------- Added: layout bits ---------- */
.search-f { flex: 1; display: flex; justify-content: flex-end; }
.muted { color: var(--muted); }
.card[hidden] { display: none; }
.foot { border-top: 1px solid var(--line); padding: 22px 16px 34px; text-align: center; color: var(--muted); font-size: 13px; }
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-bottom: 10px; }
.foot a:hover { color: var(--text); }
.text-page { max-width: 760px; line-height: 1.7; color: #d8d8e0; }
.text-page h1 { color: var(--text); margin-bottom: 14px; }
.text-page p { margin-bottom: 12px; }
.text-page a { color: var(--accent); }

/* Drama page */
.sd { display: flex; gap: 24px; margin-bottom: 26px; }
.sd-poster { width: 220px; flex: none; }
.sd-info { flex: 1; min-width: 0; }
.sd-info h1 { font-size: clamp(24px, 4vw, 34px); margin: 10px 0 4px; }
.sd-info .desc { color: #cfcfd8; line-height: 1.6; margin: 14px 0 6px; font-size: 15px; }
.sd-info .desc p { margin-bottom: 8px; }
.sd-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.ep-grid.page { max-width: 760px; margin-bottom: 26px; }
.ep-grid.page a { aspect-ratio: 1; border-radius: 10px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; }
.ep-grid.page a:hover { border-color: var(--accent); }
.ep-grid.page a.seen { color: var(--muted); }
@media (max-width: 640px) {
  .sd { flex-direction: column; gap: 14px; }
  .sd-poster { width: 150px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
}

/* Ads */
.ad { position: relative; max-width: 1200px; margin: 14px auto; padding: 0 16px; text-align: center; }
.ad img { max-width: 100%; height: auto; border-radius: 10px; display: inline-block; vertical-align: top; }
.ad-tag { position: absolute; top: 4px; right: 22px; font-size: 10px; background: rgba(0,0,0,.6); color: #ccc; padding: 1px 6px; border-radius: 4px; z-index: 1; }
.ad-t-text .ad-tag { display: none; }
.ad-text { display: flex; flex-direction: column; gap: 3px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; max-width: 728px; margin: 0 auto; }
.ad-text b { font-size: 15px; color: var(--text); }
.ad-text span { font-size: 13px; color: var(--muted); }
.ad-text .ad-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--accent-2); }
.wrap > .ad { padding: 0; }

/* Player extras */
.p-ad { position: absolute; top: 64px; left: 0; right: 0; z-index: 2; pointer-events: auto; }
.p-ad .ad { margin: 0 auto; max-width: min(calc(100dvh * 9 / 16), 100%); padding: 0 10px; }
.p-ad .ad img { max-height: 60px; }
.p-ad .ad-text { padding: 8px 12px; background: rgba(22,22,29,.9); }
.inter { position: absolute; inset: 0; z-index: 6; background: rgba(0,0,0,.94); display: grid; place-items: center; padding: 16px; }
.inter[hidden] { display: none; }
.inter-box { width: 100%; max-width: 420px; text-align: center; }
.inter-box .ad { padding: 0; }
.inter-box .ad img { max-height: 65dvh; }
.inter-box .btn:disabled { opacity: .5; cursor: default; }

/* ---------- Home sections ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hero-slider { position: relative; margin-bottom: 26px; }
.hero-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 18px; }
.hero-track::-webkit-scrollbar { display: none; }
.hero-track .hero { flex: 0 0 100%; scroll-snap-align: start; margin: 0; border-radius: 0; }
.hero-t { font-size: clamp(24px, 4vw, 38px); line-height: 1.1; margin: 6px 0 8px; }
.hero .btn { margin-right: 8px; }
.hero-dots { position: absolute; bottom: 12px; right: 16px; display: flex; gap: 6px; }
.hero-dots button { width: 8px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.4); transition: width .2s; }
.hero-dots button.on { width: 22px; background: #fff; }
.row-sec { margin-bottom: 24px; }
.row-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 14px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.row-scroll .card { scroll-snap-align: start; }
.rank { position: absolute; left: 8px; top: 6px; font-size: 34px; font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.8); -webkit-text-stroke: 1px rgba(0,0,0,.3); }
@media (max-width: 640px) { .row-scroll { grid-auto-columns: 120px; gap: 10px; } }

/* Ad network frames + direct-link CTA */
.ad-frame-wrap { width: calc(var(--w) * 1px); height: calc(var(--h) * 1px); max-width: 100%; margin: 0 auto; overflow: hidden; }
.ad-frame { display: block; border: 0; transform-origin: top left; background: transparent; }
.ad-cta { border-color: rgba(46,230,255,.45); }
.ad-cta b::after { content: " →"; color: var(--accent-2); }
.inter-box .ad-frame-wrap { margin: 0 auto 6px; }

/* Episode watch states */
.ep-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 760px; }
.ep-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.ep-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; background: var(--card); border: 1px solid #555; display: inline-block; }
.lg.done { background: rgba(46,204,113,.25); border-color: #2ecc71; }
.lg.seen { background: rgba(255,138,61,.2); border-color: var(--started); }
.ep-grid.page a, .ep-grid button { position: relative; }
.ep-grid.page a.done, .ep-grid button.done { background: rgba(46,204,113,.14); border-color: rgba(46,204,113,.7); color: #7ee2a8; }
.ep-grid.page a.seen, .ep-grid button.seen { background: rgba(255,138,61,.12); border-color: rgba(255,138,61,.7); color: #ffb37f; }
.ep-grid.page a.done::after, .ep-grid button.done::after { content: "\2713"; position: absolute; top: 3px; right: 6px; font-size: 11px; color: #2ecc71; }
.ep-grid button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Submit & Earn */
.earn-btn { flex: none; margin-left: 10px; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--fill); color: #fff; white-space: nowrap; }
@media (max-width: 640px) { .earn-btn span { display: none; } .earn-btn { padding: 8px 11px; } }
.sub-hero { text-align: center; padding: 26px 10px 8px; max-width: 720px; margin: 0 auto 18px; }
.sub-hero h1 { font-size: clamp(26px, 5vw, 40px); margin: 10px 0; line-height: 1.15; }
.sub-hero p { color: #cfcfd8; font-size: 16px; line-height: 1.6; }
.sub-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .sub-grid { grid-template-columns: 1fr; } }
.step { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.step > b { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); }
.step h3 { font-size: 15px; margin-bottom: 3px; }
.step p { color: var(--muted); font-size: 14px; }
.rules { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.rules h3 { font-size: 15px; margin-bottom: 8px; }
.rules ul { padding-left: 18px; color: #cfcfd8; font-size: 14px; line-height: 1.8; }
.sub-form h2 { font-size: 16px; margin: 6px 0 12px; }
.sub-form h2:not(:first-child) { margin-top: 16px; }
.hp { position: absolute !important; left: -9999px; }
.sub-list { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; }
.sub-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 7px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.sub-list .n { width: 24px; color: var(--muted); font-weight: 700; }
.sub-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-list .st { white-space: nowrap; color: var(--muted); }
.sub-list li.ok .st, .sub-list li.done .st { color: #2ecc71; }
.sub-list li.bad { border-color: rgba(255,59,92,.5); }
.sub-list li.bad .st { color: #ff8fa3; white-space: normal; text-align: right; }
.sub-sum { font-size: 13px; color: var(--muted); margin-top: 8px; }
.sub-terms { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.sub-terms summary { cursor: pointer; }
.sub-terms p { margin-top: 6px; line-height: 1.6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.sub-done { text-align: center; padding: 20px 6px; }
.sub-done h2 { font-size: 24px !important; }
.sub-done p { margin: 8px 0; line-height: 1.6; }
.sub-done .code { font-size: 20px; letter-spacing: 1px; color: var(--accent-2); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }

/* Languages */
.lang-badge { position: absolute; right: 8px; top: 8px; font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 3px 7px; border-radius: 6px; background: rgba(0,0,0,.72); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.pill.lang { background: rgba(46,230,255,.14); color: #8ff1ff; }
.langbar { display: flex; align-items: center; gap: 8px; overflow-x: auto; margin: -8px 0 20px; padding-bottom: 4px; }
.langbar span { font-size: 13px; color: var(--muted); white-space: nowrap; margin-right: 2px; }
.langbar button { white-space: nowrap; padding: 7px 14px; border-radius: 999px; background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.langbar button.on { background: #2ee6ff; border-color: #2ee6ff; color: #06222a; }
.card[hidden], .row-sec[hidden] { display: none; }

/* ---------- DramaNeon brand ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; flex: none; color: #fff; letter-spacing: -.2px; }
.logo img { height: 30px; width: auto; filter: drop-shadow(0 0 6px rgba(255,45,149,.65)); }
.logo .neon { color: #ff9fd0; text-shadow: 0 0 6px rgba(255,45,149,.95), 0 0 16px rgba(255,45,149,.6); }
.search { min-width: 0; width: 100%; }
.search-f { min-width: 0; }
.btn:not(.ghost):hover:not(:disabled), .earn-btn:hover { box-shadow: 0 0 18px rgba(255,45,149,.55); }
.card:hover .poster { border-color: var(--accent); box-shadow: 0 0 16px rgba(255,45,149,.35); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
@media (max-width: 640px) { .logo { font-size: 18px; gap: 6px; } .logo img { height: 25px; } .search { margin-left: 8px; padding: 8px 12px; } }
