@charset "UTF-8";
:root {
	--bg: #161618;
	--bg-2: #1e1e21;
	--surface: #26262a;
	--surface-2: #313136;
	--border: rgba(255, 255, 255, 0.08);
	--border-2: rgba(255, 255, 255, 0.14);
	/* Liquid Glass material: fill + blur(saturate 180%) + light rim + soft shadow, always together. */
	--glass-bg: rgba(44, 44, 50, 0.42);
	--glass-border: rgba(255, 255, 255, 0.2);
	--glass-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
	--glass-strong: rgba(28, 28, 32, 0.86);
	/* One spring for all geometry (damped overshoot, peaks at 1.05). Opacity uses plain easing. */
	--spring: linear(0, .04, .16, .36, .6, .82, .97, 1.04, 1.05, 1.04, 1.02, 1.007, 1);
	--text: #f4f4f6;
	--muted: #b6b6bf;
	--accent: #ff4d73;
	--accent-2: #c56cff;
	--accent-text: #ffffff;
	--danger: #ff6b7d;
	--focus: #ff9ec4;
	--radius: 14px;
	--radius-sm: 9px;
	--shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
	--gutter: clamp(16px, 4vw, 48px);
	color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
	background: var(--bg);
	color: var(--text);
	font: 16px/1.45 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
img { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--danger); margin: 0; min-height: 1.2em; font-size: 14px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

/* ---------- Ambient backdrop ----------
   Two stacked layers crossfade when the artwork changes (hero, opened title). Heavy blur + low brightness
   turns any poster into a soft colour field, which gives every glass surface something to refract. */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }
.ambient-layer {
	position: absolute; inset: -12%; background: center / cover no-repeat;
	filter: blur(70px) saturate(185%) brightness(1); opacity: 0; transition: opacity 0.9s ease-out;
}
.ambient-layer.on { opacity: 1; }
.ambient::after {
	content: ""; position: absolute; inset: 0;
	background:
		radial-gradient(60% 50% at 15% 0%, rgba(255, 255, 255, 0.04), transparent 70%),
		radial-gradient(50% 45% at 95% 100%, rgba(0, 0, 0, 0.2), transparent 70%),
		linear-gradient(to bottom, rgba(22, 22, 25, 0), rgba(22, 22, 25, 0.3));
}

/* Shared glass surfaces (blur tracks elevation: 8 nested · 16 chrome · 20 floating · 24 menus · 44 dialogs). */
.glass, .topbar, .tabs, .search input, #source-picker, .avatar, .btn:not(.primary):not(.ghost):not(.link) {
	-webkit-backdrop-filter: blur(16px) saturate(180%);
	backdrop-filter: blur(16px) saturate(180%);
}

/* ---------- Buttons & fields ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	border: 1px solid var(--glass-border); border-radius: 999px; padding: 10px 18px; cursor: pointer;
	background: var(--glass-bg); box-shadow: var(--glass-shadow); color: var(--text); font-weight: 700;
	transition: background 0.15s, opacity 0.06s ease; -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .btn:hover { background: rgba(70, 70, 80, 0.45); } }
.btn:active, .tile:active, .channel:active, .episode:active, .tabs button:active { opacity: 0.6; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text); border-color: rgba(255, 255, 255, 0.22); }
@media (hover: hover) { .btn.primary:hover { filter: brightness(1.05); background: linear-gradient(135deg, var(--accent), var(--accent-2)); } }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
@media (hover: hover) { .btn.ghost:hover { background: var(--glass-bg); color: var(--text); } }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.block { width: 100%; padding: 13px 18px; }
.btn.danger { color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--accent-2); font-weight: 700; cursor: pointer; }

.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.field input, select {
	width: 100%; padding: 11px 13px; border-radius: 12px;
	background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border-2); color: var(--text); font-weight: 400;
}
.field input:focus { border-color: var(--accent); outline: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
.advanced[open] summary { margin-bottom: 12px; }
.advanced .field + .field { margin-top: 12px; }

/* ---------- Logo ---------- */
.logo-mark {
	width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M0 16A16 16 0 0 1 16 0h32a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16A16 16 0 0 1 0 48zm14 22a4 4 0 0 0 4 4h28a4 4 0 0 0 4-4v-8a6 6 0 0 0-12 0v2H26v-2a6 6 0 0 0-12 0z' fill-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M0 16A16 16 0 0 1 16 0h32a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16A16 16 0 0 1 0 48zm14 22a4 4 0 0 0 4 4h28a4 4 0 0 0 4-4v-8a6 6 0 0 0-12 0v2H26v-2a6 6 0 0 0-12 0z' fill-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
}
.logo-word { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; }

/* ---------- Auth ---------- */
.auth {
	min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
	padding: 32px 16px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .logo-mark { width: 38px; height: 38px; }
.auth-brand .logo-word { font-size: 30px; }
.auth-card {
	width: 100%; max-width: 440px; display: grid; gap: 16px;
	background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 22px; padding: 28px 24px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
	-webkit-backdrop-filter: blur(44px) saturate(180%); backdrop-filter: blur(44px) saturate(180%);
}
.auth-card h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.auth-card p { margin: 0; }
.auth-note { color: var(--danger); max-width: 440px; text-align: center; }
.source-fields { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 14px 16px; margin: 0; display: grid; gap: 12px; }
.source-fields legend { padding: 0 6px; font-weight: 800; font-size: 14px; }

/* ---------- App shell ---------- */
.topbar {
	position: sticky; top: 0; z-index: 5;
	display: flex; align-items: center; gap: 20px; padding: 12px var(--gutter);
	background: rgba(38, 38, 44, 0.3); border-bottom: 0.5px solid var(--glass-border);
}
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.tabs {
	display: flex; gap: 3px; position: relative; padding: 4px; border-radius: 999px;
	background: rgba(255, 255, 255, 0.06); border: 0.5px solid var(--glass-border);
}
.tabs button {
	position: relative; z-index: 1; border: 0; background: transparent; color: var(--muted); font-weight: 700;
	padding: 7px 16px; border-radius: 999px; cursor: pointer; transition: color 0.15s, opacity 0.06s ease;
	-webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .tabs button:hover { color: var(--text); } }
.tabs button[aria-current="page"] { color: var(--text); }
/* The pill is ONE element that travels between tabs (glass.js), so it reads as an object moving. */
.seg-pill {
	position: absolute; left: 0; top: 0; z-index: 0; border-radius: 999px;
	background: var(--glass-bg); border: 0.5px solid var(--border-2); box-shadow: var(--glass-shadow);
	-webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
	opacity: 0; pointer-events: none; will-change: left, top, width, height, transform;
	transition: left 0.32s var(--spring), top 0.32s var(--spring), width 0.32s var(--spring), height 0.32s var(--spring);
}
.seg-pill.show { opacity: 1; }
.seg-pill.moving { animation: seg-pill-squish 0.32s ease-out; }
@keyframes seg-pill-squish {
	0% { transform: scaleX(1) scaleY(1); }
	35% { transform: scaleX(1.06) scaleY(0.94); }
	70% { transform: scaleX(0.98) scaleY(1.02); }
	100% { transform: scaleX(1) scaleY(1); }
}
.pill-measure button { transition: none !important; animation: none !important; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search input {
	width: 220px; padding: 9px 14px 9px 36px; border-radius: 999px; border: 1px solid var(--glass-border);
	background: var(--glass-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239d93ab' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px center / 16px no-repeat;
}
.search input:focus { border-color: var(--accent); outline: none; }
#source-picker { width: auto; max-width: 180px; padding: 8px 12px; border-radius: 999px; background: var(--glass-bg); border: 1px solid var(--glass-border); }
.avatar {
	width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-weight: 800;
	background: var(--glass-bg); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); color: var(--text);
}
.banner {
	display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
	margin: 14px var(--gutter) 0; padding: 12px 16px; border-radius: var(--radius);
	background: rgba(255, 107, 125, 0.14); border: 1px solid rgba(255, 107, 125, 0.35); box-shadow: var(--glass-shadow);
	-webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.status { padding: 0 var(--gutter); }
.status:empty { display: none; }

/* ---------- Hero ---------- */
.hero {
	position: relative; min-height: min(62vh, 560px); display: flex; align-items: flex-end;
	padding: 48px var(--gutter) 56px; overflow: hidden; isolation: isolate;
}
.hero-art { position: absolute; inset: 0; z-index: -2; background-size: cover; background-position: center 25%; filter: saturate(1.05); }
.hero::after {
	content: ""; position: absolute; inset: 0; z-index: -1;
	background:
		linear-gradient(to top, var(--bg) 2%, rgba(22, 22, 25, 0.4) 40%, rgba(22, 22, 25, 0.05) 75%),
		linear-gradient(to right, rgba(22, 22, 25, 0.7), transparent 60%);
}
.hero-content { max-width: 560px; display: grid; gap: 14px; }
.hero-kicker { color: var(--accent-2); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; }
.hero h1 { margin: 0; font-size: clamp(30px, 5vw, 52px); line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; }
.hero p { margin: 0; color: #dcdce2; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Shelves ---------- */
.browse { padding-bottom: 48px; }
#shelves { display: grid; gap: 30px; padding-top: 18px; }
.shelf-head { display: flex; align-items: baseline; gap: 12px; padding: 0 var(--gutter); margin-bottom: 12px; }
.shelf-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.shelf-head .btn { margin-left: auto; }
.shelf-row {
	list-style: none; margin: 0; padding: 4px var(--gutter) 10px; display: flex; gap: 14px;
	overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 var(--gutter); scrollbar-width: none;
}
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-row > li { flex: 0 0 auto; scroll-snap-align: start; }
.shelf-row.posters > li { width: clamp(124px, 13vw, 176px); }
.shelf-row.wide > li { width: clamp(220px, 24vw, 320px); }

.tile {
	display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.tile .art {
	position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); transition: translate 0.32s var(--spring), box-shadow 0.2s;
	border: 0.5px solid var(--glass-border);
}
@media (hover: hover) { .tile:hover .art { translate: 0 -4px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); } }
.tile:focus-visible .art { translate: 0 -4px; }
.tile:focus-visible { outline: none; }
.tile:focus-visible .art { outline: 3px solid var(--focus); outline-offset: 3px; }
.tile .art img { width: 100%; height: 100%; object-fit: cover; }
.tile.poster .art { aspect-ratio: 2 / 3; }
.tile.landscape .art { aspect-ratio: 16 / 9; }
.tile .placeholder {
	position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center;
	font-weight: 800; color: var(--muted); background: var(--glass-bg);
	-webkit-backdrop-filter: blur(8px) saturate(180%); backdrop-filter: blur(8px) saturate(180%);
}
.tile .label { margin-top: 8px; font-size: 14px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile .progress { position: absolute; left: 10px; right: 10px; bottom: 10px; }
.tile .fav-dot { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-bg); border: 0.5px solid var(--glass-border); color: var(--accent-2); font-size: 14px;
	-webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); }
.progress { height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- Grid view ---------- */
.grid-view { padding: 22px var(--gutter) 48px; }
.grid-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.grid-head h2 { margin: 0; font-size: 24px; font-weight: 800; }
.poster-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px 16px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

/* ---------- Live ---------- */
.live { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 62px); }
.live-rail {
	border-right: 0.5px solid var(--glass-border); padding: 16px 12px; position: sticky; top: 62px; height: calc(100vh - 62px); overflow-y: auto;
	background: rgba(38, 38, 44, 0.22); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
}
.live-rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.live-rail li button {
	width: 100%; text-align: left; border: 0; background: transparent; color: var(--muted); cursor: pointer;
	padding: 9px 12px; border-radius: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (hover: hover) { .live-rail li button:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); } }
.live-rail li button[aria-current="true"] { background: var(--glass-bg); color: var(--text); box-shadow: inset 0 0 0 0.5px var(--glass-border); }
.live-rail .rail-divider { height: 1px; background: var(--border); margin: 8px 6px; }
.live-rail .rail-label { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; padding: 12px 12px 4px; }
.rail-toggle { display: none; }
.live-list { padding: 18px var(--gutter) 48px 24px; }
.live-title { margin: 0 0 14px; font-size: 22px; font-weight: 800; }
.channels { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.channel {
	width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 14px; cursor: pointer; text-align: left;
	background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius); color: inherit;
	box-shadow: var(--glass-shadow); transition: background 0.15s, opacity 0.06s ease;
	-webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
}
@media (hover: hover) { .channel:hover { background: rgba(70, 70, 80, 0.45); } }
.channel .logo { width: 52px; height: 52px; border-radius: 12px; object-fit: contain; background: rgba(255, 255, 255, 0.06); flex-shrink: 0; padding: 4px; }
.channel .logo-fallback { width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); font-weight: 800; color: var(--muted); }
.channel .info { min-width: 0; flex: 1; }
.channel .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel .tags { display: flex; gap: 6px; margin-top: 3px; }
.tag { font-size: 11px; font-weight: 800; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; }
.tag.accent { color: var(--accent-2); border-color: rgba(197, 108, 255, 0.45); }
.channel .star { color: var(--accent-2); }

/* ---------- Sheets (details, settings) ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px 16px; }
.sheet-backdrop {
	position: absolute; inset: 0; background: rgba(150, 150, 160, 0.1);
	-webkit-backdrop-filter: blur(12px) saturate(150%); backdrop-filter: blur(12px) saturate(150%);
}
.sheet-card {
	position: relative; width: min(860px, 100%); max-height: calc(100vh - 48px); overflow-y: auto;
	background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: 22px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
	-webkit-backdrop-filter: blur(44px) saturate(180%); backdrop-filter: blur(44px) saturate(180%);
}
.sheet-close {
	position: absolute; top: 14px; right: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
	background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text); font-size: 22px; line-height: 1;
	-webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%);
}
.details-art { aspect-ratio: 16 / 7; background: var(--surface) center 25% / cover no-repeat; position: relative; }
.details-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--glass-strong), transparent 70%); }
.details-body { padding: 0 28px 28px; margin-top: -60px; position: relative; display: grid; gap: 12px; }
.details-body h2 { margin: 0; font-size: clamp(26px, 4vw, 38px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.details-body p { margin: 0; }
.details-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.details-plot { color: #dcdce2; max-width: 70ch; }
.season-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 12px; }
.season-tabs button { border: 0.5px solid var(--glass-border); padding: 7px 14px; border-radius: 999px; cursor: pointer; background: rgba(255, 255, 255, 0.05); color: var(--muted); font-weight: 700; }
.season-tabs button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.episode-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.episode {
	width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; text-align: left; cursor: pointer;
	padding: 12px 14px; border-radius: var(--radius); border: 0.5px solid var(--glass-border); background: rgba(255, 255, 255, 0.04); color: inherit;
	transition: background 0.15s, opacity 0.06s ease;
}
@media (hover: hover) { .episode:hover { background: rgba(255, 255, 255, 0.08); } }
.episode .num { font-weight: 800; color: var(--muted); font-size: 18px; }
.episode .ep-title { font-weight: 700; }
.episode .progress { margin-top: 6px; }

.settings-card { width: min(620px, 100%); padding: 28px; display: grid; gap: 6px; }
.settings-card h2 { margin: 0; font-size: 26px; font-weight: 800; }
.settings-section { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 14px; display: grid; gap: 12px; }
.section-head { display: flex; align-items: center; gap: 12px; }
.section-head h3 { margin: 0; font-size: 18px; }
.section-head .btn { margin-left: auto; }
.settings-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.settings-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: rgba(255, 255, 255, 0.04); border: 0.5px solid var(--glass-border); }
.settings-list .grow { flex: 1; min-width: 0; }
.settings-list .title { font-weight: 700; }
.settings-list .detail { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-form { display: grid; gap: 12px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.source-form h4 { margin: 0; }
.form-actions { display: flex; gap: 8px; }
.settings-footer { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-footer .danger { margin-left: auto; }

/* ---------- Player ---------- */
.player { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; }
.player-bar {
	display: flex; align-items: center; gap: 12px; padding: 10px 16px;
	background: rgba(30, 30, 34, 0.5); border-bottom: 0.5px solid var(--glass-border);
	-webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.player-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.player-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
.player-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
#player-fav[aria-pressed="true"] { color: var(--accent-2); }
.player-stage { position: relative; flex: 1; min-height: 0; display: flex; }
.player video { flex: 1; width: 100%; min-height: 0; background: #000; }
.catchup-panel {
	width: 340px; max-width: 85vw; overflow-y: auto; padding: 16px 12px;
	background: var(--glass-bg); border-left: 0.5px solid var(--glass-border);
	-webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
}
.catchup-panel h3 { margin: 0 0 6px; }
.catchup-panel ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.catchup-panel button { width: 100%; text-align: left; display: grid; gap: 2px; background: transparent; border: 0; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: inherit; }
.catchup-panel button:hover { background: var(--surface); }
.catchup-panel .day { font-size: 12px; color: var(--muted); padding: 12px 10px 2px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.resume-prompt, .player-error {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0;
	max-width: min(460px, calc(100% - 32px)); padding: 22px; border-radius: 18px; text-align: center;
	background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
	-webkit-backdrop-filter: blur(44px) saturate(180%); backdrop-filter: blur(44px) saturate(180%);
}
.resume-prompt { display: grid; gap: 10px; min-width: 280px; }
.resume-prompt p { margin: 0 0 4px; font-weight: 800; font-size: 18px; }

.toast {
	position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40;
	padding: 14px 22px; border-radius: 22px; background: var(--glass-bg); border: 1px solid var(--glass-border);
	box-shadow: var(--glass-shadow); font-weight: 700;
	-webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
	.topbar { flex-wrap: wrap; gap: 10px 14px; }
	.topbar-right { margin-left: auto; }
	/* Logo + search/avatar fill the first line, so the tabs wrap to their own line, centred at their own width. */
	.topbar-right { flex: 1 1 auto; justify-content: flex-end; }
	.tabs { order: 3; width: max-content; margin: 0 auto; }
	.search input { width: 150px; }
	.live { grid-template-columns: 1fr; }
	.live-rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px var(--gutter); }
	.live-rail:not(.open) ul { display: none; }
	.rail-toggle { display: inline-flex; width: 100%; justify-content: flex-start; }
	.live-list { padding: 16px var(--gutter) 40px; }
	.channels { grid-template-columns: 1fr; }
	.field-row { grid-template-columns: 1fr; }
	.details-body { padding: 0 18px 22px; }
	.player-bar { flex-wrap: wrap; }
	.catchup-panel { position: absolute; right: 0; top: 0; bottom: 0; }
}
@media (max-width: 480px) {
	.logo-word { display: none; }
	.search input { width: 120px; }
	.poster-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 16px 10px; }
}
@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; scroll-behavior: auto !important; }
	.seg-pill.moving { animation: none; }
}

/* ---------- Guided setup ---------- */
.setup-card { max-width: 600px; gap: 20px; }
/* Grid and flex children default to min-width:auto, which lets long commands stretch the whole card. */
.auth-card > *, .setup-steps, .setup-step, .step-row > div, .step-body, .relay-instructions, .relay-instructions li, .code-line { min-width: 0; }
.code-line .btn { flex-shrink: 0; }
.setup-head { display: grid; gap: 8px; }
.setup-progress { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.setup-progress > span {
	display: block; height: 100%; width: 0; border-radius: 999px;
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	transition: width 0.6s var(--spring);
}
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.setup-step {
	border-radius: 16px; padding: 14px 16px; border: 0.5px solid var(--glass-border);
	background: rgba(255, 255, 255, 0.03); transition: background 0.2s;
}
.setup-step.current { background: rgba(255, 255, 255, 0.06); }
.step-row { display: flex; gap: 14px; align-items: flex-start; }
.step-row h2 { margin: 0; font-size: 17px; font-weight: 800; }
.step-row p { margin: 2px 0 0; }
.step-dot {
	flex-shrink: 0; width: 26px; height: 26px; margin-top: 1px; border-radius: 50%;
	display: grid; place-items: center; font-size: 13px; font-weight: 800;
	border: 2px solid var(--border-2); color: var(--muted);
}
.setup-step.done .step-dot { border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.setup-step.done .step-dot::before { content: "\2713"; }
.setup-step.current .step-dot { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 77, 115, 0.18); }
.setup-step.skipped .step-dot::before { content: "\2013"; }
.setup-step:not(.current) .step-body { display: none; }
.step-body { display: grid; gap: 14px; margin: 14px 0 2px 40px; }
.seg-lite { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); border: 0.5px solid var(--glass-border); width: max-content; }
.seg-lite button { border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg-lite button[aria-pressed="true"] { background: var(--glass-bg); color: var(--text); box-shadow: inset 0 0 0 0.5px var(--glass-border); }
.relay-instructions { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.relay-instructions p { margin: 0 0 6px; }
.code-line { display: flex; gap: 8px; align-items: flex-start; }
.code-line code {
	flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere;
	font: 12.5px/1.5 ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
	background: rgba(10, 10, 12, 0.4); border: 0.5px solid var(--glass-border); color: #e8e8ec;
}
.relay-live { margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.relay-live.ok { color: #6ee7b7; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); flex-shrink: 0; animation: pulse 1.4s ease-in-out infinite; }
.relay-live.ok .pulse { background: #34d399; animation: none; }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (max-width: 560px) { .step-body { margin-left: 0; } .code-line { flex-direction: column; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* Source type choice (setup step 3) */
.source-types { display: grid; gap: 8px; }
.source-type {
	display: grid; gap: 2px; text-align: left; cursor: pointer; padding: 12px 14px; border-radius: 14px;
	background: rgba(255, 255, 255, 0.04); border: 0.5px solid var(--glass-border); color: inherit;
	transition: background 0.15s, opacity 0.06s ease;
}
@media (hover: hover) { .source-type:not(:disabled):hover { background: rgba(255, 255, 255, 0.08); } }
.source-type:active { opacity: 0.6; }
.source-type[aria-pressed="true"] { background: var(--glass-bg); box-shadow: inset 0 0 0 1.5px var(--accent); }
.source-type:disabled { opacity: 0.45; cursor: default; }
.source-form-inline { display: grid; gap: 14px; }
.empty-state { margin: 12vh auto; max-width: 420px; text-align: center; display: grid; gap: 12px; justify-items: center; padding: 0 16px; }
.empty-state h2 { margin: 0; font-size: 24px; font-weight: 800; }
.empty-state p { margin: 0; }

/* Going back to a finished setup step */
.setup-step.reopenable .step-row { cursor: pointer; }
@media (hover: hover) { .setup-step.reopenable:hover { background: rgba(255, 255, 255, 0.06); } }
.setup-step.reopenable .step-row h2::after { content: "  \2192  Show again"; font-size: 13px; font-weight: 700; color: var(--muted); }
.step-back { justify-self: start; padding-left: 0; }

/* Relay step failed while connecting the source */
.setup-step.failed { border-color: rgba(255, 107, 125, 0.45); background: rgba(255, 107, 125, 0.06); }
.setup-step.failed .step-dot { border-color: transparent; background: var(--danger); color: #fff; }
.relay-error {
	margin: 0; padding: 10px 12px; border-radius: 12px; font-weight: 700;
	background: rgba(255, 107, 125, 0.12); border: 0.5px solid rgba(255, 107, 125, 0.4); color: #ffc2cb;
}

/* Settings sheet: let everything shrink to the sheet's width (grid/flex children default to min-width:auto). */
.settings-card > *, .settings-section, .section-head, .settings-list, .settings-list li, .settings-list .grow, .source-form, .source-form > * { min-width: 0; }
.section-head h3 { flex: 1; min-width: 0; }
.section-head .btn { margin-left: 0; flex-shrink: 0; }
#relay-status, .settings-list .detail { overflow-wrap: anywhere; }
.settings-list .detail { white-space: normal; }
@media (max-width: 560px) {
	.sheet { padding: 12px 10px; }
	.settings-card { padding: 22px 18px; }
	.settings-list li { flex-wrap: wrap; row-gap: 8px; }
	.settings-list li .grow { flex: 1 1 100%; }
	.settings-footer .danger { margin-left: 0; }
}

/* Shelves: a grid track defaults to its content's width, so one long row widened the whole page.
   minmax(0, 1fr) keeps each row at page width and lets it scroll horizontally inside itself. */
#shelves { grid-template-columns: minmax(0, 1fr); }
.shelf, .shelf-head, .shelf-row, .browse, .grid-view, .live-list, .content { min-width: 0; }
html, body { overflow-x: clip; }

/* Hero as an inset card (same rounded, edged language as the tiles), not an edge-to-edge band. */
.hero {
	margin: 16px var(--gutter) 0; border-radius: 22px; overflow: hidden;
	padding: 48px clamp(20px, 4vw, 44px) 36px; min-height: min(56vh, 520px);
	border: 0.5px solid var(--glass-border); box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
}
.hero::after {
	background:
		linear-gradient(to top, rgba(22, 22, 25, 0.92) 4%, rgba(22, 22, 25, 0.45) 45%, rgba(22, 22, 25, 0.05) 80%),
		linear-gradient(to right, rgba(22, 22, 25, 0.6), transparent 65%);
}
@media (max-width: 560px) {
	.hero { margin-top: 12px; padding: 28px 20px 22px; min-height: 420px; }
}

/* Top bar: no divider line; the glass tint alone separates it from the content. */
.topbar { border-bottom: 0; }
