/* ── Custom properties ─────────────────────────────────────────────────── */
:root {
  --bg:        #0a0a0a;
  --surface:   #141414;
  --surface2:  #1c1c1c;
  --border:    rgba(255,255,255,0.12);
  --accent:    #9cddff;
  --text:      #e8e8e8;
  --muted:     rgba(255,255,255,0.45);
  --danger:    #e86f51;
  --success:   #7cbd65;
  --tag-height: 1.75rem;
  --sidebar-w: 260px;
  --radius:    8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

/* ── Reset / base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; font: inherit; }

/* ── Auth screen ───────────────────────────────────────────────────────── */
#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 2rem;
}
#auth-screen[hidden] { display: none; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.auth-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}

.auth-sub {
  color: var(--muted);
  margin-bottom: 2rem;
}

.btn-signin {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 500;
  padding: 0.65rem 1.5rem;
  border-radius: 6px;
  border: none;
  transition: opacity 0.15s;
}
.btn-signin:hover { opacity: 0.9; }

.btn-passkey {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 0.7rem 1.5rem;
  margin-bottom: 0.6rem;
  background: var(--accent);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  transition: opacity 0.15s;
}
.btn-passkey:hover { opacity: 0.9; }
.btn-passkey[hidden] { display: none; }

.btn-signin-secondary {
  width: 100%;
  justify-content: center;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}

.auth-status {
  min-height: 1.1em;
  margin: 0.2rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.passkey-prompt {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 92vw;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.9rem;
}
.passkey-prompt[hidden] { display: none; }
.passkey-prompt-msg { color: var(--text); }
.btn-passkey-sm {
  padding: 0.4rem 0.9rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}
.passkey-prompt-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}
.passkey-prompt-status {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ── App layout ────────────────────────────────────────────────────────── */
#app:not([hidden]) {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

#app.sidebar-collapsed {
  grid-template-columns: 56px 1fr;
  --sidebar-w: 56px;
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
#sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.875rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
}

.sidebar-collapsed .sidebar-logo { display: none; }

/* Sync row */
.sync-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
}

.btn-sync {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: 13px;
  transition: background 0.15s;
  flex-shrink: 0;
}
.btn-sync:hover { background: rgba(156,221,255,0.1); }

.sync-label { }
.sidebar-collapsed .sync-label { display: none; }

.sync-spinning #sync-icon {
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sync-status {
  font-size: 11px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-collapsed .sync-status { display: none; }

/* Sidebar sections */
.sidebar-section {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.875rem 0.375rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.sidebar-collapsed .sidebar-section-header { display: none; }
button.sidebar-section-header.collapsible {
  background: none; border: none; cursor: pointer; width: 100%;
}
button.sidebar-section-header.collapsible svg {
  transition: transform 0.15s;
  flex-shrink: 0;
}
button.sidebar-section-header.collapsible[aria-expanded="true"] svg { transform: rotate(180deg); }
.video-meta-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.video-tag-count { font-size: 10px; color: var(--muted); white-space: nowrap; }


/* ── Tag panel ─────────────────────────────────────────────────────────── */
#tag-panel {
  padding: 0.25rem 0.625rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.sidebar-collapsed #tag-panel { display: none; }
#tag-panel[hidden] { display: none; }

.tag-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: var(--tag-height);
  padding: 0 0.6rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s, opacity 0.12s;
  color: var(--text);
}
.tag-filter-pill:hover { opacity: 0.8; }
.tag-filter-pill.active { background: rgba(255,255,255,0.12); }
.tag-filter-pill .clock-icon { opacity: 0.7; font-style: normal; }

/* ── Saved filter list ─────────────────────────────────────────────────── */
.filter-list { padding: 0.25rem 0; }
.filter-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.875rem;
}
.filter-list .filter-name {
  flex: 1;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filter-list .filter-name:hover { color: var(--accent); }
.filter-list .filter-del { color: var(--muted); background: none; border: none; font-size: 13px; line-height: 1; padding: 0 2px; }
.filter-list .filter-del:hover { color: var(--danger); }
.sidebar-collapsed .filter-list { display: none; }

/* ── Channel list ──────────────────────────────────────────────────────── */
.channel-list { padding: 0.25rem 0; }

.channel-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0.375rem 0.875rem;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.1s;
  position: relative;
}
.channel-item:hover { background: rgba(255,255,255,0.05); }
.channel-item.active { background: rgba(156,221,255,0.1); }

.channel-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}
.channel-thumb-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.channel-info { flex: 1; min-width: 0; }
.channel-title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-count {
  font-size: 11px;
  color: var(--muted);
}

.sidebar-collapsed .channel-info { display: none; }
.sidebar-collapsed .channel-item { justify-content: center; padding: 0.5rem; }

/* ── Main area ─────────────────────────────────────────────────────────── */
#main {
  min-width: 0;
  padding: 1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Filter bar ────────────────────────────────────────────────────────── */
#filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.625rem;
  font: inherit;
  font-size: 13px;
  width: 180px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }

.sort-select, .tag-mode-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.player-group-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  max-width: 160px;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 0.35rem 0.625rem;
  font-size: 13px;
  transition: color 0.12s, border-color 0.12s;
}
.btn-ghost:hover { color: var(--text); border-color: rgba(255,255,255,0.3); }
.btn-ghost.small { font-size: 12px; padding: 0.25rem 0.5rem; }

/* Active filter pills (in bar) */
.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: var(--tag-height);
  padding: 0 0.5rem 0 0.7rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid;
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.active-filter-pill .pill-remove {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
}
.active-filter-pill .pill-remove:hover { color: var(--danger); }

/* ── Video grid ────────────────────────────────────────────────────────── */
#video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.video-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.22);
}

.video-thumb-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--surface2);
  overflow: hidden;
}
.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.duration-badge {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

.video-body { padding: 0.6rem 0.7rem; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.video-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-channel { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-date { font-size: 11px; color: var(--muted); }
.video-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ── Tag pill (on cards and player) ───────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 1.4rem;
  padding: 0 0.45rem 0 0.55rem;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1.5px solid currentColor;
  color: var(--text);
  background: transparent;
  max-width: 150px;
  overflow: hidden;
}
.tag-pill .tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.tag-pill .clock-icon { font-style: normal; opacity: 0.75; flex-shrink: 0; margin-right: 3px; }
.tag-pill .pill-x {
  flex-shrink: 0;
  background: none;
  border: none;
  color: inherit;
  padding: 0 0 0 4px;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s;
}
.tag-pill:hover .pill-x { opacity: 0.7; }
.tag-pill .pill-x:hover { opacity: 1; color: var(--error); }

/* ── Load more ─────────────────────────────────────────────────────────── */
#load-more-row { display: flex; justify-content: center; padding: 1rem 0; }
.btn-load-more {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 2rem;
  font: inherit;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-load-more:hover { background: var(--surface2); border-color: rgba(255,255,255,0.25); }

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* ── Player overlay ────────────────────────────────────────────────────── */
#player-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#player-overlay:not([hidden]) {
  display: flex;
}

.player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.player-modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  width: 100%;
  height: 100dvh;
  max-width: 100%;
  max-height: 100dvh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  display: flex;
  flex-direction: column;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.player-controls-spacer { flex: 1; }
.player-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.player-ctrl-btn:hover { color: var(--text); border-color: rgba(255,255,255,0.25); }

/* ── Player toggle switches ──────────────────────────────────────────────────── */
.player-toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.12s;
}
.player-toggle-switch:hover { color: var(--text); }
.player-toggle-switch input[type="checkbox"] { display: none; }
.toggle-track {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.toggle-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.player-toggle-switch input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.player-toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(12px);
  background: #fff;
}
.toggle-text { white-space: nowrap; }

.player-embed-wrap {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: #000;
  overflow: hidden;
}
.player-embed-wrap iframe,
.player-embed-wrap #yt-player,
.player-embed-wrap #yt-player > div,
.player-embed-wrap #yt-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.player-info {
  padding: 1rem 1.125rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.player-title { font-size: 1rem; font-weight: 600; line-height: 1.35; }
.player-meta { display: flex; gap: 1rem; align-items: center; color: var(--muted); font-size: 13px; }
.player-channel { font-weight: 500; }
.player-theme { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(156,221,255,0.12); color: var(--accent); border: 1px solid rgba(156,221,255,0.25); }

.player-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.player-tags[hidden] { display: none; }

.player-tag-input-row { margin-top: 4px; }
.tag-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.35rem 0.625rem;
  font: inherit;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
.tag-input:focus { border-color: var(--accent); }
.tag-input::placeholder { color: var(--muted); }

/* ── Utility buttons ───────────────────────────────────────────────────── */
.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  transition: color 0.12s, background 0.12s;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.icon-btn.small { width: 22px; height: 22px; font-size: 15px; }

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Mobile / tablet collapse ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #app {
    grid-template-columns: 56px 1fr;
  }
  #sidebar {
    width: 56px;
  }
  .sidebar-logo { display: none; }
  .sync-label { display: none; }
  .sync-status { display: none; }
  .sidebar-section-header { display: none; }
  #tag-panel { display: none; }
  .filter-list { display: none; }
  .channel-info { display: none; }
  .channel-item { justify-content: center; padding: 0.5rem; }
  #video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .search-input { width: 120px; }
}

/* ── Profile tabs ──────────────────────────────────────────────────────────── */
#profile-tabs {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
#profile-tabs::-webkit-scrollbar { display: none; }

.profile-tab {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.profile-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(156,221,255,0.08);
}
.profile-tab.liked { color: #f87171; }
.profile-tab.liked.active { border-color: #f87171; background: rgba(248,113,113,0.08); }

/* ── Discover panel ────────────────────────────────────────────────────────── */
#discover-panel {
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding-top: 8px;
}

.section-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  width: 100%;
}
.section-header[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.discover-card {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 8px 12px;
  align-items: flex-start;
}
.discover-card:hover { background: rgba(255,255,255,0.04); }

.discover-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.discover-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.discover-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-desc {
  font-size: 11px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-subscribe {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 4px;
  align-self: flex-start;
}
.btn-subscribe.subscribed {
  border-color: var(--muted);
  color: var(--muted);
  cursor: default;
}

/* ── Filter badge ──────────────────────────────────────────────────────────── */
.filter-badge {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
}


/* ── YT Player fill ────────────────────────────────────────────────────────── */
.player-embed-wrap #yt-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.player-embed-wrap #yt-player iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ── History note ──────────────────────────────────────────────────────────── */
.history-note {
  font-size: 13px;
  color: var(--muted);
  padding: 0.5rem 0;
  font-style: italic;
}

/* ── Recents bar ───────────────────────────────────────────────────────────── */
#recents-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
#recents-bar[hidden] { display: none; }
.recent-card {
  flex: 0 0 auto;
  width: 180px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  transition: border-color 0.15s;
}
.recent-card:hover { border-color: var(--accent); }
.recent-card-body {
  display: flex;
  gap: 8px;
  padding: 5px 7px;
  align-items: center;
  min-width: 0;
}
.recent-thumb {
  width: 60px;
  height: 34px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: #000;
}
.recent-info { min-width: 0; flex: 1; }
.recent-title {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.recent-channel {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-progress-track {
  height: 2px;
  background: var(--border);
}
.recent-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.5s linear;
}

/* ── Suggestions bar ───────────────────────────────────────────────────────── */
#suggestions-bar {
  display: flex;
  gap: 8px;
  padding: 4px 12px 6px;
  background: rgba(156,221,255,0.04);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  align-items: center;
}
#suggestions-bar[hidden] { display: none; }
#suggestions-bar::before {
  content: '✦';
  font-size: 10px;
  color: var(--accent);
  flex-shrink: 0;
  opacity: 0.7;
}
.suggestion-card {
  flex: 0 0 auto;
  width: 160px;
  display: flex;
  gap: 6px;
  align-items: center;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s;
}
.suggestion-card:hover { border-color: var(--accent); }
.suggestion-thumb {
  width: 52px;
  height: 29px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: #000;
}
.suggestion-title {
  font-size: 10px;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  min-width: 0;
}

/* ── Player tags toggle ────────────────────────────────────────────────────── */
.player-tags-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 3px 0;
  width: 100%;
}
.player-tags-toggle[hidden] { display: none; }
.player-tags-toggle svg { transition: transform 0.15s; }
.player-tags-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.player-tags-toggle[aria-expanded="true"] { color: var(--text); }

/* ── Like button active state ──────────────────────────────────────────────── */
#like-btn.liked { color: #f87171; border-color: #f87171; }

/* ── Update available button ───────────────────────────────────────────────── */
.update-available {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  animation: pulse-accent 2s ease-in-out infinite;
}
@keyframes pulse-accent {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Duration select uses .sort-select styling ───────────────────────────────── */

/* ── Group edit modal ────────────────────────────────────────────────────────── */
#group-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
#group-edit-modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}
.modal-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  width: 360px;
  max-width: calc(100vw - 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.modal-box h3 { margin: 0; font-size: 15px; font-weight: 600; }
#group-edit-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; }
.group-edit-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
}
.group-edit-tag.exclude { opacity: 0.65; }
.group-edit-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0 1px;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
}
.group-edit-tag button:hover { opacity: 1; }
.group-edit-add { display: flex; gap: 6px; }
.group-edit-add .tag-input { flex: 1; min-width: 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

/* ── Profile tab edit button ──────────────────────────────────────────────────── */
.profile-tab-edit {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  margin-right: 6px;
  margin-left: -6px;
  opacity: 0.4;
  transition: opacity 0.1s;
  border-radius: 4px;
}
.profile-tab-edit:hover { opacity: 1; background: rgba(255,255,255,0.08); }

/* ── Toast notification ──────────────────────────────────────────────────────── */
.tuber-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 300;
  pointer-events: none;
  animation: tuber-toast-in 0.2s ease, tuber-toast-out 0.3s ease 1.5s forwards;
}
@keyframes tuber-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%); }
}
@keyframes tuber-toast-out { to { opacity: 0; } }
#update-btn[hidden], #sidebar-update-btn[hidden] { display: none; }
#filter-panel[hidden] { display: none; }
.filter-panel-actions { padding: 4px 0 6px; }
.filter-panel-actions .btn-ghost { font-size: 11px; }
