/* ===========================================
   klx.ink — Monolith
   =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&display=swap');

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

:root {
  --bg:         #060608;
  --bg-raised:  #0c0d13;
  --bg-card:    #111218;
  --bg-hover:   #181921;
  --border:     #1c1d28;
  --border-light: #282938;
  --text:       #eef0f6;
  --text-muted: #7c7d8c;
  --text-dim:   #6e6f7e;
  --accent:     #00ffb3;
  --accent-dim: #00cc8f;
  --accent-glow: rgba(0, 255, 179, 0.10);
  --accent-strong: rgba(0, 255, 179, 0.18);
  --success:    #34d399;
  --danger:     #f87171;
  --danger-dim: #dc2626;
  --radius:     4px;
  --radius-lg:  8px;
  --font:       'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Subtle grid texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.018;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 64px 64px;
}

a { color: var(--text); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent); }

img, video { max-width: 100%; display: block; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.main-content { flex: 1; padding: 44px 0; position: relative; z-index: 1; }

/* ----- Navbar ----- */
.navbar {
  background: rgba(6, 6, 8, 0.92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 24px;
}

.nav-brand {
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
  text-transform: lowercase;
}
.nav-brand span { color: var(--accent); }

.nav-links { display: flex; gap: 2px; align-items: center; }

.nav-link {
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav-link:hover { color: var(--text); background: var(--bg-hover); }

/* ----- Footer ----- */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--text-dim);
  font-size: 0.75rem;
  position: relative;
  z-index: 1;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-copy { flex-shrink: 0; }
.footer-links {
  display: flex;
  gap: 18px;
}
.footer-links a {
  color: var(--text-dim);
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-links a:hover { color: var(--text); }

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #060608;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-dim);
  color: #060608;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border-light);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.25);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-full { width: 100%; }

/* ----- Typography ----- */
.page-header { margin-bottom: 36px; }
.page-header h1 {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.6px;
  margin-bottom: 4px;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ----- Static Pages ----- */
.static-page { max-width: 680px; padding: 20px 0 60px; }
.static-page h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
}
.static-page h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 10px;
  color: var(--text);
}
.static-page h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 6px;
}
.static-page p { margin-bottom: 12px; line-height: 1.65; color: var(--text-muted); }
.static-page ul { margin: 8px 0 16px 20px; color: var(--text-muted); line-height: 1.7; }
.static-page li { margin-bottom: 4px; }
.static-page code {
  background: var(--bg-card);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.static-page a { color: var(--accent); }
.static-page a:hover { text-decoration: underline; }
.static-date { color: var(--text-dim); font-size: 0.8125rem; margin-bottom: 24px; }

/* ----- Breadcrumb ----- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span[aria-hidden] { color: var(--border-light); user-select: none; }

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

.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  position: relative;
}

.video-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  color: var(--text);
}

/* Staggered entrance */
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.video-card {
  animation: card-in 0.4s ease both;
}
.video-card:nth-child(1)  { animation-delay: 0.01s; }
.video-card:nth-child(2)  { animation-delay: 0.04s; }
.video-card:nth-child(3)  { animation-delay: 0.07s; }
.video-card:nth-child(4)  { animation-delay: 0.10s; }
.video-card:nth-child(5)  { animation-delay: 0.13s; }
.video-card:nth-child(6)  { animation-delay: 0.16s; }
.video-card:nth-child(7)  { animation-delay: 0.19s; }
.video-card:nth-child(8)  { animation-delay: 0.22s; }
.video-card:nth-child(9)  { animation-delay: 0.25s; }
.video-card:nth-child(10) { animation-delay: 0.28s; }
.video-card:nth-child(11) { animation-delay: 0.31s; }
.video-card:nth-child(12) { animation-delay: 0.34s; }

.video-thumbnail {
  aspect-ratio: 16/9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.thumbnail-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
}

.play-icon {
  width: 0;
  height: 0;
  border-left: 20px solid rgba(255,255,255,0.12);
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  transition: border-left-color 0.2s ease;
}
.video-card:hover .play-icon { border-left-color: var(--accent); }

.video-card-info { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.video-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.video-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.video-card-views {
  font-size: 0.6875rem;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.video-card-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ----- Player Page ----- */
.player-page { max-width: 960px; margin: 0 auto; }

.player-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  border: 1px solid var(--border);
  overflow: hidden;
  max-height: 72vh;
}

.player-wrapper .plyr,
.player-wrapper video {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  margin: 0 auto;
  object-fit: contain;
}

.video-details { margin-bottom: 44px; }

.video-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.4px;
  line-height: 1.25;
}

.video-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.meta-item {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

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

.related-section {
  margin-top: 12px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.related-section h2 {
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Featured related (top 2 matches) */
.related-featured {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.related-featured-card {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s ease;
}
.related-featured-card:hover {
  border-color: var(--accent);
  color: var(--text);
}
.related-featured-thumb {
  width: 160px;
  flex-shrink: 0;
  aspect-ratio: 16/9;
  background: #000;
}
.related-featured-thumb .thumbnail-img,
.related-featured-thumb .thumbnail-placeholder {
  width: 100%;
  height: 100%;
}
.related-featured-info {
  padding: 12px 12px 12px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.related-featured-title {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  line-height: 1.3;
}
.related-featured-date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

@media (max-width: 768px) {
  .related-featured {
    grid-template-columns: 1fr;
  }
  .related-featured-thumb {
    width: 120px;
  }
}

/* ----- Empty State ----- */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}
.empty-state h2 {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.empty-state p { font-size: 0.875rem; }

/* ----- Error Pages ----- */
.error-page { text-align: center; padding: 100px 20px; }
.error-code {
  font-size: 8rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 12px;
  letter-spacing: -3px;
}
.error-message {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ----- Pagination ----- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 44px;
}

.pgn-arrow,
.pgn-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  border: 1px solid transparent;
}

.pgn-arrow { font-size: 1.125rem; color: var(--text-dim); }
.pgn-arrow:hover { color: var(--text); background: var(--bg-card); border-color: var(--border); }

.pgn-num:hover { color: var(--text); background: var(--bg-card); border-color: var(--border); }

.pgn-num.active {
  background: var(--accent);
  color: #060608;
  font-weight: 700;
  border-color: var(--accent);
  cursor: default;
}
.pgn-num.active:hover { background: var(--accent); color: #060608; }

.pgn-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--text-dim);
  font-size: 0.875rem;
  user-select: none;
}

/* ----- Login ----- */
.login-page { display: flex; justify-content: center; padding: 80px 20px; }
.login-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 380px;
}
.login-card h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 28px;
  text-align: center;
  letter-spacing: -0.3px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ----- Forms ----- */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}
.form-group label small { font-weight: 400; color: var(--text-dim); }

.form-input, .form-textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
.form-input:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 160px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.form-hint { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }
.form-hint code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.form-checkbox {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}
.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.form-checkbox small { font-weight: 400; color: var(--text-dim); }

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

.slug-display {
  display: inline-block;
  background: var(--bg);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ----- Alerts ----- */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
}
.alert-error {
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.18);
}
.alert-success {
  background: rgba(52, 211, 153, 0.08);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.18);
}

/* ----- Dashboard ----- */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}
.dash-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.dash-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 36px;
}
.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  min-width: 130px;
}
.stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}
.stat-label {
  font-size: 0.6875rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}

/* Chart Bars */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  padding: 12px 0 22px;
}
.chart-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 5px;
}
.chart-bar {
  width: 100%;
  max-width: 44px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height 0.5s ease;
}
.chart-bar-val {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.chart-bar-label {
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 3px;
}

.dash-section { margin-bottom: 36px; }
.dash-section h2 {
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.dash-section-header h2 { margin-bottom: 0; }

/* ----- Table ----- */
.table-wrapper {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.table th {
  background: var(--bg);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.1s ease; }
.table tbody tr:hover { background: var(--bg-hover); }
.table code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.td-title { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-url   { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 0.6875rem; color: var(--text-dim); }
.td-actions { white-space: nowrap; }
.td-actions .btn + .btn { margin-left: 4px; }
.td-actions form { display: inline; }

/* ----- Search ----- */
.search-form { margin-bottom: 18px; }
.search-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 300px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-icon {
  flex-shrink: 0;
  margin-left: 10px;
  color: var(--text-dim);
  pointer-events: none;
}
.search-wrap:focus-within .search-icon { color: var(--accent); }
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 10px;
  color: var(--text);
  font-size: 0.8125rem;
  font-family: var(--font);
  outline: none;
  min-width: 0;
}
.search-input::placeholder { color: var(--text-dim); }
.search-clear {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-right: 3px;
  border-radius: 50%;
  font-size: 1.125rem;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
  line-height: 1;
}
.search-clear:hover { color: var(--text); background: var(--bg-hover); }

/* ----- Bulk Actions ----- */
.bulk-actions { margin-top: 10px; }

/* ----- Admin Forms ----- */
.admin-form-page { max-width: 640px; }
.admin-form-page h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 22px;
}
.form-row { display: flex; gap: 14px; align-items: flex-start; }
.form-spacer { visibility: hidden; }
.form-threads { max-width: 100px; }
.form-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c7d8c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.form-submit { flex: 1; }
.back-link { margin-bottom: 12px; font-size: 0.8125rem; }

/* ----- Plyr Overrides ----- */
.plyr {
  --plyr-color-main: var(--accent);
  --plyr-video-background: #000;
  border-radius: var(--radius-lg);
}

/* ----- Fullscreen Overrides ----- */
.player-wrapper:fullscreen,
.player-wrapper:-webkit-full-screen,
.plyr:fullscreen,
.plyr:-webkit-full-screen {
  max-height: none !important;
}
.player-wrapper:fullscreen video,
.player-wrapper:-webkit-full-screen video,
.player-wrapper:fullscreen .plyr,
.player-wrapper:-webkit-full-screen .plyr,
.plyr:fullscreen video,
.plyr:-webkit-full-screen video {
  max-height: none !important;
  max-width: none !important;
  width: 100%;
  height: 100%;
}

/* ----- Toast ----- */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  color: var(--text);
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
  z-index: 110;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  border: 1px solid var(--border);
}

/* ----- Player error state ----- */
.player-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text-muted);
  text-align: center;
  padding: 40px 24px;
  z-index: 5;
}
.player-error-icon {
  color: var(--text-dim);
  margin-bottom: 16px;
}
.player-error-msg {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.player-error-hint {
  font-size: 0.8125rem;
  margin-bottom: 24px;
  max-width: 320px;
  line-height: 1.5;
}

/* ----- Next-video button (post-play) ----- */
.next-video-btn {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(6, 6, 8, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 10px 18px;
  color: var(--text);
  text-decoration: none;
  z-index: 25;
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  white-space: nowrap;
  max-width: calc(100% - 32px);
}
.next-video-btn.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.next-video-btn:hover {
  border-color: var(--accent);
  background: rgba(6, 6, 8, 0.95);
}
.next-video-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.next-video-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.next-video-arrow {
  font-size: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.next-video-btn:hover .next-video-arrow {
  transform: translateX(3px);
}

/* ----- Seek hint (one-time discoverability) ----- */
.seek-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  z-index: 25;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s ease;
  user-select: none;
}
.seek-hint.fade-out { opacity: 0; }
.seek-hint-icon { font-size: 0.875rem; }
.seek-hint-left  { left: 20px; }
.seek-hint-right { right: 20px; }

/* ----- Seek indicator ----- */
.seek-btn {
  position: absolute;
  top: 50%;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 179, 0.2);
  border-radius: 50%;
  color: #fff;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.5);
  transition: opacity 0.1s ease, transform 0.1s ease;
  user-select: none;
}
.seek-btn span {
  font-size: 0.625rem;
  font-weight: 700;
  margin-top: -1px;
}
.seek-btn svg { flex-shrink: 0; }
.seek-rewind { left: 12px; }
.seek-forward { right: 12px; }

.seek-btn.flash {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  transition: opacity 0.08s ease, transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ----- Processing Log ----- */
.processing-log {
  margin-top: 32px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.log-header h3 { font-size: 0.8125rem; font-weight: 600; }
.log-stats {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.log-entries { max-height: 320px; overflow-y: auto; padding: 8px 0; }
.log-entry {
  padding: 4px 16px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  line-height: 1.6;
  border-left: 3px solid transparent;
}
.log-ok     { color: #4ade80; border-left-color: #4ade80; }
.log-skip   { color: #facc15; border-left-color: #facc15; }
.log-error  { color: #f87171; border-left-color: #f87171; }
.log-done   { color: var(--text); border-left-color: var(--accent); }
.log-pending { color: var(--text-dim); }

/* ----- Responsive ----- */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .main-content { padding: 32px 0; }

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

  .page-header h1 { font-size: 1.375rem; }

  .nav-brand { font-size: 1rem; }

  .dash-header { flex-direction: column; align-items: stretch; }

  .player-wrapper {
    border-radius: 0;
    margin-left: -16px;
    margin-right: -16px;
    max-height: 55vh;
  }
  .player-wrapper .plyr,
  .player-wrapper video { max-height: 55vh; }

  .video-title { font-size: 1.25rem; }

  .error-code { font-size: 5rem; letter-spacing: -1px; }

  .table { font-size: 0.75rem; }
  .table th, .table td { padding: 8px 10px; }

  .login-card { padding: 24px; }

  .search-input { max-width: 100%; }

  .stats-row { flex-wrap: wrap; }
  .stat-card { flex: 1; min-width: 100px; padding: 16px 20px; }
  .stat-value { font-size: 1.75rem; }

  .seek-btn {
    width: 50px;
    height: 50px;
  }
  .seek-btn svg { width: 18px; height: 18px; }
  .seek-rewind { left: 6px; }
  .seek-forward { right: 6px; }

  .btn-sm { padding: 6px 14px; min-height: 44px; }

  .video-card:nth-child(n) { animation-delay: 0s; }
}

/* ----- Reduced Motion ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
