:root {
  --bg: #0b0b0c;
  --surface: #181818;
  --surface-2: #232323;
  --line: rgba(255, 255, 255, .1);
  --text: #f4f3ef;
  --muted: #a6a5a0;
  --faint: #6f6e6a;
  --accent: #e5322d;
  --accent-ink: #fff;
  --pad: clamp(16px, 4vw, 60px);
  --per-row: 6;
  --gap: 8px;
  --radius: 4px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (max-width: 1400px) { :root { --per-row: 5; } }
@media (max-width: 1100px) { :root { --per-row: 4; } }
@media (max-width: 800px)  { :root { --per-row: 3; } }
@media (max-width: 520px)  { :root { --per-row: 2.3; --gap: 6px; } }

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
img { display: block; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
body.locked { overflow: hidden; }

/* ---------- wordmark ---------- */
.wordmark { font: 900 26px/1 var(--display); letter-spacing: -.035em; color: var(--accent); text-transform: uppercase; white-space: nowrap; }

/* ---------- nav ---------- */
.nav { position: fixed; inset: 0 0 auto; z-index: 30; height: 68px; display: flex; align-items: center; gap: 28px; padding: 0 var(--pad); background: linear-gradient(180deg, rgba(0,0,0,.75), transparent); transition: background .3s; }
.nav.solid { background: var(--bg); }
.nav-links { display: flex; gap: 20px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links button { font-size: 14px; color: #e5e5e5; white-space: nowrap; padding: 4px 0; transition: color .2s; }
.nav-links button:hover { color: var(--muted); }
.nav-links button.on { color: #fff; font-weight: 600; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border: 1px solid transparent; transition: border-color .2s, background .2s; }
.search input { width: 0; border: 0; background: transparent; outline: none; font-size: 14px; transition: width .25s; }
.search.open { border-color: rgba(255,255,255,.85); background: rgba(0,0,0,.75); }
.search.open input { width: min(220px, 40vw); }
.search button { display: grid; place-items: center; }
.nav-right .out { font-size: 13px; color: var(--muted); }
.nav-right .out:hover { color: #fff; }
@media (max-width: 700px) {
  .nav { height: 56px; gap: 16px; }
  .wordmark { font-size: 20px; }
  .nav-links { display: none; }
}

/* ---------- hero ---------- */
.hero { position: relative; height: min(82vh, 56.25vw + 120px); min-height: 440px; overflow: hidden; }
.hero-art { position: absolute; inset: 0; background: #111 center/cover no-repeat; animation: drift 30s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.09) translate(-1%, -1%); } }
.hero::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(77deg, rgba(0,0,0,.82) 0%, rgba(0,0,0,.35) 45%, transparent 75%); }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 32%; z-index: 1; background: linear-gradient(180deg, transparent, var(--bg)); }
.hero-body { position: absolute; z-index: 2; left: var(--pad); bottom: 26%; width: min(560px, 86vw); }
.hero-kicker { font-size: 13px; letter-spacing: .02em; color: var(--muted); margin-bottom: 10px; }
.hero-title { font: 800 clamp(34px, 5.4vw, 72px)/1.02 var(--display); letter-spacing: -.03em; margin: 0 0 14px; text-shadow: 0 2px 24px rgba(0,0,0,.45); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: #ddd; font-size: 15px; margin-bottom: 22px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 24px 0 20px; border-radius: var(--radius); font-weight: 700; font-size: 16px; transition: opacity .15s, background .15s; }
.btn .icon { width: 24px; height: 24px; }
.btn-play { background: #fff; color: #000; }
.btn-play:hover { opacity: .8; }
.btn-ghost { background: rgba(109,109,110,.7); color: #fff; }
.btn-ghost:hover { background: rgba(109,109,110,.45); }
.btn-round { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); background: rgba(30,30,30,.6); }
.btn-round:hover { border-color: #fff; }
.btn-round .icon { width: 20px; height: 20px; }
.tag { border: 1px solid rgba(255,255,255,.4); border-radius: 3px; padding: 0 5px; font-size: 11px; line-height: 17px; font-weight: 600; color: #ddd; }
@media (max-width: 700px) {
  .hero { height: 70vh; min-height: 420px; }
  .hero-body { bottom: 12%; }
  .btn { height: 40px; font-size: 15px; padding: 0 18px 0 14px; }
}

/* ---------- rows ---------- */
.rows { position: relative; z-index: 3; margin-top: -9vw; padding-bottom: 60px; }
.rows.flat { margin-top: 0; padding-top: 100px; }
.row { margin-bottom: 3vw; }
.row-head { display: flex; align-items: baseline; gap: 12px; padding: 0 var(--pad); margin: 0 0 8px; }
.row-title { font: 700 clamp(16px, 1.45vw, 21px)/1.2 var(--display); margin: 0; }
.row-count { font-size: 13px; color: var(--faint); }
.row-wrap { position: relative; }
.track { display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--pad); padding: 10px var(--pad) 14px; scrollbar-width: none; overscroll-behavior-x: contain; }
.track::-webkit-scrollbar { display: none; }
.arrow { position: absolute; top: 10px; bottom: 14px; z-index: 4; width: var(--pad); display: grid; place-items: center; background: rgba(11,11,12,.55); opacity: 0; transition: opacity .2s, background .2s; }
.arrow .icon { width: 30px; height: 30px; transition: transform .15s; }
.arrow:hover { background: rgba(11,11,12,.8); }
.arrow:hover .icon { transform: scale(1.25); }
.arrow.l { left: 0; } .arrow.r { right: 0; }
.row-wrap:hover .arrow:not([hidden]) { opacity: 1; }
@media (hover: none) { .arrow { display: none; } }

/* ---------- tiles ---------- */
.tile { position: relative; flex: 0 0 calc((100vw - 2 * var(--pad) - (var(--per-row) - 1) * var(--gap)) / var(--per-row)); aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); scroll-snap-align: start; text-align: left; transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; background: radial-gradient(120% 120% at 0% 0%, #3a1715 0%, #1b1b1d 55%); font: 800 clamp(14px, 1.4vw, 20px)/1.1 var(--display); letter-spacing: -.02em; text-align: center; }
.tile .shade { position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.85)); }
.tile .name { position: absolute; left: 10px; right: 10px; bottom: 9px; font-weight: 700; font-size: clamp(12px, 1vw, 15px); line-height: 1.2; text-shadow: 0 1px 6px rgba(0,0,0,.8); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .sub { display: block; font-weight: 500; font-size: .82em; color: #cfcfcf; margin-top: 2px; }
.tile .bar { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.tile .bar i { display: block; height: 100%; background: var(--accent); }
.tile.has-bar .name { bottom: 14px; }
.tile .badge { position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 3px; background: rgba(0,0,0,.72); color: #ddd; }
.tile .hover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; opacity: 0; background: rgba(0,0,0,.35); transition: opacity .2s; }
.tile .hover .btn-round { width: 38px; height: 38px; }
.tile .hover .btn-round.fill { background: #fff; color: #000; border-color: #fff; }
@media (hover: hover) {
  .tile:hover { transform: scale(1.06); z-index: 2; box-shadow: 0 10px 30px rgba(0,0,0,.7); }
  .tile:hover .hover { opacity: 1; }
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 44vw), 1fr)); gap: 24px var(--gap); padding: 0 var(--pad); }
.grid .tile { flex: none; width: 100%; }

/* ---------- empty ---------- */
.empty { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 100px var(--pad); }
.empty h1 { font: 800 clamp(26px, 3vw, 40px)/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 12px; }
.empty p { color: var(--muted); max-width: 520px; margin: 0 auto 8px; }
.empty code { background: var(--surface-2); padding: 2px 8px; border-radius: 4px; color: #fff; font-size: 14px; }
.muted-note { color: var(--muted); padding: 0 var(--pad); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(90% 70% at 15% 0%, rgba(229,50,45,.22), transparent 60%), radial-gradient(70% 60% at 100% 100%, rgba(120,20,30,.25), transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); padding: 48px 40px 40px; background: rgba(0,0,0,.72); border-radius: 6px; }
.login-card .wordmark { font-size: 34px; display: block; margin-bottom: 28px; }
.login-card h1 { font: 700 26px/1.2 var(--display); margin: 0 0 8px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.field { width: 100%; height: 52px; padding: 0 16px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.3); background: rgba(22,22,22,.8); font-size: 16px; outline: none; transition: border-color .2s; }
.field:focus { border-color: #fff; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 14px; height: 48px; background: var(--accent); color: var(--accent-ink); padding: 0; }
.login-card .btn:hover { opacity: .9; }
.login-err { color: #ff8a7a; font-size: 14px; min-height: 20px; margin-top: 12px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.7); overflow-y: auto; padding: 32px 12px 60px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; max-width: 880px; margin: 0 auto; background: var(--surface); border-radius: 8px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: rise .25s cubic-bezier(.2,.7,.3,1); }
@keyframes rise { from { transform: translateY(24px) scale(.98); opacity: 0; } }
.modal-art { position: relative; aspect-ratio: 16 / 8; background: #111 center/cover no-repeat; }
.modal-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--surface)); }
.modal-art .inner { position: absolute; z-index: 1; left: 44px; right: 44px; bottom: 28px; }
.modal-art h2 { font: 800 clamp(26px, 4vw, 44px)/1.05 var(--display); letter-spacing: -.025em; margin: 0 0 18px; }
.modal-x { position: absolute; top: 14px; right: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #181818; }
.modal-body { padding: 8px 44px 40px; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: #bcbcbc; margin-bottom: 18px; }
.meta .hi { color: #46d369; font-weight: 700; }
.eps-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; }
.eps-head h3 { font: 700 22px/1.2 var(--display); margin: 0; }
.eps-head select { background: var(--surface-2); border: 1px solid #4d4d4d; border-radius: 4px; padding: 8px 12px; font-weight: 600; }
.ep { display: grid; grid-template-columns: 30px 150px 1fr auto; gap: 16px; align-items: center; width: 100%; padding: 16px 14px; border-bottom: 1px solid var(--line); border-radius: 4px; text-align: left; }
.ep:hover, .ep.cur { background: var(--surface-2); }
.ep .n { font-size: 22px; color: var(--muted); text-align: center; }
.ep .thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.ep .thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep .thumb .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.3); }
.ep .thumb .bar i { display: block; height: 100%; background: var(--accent); }
.ep .t { font-weight: 600; }
.ep .d { color: var(--muted); font-size: 14px; }
.ep .st { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .modal-art { aspect-ratio: 16 / 10; }
  .modal-art .inner { left: 18px; right: 18px; bottom: 14px; }
  .modal-body { padding: 4px 18px 40px; }
  .ep { grid-template-columns: 110px 1fr; gap: 12px; padding: 12px 6px; }
  .ep .n, .ep .d { display: none; }
}

/* ---------- player ---------- */
.player { position: fixed; inset: 0; z-index: 80; background: #000; display: grid; place-items: center; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-top { position: absolute; inset: 0 0 auto; display: flex; align-items: center; gap: 16px; padding: 18px 22px; background: linear-gradient(180deg, rgba(0,0,0,.7), transparent); transition: opacity .4s; z-index: 2; }
.player-top .back { display: grid; place-items: center; width: 44px; height: 44px; }
.player-top .back .icon { width: 30px; height: 30px; }
.player-top .pt { font-weight: 700; font-size: 17px; }
.player-top .qbtn { margin-left: auto; height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid rgba(255,255,255,.45); background: rgba(20,20,20,.6); font-size: 13px; font-weight: 600; }
.player-top .qbtn:hover { border-color: #fff; }
.player-top .pt small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.player.idle .player-top { opacity: 0; pointer-events: none; }
.player.idle { cursor: none; }
.prep { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: radial-gradient(60% 60% at 50% 50%, rgba(229,50,45,.12), transparent), #000; z-index: 1; }
.prep h2 { font: 700 24px/1.2 var(--display); margin: 0 0 8px; }
.prep p { color: var(--muted); margin: 0 0 22px; }
.meter { width: min(360px, 80vw); height: 4px; margin: 0 auto; background: rgba(255,255,255,.18); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); transition: width .6s; }
.next-card { position: absolute; right: 28px; bottom: 90px; z-index: 3; width: 320px; padding: 14px; background: rgba(20,20,20,.94); border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.next-card .lbl { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.next-card .t { font-weight: 700; margin-bottom: 12px; }
.next-card .btns .btn { height: 38px; font-size: 14px; }
@media (max-width: 520px) { .next-card { left: 12px; right: 12px; width: auto; bottom: 80px; } }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translateX(-50%); background: #fff; color: #000; padding: 10px 18px; border-radius: 4px; font-weight: 600; font-size: 14px; animation: fade .2s; }
