/* modals.css — modals, popovers, dialogs, and overlays */
/* ---------- menus / modals ---------- */
.menu {
  position: fixed; z-index: 1800 !important; min-width: 208px; max-height: 70vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 4px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.65), 0 0 0 1px var(--line2); animation: pop2 .12s ease-out;
}
@keyframes pop2 { from { opacity: 0; transform: scale(.97); } }
.menu-i {
  display: block; width: 100%; text-align: left; padding: 7px 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--tx); cursor: pointer; font-size: 12.8px; white-space: nowrap;
}
.menu-i:hover { background: var(--panel2); }
.menu-i.danger { color: var(--err); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ---------- sync header popover dropdown ---------- */
.sync-popover {
  position: fixed;
  z-index: 1700 !important;
  width: 340px;
  max-width: calc(100vw - 20px);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: 0 20px 48px rgba(0,0,0,0.65), 0 0 0 1px var(--line2);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pop2 .14s cubic-bezier(0.16, 1, 0.3, 1);
}
.sync-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line2);
}
.sync-popover-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tx);
  display: flex;
  align-items: center;
  gap: 7px;
}
.sync-popover-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: .02em;
}
.sync-popover-pill.ok {
  background: rgba(16, 185, 129, 0.16);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.sync-popover-pill.syncing {
  background: rgba(34, 211, 238, 0.16);
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.35);
}
.sync-popover-pill.err {
  background: rgba(239, 68, 68, 0.16);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.sync-popover-pill.local {
  background: rgba(148, 163, 184, 0.16);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.sync-quota-card {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sync-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.sync-quota-lbl {
  color: var(--tx2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sync-quota-val {
  font-weight: 650;
  color: var(--tx);
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
}
.sync-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--panel3);
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}

.sync-limits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}
.sync-limit-item {
  background: color-mix(in srgb, var(--panel) 60%, transparent);
  border: 1px solid var(--line2);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sync-limit-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--tx);
  font-family: var(--font-mono, monospace);
}
.sync-limit-num.highlight-ok {
  color: #10b981;
}
.sync-limit-sub {
  font-size: 9.5px;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 600;
}
.sync-limit-mini {
  font-size: 9px;
  color: var(--tx3);
  font-family: var(--font-mono, monospace);
  opacity: 0.88;
  margin-top: 1px;
}

.sync-popover-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sync-popover-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--r2);
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--tx);
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
}
.sync-popover-btn:hover {
  background: var(--panel3);
  border-color: var(--line);
  transform: translateY(-1px);
}
.sync-popover-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.sync-popover-btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, #fff);
}
.backdrop {
  position: fixed; inset: 0; z-index: 2500 !important; background: rgba(3,6,14,.82); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s ease;
}
.backdrop.in { opacity: 1; }
.modal {
  width: min(560px, 100%); max-height: 86dvh; display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(12px) scale(.96); opacity: 0; transition: transform .22s cubic-bezier(0.16, 1, 0.3, 1), opacity .22s ease;
  will-change: transform, opacity; z-index: 2501 !important;
}
.backdrop.in .modal { transform: translateY(0) scale(1); opacity: 1; }
.modal.md { width: min(680px, 100%); } .modal.lg { width: min(760px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 1rem; }
.modal-b { padding: 15px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 15px; border-top: 1px solid var(--line); }
.confirm-msg { margin: 0; font-size: 13.5px; color: var(--tx2); }
.dlg { display: flex; flex-direction: column; gap: 11px; }
.opt-list { display: flex; flex-direction: column; gap: 6px; }
.opt {
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg2); color: var(--tx);
}
.opt:hover { border-color: var(--line2); }
.opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.opt span { font-size: 11.5px; }
/* settings rows: a real switch, never a squashed native checkbox */
.opt.toggle {
  flex-direction: row; align-items: center; justify-content: space-between; gap: 16px;
  padding: 11px 13px; background: var(--bg2);
}
.opt.toggle > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.opt.toggle strong { font-size: 13px; font-weight: 600; }
.opt.toggle span { font-size: 11.5px; line-height: 1.35; }
.opt.toggle input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 40px; height: 23px; flex: none; margin: 0; cursor: pointer; position: relative;
  background: var(--panel3); border: 1px solid var(--line2); border-radius: 999px;
  transition: background .16s, border-color .16s;
}
.opt.toggle input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4);
  transition: transform .16s;
}
.opt.toggle input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.opt.toggle input[type="checkbox"]:checked::after { transform: translateX(17px); }
/* ---------- Shelf / Playlist Move Dialogs & Cards ---------- */
.shelf-move-dlg {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dlg-header-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dhs-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--tx);
}
.dhs-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.dlg-filter-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--tx);
  outline: none;
  transition: border-color .15s;
}
.dlg-filter-input:focus {
  border-color: var(--accent);
}
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  width: 100%;
  max-height: 52dvh;
  overflow-y: auto;
  padding: 2px;
}
@media (max-width: 520px) {
  .shelf-grid {
    grid-template-columns: 1fr;
  }
}
.shelf-pick-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  color: var(--tx);
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
  min-height: 64px;
}
.shelf-pick-card:hover {
  transform: translateY(-2px);
  border-color: var(--c, var(--accent)) !important;
  background: color-mix(in srgb, var(--c, var(--accent)) 10%, var(--bg2));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}
.shelf-pick-card.current {
  border-color: var(--c, var(--accent)) !important;
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--bg2));
  box-shadow: 0 0 0 1px var(--c, var(--accent));
}
.spc-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: none;
  transition: transform .15s ease;
}
.shelf-pick-card:hover .spc-icon-wrap {
  transform: scale(1.08);
}
.spc-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.spc-name {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spc-count {
  font-size: 11.5px;
  color: var(--muted);
}
.spc-current-chip {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--accent)) 25%, transparent);
  color: var(--tx);
  font-weight: 600;
  flex: none;
}
.spc-edit-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  opacity: 0.55;
  transition: opacity .15s, background .15s, transform .15s;
  flex: none;
  cursor: pointer;
}
.spc-edit-btn:hover {
  opacity: 1;
  background: var(--panel2);
  transform: scale(1.12);
}
.dlg-foot-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* Shelf Editor Dialog */
.shelf-edit-dlg {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.shelf-emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}
.shelf-emoji-row button.on {
  background: var(--accent);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--accent);
}
.shelf-dlg-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* Selection Bar Shelf Selector */
.selbar-shelf-select {
  height: 30px;
  background: var(--bg2);
  color: var(--tx);
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 170px;
  transition: border-color .15s, background .15s;
}
.selbar-shelf-select:hover {
  border-color: var(--accent);
  background: var(--panel2);
}

/* Header Toolbar Shelf Selector */
.tb-sel-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 3px 8px;
  border-radius: 9px;
  animation: pop2 .14s ease-out;
}
.tb-shelf-select {
  height: 28px;
  background: var(--panel);
  color: var(--tx);
  border: 1px solid var(--line2);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.tb-shelf-select:hover {
  border-color: var(--accent);
}

/* Collapsible Shelves on Home */
.sec.collapsed .nook-shelf-container,
.sec.collapsed .nook-shelf-plain,
.sec.collapsed .vrow,
.sec.collapsed .seeall {
  display: none !important;
}
.sec.collapsed {
  margin-bottom: 6px !important;
}
.sec-collapse-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, color .15s, background .15s;
  user-select: none;
}
.sec-collapse-btn:hover {
  color: var(--tx);
  background: var(--bg2);
}
.sec.collapsed .sec-collapse-btn {
  transform: rotate(-90deg);
}
.sec-collapsed-pill {
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.sec-collapsed-pill:hover {
  color: var(--tx);
  border-color: var(--line2);
}
.sec-edit-shelf-btn {
  padding: 0 8px;
  font-size: 11.5px;
}
.home-shelf-footer {
  display: flex;
  justify-content: center;
  margin: 18px 0 28px 0;
}

/* Video Card Done Badge & Chip */
.vcard-done-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(16, 185, 129, 0.92);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: all .16s ease;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.vcard-done-badge:hover {
  background: #ef4444;
  color: #fff;
  transform: scale(1.05);
}
.chip-done {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #10b981 !important;
  font-weight: 600;
}
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 27px; height: 27px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.sw.on { border-color: var(--tx); transform: scale(1.08); }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; min-height: 22px; }


/* ---------- drag and drop backup restore overlay ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  display: grid; place-items: center; pointer-events: none;
  animation: pageFadeIn .15s ease-out;
}
.drop-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 48px 64px;
  background: var(--panel);
  border: 2px dashed var(--accent);
  border-radius: var(--r);
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
  text-align: center;
  transform: scale(1.02);
  transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.drop-ico { font-size: 52px; }
.drop-title { font-size: 18px; font-weight: 700; color: var(--tx); }
.drop-sub { font-size: 13px; color: var(--muted); }
.pb-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 0 6px; white-space: nowrap; font-weight: 500; }
.pb-prog { width: 160px; height: 6px; border-radius: 4px; background: var(--panel3); cursor: pointer; position: relative; }
.pb-prog i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .25s linear; position: relative; }
.pb-prog i::after {
  content: ''; position: absolute; right: -4px; top: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 6px var(--accent); opacity: 0; transition: opacity .15s;
}
.pb-prog:hover i::after { opacity: 1; }

/* Miniplayer default: docked floating player in bottom-right corner */
.yt-stage {
  position: fixed; z-index: 300; right: 18px; bottom: calc(var(--player) + 14px);
  width: 360px; height: 202px; max-width: calc(100vw - 36px); background: #000;
  border-radius: var(--r); overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--line2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: width .22s cubic-bezier(0.16, 1, 0.3, 1),
              height .22s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius .22s ease,
              transform .18s ease;
  cursor: pointer;
}
.yt-stage:hover {
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--accent);
}
.yt-player-box {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 86; background: #000;
}
.yt-stage iframe, .yt-mount, .media-el, .yt-player-box iframe, .yt-player-box .yt-mount, .yt-player-box .media-el {
  width: 100% !important; height: 100% !important; border: 0 !important;
  display: block !important; background: #000;
}

/* Theater / Cinema Study Mode fills the screen distraction-free */
body.player-expanded .topbar,
body.player-expanded .statusbar,
body.player-expanded .sidebar,
body.player-expanded .main,
body.player-expanded .mobile-nav {
  display: none !important;
}

body.player-expanded .yt-stage {
  position: fixed !important;
  inset: 0 0 var(--player, 62px) 0 !important;
  left: 0 !important; top: 0 !important; right: 0 !important; bottom: var(--player, 62px) !important;
  width: 100vw !important; height: calc(100vh - var(--player, 62px)) !important; border-radius: 0 !important;
  box-shadow: none !important; cursor: default;
  display: flex !important; flex-direction: row !important; align-items: stretch !important;
  background: #08090d !important;
  overflow: hidden !important;
  z-index: 500 !important;
}

body.player-expanded .playerbar {
  z-index: 520 !important;
}

/* Ambient backlight glow */
.stage-ambient-glow {
  position: absolute; inset: -30px; pointer-events: none; z-index: 84;
  background: radial-gradient(circle at 45% 50%, color-mix(in srgb, var(--accent) 15%, transparent) 0%, transparent 68%);
  filter: blur(54px); opacity: 0.85; transition: opacity .3s ease;
}
body:not(.player-expanded) .stage-ambient-glow { display: none; }

/* In expanded mode, media takes remaining space */
body.player-expanded .yt-player-box {
  flex: 1; min-width: 0; height: 100%; position: relative; z-index: 86;
  display: flex; align-items: center; justify-content: center;
}

@media (max-width: 600px) {
  .yt-stage {
    width: calc(100vw - 24px); right: 12px; height: calc((100vw - 24px) * 9 / 16);
  }
}

/* Cinema Mode floating top controls */
.stage-overlay-bar {
  position: absolute; top: 12px; left: 16px; right: 16px; height: 48px;
  display: flex; align-items: center; gap: 10px; z-index: 510 !important; pointer-events: auto;
  background: rgba(14, 18, 30, 0.92); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px; padding: 0 14px; box-shadow: 0 12px 36px rgba(0,0,0,0.65);
}
.stage-overlay-bar.mini {
  top: 8px; right: 8px; left: auto; height: 32px; padding: 0 8px;
  background: rgba(11, 15, 26, 0.9); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border-radius: 8px; border: 1px solid var(--line2);
  gap: 6px; opacity: 0; transition: opacity .18s ease; z-index: 510 !important;
}
.yt-stage:hover .stage-overlay-bar.mini {
  opacity: 1;
}

/* On desktop with study drawer open, keep overlay bar cleanly over video area */
@media (min-width: 861px) {
  .yt-stage:has(.stage-study-drawer:not(.hidden)) .stage-overlay-bar,
  .yt-stage.drawer-open .stage-overlay-bar {
    right: calc(380px + 16px) !important;
  }
}

.stage-overlay-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stage-overlay-title { font-size: 13.5px; font-weight: 650; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.stage-overlay-sub { font-size: 11.5px; color: var(--muted, #94a3b8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stage-back-btn, .stage-close-btn, .stage-cc-btn {
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--tx); font-size: 12px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  transition: all .15s ease;
}
.stage-back-btn:hover {
  background: rgba(255, 255, 255, 0.16); border-color: var(--accent); color: #fff;
}
.stage-close-btn:hover {
  background: rgba(239, 68, 68, 0.18); border-color: #ef4444; color: #ef4444;
}
.stage-cc-btn.on {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  border-color: var(--accent); color: var(--accent);
}

/* Quick Speed & Action Pills in Cinema Mode */
.stage-pills-group {
  display: flex; align-items: center; gap: 5px;
}
.stage-pill-btn {
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); color: var(--tx2);
  border-radius: 6px; padding: 4px 8px; font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease;
}
.stage-pill-btn:hover {
  background: rgba(255, 255, 255, 0.14); color: #fff; border-color: rgba(255, 255, 255, 0.25);
}
.stage-pill-btn.active {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  border-color: var(--accent); color: var(--accent);
}

/* Side Study Drawer (Notes + Up Next) */
.stage-study-drawer {
  width: 380px; max-width: 92vw; height: 100%; background: var(--panel, #0f1420);
  border-left: 1px solid var(--line2); display: flex; flex-direction: column;
  z-index: 505 !important; position: relative; padding-top: 14px; flex: none;
  box-shadow: -8px 0 28px rgba(0,0,0,0.45);
}
body:not(.player-expanded) .stage-study-drawer { display: none !important; }
.stage-study-drawer.hidden { display: none !important; }

@media (max-width: 860px) {
  body.player-expanded .stage-study-drawer {
    position: absolute; right: 0; top: 0; bottom: 0; width: 340px; z-index: 515 !important;
    padding-top: 66px !important;
  }
}

.stage-drawer-tabs {
  display: flex; border-bottom: 1px solid var(--line); padding: 0 14px; gap: 4px;
  background: var(--panel2, #141a29);
}
.stage-drawer-tab {
  padding: 10px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  border: none; background: transparent; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}
.stage-drawer-tab:hover { color: var(--tx); }
.stage-drawer-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.stage-drawer-content {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px;
}

/* Quick inline note capture in drawer */
.stage-quick-note {
  display: flex; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.stage-quick-note-input {
  flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 7px 11px; font-size: 12.5px; color: var(--tx);
  outline: none;
}
.stage-quick-note-input:focus { border-color: var(--accent); }

/* Queue items in drawer */
.stage-queue-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--r-sm);
  background: var(--panel2); border: 1px solid transparent; cursor: pointer;
  transition: all 0.15s ease;
}
.stage-queue-item:hover { border-color: var(--line2); background: var(--hover); }
.stage-queue-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.stage-queue-thumb { width: 54px; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; flex: none; }
.stage-queue-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stage-queue-title { font-size: 12px; font-weight: 550; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-queue-sub { font-size: 11px; color: var(--muted); }

.media-wrap { width: 100%; height: 100%; display: grid; place-items: center; }
.audio-el { display: none; }
.audio-wrap { background: linear-gradient(135deg, var(--bg), var(--panel)); flex-direction: column; gap: 14px; }
.audio-card { display: flex; align-items: center; gap: 14px; padding: 20px; max-width: 520px; }
.audio-thumb { width: 108px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; }
.audio-title { font-weight: 650; margin-bottom: 3px; }
.audio-sub { font-size: 12px; color: var(--muted); }
body.focus-mode .sidebar, body.focus-mode .topbar, body.focus-mode .statusbar, body.focus-mode .main { display: none; }
body.focus-mode .yt-stage { left: 0; top: 0; }
.stage-cc-btn, .stage-speed-btn {
  background: var(--panel2); border: 1px solid var(--line2); color: var(--tx); font-size: 12px; cursor: pointer; padding: 4px 9px; border-radius: 6px; display: inline-flex; align-items: center; gap: 5px; font-weight: 600;
}
.stage-cc-btn:hover, .stage-speed-btn:hover { background: var(--panel3); border-color: var(--accent); }
.stage-cc-btn.on { background: rgba(34, 211, 238, 0.2); border-color: #22d3ee; color: #22d3ee; }


/* ---------- keyboard shortcut sheet ---------- */
.sc-grid { display: grid; gap: 2px; }
.sc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 8px; border-radius: 7px; min-width: 0;
}
.sc-row:nth-child(odd) { background: color-mix(in srgb, var(--panel) 60%, transparent); }
.sc-row kbd {
  flex: none; min-width: 116px; text-align: center;
  font: 600 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 2px 7px; border-radius: 6px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--tx);
  white-space: nowrap;
}
.sc-d { font-size: 12.5px; color: var(--tx2); min-width: 0; }
@media (max-width: 480px) {
  .sc-row kbd { min-width: 96px; font-size: 10.5px; }
  .sc-d { font-size: 11.5px; }
}


/* ---------- Media Downloader & Yoinks Modal ---------- */
.dl-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  width: 100%;
}
.dl-video-preview {
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  align-items: center;
}
.dl-thumb {
  width: 120px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #0f172a;
}
.dl-thumb-placeholder {
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  font-size: 24px;
}
.dl-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dl-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dl-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  color: #94a3b8;
}
.dl-author {
  color: #cbd5e1;
  font-weight: 500;
}
.dl-dot {
  opacity: 0.5;
}
.dl-pill {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.dl-tabs-bar {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}
.dl-tab {
  background: none;
  border: 1px solid transparent;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dl-tab:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.04);
}
.dl-tab.on {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

.dl-tab-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 140px;
}

.dl-format-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 520px) {
  .dl-format-grid {
    grid-template-columns: 1fr;
  }
}
.dl-format-card {
  padding: 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dl-format-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}
.dl-format-card.selected {
  background: rgba(16, 185, 129, 0.08);
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}
.dl-fc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dl-fc-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}
.dl-format-card.selected .dl-fc-badge {
  background: #10b981;
  color: #042f2e;
}
.dl-fc-check {
  font-size: 13px;
  font-weight: bold;
  color: #10b981;
}
.dl-fc-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
}
.dl-fc-sub {
  font-size: 11px;
  color: #94a3b8;
}

.dl-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
@media (max-width: 520px) {
  .dl-action-row {
    grid-template-columns: 1fr;
  }
}
.dl-btn-device {
  background: #10b981 !important;
  color: #042f2e !important;
  font-weight: 600 !important;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
}
.dl-btn-device:hover {
  background: #059669 !important;
}
.dl-btn-vault {
  background: rgba(14, 165, 233, 0.14) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(14, 165, 233, 0.3) !important;
  font-weight: 600 !important;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 8px;
}
.dl-btn-vault:hover {
  background: rgba(14, 165, 233, 0.22) !important;
  border-color: #38bdf8 !important;
}

.dl-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 10px;
  color: #94a3b8;
  font-size: 12.5px;
}
.dl-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(16, 185, 129, 0.2);
  border-top-color: #10b981;
  border-radius: 50%;
  animation: dlSpin 0.7s linear infinite;
}
@keyframes dlSpin {
  to { transform: rotate(360deg); }
}

/* CLI Yoinks Section */
.dl-cli-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dl-cli-desc {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
}
.dl-cli-desc strong {
  color: #10b981;
}
.dl-cli-desc code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
  color: #38bdf8;
}
.dl-code-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #0b0f19;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 10px 12px;
}
.dl-code-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dl-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.dl-code-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #38bdf8;
  white-space: nowrap;
  overflow-x: auto;
  flex: 1;
  padding: 2px 0;
}
.dl-copy-btn {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.15s ease;
}
.dl-copy-btn:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #10b981;
}
.dl-copy-btn.copied {
  background: #10b981;
  border-color: #10b981;
  color: #042f2e;
  font-weight: 600;
}
.dl-cli-foot {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
  margin-top: 2px;
}
.dl-cli-foot code {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Progress Box */
.dl-progress-box {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  margin-top: 4px;
}
.dl-progress-box.active {
  display: flex;
}
.dl-progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.dl-p-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.dl-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
}
.dl-p-text {
  color: #cbd5e1;
  font-weight: 500;
}
.dl-p-sub {
  color: #10b981;
  font-weight: 700;
}
.dl-done-row, .dl-err-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* Card quick download button */
.vcard-quick-dl {
  background: none;
  border: none;
  color: var(--tx-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.vcard-quick-dl:hover {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

/* Batch Download Dialog */
.batch-dl-dlg {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.batch-dl-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 8px 10px;
}
.batch-dl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
}
.batch-dl-bullet {
  color: #10b981;
}
.batch-dl-item-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

