:root {
  --bg: #000;
  --panel: #121212;
  --panel-2: #1c1c1e;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --accent: #e82127;
  --accent-2: #3e6ae1;
  --ok: #31a24c;
  --danger: #e82127;
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

code {
  color: #ddd;
  background: #222;
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

#top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px 10px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}

.logo {
  background: none;
  border: 0;
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding: 8px 4px;
}

nav { display: flex; gap: 10px; }

.tab, .btn {
  appearance: none;
  border: 0;
  background: var(--panel-2);
  color: var(--text);
  font-size: 22px;
  min-height: 64px;
  padding: 0 22px;
  border-radius: 999px;
  cursor: pointer;
}

.tab.active { background: #fff; color: #000; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid #444; }

.hidden { display: none !important; }

.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.search-row input {
  flex: 1;
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 22px;
  padding: 0 20px;
}

.row-title {
  font-size: 22px;
  color: var(--muted);
  margin: 8px 0 12px;
  font-weight: 600;
}

.rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 10px;
  scroll-snap-type: x mandatory;
}

.tile {
  flex: 0 0 auto;
  width: 210px;
  scroll-snap-align: start;
  background: var(--panel);
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.tile.wide { width: 320px; }

.tile .art {
  width: 100%;
  height: 300px;
  object-fit: cover;
  background: #1a1a1a;
  display: block;
}

.tile.wide .art { height: 180px; }

.tile .meta {
  padding: 10px 12px 14px;
}

.tile .name {
  font-size: 18px;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
}

.tile .sub {
  color: var(--muted);
  font-size: 15px;
  margin-top: 4px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.yt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 16px;
  margin-bottom: 28px;
}

.yt-rail {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 10px;
}

.yt-rail .yt-card {
  flex: 0 0 320px;
}

.yt-live-rail {
  min-height: 228px;
  padding-top: 4px;
}

.yt-card {
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.yt-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #222;
}

.yt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.yt-dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.yt-dur.live {
  background: #cc0000;
  letter-spacing: 0.04em;
}

.yt-info {
  display: flex;
  gap: 12px;
  padding: 10px 2px 0;
}

.yt-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #333;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.yt-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
}

.yt-sub {
  color: #aaa;
  font-size: 14px;
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .yt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.status-line {
  color: var(--muted);
  font-size: 18px;
  margin: 8px 0 18px;
}

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}

.card h2 { margin: 0 0 10px; font-size: 26px; }
.card p { color: var(--muted); font-size: 18px; line-height: 1.45; }

.pin {
  font-size: 72px;
  letter-spacing: 0.28em;
  font-weight: 700;
  margin: 12px 0;
  text-indent: 0.28em;
}

.plex-link-card .pin {
  font-size: 96px;
  text-align: center;
  color: #fff;
}

.overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(640px, 92vw);
  background: var(--panel);
  border-radius: 24px;
  padding: 36px;
}

.mark {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 14px;
}

.login-card h1 { font-size: 56px; margin: 6px 0 12px; letter-spacing: -0.04em; }
.login-card form { margin-top: 18px; }
.login-card .form-row { display: flex; gap: 12px; }
.login-card .form-stack { display: flex; flex-direction: column; gap: 12px; }
.login-card .form-stack .btn { min-height: 64px; width: 100%; }
.login-card input {
  flex: 1;
  min-height: 64px;
  border: 0;
  border-radius: 16px;
  background: #000;
  color: #fff;
  font-size: 22px;
  padding: 0 18px;
}

.error { color: var(--accent); min-height: 1.2em; }

.player {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 30;
  touch-action: manipulation;
}

#stage, #mjpeg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

#mjpeg { display: none; }
.player.mjpeg-mode #mjpeg { display: block; }
.player.mjpeg-mode #stage { display: none; }
.subtitle-image-overlay {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  background: transparent;
}
.player.live-mode .seek-wrap {
  visibility: hidden;
  pointer-events: none;
}

.player-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 18px 18px;
  background: linear-gradient(#0008, transparent 18%, transparent 72%, #000a);
}

.player-top, .player-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
}

.player-title {
  font-size: 26px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seek-wrap {
  position: relative;
  flex: 1;
  height: 56px;
  touch-action: none;
  cursor: pointer;
}
.seek-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 14px;
  margin-top: -7px;
  background: #3a3a3a;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
}
.seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 6px;
}
.seek-buf { background: #9a9a9a; }
.seek-played { background: var(--accent); }
.seek-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  margin-left: -14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px #0005;
  pointer-events: none;
}
#seek {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.time { font-size: 20px; min-width: 160px; text-align: right; }

.player-msg {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #111c;
  padding: 22px 28px;
  border-radius: 16px;
  font-size: 22px;
  max-width: 80%;
  text-align: center;
}

.seek-tap-feedback {
  position: absolute;
  z-index: 8;
  top: 50%;
  min-width: 124px;
  padding: 16px 20px;
  transform: translateY(-50%) scale(0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(7, 10, 16, 0.76);
  color: #fff;
  font-size: 20px;
  font-weight: 750;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.seek-tap-feedback.left { left: 10%; }
.seek-tap-feedback.right { right: 10%; }
.seek-tap-feedback.show {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.empty {
  color: var(--muted);
  font-size: 22px;
  padding: 40px 8px;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.chip {
  min-height: 56px;
  padding: 0 18px;
  border-radius: 999px;
  background: #222;
  color: #fff;
  border: 0;
  font-size: 20px;
}

.chip.on { background: #fff; color: #000; }

input[type="file"] {
  color: var(--muted);
  font-size: 18px;
  margin: 10px 0;
}

/* Modern interface refresh */
:root {
  --app-pad-x: 34px;
  --app-pad-y: 30px;
  --bg: #080a0f;
  --panel: #11141c;
  --panel-2: #181c26;
  --panel-3: #202634;
  --text: #f7f8fc;
  --muted: #929bad;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #8b5cf6;
  --accent-2: #22c7f2;
  --ok: #37d67a;
  --danger: #ff4d67;
  --radius: 22px;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.32);
}

html, body {
  background:
    radial-gradient(circle at 8% -10%, rgba(139, 92, 246, 0.20), transparent 32%),
    radial-gradient(circle at 92% 5%, rgba(34, 199, 242, 0.12), transparent 26%),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}

button, input { font: inherit; }

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(34, 199, 242, 0.55);
  outline-offset: 3px;
}

#top {
  min-height: 92px;
  padding: 14px 30px;
  background: rgba(8, 10, 15, 0.92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0;
  min-height: 58px;
  cursor: pointer;
}

.brand-glyph {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -0.04em;
  box-shadow: 0 12px 28px rgba(123, 92, 246, 0.36);
}

.brand-name {
  color: var(--text);
  font-size: 26px;
  font-weight: 760;
  letter-spacing: -0.045em;
}

.brand-name span {
  color: var(--muted);
  font-weight: 520;
}

nav {
  display: flex;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.045);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 15px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 650;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tab svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.tab.active {
  color: #0a0c11;
  background: #f5f6fa;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.22);
}

.tab.active svg { color: var(--accent); }

#app {
  flex: 1;
  overflow: auto;
  padding: var(--app-pad-y, 30px) var(--app-pad-x, 34px) 56px;
  scroll-behavior: smooth;
}
#app.route-youtube {
  padding-top: 0;
  scroll-padding-top: 126px;
}
#app.route-plex:not(.plex-web-layout):not(.plex-detail-view) {
  padding-top: 0;
  scroll-padding-top: 92px;
}

#app::-webkit-scrollbar,
.rail::-webkit-scrollbar,
.yt-rail::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

#app::-webkit-scrollbar-thumb,
.rail::-webkit-scrollbar-thumb,
.yt-rail::-webkit-scrollbar-thumb {
  background: #303746;
  border-radius: 999px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 118px;
  margin-bottom: 24px;
}

.page-kicker {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(36px, 4vw, 52px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.page-intro p {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.search-row {
  gap: 10px;
  padding: 8px;
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(17, 20, 28, 0.88);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.22);
}

.search-row input {
  min-height: 60px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 0 17px;
  color: var(--text);
  font-size: 19px;
}

.search-row input::placeholder { color: #737d90; }

.btn {
  min-height: 56px;
  padding: 0 20px;
  border-radius: 15px;
  background: var(--panel-3);
  color: var(--text);
  font-size: 18px;
  font-weight: 680;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none;
  transition: transform 150ms ease, filter 150ms ease, background 150ms ease;
}

.btn:hover { background: #2a3140; }
.btn:active, .tab:active, .chip:active, .tile:active, .yt-card:active { transform: scale(0.98); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #6d5dfc 58%, var(--accent-2));
  color: #fff;
  border: 0;
  box-shadow: 0 11px 26px rgba(110, 84, 245, 0.28);
}

.btn.primary:hover { filter: brightness(1.08); }

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn.danger {
  background: rgba(255, 77, 103, 0.10);
  color: #ff8da0;
  border: 1px solid rgba(255, 77, 103, 0.32);
}

.btn.danger:hover { background: rgba(255, 77, 103, 0.18); }

.row-title {
  margin: 20px 0 14px;
  color: var(--text);
  font-size: 22px;
  font-weight: 730;
  letter-spacing: -0.025em;
}

.yt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px 18px;
  margin: 0;
}

.yt-rail {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  margin: 0 -2px;
  scroll-snap-type: x mandatory;
}

.yt-rail .yt-card {
  flex: 0 0 360px;
  scroll-snap-align: start;
}

.yt-card {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  box-shadow: none;
  border-radius: 0;
  cursor: pointer;
}

.yt-card:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
}

.yt-thumb {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1a1a;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.yt-thumb img { transition: transform 280ms ease; }
.yt-card:hover .yt-thumb img { transform: scale(1.03); }

.yt-dur {
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.82);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.yt-dur.live {
  background: #e00;
  letter-spacing: 0.08em;
}

.yt-info {
  gap: 12px;
  padding: 12px 2px 0;
}

.yt-avatar {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  border: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.yt-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.015em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.yt-sub {
  color: #aaa;
  font-size: 14px;
  margin-top: 5px;
}

.yt-page {
  max-width: 1480px;
  margin: 0 auto;
}

#yt-results {
  padding-top: 10px;
}

.yt-chrome-sentinel,
.page-chrome-sentinel {
  height: 1px;
  pointer-events: none;
}

.yt-chrome,
.plex-chrome {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0 calc(-1 * var(--app-pad-x, 34px));
  padding: 12px var(--app-pad-x, 34px) 8px;
  background: rgba(8, 10, 15, 0.92);
  border-bottom: 1px solid var(--line);
  transition: box-shadow 0.25s ease;
}
.yt-chrome.is-stuck,
.plex-chrome.is-stuck {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

.yt-masthead {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 4px 0 12px;
}

.yt-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.yt-play {
  display: grid;
  place-items: center;
  width: 36px;
  height: 26px;
  border-radius: 8px;
  background: #f00;
  box-shadow: 0 8px 18px rgba(255, 0, 0, 0.28);
}

.yt-play::after {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
  content: "";
  margin-left: 2px;
}

.yt-search {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #303030;
  border-radius: 40px;
  background: #121212;
}

.yt-search input {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
}

.yt-search input::placeholder { color: #8a8a8a; }

.yt-search-btn {
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-left: 1px solid #303030;
  background: #222;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.yt-search-btn:hover { background: #2c2c2c; }

.yt-home-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 18px;
}

.yt-nav-chip {
  appearance: none;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: #272727;
  color: #f1f1f1;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.yt-nav-chip.on {
  background: #fff;
  color: #111;
}

.yt-section {
  margin: 6px 0 34px;
  scroll-margin-top: 92px;
}

.yt-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 16px;
}

.yt-section-head h2 {
  margin: 0;
  color: #fff;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.yt-section-head span {
  color: #8b8b8b;
  font-size: 14px;
  font-weight: 600;
}

.yt-empty {
  display: grid;
  justify-items: start;
  gap: 8px;
  max-width: 560px;
  margin: 28px 0 40px;
  padding: 28px 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.yt-empty h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.yt-empty p {
  margin: 0 0 8px;
  color: #aaa;
  font-size: 16px;
  line-height: 1.45;
}

.yt-skel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px 18px;
}

.yt-skel-thumb,
.yt-skel-line {
  border-radius: 12px;
  background: linear-gradient(100deg, #1c1c1c 25%, #2a2a2a 42%, #1c1c1c 60%);
  background-size: 300% 100%;
  animation: plex-shimmer 1.6s ease-in-out infinite;
}

.yt-skel-thumb {
  aspect-ratio: 16 / 9;
  margin-bottom: 12px;
}

.yt-skel-line {
  width: 86%;
  height: 14px;
  margin: 8px 0;
}

.yt-skel-line.short { width: 54%; }

@media (max-width: 900px) {
  .yt-masthead { flex-wrap: wrap; }
  .yt-brand { width: 100%; }
  .yt-search { width: 100%; }
  .yt-rail .yt-card { flex-basis: 300px; }
}

.rail {
  gap: 17px;
  padding: 4px 2px 22px;
}

.tile {
  width: 220px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #171b24, #10131a);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  transition: transform 170ms ease, border-color 170ms ease;
}

.tile:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 199, 242, 0.36);
}

.tile.wide { width: 350px; }
.tile .meta { padding: 13px 14px 16px; }
.tile .name { font-size: 17px; font-weight: 670; }
.tile .sub { color: var(--muted); }

.art-wrap {
  position: relative;
  overflow: hidden;
  background: #171a20;
}

.tile-progress {
  position: absolute;
  right: 9px;
  bottom: 9px;
  left: 9px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.tile-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #e5a00d;
}

.grid {
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 19px;
}

/* Plex uses its own restrained, poster-first visual language. */
#top .tab[data-route="plex"].active svg { color: #e5a00d; }

.plex-page {
  max-width: 1480px;
  margin: 0 auto;
}

#plex-body {
  padding-top: 10px;
}

#plex-body > .row-title:first-child {
  margin-top: 8px;
}

.plex-search-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.plex-search-head span:first-child { color: #f7f7f7; }

.plex-search-head span:last-child {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.plex-live-rail {
  min-height: 340px;
  padding-top: 4px;
}

.plex-chrome {
  padding-bottom: 12px;
}

.plex-masthead {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 4px 0 8px;
}

.plex-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.plex-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 26px;
}

.plex-mark::after {
  width: 14px;
  height: 22px;
  background: #e5a00d;
  box-shadow: 0 8px 18px rgba(229, 160, 13, 0.28);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  content: "";
}

.plex-search {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #303030;
  border-radius: 40px;
  background: #121212;
}

.plex-search:focus-within {
  border-color: rgba(229, 160, 13, 0.55);
}

.plex-search input {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
}

.plex-search input::placeholder { color: #8a8a8a; }

.plex-search-btn {
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-left: 1px solid #303030;
  background: #222;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.plex-search-btn:hover { background: #2c2c2c; }

#app.plex-web-layout {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

.plex-web-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #1b1b1b;
}

.route-plex .search-row:focus-within {
  border-color: rgba(229, 160, 13, 0.55);
}

.route-plex .search-row .btn.primary,
.route-plex .card .btn.primary {
  color: #16120a;
  background: #e5a00d;
  box-shadow: 0 10px 26px rgba(229, 160, 13, 0.22);
}

.route-plex .row-title {
  margin-top: 26px;
  font-size: 24px;
}

.route-plex .tile {
  overflow: visible;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.route-plex .tile .art-wrap {
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.30);
  transition: box-shadow 170ms ease, outline-color 170ms ease;
}

.route-plex .tile .art { transition: transform 220ms ease; }

.route-plex .tile:hover {
  border-color: transparent;
  transform: translateY(-4px);
}

.route-plex .tile:hover .art-wrap {
  outline: 3px solid #e5a00d;
  outline-offset: 2px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

.route-plex .tile:hover .art { transform: scale(1.025); }

.route-plex .tile .meta { padding: 12px 2px 10px; }
.route-plex .tile .name { color: #f7f7f7; font-weight: 620; }
.route-plex .tile .sub { color: #8c919a; font-size: 14px; }
.route-plex .grid .tile { width: 100%; }

.route-plex .chip {
  border: 0;
  border-radius: 999px;
  background: #22252b;
}

.route-plex .chip:hover {
  color: #171109;
  border-color: transparent;
  background: #e5a00d;
}

.plex-detail-view {
  padding: 0 0 60px !important;
  background: #0d0f12;
}

.plex-detail-nav {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 82px;
  padding: 12px 34px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 15, 18, 0.90);
  backdrop-filter: blur(18px);
}

.plex-back {
  flex: 0 0 auto;
  min-height: 50px;
  color: #f5f5f5;
  background: rgba(255, 255, 255, 0.09);
}

.plex-back span {
  display: inline-block;
  margin-right: 7px;
  color: #e5a00d;
}

.plex-breadcrumbs {
  display: flex;
  align-items: center;
  min-width: 0;
  width: auto;
  gap: 8px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
}

.plex-breadcrumbs button {
  appearance: none;
  min-height: 42px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #a8adb5;
  cursor: pointer;
}

.plex-breadcrumbs button:hover {
  color: #e5a00d;
  background: rgba(255, 255, 255, 0.06);
}

.plex-breadcrumbs span { color: #626872; }

.plex-breadcrumbs strong {
  overflow: hidden;
  color: #f2f3f5;
  font-size: 16px;
  font-weight: 650;
  text-overflow: ellipsis;
}

.plex-detail-hero {
  position: relative;
  min-height: 440px;
  overflow: hidden;
  background: linear-gradient(135deg, #24282e, #101216 68%);
}

.plex-detail-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.43;
}

.plex-detail-fade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(13, 15, 18, 0.98) 0%, rgba(13, 15, 18, 0.77) 43%, rgba(13, 15, 18, 0.24) 100%),
    linear-gradient(0deg, #0d0f12 0%, transparent 42%);
}

.plex-detail-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 30px;
  min-height: 440px;
  padding: 46px 44px 40px;
}

.plex-detail-poster {
  width: 185px;
  height: 278px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: #24272d;
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.50);
}

.plex-no-poster {
  background: linear-gradient(145deg, #30343b, #1a1d22);
}

.plex-detail-copy {
  max-width: 760px;
  padding-bottom: 5px;
}

.plex-detail-kicker {
  margin-bottom: 8px;
  color: #e5a00d;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.plex-detail-copy h1 {
  margin: 0;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.05em;
  text-shadow: 0 3px 20px rgba(0, 0, 0, 0.55);
}

.plex-facts {
  display: flex;
  gap: 9px;
  margin-top: 15px;
  color: #c6c9ce;
  font-size: 16px;
}

.plex-facts span + span::before {
  margin-right: 9px;
  color: #71767e;
  content: "•";
}

.plex-detail-copy p {
  display: -webkit-box;
  max-width: 720px;
  margin: 18px 0 0;
  overflow: hidden;
  color: #c4c7cc;
  font-size: 17px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.plex-children { padding: 28px 44px 10px; }

.plex-section-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.plex-section-heading h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.03em;
}

.plex-section-heading > span {
  color: #7e848e;
  font-size: 15px;
}

.plex-library-view {
  margin: 8px 0 28px;
}

.plex-library-browser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: start;
}

.plex-library-grid {
  min-width: 0;
}

.plex-alpha-rail {
  position: sticky;
  top: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: min(78vh, 720px);
  padding: 6px 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(12, 14, 18, 0.82);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  touch-action: none;
  user-select: none;
}

.plex-alpha-rail button {
  appearance: none;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9aa1ab;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
}

.plex-alpha-rail button.active,
.plex-alpha-rail button:hover:not(:disabled) {
  color: #e5a00d;
}

.plex-alpha-rail button:disabled {
  color: rgba(154, 161, 171, 0.28);
  cursor: default;
}

.route-plex .chip.on {
  color: #16120a;
  background: #e5a00d;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(229, 160, 13, 0.22);
}

.plex-detail-grid {
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 26px 18px;
}

.plex-episode-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.plex-detail-loading {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 440px;
  padding: 45px 44px;
}

.plex-loading-poster,
.plex-loading-line {
  border-radius: 10px;
  background: linear-gradient(100deg, #1c2026 25%, #292e36 42%, #1c2026 60%);
  background-size: 300% 100%;
  animation: plex-shimmer 1.6s ease-in-out infinite;
}

.plex-loading-poster {
  width: 185px;
  height: 278px;
}

.plex-loading-line {
  width: 260px;
  height: 18px;
  margin: 14px 0;
}

.plex-loading-line.wide {
  width: min(520px, 52vw);
  height: 52px;
}

.plex-detail-error {
  max-width: 720px;
  margin: 48px 44px;
}

@keyframes plex-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(24, 28, 38, 0.96), rgba(14, 17, 24, 0.96));
  box-shadow: var(--shadow);
}

.card h2 {
  margin-bottom: 9px;
  font-size: 25px;
  letter-spacing: -0.035em;
}

.card p {
  color: var(--muted);
  font-size: 17px;
}

.route-settings {
  display: block;
}

.route-settings .page-intro {
  min-height: 0;
  margin-bottom: 18px;
}

.settings-page {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  max-width: 1240px;
}

.settings-nav {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(17, 20, 28, 0.92);
  box-shadow: var(--shadow);
}

.settings-nav button {
  appearance: none;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.settings-nav button.on,
.settings-nav button:hover {
  color: #fff;
  background: rgba(139, 92, 246, 0.16);
}

.settings-body { min-width: 0; }

.settings-panel {
  scroll-margin-top: 12px;
  margin: 0 0 18px;
  padding: 28px 30px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(24, 28, 38, 0.96), rgba(14, 17, 24, 0.96));
  box-shadow: var(--shadow);
}

.settings-panel header { margin-bottom: 8px; }

.settings-panel header h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.settings-panel header p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.set-row,
.set-block {
  display: grid;
  gap: 14px 28px;
  align-items: center;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.set-row {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
}

.set-block { grid-template-columns: 1fr; }

.settings-panel header + .set-row,
.settings-panel header + .set-block {
  border-top: 0;
  padding-top: 10px;
}

.set-copy strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.set-copy p,
.set-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.set-help.ok { color: var(--ok); }
.set-help.error { color: var(--danger); }

.set-control {
  display: flex;
  justify-content: flex-end;
}

.set-control .settings-row,
.settings-panel .settings-row {
  margin: 0;
  justify-content: flex-end;
}

.set-block .settings-row {
  justify-content: flex-start;
}

.set-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
}

.set-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.set-pill.ok {
  color: #b6f5cf;
  border-color: rgba(55, 214, 122, 0.28);
  background: rgba(55, 214, 122, 0.12);
}

.set-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.set-options.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.set-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 148px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 15, 22, 0.72);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.set-option strong {
  font-size: 18px;
  letter-spacing: -0.03em;
}

.set-option p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.set-option.on {
  border-color: rgba(139, 92, 246, 0.7);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.18), rgba(18, 22, 32, 0.9));
  box-shadow: 0 12px 28px rgba(108, 86, 244, 0.18);
}

.set-badge {
  margin-bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.set-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.set-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 15, 22, 0.72);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.set-choice strong { font-size: 18px; }
.set-choice span { color: var(--muted); font-size: 14px; }
.set-choice.on {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #675cf4);
  box-shadow: 0 9px 23px rgba(108, 86, 244, 0.26);
}
.set-choice.on span { color: rgba(255, 255, 255, 0.82); }

.set-form {
  display: grid;
  gap: 10px;
  max-width: 420px;
}

.set-form input {
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0b0e14;
  color: var(--text);
  font-size: 18px;
}

.set-file {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.set-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 80px;
}

.set-pin {
  margin-top: 8px;
  padding: 18px 20px 8px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.set-pin h2,
.plex-link-card h2 { margin-bottom: 4px; }

.set-pin .pin {
  font-size: 64px;
  letter-spacing: 0.22em;
  text-indent: 0.12em;
  margin: 8px 0 4px;
}

.set-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.set-meta div {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 15, 22, 0.55);
}

.set-meta span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.set-meta strong {
  font-size: 18px;
  letter-spacing: -0.03em;
  word-break: break-word;
}

.set-note {
  display: none;
}

.set-note.show {
  position: sticky;
  top: 8px;
  z-index: 6;
  display: block;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(55, 214, 122, 0.12);
  color: #b6f5cf;
  font-size: 16px;
  font-weight: 650;
}

.set-note.show.error {
  background: rgba(255, 77, 103, 0.12);
  color: #ff8da0;
}

.settings-row {
  gap: 9px;
  margin: 17px 0 0;
}

.chip {
  min-height: 52px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #1c212c;
  color: #bac1cf;
  font-size: 17px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.chip:hover {
  color: #fff;
  border-color: rgba(139, 92, 246, 0.45);
}

.chip.on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #675cf4);
  box-shadow: 0 9px 23px rgba(108, 86, 244, 0.26);
}

.empty {
  min-height: 130px;
  display: grid;
  place-items: center;
  padding: 38px 18px;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.10);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.018);
  text-align: center;
}

.overlay {
  background:
    radial-gradient(circle at 25% 15%, rgba(139, 92, 246, 0.28), transparent 34%),
    radial-gradient(circle at 80% 80%, rgba(34, 199, 242, 0.15), transparent 30%),
    #080a0f;
}

.login-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(25, 29, 40, 0.98), rgba(12, 15, 21, 0.98));
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.52);
}

.mark {
  color: var(--accent-2);
  letter-spacing: 0.18em;
}

.login-card input {
  border: 1px solid var(--line);
  background: #0b0e14;
}

.error { color: var(--danger); }

.player-ui {
  padding: 20px 24px 22px;
  background: linear-gradient(#020306c7, transparent 22%, transparent 63%, #020306e8);
}

.player-top {
  align-self: stretch;
  width: 100%;
  max-width: none;
  padding: 7px 12px 7px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(8, 10, 15, 0.82);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.30);
}

.player-back {
  min-height: 50px;
  padding: 0 16px;
}

.player-title {
  flex: 1;
  min-width: 0;
  font-size: 22px;
  font-weight: 670;
  padding-right: 10px;
}

.player-bottom {
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 23px;
  background: rgba(8, 10, 15, 0.88);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
}

.player-bottom .btn {
  min-width: 112px;
  min-height: 54px;
}

.seek-track {
  height: 10px;
  margin-top: -5px;
  border-radius: 999px;
  background: #343a47;
  overflow: visible;
}

.seek-fill { border-radius: 999px; }
.seek-buf { background: #697285; }
.seek-played { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.seek-thumb {
  width: 24px;
  height: 24px;
  margin-top: -12px;
  margin-left: -12px;
  background: #fff;
  border: 4px solid var(--accent);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
}

.time {
  min-width: 145px;
  color: #dfe3ec;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.player-msg {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: rgba(9, 11, 16, 0.90);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  color: #fff;
  font-weight: 650;
  z-index: 6;
}

.player-ui {
  z-index: 2;
  transition: opacity 0.4s ease;
}
.player.chrome-hidden .player-ui {
  opacity: 0;
  pointer-events: none;
}

.player-center-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 132px;
  height: 132px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 10, 15, 0.32);
  color: #fff;
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.player-center-play svg {
  width: 72px;
  height: 72px;
  fill: currentColor;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}
.player-center-play .icon-play {
  display: none;
  margin-left: 6px;
}
.player-center-play.is-paused .icon-pause { display: none; }
.player-center-play.is-paused .icon-play { display: block; }
.player-center-play:active {
  opacity: 0.95;
  background: rgba(8, 10, 15, 0.5);
}

.subtitle-button {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 50px;
  padding: 0 14px;
  border-color: rgba(255, 255, 255, 0.2);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.subtitle-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.subtitle-menu {
  position: absolute;
  z-index: 7;
  top: 86px;
  right: 24px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(9, 11, 16, 0.97);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.subtitle-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #eef1f7;
  font: inherit;
  font-size: 16px;
  text-align: left;
}

.subtitle-option + .subtitle-option { margin-top: 3px; }
.subtitle-option:hover { background: rgba(255, 255, 255, 0.08); }
.subtitle-option.active { background: rgba(123, 97, 255, 0.28); color: #fff; }
.subtitle-option small { color: var(--accent-2); font-weight: 800; }

.subtitle-overlay {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 112px;
  max-width: min(84vw, 1200px);
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: clamp(22px, 2.4vw, 38px);
  font-weight: 650;
  line-height: 1.28;
  text-align: center;
  white-space: pre-line;
  text-shadow: 0 2px 5px #000, 0 0 2px #000;
  pointer-events: none;
}

@media (min-width: 1500px) {
  :root { --app-pad-x: 44px; }
  #app { padding-left: 44px; padding-right: 44px; }
  .yt-grid, .yt-skel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  :root { --app-pad-x: 20px; --app-pad-y: 24px; }
  #top { padding: 12px 18px; }
  .brand-name { display: none; }
  .tab { padding: 0 14px; }
  #app { padding: 24px 20px 44px; }
  .route-settings { grid-template-columns: 1fr; }
  .settings-page { grid-template-columns: 1fr; }
  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
  }
  .settings-nav button { flex: 0 0 auto; padding: 0 18px; }
  .set-row,
  .set-options,
  .set-meta { grid-template-columns: 1fr; }
  .set-control,
  .set-control .settings-row,
  .settings-panel .settings-row { justify-content: flex-start; }
  .page-intro { min-height: 96px; }
  .plex-detail-nav { padding-right: 20px; padding-left: 20px; }
  .plex-detail-content { padding-right: 28px; padding-left: 28px; }
  .plex-children { padding-right: 28px; padding-left: 28px; }
}

@media (max-width: 700px) {
  #top {
    align-items: stretch;
    flex-direction: column;
  }
  .logo { display: none; }
  nav { width: 100%; }
  .tab { flex: 1; padding: 0 8px; }
  .tab span { display: none; }
  .search-row { flex-direction: column; }
  .search-row .btn { width: 100%; }
  .yt-grid { grid-template-columns: 1fr; }
  .player-ui { padding: 12px; }
  .subtitle-menu { top: 74px; right: 12px; }
  .subtitle-overlay { bottom: 96px; max-width: 92vw; }
  .plex-library-browser { grid-template-columns: minmax(0, 1fr) 28px; }
  .plex-alpha-rail { height: min(72vh, 560px); }
  .player-bottom { gap: 8px; }
  .player-bottom .btn { min-width: 82px; padding: 0 12px; }
  .time { min-width: 98px; font-size: 14px; }
  .plex-detail-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    padding: 10px 16px 8px;
  }
  .plex-back { min-height: 44px; }
  .plex-breadcrumbs { max-width: 100%; }
  .plex-detail-content {
    align-items: flex-end;
    gap: 18px;
    min-height: 390px;
    padding: 32px 18px;
  }
  .plex-detail-hero { min-height: 390px; }
  .plex-detail-poster {
    width: 110px;
    height: 165px;
  }
  .plex-detail-copy h1 { font-size: 36px; }
  .plex-detail-copy p { display: none; }
  .plex-children { padding: 24px 18px; }
  .plex-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plex-episode-grid { grid-template-columns: 1fr; }
  .plex-detail-loading { padding: 30px 18px; }
  .plex-loading-poster {
    width: 110px;
    height: 165px;
  }
  .plex-detail-error { margin: 28px 18px; }
}
