:root {
  color-scheme: dark;
  --bg: #0e0e16;
  --panel: #181826;
  --line: #37344a;
  --text: #f7f5ff;
  --muted: #beb9d0;
  --accent: #d0b6ff;
  --ink: #201435;
  --gutter: clamp(18px, 4.8vw, 86px);
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--text) }
[hidden] { display: none !important }
a { color: inherit; text-decoration: none }
button, input, select { font: inherit }
button, select { cursor: pointer }
button { color: inherit; background: #272538; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .95rem }
button:hover { background: #3b3555 }
button:disabled { opacity: .6 }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
h1, h2, h3, p { margin: 0 }
p { color: var(--muted) }
.primary { background: var(--accent); color: var(--ink); border-color: transparent; font-weight: 750 }
.primary:hover { background: #eadcff }
.brand { display: inline-flex; align-items: center; gap: 2px; width: max-content; font-size: 1.92rem; font-weight: 850; letter-spacing: -.075em; line-height: 1 }
.brand span { color: var(--accent) }
.brand i { width: 6px; height: 6px; margin: 17px 0 0 4px; background: var(--accent); transform: rotate(45deg) }

#signin { min-height: 100svh; display: grid; grid-template-columns: 1.1fr 1fr }
.login-art { display: grid; place-items: center; background: radial-gradient(ellipse, #3f2d68, #1d1731 53%, #0d0b14 87%); overflow: hidden }
.prism { width: min(25vw,330px); aspect-ratio: 1; background: linear-gradient(135deg,#f3e6ff,#785ca9 32%,#33234d 33%,#b285ec 67%,#4f3177 68%,#201c38); transform: rotate(29deg) skew(-9deg,-9deg); border-radius: 19%; box-shadow: 8px 25px 60px #07040caa,inset 0 0 24px #e8d6ff5c; border: 1px solid #e9beff65 }
#login { width: min(100% - 3rem,390px); margin: auto; display: grid; gap: 1.15rem; padding: 3rem 0 }
#login h1 { font-size: 2.8rem; letter-spacing: -.06em; margin-top: 1.6rem }
label { display: grid; gap: .35rem }
input, select { background: #191827; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; min-width: 0 }
#login-error, #video-error, .card-status { color: #ffb7bf }

.topbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: clamp(14px, 2.6vw, 44px); min-height: 74px; padding: 10px var(--gutter); background: #11111bf5; border-bottom: 1px solid #262438; backdrop-filter: blur(15px) }
nav { display: flex; align-items: center; gap: clamp(12px, 1.8vw, 24px); white-space: nowrap }
nav a { position: relative; padding: 8px 0; font-size: .92rem; font-weight: 650; color: var(--muted) }
nav a:hover, nav a[aria-current] { color: var(--text) }
nav a[aria-current]::after { content: ""; position: absolute; inset: auto 0 0; height: 2px; border-radius: 8px; background: var(--accent) }
#search { display: flex; align-items: center; margin-left: auto; min-width: 94px }
#search input { width: clamp(78px, 14vw, 200px); background: #1a1928; border-radius: 8px 0 0 8px }
#search button { display: grid; place-items: center; padding: .75rem; border-left: 0; border-radius: 0 8px 8px 0 }
#logout { text-align: left; display: flex; align-items: center; gap: 8px; background: transparent; border: 0; padding: 4px }
#avatar { display: grid; place-items: center; min-width: 33px; height: 33px; border-radius: 8px; background: #3d2b59; color: var(--accent); font-weight: 750 }
#logout small { display: block; color: var(--muted); font-size: .75rem }
#profile { overflow-wrap: anywhere }

.hero { position: relative; isolation: isolate; margin-bottom: 22px }
.hero-panel { position: relative; isolation: isolate; display: flex; align-items: end; min-height: clamp(405px, min(44vw, 64svh), 650px); background: radial-gradient(ellipse at 77% 40%, #4b345e, #13111d 79%); overflow: hidden }
.hero-panel::after, .detail-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, var(--bg), transparent 58%), linear-gradient(90deg, #100d1aed 0%, #100e1abb 29%, transparent 77%) }
.hero-panel > img, .detail-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 38%; z-index: -2 }
.hero-copy { max-width: min(730px, 72%); padding: 38px var(--gutter) clamp(28px, 4.5vw, 65px) }
.hero h1 { font-size: clamp(3rem, 6.5vw, 7.5rem); line-height: .93; letter-spacing: -.075em; text-wrap: balance; margin: .45rem 0 .9rem }
.tag { display: inline-block; color: #eadcff; font-weight: 750; font-size: .875rem; background: #251735ca; border: 1px solid #bfa4ed68; border-radius: 6px; padding: .25rem .55rem }
.meta { color: #e8dcf7; font-size: .93rem; margin: .3rem 0 }
.summary { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; color: #e2dced; margin: .75rem 0 }
.actions { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: 1.15rem }
.hero .actions button { padding: .7rem 1.2rem }
.hero-picks { position: absolute; right: var(--gutter); bottom: clamp(28px, 4.5vw, 65px); display: flex; gap: 7px }
.hero-pick { width: clamp(47px, 6.4vw, 105px); aspect-ratio: 16/10; padding: 0; overflow: hidden; border: 2px solid #8b7a9f9d; background: #35254d; opacity: .77 }
.hero-pick:hover, .hero-pick[aria-pressed="true"] { opacity: 1 }
.hero-pick[aria-pressed="true"] { border-color: var(--accent) }
.hero-pick img { display: block; width: 100%; height: 100%; object-fit: cover }

.shelf, .catalog { margin: 0 var(--gutter) 33px }
.catalog { margin-top: clamp(24px, 5vw, 68px) }
.shelf h2 { font-size: clamp(1.2rem, 2.1vw, 1.7rem); letter-spacing: -.033em }
.shelf-link:hover { color: var(--accent); text-decoration: underline }
.catalog h1 { font-size: clamp(1.65rem, 3.5vw, 2.8rem); line-height: 1.1; letter-spacing: -.06em }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; gap: 10px }
.row-controls { display: flex; gap: .35rem }
.row-controls button { min-width: 34px; padding: .15rem .6rem; font-size: 1.15rem; line-height: 1.25 }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(168px, 17.5vw, 315px); gap: 10px; overflow: auto; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: #524568 transparent; padding: 5px 5px 10px; margin: -5px }
.card { position: relative; min-width: 0; width: 100%; scroll-snap-align: start }
.card-cover { display: block; width: 100%; padding: 0; overflow: hidden; background: #1b1829; border: 1px solid #343044; text-align: left; border-radius: 8px }
.card:hover .card-cover, .card:focus-within .card-cover { border-color: #ab91cb; background: #2c233b }
.thumb { aspect-ratio: 16/9; position: relative; background: linear-gradient(135deg,#473863,#1e172d); overflow: hidden }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover }
.card strong { display: block; padding: .45rem .55rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem }
.card-actions { position: absolute; top: 0; left: 0; right: 0; aspect-ratio: 16/9; display: flex; gap: 6px; align-items: end; padding: 8px; pointer-events: none; opacity: 0; background: linear-gradient(transparent 30%, #110a1bd9) }
.card:hover .card-actions, .card:focus-within .card-actions { opacity: 1 }
.card-actions button { pointer-events: auto; padding: 0; border-radius: 50%; font-size: 1rem; width: 34px; height: 34px }
.card-actions button:focus-visible { outline-offset: 2px }
.card-play { background: var(--accent); color: var(--ink) }
.card-play:hover { background: #e7d7ff }
.card-status { font-size: .8rem; min-width: 0 }
.card progress { position: absolute; inset: auto 0 0; width: 100%; height: 4px; appearance: none; border: 0; background: #322443; accent-color: var(--accent) }
progress::-webkit-progress-bar { background: #322443 }
progress::-webkit-progress-value { background: var(--accent) }
.catalog .row-head { flex-wrap: wrap }
.grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,215px),1fr)); gap: 12px }
.catalog > button { margin: 1rem 0 }
.status { margin: 2rem var(--gutter) }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(900px,calc(100% - 24px)); max-height: 90svh }
dialog::backdrop { background: #070610d8 }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; line-height: 1; font-size: 1.5rem; padding: .4rem .65rem }
.detail-hero { position: relative; min-height: 335px; display: flex; align-items: end; isolation: isolate; padding: 26px; background: #292136 }
.detail-hero::after { background: linear-gradient(0deg, var(--panel), transparent 90%), linear-gradient(90deg, #120c1fbe, transparent 90%) }
.detail-hero h2 { font-size: clamp(2rem,5vw,3.5rem); line-height: 1; letter-spacing: -.06em }
.detail-body { padding: 0 26px 26px }
.detail-body h3 { margin: 1rem 0 .5rem }
.episode { display: grid; grid-template-columns: 1fr auto; width: 100%; gap: 12px; text-align: left; margin: .4rem 0 }
.episode small { color: var(--muted) }
#player { width: min(1200px,calc(100% - 15px)); background: #07060d }
.player-head { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 10px 58px 10px 16px }
video { display: block; width: 100%; max-height: 75svh }
#video-error:empty { display: none }
#video-error { padding: 12px }

@media (max-width: 930px) {
  .topbar { flex-wrap: wrap; column-gap: 14px; row-gap: 3px }
  nav { order: 4; width: 100%; overflow: auto; padding-bottom: 2px }
  #search input { width: clamp(100px, 28vw, 220px) }
  #logout > span:last-child { display: none }
  .hero-copy { max-width: 88%; padding-bottom: 82px }
  .hero-picks { bottom: 20px; left: var(--gutter); right: auto }
}
@media (max-width: 600px) {
  #signin { grid-template-columns: 1fr }
  .login-art { display: none }
  .topbar { padding: 8px var(--gutter) 5px }
  .brand { font-size: 1.65rem }
  .hero-panel { min-height: 420px }
  .hero-panel::after { background: linear-gradient(0deg,var(--bg),#0e0e1680 48%,#0e0e1610 90%),linear-gradient(90deg,#100e1a80,transparent 85%) }
  .hero-copy { max-width: 100% }
  .hero h1 { font-size: clamp(2.35rem, 10vw, 4rem) }
  .summary { -webkit-line-clamp: 2 }
  .grid { grid-template-columns: repeat(auto-fill,minmax(min(100%,145px),1fr)) }
}
@media (hover: none) {
  .card-actions { opacity: 1 }
}
