/* Guest access is party-only: no Browse, search, settings or library chrome. */
.guest-admission {
  display: grid;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.2);
}
.guest-admission .btn {
  margin-top: 0;
}
.guest-invitation-dialog {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3,8,14,.72);
}
.guest-invitation-card {
  width: min(390px,100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0d1b2d;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.guest-invitation-card h2 {
  margin: 0;
}
.guest-invitation-card p {
  margin: 7px 0 15px;
  color: var(--muted);
}
.guest-invitation-card label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
}
.guest-invitation-card input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #091523;
  color: var(--text);
  outline: none;
}
.guest-invitation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 16px;
}
.guest-invitation-actions .btn {
  width: auto;
  margin-top: 0;
}
body.guest-viewer #appView {
  display: none !important;
}
/* Foundation and design tokens
 * Defines shared color, spacing, and surface values used throughout the Activity. */
:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #0d1b2d;
  --panel2: #13243a;
  --line: #253b55;
  --text: #eef5ff;
  --muted: #aebed1;
  --accent: #5aa7ff;
  --accent-strong: #1766b7;
  --accent-border: #2583df;
  --overlay-rgb: 5,11,20;
  --danger: #ff7474;
}

* {
  box-sizing: border-box;
}

html,body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  font: 15px/1.4 system-ui,-apple-system,Segoe UI,sans-serif;
  background: radial-gradient(circle at top,#102744 0,#08111f 45%);
  color: var(--text);
}

button,input,select {
  font: inherit;
}

.hidden {
  display: none !important;
}

/* Application shell and navigation
 * Defines the authenticated layout, backdrop, header, sidebar, and primary navigation surfaces. */
.shell {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  background: radial-gradient(circle at top,#102744 0,#08111f 45%);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.app-backdrop-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.app-backdrop-layer.active {
  opacity: 1;
}

.shell.app-backdrop-active {
  background-attachment: fixed;
}

.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: rgba(7,16,29,.86);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.shell.app-backdrop-active .topbar {
  background: rgba(var(--overlay-rgb),.64);
  border-bottom-color: var(--line);
  backdrop-filter: blur(12px);
  transition: background-color 1.2s ease,border-color 1.2s ease;
}

.brand {
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.back-slot {
  flex: 0 0 82px;
  width: 82px;
}

.search-wrap {
  position: relative;
  flex: 0 0 320px;
  width: 320px;
  max-width: 320px;
  min-width: 180px;
}

.search {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 38px 10px 12px;
  outline: none;
}

.search:focus {
  border-color: var(--accent);
}

.search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.search-clear:hover {
  background: var(--panel2);
  color: var(--text);
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  padding: 9px 13px;
  border-radius: 9px;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.btn:disabled,
.btn.queue-playback-disabled {
  opacity: .42;
  filter: grayscale(.9) saturate(.35);
  cursor: not-allowed;
}

.btn:disabled:hover,
.btn.queue-playback-disabled:hover {
  border-color: var(--line);
}

.btn.primary {
  background: var(--accent-strong);
  border-color: var(--accent-border);
  transition: background-color 1.2s ease,border-color 1.2s ease;
}

.btn.danger {
  background: #4b2027;
}

.main {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  position: relative;
  z-index: 1;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 16px;
  background: rgba(var(--overlay-rgb),.8);
  transition: background-color 1.2s ease,border-color 1.2s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-main {
  flex: 1 1 auto;
  min-height: 0;
}

.sidebar-footer {
  flex: 0 0 auto;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(174,190,209,.18);
  display: grid;
  gap: 3px;
}

.sidebar-version {
  font-size: 10px;
  color: #6f7d8d;
}

.public-link {
  color: #8794a3;
  text-decoration: none;
}

.public-link:hover,.public-link:focus-visible {
  color: #bcc7d3;
  text-decoration: underline;
}

.sidebar-project-link {
  font-size: 11px;
  line-height: 1.25;
}

.shell.app-backdrop-active .sidebar {
  background: rgba(var(--overlay-rgb),.68);
  border-right-color: var(--line);
  backdrop-filter: blur(10px);
}

.navbtn {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
}

.navbtn:hover,.navbtn.active {
  background: var(--panel2);
  color: var(--text);
}

.navbtn.favorites-nav {
  margin-top: 18px;
}

.content {
  padding: 22px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  position: relative;
  transition: background-image .28s ease;
}

.content.detail-mode,.content.browse-backdrop-mode,.content.home-backdrop-mode {
  min-height: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.content.home-backdrop-mode,.content.browse-backdrop-mode {
  background-attachment: local;
}

.heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.heading h1 {
  font-size: 22px;
  margin: 0;
}

/* Library and media detail
 * Lays out libraries, search results, posters, metadata, and item detail content. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(154px,184px));
  gap: 22px 18px;
  align-items: start;
}

.grid.library-grid {
  grid-template-columns: repeat(auto-fill,minmax(280px,360px));
  gap: 22px;
}

.card {
  min-width: 0;
  cursor: pointer;
}

.poster {
  aspect-ratio: 2/3;
  border-radius: 10px;
  background: linear-gradient(145deg,#182c44,#0c1726);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71859d;
  box-shadow: 0 8px 25px rgba(0,0,0,.22);
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .16s ease;
}

.poster img.loaded {
  opacity: 1;
}

.poster img.image-failed {
  display: none;
}

.card-title {
  font-weight: 650;
  margin-top: 8px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Authentication
 * Presents the media-server sign-in and remembered-session recovery experience. */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login {
  width: min(420px,100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: rgba(13,27,45,.96);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  box-shadow: 0 25px 70px rgba(0,0,0,.35);
}

.login h1 {
  margin: 0 0 4px;
}

.login .server {
  color: var(--muted);
  margin-bottom: 12px;
}

.login label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
}

.login input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #091523;
  color: var(--text);
  outline: none;
}

.login button {
  width: 100%;
  margin-top: 18px;
}

.login .auth-recovery-button {
  margin-top: 10px;
}

.login .auth-recovery-button+.auth-recovery-button {
  margin-top: 8px;
}

.remember-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0 !important;
  color: var(--text) !important;
  position: relative;
}
.remember-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 370;
  width: min(360px, calc(100vw - 64px));
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #07111e;
  color: var(--text);
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  font-size: 11px;
  line-height: 1.4;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity .12s ease, transform .12s ease, visibility .12s;
}
.remember-row:hover .remember-tooltip,
.remember-row:focus-within .remember-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.remember-row input {
  width: auto !important;
  margin: 0;
}

.login-privacy {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.login-privacy p {
  margin: 0;
}

.login-privacy p+p {
  margin-top: 8px;
}

.auth-followup {
  margin-top: 4px;
  color: #c5d2e1;
  font-size: 12px;
}

.error {
  color: #ff9b9b;
  margin-top: 12px;
  white-space: pre-wrap;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.detail {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px,280px) minmax(0,1fr);
  gap: 24px;
  max-width: 1120px;
}

.detail.episode-detail {
  grid-template-columns: minmax(170px,240px) minmax(0,1fr);
}

.detail .poster {
  width: 100%;
}

.detail.episode-detail .poster {
  aspect-ratio: 16/9;
}

.detail h1 {
  font-size: 30px;
  margin: 0 0 4px;
}

.detail-info {
  position: relative;
  padding: 16px 70px 22px 22px;
  border-radius: 14px;
  background: linear-gradient(135deg,rgba(var(--overlay-rgb),.58) 0%,rgba(var(--overlay-rgb),.49) 58%,rgba(var(--overlay-rgb),.38) 100%);
  border: 1px solid rgba(88,122,156,.18);
  box-shadow: 0 18px 46px rgba(0,0,0,.18);
  backdrop-filter: blur(6px);
}

.detail-season {
  font-size: 21px;
  font-weight: 700;
  color: #d7e4f2;
  margin-top: 3px;
}

.detail-episode {
  font-size: 20px;
  font-weight: 700;
  margin-top: 3px;
}

.detail-quality {
  font-size: 13px;
  color: #cbd8e7;
  margin-top: 4px;
}

.detail-subtitle-row {
  margin: -8px 0 18px;
}

.detail-subtitle-select {
  min-width: 190px;
  max-width: min(360px,100%);
  padding: 9px 34px 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0d1b2d;
  color: var(--text);
}

.detail-subtitle-select.placeholder {
  color: var(--muted);
}

.detail-extras {
  grid-column: 1/-1;
  margin-top: 2px;
}

.detail-extras h2 {
  font-size: 19px;
  margin: 0 0 12px;
}

.detail-extras .grid {
  grid-template-columns: repeat(auto-fill,minmax(154px,184px));
}

.overview {
  color: #d5e1ee;
  max-width: 760px;
  white-space: pre-line;
}

.playback-ended-notice {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin: 14px 0 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(var(--overlay-rgb),.52);
  color: #dce8f5;
  font-size: 13px;
  font-weight: 650;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.detail-primary-action {
  min-width: 154px;
}

.favorite-star {
  position: absolute;
  right: 18px;
  top: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  background: rgba(4,10,18,.5);
  color: #f5d76e;
  border-radius: 50%;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.favorite-star:hover {
  background: rgba(4,10,18,.72);
}

.favorite-star[disabled] {
  opacity: .65;
  cursor: wait;
}

/* The player is a fixed-height shell. The media stage flexes only inside the space left after both bars, so controls cannot be pushed below Discord's viewport. */
.player-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #000;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* Player and loading surface
 * Keeps playback startup, video presentation, and transport controls visually coordinated. */
.playback-loading-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #000 center/cover no-repeat;
  opacity: 1;
  transition: opacity .44s ease,filter .44s ease;
  pointer-events: none;
  display: grid;
  place-items: center;
  animation: loading-fanart-in .3s ease;
}

.playback-loading-backdrop.reveal {
  opacity: 0;
  filter: brightness(1.03);
}

.playback-loading-message {
  padding: 16px 24px 18px;
  border-radius: 16px;
  background: rgba(2,7,13,.38);
  backdrop-filter: blur(8px);
  text-align: center;
  box-shadow: 0 12px 42px rgba(0,0,0,.18);
  animation: loading-message-in .34s ease both .08s;
}

.playback-loading-brand {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .2px;
}

.playback-loading-status {
  margin-top: 3px;
  color: #dce7f3;
  font-size: 15px;
}

.loading-dot {
  display: inline-block;
  margin-left: 2px;
  animation: loading-dot-hop 1s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
  animation-delay: .12s;
}

.loading-dot:nth-child(3) {
  animation-delay: .24s;
}

@keyframes loading-fanart-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }

}

@keyframes loading-message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }

}

@keyframes loading-dot-hop {
  0%,55%,100% {
    transform: translateY(0);
  }

  25% {
    transform: translateY(-5px);
  }

}

.player-overlay.playback-loading .player-top,.player-overlay.playback-loading .transport {
  opacity: 0 !important;
  pointer-events: none !important;
}

.player-top {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #06090e;
  border-bottom: 1px solid #18202b;
}

.player-top .title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-exit-wrap {
  position: relative;
  flex: 0 0 auto;
}

.player-exit-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 12;
  width: min(380px,calc(100vw - 24px));
  padding: 14px;
  background: #101b29;
  border: 1px solid #334b66;
  border-radius: 11px;
  box-shadow: 0 18px 55px rgba(0,0,0,.62);
}

.player-exit-popover h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.player-exit-popover p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.player-exit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.player-exit-actions .btn {
  flex: 1 1 auto;
}

.player-exit-popover .danger {
  background: #4b2027;
}

.player-exit-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 20px;
  width: 10px;
  height: 10px;
  background: #101b29;
  border-left: 1px solid #334b66;
  border-top: 1px solid #334b66;
  transform: rotate(45deg);
}

.player-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.player-stage video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}

/* Prepared progression retains the existing player and controls. Never use the
   full cold-start overlay or expose the old outgoing frame behind the handoff. */
.fast-handoff {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #f5f7fa;
  transition: opacity .2s ease;
  pointer-events: none;
}
.fast-handoff.is-revealing {
  opacity: 0;
}
.fast-handoff-message {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
}
.fast-handoff-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 12px;
}
.fast-handoff-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: handoff-bounce .9s ease-in-out infinite alternate;
}
.fast-handoff-dots i:nth-child(2) {
  animation-delay: .15s;
}
.fast-handoff-dots i:nth-child(3) {
  animation-delay: .3s;
}
@keyframes handoff-bounce {
  to {
    transform: translateY(-4px);
    opacity: .45;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fast-handoff, .fast-handoff-dots i {
    animation: none;
    transition: none;
  }
}

.activity-subtitle-overlay {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  pointer-events: none;
  text-align: center;
  padding: 0 4%;
  font-size: var(--activity-subtitle-font-size,22px);
  line-height: 1.28;
}

.activity-subtitle-overlay.hidden {
  display: none;
}

.activity-subtitle-cue {
  max-width: 100%;
  padding: 2px 7px;
  color: #fff;
  background: transparent;
  text-shadow: -1px -1px 1px #000,1px -1px 1px #000,-1px 1px 1px #000,1px 1px 1px #000,0 2px 4px #000;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pip-activity-placeholder {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #05080d;
  color: #d8e3f0;
  text-align: center;
}

.pip-activity-placeholder .pip-placeholder-card {
  display: grid;
  gap: 5px;
  max-width: 360px;
}

.pip-activity-placeholder strong {
  font-size: 17px;
}

.pip-activity-placeholder span {
  font-size: 12px;
  color: var(--muted);
}

.transport {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  min-height: 82px;
  padding: 8px 12px max(26px,calc(env(safe-area-inset-bottom) + 18px));
  display: flex;
  align-items: center;
  gap: 9px;
  background: #06090e;
  border-top: 1px solid #18202b;
}

.player-project-cta {
  position: absolute;
  right: 12px;
  bottom: max(4px,env(safe-area-inset-bottom));
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  font-size: 10px;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
  pointer-events: auto;
}

.player-project-cta-question {
  color: #666f79;
}

.player-project-cta .public-link {
  color: #858f9a;
  font-weight: 650;
}

.player-project-cta .public-link:hover,.player-project-cta .public-link:focus-visible {
  color: #b9c2cc;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #27384c;
  border-radius: 9px;
  background: #101b29;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.icon-btn:hover,.icon-btn.active {
  border-color: var(--accent);
  background: var(--panel2);
}

.play-icon {
  font-size: 19px;
}

.play-icon.activity-pause {
  position: relative;
  font-size: 0;
}

.play-icon.activity-pause::before,.play-icon.activity-pause::after {
  content: "";
  position: absolute;
  top: 11px;
  width: 4px;
  height: 16px;
  border-radius: 1px;
  background: currentColor;
}

.play-icon.activity-pause::before {
  left: 12px;
}

.play-icon.activity-pause::after {
  right: 12px;
}

#audioButton {
  font-size: 25px;
  line-height: 1;
}

#volumeButton {
  font-size: 21px;
  line-height: 1;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #c7d2df;
  white-space: nowrap;
}

.seek {
  flex: 1;
  min-width: 80px;
  accent-color: var(--accent);
}

.transport-spacer {
  flex: 0 0 2px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 5px;
}

.volume-slider {
  width: 86px;
  min-width: 58px;
  accent-color: var(--accent);
}

/* At desktop widths the groups are transparent to the established control order.
 * Narrow Activity viewports use two stable rows instead of clipping controls. */
.transport-primary,.transport-secondary {
  display: contents;
}

/* Playback controls and popovers
 * Presents quality, audio, subtitle, and diagnostic controls above the transport surface. */
.control-popover {
  position: absolute;
  right: 54px;
  bottom: 58px;
  width: min(290px,calc(100vw - 24px));
  padding: 12px;
  background: #0d1724;
  border: 1px solid #2c425d;
  border-radius: 11px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
  z-index: 8;
}

.control-popover.quality {
  right: 150px;
}

.control-popover.audio {
  right: 102px;
}

.control-popover label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.control-popover select {
  width: 100%;
  background: #091523;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.control-popover-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.subtitle-options {
  display: grid;
  gap: 5px;
  max-height: min(42vh,320px);
  overflow: auto;
}

.subtitle-option {
  width: 100%;
  text-align: left;
  background: #091523;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
}

.subtitle-option:hover,.subtitle-option.active {
  border-color: var(--accent);
  background: #152943;
}

.subtitle-option:disabled {
  opacity: .55;
  cursor: default;
}

.status-pill {
  font-size: 12px;
  color: var(--muted);
}

.subtitle-debug-panel {
  position: absolute;
  right: 54px;
  bottom: 58px;
  z-index: 11;
  width: min(520px,calc(100vw - 24px));
  max-height: min(66vh,560px);
  overflow: auto;
  padding: 12px;
  background: #08111f;
  border: 1px solid #3a5573;
  border-radius: 11px;
  box-shadow: 0 18px 60px rgba(0,0,0,.72);
  font-size: 12px;
}

.subtitle-debug-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.subtitle-debug-head strong {
  flex: 1;
  font-size: 13px;
}

.subtitle-debug-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.subtitle-debug-actions .btn {
  padding: 5px 8px;
  font-size: 11px;
}

.subtitle-debug-grid {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: 4px 10px;
  padding: 8px;
  background: #0d1b2d;
  border: 1px solid #20354d;
  border-radius: 8px;
}

.subtitle-debug-grid dt {
  color: var(--muted);
}

.subtitle-debug-grid dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.subtitle-debug-section {
  margin-top: 10px;
}

.subtitle-debug-section h4 {
  margin: 0 0 5px;
  font-size: 11px;
  color: #c7d7e8;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.subtitle-debug-pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #050b13;
  border: 1px solid #20354d;
  border-radius: 8px;
  padding: 8px;
  max-height: 180px;
  overflow: auto;
  font: 11px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;
  color: #dce9f7;
}

.subtitle-debug-copy-fallback {
  position: absolute;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.subtitle-debug-good {
  color: #8ee6a4;
}

.subtitle-debug-warn {
  color: #ffd479;
}

/* Session-presence and credits overlays
 * Keeps timeout and end-of-title prompts visible without obscuring unrelated application state. */
.still-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.58);
  padding: 20px;
}

.still-card {
  width: min(360px,100%);
  background: #101b29;
  border: 1px solid #334b66;
  border-radius: 14px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0,0,0,.65);
}

.still-card h2 {
  margin: 0 0 8px;
}

.still-card p {
  color: var(--muted);
}

.still-card .btn {
  width: 100%;
  margin-top: 8px;
}

.still-card .btn+.btn {
  margin-top: 8px;
}

.session-expiry-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.7);
  padding: 20px;
  pointer-events: auto;
}

.session-expiry-modal .btn,.still-modal .btn {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.session-expiry-card {
  width: min(420px,100%);
  background: #101b29;
  border: 1px solid #3a5573;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0,0,0,.72);
}

.session-expiry-card h2 {
  margin: 0 0 8px;
}

.session-expiry-card p {
  color: var(--muted);
}

.session-countdown {
  font-size: 20px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  margin: 14px 0;
}

.session-expiry-card .btn {
  width: 100%;
  margin-top: 8px;
}

.terminal-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top,#102744 0,#08111f 45%);
}

.terminal-card {
  width: min(460px,100%);
  background: rgba(13,27,45,.98);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  text-align: center;
}

.terminal-card h1 {
  margin: 0 0 8px;
}

.terminal-card p {
  color: var(--muted);
}

.terminal-card .btn {
  width: 100%;
  margin-top: 10px;
}

.bootstrap-failure {
  margin-top: 10px;
  color: #ffb6b6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Watch Party lobby
 * The lobby is the shared party home between playback items. The main canvas stays
 * presentation-oriented while operational party state remains in a stable right rail. */
.party-lobby {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(340px,420px);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #07111f;
}

.party-lobby-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(28px,5vw,72px);
  overflow: auto;
  background:
    radial-gradient(circle at 50% 28%,rgba(64,119,179,.22),transparent 35%),
    linear-gradient(145deg,#10243b 0%,#091524 52%,#07101c 100%);
}

.party-lobby-main-copy {
  width: min(760px,100%);
  display: grid;
  gap: 14px;
  text-align: center;
}

.party-lobby-kicker {
  color: #a9c9ec;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.party-lobby-main h1 {
  margin: 0;
  font-size: clamp(38px,6vw,72px);
  line-height: 1;
}

.party-lobby-message {
  margin: 0 auto;
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(15px,2vw,19px);
}

.party-lobby-next {
  width: min(620px,100%);
  margin: 14px auto 0;
  padding: 20px 22px;
  display: grid;
  gap: 5px;
  border: 1px solid rgba(174,190,209,.24);
  border-radius: 16px;
  background: rgba(9,21,35,.62);
  box-shadow: 0 18px 52px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
}

.party-lobby-next-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.party-lobby-next strong {
  font-size: clamp(20px,3vw,30px);
  overflow-wrap: anywhere;
}

.party-lobby-next-meta {
  color: var(--muted);
  font-size: 13px;
}

.party-lobby-main-actions,
.party-lobby-inline-actions,
.party-lobby-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.party-lobby-main-actions {
  justify-content: center;
  margin-top: 4px;
}

.party-lobby-rail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: rgba(8,17,31,.96);
  box-shadow: -18px 0 50px rgba(0,0,0,.28);
}

.party-lobby-rail-head {
  position: sticky;
  top: -18px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -18px -18px 14px;
  padding: 18px;
  border-bottom: 1px solid rgba(174,190,209,.16);
  background: rgba(8,17,31,.97);
  backdrop-filter: blur(10px);
}

.party-lobby-rail-head h2,
.party-lobby-rail-section h3 {
  margin: 0;
}

.party-lobby-rail-head h2 {
  font-size: 18px;
}

.party-lobby-rail-section {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(174,190,209,.18);
  border-radius: 12px;
  background: rgba(19,36,58,.34);
}

.party-lobby-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.party-lobby-section-copy,
.party-lobby-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.party-lobby-status:empty {
  display: none;
}

.party-lobby-timer {
  width: 6ch;
  text-align: right;
  color: #eef5ff;
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.party-lobby-participants {
  display: grid;
  gap: 7px;
}

.party-lobby-participants .party-person {
  margin: 0;
  padding: 8px 9px;
}

.party-lobby-queue-section .party-timeline-section {
  margin: 0;
}

.party-lobby-queue-section .party-timeline-list {
  max-height: min(38dvh,420px);
  overflow: auto;
  padding-right: 2px;
}

.party-lobby-controls .btn {
  flex: 1 1 140px;
}

@media (max-width: 880px) {
  .party-lobby {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(250px,42dvh) minmax(0,1fr);
    overflow: hidden;
  }

  .party-lobby-main {
    min-height: 250px;
    padding: 28px 20px;
  }

  .party-lobby-rail {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .party-lobby-rail-head {
    position: static;
  }
}

/* Watch Party
 * Presents party membership, host controls, readiness, and shared playback actions. */
.party-panel {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(0,0,0,.56);
  display: flex;
  justify-content: flex-end;
}

.party-panel-card {
  width: min(430px,100%);
  height: 100%;
  overflow: auto;
  background: #0d1b2d;
  border-left: 1px solid var(--line);
  padding: 20px;
  box-shadow: -20px 0 55px rgba(0,0,0,.35);
}

.party-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.party-panel-head h2 {
  margin: 0;
  flex: 1;
}

.party-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.party-person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
}

.party-person-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-role {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.party-actions {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.party-actions .btn {
  width: 100%;
}

.party-transfer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 14px;
}

.party-transfer select {
  min-width: 0;
  background: #091523;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
}

.party-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(19,36,58,.55);
  font-size: 12px;
}

.party-project-footer {
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid rgba(174,190,209,.16);
  font-size: 11px;
  text-align: right;
}

.about-panel {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.66);
}

.about-card {
  width: min(460px,100%);
  max-height: min(80dvh,640px);
  overflow: auto;
  background: #0d1b2d;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 24px 72px rgba(0,0,0,.62);
}

.about-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.about-head h2 {
  margin: 0;
  flex: 1;
}

.about-copy {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.about-versions {
  display: grid;
  gap: 6px;
  margin: 12px 0 18px;
}

.about-version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 9px;
  border: 1px solid rgba(174,190,209,.14);
  border-radius: 8px;
  background: rgba(19,36,58,.42);
  font-size: 12px;
}

.about-version-row span:first-child {
  color: #cbd8e7;
}

.about-version-row code {
  color: #9fb0c2;
  font: 11px/1.2 ui-monospace,SFMono-Regular,Consolas,monospace;
}

.about-links {
  display: grid;
  gap: 7px;
}

.about-links .public-link {
  width: fit-content;
  font-size: 12px;
}

.about-link-placeholder {
  font-size: 11px;
  color: #687584;
}

.about-update-link {
  font-weight: 700;
}

.party-confirm {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.72);
}

.party-confirm-card {
  width: min(360px,100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101b29;
  text-align: center;
}

.party-confirm-card h3 {
  margin: 0 0 8px;
}

.party-confirm-card p {
  color: var(--muted);
}

.party-confirm-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.party-panel-card {
  position: relative;
}

.player-overlay:fullscreen,.player-overlay:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
}

.player-overlay:fullscreen .player-stage video,.player-overlay:-webkit-full-screen .player-stage video {
  object-fit: contain;
}

.player-overlay.video-fullscreen .player-stage {
  position: absolute;
  inset: 0;
}

.player-overlay.video-fullscreen .player-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  background: linear-gradient(to bottom,rgba(6,9,14,.96),rgba(6,9,14,.72));
}

.player-overlay.video-fullscreen .transport {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  background: linear-gradient(to top,rgba(6,9,14,.97),rgba(6,9,14,.72));
  transition: opacity .18s ease;
}

.player-overlay.video-fullscreen .player-top {
  transition: opacity .18s ease;
}

.player-overlay.video-fullscreen.ui-idle .player-top,.player-overlay.video-fullscreen.ui-idle .transport {
  opacity: 0;
  pointer-events: none;
}

.player-overlay.video-fullscreen.ui-idle {
  cursor: none;
}

.player-overlay.video-fullscreen .player-stage video {
  object-fit: contain;
}

/* Responsive and capability-specific presentation
 * Adapts the Activity to compact viewports and input capabilities without changing application semantics. */
@media (max-width:760px) {
  .main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .back-slot {
    flex-basis: 68px;
    width: 68px;
  }

  .search-wrap {
    flex: 1 1 220px;
    width: auto;
    max-width: 260px;
    min-width: 140px;
  }

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

  .grid .poster {
    height: 190px;
  }

  .detail,.detail.episode-detail {
    grid-template-columns: 1fr;
  }

  .detail>.poster {
    max-width: 220px;
  }

  .detail.episode-detail>.poster {
    max-width: 420px;
  }

  .brand small {
    display: none;
  }

  .transport {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .volume-slider {
    width: 64px;
  }

  .time {
    font-size: 11px;
  }

  .player-top {
    min-height: 44px;
  }

}

.grid .card {
  position: relative;
  outline: none;
  transform: translateZ(0);
  transition: transform .18s ease;
}

.grid .card .poster {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 2/3;
  border: 0;
  box-shadow: none;
  border-radius: 10px;
  background: #0b1725;
  transition: transform .18s ease,filter .18s ease;
}

.grid .card .poster img {
  object-fit: cover;
  transition: transform .18s ease,filter .18s ease;
}

.grid .card.episode-card .poster {
  aspect-ratio: 16/9;
}

.grid .card.library-card .poster {
  height: auto;
  aspect-ratio: 16/9;
}

.grid .card.library-card .poster img {
  object-fit: cover;
}

.search-library {
  margin: 0 0 34px;
}

.search-library-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 4px 0 14px;
}

.search-library-head h2 {
  margin: 0;
  font-size: 20px;
}

.search-library-count {
  font-size: 12px;
  color: var(--muted);
}

.search-media-group {
  margin: 0 0 26px;
}

.search-media-heading {
  margin: 0 0 10px;
  font-size: 14px;
  color: #d7e4f2;
}

.search-media-heading.hidden-heading {
  display: none;
}

.grid.search-episode-grid {
  grid-template-columns: repeat(auto-fill,minmax(260px,340px));
  gap: 22px;
}

.search-library-more {
  display: block;
  margin: 4px 0 0;
}

.poster {
  position: relative;
}

.tile-overlay {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  background: linear-gradient(to top,rgba(0,0,0,.82) 0%,rgba(0,0,0,.46) 30%,rgba(0,0,0,0) 62%);
  opacity: .78;
  transition: opacity .18s ease;
}

.grid .card:hover,.grid .card:focus-visible {
  transform: translateY(-2px);
}

.grid .card:hover .poster img,.grid .card:focus-visible .poster img {
  transform: scale(1.025);
  filter: brightness(.92);
}

.grid .card:hover .tile-overlay,.grid .card:focus-visible .tile-overlay {
  opacity: 1;
}

.party-start-modal {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #05080d;
  overflow: hidden;
  pointer-events: none;
}

.party-start-modal.is-fading-out {
  opacity: 0;
  transition: opacity 250ms ease;
}

.party-start-backdrop {
  position: absolute;
  inset: -3%;
  z-index: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(3px) saturate(.9);
  transform: scale(1.04);
  opacity: .58;
}

.party-start-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg,rgba(0,0,0,.34),rgba(0,0,0,.74));
}

.party-start-card {
  position: relative;
  z-index: 2;
}

.party-start-card {
  width: min(620px,100%);
  min-height: 390px;
  padding: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-radius: 16px;
  background: rgba(7,15,25,.68);
  border: 1px solid rgba(255,255,255,.17);
  backdrop-filter: blur(10px);
}

.party-start-media-header {
  min-height: 88px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.party-start-series {
  margin-bottom: 5px;
  color: #cbd8e7;
  font-size: 18px;
  font-weight: 700;
}

.party-start-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
  font-weight: 800;
  text-wrap: balance;
}

.party-start-status {
  margin-top: 12px;
  color: #cbd8e7;
  font-size: 18px;
  font-weight: 650;
  min-height: 25px;
}

.party-start-substatus {
  margin-top: 4px;
  min-height: 20px;
  color: #9fb0c3;
  font-size: 14px;
  font-weight: 550;
}

.party-start-participants {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  text-align: left;
}

.party-start-participants.two-column {
  grid-template-columns: repeat(2,minmax(0,1fr));
}

.party-start-participants.scrollable {
  max-height: min(42vh,420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.party-start-person {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.055);
  font-size: 13px;
}

.party-start-person .state {
  color: #cbd8e7;
  white-space: nowrap;
}

.party-start-participants.two-column .party-start-person {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.party-start-person > span:first-child {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-start-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  /* The preparation overlay itself is click-through so playback controls beneath
   * it are not globally blocked. Explicit action controls opt back into hit-testing. */
  pointer-events: auto;
}

.party-start-actions.hidden {
  display: none;
}

.party-countdown {
  font-size: 72px;
  line-height: 1;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  width: 6ch;
  align-self: center;
  text-align: center;
  margin-top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .party-start-modal.is-fading-out {
    transition-duration: 0ms;
  }
}

@media (hover:none) {
  .tile-overlay {
    opacity: .9;
  }

}

/* Diagnostics
 * Styles the sanitized runtime diagnostics surface used during troubleshooting. */
.runtime-diag-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 260;
  width: min(720px,calc(100vw - 24px));
  max-height: min(78vh,700px);
  overflow: auto;
  padding: 12px;
  background: #07111d;
  border: 1px solid #3a5573;
  border-radius: 11px;
  box-shadow: 0 18px 60px rgba(0,0,0,.76);
  font-size: 12px;
}

.runtime-diag-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  position: sticky;
  top: -12px;
  background: #07111d;
  padding: 8px 0;
  z-index: 2;
}

.runtime-diag-head strong {
  flex: 1;
}

.runtime-diag-head>div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.runtime-diag-head .btn {
  padding: 5px 8px;
  font-size: 11px;
}

.runtime-diag-mode {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #563f00;
  border: 1px solid #8b6900;
  color: #ffe29a;
  font-size: 10px;
}

.runtime-diag-health {
  padding: 7px 9px;
  background: #0d1b2d;
  border: 1px solid #20354d;
  border-radius: 8px;
  margin-bottom: 9px;
  color: #cbd8e7;
}

.runtime-diag-section {
  margin-top: 9px;
  padding: 8px;
  border: 1px solid #20354d;
  border-radius: 8px;
  background: #091523;
}

.runtime-diag-section h4 {
  margin: 0 0 6px;
  font-size: 11px;
  color: #c7d7e8;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.runtime-diag-section.runtime-diag-highlight {
  border-color: #4d88c8;
  box-shadow: 0 0 0 1px rgba(77,136,200,.25);
}

.runtime-diag-grid {
  display: grid;
  grid-template-columns: minmax(130px,auto) minmax(0,1fr);
  gap: 3px 10px;
  margin: 0;
}

.runtime-diag-grid dt {
  color: var(--muted);
}

.runtime-diag-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.runtime-diag-pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #050b13;
  border: 1px solid #20354d;
  border-radius: 8px;
  padding: 8px;
  max-height: 220px;
  overflow: auto;
  font: 11px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace;
  color: #dce9f7;
}

.runtime-diag-copy-fallback {
  position: absolute;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.icon-btn.debug-active-indicator {
  font-size: 9px !important;
  line-height: 1 !important;
  letter-spacing: .03em;
}

.topbar {
  display: grid;
  grid-template-columns: 220px minmax(0,1fr);
  gap: 0;
  padding: 0;
}

.brand {
  height: 62px;
  display: flex;
  align-items: center;
  padding: 0 18px;
}

.topnav {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  min-width: 0;
}

.back-slot {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
}

.back-arrow {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}

.topnav .search-wrap {
  flex: 0 1 420px;
  width: min(420px,42vw);
  max-width: 420px;
}

.user-menu-wrap {
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
}

.user-card {
  min-height: 44px;
  max-width: min(330px,38vw);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(var(--overlay-rgb),.58);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.user-card:hover,.user-card[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--panel2);
}

.user-avatar-shell {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.user-avatar-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-shell img.hidden+span {
  display: grid;
}

.user-avatar-fallback {
  width: 100%;
  height: 100%;
  place-items: center;
}

.user-avatar-shell img:not(.hidden)+.user-avatar-fallback {
  display: none;
}

.user-card-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-card-name {
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-party-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 235px;
  line-height: 1.25;
}

.user-chevron {
  font-size: 11px;
  color: var(--muted);
  margin-left: 2px;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 220px;
  padding: 7px;
  background: #0d1724;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 18px 48px rgba(0,0,0,.5);
}

.user-menu .menu-item {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.user-menu .menu-item:hover {
  background: var(--panel2);
}

.user-menu .menu-item.danger {
  color: #ffb5b5;
}

.credits-prompt {
  position: absolute;
  right: 18px;
  bottom: 78px;
  z-index: 9;
  width: min(360px,calc(100vw - 36px));
  padding: 13px 14px;
  background: rgba(8,17,31,.94);
  border: 1px solid #334b66;
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0,0,0,.56);
  backdrop-filter: blur(8px);
}

.credits-prompt-copy {
  font-size: 15px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.35;
  margin: 0;
}

.credits-next-detail {
  font-size: 12px;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.credits-progress {
  height: 3px;
  margin: 10px 0;
  background: #1c2b3e;
  border-radius: 999px;
  overflow: hidden;
}

.credits-progress>span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
}

.credits-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.credits-actions .btn {
  flex: 1;
  min-width: 0;
  white-space: normal;
}

.bitrate-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.bitrate-slider {
  position: relative;
  display: block;
  flex: 0 0 7px;
  width: 22px;
  height: 7px;
}

.bitrate-slider+.bitrate-slider {
  margin-top: 0;
}

.bitrate-slider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: .9;
}

.bitrate-slider::after {
  content: "";
  position: absolute;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.bitrate-slider-one::after {
  left: 4px;
}

.bitrate-slider-two::after {
  right: 4px;
}

.connection-status {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 140;
  max-width: min(390px,calc(100vw - 28px));
  padding: 8px 11px;
  border: 1px solid #8a6c2b;
  border-radius: 10px;
  background: rgba(31,24,9,.94);
  box-shadow: 0 10px 34px rgba(0,0,0,.38);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.connection-status.buffering {
  padding: 11px 14px;
  font-size: 13px;
}

.connection-status small {
  display: block;
  margin-top: 2px;
  color: #e2d5af;
  font-size: 11px;
  font-weight: 500;
}

@media (max-width:720px) {
  .topbar {
    grid-template-columns: 180px minmax(0,1fr);
  }

  .main {
    grid-template-columns: 180px 1fr;
  }

  .topnav {
    padding: 0 10px;
    gap: 8px;
  }

  .topnav .search-wrap {
    min-width: 120px;
    width: auto;
  }

  .user-card {
    max-width: 210px;
  }

  .user-party-status {
    max-width: 135px;
  }

  .player-project-cta {
    font-size: 9px;
    gap: 4px;
    right: 8px;
  }

}

.sidebar {
  position: sticky;
  top: 62px;
  height: calc(100dvh - 62px);
  align-self: start;
  overflow: hidden;
}

.sidebar-main {
  overflow: auto;
  padding-right: 2px;
}

.back-arrow {
  font-size: 26px;
  font-weight: 900;
  border-width: 2px;
  background: rgba(19,36,58,.9);
  color: #f4f8ff;
  box-shadow: 0 3px 12px rgba(0,0,0,.24);
}

.back-arrow:hover,.back-arrow:focus-visible {
  border-color: var(--accent);
  background: #183553;
  outline: none;
  box-shadow: 0 0 0 2px rgba(90,167,255,.18),0 4px 14px rgba(0,0,0,.3);
}

.search-media-heading {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.search-media-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.episode-search-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  white-space: normal;
  overflow: visible;
}

.episode-meta-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: #a9c9ec;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.episode-meta-link:hover,.episode-meta-link:focus-visible {
  color: #d9ebff;
  text-decoration: underline;
  outline: none;
}

.episode-meta-separator {
  color: #71859d;
}

/* Watch Party participant moderation + user-facing Session Stats */
.party-panel-head-actions,
.session-stats-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.party-person {
  position: relative;
}

.party-person-main {
  min-width: 0;
  flex: 1;
}

.party-person-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.party-person-menu {
  min-width: 36px;
  padding: 6px 10px;
}

.party-context-menu {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 4px);
  display: flex;
  flex-direction: column;
  min-width: 190px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  background: rgba(18, 18, 24, .98);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .35);
}

.party-context-menu .btn {
  text-align: left;
  border: 0;
  background: transparent;
}

.party-context-menu .danger {
  color: #ffb3b3;
}

.session-stats-panel,
.viewer-info-panel {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 10, .62);
  backdrop-filter: blur(8px);
}

.session-stats-panel.hidden,
.viewer-info-panel.hidden {
  display: none;
}

.session-stats-card,
.viewer-info-card {
  width: min(760px, 96vw);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  background: rgba(17, 19, 25, .98);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  padding: 18px;
}

.session-stats-panel.pinned {
  background: transparent;
  pointer-events: none;
  place-items: end end;
  padding: 18px;
}

.session-stats-panel.pinned .session-stats-card {
  width: min(420px, 92vw);
  max-height: 58vh;
  pointer-events: auto;
}

.session-stats-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.session-stats-head h2 {
  margin: 0;
}

.session-stats-body {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.session-stat-card {
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, .035);
}

.session-stat-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.session-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  font-size: .92rem;
}

.session-stat-label {
  opacity: .68;
}

.session-stat-value {
  font-variant-numeric: tabular-nums;
}

.viewer-info-card {
  width: min(520px, 96vw);
}

@media (max-width: 620px) {
  .session-stat-grid {
    grid-template-columns: 1fr;
  }

  .party-context-menu {
    right: 4px;
  }
}

/* Watch Party queue + timeline */
.queue-toggle-compact {
  position: absolute;
  z-index: 5;
  right: 8px;
  top: 8px;
  width: 36px;
  height: 36px;
  max-width: calc(100% - 16px);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 12px;
  background: rgba(9,21,35,.30);
  backdrop-filter: blur(5px);
  transition: width .16s ease,background-color .16s ease,border-color .16s ease;
}

.queue-toggle-compact:hover,
.queue-toggle-compact:focus-visible {
  width: 150px;
  background: rgba(9,21,35,.55);
}

.queue-toggle-symbol {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 23px;
  line-height: 1;
  font-weight: 900;
}

.queue-toggle-label {
  flex: 0 0 auto;
  padding-right: 10px;
  opacity: 0;
  transition: opacity .12s ease;
}

.queue-toggle-compact:hover .queue-toggle-label,
.queue-toggle-compact:focus-visible .queue-toggle-label {
  opacity: 1;
}

.queue-toggle-compact.queued {
  background: rgba(20,45,64,.34);
}

.queue-toggle-compact.queued:hover,
.queue-toggle-compact.queued:focus-visible {
  background: rgba(20,45,64,.58);
}

.queue-state-notice {
  width: fit-content;
  margin: 2px 0 12px;
  padding: 7px 10px;
  border: 1px solid rgba(174,190,209,.24);
  border-radius: 9px;
  color: #d7e4f2;
  background: rgba(13,27,45,.72);
  font-size: 12px;
}

.library-queue-card {
  position: sticky;
  top: 82px;
  z-index: 8;
  float: right;
  width: min(340px,calc(100vw - 280px));
  max-height: calc(100dvh - 104px);
  margin: 0 0 18px 18px;
  padding: 12px;
  overflow: auto;
  border: 1px solid rgba(174,190,209,.26);
  border-radius: 12px;
  background: rgba(9,21,35,.50);
  box-shadow: 0 12px 34px rgba(0,0,0,.22);
  backdrop-filter: blur(8px);
  transition: background-color .16s ease;
}

.library-queue-card:hover,
.library-queue-card:focus-within {
  background: rgba(9,21,35,.70);
}

.library-queue-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.library-queue-count {
  margin-left: 4px;
  color: var(--muted);
  font-size: 11px;
}

.library-queue-collapse {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(19,36,58,.72);
  color: var(--text);
  cursor: pointer;
}

.library-queue-card.collapsed {
  width: auto;
  min-width: 122px;
  overflow: visible;
}

.library-queue-card.collapsed .library-queue-card-head {
  margin-bottom: 0;
}

.library-queue-list {
  display: grid;
  gap: 6px;
}

.library-queue-row {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) 28px;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(19,36,58,.38);
  cursor: grab;
}

.library-queue-row.dragging {
  opacity: .45;
}

.library-queue-row.drag-before::before,
.library-queue-row.drag-after::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: #a9c9ec;
}

.library-queue-row.drag-before::before { top: -4px; }
.library-queue-row.drag-after::after { bottom: -4px; }

.library-queue-order {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.library-queue-title {
  min-width: 0;
  align-self: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
  font-size: 12px;
}

.library-queue-remove {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(174,190,209,.22);
  border-radius: 7px;
  background: rgba(9,21,35,.34);
  color: var(--text);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.library-queue-remove:hover,
.library-queue-remove:focus-visible {
  background: rgba(58,33,41,.68);
}

.library-queue-controls {
  display: grid;
  grid-template-columns: minmax(0,.72fr) minmax(0,1.28fr);
  gap: 8px;
  margin-top: 10px;
}

.library-queue-intermission,
.library-queue-skip,
.library-queue-start {
  width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.library-queue-start { grid-column: 1 / -1; }

.library-queue-status {
  min-height: 0;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 760px) {
  .library-queue-card {
    float: none;
    position: relative;
    top: auto;
    width: 100%;
    max-height: none;
    box-sizing: border-box;
    margin: 0 0 18px;
  }
}

.party-timeline-section {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.party-timeline-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.party-timeline-head h3 {
  margin: 0;
  flex: 1;
  font-size: 15px;
}

.party-timeline-list {
  display: grid;
  gap: 7px;
}

.party-timeline-row {
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(19,36,58,.48);
}

.party-timeline-row.timeline-completed {
  opacity: .72;
}

.party-timeline-row.timeline-current {
  border-color: rgba(169,201,236,.58);
  background: rgba(25,49,76,.72);
}

.party-timeline-row.draggable {
  cursor: grab;
}

.party-timeline-row.dragging {
  opacity: .5;
}

.party-timeline-row.drag-over {
  border-color: #a9c9ec;
}

.party-timeline-marker {
  text-align: center;
  color: #a9c9ec;
  font-weight: 700;
}

.party-timeline-main {
  min-width: 0;
}

.party-timeline-title {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-weight: 650;
}

.party-timeline-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.party-timeline-actions,
.party-intermission-request-actions {
  display: flex;
  gap: 6px;
}

.party-timeline-actions .btn {
  padding: 5px 7px;
  font-size: 11px;
}

.party-intermission-request {
  width: 100%;
}

.party-intermission-requests {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(174,190,209,.24);
  border-radius: 10px;
  background: rgba(19,36,58,.62);
  font-size: 12px;
}

.queue-dialog {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.72);
}

.queue-dialog-card {
  width: min(440px,100%);
  max-height: min(84dvh,720px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #101b29;
  box-shadow: 0 24px 72px rgba(0,0,0,.55);
}

.queue-dialog-card h3 {
  margin: 0 0 8px;
}

.queue-dialog-card p {
  color: var(--muted);
  line-height: 1.45;
}

.queue-dialog-label {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.queue-dialog-select,
.queue-dialog-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #091523;
  color: var(--text);
}

.queue-missing-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.queue-missing-card > p {
  flex: 0 0 auto;
}

.queue-missing-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 38dvh;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid rgba(174,190,209,.20);
  border-radius: 9px;
  background: rgba(9,21,35,.42);
}

.queue-missing-item {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.queue-dialog-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.queue-missing-actions {
  flex: 0 0 auto;
}

.queue-playback-lock-message {
  flex-basis: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.library-queue-playback-lock-note {
  grid-column: 1 / -1;
  width: 100%;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.queue-intermission-type-help {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

/* Watch Party lobby customization — Build 3
 * Lobby visuals are bounded presentation layers. The operational right rail stays
 * outside this surface and cannot be displaced by custom artwork. */
.party-lobby-main {
  position: relative;
  isolation: isolate;
}

.party-lobby-main-copy {
  position: relative;
  z-index: 4;
}

.party-lobby-artwork {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #07111f;
}

.party-lobby-artwork-layer,
.party-lobby-overlay-art,
.party-lobby-artwork-scrim {
  position: absolute;
  inset: 0;
}

.party-lobby-artwork-layer {
  z-index: 0;
  opacity: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transform: scale(1.015);
  transition: opacity .9s ease;
}

.party-lobby-artwork-layer.active {
  opacity: 1;
}

.party-lobby-overlay-art {
  z-index: 2;
  display: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.party-lobby-artwork-scrim {
  z-index: 1;
  background: linear-gradient(180deg,rgba(2,8,15,.18),rgba(2,8,15,.68));
}

.party-lobby.lobby-mode-spartan .party-lobby-main {
  background: #07111f;
}

.party-lobby.lobby-mode-spartan .party-lobby-artwork {
  display: none;
}

.party-lobby.lobby-mode-image .party-lobby-main,
.party-lobby.lobby-mode-slideshow .party-lobby-main,
.party-lobby.lobby-mode-layered .party-lobby-main {
  background: #05090f;
}

.party-lobby.lobby-mode-layered .party-lobby-overlay-art.has-art {
  display: block;
}

.party-lobby-guest-preview {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(169,201,236,.34);
  border-radius: 10px;
  background: rgba(6,17,29,.9);
  box-shadow: 0 10px 30px rgba(0,0,0,.24);
  backdrop-filter: blur(10px);
  font-size: 12px;
}

.party-lobby-guest-preview span {
  color: var(--muted);
}

.party-lobby-customizer {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0,0,0,.76);
  overflow: auto;
}

.party-lobby-customizer-card {
  width: min(960px,100%);
  max-height: min(880px,94dvh);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0b1726;
  box-shadow: 0 26px 80px rgba(0,0,0,.48);
}

.party-lobby-customizer-head,
.party-lobby-art-search-head,
.party-lobby-customizer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.party-lobby-customizer-head h2,
.party-lobby-art-search-head h3 {
  margin: 0;
}

.party-lobby-customizer-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
  margin-top: 18px;
}

.party-lobby-customizer-grid label {
  display: grid;
  gap: 6px;
  color: #dce8f5;
  font-size: 12px;
  font-weight: 700;
}

.party-lobby-customizer-grid select,
.party-lobby-customizer-grid input[type="url"] {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #081321;
  color: var(--text);
}

.party-lobby-customizer-grid .party-lobby-wide {
  grid-column: 1 / -1;
}

.party-lobby-check {
  display: flex !important;
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
}

.party-lobby-art-search-head {
  margin-top: 22px;
  align-items: end;
}

.party-lobby-art-search-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.party-lobby-art-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(150px,1fr));
  gap: 10px;
  margin-top: 12px;
}

.party-lobby-art-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(19,36,58,.5);
}

.party-lobby-art-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  background: #050b12 center/cover no-repeat;
}

.party-lobby-art-card label {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  font-size: 11px;
}

.party-lobby-art-card .meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-lobby-customizer-status {
  min-height: 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.party-lobby-customizer-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

/* Top-level party confirmations must survive lobby/panel refreshes. */
.party-confirm {
  position: fixed;
  z-index: 320;
}

/* A scrollbar must never change the usable width of timeline cards. */
.party-lobby-queue-section,
.party-lobby-queue-section .party-timeline-section,
.party-lobby-queue-section .party-timeline-list,
.party-lobby-queue-section .party-timeline-row {
  min-width: 0;
  max-width: 100%;
}

.party-lobby-queue-section .party-timeline-list {
  width: 100%;
  padding-right: 6px;
  scrollbar-gutter: auto;
}

.party-lobby-queue-section .party-timeline-row {
  width: 100%;
  height: auto;
  max-height: none;
  box-sizing: border-box;
  align-items: start;
  overflow: visible;
}

.party-lobby-queue-section .party-timeline-main,
.party-lobby-queue-section .party-timeline-meta {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: anywhere;
}

.party-lobby-queue-section .party-timeline-main {
  align-self: stretch;
  padding-bottom: 1px;
}

.party-lobby-queue-section .party-timeline-meta {
  line-height: 1.35;
}

.party-leave-note {
  flex: 1 0 100%;
  margin: 0;
}

@media (max-width: 700px) {
  .party-lobby-customizer-grid {
    grid-template-columns: 1fr;
  }
  .party-lobby-customizer-grid .party-lobby-wide {
    grid-column: auto;
  }
  .party-lobby-guest-preview {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Build 3 artwork picker cards. */
.party-lobby-art-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  background: #050b12 center/cover no-repeat;
}

.party-lobby-art-card-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}

.party-lobby-art-card > input[type="checkbox"] {
  justify-self: start;
}

/* Build 8A — one undimmed floating/docked Watch Party surface. The Lobby has
 * its own visible rail, so a second panel is suspended there. */
:root {
  --party-rail-width: clamp(340px, 30vw, 430px);
}
.party-panel {
  background: transparent;
  pointer-events: none;
}
.party-panel-card {
  width: min(var(--party-rail-width), 100%);
  min-width: 0;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#partyPanelBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.party-panel.presentation-suspended {
  display: none !important;
}
body.party-rail-pinned #appView:not(.hidden) {
  width: calc(100% - var(--party-rail-width));
}
body.party-rail-pinned #player:not(.hidden):not(.video-fullscreen) {
  right: var(--party-rail-width);
  width: calc(100vw - var(--party-rail-width));
}
.party-panel.pinned .party-panel-card {
  box-shadow: none;
  transition: opacity .2s ease;
}
.party-panel.pinned:not(:hover):not(:focus-within) .party-panel-card {
  opacity: .2;
}
.party-panel.pinned:hover .party-panel-card,
.party-panel.pinned:focus-within .party-panel-card {
  opacity: 1;
}
.party-person-info {
  appearance: none;
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.party-person-info:hover,
.party-person-info:focus-visible {
  text-decoration: underline;
  color: #c7e3ff;
}
/* Do not make the playback experience a dimmed modal. These surfaces float
 * above video, stay readable and leave the rest of the interface interactive. */
.session-stats-panel,
.viewer-info-panel {
  inset: auto;
  display: block;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  z-index: 195;
}
.session-stats-panel {
  right: 18px;
  bottom: var(--stats-playback-bottom, 18px);
  width: min(420px, calc(100vw - 24px));
}
.session-stats-card,
.viewer-info-card {
  width: 100%;
  max-height: min(65dvh, 660px);
  pointer-events: auto;
  padding: 14px;
  background: rgba(13, 27, 45, .96);
  backdrop-filter: blur(9px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
}
.session-stats-panel.pinned {
  inset: auto;
  right: 18px;
  bottom: var(--stats-playback-bottom, 18px);
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  display: block;
}
.session-stats-panel.pinned .session-stats-card {
  width: 100%;
  max-height: min(65dvh, 660px);
}
.session-stats-panel.embedded,
.session-stats-panel.pinned.embedded {
  position: relative;
  right: auto;
  bottom: auto;
  left: auto;
  top: auto;
  width: 100%;
  height: 25%;
  min-height: 120px;
  max-height: 25%;
  flex: 0 0 25%;
  padding: 0;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
.session-stats-panel.embedded .session-stats-card {
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  border: 0;
  padding: 10px 0 0;
  box-shadow: none;
}
.viewer-info-panel {
  position: fixed;
  z-index: 210;
  left: 12px;
  top: 12px;
  width: min(380px, calc(100vw - 24px));
}
.viewer-info-card {
  max-height: min(60dvh, 510px);
}
#player .session-stats-panel {
  z-index: 40;
}
#player .viewer-info-panel {
  z-index: 45;
}
@media (max-width: 740px) {
  :root {
    --party-rail-width: min(340px, 64vw);
  }
  /* A permanent rail must not leave a sliver of usable player in a compact
   * Discord Activity viewport. Keep the pinned panel accessible as an overlay. */
  body.party-rail-pinned #appView:not(.hidden) {
    width: 100%;
  }
  body.party-rail-pinned #player:not(.hidden):not(.video-fullscreen) {
    width: 100vw;
    right: 0;
  }
  .party-panel.pinned .party-panel-card,
  .party-panel:not(.pinned) .party-panel-card {
    width: min(430px, 90vw);
  }
  .session-stats-panel,
  .session-stats-panel.pinned {
    right: 12px;
  }
  .session-stats-panel.embedded {
    right: auto;
    bottom: auto;
  }
}
@media (max-width: 540px) {
  .party-panel-head-actions {
    gap: 4px;
  }
  .party-panel-head-actions .btn {
    padding: 6px;
    font-size: 12px;
  }
}

/* Build 8B: library actions, Home sections and account Settings. */
.heading {
  flex-wrap: wrap;
}
.library-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: 0;
}
.library-actions .btn {
  white-space: nowrap;
  font-size: 12px;
}
.settings-groups {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.settings-groups section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.settings-groups h3 {
  margin: 0 0 5px;
  font-size: 14px;
}
.settings-groups p {
  color: var(--muted);
  margin: 0;
  font-size: 12px;
}
.library-queue-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  max-height: 3.9em;
}
.library-queue-row {
  height: auto;
  align-items: center;
}
.library-home-row {
  margin: 20px 0 6px;
}
.library-home-row h2 {
  margin: 0 0 10px;
  font-size: 18px;
}
.library-home-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: thin;
}
.library-home-track .card {
  min-width: 126px;
  max-width: 166px;
  flex: 0 0 150px;
}
.home-backdrop-title {
  position: absolute;
  bottom: 14px;
  right: 20px;
  z-index: 3;
  padding: 4px 0;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  text-shadow: 0 1px 7px #000;
  font-size: 13px;
  opacity: .86;
}
.home-backdrop-title:hover {
  opacity: 1;
  text-decoration: underline;
}
.library-home-track .home-row-card {
  width: 150px;
  min-width: 150px;
}
.library-home-track .home-row-card .poster {
  width: 100%;
}
.home-progress {
  height: 4px;
  width: 100%;
  border-radius: 4px;
  background: rgba(255,255,255,.22);
  overflow: hidden;
}
.home-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.party-timeline-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.party-timeline-main {
  min-width: 0;
}
@media (max-width: 720px) {
  .library-actions {
    width: 100%;
    margin-left: 0;
  }
  .library-actions .btn {
    flex: 1;
  }
}

/* 8B follow-up: independent Home-row preferences, nav reflow, and library controls. */
.shell.nav-collapsed .main {
  grid-template-columns: minmax(0,1fr);
}
.shell.nav-collapsed .sidebar {
  display: none;
}
.compact-library-nav-wrap {
  flex: 0 1 170px;
  min-width: 105px;
}
.compact-library-nav-wrap select {
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.settings-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  cursor: pointer;
}
.settings-toggle + .settings-toggle {
  border-top: 1px solid var(--line);
}
.settings-toggle span {
  display: grid;
  gap: 4px;
}
.settings-toggle strong {
  font-size: 13px;
}
.settings-toggle small {
  font-size: 12px;
  color: var(--muted);
}
.settings-toggle input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.library-actions {
  position: relative;
}
.library-refresh-trigger {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 7px;
}
.library-refresh-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 25;
  width: min(278px,80vw);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
}
.library-refresh-menu button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 11px;
  text-align: left;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}
.library-refresh-menu button:hover,.library-refresh-menu button:focus-visible {
  background: rgba(140,170,205,.18);
  outline: 1px solid var(--accent);
}
.library-refresh-menu button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.library-refresh-menu strong {
  font-size: 13px;
}
.library-refresh-menu small {
  font-size: 11px;
  color: var(--muted);
}
.library-refresh-menu.hidden {
  display: none;
}
.library-home-track .card {
  position: relative;
  outline: none;
  transform: translateZ(0);
  transition: transform .18s ease;
}
.library-home-track .card .poster {
  position: relative;
  width: 100%;
  height: auto;
  border: 0;
  box-shadow: none;
  border-radius: 10px;
  background: #0b1725;
  transition: transform .18s ease,filter .18s ease;
}
.library-home-track .card.home-series-card {
  flex-basis: 260px;
  width: 260px;
  min-width: 260px;
  max-width: 300px;
}
.library-home-track .card.home-series-card .poster {
  aspect-ratio: 16/9;
}
.library-home-track .card:hover,.library-home-track .card:focus-visible {
  transform: translateY(-2px);
}
.library-home-track .card:hover .poster img,.library-home-track .card:focus-visible .poster img {
  transform: scale(1.025);
  filter: brightness(.92);
}
.library-home-track .card:hover .tile-overlay,.library-home-track .card:focus-visible .tile-overlay {
  opacity: 1;
}
.library-home-track .card-title {
  overflow-wrap: anywhere;
}
.library-home-track .episode-search-meta {
  display: flex;
  flex-wrap: wrap;
  white-space: normal;
  overflow: visible;
  gap: 5px;
}
@media (max-width: 720px) {
.library-actions {
  width: auto;
  margin-left: 0;
}
.library-actions .library-refresh-trigger {
  flex: 0 0 auto;
}
.shell.nav-collapsed .grid.library-grid {
  grid-template-columns: repeat(auto-fill,minmax(min(100%,220px),1fr));
}
.compact-library-nav-wrap {
  flex-basis: 120px;
}
.library-home-track .card.home-series-card {
  flex-basis: 220px;
  min-width: 220px;
}
}
@media (max-width: 760px) {
  .shell.nav-collapsed .topbar {
    grid-template-columns: minmax(0,1fr);
  }
  .shell.nav-collapsed .brand {
    display: none;
  }
  .shell.nav-collapsed .topnav .search-wrap {
    flex: 1 1 140px;
    min-width: 100px;
    width: auto;
  }
  .shell.nav-collapsed .user-card-copy {
    display: none;
  }
  .shell.nav-collapsed .user-card {
    min-width: 0;
    padding: 6px;
  }
}

/* Build 8C: responsive, icon-led navigation and connected party identity. */
.topnav .back-slot:has(.back-arrow.hidden) {
  visibility: hidden;
}
.topnav-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 8px;
  flex: 0 0 44px;
}
.topnav-icon svg,
.popcorn-shortcut .popcorn-symbol {
  width: 24px;
  height: 24px;
}
.topnav .search-wrap {
  flex: 0 1 420px;
  width: min(420px,38vw);
  min-width: min(120px,26vw);
}
.topnav .search-wrap.hidden {
  display: none;
}
.topnav .compact-library-nav-wrap {
  flex: 0 1 170px;
}
.user-control-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.user-card-wrap {
  position: relative;
  min-width: 0;
}
.popcorn-shortcut {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 5px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: 12px;
  background: rgba(var(--overlay-rgb),.58);
}
.popcorn-shortcut .popcorn-symbol {
  display: block;
}
.popcorn-pop {
  position: absolute;
  top: 2px;
  left: 10px;
  color: #ffe39a;
  opacity: 0;
  pointer-events: none;
}
.popcorn-pop-two {
  left: 26px;
  animation-delay: 1.15s !important;
}
.user-control-shell.party-active {
  gap: 0;
  border: 1px solid rgba(238,190,94,.65);
  border-radius: 12px;
  background: rgba(var(--overlay-rgb),.7);
  box-shadow: 0 0 15px rgba(244,183,73,.22);
}
.party-active .popcorn-shortcut {
  align-self: stretch;
  height: auto;
  min-height: 44px;
  color: #ffdb83;
  border: 0;
  border-radius: 11px 0 0 11px;
  background: rgba(113,72,22,.3);
  box-shadow: inset 0 0 13px rgba(242,181,60,.14);
}
.party-active .popcorn-pop {
  animation: popcorn-pop-up 2.6s ease-out infinite;
}
.party-active .user-card {
  border: 0;
  border-left: 1px solid rgba(238,190,94,.25);
  border-radius: 0 11px 11px 0;
  min-height: 54px;
  padding-bottom: 18px;
  padding-top: 5px;
}
.party-active .user-party-status {
  position: absolute;
  left: 46px;
  bottom: 3px;
  width: calc(100% - 65px);
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  color: #f2d49c;
  font: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}
.user-party-status:hover,.user-party-status:focus-visible {
  color: #fff4cf;
  text-decoration: underline;
}
@keyframes popcorn-pop-up {
  0%,56%,100% {
    opacity: 0;
    transform: translateY(2px) scale(.7);
  }
  65% {
    opacity: 1;
    transform: translateY(-6px) scale(1);
  }
  78% {
    opacity: .75;
    transform: translateY(-13px) rotate(14deg);
  }
  94% {
    opacity: 0;
    transform: translateY(-19px) scale(.7);
  }
}
.home-favorites-shortcut {
  display: block;
  margin: 8px 0 16px;
}
/* Keep visual accents on navigational controls, never error/danger state. */
.shell.app-backdrop-active .topbar {
  backdrop-filter: blur(8px);
}
.shell.app-backdrop-active .sidebar {
  backdrop-filter: blur(7px);
}
.shell.app-backdrop-active .content.home-backdrop-mode,
.shell.app-backdrop-active .content.browse-backdrop-mode {
  backdrop-filter: blur(2px);
  background-image: linear-gradient(to bottom,rgba(var(--overlay-rgb),.62),rgba(var(--overlay-rgb),.20) 65%,rgba(var(--overlay-rgb),.12)) !important;
}
.shell.app-backdrop-active .back-arrow:hover,
.shell.app-backdrop-active .back-arrow:focus-visible,
.shell.app-backdrop-active .topnav-icon:focus-visible,
.shell.app-backdrop-active .popcorn-shortcut:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.shell.app-backdrop-active .subtitle-option:hover,
.shell.app-backdrop-active .subtitle-option.active {
  background: var(--panel2);
  border-color: var(--accent-border);
}
@media (max-width: 900px) {
  .topnav {
    gap: 7px;
    padding: 0 9px;
  }
  .topnav .compact-library-nav-wrap { flex-basis: 125px; }
  .user-card { max-width: min(250px,34vw); }
  .party-active .user-card { min-width: 140px; }
}
@media (max-width: 680px) {
  .topbar { grid-template-columns: minmax(0,1fr); }
  .topbar .brand { display: none; }
  .topnav .search-wrap:not(.hidden) {
    flex: 1 1 120px;
    width: auto;
    min-width: 90px;
  }
  .topnav .compact-library-nav-wrap {
    flex-basis: 100px;
    min-width: 80px;
  }
  .topnav-icon {
    flex-basis: 34px;
    width: 34px;
  }
  .user-control-shell.party-active .user-card-copy { display: flex; }
  .party-active .user-card {
    min-width: 100px;
    max-width: 195px;
  }
  .user-card-name { max-width: 128px; }
  .party-active .user-party-status {
    width: calc(100% - 48px);
    left: 43px;
    font-size: 10px;
  }
  .user-chevron { display: none; }
}
@media (max-width: 480px) {
  .topnav .compact-library-nav-wrap:not(.hidden) { max-width: 100px; }
  .topnav:has(.search-wrap:not(.hidden)) .compact-library-nav-wrap { display: none; }
  .topnav:has(.search-wrap:not(.hidden)) .user-card-copy { display: none; }
  .party-active .user-card {
    min-width: 38px;
    padding-bottom: 5px;
  }
  .party-active .user-party-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .party-active .user-card-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .party-active .popcorn-pop {
    animation: none;
    opacity: 0;
  }
  .user-control-shell.party-active { box-shadow: 0 0 0 1px rgba(238,190,94,.6); }
  .app-backdrop-layer { transition-duration: .01ms; }
}

/* Build 8C follow-up: stable navigation geometry and uncompressed user identity. */
.topbar {
  height: auto;
  min-height: 72px;
}
.brand {
  height: auto;
  min-height: 72px;
}
.topnav {
  height: auto;
  min-height: 72px;
  padding-block: 8px;
}
.sidebar {
  top: 72px;
  height: calc(100dvh - 72px);
}
.user-control-shell:not(.party-active) .user-card {
  min-height: 44px;
  padding: 5px 9px 5px 6px;
}
.user-control-shell.party-active .user-card {
  min-height: 58px;
  min-width: 175px;
  padding: 6px 10px 19px 8px;
}
.user-control-shell.party-active .user-card-wrap {
  min-width: 175px;
}
.user-control-shell.party-active .user-card-copy {
  display: flex;
}
.topnav .back-slot {
  display: block;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
}
.topnav .back-slot:has(.back-arrow.hidden) {
  visibility: hidden;
  display: block;
}
.back-arrow.topnav-icon {
  font-size: inherit;
  font-weight: inherit;
  border-width: 1px;
  box-shadow: none;
  background: var(--panel2);
  color: var(--text);
}
.back-arrow.topnav-icon:hover,
.shell.app-backdrop-active .back-arrow.topnav-icon:hover {
  border-color: var(--accent);
  background: var(--panel2);
  outline: none;
  box-shadow: none;
}
.back-arrow.topnav-icon:focus-visible,
.shell.app-backdrop-active .back-arrow.topnav-icon:focus-visible {
  border-color: var(--accent);
  background: var(--panel2);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: none;
}
.detail-subtitle-select {
  width: min(100%, 360px);
  min-width: 0;
  background: var(--panel2);
  color: var(--text);
  border-color: var(--line);
}
.detail-subtitle-select:hover {
  border-color: var(--accent-border);
}
.detail-subtitle-select:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.detail-subtitle-select option {
  background: var(--panel2);
  color: var(--text);
}
.library-queue-controls {
  grid-template-columns: minmax(50px, .6fr) minmax(104px, 1.4fr);
}
.library-queue-intermission {
  min-width: 104px;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
}
.library-queue-skip {
  min-width: 0;
  overflow-wrap: normal;
}
.heading .library-actions {
  margin-left: 0;
  flex: 0 0 auto;
}
.heading .status-pill {
  margin-left: auto;
}
.library-refresh-menu {
  left: 0;
  right: auto;
}
.library-scan-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  width: min(180px, 35vw);
  font-size: 11px;
  color: var(--text);
}
.library-scan-progress.hidden {
  display: none;
}
.library-scan-percent {
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  font-weight: 700;
}
.library-scan-track {
  flex: 0 0 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--line);
}
.library-scan-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform .25s ease;
}
.library-scan-progress.indeterminate .library-scan-track span {
  width: 35%;
  transform: none;
  animation: library-scan-indeterminate 1.5s ease-in-out infinite alternate;
}
@keyframes library-scan-indeterminate {
  from { margin-left: 0; }
  to { margin-left: 65%; }
}
@media (prefers-reduced-motion: reduce) {
  .library-scan-progress.indeterminate .library-scan-track span {
    animation: none;
    width: 100%;
    opacity: .5;
  }
}
@media (max-width: 680px) {
  .topnav { flex-wrap: nowrap; }
  .user-control-shell.party-active .user-card {
    min-width: 105px;
    max-width: 195px;
  }
  .user-control-shell.party-active .user-card-wrap { min-width: 105px; }
  .library-scan-progress { width: min(150px, 42vw); }
}

/* Library heading counters stay with the active media-library title. */
.heading.media-library-heading .status-pill {
  margin-left: 0;
}

/* The compact Watch Party entry is anchored to the popcorn shortcut. */
.user-control-shell {
  position: relative;
}
.watch-party-quick-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 65;
  display: grid;
  gap: 11px;
  width: min(252px, calc(100vw - 20px));
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d1724;
  box-shadow: 0 18px 48px rgba(0,0,0,.5);
}
.watch-party-quick-menu strong {
  font-size: 15px;
}
.watch-party-quick-menu p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.watch-party-quick-menu .btn {
  width: 100%;
}
.watch-party-quick-status {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: break-word;
}
.watch-party-quick-status:empty {
  display: none;
}

/* Let the merged identity grow to contain its full second line. */
.user-control-shell.party-active .user-card-wrap {
  display: flex;
  flex-direction: column;
  min-width: 186px;
  max-width: min(310px, calc(100vw - 110px));
}
.user-control-shell.party-active .user-card {
  min-width: 0;
  width: 100%;
  max-width: none;
  min-height: 44px;
  padding: 5px 10px 3px 8px;
  border-radius: 0 11px 0 0;
}
.user-control-shell.party-active .user-party-status {
  position: static;
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  padding: 0 10px 8px;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  text-overflow: clip;
  line-height: 1.35;
  font-size: 12px;
}
.user-control-shell.party-active .user-card-name {
  display: block;
  max-width: min(240px, 44vw);
}
.party-active .popcorn-pop {
  animation-duration: 7.2s;
}
.popcorn-pop-two {
  animation-delay: 3.8s !important;
}

/* Intermission keeps two readable words while Skip yields space, never the gap. */
.library-queue-controls {
  grid-template-columns: minmax(112px, 1.35fr) minmax(48px, .65fr);
  gap: 12px;
}
.library-queue-intermission {
  min-width: 112px;
  overflow-wrap: normal;
  word-break: keep-all;
  white-space: normal;
}
.library-queue-skip {
  min-width: 48px;
}

/* Favorites uses the same landscape library-card frame and actual user artwork. */
.favorites-library-card .favorites-artwork {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 2px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  grid-template-columns: repeat(2,minmax(0,1fr));
  grid-template-rows: repeat(2,minmax(0,1fr));
}
.favorites-library-card .favorites-artwork-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.favorites-library-card .favorites-artwork-2 {
  grid-template-columns: repeat(2,minmax(0,1fr));
  grid-template-rows: 1fr;
}
.favorites-library-card .favorites-artwork-3 img:first-child {
  grid-row: 1 / 3;
}
.favorites-library-card .favorites-artwork img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
}
.favorites-artwork-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #e7a6b5;
  font-size: 52px;
  background: linear-gradient(145deg,#2c2445,#0c1726);
}
.favorites-library-label {
  position: absolute;
  z-index: 2;
  bottom: 12px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 16px;
  font-weight: 750;
  text-shadow: 0 2px 5px rgba(0,0,0,.9);
  pointer-events: none;
}
.favorites-library-label span {
  color: #f1a4b6;
}
@media (max-width: 480px) {
  .topnav:has(.party-active) {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  .topnav:has(.party-active) .user-menu-wrap {
    margin-left: auto;
  }
  .topnav:has(.search-wrap:not(.hidden)) .party-active .user-card-copy {
    display: flex;
  }
  .user-control-shell.party-active .user-card-wrap {
    min-width: 176px;
    max-width: calc(100vw - 90px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .party-active .popcorn-pop {
    animation: none;
    opacity: 0;
  }
}

/* Build 8D: viewport isolation and responsive playback controls. */
html.playback-viewport-active,body.playback-viewport-active {
  overscroll-behavior: none;
}
.player-overlay {
  isolation: isolate;
  min-width: 0;
  container-type: inline-size;
  container-name: mnpc-player;
}
.player-top .title,.player-top #playMethod {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-top #playMethod {
  max-width: min(28vw, 220px);
  white-space: nowrap;
}
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@container mnpc-player (max-width: 840px) {
  .transport {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px max(25px,calc(env(safe-area-inset-bottom) + 17px));
  }
  .transport-primary,.transport-secondary {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: 7px;
  }
  .transport-primary .seek {
    flex: 1 1 60px;
    min-width: 36px;
  }
  .transport-primary .volume-control {
    flex: 0 1 auto;
    min-width: 0;
  }
  .transport-primary .volume-slider {
    width: clamp(40px, 9vw, 72px);
    min-width: 40px;
  }
  .transport-secondary {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .transport-secondary .transport-spacer {
    display: none;
  }
  .transport-primary .icon-btn,.transport-secondary .icon-btn {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
  }
  .transport .player-project-cta {
    bottom: max(3px,env(safe-area-inset-bottom));
  }
  .player-top {
    gap: 7px;
    padding: 6px 9px;
  }
  .player-top .btn {
    flex: 0 0 auto;
    padding: 7px 9px;
  }
}
@container mnpc-player (max-width: 540px) {
  .transport-primary .volume-control {
    margin-left: auto;
  }
  .transport-primary {
    flex-wrap: wrap;
  }
  .transport-primary .volume-slider {
    width: 40px;
    min-width: 40px;
  }
  .transport-primary .time {
    font-size: 11px;
  }
  .transport-secondary {
    gap: 6px;
  }
  .player-top {
    flex-wrap: wrap;
  }
  .player-top .title {
    flex: 1 1 72px;
  }
  .player-top #playMethod {
    max-width: 100%;
  }
}
@media (max-height: 410px) {
  .player-top {
    min-height: 38px;
    padding-block: 3px;
  }
  .transport {
    padding-top: 4px;
    padding-bottom: max(19px,calc(env(safe-area-inset-bottom) + 11px));
  }
  .player-project-cta-question {
    display: none;
  }
}

/* Host invitation controls stay within the trusted full party panel and Lobby. */
.party-guest-invite {
  display: grid;
  gap: 9px;
  margin: 13px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.party-guest-invite p {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}
.party-guest-invite-code {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.party-guest-invite-code input {
  flex: 1 1 160px;
  width: 100%;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}
.party-guest-invite-code button {
  flex: 0 1 auto;
}

/* Auth and guest admission status messages use accessible semantic tones. */
#authStatus,
.guest-invitation-status {
  min-height: 24px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  overflow-wrap: anywhere;
}
.guest-invitation-status {
  margin-top: 10px;
  font-size: 12px;
}
.guest-invitation-status:empty {
  display: none;
}
.status-success {
  color: #d6f8dc;
  background: rgba(55, 122, 72, .22);
  border-color: rgba(144, 220, 158, .34) !important;
}
.status-warning {
  color: #fff0ba;
  background: rgba(137, 105, 34, .22);
  border-color: rgba(239, 205, 112, .34) !important;
}
.status-error {
  color: #ffd0d0;
  background: rgba(142, 52, 58, .24);
  border-color: rgba(240, 132, 139, .36) !important;
}

.settings-select {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.settings-select span {
  display: grid;
  gap: 4px;
}
.settings-select strong {
  font-size: 13px;
}
.settings-select small {
  font-size: 12px;
  color: var(--muted);
}
.settings-select select {
  flex: 0 0 auto;
  min-width: 148px;
  padding: 8px 9px;
  color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* Optional bottom navigation reuses the one authoritative nav set.
 * The dock matches the top navigation height. Search/dropdown surfaces open
 * upward so the centered icon row and Home artwork never reflow. */
.shell.nav-bar-bottom {
  padding-bottom: 72px;
}
.shell.nav-bar-bottom .topbar {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  display: block;
  width: auto;
  height: 72px;
  min-height: 72px;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.shell.nav-bar-bottom .brand {
  display: none;
}
.shell.nav-bar-bottom .topnav {
  position: relative;
  width: 100%;
  height: 72px;
  min-height: 72px;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
}
.shell.nav-bar-bottom .topnav .user-menu-wrap {
  margin-left: 0;
}
.shell.nav-bar-bottom .topnav .search-wrap {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 83;
  width: min(520px, calc(100vw - 32px));
  max-width: 520px;
  min-width: 0;
  transform: translateX(-50%);
  flex: none;
}
.shell.nav-bar-bottom .topnav .compact-library-nav-wrap {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 8px);
  z-index: 82;
  width: min(170px, 24vw);
  min-width: 105px;
  flex: none;
}
.shell.nav-bar-bottom .topnav:has(.search-wrap:not(.hidden)) .compact-library-nav-wrap {
  visibility: hidden;
}
.shell.nav-bar-bottom .user-menu,
.shell.nav-bar-bottom .watch-party-quick-menu {
  top: auto;
  bottom: calc(100% + 8px);
}
.shell.nav-bar-bottom .main {
  min-height: 0;
}
.shell.nav-bar-bottom .sidebar {
  top: 0;
  height: calc(100dvh - 72px);
}
.shell.nav-bar-bottom .content.detail-mode,
.shell.nav-bar-bottom .content.browse-backdrop-mode,
.shell.nav-bar-bottom .content.home-backdrop-mode,
.shell.nav-bar-bottom .content.library-home-mode {
  min-height: 0;
}
/* Home bottom positioning belongs to navigation state, not async backdrop state.
 * display:contents lets the existing heading and Home sections share one flex
 * ordering context without changing top-nav DOM or accessibility. */
.shell.nav-bar-bottom .content.library-home-mode {
  display: flex;
  flex-direction: column;
}
.shell.nav-bar-bottom .content.library-home-mode #content {
  display: contents;
}
.shell.nav-bar-bottom .content.library-home-mode > .heading {
  order: 90;
  margin-top: auto;
  margin-bottom: 12px;
}
.shell.nav-bar-bottom .content.library-home-mode #content > .grid.library-grid {
  order: 100;
  margin-top: 0;
}
body.party-rail-pinned .shell.nav-bar-bottom .topbar {
  right: var(--party-rail-width);
}
@media (max-width: 740px) {
  body.party-rail-pinned .shell.nav-bar-bottom .topbar {
    right: 0;
  }
}
@media (max-width: 620px) {
  .shell.nav-bar-bottom .topnav {
    gap: 4px;
    padding-right: 8px;
    padding-left: 8px;
  }
  .shell.nav-bar-bottom .topnav .compact-library-nav-wrap {
    left: 8px;
    width: 108px;
    min-width: 88px;
  }
  .shell.nav-bar-bottom .topnav .search-wrap {
    width: calc(100vw - 16px);
  }
}
}


/* Queue Timeline and compact party controls follow the same hierarchy in the
 * Lobby and floating Party panel: list, full-width play, then equal-height
 * secondary actions. */
.party-queue-controls {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}
.party-queue-controls > .party-play-queue {
  width: 100%;
  min-height: 44px;
}
.party-queue-secondary-controls {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
}
.party-queue-secondary-controls .btn,
.party-add-intermission {
  min-height: 44px;
  width: 100%;
  min-width: 0;
  white-space: normal;
}
.party-section-toggle {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.party-section-toggle:hover {
  color: #c7e3ff;
}
.party-section-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 5px;
}
.party-section-toggle-indicator {
  color: var(--muted);
  font-size: 16px;
}
.party-collapsible-section {
  margin: 12px 0;
}
.party-collapsible-section .party-list {
  margin: 8px 0 0;
}
.party-current-playback-time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: #dbeaff;
}

/* Playback uses the same lightweight Watch Party starter as the popcorn icon.
 * It is an anchored popover, never a dimming modal. */
.player-party-quick-wrap {
  position: relative;
}
.player-party-quick-wrap .player-watch-party-quick-menu {
  top: calc(100% + 8px);
  right: 0;
  bottom: auto;
  z-index: 230;
}
.player-party-quick-wrap .watch-party-quick-menu {
  pointer-events: auto;
}

/* The Lobby itself never owns a second page scrollbar; its rail owns overflow. */
.party-lobby {
  overflow: hidden;
}
.party-lobby-rail {
  overscroll-behavior: contain;
}
