/* ---- Sidebar nav ---- */
#sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--nav-w);
  background: linear-gradient(180deg, oklch(0.15 0.018 260) 0%, oklch(0.12 0.015 260) 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 10px 16px;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
}
#sidebar.expanded { width: var(--nav-w-open); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px 18px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  white-space: nowrap;
}
.logo-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: oklch(0.18 0.02 260);
  font-family: 'Fraunces', serif;
  font-size: 20px; font-weight: 800;
  flex-shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 700; font-family: 'Fraunces', serif; }
.logo-ver  { font-size: 9px; color: var(--text-muted); letter-spacing: 1.5px; font-family: ui-monospace, monospace; }

.nav-items { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px;
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.nav-item:hover   { color: var(--text); background: var(--bg-2); }
.nav-item.active  { color: var(--text); background: var(--accent-soft); }
.nav-item.active .nav-dot { background: var(--accent); }
.nav-item.is-focused { outline: 2px solid var(--accent); outline-offset: 0; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-dot  { width: 4px; height: 16px; border-radius: 2px; background: transparent; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; cursor: pointer;
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 600; border-radius: 9px;
  transition: all var(--transition);
}
.btn-primary  { background: var(--accent); color: oklch(0.18 0.02 260); }
.btn-primary:hover, .btn-primary.is-focused  { filter: brightness(1.07); }
.btn-secondary { background: rgba(255,255,255,.08); color: var(--text); }
.btn-secondary:hover, .btn-secondary.is-focused { background: rgba(255,255,255,.14); }
.btn-ghost    { background: transparent; color: var(--text-dim); }
.btn-ghost:hover, .btn-ghost.is-focused { color: var(--text); background: var(--bg-2); }
.btn.is-focused { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Rating chip ---- */
.rating-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700; font-size: 11px;
  padding: 3px 7px; border-radius: 4px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  color: var(--gold);
}

/* ---- Genre pill ---- */
.pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
}
.pill:hover, .pill.active, .pill.is-focused {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Poster card ---- */
.card {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 8px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover, .card.is-focused {
  transform: scale(1.045) translateY(-2px);
}
.card.is-focused {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  z-index: 5;
}
.card-poster {
  width: 100%; border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: var(--shadow-poster);
}
.card-poster img {
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.card-poster-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, var(--bg-2) 0 8px, var(--bg-1) 8px 16px);
  color: var(--text-muted);
  font-size: 10px; text-align: center; padding: 8px;
}
.card-badge {
  position: absolute; top: 6px; left: 6px;
}
.card-type-badge {
  position: absolute; top: 6px; right: 6px;
  font-size: 9px; font-weight: 700;
  padding: 2px 5px;
  background: rgba(0,0,0,.6);
  border-radius: 3px;
  letter-spacing: .5px;
}
.card-meta { padding: 8px 2px 0; }
.card-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-sub {
  font-size: 10px; color: var(--text-muted); margin-top: 2px;
}

/* ---- Hero ---- */
.hero {
  position: relative;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(1.05);
}
.hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, transparent 35%, var(--bg-0) 100%),
    linear-gradient(90deg, var(--bg-0) 0%, transparent 60%);
}
.hero-content {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding: 32px 40px;
}
.hero-badge {
  font-family: ui-monospace, monospace;
  font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent);
}
.hero-title {
  margin: 10px 0 0;
  font-size: 52px; line-height: 1;
  text-shadow: 0 2px 24px rgba(0,0,0,.7);
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; margin-top: 14px;
  font-size: 13px; color: var(--text-dim);
}
.hero-meta .rating { color: var(--gold); font-weight: 700; }
.hero-desc {
  margin-top: 14px;
  font-size: 14px; line-height: 1.6;
  color: var(--text-dim); max-width: 520px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ---- Row (carousel) ---- */
.row { margin-bottom: 28px; }
.row-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; margin-bottom: 12px;
}
.row-title { margin: 0; font-size: 18px; font-weight: 600; font-family: 'Fraunces', serif; }
.row-track {
  display: flex; gap: 14px;
  overflow-x: auto; overflow-y: visible;
  padding: 8px 28px 16px;
  scroll-snap-type: x mandatory;
}
.row-track > * { scroll-snap-align: start; }

/* ---- OSK (keyboard) ---- */
.osk {
  display: grid;
  gap: 6px;
}
.osk-row { display: flex; gap: 6px; justify-content: center; }
.osk-key {
  min-width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.osk-key:hover, .osk-key.is-focused {
  background: var(--accent);
  color: oklch(0.18 0.02 260);
  border-color: var(--accent);
}
.osk-key.wide { min-width: 80px; }
.osk-key.wider { min-width: 120px; }

/* ---- Toast ---- */
#toast-container {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 999; pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px; font-weight: 500;
  animation: fadeIn .25s ease;
  backdrop-filter: blur(10px);
}

/* ---- Source picker ---- */
.source-picker {
  display: flex; flex-direction: column; gap: 8px;
}
.source-group { margin-bottom: 16px; }
.source-group-name {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 6px;
}
.source-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--bg-2);
  border: 1px solid transparent;
  cursor: pointer; width: 100%;
  text-align: left; color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
}
.source-btn:hover, .source-btn.is-focused {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.source-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.source-quality {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  color: var(--accent);
  font-family: ui-monospace, monospace;
  letter-spacing: .5px;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(255,255,255,.06);
}
.source-quality.q-4k  { color: oklch(0.85 0.18 30); }
.source-quality.q-fhd { color: oklch(0.85 0.16 60); }
.source-quality.q-hd  { color: var(--accent); }
.source-quality.q-sd  { color: var(--text-muted); }

/* ---- Card: hover-trailer ---- */
.card-poster { position: relative; }
.card-trailer-iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0; z-index: 4;
  background: #000;
  animation: fadeIn .3s ease;
  pointer-events: none;
}
.card-trailer-hint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55);
  color: var(--text-dim);
  font-size: 11px; font-weight: 600;
  letter-spacing: .5px;
  z-index: 4;
  animation: fadeIn .25s ease;
}
.card-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(0,0,0,.5);
  z-index: 3;
}
.card-progress > span {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ---- Top-bar ---- */
#topbar {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px;
  padding: 12px 28px;
  z-index: 50;
  background: linear-gradient(180deg, var(--bg-0) 0%, transparent 100%);
}
.topbar-search {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-family: inherit; font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 280px;
}
.topbar-search:hover, .topbar-search.is-focused {
  border-color: var(--accent);
  color: var(--text);
}
.topbar-search > span { flex: 1; text-align: left; }
.topbar-search kbd {
  font-family: ui-monospace, monospace;
  font-size: 10px; padding: 2px 6px;
  background: var(--bg-3); border-radius: 4px;
  color: var(--text-muted);
}

/* ---- Search history ---- */
.search-history { margin-bottom: 4px; }
.search-history-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px;
}
.search-history-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}

/* ---- Genres filters ---- */
.genres-filters {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.genres-filter {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--text-muted);
}
.genres-filter select {
  width: 200px;
}

/* ---- Collection tabs ---- */
.collection-tabs { padding: 0 28px 12px; }
.collection-tabs-row {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.collection-tabs-row .btn {
  padding: 8px 16px; font-size: 13px;
}
.collection-empty {
  color: var(--text-muted); padding: 24px;
}

/* ---- Detail backdrop blur layers ---- */
.detail-backdrop-blur {
  position: absolute; inset: -10%;
  width: 120%; height: 120%; object-fit: cover;
  filter: blur(28px) saturate(1.6) brightness(.7);
  opacity: .9; z-index: 0;
}
.detail-backdrop-main {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  z-index: 1;
}
.detail-hero .hero-overlay { z-index: 2; }
.detail-hero .back-btn { z-index: 3; }

/* ---- Videos gallery ---- */
.videos-row {
  display: flex; gap: 14px;
  overflow-x: auto; padding-bottom: 8px;
}
.video-thumb {
  width: 200px; flex-shrink: 0;
  cursor: pointer;
  border-radius: 8px;
  transition: transform var(--transition);
}
.video-thumb.is-focused { transform: scale(1.04); outline: 3px solid var(--accent); outline-offset: 2px; }
.video-thumb-img {
  position: relative;
  width: 100%; height: 112px;
  border-radius: 8px; overflow: hidden;
  background: var(--bg-2);
}
.video-thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.video-thumb-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  color: rgba(255,255,255,.85);
  text-shadow: 0 2px 12px rgba(0,0,0,.7);
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.45) 100%);
}
.video-thumb-name {
  font-size: 12px; font-weight: 600;
  margin-top: 6px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.video-thumb-type {
  font-size: 10px; color: var(--text-muted);
  margin-top: 2px;
}

/* ---- Video modal ---- */
.video-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .25s ease;
}
.video-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
}
.video-modal-card {
  position: relative; z-index: 1;
  width: min(960px, 92vw);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.video-modal-close {
  position: absolute; top: -50px; right: 0;
  padding: 8px 14px; font-size: 13px;
}
.video-modal-title {
  font-size: 16px; font-weight: 700;
  font-family: 'Fraunces', serif;
  margin-bottom: 12px;
}
.video-modal-card iframe {
  width: 100%; aspect-ratio: 16/9;
  border: 0; border-radius: 8px;
  background: #000;
}

/* ---- Reviews ---- */
.reviews-list {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;
  max-width: 900px;
}
.review-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.review-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
}
.review-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--text);
  overflow: hidden;
  flex-shrink: 0;
}
.review-avatar img { width: 100%; height: 100%; object-fit: cover; }
.review-author { font-size: 13px; font-weight: 700; }
.review-date { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.review-text {
  font-size: 12px; color: var(--text-dim);
  line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---- Player filters ---- */
.player-filters {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.player-filter-group { margin-bottom: 8px; }
.player-filter-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted); letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.player-filter-row {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.player-filter-row .pill {
  font-size: 10px; padding: 3px 8px;
}

/* ---- Player title ---- */
.player-title {
  position: absolute; top: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 13px; font-weight: 600;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
  padding: 6px 14px; border-radius: 999px;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.player-title-quality {
  font-family: ui-monospace, monospace;
  font-size: 10px; font-weight: 700;
  color: var(--accent);
  padding: 1px 6px; border-radius: 4px;
  background: rgba(255,255,255,.08);
}

/* ---- Detail favorite button ---- */
.btn.is-fav {
  background: oklch(0.65 0.20 25 / .15);
  color: oklch(0.78 0.20 25);
  border: 1px solid oklch(0.65 0.20 25 / .4);
}

/* ---- Onboarding modal ---- */
.onboarding-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .35s ease;
}
.onboarding-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(10px);
}
.onboarding-card {
  position: relative; z-index: 1;
  width: min(560px, 92vw);
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 36px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.onboarding-logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 30px; font-weight: 800;
  color: oklch(0.18 0.02 260);
  margin-bottom: 16px;
}
.onboarding-title {
  margin: 0 0 10px;
  font-size: 26px; line-height: 1.1;
}
.onboarding-text {
  font-size: 13px; line-height: 1.6;
  color: var(--text-dim);
  margin: 0 0 16px;
}
.onboarding-bullets {
  margin: 0 0 24px;
  padding-left: 18px;
  font-size: 12px; line-height: 1.7;
  color: var(--text-dim);
}
.onboarding-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.onboarding-actions .btn { padding: 10px 18px; font-size: 13px; }
