:root {
  --bg-app: #0b0e14;
  --bg-main: #0b0e14;
  --bg-sidebar: #101522;
  --bg-surface: #171e2e;
  --bg-surface-hover: #1f283d;
  --bg-card: #151b2a;
  --bg-card-hover: #1e263c;
  --border-subtle: #242d42;
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg-app: #f4f6fa;
  --bg-main: #f4f6fa;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #eef2f6;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-subtle: #e2e8f0;
  --border-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.15);

  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.12);
  --warning: #d97706;
  --danger: #dc2626;
}

[data-theme="light"] .watch-navbar,
[data-theme="light"] .header,
[data-theme="light"] .sidebar,
[data-theme="light"] .topbar {
  background-color: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .topbar {
  background-color: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .topbar-search,
[data-theme="light"] .custom-select,
[data-theme="light"] .topbar-btn,
[data-theme="light"] .system-capsule,
[data-theme="light"] .topbar-utility-group,
[data-theme="light"] .card-tick-btn,
[data-theme="light"] .btn-card-download,
[data-theme="light"] .btn-card-restart,
[data-theme="light"] .sidebar-action-btn.secondary {
  background-color: #ffffff;
  border-color: #e2e8f0;
  color: #1e293b;
}

[data-theme="light"] .topbar-search:focus-within {
  border-color: #2563eb;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

[data-theme="light"] .topbar-btn:hover,
[data-theme="light"] .capsule-btn:hover,
[data-theme="light"] .topbar-utility-group .topbar-icon-btn:hover,
[data-theme="light"] .card-tick-btn:hover,
[data-theme="light"] .btn-card-download:hover,
[data-theme="light"] .btn-card-restart:hover,
[data-theme="light"] .sidebar-action-btn.secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

[data-theme="light"] .btn-card-download {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .btn-card-download:hover {
  background-color: #ffffff;
  border-color: #2563eb;
  color: #2563eb;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.15);
}

[data-theme="light"] .topbar-btn.warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

[data-theme="light"] .topbar-btn.warning:hover {
  background-color: #fef3c7;
  border-color: #f59e0b;
}

[data-theme="light"] .topbar-divider,
[data-theme="light"] .capsule-sep {
  background-color: #e2e8f0;
}

[data-theme="light"] .drive-pill.connected {
  color: #059669;
}

[data-theme="light"] .drive-pill.disconnected {
  color: #d97706;
}

[data-theme="light"] .queue-btn {
  color: #2563eb;
}

[data-theme="light"] .queue-btn.running {
  color: #dc2626;
  background-color: #fef2f2;
}

[data-theme="light"] .reset-btn:hover {
  color: #d97706;
  background-color: #fffbeb;
}

[data-theme="light"] .topbar-icon-btn.danger:hover {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

[data-theme="light"] .card-tick-btn.completed {
  background-color: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}

[data-theme="light"] .btn-card-watch {
  background-color: #2563eb;
  color: #ffffff;
}

[data-theme="light"] .btn-card-watch:hover {
  background-color: #1d4ed8;
}

[data-theme="light"] .playlist-card,
[data-theme="light"] .video-card {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
  background-color: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .video-card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  border-color: #93c5fd;
}

[data-theme="light"] .category-hero {
  background: linear-gradient(180deg, #eef2f6 0%, rgba(244, 246, 250, 0) 100%);
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .hero-stat-box {
  background-color: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .thumb-container,
[data-theme="light"] .playlist-thumb {
  background-color: #e2e8f0;
}

[data-theme="light"] .nav-item.active {
  background-color: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

[data-theme="light"] .nav-badge {
  background: rgba(0, 0, 0, 0.06);
  color: #475569;
}

[data-theme="light"] .nav-item.active .nav-badge {
  background: #bfdbfe;
  color: #1e40af;
}

[data-theme="light"] .cat-pill {
  background: #dbeafe;
  color: #1d4ed8;
}

[data-theme="light"] .player-quick-tools-bar {
  background-color: #f1f5f9;
  border-color: #e2e8f0;
}

[data-theme="light"] .player-quick-tools-bar .tools-label {
  color: #334155;
}

[data-theme="light"] .tool-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
}

[data-theme="light"] .tool-pill:hover,
[data-theme="light"] .tool-pill.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

[data-theme="light"] .tool-btn {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .tool-btn:hover {
  background: #eef2f6;
  border-color: #2563eb;
}

[data-theme="light"] .player-study-console {
  background-color: #ffffff;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .logs-drawer-body {
  background-color: #f8fafc;
  color: #334155;
}

[data-theme="light"] .logs-drawer {
  background-color: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .ai-msg.model {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .ai-msg.user {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #0f172a;
}

[data-theme="light"] .note-ts-tag {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

[data-theme="light"] .note-ts-tag:hover {
  background: #2563eb;
  color: #ffffff;
}



[data-theme="light"] .modal-backdrop {
  background-color: rgba(15, 23, 42, 0.45);
}

[data-theme="light"] .modal-dialog,
[data-theme="light"] .player-theater-wrapper,
[data-theme="light"] .login-card {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .login-overlay {
  background: radial-gradient(circle at center, #ffffff 0%, #e2e8f0 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 30;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-emoji {
  font-size: 1.75rem;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.sidebar-action-box {
  padding: 0.5rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  width: 100%;
}

.sidebar-action-btn.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sidebar-action-btn.primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.sidebar-action-btn.secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.sidebar-action-btn.secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-nav-section {
  padding: 0.5rem 1.25rem;
  flex-grow: 1;
  overflow-y: auto;
}

.section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.category-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
}

.nav-item-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-cat-icon {
  font-size: 0.85rem;
  opacity: 0.75;
}

.nav-cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

.nav-item.active {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  color: #3b82f6;
}

.nav-item.active .nav-cat-icon {
  color: #3b82f6;
  opacity: 1;
}

.nav-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.nav-item.active .nav-badge {
  background: rgba(59, 130, 246, 0.25);
  color: #60a5fa;
}

/* Sidebar Stats Widget */
.sidebar-stats-widget {
  margin: 1rem 1.25rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.stats-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.stats-counter {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.35rem 0 0.5rem;
  color: var(--text-main);
}

.progress-bar-track {
  height: 6px;
  background: var(--bg-app);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-thumb {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.stats-note {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  text-align: right;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.75rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.user-pill:hover {
  background: var(--bg-surface);
}

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.user-info {
  flex-grow: 1;
  overflow: hidden;
}
.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  display: block;
}
.user-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: block;
}

.settings-gear {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-app);
}

/* ========================================== */
/* Topbar & Header Navigation System          */
/* ========================================== */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.75rem;
  min-height: 64px;
  background-color: rgba(16, 21, 34, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 1rem;
}

/* Search & Filter Cluster */
.topbar-search-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  max-width: 520px;
}

.topbar-search {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.45rem 1rem;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbar-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background-color: var(--bg-card);
}

.search-icon {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.topbar-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  margin-left: 0.6rem;
  width: 100%;
}

.topbar-search input::placeholder {
  color: var(--text-dim);
}

.topbar-filter-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  pointer-events: none;
}

.custom-select {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.45rem 1rem 0.45rem 2.1rem;
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.custom-select:hover, .custom-select:focus {
  border-color: var(--accent);
}

/* Actions & Control Clusters */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.topbar-action-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.topbar-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.topbar-btn.warning {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.topbar-btn.warning:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
}

.topbar-btn.active {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: #f59e0b !important;
  color: #d97706 !important;
}

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

.topbar-btn.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Subtle Install App Ghost Pill */
#installAppBtn {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: var(--accent);
}

#installAppBtn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border-subtle);
  margin: 0 0.15rem;
}

/* Cloud & Queue Capsule (Unified Pill - Zero Internal Borders) */
.system-capsule {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 3px 6px;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .system-capsule {
  background: #ffffff;
  border-color: #e2e8f0;
}

.system-capsule button,
.system-capsule .capsule-btn,
.system-capsule .drive-pill,
.system-capsule .queue-btn,
.system-capsule .reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  white-space: nowrap;
}

.system-capsule button:hover,
.system-capsule .capsule-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="light"] .system-capsule button:hover,
[data-theme="light"] .system-capsule .capsule-btn:hover {
  background: #f1f5f9 !important;
}

.system-capsule .capsule-sep {
  width: 1px;
  height: 14px;
  background: var(--border-subtle);
  margin: 0 2px;
}

.system-capsule .drive-pill .status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.system-capsule .drive-pill.connected {
  color: #10b981 !important;
}

[data-theme="light"] .system-capsule .drive-pill.connected {
  color: #059669 !important;
}

.system-capsule .drive-pill.connected .status-indicator {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.system-capsule .drive-pill.disconnected {
  color: #f59e0b !important;
}

.system-capsule .drive-pill.disconnected .status-indicator {
  background: #f59e0b;
}

.system-capsule .queue-btn {
  color: #60a5fa !important;
}

[data-theme="light"] .system-capsule .queue-btn {
  color: #2563eb !important;
}

.system-capsule .queue-btn:hover {
  background: rgba(59, 130, 246, 0.12) !important;
}

.system-capsule .queue-btn.running {
  color: #f87171 !important;
}

[data-theme="light"] .system-capsule .queue-btn.running {
  color: #dc2626 !important;
}

.system-capsule .queue-btn.running:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

.system-capsule .reset-btn {
  padding: 0.35rem 0.55rem;
  color: var(--text-muted);
}

.system-capsule .reset-btn:hover {
  color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.15) !important;
}

/* Utilities Group (Unified Modern Capsule) */
.topbar-utility-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 2px 4px;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topbar-utility-group .topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.topbar-utility-group .topbar-icon-btn:hover {
  background: var(--bg-surface-hover) !important;
  color: var(--text-main);
}

.topbar-utility-group .topbar-icon-btn.danger:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12) !important;
}

/* Category Hero Banner */
.category-hero {
  padding: 2.25rem 2.5rem;
  background: linear-gradient(180deg, rgba(23, 30, 46, 0.8) 0%, rgba(11, 14, 20, 0) 100%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
}

.hero-content h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hero-stats {
  display: flex;
  gap: 1.25rem;
}

.hero-stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  min-width: 110px;
  text-align: center;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  display: block;
}
.stat-green { color: var(--success); }
.stat-blue { color: var(--accent); }

.stat-text {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 0.25rem;
  display: block;
}

/* Video Grid Container */
.video-grid-container {
  padding: 2rem 2.5rem 5rem;
  flex-grow: 1;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
}

/* Video Card */
.video-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.video-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.6);
}

.video-card.completed {
  border-color: rgba(16, 185, 129, 0.35);
}

.thumb-container {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #090c13;
  cursor: pointer;
  overflow: hidden;
}

.thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.thumb-container:hover .thumb-image {
  transform: scale(1.05);
}

.play-hover-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  opacity: 0.9;
}

.thumb-container:hover .play-hover-btn {
  transform: translate(-50%, -50%) scale(1.1);
  background-color: var(--accent);
  opacity: 1;
}

.class-num-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.status-tag {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.status-tag.ready { background: rgba(16, 185, 129, 0.9); color: white; }
.status-tag.pending { background: rgba(245, 158, 11, 0.9); color: white; }
.status-tag.downloading { background: rgba(59, 130, 246, 0.9); color: white; }
.status-tag.uploading { background: rgba(139, 92, 246, 0.9); color: white; }
.status-tag.failed { background: rgba(239, 68, 68, 0.9); color: white; }

.completed-watermark {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--success);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.card-details {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-meta-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.card-title {
  font-size: 0.925rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap !important;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  gap: 0.5rem;
}

.card-tick-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-tick-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
  background: var(--bg-surface-hover);
}

.card-tick-btn.completed {
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10b981;
}

.card-actions-cluster {
  display: flex;
  align-items: center;
  flex-wrap: nowrap !important;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-card-watch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: var(--accent);
  color: #ffffff;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px var(--accent-glow);
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-card-watch:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-card-download {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  text-decoration: none;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
}

.btn-card-download:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-card-download i {
  font-size: 0.82rem;
}

.btn-card-restart {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.32rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-card-restart:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-card-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-card-action.edit {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}

.btn-card-action.edit:hover {
  background: rgba(245, 158, 11, 0.2);
}

.btn-card-action.delete {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.btn-card-action.delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding: 1.75rem;
  z-index: 101;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  margin: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h3 { font-size: 1.25rem; font-weight: 700; }

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.15s;
}
.close-modal-btn:hover { color: var(--text-main); }

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}
.req { color: var(--danger); }

.form-group input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
}
.form-group input:focus {
  border-color: var(--accent);
}

.form-hint {
  font-size: 0.725rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
  display: block;
}

.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-surface);
}
.dropzone:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.dropzone-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* Player Theater Modal */
.player-theater-wrapper {
  position: relative;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 95%;
  max-width: 1100px;
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
  padding: 1.5rem;
  z-index: 101;
  display: flex;
  flex-direction: column;
  margin: auto;
  -webkit-overflow-scrolling: touch;
}

.player-top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.player-title-col {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.cat-pill {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.player-title-col h2 {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.complete-toggle-btn {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.complete-toggle-btn.completed {
  background: var(--success-bg);
  border-color: var(--success);
  color: #34d399;
}

.player-stage {
  aspect-ratio: 16 / 9;
  width: 100%;
  min-height: 240px;
  max-height: 55vh;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plyr-container, .iframe-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.plyr-container .plyr,
.plyr-container .plyr__video-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
}

.plyr-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.player-bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.player-meta-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

#playerIndexIndicator {
  font-size: 0.85rem;
  font-weight: 600;
}

.hotkeys-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ========================================== */
/* Platform Global Button System              */
/* ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-decoration: none;
  font-family: inherit;
  outline: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-block {
  width: 100%;
  display: flex;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

[data-theme="light"] .btn-secondary:hover {
  background: #f8fafc;
  border-color: #2563eb;
  color: #2563eb;
}

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  color: #f59e0b;
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* ========================================== */
/* Login Overlay & Card Redesign              */
/* ========================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(19, 25, 41, 0.95) 0%, rgba(8, 10, 16, 0.98) 100%);
  backdrop-filter: blur(12px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

[data-theme="light"] .login-overlay {
  background: radial-gradient(circle at center, #ffffff 0%, #f1f5f9 100%);
}

.login-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .login-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #6366f1, #8b5cf6);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--accent);
}

.login-brand h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-card .form-group {
  margin-bottom: 1.25rem;
}

.login-card .form-group label {
  display: block;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.login-card .form-group input {
  height: 44px;
  font-size: 0.95rem;
  border-radius: 10px;
  padding: 0 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  width: 100%;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

[data-theme="light"] .login-card .form-group input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.login-card .form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-card .btn-primary {
  height: 46px;
  font-size: 0.95rem;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.error-msg {
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

/* Activity Console Drawer */
.logs-drawer {
  position: fixed;
  bottom: 0;
  right: 2rem;
  width: 460px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.7);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
}

.logs-drawer.collapsed {
  transform: translateY(calc(100% - 46px));
}

.logs-drawer-header {
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.logs-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.logs-drawer-body {
  height: 240px;
  overflow-y: auto;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  background-color: #080a10;
  color: #94a3b8;
}

.log-line {
  margin-bottom: 0.35rem;
  word-break: break-all;
}

.accordion-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.box-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.or-divider {
  text-align: center;
  position: relative;
  margin: 1.25rem 0;
}
.or-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-subtle);
}
.or-divider span {
  position: relative;
  background: var(--bg-sidebar);
  padding: 0 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 700;
}

.connected-badge-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--success-bg);
  border: 1px solid var(--success);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
}
.badge-icon {
  font-size: 1.25rem;
  color: var(--success);
}

.empty-state {
  text-align: center;
  padding: 5rem 1rem;
  grid-column: 1 / -1;
  color: var(--text-muted);
}
.empty-illustration {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}
.empty-state h3 {
  font-size: 1.35rem;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}
.empty-state button {
  margin-top: 1.5rem;
}

/* Form Grid & Large Modal */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.modal-dialog-large {
  max-width: 580px;
}

.custom-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  resize: vertical;
  min-height: 85px;
  line-height: 1.5;
}
.custom-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
}

/* Mobile Sidebar & Controls */
.mobile-menu-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 1.25rem;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.mobile-menu-btn:hover {
  background: var(--bg-surface-hover);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
}
.sidebar-backdrop.active {
  display: block;
}

/* ========================================== */
/* Mobile Responsive Breakpoints              */
/* ========================================== */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .topbar {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .topbar-search-cluster {
    order: 3;
    width: 100%;
    max-width: 100%;
    margin-top: 0.25rem;
    gap: 0.45rem;
  }

  .topbar-search {
    flex: 1;
    min-width: 160px;
  }

  .topbar-actions {
    margin-left: auto;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .topbar-divider {
    display: none;
  }

  .category-hero {
    padding: 1.5rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .hero-stats {
    width: 100%;
    justify-content: space-between;
  }

  .hero-stat-box {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.5rem;
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }

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

  .player-modal {
    padding: 0;
  }

  .player-theater-wrapper {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  .player-stage {
    min-height: 240px;
  }

  .player-top-header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .player-controls-right {
    width: 100%;
    justify-content: space-between;
  }

  .player-bottom-bar {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .logs-drawer {
    width: 100%;
    right: 0;
    left: 0;
    border-radius: 0;
  }

  .modal-dialog {
    margin: 1rem;
    width: calc(100% - 2rem);
  }
}

/* ========================================== */
/* Advanced Player Tools & Theater Sizing     */
/* ========================================== */
.player-theater-wrapper.wide-theater {
  max-width: 95vw;
  width: 95vw;
}

.player-quick-tools-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.25rem;
  background-color: #0d121d;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
  flex-wrap: wrap;
}

.tools-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tools-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.speed-pill-group {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-surface);
  padding: 0.2rem;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
}

.tool-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s;
}

.tool-pill:hover {
  color: var(--text-main);
}

.tool-pill.active {
  background: var(--accent);
  color: #fff;
}

.tool-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.tool-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
}

/* ========================================== */
/* Study Console: Notes & AI Tutor Tabs       */
/* ========================================== */
.player-study-console {
  background-color: #0b0f19;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.study-tabs-nav {
  display: flex;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.study-tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.study-tab-btn:hover {
  color: var(--text-main);
}

.study-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: rgba(59, 130, 246, 0.06);
}

.tab-badge {
  background: var(--border-subtle);
  color: var(--text-main);
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
}

.study-tab-content {
  padding: 1rem 1.25rem;
  max-height: 280px;
  overflow-y: auto;
}

/* Notes Section */
.notes-composer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.composer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.composer-input-row {
  display: flex;
  gap: 0.5rem;
}

.composer-input-row input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  color: var(--text-main);
  font-size: 0.85rem;
}

.composer-input-row input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.notes-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.note-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.note-item:hover {
  border-color: var(--accent);
}

.note-left {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex: 1;
}

.note-ts-tag {
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.4);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.note-ts-tag:hover {
  background: var(--accent);
  color: #fff;
}

.note-content-text {
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.5;
  word-break: break-word;
}

.note-del-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.1rem;
}

.note-del-btn:hover {
  color: var(--danger);
}

.empty-notes-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 1.5rem 0;
}

/* Gemini AI Chat Section */
.ai-prompt-chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.6rem;
  margin-bottom: 0.75rem;
}

.chip-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
  border-color: var(--accent);
}

.ai-chat-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 190px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  padding-right: 0.25rem;
}

.ai-msg {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.5;
}

.ai-msg.model {
  background: #111827;
  border: 1px solid #1f293d;
}

.ai-msg.user {
  background: #1a2235;
  border: 1px solid #283552;
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.ai-msg-body {
  flex: 1;
}

.ai-msg-body strong {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.ai-composer-form {
  display: flex;
  gap: 0.5rem;
}

.ai-composer-form input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  color: var(--text-main);
  font-size: 0.85rem;
}

.ai-composer-form input:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Favicon Emoji Presets */
.emoji-preset-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.preset-emoji-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-emoji-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ========================================== */
/* Dedicated Full-Page Watch View             */
/* ========================================== */
.watch-page-body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.watch-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.watch-nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.watch-nav-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  flex-grow: 1;
}

.watch-nav-center h1 {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.watch-nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1750px;
  margin: 0 auto;
  width: 100%;
  flex-grow: 1;
}

.watch-layout.cinema-wide {
  grid-template-columns: 1fr;
}

.watch-primary-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.watch-stage-wrapper {
  background-color: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: 72vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.watch-primary-col .player-top-header {
  background-color: var(--bg-card);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.watch-secondary-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.playlist-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 7rem);
  max-height: calc(100vh - 7rem);
  position: sticky;
  top: 5rem;
}

.playlist-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.playlist-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.playlist-title-row h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.playlist-search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  color: var(--text-main);
  font-size: 0.8rem;
}

.playlist-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.playlist-items-scroll {
  overflow-y: auto;
  flex-grow: 1;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  -webkit-overflow-scrolling: touch;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
}

.playlist-item:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
}

.playlist-item.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
}

.playlist-thumb {
  width: 82px;
  height: 46px;
  border-radius: 4px;
  object-fit: cover;
  background: #090c13;
  flex-shrink: 0;
}

.playlist-item-meta {
  flex-grow: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.playlist-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 1024px) {
  .watch-layout {
    grid-template-columns: 1fr;
    padding: 1rem;
  }
  .playlist-card {
    height: 480px;
    max-height: 480px;
    position: static;
  }
  .watch-navbar {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
  }
  .watch-nav-center {
    order: 3;
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* Font Awesome Global Polish */
i.fa-solid, i.fa-regular, i.fa-brands {
  display: inline-block;
  line-height: 1;
}

.btn i, .pill-btn i, .tool-btn i {
  font-size: 0.9em;
}

.brand-badge i {
  font-size: 2.2rem;
  color: var(--accent);
}

.logo-emoji i {
  font-size: 1.4rem;
  color: var(--accent);
}

.empty-illustration i {
  font-size: 3.5rem;
  color: var(--text-dim);
}

.dropzone-icon i {
  font-size: 2.2rem;
  color: var(--accent);
}

.avatar-circle i {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.ai-msg-avatar i {
  font-size: 1.15rem;
  color: var(--accent);
}

.ai-msg.user .ai-msg-avatar i {
  color: var(--text-main);
}

/* ========================================== */
/* Edit Mode & Card Management Controls       */
/* ========================================== */

.card-edit-action {
  display: none !important;
}

body.edit-mode-active .card-edit-action {
  display: inline-flex !important;
}

body.edit-mode-active .video-card {
  border: 1px dashed rgba(245, 158, 11, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15) !important;
}

.edit-mode-banner {
  display: none;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-weight: 500;
  gap: 1rem;
}

body.edit-mode-active .edit-mode-banner {
  display: flex !important;
}

/* Card Download Button */
.card-download-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
}

.card-download-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}


