:root {
  --bg: #0f0f0f;
  --bg-elev: #181818;
  --bg-elev-2: #272727;
  --bg-glass: rgba(15, 15, 15, 0.95);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f1f1f1;
  --text-muted: #aaaaaa;
  --yt-red: #ff0033;
  --yt-red-hover: #cc0029;
  --yt-chip: #272727;
  --yt-chip-hover: #3f3f3f;
  --yt-blue: #3ea6ff;
  --nf-red: #ff0033;
  --nf-red-hover: #cc0029;
  --amber: #3ea6ff;
  --amber-hover: #65b8ff;
  --amber-soft: rgba(62, 166, 255, 0.16);
  --green: #2ba640;
  --blue: #3ea6ff;
  --red: #ff0033;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.72);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.muted-text {
  color: var(--text-muted);
  font-size: 0.86rem;
}

/* YouTube Header & Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 10px 18px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
}

.yt-corner-hero-pic {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid rgba(255, 255, 255, 0.78);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  transition: transform 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
}

.brand:hover .yt-corner-hero-pic {
  transform: scale(1.12);
  border-color: var(--yt-red);
}

.yt-play-logo {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 21px;
  border-radius: 6px;
  background: var(--yt-red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(255, 0, 51, 0.35);
  flex-shrink: 0;
}

.yt-wordmark {
  color: #fff;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.brand-text strong {
  display: block;
  font-size: 1.08rem;
  line-height: 1.15;
}

.brand-text small {
  display: block;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.yt-search-shell {
  flex: 1 1 340px;
  max-width: 620px;
  display: flex;
  align-items: stretch;
  background: #121212;
  border: 1px solid #303030;
  border-radius: 999px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.yt-search-shell:focus-within {
  border-color: var(--yt-blue);
}

.search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 16px;
  min-width: 0;
}

.search-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.94rem;
  min-width: 0;
}

.yt-search-submit-btn {
  display: inline-grid;
  place-items: center;
  width: 52px;
  background: #222222;
  border-left: 1px solid #303030;
  font-size: 0.95rem;
  color: var(--text);
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.yt-topbar-action-btn {
  background: var(--yt-chip);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.yt-topbar-action-btn:hover {
  background: var(--yt-chip-hover);
}

.yt-topbar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
}

.pipeline-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.82rem;
  cursor: pointer;
}

.pipeline-pill:hover {
  background: var(--yt-chip-hover);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.pulse-dot.active {
  background: var(--yt-red);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.25); }
}

.nav-tabs {
  max-width: 1560px;
  margin: 0 auto;
  padding: 4px 18px 10px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  background: var(--yt-chip);
  border: none;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}

.nav-tab:hover {
  background: var(--yt-chip-hover);
}

.nav-tab.active {
  color: #0f0f0f;
  background: #f1f1f1;
  font-weight: 700;
}

.tab-badge {
  background: rgba(255, 0, 51, 0.9);
  color: #fff;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  margin-left: 5px;
}

.nav-tab.active .tab-badge {
  background: var(--yt-red);
  color: #fff;
}

/* Main Layout */
.main-container {
  max-width: 1560px;
  margin: 0 auto;
  padding: 16px 18px calc(80px + env(safe-area-inset-bottom));
}

.section-block {
  margin-bottom: 28px;
}

.section-header h2 {
  margin: 0 0 12px;
  font-size: 1.18rem;
}

/* YouTube Channel Header Banner */
.yt-channel-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  background: linear-gradient(120deg, #181818 0%, #231115 55%, #161b22 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 18px;
}

.yt-channel-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 380px;
}

.yt-channel-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  flex-shrink: 0;
}

.yt-channel-meta {
  min-width: 0;
}

.yt-channel-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.yt-channel-meta h1 {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.yt-verified-badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  color: #0f0f0f;
  font-size: 0.7rem;
  font-weight: 900;
  flex-shrink: 0;
}

.yt-channel-sub {
  margin: 3px 0 4px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.yt-channel-desc {
  margin: 0;
  color: #cccccc;
  font-size: 0.86rem;
}

.yt-channel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* YouTube Category Chips & People Strip */
.yt-chip-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.yt-chip-strip::-webkit-scrollbar,
.yt-people-strip::-webkit-scrollbar {
  display: none;
}

.yt-people-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 14px;
  scrollbar-width: none;
}

.yt-person-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 11px 4px 5px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.yt-person-pill:hover {
  background: var(--bg-elev-2);
}

.yt-person-pill.active {
  background: #f1f1f1;
  color: #0f0f0f;
  border-color: #f1f1f1;
  font-weight: 700;
}

.yt-person-pill img,
.yt-person-pill-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  flex-shrink: 0;
}

.yt-person-pill-dot {
  display: inline-grid;
  place-items: center;
  background: var(--yt-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

/* Hero Banner (Home Feed Highlight Film) */
.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  background: linear-gradient(110deg, #181818 25%, #271016 72%, #181818 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-badge {
  display: inline-block;
  background: rgba(255, 0, 51, 0.18);
  color: #ff6b81;
  border: 1px solid rgba(255, 0, 51, 0.45);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.hero-info h1 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  line-height: 1.2;
}

.hero-info p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-chip {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.hero-thumb {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  cursor: pointer;
}

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

/* Horizontal Shelf Carousel */
.continue-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.continue-strip > * {
  flex: 0 0 275px;
  scroll-snap-align: start;
}

/* Catalog Toolbar & Filters */
.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-left h2 {
  margin: 0;
  font-size: 1.2rem;
}

.count-pill {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.toolbar-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.compact-input, .compact-select, .form-input, .form-textarea {
  background: #121212;
  border: 1px solid #303030;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.86rem;
  outline: none;
}

.compact-input:focus, .compact-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--yt-blue);
}

.full-width {
  width: 100%;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pill-btn {
  background: var(--yt-chip);
  border: none;
  color: var(--text);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.14s, color 0.14s;
}

.pill-btn:hover {
  background: var(--yt-chip-hover);
}

.pill-btn.active {
  background: #f1f1f1;
  color: #0f0f0f;
  font-weight: 700;
}

/* YouTube Video & Clip Cards Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 20px 16px;
}

.video-card {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 4px;
  display: flex;
  flex-direction: column;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.video-card:hover {
  background: #1c1c1c;
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.card-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
}

.card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.22s ease;
}

.video-card:hover .card-thumb-wrap img {
  transform: scale(1.03);
}

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.badge-top-left {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(15, 15, 15, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-bottom-right {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.84);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.resnap-card-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 15, 15, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--text);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0.92;
}

.resnap-card-btn:hover {
  border-color: var(--yt-blue);
  color: var(--yt-blue);
}

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

.progress-fill {
  height: 100%;
  background: var(--yt-red);
}

.card-body {
  padding: 10px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.yt-card-meta-layout {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.yt-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #272727;
  margin-top: 2px;
}

.yt-card-text-col {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.32;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title:hover {
  color: var(--yt-blue);
}

.yt-card-channel-line {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-notes {
  margin: 0;
  font-size: 0.79rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.mini-badge {
  font-size: 0.71rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.mini-badge.ready {
  color: #86efac;
  border-color: rgba(43, 166, 64, 0.45);
}

.mini-badge.pending {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.35);
}

/* Subview Directory Cards (People, Collections, Years) */
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.directory-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.directory-card:hover, .directory-card.active {
  border-color: var(--yt-blue);
  background: var(--bg-elev-2);
}

.directory-card strong {
  font-size: 0.98rem;
}

/* Search Overlay Panel */
.search-panel {
  max-width: 1560px;
  margin: 12px auto 0;
  padding: 0 18px 24px;
}

.search-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.search-scope-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scope-btn {
  background: var(--yt-chip);
  border: none;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
}

.scope-btn.active {
  background: #f1f1f1;
  color: #0f0f0f;
  font-weight: 700;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}

.search-hit-card {
  display: flex;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  text-align: left;
}

.search-hit-card:hover {
  border-color: var(--yt-blue);
}

.search-hit-thumb {
  width: 96px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #000;
}

.search-hit-body {
  min-width: 0;
  flex: 1;
}

.search-hit-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.ts-pill {
  background: var(--amber-soft);
  color: var(--yt-blue);
  border: 1px solid rgba(62, 166, 255, 0.35);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 0.74rem;
  font-weight: 600;
}

.search-snippet {
  font-size: 0.84rem;
  color: #d0d7e2;
  margin: 4px 0 0;
}

.search-snippet mark {
  background: rgba(62, 166, 255, 0.32);
  color: #fff;
  padding: 0 3px;
  border-radius: 3px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
  text-decoration: none;
}

.btn-sm { padding: 7px 14px; font-size: 0.84rem; }
.btn-xs { padding: 4px 10px; font-size: 0.76rem; }

.btn-yt-primary {
  background: var(--yt-red);
  color: #ffffff;
  font-weight: 700;
}
.btn-yt-primary:hover {
  background: var(--yt-red-hover);
}

.btn-netflix {
  background: #f1f1f1;
  color: #0f0f0f;
  font-weight: 700;
}
.btn-netflix:hover {
  background: #ffffff;
}

.btn-amber {
  background: var(--yt-blue);
  color: #0f0f0f;
}
.btn-amber:hover { background: var(--amber-hover); }

.btn-secondary {
  background: var(--bg-elev-2);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--yt-chip-hover); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.15); }

/* Player Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px;
}

.player-modal-shell {
  width: min(1440px, 100%);
  height: min(93vh, 930px);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.player-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #141414;
}

.player-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.yt-modal-corner-pic {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.player-title-group h2, .player-modal-header h3 {
  margin: 0;
  font-size: 1.04rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.era-badge {
  background: var(--amber-soft);
  color: var(--yt-blue);
  border: 1px solid rgba(62, 166, 255, 0.35);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  flex-shrink: 0;
}

.clip-trim-bar {
  background: #1f1f1f;
  border: 1px solid rgba(255, 0, 51, 0.35);
}

.clip-trim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.player-window-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.player-stage {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px;
  gap: 12px;
  border-right: 1px solid var(--border);
  min-height: 0;
  min-width: 0;
}

.video-frame-wrap {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: clamp(260px, 48vh, 520px);
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.video-frame-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.player-quick-actions,
.playlist-bar,
.inline-drawer,
.chapters-strip-wrap {
  flex-shrink: 0;
}

.resume-banner {
  position: absolute;
  left: 12px;
  bottom: 54px;
  background: rgba(11, 13, 18, 0.92);
  border: 1px solid var(--amber);
  border-radius: 999px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

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

.inline-drawer {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.clip-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.time-pair {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.time-pair label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.time-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 3px;
}

.time-box {
  width: 90px;
}

.strip-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.subtab-btn {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

.subtab-btn.active {
  border-color: var(--amber);
  color: var(--amber-hover);
}

.chapter-pills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chapter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.8rem;
  cursor: pointer;
}

.chapter-pill.active {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.chapter-pill-time {
  color: var(--amber-hover);
  font-weight: 600;
}

.contact-sheet-view img {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: crosshair;
}

/* Player Sidebar */
.player-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #141414;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
}

.sidebar-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 8px;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
}

.sidebar-tab.active {
  color: var(--amber-hover);
  border-bottom-color: var(--amber);
  font-weight: 600;
}

.sidebar-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px 14px;
}

.transcript-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.autoscroll-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.transcript-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
}

.transcript-line {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
}

.transcript-line:hover {
  background: rgba(255, 255, 255, 0.06);
}

.transcript-line.active {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.55);
}

.transcript-ts {
  color: var(--amber-hover);
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 48px;
}

.transcript-text {
  font-size: 0.86rem;
}

/* Editor Forms & Lists */
.editor-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.editor-form h3 {
  margin: 0;
  font-size: 0.98rem;
}

.editor-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-row {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

.picker-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.chip-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-toggle {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.chip-toggle.selected {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber-hover);
}

.inline-add-person {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

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

.editor-chapter-list-wrap h4 {
  margin: 14px 0 8px;
  font-size: 0.9rem;
}

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

.editor-chapter-item {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
}

.editor-chapter-thumb {
  width: 68px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: #06080c;
  flex-shrink: 0;
}

.editor-chapter-meta {
  flex: 1;
  min-width: 0;
}

.editor-chapter-meta strong {
  display: block;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Floating Mini-Dock */
.mini-dock {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(24, 24, 24, 0.96);
  border: 1px solid var(--yt-red);
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 32px);
}

.mini-dock video {
  width: 84px;
  height: 52px;
  border-radius: 6px;
  background: #000;
  object-fit: cover;
}

.mini-dock-info {
  min-width: 110px;
  max-width: 210px;
}

.mini-dock-info strong {
  display: block;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-dock-info small {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.mini-dock-actions {
  display: flex;
  gap: 6px;
}

/* Small Pipeline Modal */
.small-modal-card {
  width: min(580px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.pipeline-modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pipeline-status-box {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.88rem;
}

.pipeline-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(24, 24, 24, 0.96);
  border: 1px solid var(--yt-blue);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
}

/* Face Recognition & Cluster Labeling UI */
.person-card-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.person-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}

.person-avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber-hover);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.face-review-panel {
  margin-top: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.face-cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.face-cluster-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.face-samples-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
}

.face-samples-strip.expanded {
  flex-wrap: wrap;
  overflow-x: visible;
}

.face-sample-wrap {
  position: relative;
  width: 74px;
  height: 74px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid var(--border);
  overflow: hidden;
  background: #06080c;
  cursor: grab;
}

.face-sample-wrap:hover {
  border-color: var(--amber);
}

.face-sample-wrap.selected {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35);
}

.face-sample-btn {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: block;
}

.face-sample-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.face-check-btn {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(11, 13, 18, 0.78);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.face-sample-wrap.selected .face-check-btn {
  background: var(--amber);
  color: #0b0d12;
  border-color: var(--amber);
  font-weight: 700;
}

.face-ignore-x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(11, 13, 18, 0.78);
  color: #fca5a5;
  font-size: 0.7rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  opacity: 0.85;
}

.face-ignore-x:hover {
  background: var(--red);
  color: #fff;
  opacity: 1;
}

.face-sample-ts {
  position: absolute;
  right: 3px;
  bottom: 3px;
  background: rgba(11, 13, 18, 0.85);
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 4px;
  pointer-events: none;
}

.face-selection-bar {
  position: sticky;
  top: 96px;
  z-index: 25;
  background: rgba(20, 26, 40, 0.96);
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: var(--shadow);
}

.directory-card.drop-target {
  border-color: var(--amber);
  background: var(--amber-soft);
  transform: scale(1.02);
}

/* Cluster Focus Triage Modal */
.focus-modal-shell {
  width: min(1240px, 100%);
  height: min(90vh, 880px);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.focus-modal-toolbar {
  padding: 12px 16px;
  background: #141414;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.focus-modal-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  align-content: start;
}

.focus-face-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 2px solid var(--border);
  overflow: hidden;
  background: #06080c;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.focus-face-tile:hover {
  border-color: var(--amber);
  transform: translateY(-1px);
}

.focus-face-tile.selected {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.35);
}

.focus-face-tile.reject-hover:hover {
  border-color: var(--red);
}

.focus-face-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.focus-tile-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, rgba(5, 7, 11, 0.92));
  padding: 14px 6px 4px;
  font-size: 0.68rem;
  color: #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

/* Playlist Bar & Visual Chapter Cards */
.playlist-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.84rem;
}

.chapter-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
}

.chapter-visual-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: border-color 0.14s, transform 0.12s;
}

.chapter-visual-card:hover {
  border-color: var(--amber);
  transform: translateY(-1px);
}

.chapter-visual-card.active {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
}

.chapter-visual-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #06080c;
  width: 100%;
}

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

.chapter-visual-body {
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-visual-body strong {
  font-size: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Edit Mode & Clips Styling */
.edit-mode-pill {
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.edit-mode-pill.active {
  background: rgba(62, 166, 255, 0.16);
  border-color: var(--yt-blue);
  color: var(--yt-blue);
}

.edit-mode-banner {
  background: #181818;
  border: 1px solid rgba(62, 166, 255, 0.35);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.edit-banner-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.86rem;
}
.edit-banner-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

body:not(.edit-mode-on) .edit-only-block,
body:not(.edit-mode-on) #edit-mode-banner,
body:not(.edit-mode-on) .card-edit-bar,
body:not(.edit-mode-on) .chapter-card-actions,
body:not(.edit-mode-on) #pipeline-btn,
body:not(.edit-mode-on) .resnap-card-btn {
  display: none !important;
}

.card-edit-bar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.chapter-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.mini-badge.highlight {
  background: rgba(255, 0, 51, 0.18);
  color: #ff8095;
  border: 1px solid rgba(255, 0, 51, 0.42);
}
.mini-badge.unimportant {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}
.video-card.card-unimportant,
.chapter-visual-card.card-unimportant {
  opacity: 0.56;
}
.video-card.card-highlight,
.chapter-visual-card.card-highlight {
  border-color: rgba(255, 0, 51, 0.35);
}

/* Responsive Mobile / iOS Adjustments */
@media (max-width: 960px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
  .yt-channel-banner {
    padding: 14px 16px;
  }
  .yt-channel-avatar {
    width: 58px;
    height: 58px;
  }
  .yt-topbar-avatar {
    display: none;
  }
  .player-modal-shell {
    height: 96vh;
  }
  .player-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .player-stage {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 56vh;
  }
  .video-frame-wrap {
    height: 220px;
  }
}

/* Important Dates, Notifications Preview & Date Verification Log */
.dates-teaser {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.dates-teaser-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dates-teaser-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 280px;
}

.dates-teaser-right {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.date-teaser-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.date-teaser-chip:hover {
  border-color: var(--amber);
}

.dates-hero-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.dates-control-card,
.phone-notif-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.phone-notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.phone-lock-toast {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
}

.phone-toast-app {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: #93c5fd;
  margin-bottom: 4px;
  font-weight: 700;
}

.phone-toast-meta {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}

.dates-window-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.dates-bucket-stage {
  margin-bottom: 24px;
}

.subsection-heading {
  margin: 0 0 10px 0;
  font-size: 1rem;
  color: var(--text);
}

.milestone-banner-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.milestone-highlight-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.dates-subblock {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.add-imp-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
}

.important-dates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
}

.important-date-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.imp-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.imp-card-date {
  color: var(--amber);
  font-size: 0.9rem;
  font-weight: 600;
}

.imp-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.date-obs-list {
  display: grid;
  gap: 10px;
}

.date-obs-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.date-obs-row.obs-dismissed {
  opacity: 0.5;
}

.obs-main {
  flex: 1 1 420px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.obs-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.src-pill,
.ver-pill,
.pill-tag,
.obs-date-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.src-tr {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.src-ocr {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.ver-ok {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.ver-pend {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.ver-no {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.obs-date-chip {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.pill-amber {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.pill-blue {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}

.obs-title-line {
  font-size: 0.94rem;
}

.obs-evidence {
  font-size: 0.85rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: 8px;
  border-left: 3px solid rgba(245, 158, 11, 0.45);
}

.obs-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.empty-inline-card {
  padding: 18px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px dashed var(--border);
  color: var(--muted);
}

@media (max-width: 960px) {
  .dates-hero-grid {
    grid-template-columns: 1fr;
  }
}

/* Organized Story Shelves & Parent-Friendly Ages Badges */
.clips-story-shelves {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

.story-shelf-block {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}

.story-shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.story-shelf-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.shelf-mini-card {
  flex: 0 0 218px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.shelf-mini-card:hover {
  transform: translateY(-2px);
  border-color: var(--amber);
}

.shelf-thumb-box {
  position: relative;
  height: 124px;
  background: #000;
}

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

.shelf-card-info {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.shelf-card-info strong {
  font-size: 0.86rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shelf-age-line {
  font-size: 0.74rem;
  color: #fcd34d;
  font-weight: 600;
}

.mini-badge.ages-pill {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.mini-badge.home-pill {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.32);
}

body:not(.edit-mode-on) .dates-hero-grid {
  grid-template-columns: 1fr;
}

.tape-faces-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.curation-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

/* iOS 17 & 18 PWA Safe Areas + Role Visibility */
.topbar {
  padding-top: env(safe-area-inset-top, 0px);
}

main.main-shell,
.main-content {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

body.role-viewer .admin-only-block {
  display: none !important;
}

/* User Profile Pill & Dropdown */
.user-menu-wrap {
  position: relative;
}

.user-profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f4f4f5;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
}

.user-profile-pill:hover {
  border-color: var(--amber);
  background: rgba(255, 255, 255, 0.11);
}

.user-profile-pill img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-pill-caret {
  font-size: 0.72rem;
  opacity: 0.75;
}

.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 265px;
  background: #181a20;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
  padding: 10px;
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-menu-header {
  display: flex;
  flex-direction: column;
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--border);
}

.user-menu-stats {
  font-size: 0.76rem;
  color: #cbd5e1;
  padding: 6px 8px;
}

.user-menu-item {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #f4f4f5;
  padding: 9px 10px;
  font-size: 0.86rem;
  cursor: pointer;
}

.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.user-menu-item.danger {
  color: #fca5a5;
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 10px;
}

/* Per-user Favorite / Watch Later / Watched badges */
.user-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn.user-active-fav {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fda4af;
}

.btn.user-active-wl {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}

.btn.user-active-watched,
.mini-badge.watched-pill {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
}

/* Family Profile Picker & PIN Lock Overlay */
.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: radial-gradient(circle at top, #1f1b2e 0%, #0b0c10 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
}

.auth-gate-overlay.hidden {
  display: none !important;
}

.auth-gate-card {
  width: min(520px, 100%);
  background: rgba(22, 24, 31, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72);
  text-align: center;
}

.auth-gate-brand h1 {
  margin: 8px 0 4px;
  font-size: 1.6rem;
}

.auth-gate-logo {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--amber);
}

.auth-profiles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.auth-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.auth-profile-card:hover,
.auth-profile-card:active {
  transform: translateY(-2px);
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
}

.auth-profile-card img,
.auth-profile-emoji {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.22);
}

.auth-profile-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.08);
}

.auth-pin-panel {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.auth-selected-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-selected-who {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.auth-selected-who img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.auth-pin-input {
  width: 100%;
  max-width: 240px;
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.35em;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0d0f14;
  color: #fff;
}

.auth-keypad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  gap: 10px;
  justify-content: center;
}

.auth-key {
  height: 54px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-key:active {
  background: rgba(245, 158, 11, 0.25);
}

.auth-key-alt {
  font-size: 0.88rem;
  color: #cbd5e1;
}

.auth-error-msg {
  color: #fca5a5;
  background: rgba(220, 38, 38, 0.14);
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.86rem;
  width: 100%;
}

.quick-edit-modal-card {
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}

.quick-edit-form-body {
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.editor-form input,
.editor-form select,
.editor-form textarea,
.inline-add-person input,
.time-input-group input {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Comprehensive Mobile & iPhone 17 / 18 Responsive Layout */
@media (max-width: 960px) {
  .modal-backdrop {
    padding: 0;
  }

  .player-modal-shell {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .player-modal-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  }

  .player-title-group {
    flex: 1 1 100%;
    min-width: 0;
  }

  .player-title-group h2 {
    font-size: 0.96rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .player-window-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .player-layout {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .player-stage {
    overflow: visible;
    max-height: none;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .video-frame-wrap {
    height: clamp(195px, 28dvh, 270px);
  }

  .player-sidebar {
    overflow: visible;
    flex: none;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .sidebar-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #141414;
  }

  .sidebar-pane {
    overflow: visible;
    padding: 12px;
  }

  .strip-subtabs {
    flex-wrap: wrap;
  }

  .small-modal-card {
    width: calc(100vw - 16px) !important;
    max-height: 92dvh;
    border-radius: 16px;
  }
}

@media (max-width: 680px) {
  .hide-on-mobile {
    display: none !important;
  }

  .topbar-inner {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .brand {
    flex: 1 1 auto;
  }

  .brand-text small {
    display: none;
  }

  .yt-search-shell {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
  }

  .topbar-right {
    gap: 6px;
  }

  .yt-topbar-action-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .nav-tabs {
    padding: 4px 12px 8px;
  }

  .form-row-2 {
    grid-template-columns: 1fr !important;
  }

  .time-input-group {
    flex-wrap: wrap;
  }

  .time-box {
    width: auto;
    flex: 1 1 100px;
  }

  .inline-add-person {
    flex-wrap: wrap;
  }

  .inline-add-person input {
    flex: 1 1 160px;
  }

  .chip-toggle {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.84rem;
  }

  /* Prevent iOS Safari auto-zoom on form inputs (<16px) */
  input,
  select,
  textarea {
    font-size: 16px !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  .chapter-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}





