:root {
  --bg: #0d0d0f;
  --bg2: #141418;
  --surface: #1a1a20;
  --text: #f2f2f4;
  --muted: #9a9aa3;
  --accent: #e50914;
  --border: #2a2a32;
  --radius: 8px;
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

#app {
  min-height: 100vh;
}

.is-hidden {
  display: none !important;
}

.drive-badge {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drive-badge-inline {
  color: var(--muted);
  font-size: 0.88em;
  font-weight: 500;
}

.meta-all {
  margin-bottom: 0.5rem;
}

.empty.soft {
  padding: 2rem 1.5rem;
  max-width: 36rem;
}

.empty.soft .hint {
  margin: 0;
  line-height: 1.55;
}

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, #141418 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
}

.logo {
  color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
}

.btn:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.big {
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
}

.filter {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  font: inherit;
}

.subbar {
  padding: 0.5rem 1.5rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* All libraries: full-width vertical scroll (Netflix-style browse) */
.main--browse {
  max-width: none;
  width: 100%;
  padding-left: clamp(0.75rem, 2vw, 2.5rem);
  padding-right: clamp(0.75rem, 2vw, 2.5rem);
  padding-bottom: 3rem;
}

.browse-page--all {
  width: 100%;
  min-height: min(60vh, 800px);
}

.browse-meta {
  margin-bottom: 1.25rem;
}

.browse-section-title.row-title {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: 1rem;
}

.netflix-poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 1rem 1.25rem;
  width: 100%;
  padding-bottom: 0.5rem;
}

.netflix-poster-grid--movies .card.movie-card.netflix-card {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.netflix-poster-grid .card-cap .t {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.browse-strip.strip-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.85rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.35rem 0 1rem;
  margin: 0;
  width: 100%;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 0.25rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--border) transparent;
}

.browse-strip.strip-scroll .card {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.browse-show-block,
.browse-album-block {
  margin-bottom: 2.25rem;
}

.browse-page--list .browse-list-wrap {
  max-width: none;
  width: 100%;
}

.foot {
  padding: 1rem 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.empty {
  text-align: center;
  padding: 4rem 1rem;
  max-width: 32rem;
  margin: 0 auto;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.home-page {
  padding: 0 1.25rem 2rem;
  max-width: 56rem;
  margin: 0 auto;
}

.home-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.home-cat-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.home-cat-card:hover {
  border-color: var(--muted);
  background: var(--bg2);
}

.home-cat-icon .cat-icon {
  width: 2rem;
  height: 2rem;
}

.home-cat-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.home-cat-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.home-cat-line {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
}

.home-dash {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.home-dash-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.home-dash-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.home-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
}

.home-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.home-table th,
.home-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.home-table th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
}

.home-table td {
  background: var(--bg2);
}

.home-table tbody tr:last-child td {
  border-bottom: none;
}

.home-table tfoot th,
.home-table tfoot td {
  background: var(--surface);
  font-weight: 600;
  color: var(--text);
  border-top: 2px solid var(--border);
  border-bottom: none;
}

.home-th-sub {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  opacity: 0.85;
}

.home-root {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}

.home-sub {
  color: var(--muted);
  font-size: 0.85em;
}

.drive-banner.home-banner {
  background: linear-gradient(90deg, #1a1a24 0%, var(--bg2) 100%);
}

.row-title {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.row-title-inner,
.list-h-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.row-title-inner > span:last-child,
.list-h-inner > span:last-child {
  line-height: 1.2;
}

.cat-icon {
  width: 1.35rem;
  height: 1.35rem;
  object-fit: contain;
  flex-shrink: 0;
}

.seg-cats {
  flex-wrap: wrap;
}

.seg-btn-cat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.55rem;
  padding-right: 0.65rem;
}

.seg-btn-cat .cat-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.seg-btn-cat span:last-child {
  line-height: 1;
}

.row {
  margin-bottom: 2rem;
}

.row-head {
  margin-bottom: 0.5rem;
}

.row-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.row-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.row-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.row-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.card {
  flex: 0 0 auto;
  width: 140px;
}

.card.movie-card {
  width: 180px;
}

.card.track-card {
  width: 120px;
}

.card.book-card {
  width: 118px;
}

.card-poster.book-poster {
  aspect-ratio: 2 / 3;
}

.card-poster {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2/3;
  background: linear-gradient(145deg, var(--surface) 0%, #252530 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

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

.card-poster.sq {
  aspect-ratio: 1;
}

.card-poster .poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-poster-wrap {
  flex: 0 0 auto;
  width: 48px;
  aspect-ratio: 2/3;
  background: linear-gradient(145deg, var(--surface) 0%, #252530 100%);
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

.list-poster-wrap.wide {
  width: 72px;
  aspect-ratio: 16/9;
}

.list-poster-wrap .poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.list-show {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
}

.list-show-text {
  flex: 1 1 200px;
  min-width: 0;
}

.list-show > .nested {
  flex: 1 1 100%;
  margin-left: 0;
}

.list-movie-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.list-movie-text {
  flex: 1;
  min-width: 0;
}

.card-cap {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.card-cap .t {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-cap .s {
  color: var(--muted);
  font-size: 0.75rem;
}

.expand-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.season-block {
  margin-bottom: 1rem;
}

.season-block h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.ep-list {
  margin: 0;
  padding-left: 1.25rem;
}

.ep-num {
  color: var(--accent);
  margin-right: 0.35rem;
}

.ep-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.ep-row .ep-name {
  flex: 1 1 8rem;
  min-width: 0;
}

.card-selectable {
  position: relative;
}

.pick-overlay {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  z-index: 2;
  cursor: pointer;
}

.pick-overlay input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
}

.pick-ep {
  margin-left: auto;
  flex-shrink: 0;
}

.pick-ep input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
}

.pick-list {
  display: inline-flex;
  align-items: center;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.pick-list input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.move-extra {
  margin-top: 0.5rem;
}

.path {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  word-break: break-all;
}

code.path {
  font-family: ui-monospace, monospace;
}

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

.list-wrap {
  max-width: 52rem;
}

.list-h {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

.list-h .list-h-inner {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.list-ul {
  margin: 0;
  padding-left: 1.25rem;
}

.list-show {
  margin: 0.75rem 0;
}

.nested {
  margin-top: 0.35rem;
}

.list-album {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

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

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  max-width: 22rem;
  width: 100%;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-card h1 {
  margin-top: 0;
  font-size: 1.35rem;
}

.login-lead {
  color: var(--muted);
  margin-bottom: 1rem;
}

.login-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1rem;
  line-height: 1.4;
}

.input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  margin: 0.35rem 0 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.textarea {
  resize: vertical;
  min-height: 4rem;
}

.drive-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.drive-picker-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.drive-banner {
  padding: 0.65rem 1.5rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.45;
}

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

.drive-notes {
  color: var(--text);
}

.drive-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 26rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-wide {
  max-width: 32rem;
}

.modal h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

.modal-lead {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.modal-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.modal-sub code {
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.modal-field {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.modal-field .req {
  color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.modal-lead a {
  color: var(--accent);
}

.covers-note {
  font-size: 0.82rem;
  line-height: 1.45;
}

.covers-status {
  min-height: 1.4em;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.settings-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.settings-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

/* —— TMDB-style browse + detail —— */
.browse-page--tmdb {
  max-width: 100%;
}

.tmdb-browse {
  display: grid;
  grid-template-columns: minmax(200px, 240px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .tmdb-browse {
    grid-template-columns: 1fr;
  }
}

.tmdb-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 5.5rem;
}

.tmdb-filter-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.tmdb-filter-block {
  margin-bottom: 1rem;
}

.tmdb-filter-select {
  margin-top: 0.25rem;
}

.tmdb-filter-hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.tmdb-browse-h {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.tmdb-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.25rem;
}

.tmdb-card {
  position: relative;
  display: block;
  text-align: left;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tmdb-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.tmdb-card-poster {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 2/3;
  background: var(--bg2);
}

.tmdb-card-poster .poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tmdb-score {
  position: absolute;
  bottom: 3.2rem;
  left: 0.5rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: #081c22;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  box-shadow: 0 0 0 2px #081c22;
  background-image: conic-gradient(
    hsl(var(--hue, 130), 75%, 45%) calc(var(--pct, 0) * 1%),
    #423d0f 0
  );
}

.tmdb-score-inner {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #081c22;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.tmdb-score-sym {
  font-size: 0.45rem;
  opacity: 0.85;
}

.tmdb-score--na {
  position: absolute;
  bottom: 3.2rem;
  left: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(8, 28, 34, 0.9);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.tmdb-card-cap {
  padding: 0.5rem 0.15rem 0;
}

.tmdb-card-title {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.25;
}

.tmdb-card-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.tmdb-card-date {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.tmdb-attribution {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 1.5rem 0 0;
  text-align: center;
}

.main--detail {
  padding: 0;
  max-width: none;
}

.tmdb-detail {
  padding-bottom: 2rem;
}

.tmdb-detail-hero {
  background: var(--bg2);
  background-size: cover;
  background-position: center top;
  padding: 2rem 1.5rem 3rem;
  margin-bottom: 0;
}

.tmdb-detail-hero-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

.tmdb-detail-poster {
  flex-shrink: 0;
  width: 18rem;
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.tmdb-detail-poster .poster-img {
  width: 100%;
  display: block;
}

.tmdb-detail-head {
  flex: 1;
  min-width: 200px;
}

.tmdb-detail-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
}

.tmdb-detail-year {
  font-weight: 400;
  opacity: 0.85;
}

.tmdb-detail-meta {
  font-size: 0.95rem;
  color: #c8c8d0;
  margin-bottom: 0.75rem;
}

.tmdb-dot {
  margin: 0 0.35rem;
  opacity: 0.6;
}

.tmdb-detail-score-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.tmdb-detail-score-row .tmdb-score {
  position: static;
}

.tmdb-detail-score-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.tmdb-detail-tagline {
  font-style: italic;
  opacity: 0.85;
  margin: 0.5rem 0 1rem;
  color: #c8c8d0;
}

.tmdb-detail-h2 {
  margin: 1rem 0 0.5rem;
  font-size: 1.1rem;
}

.tmdb-detail-overview {
  line-height: 1.55;
  margin: 0;
  color: #e8e8ec;
}

.tmdb-detail-section {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.tmdb-detail-muted {
  font-size: 0.88rem;
}

.tmdb-cast-strip {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.tmdb-cast-card {
  flex: 0 0 8.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.tmdb-cast-photo {
  aspect-ratio: 2/3;
  background: var(--bg2);
}

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

.tmdb-cast-ph {
  width: 100%;
  height: 100%;
  min-height: 8rem;
}

.tmdb-cast-cap {
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
}

.tmdb-cast-cap strong {
  display: block;
  font-size: 0.82rem;
}

.tmdb-cast-cap span {
  color: var(--muted);
  display: block;
  margin-top: 0.15rem;
}

.tmdb-detail-local .path {
  margin: 0.25rem 0 0;
}
