:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #111115;
  --surface: #18181c;
  --surface-hover: #222228;
  --surface-active: #2a2a32;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #ff2d55;
  --accent-hover: #ff3b68;
  --accent-active: #e02449;
  --accent-subtle: rgba(255, 45, 85, 0.12);
  --accent-glow: rgba(255, 45, 85, 0.25);
  --accent-border: rgba(255, 45, 85, 0.35);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --blur-panel: saturate(180%) blur(24px);
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--font-system);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

::selection {
  background: rgba(255, 45, 85, 0.35);
  color: #ffffff;
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, rgba(255, 45, 85, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-system);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select {
  font: inherit;
}

button, a, input, select {
  outline-offset: 4px;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--accent-subtle), 0 0 16px var(--accent-glow);
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button:disabled {
  cursor: wait;
  opacity: .5;
}

button svg, a svg {
  pointer-events: none;
}

input, select {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

input:hover, select:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

input:focus, select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

input::placeholder {
  color: var(--faint);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

label > input, label > select {
  display: block;
  width: 100%;
  margin-top: 8px;
}

select {
  max-width: 100%;
  cursor: pointer;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1, h2, h3 {
  font-weight: 600;
}

h1 {
  letter-spacing: -1.4px;
}

h2 {
  letter-spacing: -.6px;
}

p {
  line-height: 1.65;
}

svg {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  vertical-align: middle;
}

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
}

.wordmark {
  display: inline-block;
  font-size: 46px;
  line-height: 1;
  letter-spacing: -3.5px;
  font-weight: 700;
  color: var(--text);
}

.wordmark span, .mobile-wordmark span {
  color: var(--accent);
  font-size: 26px;
  letter-spacing: -1px;
  margin-left: 2px;
  text-shadow: 0 0 16px var(--accent-glow);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 10px;
  padding: 10px 18px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  border: 1px solid var(--line);
  transition: background .18s cubic-bezier(0.16, 1, 0.3, 1), transform .18s cubic-bezier(0.16, 1, 0.3, 1), border-color .18s, box-shadow .18s;
  white-space: nowrap;
}

.button:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.button:active {
  transform: scale(.98);
}

.button.primary {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid transparent;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(255, 45, 85, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.button.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 22px rgba(255, 45, 85, 0.5);
  transform: translateY(-1px);
}

.button.primary:active {
  background: var(--accent-active);
  transform: scale(.98);
  box-shadow: 0 2px 8px rgba(255, 45, 85, 0.3);
}

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

.button.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-color: var(--line-strong);
}

.button.small {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 8px;
}

.button svg {
  width: 17px;
  height: 17px;
}

.wide {
  width: 100%;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 9px;
  color: var(--muted);
  transition: color .18s, background .18s, transform .18s;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.icon-button:active {
  transform: scale(.95);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  background: rgba(14, 14, 18, 0.85);
  backdrop-filter: var(--blur-panel);
  -webkit-backdrop-filter: var(--blur-panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 36px 16px 18px;
  z-index: 10;
}

.sidebar > .wordmark {
  margin: 0 16px 44px;
}

.nav-section-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--faint);
  padding: 24px 14px 10px;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 450;
  color: var(--muted);
  padding: 11px 14px;
  border-radius: 10px;
  min-height: 42px;
  margin-bottom: 3px;
  position: relative;
  transition: background .15s, color .15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-item.active {
  background: rgba(255, 45, 85, 0.12);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 45, 85, 0.25);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: .8;
  transition: color .15s, opacity .15s;
}

.nav-item.active svg {
  color: var(--accent);
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(255, 45, 85, 0.4));
}

.nav-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
}

.nav-item.active .nav-count {
  color: rgba(255, 45, 85, 0.85);
  font-weight: 600;
}

.sidebar-add {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  padding: 11px 14px;
  font-size: 12px;
  margin-top: 5px;
  text-align: left;
  border-radius: 10px;
  transition: color .15s, background .15s;
}

.sidebar-add:hover {
  color: var(--accent);
  background: rgba(255, 45, 85, 0.08);
}

.plus {
  font-size: 20px;
  font-weight: 300;
  line-height: 16px;
  color: var(--accent);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 24px;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 18px;
  color: var(--faint);
  font-size: 11px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #30d158;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px rgba(48, 209, 88, 0.6);
}

.account-button {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding: 18px 4px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  transition: color .15s;
}

.account-button:hover {
  color: var(--text);
}

.account-button > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-button svg {
  width: 13px;
  margin-left: auto;
}

.avatar {
  height: 28px;
  width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.2), rgba(255, 45, 85, 0.05));
  border: 1px solid rgba(255, 45, 85, 0.3);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.main-area {
  margin-left: 220px;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  height: 80px;
  padding: 0 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: var(--blur-panel);
  -webkit-backdrop-filter: var(--blur-panel);
  position: sticky;
  top: 0;
  z-index: 9;
}

.breadcrumb {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .2px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  position: relative;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 12px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.search-field:focus-within {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  color: var(--text);
}

.search-field svg {
  width: 16px;
  height: 16px;
}

.search-field input {
  background: transparent;
  border: none;
  width: 200px;
  padding: 8px 20px 8px 0;
  margin: 0;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.search-field kbd {
  position: absolute;
  right: 8px;
  font: 10px inherit;
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.04);
}

#upload-button {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
}

#upload-button:hover {
  background: rgba(255, 45, 85, 0.15);
  border-color: rgba(255, 45, 85, 0.35);
  color: #ffffff;
}

#content {
  padding: 40px 44px 42px;
  max-width: 1800px;
  margin: 0 auto;
  min-height: calc(100vh - 150px);
  outline: none;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 35px;
}

.page-heading .eyebrow {
  margin-bottom: 12px;
}

.page-heading h1 {
  font-size: 34px;
  margin: 0 0 8px;
  letter-spacing: -1.2px;
  font-weight: 650;
}

.page-heading p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-select {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: border-color .15s;
}

.sort-select:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.main-footer {
  border-top: 1px solid var(--line);
  margin: 0 44px;
  padding: 24px 0 28px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--faint);
}

.empty-feature {
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: radial-gradient(ellipse at 30% 60%, rgba(255, 45, 85, 0.08), transparent 60%), var(--surface);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  overflow: hidden;
  padding: 30px 8% 30px 4%;
  margin-bottom: 43px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.empty-copy h2 {
  font-size: 42px;
  line-height: 1.12;
  letter-spacing: -1.6px;
  margin-bottom: 16px;
  font-weight: 650;
}

.empty-copy p {
  font-size: 13px;
  max-width: 300px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 26px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.empty-actions .button {
  font-size: 12px;
}

.empty-art {
  width: 100%;
  height: 270px;
}

.empty-art svg {
  width: 100%;
  height: 100%;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 36px 0 18px;
}

.section-heading h2 {
  font-size: 17px;
  margin: 0;
  letter-spacing: -.4px;
  font-weight: 600;
}

.section-heading span {
  font-size: 11px;
  color: var(--faint);
}

.library-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.library-tile {
  padding: 22px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 95px;
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}

.library-tile:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 45, 85, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.library-tile > .tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 46px;
  border-radius: 10px;
  background: rgba(255, 45, 85, 0.1);
  color: var(--accent);
  border: 1px solid rgba(255, 45, 85, 0.2);
}

.library-tile strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
  margin-bottom: 5px;
}

.library-tile small {
  font-size: 11px;
  color: var(--faint);
}

.library-tile > .chevron {
  margin-left: auto;
  color: var(--faint);
  transition: color .15s, transform .15s;
}

.library-tile:hover > .chevron {
  color: var(--accent);
  transform: translateX(2px);
}

.library-tile svg {
  width: 19px;
}

.quiet-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--faint);
  font-size: 11px;
  margin-top: 32px;
}

.quiet-note svg {
  width: 13px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 28px 20px;
}

.media-card {
  text-align: left;
  padding: 0;
  min-width: 0;
  border-radius: 12px;
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-card:hover {
  transform: translateY(-6px);
}

.poster {
  aspect-ratio: 2/3;
  background: var(--surface);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  transition: border-color .25s, box-shadow .25s;
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .2s;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: linear-gradient(145deg, #18181e, #111116);
  padding: 20px;
  color: #a1a1aa;
  text-align: center;
}

.poster-fallback svg {
  width: 30px;
  height: 30px;
  opacity: .4;
}

.poster-fallback span {
  font-size: 13px;
  line-height: 1.5;
  font-weight: 400;
}

.poster .quality {
  position: absolute;
  right: 9px;
  top: 9px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .5px;
  padding: 3px 6px;
  color: #ffffff;
}

.poster .watched {
  position: absolute;
  left: 9px;
  top: 9px;
  width: 22px;
  height: 22px;
  background: rgba(17, 17, 21, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 45, 85, 0.4);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.watched svg {
  width: 13px;
  height: 13px;
}

.poster .progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
}

.poster .progress-track i {
  height: 100%;
  display: block;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.poster-play {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-card:hover .poster-play, .media-card:focus-visible .poster-play {
  opacity: 1;
}

.media-card:hover .poster, .media-card:focus-visible .poster {
  border-color: rgba(255, 45, 85, 0.45);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 45, 85, 0.25);
}

.poster-play svg {
  width: 44px;
  height: 44px;
  padding: 12px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(255, 45, 85, 0.5);
  transform: scale(.92);
  transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-card:hover .poster-play svg, .media-card:focus-visible .poster-play svg {
  transform: scale(1);
}

.media-card h3 {
  font-size: 13px;
  font-weight: 550;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.2px;
}

.media-card p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.continue-card {
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  text-align: left;
  padding: 0;
  border: 1px solid var(--line);
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1), border-color .25s, box-shadow .25s;
}

.continue-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 45, 85, 0.35);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
}

.continue-image {
  aspect-ratio: 16/8;
  position: relative;
  background: #1c1c22;
}

.continue-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continue-image .poster-play {
  opacity: 1;
  background: linear-gradient(0deg, rgba(0, 0, 0, .6), transparent);
}

.continue-image .poster-play svg {
  width: 34px;
  height: 34px;
  padding: 9px;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 45, 85, 0.45);
}

.continue-meta {
  padding: 13px 15px;
}

.continue-meta strong {
  font-size: 13px;
  font-weight: 550;
}

.continue-meta p {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 0;
}

.continue-meta progress {
  margin-top: 10px;
  width: 100%;
  height: 3px;
}

.featured {
  position: relative;
  min-height: 320px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 36px;
  display: flex;
  align-items: end;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.featured > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .65;
}

.featured::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(9, 9, 11, 0.95) 0%, rgba(9, 9, 11, 0.6) 50%, rgba(9, 9, 11, 0.2) 100%), linear-gradient(0deg, rgba(9, 9, 11, 0.7) 0%, transparent 60%);
}

.featured-copy {
  position: relative;
  z-index: 1;
  padding: 35px;
  max-width: 580px;
}

.featured-copy h2 {
  font-size: 36px;
  margin: 8px 0 12px;
  letter-spacing: -1.2px;
  font-weight: 650;
}

.featured-copy p {
  font-size: 13px;
  color: #cfcfd4;
  max-width: 480px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}

.featured-copy .eyebrow {
  color: var(--accent);
  font-weight: 600;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 18px;
}

.rating {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--accent);
}

.rating b {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border: 1px solid rgba(255, 45, 85, 0.35);
  border-radius: 4px;
  color: var(--accent);
  background: rgba(255, 45, 85, 0.1);
}

.scan-status {
  font-size: 11px;
  color: var(--accent);
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 16px;
  font-weight: 500;
}

.scan-status svg {
  animation: spin 2s linear infinite;
  width: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.no-results {
  text-align: center;
  padding: 90px 20px;
  color: var(--muted);
}

.no-results h2 {
  color: var(--text);
}

.mobile-wordmark, .mobile-nav {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 35px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.modal-card {
  position: relative;
  max-height: calc(100dvh - 70px);
  width: 100%;
  max-width: 900px;
  overflow: auto;
  background: rgba(17, 17, 21, 0.96);
  backdrop-filter: var(--blur-panel);
  -webkit-backdrop-filter: var(--blur-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65), 0 0 1px rgba(255, 255, 255, 0.15);
}

.modal-card.compact {
  max-width: 510px;
}

.modal-card.settings {
  max-width: 760px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.5px;
}

.modal-body {
  padding: 26px 28px;
}

.modal-body > p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-error {
  font-size: 12px;
  color: #ff453a;
  min-height: 0;
  margin: 0;
}

.form-error:empty {
  display: none;
}

.field-hint {
  font-size: 11px;
  color: var(--faint);
  margin-top: 7px;
  line-height: 1.7;
}

.settings-tabs {
  display: flex;
  gap: 24px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

.settings-tabs button {
  padding: 16px 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}

.settings-tabs button:hover {
  color: var(--text);
}

.settings-tabs button.active {
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

.settings-group {
  margin-bottom: 26px;
}

.settings-group h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.settings-group p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

.settings-folder {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.settings-folder .folder-info {
  min-width: 0;
  flex: 1;
}

.settings-folder strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
}

.settings-folder code {
  display: block;
  font-family: inherit;
  color: var(--faint);
  font-size: 11px;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 550;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  border-radius: 6px;
}

.link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.connection-link {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  padding: 12px 14px;
  border-radius: 10px;
  margin: 10px 0;
  border: 1px solid var(--line);
}

.connection-link code {
  font-size: 12px;
  overflow-wrap: anywhere;
  flex: 1;
  color: var(--text);
}

.connection-link button {
  flex-shrink: 0;
}

.provider-state {
  font-size: 11px;
  color: #30d158;
  margin-left: 8px;
  font-weight: 500;
}

.tmdb-credit {
  font-size: 11px;
  color: var(--faint);
  line-height: 1.8;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tmdb-credit img {
  width: 75px;
  height: auto;
  display: block;
  margin-bottom: 12px;
}

.detail-hero {
  height: 290px;
  position: relative;
  background: #141418;
  overflow: hidden;
}

.detail-hero > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .7;
}

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, var(--panel) 0%, rgba(17, 17, 21, 0.4) 60%, transparent 100%);
}

.detail-close {
  position: absolute;
  right: 18px;
  top: 17px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #eee;
  border-radius: 50%;
  transition: background .15s, color .15s;
}

.detail-close:hover {
  background: rgba(255, 45, 85, 0.3);
  color: #ffffff;
}

.detail-main {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 28px;
  padding: 0 34px 32px;
  margin-top: -65px;
  position: relative;
  z-index: 1;
}

.detail-poster {
  width: 145px;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.detail-copy {
  padding-top: 21px;
  min-width: 0;
}

.detail-copy h1 {
  font-size: 32px;
  line-height: 1.13;
  margin: 0 0 14px;
  letter-spacing: -1px;
  font-weight: 650;
}

.detail-copy .overview {
  font-size: 13px;
  color: #b1b0b5;
  line-height: 1.9;
  white-space: pre-line;
  margin: 22px 0;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.detail-actions .button {
  font-size: 12px;
}

.detail-extras {
  padding: 0 34px 30px;
}

.detail-extras h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 10px 0 17px;
}

.technical {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 21px;
  margin-top: 25px;
}

.technical span {
  font-size: 10px;
  letter-spacing: .3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 9px;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.02);
}

.cast-grid {
  display: flex;
  overflow-x: auto;
  gap: 18px;
  padding-bottom: 12px;
}

.cast-person {
  flex: 0 0 75px;
  width: 75px;
  text-align: center;
}

.cast-photo {
  width: 62px;
  height: 62px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #222228;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  border: 1px solid var(--line);
}

.cast-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cast-person strong {
  font-size: 10px;
  font-weight: 500;
  display: block;
  line-height: 1.5;
}

.cast-person small {
  font-size: 9px;
  color: var(--faint);
  display: block;
  line-height: 1.5;
  margin-top: 4px;
}

.episode-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

.episode-button {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 13px 15px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}

.episode-button:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 45, 85, 0.25);
}

.episode-button > span:nth-child(2) {
  flex: 1;
  font-size: 13px;
}

.episode-button small {
  color: var(--faint);
  font-size: 11px;
}

.episode-number {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  min-width: 55px;
}

.image-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  max-height: 330px;
  overflow: auto;
}

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

.image-choice {
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #222;
  position: relative;
  aspect-ratio: 2/3;
  border: 2px solid transparent;
  transition: border-color .15s, box-shadow .15s;
}

.image-choice:hover {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(255, 45, 85, 0.4);
}

.image-choice img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.backdrops .image-choice {
  aspect-ratio: 16/9;
}

.art-tools {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.inline-form {
  display: flex;
  gap: 9px;
}

.inline-form input {
  flex: 1;
  min-width: 0;
}

.metadata-result {
  display: flex;
  gap: 15px;
  width: 100%;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  align-items: center;
  transition: background .15s;
  border-radius: 8px;
}

.metadata-result:hover {
  background: rgba(255, 255, 255, 0.03);
}

.metadata-result img {
  width: 44px;
  height: 66px;
  border-radius: 6px;
  object-fit: cover;
  background: #222228;
}

.metadata-result strong {
  font-size: 13px;
  display: block;
  font-weight: 550;
}

.metadata-result p {
  font-size: 11px;
  color: var(--muted);
  margin: 5px 0 0;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: radial-gradient(ellipse at 50% 20%, rgba(255, 45, 85, 0.08) 0%, var(--bg) 65%);
}

.auth-card {
  width: 360px;
  max-width: 100%;
}

.auth-card > .wordmark {
  margin-bottom: 48px;
  font-size: 58px;
}

.auth-card .eyebrow {
  font-size: 10px;
  margin-bottom: 16px;
  color: var(--accent);
}

.auth-card h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -1.2px;
  margin-bottom: 16px;
  font-weight: 650;
}

.auth-card > .muted {
  font-size: 13px;
  margin-bottom: 30px;
  line-height: 1.6;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-card input {
  background: rgba(255, 255, 255, 0.05);
  padding: 13px 14px;
}

.auth-footnote {
  font-size: 11px;
  text-align: center;
  color: var(--faint);
  margin: 26px 0 0;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(24, 24, 28, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 13px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  max-width: 90vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 45, 85, 0.25);
}

.upload-progress {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 80;
  width: 330px;
  max-width: calc(100vw - 40px);
  padding: 16px 20px 20px;
  background: rgba(24, 24, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 45, 85, 0.2);
}

.upload-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upload-progress strong {
  font-weight: 550;
  font-size: 13px;
}

.upload-progress p {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 4px 0 14px;
}

.upload-progress progress {
  width: calc(100% - 45px);
  height: 4px;
  vertical-align: middle;
}

.upload-progress > span {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-left: 9px;
}

progress {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

progress::-webkit-progress-value {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(255, 45, 85, 0.6);
  border-radius: 4px;
}

progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 4px;
}

.drop-zone {
  position: fixed;
  inset: 15px;
  z-index: 90;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: rgba(9, 9, 11, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.drop-zone svg {
  width: 44px;
  height: 44px;
  color: var(--accent);
  margin-bottom: 24px;
  filter: drop-shadow(0 0 16px rgba(255, 45, 85, 0.5));
}

.drop-zone h2 {
  font-size: 32px;
  font-weight: 650;
}

.drop-zone p {
  color: var(--muted);
  font-size: 14px;
}

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

.player-overlay video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Apple-style clean, cinematic subtitle cue styling with customization support */
:root {
  --sub-font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sub-font-size: clamp(14px, 2.2vw, 21px);
  --sub-color: #ffffff;
  --sub-bg-color: transparent;
  --sub-bottom: 10%;
  --sub-text-shadow:
    0 1px 2px rgba(0, 0, 0, 1),
    0 2px 4px rgba(0, 0, 0, 0.95),
    0 0 6px rgba(0, 0, 0, 0.85),
    0 0 14px rgba(0, 0, 0, 0.65);
}

video::cue {
  font-family: var(--sub-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif) !important;
  font-size: var(--sub-font-size, clamp(14px, 2.2vw, 21px)) !important;
  font-weight: 550;
  line-height: 1.4;
  color: var(--sub-color, #ffffff) !important;
  background: var(--sub-bg-color, transparent) !important;
  background-color: var(--sub-bg-color, transparent) !important;
  text-shadow: var(--sub-text-shadow,
    0 1px 2px rgba(0, 0, 0, 1),
    0 2px 4px rgba(0, 0, 0, 0.95),
    0 0 6px rgba(0, 0, 0, 0.85),
    0 0 14px rgba(0, 0, 0, 0.65)) !important;
  white-space: pre-line;
}

.player-header {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 32px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
}

.player-header h2 {
  font-size: 16px;
  margin: 4px 0 0;
  letter-spacing: -.2px;
  font-weight: 600;
}

.player-header .eyebrow {
  font-size: 9px;
  color: var(--accent);
  font-weight: 600;
}

.player-header .icon-button {
  color: #eee;
}

.player-header .icon-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.player-mode {
  margin-left: auto;
  font-size: 11px;
  font-weight: 550;
  color: #eee;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 6px 12px;
}

.player-controls {
  position: absolute;
  inset: auto 0 0;
  padding: 60px 35px 25px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
}

.time-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #ddd;
}

.time-row span {
  min-width: 42px;
  font-weight: 500;
}

.time-row span:last-child {
  text-align: right;
}

.time-row input {
  flex: 1;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 2px;
  cursor: pointer;
  accent-color: var(--accent);
  transition: height .15s;
}

.time-row input:hover {
  height: 6px;
}

.time-row input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transition: transform .15s;
}

.time-row input:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.time-row input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.transport-row, .transport, .player-options {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transport-row {
  justify-content: space-between;
  margin-top: 14px;
}

.transport .icon-button {
  color: #eee;
}

.transport .icon-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.transport .play-pause {
  background: var(--accent);
  color: #ffffff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  box-shadow: 0 4px 16px rgba(255, 45, 85, 0.45);
  transition: transform .18s, background .18s, box-shadow .18s;
}

.transport .play-pause:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 22px rgba(255, 45, 85, 0.6);
  transform: scale(1.06);
}

.transport .play-pause:active {
  transform: scale(.95);
}

.transport input {
  width: 80px;
  height: 4px;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: 2px;
}

.player-options select {
  background: rgba(24, 24, 28, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: #eee;
  max-width: 155px;
}

.player-options select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.player-options .icon-button {
  color: #eee;
}

.player-options .icon-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.player-play-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 55;
  pointer-events: auto;
}

.player-center-play {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(255, 45, 85, 0.55), 0 0 0 4px rgba(255, 45, 85, 0.2);
  transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1), background .2s, box-shadow .2s;
  cursor: pointer;
  border: none;
}

.player-center-play:hover {
  background: var(--accent-hover);
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(255, 45, 85, 0.7), 0 0 0 6px rgba(255, 45, 85, 0.3);
}

.player-center-play svg {
  width: 32px;
  height: 32px;
  margin-left: 3px;
}

.player-play-label {
  font-size: 13px;
  font-weight: 600;
  color: #f5f5f7;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  letter-spacing: .3px;
}

.player-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 55;
  padding: 24px 32px;
  background: rgba(17, 17, 21, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.player-spinner-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-spinner {
  width: 54px;
  height: 54px;
  transform: rotate(-90deg);
  transform-origin: 27px 27px;
}

.spinner-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 4;
}

.spinner-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 138.23;
  stroke-dashoffset: 138.23;
  transform-origin: 27px 27px;
  filter: drop-shadow(0 0 6px rgba(255, 45, 85, 0.5));
  transition: stroke-dashoffset 0.25s ease;
}

.spinner-ring.indeterminate {
  animation: spinner-dash 1.4s ease-in-out infinite, spinner-spin 2s linear infinite;
}

@keyframes spinner-dash {
  0% { stroke-dashoffset: 130; }
  50% { stroke-dashoffset: 35; }
  100% { stroke-dashoffset: 130; }
}

@keyframes spinner-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.player-loader-pct {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.player-loader-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -.2px;
}

.player-loader-sub {
  font-size: 11px;
  color: var(--muted);
}

.player-message {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #eee;
  font-size: 13px;
  max-width: 85vw;
  line-height: 1.8;
  padding: 20px 28px;
  border-radius: 14px;
  background: rgba(17, 17, 21, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.7);
}

.player-message:empty {
  display: none;
}

.player-message .button {
  margin-top: 14px;
  font-size: 12px;
}

.player-overlay.controls-hidden .player-header, .player-overlay.controls-hidden .player-controls {
  opacity: 0;
  pointer-events: none;
}

.player-header, .player-controls {
  transition: opacity .25s ease-out;
}

.loading {
  padding: 80px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.skeleton {
  height: 200px;
  background: linear-gradient(100deg, #141418, #1e1e24, #141418);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: 12px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.file-note {
  font-size: 11px;
  color: var(--faint);
  overflow-wrap: anywhere;
  margin-top: 14px;
  line-height: 1.8;
}

.modal-back {
  color: var(--muted);
  margin-right: 8px;
}

.settings-checklist {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.settings-checklist span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.settings-checklist svg {
  width: 13px;
  color: #30d158;
}

/* TV 10-foot UI & Remote Focus Rings */
@media screen and (min-width: 1400px), screen and (min-height: 800px) {
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
    box-shadow: 0 0 0 5px var(--accent-subtle), 0 0 24px var(--accent-glow);
  }
}

.media-card:focus-visible, .continue-card:focus-visible, .library-tile:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px var(--accent-subtle), 0 0 28px rgba(255, 45, 85, 0.55);
  transform: translateY(-6px) scale(1.03);
  z-index: 5;
}

.episode-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 16px var(--accent-glow);
}

@media(min-width:1600px) {
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  }
  .empty-feature {
    min-height: 410px;
  }
  .empty-copy h2 {
    font-size: 52px;
  }
}

@media(max-width:1150px) {
  .sidebar {
    width: 190px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .main-area {
    margin-left: 190px;
  }
  .topbar {
    padding: 0 27px;
  }
  #content {
    padding: 35px 27px;
  }
  .main-footer {
    margin: 0 27px;
  }
  .empty-copy h2 {
    font-size: 35px;
  }
  .empty-feature {
    padding-right: 5%;
  }
  .library-tile {
    padding: 17px;
    gap: 10px;
  }
  .search-field input {
    width: 170px;
  }
  .breadcrumb {
    display: none;
  }
  .topbar-actions {
    margin-left: auto;
  }
  .media-grid {
    gap: 24px 16px;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

@media(max-width:800px) {
  .sidebar {
    width: 165px;
    padding-left: 9px;
    padding-right: 9px;
  }
  .sidebar > .wordmark {
    margin-left: 15px;
  }
  .main-area {
    margin-left: 165px;
  }
  .topbar {
    padding: 0 22px;
  }
  .search-field input {
    width: 145px;
  }
  #content {
    padding: 30px 22px;
  }
  .main-footer {
    margin: 0 22px;
  }
  .nav-item {
    padding: 11px 10px;
    font-size: 12px;
    gap: 9px;
  }
  .empty-feature {
    grid-template-columns: 1fr;
    padding: 30px;
    min-height: 0;
  }
  .empty-art {
    height: 155px;
    margin-bottom: 12px;
  }
  .empty-copy {
    padding: 0 10px 15px;
  }
  .empty-copy h2 {
    font-size: 35px;
  }
  .empty-copy p {
    max-width: 100%;
  }
  .library-tiles {
    grid-template-columns: 1fr;
  }
  .library-tile {
    min-height: 75px;
  }
  .page-heading h1 {
    font-size: 29px;
  }
  .page-heading {
    align-items: start;
  }
  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  }
  .detail-main {
    grid-template-columns: 110px 1fr;
    padding: 0 24px 25px;
    gap: 20px;
  }
  .detail-poster {
    width: 110px;
  }
  .detail-copy h1 {
    font-size: 26px;
  }
  .detail-extras {
    padding: 0 24px 24px;
  }
  .detail-copy {
    padding-top: 25px;
  }
  .modal {
    padding: 20px;
  }
  .modal-card {
    max-height: calc(100dvh - 40px);
  }
  .player-options {
    gap: 3px;
  }
  .player-options select {
    max-width: 110px;
  }
  .transport input {
    display: none;
  }
  .player-controls {
    padding: 40px 18px 25px;
  }
}

@media(max-width:600px) {
  .sidebar {
    display: none;
  }
  .main-area {
    margin-left: 0;
    padding-bottom: 75px;
  }
  .topbar {
    height: 72px;
    padding: 0 20px;
    gap: 14px;
  }
  .mobile-wordmark {
    display: block;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -3px;
  }
  .mobile-wordmark span {
    font-size: 20px;
    margin-left: 2px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .search-field {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
  }
  .search-field input {
    position: absolute;
    right: 0;
    width: 38px;
    opacity: 0;
    cursor: pointer;
  }
  .search-field:focus-within {
    width: 170px;
    padding: 0 10px;
  }
  .search-field:focus-within input {
    opacity: 1;
    position: relative;
    background: var(--bg);
    width: 100%;
    padding-left: 8px;
  }
  .search-field:focus-within > span {
    display: none;
  }
  .search-field kbd {
    display: none;
  }
  .upload-button-label {
    display: none;
  }
  .topbar-actions > .button {
    padding: 8px;
    min-width: 38px;
    min-height: 38px;
  }
  .topbar-actions > .icon-button {
    min-width: 38px;
    height: 38px;
  }
  #content {
    padding: 26px 18px 25px;
    min-height: calc(100dvh - 200px);
  }
  .page-heading {
    margin-bottom: 24px;
  }
  .page-heading h1 {
    font-size: 28px;
  }
  .page-heading .eyebrow {
    font-size: 9px;
    margin-bottom: 10px;
  }
  .page-heading p {
    font-size: 11px;
  }
  .heading-actions {
    padding-top: 20px;
  }
  .sort-select {
    font-size: 10px;
    max-width: 110px;
  }
  .empty-feature {
    padding: 18px 20px 24px;
    border-radius: 16px;
    margin-bottom: 30px;
  }
  .empty-art {
    height: 160px;
  }
  .empty-copy {
    padding: 0 4px;
  }
  .empty-copy h2 {
    font-size: 32px;
    letter-spacing: -1.2px;
  }
  .empty-copy p {
    font-size: 12px;
    line-height: 1.8;
  }
  .empty-actions {
    flex-wrap: wrap;
  }
  .empty-actions .button {
    font-size: 11px;
    padding: 10px 14px;
    min-height: 40px;
  }
  .library-tiles {
    gap: 10px;
  }
  .library-tile {
    padding: 15px 18px;
  }
  .section-heading {
    margin-top: 26px;
  }
  .section-heading h2 {
    font-size: 15px;
  }
  .quiet-note {
    font-size: 10px;
    line-height: 1.7;
    text-align: center;
  }
  .main-footer {
    margin: 0 18px;
    padding: 18px 0;
    font-size: 10px;
  }
  .main-footer span:last-child {
    display: none;
  }
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(17, 17, 21, 0.88);
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    border-top: 1px solid var(--line);
    padding: 8px 12px max(14px, env(safe-area-inset-bottom));
    z-index: 20;
  }
  .mobile-nav button {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
    min-width: 65px;
    padding: 4px 0;
    transition: color .15s;
  }
  .mobile-nav svg {
    width: 20px;
    height: 20px;
  }
  .mobile-nav button.active {
    color: var(--accent);
    font-weight: 600;
  }
  .mobile-nav button.active svg {
    color: var(--accent);
    filter: drop-shadow(0 0 6px rgba(255, 45, 85, 0.5));
  }
  .media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 10px;
  }
  .poster {
    border-radius: 9px;
    margin-bottom: 8px;
  }
  .media-card h3 {
    font-size: 11px;
  }
  .media-card p {
    font-size: 9px;
  }
  .poster .quality {
    font-size: 7px;
    top: 6px;
    right: 6px;
    padding: 2px 4px;
  }
  .poster-fallback {
    padding: 10px;
    gap: 8px;
  }
  .poster-fallback span {
    font-size: 11px;
  }
  .poster-fallback svg {
    width: 22px;
  }
  .continue-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .continue-meta {
    padding: 10px;
  }
  .continue-meta strong {
    font-size: 11px;
  }
  .continue-meta p {
    font-size: 9px;
  }
  .featured {
    min-height: 260px;
    border-radius: 14px;
  }
  .featured-copy {
    padding: 22px;
  }
  .featured-copy h2 {
    font-size: 26px;
  }
  .featured-copy p {
    font-size: 11px;
  }
  .modal {
    padding: 0;
    align-items: end;
  }
  .modal-card {
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
  .modal-card.compact, .modal-card.settings {
    max-width: 100%;
  }
  .modal-header {
    padding: 18px 20px;
  }
  .modal-body {
    padding: 22px 20px 32px;
  }
  .settings-tabs {
    padding: 0 20px;
    gap: 20px;
  }
  .settings-tabs button {
    font-size: 12px;
    padding-top: 14px;
  }
  .detail-hero {
    height: 230px;
  }
  .detail-main {
    grid-template-columns: 85px 1fr;
    gap: 16px;
    padding: 0 20px 24px;
    margin-top: -50px;
  }
  .detail-poster {
    width: 85px;
    border-radius: 8px;
  }
  .detail-copy {
    padding-top: 16px;
  }
  .detail-copy h1 {
    font-size: 24px;
    letter-spacing: -.6px;
    margin-bottom: 10px;
  }
  .detail-copy .overview {
    font-size: 12px;
    margin-top: 16px;
  }
  .detail-copy .meta-line {
    font-size: 10px;
    gap: 8px;
    margin-bottom: 14px;
  }
  .detail-actions {
    gap: 7px;
  }
  .detail-actions .button {
    padding: 9px 12px;
    min-height: 38px;
    font-size: 11px;
  }
  .detail-actions .icon-button {
    min-width: 36px;
    height: 36px;
  }
  .detail-extras {
    padding: 0 20px 28px;
  }
  .cast-photo {
    width: 52px;
    height: 52px;
  }
  .cast-person {
    flex-basis: 64px;
    width: 64px;
  }
  .cast-grid {
    gap: 10px;
  }
  .detail-close {
    top: 12px;
    right: 12px;
  }
  .technical {
    gap: 5px;
  }
  .technical span {
    font-size: 8px;
  }
  .player-header {
    padding: 16px 14px;
    gap: 10px;
  }
  .player-header h2 {
    font-size: 14px;
  }
  .player-mode {
    font-size: 8px;
    max-width: 95px;
    text-align: center;
  }
  .player-controls {
    padding: 40px 14px max(24px, env(safe-area-inset-bottom));
  }
  .time-row {
    gap: 8px;
    font-size: 10px;
  }
  .time-row span {
    min-width: 34px;
  }
  .transport-row {
    gap: 0;
    align-items: start;
  }
  .transport {
    gap: 4px;
  }
  .transport .icon-button {
    min-width: 32px;
    width: 32px;
    height: 32px;
  }
  .transport .play-pause {
    width: 36px;
    height: 36px;
  }
  .transport #mute {
    display: none;
  }
  .player-options {
    flex-wrap: wrap;
    justify-content: end;
    max-width: 58%;
    gap: 4px;
  }
  .player-options select {
    padding: 6px 4px;
    font-size: 8px;
    max-width: 88px;
  }
  .player-options .icon-button {
    height: 30px;
    min-width: 28px;
  }
  .player-options #audio-select {
    max-width: 78px;
  }
  .upload-progress {
    bottom: 95px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
  .toast {
    bottom: 95px;
  }
  .inline-form {
    flex-wrap: wrap;
  }
  .inline-form input {
    min-width: 160px;
  }
  .image-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .image-grid.backdrops {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
