:root { --bg: #0b0b0d; --card: #17171b; --text: #f2f2f2; --muted: #9a9aa3; --accent: #e50914; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, Segoe UI, sans-serif; }
a { color: inherit; }
header { display: flex; align-items: center; gap: 16px; padding: 16px 4vw; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(#000c, #0000); }
.logo { color: var(--accent); font-weight: 800; font-size: 1.6rem; letter-spacing: .5px; text-decoration: none; }
header input { margin-left: auto; }
nav { display: flex; gap: 4px; }
nav { flex-wrap: wrap; flex-shrink: 0; }
nav button { background: none; color: var(--muted); padding: 8px 10px; font-weight: 500; white-space: nowrap; }
nav button[aria-pressed="true"] { color: var(--text); font-weight: 700; }
.type-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.type-pick legend { float: left; margin-right: 8px; color: var(--muted); font-size: .9rem; }
.type-pick label { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 1rem; cursor: pointer; }
.type-pick input { width: auto; accent-color: var(--accent); }
@media (max-width: 600px) { header { flex-wrap: wrap; } header input { width: 100%; } }
input, textarea, select, button { font: inherit; }
input, textarea, select { background: #222228; color: var(--text); border: 1px solid #333; border-radius: 6px; padding: 9px 12px; width: 100%; }
header input { width: auto; flex: 0 1 260px; min-width: 120px; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
button.ghost { background: #ffffff22; }
button:disabled { opacity: .5; cursor: wait; }

.hero { min-height: 62vh; display: flex; align-items: flex-end; padding: 0 4vw 6vh; margin-top: -72px;
  background-size: cover; background-position: center 25%; position: relative; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #000d 15%, #0000 70%), linear-gradient(0deg, var(--bg), #0000 40%); }
.hero > div { position: relative; max-width: 560px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 10px; }
.hero p { color: #ddd; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.row { padding: 10px 4vw 30px; }
.row h2 { font-size: 1.2rem; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.poster { aspect-ratio: 2/3; border-radius: 6px; background: var(--card) center/cover; cursor: pointer; border: 0; padding: 0;
  transition: transform .2s; display: flex; align-items: flex-end; overflow: hidden; }
.poster:hover, .poster:focus-visible { transform: scale(1.05); outline: 2px solid #fff; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
/* Fire TV app: the focus is a soft glow that grows the item, never a hard white box; the page never scrolls sideways */
.tv body { overflow-x: hidden; }
.tv :focus { outline: none !important; }
.tv .poster, .tv button, .tv a { transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease; }
.tv .poster:focus { transform: scale(1.07); box-shadow: 0 0 0 3px #fff, 0 12px 32px #000d; position: relative; z-index: 1; }
.tv button:focus { transform: scale(1.06); box-shadow: 0 0 0 2px #fff, 0 6px 22px #0009; }
.tv input:focus { border-color: #fff; box-shadow: 0 0 0 2px #ffffff55; }
/* top menu: the focused tab lights up as a pill instead of a box */
.tv nav button:focus, .tv nav a:focus, .tv header a:focus { transform: none; box-shadow: none; color: #fff; background: #ffffff24; border-radius: 999px; }
.tv .admin-link:focus { border-color: #fff; }
.poster span { width: 100%; padding: 8px; font-size: .9rem; text-align: left; background: linear-gradient(#0000, #000c); }
.empty { color: var(--muted); padding: 40px 4vw; }

dialog { background: var(--card); color: var(--text); border: 0; border-radius: 10px; padding: 0; width: min(820px, 94vw); }
dialog::backdrop { background: #000b; }
.detail { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 24px; }
.detail img { width: 100%; border-radius: 6px; }
.meta { color: var(--muted); font-size: .95rem; }
.close { position: absolute; right: 10px; top: 10px; background: #0008; border-radius: 50%; width: 36px; height: 36px; padding: 0; }
@media (max-width: 600px) { .detail { grid-template-columns: 1fr; } .detail img { max-width: 180px; } }

#player { position: fixed; inset: 0; background: #000; z-index: 20; display: none; }
#player video { width: 100%; height: 100%; }
#player .close { z-index: 21; }
.player-bar { position: absolute; top: 10px; left: 12px; right: 60px; z-index: 21; display: flex; align-items: center; gap: 12px;
  color: #fff; text-shadow: 0 1px 3px #000; pointer-events: none; }
.player-bar button { pointer-events: auto; }

/* admin */
.wrap { max-width: 1000px; margin: 0 auto; padding: 20px 16px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; background: var(--card); padding: 20px; border-radius: 10px; }
.form label { display: grid; gap: 6px; font-size: .9rem; color: var(--muted); }
.full { grid-column: 1 / -1; }
.cover-prev { width: 120px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; background: #222; }
progress { width: 100%; }
.msg { min-height: 1.4em; color: var(--muted); }
.list { display: grid; gap: 10px; margin-top: 24px; }
.item { display: flex; gap: 14px; align-items: center; background: var(--card); padding: 10px; border-radius: 8px; }
.item img { width: 46px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; background: #222; }
.item div { flex: 1; }
@media (max-width: 600px) { .form { grid-template-columns: 1fr; } }

/* episodes */
.ep-dlg { width: min(960px, 96vw); }
.ep-body { padding: 24px; max-height: 88vh; overflow: auto; }
.ep-body h3 { margin: 18px 0 6px; font-size: 1rem; color: var(--muted); }
.ep-add { margin-top: 8px; }
.ep-add select { min-height: 160px; }
.ep-row { flex-wrap: wrap; }
.ep-fields { display: flex; align-items: center; gap: 6px; flex: 1 1 360px; color: var(--muted); }
.ep-fields input[type="number"] { width: 64px; }
.ep-row .meta { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seasons { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 8px; }
.seasons button[aria-pressed="false"] { background: #ffffff22; }
.episodes { display: grid; gap: 6px; max-height: 300px; overflow: auto; }
.episodes button { text-align: left; background: #ffffff10; font-weight: 500; }
.episodes button:hover, .episodes button:focus-visible { background: #ffffff26; }
.wrap > h2 { font-size: 1.6rem; margin: 32px 0 12px; }
.admin-link { margin-left: auto; font-size: .85rem; color: var(--muted); text-decoration: none; border: 1px solid #ffffff33;
  border-radius: 6px; padding: 6px 10px; white-space: nowrap; }
.admin-link:hover, .admin-link:focus-visible { color: var(--text); border-color: var(--text); }
.admin-link:not([hidden]) + input { margin-left: 0; }
header .logout { padding: 6px 12px; font-size: .85rem; font-weight: 500; color: var(--muted); }
header .logout:hover, header .logout:focus-visible { color: var(--text); }
nav .nav-link { color: var(--muted); padding: 8px 10px; font-weight: 500; text-decoration: none; white-space: nowrap; }
nav .nav-link:hover, nav .nav-link:focus-visible { color: var(--text); }
