:root {
  --bg: #0b0b12; --bg2: #12121c; --card: #171724; --card2: #1e1e2e; --line: #2a2a3d; --text: #f1f1f6; --muted: #a0a0b8; --faint: #6b6b85;
  --accent: #f43f5e; --accent2: #8b5cf6; --ok: #34d399; --warn: #fbbf24;
  --grad: linear-gradient(135deg, #f43f5e, #8b5cf6);
  --r: 18px; --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { -webkit-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hide { display: none !important; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.ring { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* нүүр / нэвтрэх */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; background:
  radial-gradient(600px 400px at 0% 0%, rgba(244, 63, 94, .22), transparent 60%), radial-gradient(600px 400px at 100% 100%, rgba(139, 92, 246, .22), transparent 60%), var(--bg); }
.gcard { width: 100%; max-width: 440px; background: rgba(23, 23, 36, .9); border: 1px solid var(--line); border-radius: 24px; padding: 26px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.logo { width: 58px; height: 58px; margin-bottom: 14px; }
.gcard h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.3px; }
.gcard p { color: var(--muted); margin: 0 0 18px; }
.steps { display: grid; gap: 10px; margin: 18px 0; }
.step { display: flex; gap: 12px; align-items: flex-start; background: var(--card2); border-radius: 14px; padding: 12px; font-size: 14px; }
.step b.n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 13px; }
.price { font-size: 30px; font-weight: 850; letter-spacing: -.6px; }
.price small { font-size: 14px; color: var(--muted); font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 20px; border-radius: 14px; font-weight: 750; font-size: 15.5px; background: var(--card2); border: 1px solid var(--line); width: 100%; }
.btn.primary { background: var(--grad); border: 0; box-shadow: 0 10px 30px rgba(244, 63, 94, .3); }
.btn.sm { height: 36px; font-size: 13px; padding: 0 12px; width: auto; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.codein { width: 100%; height: 58px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; font-size: 22px; font-weight: 800; letter-spacing: 3px; text-align: center; text-transform: uppercase; outline: none; margin-bottom: 12px; }
.codein:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(244, 63, 94, .15); }
.err { color: #fb7185; font-size: 13.5px; min-height: 20px; margin-top: 10px; text-align: center; }
.small { font-size: 12.5px; color: var(--faint); text-align: center; margin-top: 14px; }
.small button { color: var(--muted); text-decoration: underline; }
.toc { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 6px; }
.toc div { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; }
.toc div::before { content: "🎬"; }

/* анги */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11, 11, 18, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top .in { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.top img { width: 34px; height: 34px; flex: none; }
.top .t { flex: 1; min-width: 0; }
.top .t b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 6px; background: var(--card2); border-radius: 6px; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width .4s; }
.top .pct { font-size: 12px; color: var(--muted); }
.layout { max-width: 1200px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.side { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; position: sticky; top: 76px; }
.side .sh { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-weight: 800; }
.mod { border-top: 1px solid var(--line); }
.mod h4 { margin: 0; padding: 12px 16px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.les { display: flex; gap: 12px; align-items: center; padding: 11px 16px; width: 100%; text-align: left; font-size: 14px; color: var(--muted); border-left: 3px solid transparent; }
.les:hover { background: var(--card2); color: var(--text); }
.les.on { background: rgba(244, 63, 94, .08); color: var(--text); border-left-color: var(--accent); }
.les .ck { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; }
.les.done .ck { background: var(--ok); border-color: var(--ok); color: #052e1f; }
.les .soon { margin-left: auto; font-size: 11px; color: var(--faint); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.main { min-width: 0; }
.player { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.player.v916 { aspect-ratio: 9 / 16; max-height: 78vh; margin: 0 auto; width: min(100%, calc(78vh * 9 / 16)); }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player .msg { color: var(--muted); text-align: center; padding: 24px; }
.wm { position: absolute; z-index: 5; pointer-events: none; font-size: 13px; font-weight: 800; color: rgba(255, 255, 255, .42); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); transition: top 1.2s ease, left 1.2s ease; white-space: nowrap; letter-spacing: .5px; }
.wmtile { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: .06; background-repeat: repeat; }
.shield { position: absolute; inset: 0; z-index: 6; }
.ctl { position: absolute; z-index: 7; left: 0; right: 0; bottom: 0; padding: 10px 12px; display: flex; align-items: center; gap: 10px; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); opacity: 0; transition: opacity .2s; }
.player:hover .ctl, .player.paused .ctl, .player.touch .ctl { opacity: 1; }
.ctl button { width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .14); display: grid; place-items: center; font-size: 15px; flex: none; }
.ctl .tm { font-size: 12px; color: #e5e7eb; font-variant-numeric: tabular-nums; flex: none; }
.ctl input[type=range] { flex: 1; accent-color: var(--accent); }
.bigplay { position: absolute; z-index: 8; width: 74px; height: 74px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-size: 26px; box-shadow: 0 10px 40px rgba(244, 63, 94, .5); }
.info { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.info h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.3px; }
.info p { margin: 0; color: var(--muted); white-space: pre-line; }
.acts { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.acts .btn { width: auto; flex: 1; min-width: 150px; }
.btn.done { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .4); color: var(--ok); }
.mobtoc { display: none; }

/* эзэн */
.admin { max-width: 1200px; margin: 0 auto; padding: 16px; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.box h3 { margin: 0 0 12px; font-size: 16px; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.form input { height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); padding: 0 10px; font: inherit; }
.kp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.kp div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.kp b { display: block; font-size: 22px; }
.kp span { font-size: 12px; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--faint); font-weight: 600; font-size: 12px; }
.tblw { overflow-x: auto; }
.code { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .5px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card2); color: var(--muted); }
.tag.ok { background: rgba(52, 211, 153, .12); color: var(--ok); } .tag.bad { background: rgba(251, 113, 133, .12); color: #fb7185; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; background: #fff; color: #111; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: 0 0 24px; gap: 0; }
  .side { display: none; position: static; border-radius: 0; border-left: 0; border-right: 0; }
  .side.open { display: block; }
  .player { border-radius: 0; }
  .player.v916 { max-height: 72vh; width: min(100%, calc(72vh * 9 / 16)); }
  .info { border-radius: 0; border-left: 0; border-right: 0; margin-top: 0; }
  .mobtoc { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); font-weight: 750; font-size: 14px; width: 100%; }
  .kp { grid-template-columns: repeat(3, 1fr); }
}
.player.pseudo { position: fixed; inset: 0; z-index: 50; border-radius: 0; aspect-ratio: auto; max-height: none; width: 100%; height: 100%; }

.snip { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg2); overflow: hidden; }
.snh { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.snh b { flex: 1; min-width: 0; }
.snh .cp { flex: none; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; }
.snip pre { margin: 0; padding: 12px 14px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: #dcdcea; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; -webkit-user-select: text; user-select: text; }
