:root {
  --bg: #0b0c10;
  --surface: #14161c;
  --surface-2: #1c1f27;
  --line: #262a34;
  --text: #eceef3;
  --muted: #9aa1ae;
  --faint: #6b7280;
  --accent: #5b8cff;
  --good: #3ccf8e;
  --warn: #f5b84a;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 48px);
  --card-w: clamp(120px, 14vw, 180px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Pretendard Variable", Pretendard, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
main { min-height: 70vh; outline: none; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  height: 64px; padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(11,12,16,.92), rgba(11,12,16,0));
  transition: background .25s;
}
.topbar.solid { background: rgba(11,12,16,.96); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; font-size: 20px; letter-spacing: .04em; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 20px; flex: none; }
.nav a { color: var(--muted); font-weight: 500; white-space: nowrap; transition: color .15s; }
.nav a:hover, .nav a.active { color: var(--text); }
.nav .nav-short { display: none; }
.search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.07); border: 1px solid transparent; border-radius: 999px;
  padding: 0 14px; height: 38px; width: min(280px, 40vw); min-width: 38px; flex: 0 1 auto; transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--line); background: var(--surface); }
.search svg { width: 18px; height: 18px; fill: var(--muted); flex: none; }
.search input { all: unset; flex: 1; min-width: 0; font-size: 14px; }
.account:empty { display: none; }
.account-user { display: flex; align-items: center; gap: 10px; }
.account .btn { white-space: nowrap; }
.account-name { color: var(--muted); font-size: 14px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 960px) {
  .topbar { gap: 18px; }
  .search { width: min(200px, 26vw); }
  .account-name { max-width: 80px; }
}
@media (max-width: 720px) {
  .topbar { gap: 12px; }
  .nav { gap: 12px; font-size: 14px; }
  .nav a[data-nav="library"] { display: none; }
  .nav .nav-long { display: none; }
  .nav .nav-short { display: inline; }
  .search { width: 38px; padding: 0 10px; }
  .search:focus-within { width: 60vw; }
  .account-name { display: none; }
}

/* ---------- hero ---------- */
.hero { position: relative; min-height: min(78vh, 720px); display: flex; align-items: flex-end; }
.hero-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; isolation: isolate; }   /* its layers stay under the text */
.hero-img { position: absolute; inset: 0; background-image: var(--hero-wide); background-size: cover; background-position: center 25%;
  opacity: 0; transition: opacity .9s ease; }
.hero-img.on { opacity: 1; }
/* background clip: fades in over the artwork once it is playing; cropped to fill */
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%;
  opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
.hero-video.on { opacity: 1; }
.hero-bg::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(to top, var(--bg) 0%, rgba(11,12,16,.55) 45%, rgba(11,12,16,.15) 75%, rgba(11,12,16,.6) 100%),
    linear-gradient(to right, rgba(11,12,16,.9) 0%, rgba(11,12,16,.2) 60%);
}
.hero-body { position: relative; z-index: 1; padding: 120px var(--gutter) 56px; max-width: 760px;
  display: flex; flex-direction: column; justify-content: flex-end; }   /* a resize (see buildHero) clips only the empty top */
.hero-body.resizing { overflow: hidden; transition: height .5s ease; }
.hero-body > * { animation: hero-copy-in .5s ease both; }
@keyframes hero-copy-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .hero-body > * { animation: none; } .hero-body.resizing { transition: none; } }
.hero-kicker { color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.hero h1 { font-size: clamp(28px, 4.4vw, 52px); line-height: 1.12; margin: 0 0 14px; font-weight: 800; letter-spacing: -.01em; }
.hero p { color: #c9ccd4; margin: 16px 0 24px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* banner sound switch: faint, top-right corner, only while a clip is on screen */
.hero-sound {
  position: absolute; z-index: 2; top: 84px; right: var(--gutter); width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.22);
  background: rgba(0,0,0,.25); color: #fff; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .4s, background .15s;
}
.hero-sound svg { width: 18px; height: 18px; fill: currentColor; }
.hero:has(.hero-video.on) .hero-sound { opacity: .4; pointer-events: auto; }
.hero:has(.hero-video.on) .hero-sound:hover, .hero:has(.hero-video.on) .hero-sound:focus-visible { opacity: 1; background: rgba(0,0,0,.5); }
@media (max-width: 720px) { .hero-sound { top: 72px; width: 32px; height: 32px; } }
.hero-dots { position: absolute; z-index: 1; right: var(--gutter); bottom: 60px; display: flex; gap: 8px; }
.hero-dots button { width: 28px; height: 4px; border-radius: 2px; border: 0; background: rgba(255,255,255,.3); cursor: pointer; padding: 0; }
.hero-dots button.on { background: var(--text); }

/* phones: portrait poster backdrop, centred content, dots under the buttons, no overlap with the next row */
@media (max-width: 720px) {
  .hero { min-height: auto; flex-direction: column; align-items: stretch; justify-content: flex-end; }
  .hero-img { background-image: var(--hero-tall); background-position: center 20%; }
  .hero-bg::after {
    background: linear-gradient(to top, var(--bg) 0%, rgba(11,12,16,.85) 32%, rgba(11,12,16,.25) 65%, rgba(11,12,16,.55) 100%);
  }
  .hero-body { width: 100%; max-width: none; padding: min(78vw, 420px) var(--gutter) 20px; text-align: center; }
  .hero-kicker { margin-bottom: 6px; }
  .hero h1 { font-size: clamp(22px, 6.4vw, 28px); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hero .meta { justify-content: center; font-size: 13px; gap: 4px 10px; }
  .hero p { display: none; }
  .hero .btns { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .hero .btns .btn { justify-content: center; padding: 0 10px; height: 44px; font-size: 14px; }
  .hero .btns .btn:only-child { grid-column: 1 / -1; }
  .hero-dots, .hero.has-continue .hero-dots { position: relative; bottom: auto; right: auto; justify-content: center; margin: 0 auto; padding: 0 0 18px; width: 100%; }
  .hero-dots button { width: 18px; }
  .hero.hero.has-continue .hero-body { padding-bottom: 20px; }   /* doubled class: beats the desktop rule further down */
  .hero + .section.continue { margin-top: 0; }   /* beats the desktop overlap rule defined further down */
}

/* ---------- buttons / chips / meta ---------- */
.btns { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 22px;
  border-radius: 8px; border: 0; cursor: pointer; font-weight: 700; font-size: 15px;
  background: rgba(255,255,255,.14); transition: background .15s, transform .1s;
}
.btn:hover { background: rgba(255,255,255,.22); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--text); color: #0b0c10; }
.btn.primary:hover { background: #fff; }
.btn.accent { background: var(--accent); color: #fff; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: 14px; }
.meta .score { color: var(--good); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); color: #cfd3db; border: 1px solid var(--line); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: rgba(0,0,0,.65); color: #fff; }
.badge.score { color: var(--good); }
.badge.live { background: #e5484d; }
.badge.video { background: var(--accent); }

/* ---------- rows ---------- */
.section { padding: 8px 0 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 var(--gutter); margin-bottom: 12px; }
.section-head h2 { font-size: clamp(17px, 1.6vw, 21px); margin: 0; font-weight: 700; }
.section-head a { color: var(--muted); font-size: 13px; white-space: nowrap; }
.section-head a:hover { color: var(--text); }
.row-wrap { position: relative; }
.row {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--card-w); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter);
  padding: 4px var(--gutter) 12px; scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row > * { scroll-snap-align: start; }
.row.wide { grid-auto-columns: clamp(220px, 24vw, 320px); }
.row-arrow {
  position: absolute; top: 4px; bottom: 12px; width: var(--gutter); min-width: 36px; border: 0; cursor: pointer;
  background: rgba(11,12,16,.7); opacity: 0; transition: opacity .2s; z-index: 2; display: grid; place-items: center;
}
.row-arrow svg { width: 26px; height: 26px; fill: #fff; }
.row-arrow.left { left: 0; } .row-arrow.right { right: 0; }
.row-wrap:hover .row-arrow { opacity: 1; }
@media (hover: none) { .row-arrow { display: none; } }

/* ---------- poster card ---------- */
.card { display: block; min-width: 0; }
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--c, var(--surface-2)); box-shadow: 0 4px 18px rgba(0,0,0,.35);
  transition: transform .2s, box-shadow .2s;
}
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.poster img.loaded { opacity: 1; }
.poster .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font-weight: 700; color: rgba(255,255,255,.85); font-size: 14px; }
.poster .badges { z-index: 1; position: absolute; left: 8px; top: 8px; right: 8px; display: flex; justify-content: space-between; gap: 4px; }
.card:hover .poster, .card:focus-visible .poster { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,0,0,.55); }
.card-title { margin-top: 9px; font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { color: var(--faint); font-size: 12px; margin-top: 2px; }

/* episode card: banner as a dimmed backdrop, text on top */
.ecard {
  position: relative; display: flex; min-width: 0; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c, #3a3f4b) 55%, #0b0c10), #14161c);
  border: 1px solid var(--line); transition: border-color .2s, transform .2s;
}
.ecard-bg { position: absolute; inset: -12px; background-size: cover; background-position: center 30%; filter: blur(3px) saturate(1.1); opacity: .45; transition: opacity .3s, transform .4s; }
.ecard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, rgba(11,12,16,.92) 0%, rgba(11,12,16,.6) 60%, rgba(11,12,16,.35) 100%); }
.ecard-body { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 16px 18px; width: 100%; }
.ecard-ep { font-size: 28px; font-weight: 800; line-height: 1; color: color-mix(in srgb, var(--c, #fff) 45%, #fff); }
.ecard-title { font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ecard-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.ecard-play { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; flex: none; }
.ecard-play svg { width: 14px; height: 14px; fill: #0b0c10; margin-left: 2px; }
/* with a real episode thumbnail: show it sharp, darken only the bottom for the text */
.ecard-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.ecard.has-thumb::after { background: linear-gradient(to top, rgba(11,12,16,.95) 0%, rgba(11,12,16,.55) 45%, rgba(11,12,16,0) 75%); }
.ecard.has-thumb .ecard-ep { color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.ecard.has-thumb:hover .ecard-thumb { transform: scale(1.04); }
.ecard-progress { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.18); }
.ecard-progress i { display: block; height: 100%; background: var(--c, var(--accent)); filter: saturate(1.3) brightness(1.15); }
.ecard-remove {
  position: absolute; z-index: 2; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s;
}
.ecard:hover .ecard-remove, .ecard-remove:focus-visible { opacity: 1; }
.ecard-remove:hover { background: rgba(229,72,77,.9); }
@media (hover: none) { .ecard-remove { opacity: .8; } }

/* "recently watched" row overlaps the bottom of the hero */
.hero.has-continue .hero-body { padding-bottom: 150px; }
.hero.has-continue .hero-dots { bottom: 160px; }
.section.continue { position: relative; z-index: 3; margin-top: -120px; }
.ecard:hover { border-color: color-mix(in srgb, var(--c, #fff) 60%, transparent); transform: translateY(-3px); }
.ecard:hover .ecard-bg { opacity: .6; transform: scale(1.04); }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- browse ---------- */
.page { padding: 92px var(--gutter) 40px; }
.page h1 { font-size: clamp(24px, 2.6vw, 32px); margin: 0 0 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; align-items: center; }
.filters select, .filters .toggle {
  height: 38px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--text);
  padding: 0 12px; font: inherit; font-size: 14px;
}
.filters .toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.filters .toggle input { accent-color: var(--accent); }
.filters .count { margin-left: auto; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr)); gap: 26px 16px; }
.more { display: flex; justify-content: center; margin-top: 30px; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }

/* ---------- weekly schedule ---------- */
.sched-page > * { max-width: 1320px; margin-inline: auto; }
.sched-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.sched-top h1 { margin: 0; }
.sched-top .filters { margin: 0 0 0 auto; }
.sched-tabs { display: none; }
.sched { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.sched-col { min-width: 0; }
.sched-head {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 0 10px; padding: 9px 0;
  font-size: 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
}
.sched-col.today .sched-head { border-color: var(--accent); }
.sched-list { display: flex; flex-direction: column; gap: 6px; }
.sched-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }
.sc {
  position: relative; display: block; height: 140px; border-radius: 8px; overflow: hidden; isolation: isolate;
  background: var(--c, var(--surface-2)); border: 1px solid var(--line); transition: border-color .15s, transform .15s;
}
.sc:hover { border-color: #4a5266; transform: translateY(-1px); }
.sc-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; z-index: -2; }
.sc::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(0,0,0,.92) 0%, rgba(0,0,0,.6) 45%, rgba(0,0,0,.05) 100%);
}
.sc-tags { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; }
.sc-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 8px; display: flex; flex-direction: column; gap: 2px; }
.sc-title {
  font-size: 13px; font-weight: 700; line-height: 1.28; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all;
}
.sc-meta { font-size: 11.5px; color: rgba(255,255,255,.78); text-shadow: 0 1px 2px rgba(0,0,0,.8); }
.sc-tag { font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 3px; line-height: 17px; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.sc-tag.premiere { background: #f5a524; color: #111; }
.sc-tag.owned { background: var(--accent); color: #fff; }
.sc-tag.ended { background: rgba(20,22,28,.85); color: #e6e8ee; }
.sched-edit-btn { height: 38px; }
.sched-note {
  margin-bottom: 14px; padding: 10px 14px; border-radius: 8px; font-size: 13px;
  background: rgba(91,140,255,.12); border: 1px solid rgba(91,140,255,.35); color: #c9d7ff;
}
.sched.editing .sc { outline: 1px dashed rgba(255,255,255,.25); outline-offset: -1px; }
.sc.is-hidden .sc-img { filter: grayscale(1); opacity: .35; }
.sc.is-hidden .sc-body { opacity: .55; }

/* narrower screens: one weekday at a time, picked from tabs, its shows as a grid */
@media (max-width: 1023px) {
  .sched-tabs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
  .sched-tab {
    display: flex; align-items: center; justify-content: center; padding: 10px 0; border-radius: 8px; font: inherit; font-size: 15px; font-weight: 700;
    background: var(--surface); border: 1px solid var(--line); color: var(--muted); cursor: pointer;
  }
  .sched-tab { color: var(--text); }
  .sched-tab.today { border-color: var(--accent); }
  .sched-tab.active { background: var(--accent); border-color: var(--accent); }
  .sched-tab.active { color: #fff; }
  .sched { display: block; }
  .sched-col { display: none; }
  .sched-col.active { display: block; }
  .sched-head { display: none; }
  .sched-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
  .sc { height: 160px; }
  .sc-title { font-size: 14px; }
}
@media (max-width: 520px) {
  .sched-list { grid-template-columns: 1fr 1fr; }
  .sc { height: 170px; }
  .sc-title { font-size: 13px; }
}

/* ---------- detail ---------- */
.d-hero { position: relative; min-height: 440px; }
.d-backdrop { position: absolute; inset: 0; background-size: cover; background-position: center 25%; }
.d-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 2%, rgba(11,12,16,.7) 50%, rgba(11,12,16,.45) 100%); }
.d-backdrop.nobanner { background: radial-gradient(1200px 400px at 30% 0%, color-mix(in srgb, var(--accent) 35%, transparent), transparent); }
.d-head { position: relative; display: grid; grid-template-columns: clamp(150px, 18vw, 240px) 1fr; gap: clamp(18px, 3vw, 40px); padding: 150px var(--gutter) 24px; align-items: end; }
.d-head .poster { box-shadow: 0 18px 50px rgba(0,0,0,.6); }
.d-title h1 { font-size: clamp(24px, 3.4vw, 42px); line-height: 1.15; margin: 8px 0 14px; font-weight: 800; }
.d-title .aliases { color: var(--muted); font-size: 14px; margin-top: -6px; margin-bottom: 14px; }
.scorebox { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 800; font-size: 22px; color: var(--good); }
.scorebox small { color: var(--muted); font-size: 13px; font-weight: 500; }
.d-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; padding: 8px var(--gutter) 40px; align-items: start; }
.d-body h2 { font-size: 18px; margin: 30px 0 14px; }
.d-body h2:first-child { margin-top: 0; }
/* pull the first line up by its half-leading so the text top lines up with the episode box border */
.synopsis { color: #cfd3db; white-space: pre-line; margin-top: -0.275em; }
.synopsis.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; margin-top: 6px; }
.info { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.info dl { display: grid; grid-template-columns: 84px 1fr; gap: 10px 12px; margin: 0; font-size: 14px; }
.info dt { color: var(--faint); }
.info dd { margin: 0; }
.info + .info { margin-top: 16px; }
.info h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; }
.links a { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.links a:first-of-type { border-top: 0; }
.links a span { color: var(--faint); font-size: 12px; }
.links a:hover { color: var(--accent); }
.tag.spoiler { filter: blur(4px); user-select: none; }
.tags-wrap.reveal .tag.spoiler { filter: none; user-select: auto; border-color: #5a3a3a; }
.tag .rel { color: var(--faint); margin-left: 4px; font-size: 11px; }
.eplist { display: grid; gap: 8px; }
.ep {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s, background .15s;
}
.ep:hover { border-color: var(--accent); background: var(--surface-2); }
.ep-bg {
  position: absolute; inset: 0 0 0 auto; width: 62%; z-index: -1;
  background: center / cover no-repeat; opacity: .45; transition: opacity .2s, transform .3s;
  -webkit-mask-image: linear-gradient(to left, #000 15%, transparent 100%);
          mask-image: linear-gradient(to left, #000 15%, transparent 100%);
}
.ep:hover .ep-bg { opacity: .65; transform: scale(1.03); }
.ep-body { min-width: 0; }
.ep .t { font-weight: 700; }
.ep .s { color: var(--faint); font-size: 13px; }
.ep.has-thumb .s { color: var(--muted); }
.ep.has-thumb .t, .ep.has-thumb .s { text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.ep .go {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background .15s, border-color .15s, transform .15s;
}
.ep .go svg { width: 18px; height: 18px; fill: var(--text); margin-left: 2px; }
.ep:hover .go { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.notice { background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; padding: 18px; color: var(--muted); font-size: 14px; }
.next-air { display: inline-flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: #dfe6ff; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.trailer { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; cursor: pointer; }
.trailer img { width: 100%; height: 100%; object-fit: cover; opacity: .75; }
.trailer .play { position: absolute; inset: 0; display: grid; place-items: center; }
.trailer .play i { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; }
.trailer .play svg { width: 24px; height: 24px; fill: #0b0c10; margin-left: 3px; }
.trailer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 900px) {
  .d-body { grid-template-columns: 1fr; }
  .d-side { order: -1; }
  .d-head { grid-template-columns: 120px 1fr; padding-top: 110px; }
}

/* ---------- watch: full-viewport player ---------- */
body.watching { overflow: hidden; background: #000; }
body.watching .topbar, body.watching .footer { display: none; }
.watch { position: fixed; inset: 0; z-index: 100; background: #000; }
.w-stage, .watch .plyr { width: 100%; height: 100%; }
.watch video { width: 100%; height: 100%; object-fit: contain; background: #000; }

/* Plyr theme */
.watch .plyr {
  --plyr-color-main: var(--accent);
  --plyr-font-family: inherit;
  --plyr-control-icon-size: 20px;
  --plyr-control-spacing: 12px;
  --plyr-control-radius: 8px;
  --plyr-range-thumb-height: 14px;
  --plyr-range-track-height: 4px;
  --plyr-video-controls-background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,.45) 55%, transparent);
  --plyr-menu-background: rgba(20,22,28,.96);
  --plyr-menu-color: var(--text);
  --plyr-menu-radius: 10px;
  --plyr-tooltip-background: rgba(20,22,28,.95);
  --plyr-tooltip-color: var(--text);
  --plyr-captions-background: transparent;
  --plyr-captions-text-color: #fff;
  font-family: inherit;
}
.watch .plyr__controls { padding: 60px clamp(14px, 3vw, 36px) clamp(14px, 2.4vw, 26px); }
.watch .plyr__control--overlaid { --plyr-control-icon-size: 30px; padding: 26px; background: color-mix(in srgb, var(--accent) 85%, transparent); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.watch .plyr__menu__container { backdrop-filter: blur(12px); }
/* Subtitles: sized by the player's own width (container units), so a small window, the normal page and
   fullscreen all get a comfortable size (about 4-5% of the picture height for 16:9). */
.watch .plyr { container-type: inline-size; }
.watch .plyr .plyr__captions { font-size: clamp(15px, 2.7cqw, 40px); padding: 0 6% 2.2cqw; line-height: 1.28; }
.watch .plyr__caption {
  display: inline; padding: 0 .2em; line-height: 1.28; background: transparent;   /* Plyr's own is 185% */ color: #fff; font-weight: 600; letter-spacing: -.01em;
  /* outline only: a dark edge on every side keeps white text readable on bright scenes */
  text-shadow: 0 0 .1em #000, 0 0 .1em #000, 0 0 .14em #000, .05em .05em .08em #000, -.05em -.05em .08em #000,
               .05em -.05em .08em #000, -.05em .05em .08em #000;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
@media (max-width: 640px) { .watch .plyr .plyr__captions { font-size: clamp(14px, 4cqw, 22px); } }
.watch .plyr__progress input[type=range] { cursor: pointer; }

/* overlays (auto-hide together with Plyr controls) */
.w-top {
  position: absolute; inset: 0 0 auto 0; z-index: 4; display: flex; align-items: center; gap: 16px;
  padding: clamp(14px, 2.4vw, 26px) clamp(14px, 3vw, 36px) 60px;
  background: linear-gradient(to bottom, rgba(0,0,0,.8), rgba(0,0,0,.35) 60%, transparent);
  transition: opacity .3s, transform .3s; pointer-events: none;
}
.w-top > * { pointer-events: auto; }
.w-back { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.12); flex: none; transition: background .15s; }
.w-back:hover { background: rgba(255,255,255,.24); }
.w-back svg { width: 26px; height: 26px; fill: #fff; }
.w-heading { min-width: 0; }
.w-anime { font-size: 13px; color: rgba(255,255,255,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-ep { font-size: clamp(18px, 2vw, 24px); font-weight: 800; line-height: 1.2; }
.w-ep span { color: rgba(255,255,255,.55); font-weight: 600; font-size: .7em; }
.w-top-actions { margin-left: auto; display: flex; gap: 8px; }
.w-chip { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: 13px; font-weight: 600; transition: background .15s; }
.w-chip:hover { background: rgba(255,255,255,.24); }
.w-chip svg { width: 18px; height: 18px; fill: currentColor; }
.plyr--hide-controls .w-top { opacity: 0; transform: translateY(-8px); }
.plyr--hide-controls .w-top > * { pointer-events: none; }

.w-skip {
  position: absolute; z-index: 10; right: clamp(14px, 3vw, 36px); bottom: clamp(90px, 12vh, 120px);
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px 0 20px; border-radius: 10px;
  background: rgba(20,22,28,.85); border: 1px solid rgba(255,255,255,.28); color: #fff; font: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; backdrop-filter: blur(6px); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .25s, transform .25s, background .15s;
}
.w-skip.show { opacity: 1; transform: none; pointer-events: auto; }
.w-skip:hover { background: #fff; color: #0b0c10; }
.w-skip svg { width: 18px; height: 18px; fill: currentColor; }
/* controls hidden: the skip button stays on top, moved down into the space the control bar leaves */
.plyr--hide-controls .w-skip { bottom: clamp(24px, 5vh, 48px); }
.w-skip { transition: opacity .25s, transform .25s, background .15s, bottom .25s; }

/* auto-skip switch: a row in the settings menu */
.watch .plyr__menu .plyr__control.w-autoskip { display: flex; align-items: center; width: 100%; gap: 14px; white-space: nowrap; }
.watch .plyr__menu .w-autoskip .plyr__menu__value { margin-left: auto; padding-left: 10px; display: inline-flex; }
.w-autoskip-dot { position: relative; width: 28px; height: 16px; border-radius: 999px; background: rgba(255,255,255,.28); transition: background .2s; flex: none; }
.w-autoskip-dot::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s; }
.w-autoskip[aria-pressed="true"] .w-autoskip-dot { background: var(--accent); }
.w-autoskip[aria-pressed="true"] .w-autoskip-dot::after { transform: translateX(12px); }
/* episode list button in the control bar */
.watch .plyr__control.w-list-btn svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; width: 20px; height: 20px; }
.watch .plyr__control.w-list-btn.plyr__control--pressed { background: var(--accent); color: #fff; }
/* while the episode list is open the controls stay up */
.watch .plyr.wl-open.plyr--hide-controls { cursor: auto; }
.watch .plyr.wl-open.plyr--hide-controls .plyr__controls { opacity: 1; pointer-events: auto; transform: none; }
.watch .plyr.wl-open.plyr--hide-controls .w-top { opacity: 1; transform: none; }
.watch .plyr.wl-open.plyr--hide-controls .w-top > * { pointer-events: auto; }
.watch .plyr.wl-open.plyr--hide-controls .w-skip { bottom: clamp(90px, 12vh, 120px); }

.w-toast {
  position: absolute; z-index: 10; left: 50%; top: clamp(70px, 12vh, 110px); transform: translate(-50%, -6px);
  padding: 9px 16px; border-radius: 999px; background: rgba(20,22,28,.88); border: 1px solid rgba(255,255,255,.18);
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.w-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* info button (top bar) + popup */
.w-info-btn { width: 36px; min-width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 0; padding: 0;
  background: rgba(255,255,255,.12); color: #fff; cursor: pointer; transition: background .15s; }
.w-info-btn:hover { background: rgba(255,255,255,.24); }
.w-info-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.w-top-actions { margin-left: 0; }
.w-heading { margin-right: auto; }

.wi-overlay { position: absolute; inset: 0; z-index: 12; display: none; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0,0,0,.45); }
.wi-overlay.show { display: flex; }
.wi-card { width: min(560px, 100%); max-height: min(86%, 760px); display: flex; flex-direction: column; border-radius: 14px;
  background: rgba(20,22,28,.94); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 20px 60px rgba(0,0,0,.6);
  backdrop-filter: blur(10px); color: #fff; overflow: hidden; }
.wi-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.wi-head > div { flex: 1; min-width: 0; }
.wi-title { font-size: 16px; font-weight: 800; }
.wi-sub { font-size: 13px; color: rgba(255,255,255,.65); margin-top: 2px; }
.wi-close { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; flex: none; }
.wi-close:hover { background: rgba(255,255,255,.22); }
/* inside the player Plyr's own button rules (padding, sizing) win over the plain class, so pin the circle */
.watch .plyr .wi-close { width: 32px; height: 32px; min-width: 32px; padding: 0; margin: 0; display: grid; place-items: center;
  flex: none; font-size: 20px; line-height: 1; border-radius: 50%; aspect-ratio: 1; }
.wi-body { overflow-y: auto; padding: 6px 20px 18px; }
.wi-body section { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.wi-body section:last-child { border-bottom: 0; }
.wi-body h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--accent); }
.wi-body dl { margin: 0; display: grid; gap: 6px; }
.wi-row { display: grid; grid-template-columns: 116px 1fr; gap: 12px; font-size: 13px; }
.wi-row dt { color: rgba(255,255,255,.55); }
.wi-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.wi-muted { font-size: 13px; color: rgba(255,255,255,.55); }
.wi-skips { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wi-skips li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.wi-skips button { font: inherit; font-variant-numeric: tabular-nums; color: #fff; background: rgba(255,255,255,.1); border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.wi-skips button:hover { background: var(--accent); }
.wi-skips span { color: rgba(255,255,255,.6); }
@media (max-width: 640px) { .wi-row { grid-template-columns: 92px 1fr; } }

/* episode list panel: slides in on the right, above the control bar, while the video keeps playing */
.wl-panel {
  position: absolute; z-index: 11; top: clamp(70px, 10vh, 96px); right: clamp(10px, 2vw, 24px); bottom: 64px;
  width: min(340px, calc(100% - 20px)); display: flex; flex-direction: column; border-radius: 12px; overflow: hidden;
  background: rgba(16,18,24,.9); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 16px 50px rgba(0,0,0,.55);
  backdrop-filter: blur(10px); color: #fff;
  opacity: 0; transform: translateX(16px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.wl-panel.show { opacity: 1; transform: none; pointer-events: auto; }
.wl-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 10px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.wl-head > div { flex: 1; min-width: 0; }
.wl-title { font-size: 15px; font-weight: 800; }
.wl-count { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.wl-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; color: #fff; transition: background .15s; }
a.wl-item:hover { background: rgba(255,255,255,.1); }
.wl-item.current { background: color-mix(in srgb, var(--accent) 28%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 70%, transparent); }
.wl-thumb { position: relative; flex: none; width: 96px; aspect-ratio: 16 / 9; border-radius: 5px; overflow: hidden; background: rgba(255,255,255,.08); }
.wl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.wl-thumb i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.wl-item.done .wl-thumb img { opacity: .6; }
.wl-text { min-width: 0; }
.wl-ep { font-size: 14px; font-weight: 700; }
.wl-sub { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 2px; }
.wl-item.current .wl-sub { color: #fff; font-weight: 600; }
/* the skip button moves out from under the open panel */
.wl-open .w-skip { right: calc(clamp(10px, 2vw, 24px) + min(340px, calc(100% - 20px)) + 12px); }
@media (max-width: 640px) {
  /* portrait phone: a sheet in the space under the (16:9, vertically centred) video, so the picture stays visible */
  .watch .plyr { --wl-h: max(170px, calc(50% - 28.125vw - 66px)); }
  .wl-panel { top: auto; left: 8px; right: 8px; bottom: 58px; width: auto; height: var(--wl-h); transform: translateY(16px); }
  .wl-thumb { width: 84px; }
  .wl-open .w-skip, .plyr--hide-controls.wl-open .w-skip { right: 8px; bottom: calc(58px + var(--wl-h, 170px) + 10px); }
}

.w-error { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); background: rgba(0,0,0,.85); text-align: center; padding: 20px; }

@media (max-width: 640px) {
  .w-top-actions { display: none; }
  .watch .plyr__control[data-plyr="rewind"], .watch .plyr__control[data-plyr="fast-forward"], .watch .plyr__volume { display: none; }
}

/* ---------- admin ---------- */
.btn.xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.danger { background: rgba(239,68,68,.18); color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,.32); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.ad-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 28px; align-items: start; }
.ad-side { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px; }
.ad-side-head { font-size: 12px; font-weight: 800; color: var(--accent); padding: 0 10px 10px; letter-spacing: .04em; }
.ad-nav { display: grid; gap: 2px; }
.ad-nav-link { display: block; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.ad-nav-link:hover { background: var(--surface-2); color: var(--text); }
.ad-nav-link.active { background: var(--surface-2); color: var(--text); font-weight: 700; }
.ad-nav-group { margin-top: 6px; }
.ad-nav-title { padding: 8px 10px 4px; font-size: 13px; font-weight: 700; color: var(--text); }
.ad-nav-group .ad-nav-link { padding-left: 22px; }
.ad-main h2 { font-size: 17px; margin: 28px 0 10px; }
.ad-sub { font-size: 12px; color: var(--faint); }
.ad-back { display: inline-block; margin: -8px 0 14px; font-size: 13px; color: var(--muted); }
.ad-back:hover { color: var(--text); }
.ad-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.ad-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.ad-stat.link:hover { border-color: var(--accent); }
.ad-stat-label { font-size: 12px; color: var(--muted); }
.ad-stat-value { font-size: 24px; font-weight: 800; margin-top: 4px; }
.ad-stat-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.ad-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 14px; }
.ad-anime { grid-template-columns: 120px minmax(0, 1fr); align-items: start; }
.ad-cover { width: 120px; border-radius: 8px; }
.ad-anime-info { display: grid; gap: 14px; min-width: 0; }
.ad-dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 14px; }
.ad-dl dt { color: var(--muted); }
.ad-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ad-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.ad-card .ad-toolbar { margin: 0; }
.ad-label { font-size: 13px; color: var(--muted); }
.ad-input { height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; }
.ad-input:focus { outline: none; border-color: var(--accent); }
.ad-input.wide { flex: 1; min-width: 200px; }
.ad-input.sm { height: 30px; width: 96px; }
.ad-input.time { width: 76px; font-variant-numeric: tabular-nums; }
.ad-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ad-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ad-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.ad-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-table tr.clickable { cursor: pointer; }
.ad-table tr.clickable:hover td { background: rgba(255,255,255,.03); }
.ad-table a { color: var(--text); }
.ad-table a:hover { color: var(--accent); }
.ad-thumb { width: 44px; }
.ad-thumb img { width: 36px; height: 52px; object-fit: cover; border-radius: 4px; }
.ad-switch { position: relative; display: inline-flex; vertical-align: middle; cursor: pointer; }
.ad-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.ad-switch-track { width: 40px; height: 22px; border-radius: 999px; background: #3a3f4b; transition: background .15s; position: relative; }
.ad-switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s;
}
.ad-switch input:checked + .ad-switch-track { background: var(--accent); }
.ad-switch input:checked + .ad-switch-track::after { transform: translateX(18px); }
.ad-switch input:focus-visible + .ad-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.ad-switch input:disabled + .ad-switch-track { opacity: .6; }
.ad-hero-mode { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.ad-hero-mode-title { font-weight: 700; margin-bottom: 4px; }
.ad-hero-list { display: grid; gap: 8px; }
.ad-hero-row { display: grid; grid-template-columns: 24px 120px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; }
.ad-hero-num { color: var(--muted); font-weight: 700; text-align: center; }
.ad-hero-art { width: 120px; aspect-ratio: 16 / 7; border-radius: 6px; background: var(--surface-2) center 25% / cover no-repeat; }
.ad-hero-info { min-width: 0; }
.ad-hero-title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-hero-tools { display: flex; gap: 4px; }
.ad-hero-results { display: grid; gap: 6px; margin-top: 10px; max-height: 420px; overflow-y: auto; }
.ad-hero-result { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 4px; border-radius: 6px; }
.ad-hero-result:hover { background: var(--surface-2); }
.ad-hero-result img { width: 34px; height: 48px; object-fit: cover; border-radius: 4px; }
@media (max-width: 640px) {
  .ad-hero-row { grid-template-columns: 20px 80px minmax(0, 1fr); }
  .ad-hero-row > .ad-badge, .ad-hero-row > .ad-hero-tools { grid-column: 3; justify-self: start; }
  .ad-hero-art { width: 80px; }
}
.ad-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.ad-badge.admin { background: rgba(91,140,255,.18); color: #a9c1ff; }
.ad-badge.ok { background: rgba(60,207,142,.16); color: #8ee6bd; }
.ad-badge.blocked { background: rgba(239,68,68,.18); color: #fca5a5; }
.ad-meter { display: inline-block; width: 54px; height: 6px; border-radius: 3px; background: var(--surface-2); vertical-align: middle; overflow: hidden; }
.ad-meter span { display: block; height: 100%; background: var(--good); }
.ad-panel-body { display: grid; gap: 8px; padding: 6px 0; }
.ad-panel-title { font-size: 13px; font-weight: 700; margin-top: 4px; }
.ad-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.ad-seg-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ad-top { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.ad-top-item img, .ad-top-ph { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.ad-top-title { font-size: 13px; font-weight: 600; margin-top: 6px; }
.ad-notice { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translate(-50%, 10px); padding: 10px 18px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.ad-notice.show { opacity: 1; transform: translate(-50%, 0); }
.ad-notice.ok { border-color: rgba(60,207,142,.5); }
.ad-notice.err { border-color: rgba(239,68,68,.6); color: #fca5a5; }
.btn.xs.accent { background: var(--accent); color: #fff; }
.ad-time { display: inline-flex; gap: 4px; align-items: center; }
.ad-video { width: 100%; max-height: 40vh; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; }
.ad-ep-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: stretch; }
.ad-player .ad-video { max-height: 44vh; }
.ad-subs-box { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.ad-subs { position: relative; flex: 1; min-height: 200px; max-height: 60vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 4px; }
.ad-subs-head { display: flex; align-items: center; gap: 8px; }
.ad-subs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ad-grow { flex: 1; }
.ad-subs-box.dirty .ad-subs-head .ad-panel-title::after { content: ' · 저장 안 됨'; color: var(--warn); font-weight: 600; }
.ad-subs-box.editing { grid-column: 1 / -1; }
.ad-subs-box.editing .ad-subs { flex: none; max-height: 62vh; }
.ad-cue-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; padding: 6px; border-radius: 6px; }
.ad-cue-row.active { background: rgba(91,140,255,.14); }
.ad-cue-edit { flex: 1; min-width: 220px; height: auto; padding: 6px 8px; resize: vertical; line-height: 1.4; font-size: 13px; }
.ad-tool { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s; white-space: nowrap; }
.ad-tool:hover { background: #262a34; border-color: #343a47; }
.ad-tool.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ad-tool.primary:hover { background: #4a7bf0; }
.ad-tool-icon { display: inline-flex; }
.ad-tool-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ad-tool-group { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 10px; }
.ad-tool-group .ad-tool { height: 26px; padding: 0 9px; }
.ad-tool-group .ad-input { height: 26px; }
.ad-tool-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.ad-subs-box.empty .ad-subs-tools { display: none; }
.ad-subs-empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px 12px; text-align: center; }
.ad-subs-empty-icon svg { width: 42px; height: 42px; fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-linecap: round; }
.ad-subs-empty-title { font-size: 15px; font-weight: 700; }
.ad-subs-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.ad-drop-hint { margin-top: 2px; }
.ad-subs-box.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.ad-subs-box.drop .ad-subs { background: rgba(91,140,255,.08); }
.ad-import { display: grid; gap: 12px; }
.ad-import-all { display: grid; gap: 10px; margin-bottom: 14px; }
.ad-import-all-result { display: grid; gap: 8px; }
.ad-import-all-result:empty { display: none; }
.ad-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; }
.ad-chip:hover { border-color: var(--accent); }
.ad-import-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ad-nowrap { white-space: nowrap; }
.ad-nowrap > * + * { margin-left: 6px; }
.ad-subs-box.comparing { outline: 1px solid rgba(245,184,74,.5); }
.ad-compare-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-unsorted-pick { width: auto; max-width: 220px; }
.ad-import-state:empty { display: none; }
/* scrollable without a visible scrollbar */
.ad-subs { scrollbar-width: none; -ms-overflow-style: none; }
.ad-subs::-webkit-scrollbar { display: none; }
.ad-cue { display: grid; grid-template-columns: 46px 1fr; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 5px 6px; border-radius: 6px; font-size: 12px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.ad-cue:hover { background: var(--surface-2); color: var(--text); }
.ad-cue.active { background: rgba(91,140,255,.18); color: var(--text); }
.ad-cue-time { font-variant-numeric: tabular-nums; color: var(--faint); }
.ad-cue.active .ad-cue-time { color: var(--accent); font-weight: 700; }
.ad-cue-text { white-space: pre-line; }
@media (min-width: 1000px) {
  .ad-ep-grid { grid-template-columns: minmax(0, 1fr) 340px; }
  /* the list fills the box; flex-basis 0 keeps the lines from setting the row height (the player card does) */
  .ad-subs-box:not(.editing) .ad-subs { flex: 1 1 0; min-height: 0; max-height: none; }
}
.ad-timeline-row { display: flex; align-items: center; gap: 12px; }
.ad-timeline { position: relative; flex: 1; height: 14px; border-radius: 4px; background: var(--surface-2); cursor: pointer; overflow: hidden; }
.ad-timeline-seg { position: absolute; top: 0; bottom: 0; background: rgba(91,140,255,.55); }
.ad-timeline-seg.manual { background: rgba(60,207,142,.6); }
.ad-timeline-seg.aniskip { background: rgba(245,184,74,.6); }
.ad-timeline-head { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; transform: translateX(-1px); pointer-events: none; }
.ad-now { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 110px; text-align: right; color: var(--muted); }
.ad-now.in-skip { color: var(--accent); font-weight: 700; }
.ad-jumps { display: grid; gap: 6px; }
.ad-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
@media (max-width: 860px) {
  .ad-layout { grid-template-columns: 1fr; gap: 16px; }
  .ad-side { position: static; }
  .ad-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .ad-nav-group { display: contents; }
  .ad-nav-title { display: none; }
  .ad-nav-group .ad-nav-link { padding-left: 10px; }
  .ad-anime { grid-template-columns: 1fr; }
  .ad-cover { width: 100px; }
}

/* ---------- footer ---------- */
.footer { color: var(--faint); font-size: 12px; padding: 24px var(--gutter) 40px; border-top: 1px solid var(--line); }
.footer a { color: var(--muted); }

/* ---------- Windows app page (#/app) ---------- */
.nav a.nav-app { color: var(--accent); }
@media (max-width: 960px) { .nav a.nav-app { display: none; } }
.app-page { max-width: 1240px; margin: 0 auto; }
.app-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; align-items: center; padding: 28px 0 56px; }
.app-kicker { color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 12px; }
.app-hero h1 { font-size: clamp(30px, 4vw, 50px); line-height: 1.12; margin: 0 0 18px; font-weight: 800; letter-spacing: -.01em; }
.app-hero h1 span { background: linear-gradient(90deg, var(--accent), #8a6bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.app-hero p { color: #c9ccd4; font-size: 16px; line-height: 1.7; margin: 0 0 28px; max-width: 520px; }
.app-dl { height: auto; padding: 14px 24px 14px 18px; gap: 14px; border-radius: 14px; box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 35%, transparent); }
.app-dl > span:last-child { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.app-dl b { font-size: 16px; }
.app-dl small { font-size: 12.5px; opacity: .85; font-weight: 500; }
.app-dl-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.app-dl-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.app-inapp { display: inline-block; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); font-weight: 600; }
.app-req { margin-top: 16px; color: var(--muted); font-size: 13px; }
.app-shots { position: relative; padding-bottom: 14%; }
.app-shot { display: block; width: 100%; border-radius: 12px; border: 1px solid rgba(255,255,255,.1); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.app-shot.player { position: absolute; width: 56%; right: -4%; bottom: 0; border-radius: 10px; box-shadow: 0 24px 60px rgba(0,0,0,.75); }
.app-feats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 40px; }
.app-feat { padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.app-feat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 14px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.app-feat-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-feat h3 { margin: 0 0 6px; font-size: 15.5px; }
.app-feat p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.app-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.app-card { padding: 22px 24px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.app-card h2 { margin: 0 0 14px; font-size: 17px; }
.app-keys { display: grid; grid-template-columns: max-content 1fr; gap: 9px 16px; margin: 0; font-size: 14px; align-items: center; }
.app-keys dd { margin: 0; color: #d6d9e0; }
.app-keys kbd { display: inline-block; min-width: 26px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; font: inherit; font-size: 12.5px; font-weight: 700; text-align: center; }
.app-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: #d6d9e0; font-size: 14px; line-height: 1.6; }
.app-steps b { color: var(--text); }
@media (max-width: 1000px) {
  .app-hero { grid-template-columns: 1fr; gap: 32px; }
  .app-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .app-feats { grid-template-columns: 1fr; }
  .app-shot.player { display: none; }
  .app-shots { padding-bottom: 0; }
}

/* ---------- SUNNAS desktop app (html.desktop-app) ---------- */
/* the window has no title bar: the top bar (and the player's top strip) drag the window, and room is kept
   on the right for the min / max / close buttons Windows draws over the page (window controls overlay) */
.desktop-app { --wco-right: 140px; }   /* the app also sets it (src/main.js CONTROLS_WIDTH) */
.desktop-app .w-top { -webkit-app-region: drag; padding-right: calc(clamp(14px, 3vw, 36px) + var(--wco-right)); }
.desktop-app .w-top a, .desktop-app .w-top button { -webkit-app-region: no-drag; }
.desktop-app .wi-overlay, .desktop-app .wl-panel, .desktop-app .plyr__controls { -webkit-app-region: no-drag; }
/* scrollbars hidden (scrolling still works) */
.desktop-app, .desktop-app * { scrollbar-width: none; }   /* the page itself and every scrolling box */
.desktop-app::-webkit-scrollbar, .desktop-app ::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* the app has its own sidebar (desktop/src/sidebar): the site's top bar is not shown there */
.desktop-app .topbar { display: none; }
.desktop-app .page { padding-top: 56px; }
/* a strip along the top of the page moves the window (it has no title bar) */
.desktop-app body:not(.watching)::before {
  content: ""; position: fixed; z-index: 49; top: 0; left: 0; right: 0; height: 36px; -webkit-app-region: drag;
}
