/* ═══════════════════════════════════════════════════════════════════════════
   gLib — Consolidated Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg: #09090b;
  --surface: #111114;
  --card: #18181b;
  --border: #27272a;
  --border2: #3f3f46;
  --accent: #5b8def;
  --accent-dim: rgba(91, 141, 239, .12);
  --accent2: #7c6af7;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --muted: #71717a;
  --muted2: #52525b;
  --text: #f4f4f5;
  --text2: #a1a1aa;
  --font: 'Outfit', sans-serif;
  --mono: 'DM Mono', monospace;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
}
[data-bs-theme=light] {
  --bg: #f8fafc;
  --surface: #fff;
  --card: #fff;
  --border: #e4e4e7;
  --border2: #d4d4d8;
  --accent: #2563eb;
  --accent-dim: rgba(37, 99, 235, .08);
  --accent2: #7c3aed;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --muted: #71717a;
  --muted2: #a1a1aa;
  --text: #09090b;
  --text2: #52525b;
}


/* ── Reset & Base ──────────────────────────────────────────── */
*,
::before,
::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}


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


/* ── Animations ────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}


/* ═══════════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════════ */

.gl-nav {
  background: rgba(9, 9, 11, .9);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(20px);
}
[data-bs-theme=light] .gl-nav {
  background: rgba(255, 255, 255, .92);
}

/* Compact variant (detail page) */
.gl-nav-compact {
  height: 58px;
  padding: 0 1.5rem;
  gap: 12px;
}

.gl-brand {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--accent);
  text-decoration: none;
  line-height: 1;
  flex-shrink: 0;
}
.gl-brand span {
  color: var(--text);
}

/* Smaller brand (detail page) */
.gl-brand-sm {
  font-size: 1.4rem;
}


/* ── Nav elements ──────────────────────────────────────────── */
.nav-sep {
  color: var(--border2);
  font-size: 16px;
  font-weight: 300;
}
.nav-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
  color: var(--text2);
}
.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}
.nav-link-plain {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: color .15s;
}
.nav-link-plain:hover {
  color: var(--text);
}


.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.nav-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════
   BUTTONS & INPUTS (shared)
   ═══════════════════════════════════════════════════════════════ */

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all .15s;
  text-decoration: none;
}
.btn-icon:hover,
.btn-icon.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.gl-label {
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
  display: block;
}

.gl-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.gl-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.gl-input::placeholder {
  color: var(--muted);
}

.gl-sel {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}
.gl-sel:focus {
  border-color: var(--accent);
}

.gl-hint {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 5px;
  font-family: var(--mono);
  line-height: 1.5;
}

.form-error {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--red);
  margin-top: 6px;
  display: none;
}

.color-input {
  width: 52px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
}

.slug-input {
  font-family: var(--mono);
  text-transform: uppercase;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}


/* ═══════════════════════════════════════════════════════════════
   HELP OVERLAY (detail + library)
   ═══════════════════════════════════════════════════════════════ */

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
  background: rgba(0, 0, 0, .55);
}
.help-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.help-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.help-close:hover {
  background: var(--border);
}
.help-note {
  position: absolute;
  max-width: 220px;
  pointer-events: none;
  animation: help-pop .3s cubic-bezier(.34, 1.56, .64, 1) both;
}
@keyframes help-pop {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}
.help-bubble {
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
}
.help-arrow {
  width: 0;
  height: 0;
  border: 8px solid transparent;
  position: absolute;
}
.help-arrow.down  { border-top-color: var(--accent);    top: 100%; left: 50%; transform: translateX(-50%); border-bottom: none; }
.help-arrow.up    { border-bottom-color: var(--accent); bottom: 100%; left: 50%; transform: translateX(-50%); border-top: none; }
.help-arrow.right { border-left-color: var(--accent);   left: 100%; top: 50%; transform: translateY(-50%); border-right: none; }
.help-arrow.left  { border-right-color: var(--accent);  right: 100%; top: 50%; transform: translateY(-50%); border-left: none; }


/* ═══════════════════════════════════════════════════════════════
   MODAL (shared)
   ═══════════════════════════════════════════════════════════════ */

.gl-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, .7);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.gl-modal.open {
  display: flex;
}
.modal-box {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  width: 360px;
  max-width: 95vw;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .5);
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -.02em;
}
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 1.5rem;
}


/* ═══════════════════════════════════════════════════════════════
   DETAIL PAGE — Layout
   ═══════════════════════════════════════════════════════════════ */

.gl-layout {
  display: flex;
  height: calc(100vh - 58px);
  overflow: hidden;
}
.gl-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}
.gl-sidebar {
  width: 400px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}


/* ── Video player ──────────────────────────────────────────── */
.video-wrap {
  background: #000;
  flex-shrink: 0;
}
video {
  width: 100%;
  display: block;
  max-height: calc(100vh - 200px);
}
video::cue {
  font-family: var(--font);
  font-size: 1em;
  background: rgba(0, 0, 0, .85);
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
}


/* ── Video info bar ────────────────────────────────────────── */
.video-info {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.video-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.025em;
  margin-bottom: 7px;
  line-height: 1.3;
  color: var(--text);
}
.video-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.meta-chip {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.meta-chip i {
  font-size: 11px;
}
.meta-chip-link {
  color: var(--accent2);
  cursor: pointer;
  text-decoration: none;
  transition: color .15s;
}
.meta-chip-link:hover {
  color: var(--accent);
}
.lang-badge {
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid;
  cursor: pointer;
  transition: all .15s;
}
.lang-badge:hover {
  transform: scale(1.05);
}
.lang-badge.good {
  color: var(--green);
  border-color: rgba(52, 211, 153, .4);
  background: rgba(52, 211, 153, .08);
}
.lang-badge.warn {
  color: var(--amber);
  border-color: rgba(251, 191, 36, .4);
  background: rgba(251, 191, 36, .08);
}

/* Tags in detail */
.vi-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.v-tag-detail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--tc);
  color: var(--tc);
  background: color-mix(in srgb, var(--tc) 10%, transparent);
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
}
.v-tag-detail:hover {
  background: color-mix(in srgb, var(--tc) 22%, transparent);
}
.tag-pip-sm {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tag-fullname {
  font-weight: 400;
  color: inherit;
  opacity: .75;
  font-size: 11px;
}


/* ── Abstract section ──────────────────────────────────── */
.vi-abstract {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.75;
  color: var(--text2);
}
.abstract-body strong,
.abstract-body b {
  font-weight: 700;
  color: var(--text);
}
.abstract-body em,
.abstract-body i {
  font-style: italic;
}
.abstract-body ul,
.abstract-body ol {
  padding-left: 1.5em;
  margin: .4em 0;
}
.abstract-body li {
  margin: .25em 0;
}
.abstract-body p {
  margin: .4em 0;
}
.abstract-highlight {
  background: rgba(251, 191, 36, .35);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}


/* ── Controls bar ──────────────────────────────────────────── */
.video-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--card);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ctrl-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ctrl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.ctrl-btn.cc-on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.slide-nav-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.slide-nav-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
}
.slide-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  transform: scale(1.03);
}
.slide-nav-btn i {
  font-size: 15px;
}
.slide-indicator {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--accent);
  padding: 0 8px;
  min-width: 56px;
  text-align: center;
  font-weight: 600;
}


/* ── Mini timeline ──────────────────────────────────────────── */
.mini-timeline {
  flex: 1;
  position: relative;
  min-width: 0;
}
.mt-track {
  height: 20px;
  background: transparent;
  position: relative;
  overflow: visible;
  cursor: pointer;
}
.mt-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 7px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  pointer-events: none;
  z-index: 0;
}
.mt-progress {
  position: absolute;
  left: 0;
  top: 7px;
  height: 6px;
  background: var(--accent);
  border-radius: 3px;
  pointer-events: none;
  transition: width .25s linear;
  z-index: 1;
}
.mt-slide-highlight {
  position: absolute;
  top: 7px;
  height: 6px;
  background: rgba(91, 141, 239, .3);
  border-radius: 3px;
  pointer-events: none;
  display: none;
  z-index: 2;
}
.mt-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.mt-marker {
  position: absolute;
  top: 4px;
  width: 2px;
  height: 12px;
  background: rgba(128, 128, 128, .45);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: all .15s;
}
.mt-marker.active-slide {
  background: var(--accent);
  opacity: 1;
  width: 3px;
}
.mt-search-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.mt-search-dot {
  position: absolute;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  transition: all .15s;
  opacity: .9;
}
.mt-search-dot.tx-dot { background: var(--amber); }
.mt-search-dot.sl-dot { background: var(--green); }
.mt-search-dot.hovered {
  opacity: 1;
  transform: translateX(-50%) scale(1.8);
  z-index: 5;
}
.mt-hover-marker {
  position: absolute;
  top: 3px;
  width: 2px;
  height: 14px;
  background: rgba(255, 255, 255, .85);
  border-radius: 1px;
  transform: translateX(-50%);
  pointer-events: none;
  display: none;
  z-index: 6;
}
.mt-tooltip {
  position: absolute;
  bottom: 22px;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  display: none;
  transform: translateX(-50%);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
}


/* ── Sidebar search ─────────────────────────────────────────── */
.vsearch-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.vsearch-wrap {
  position: relative;
  flex: 1;
}
.vsearch-wrap i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}
#vsearch {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px 7px 30px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#vsearch:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
#vsearch::placeholder {
  color: var(--muted);
}
.search-counts {
  display: none;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  align-items: center;
}
.search-counts.visible {
  display: flex;
}
.sc-badge {
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.sc-badge.tx-results {
  color: var(--amber);
  border-color: rgba(251, 191, 36, .45);
  background: rgba(251, 191, 36, .08);
}
.sc-badge.sl-results {
  color: var(--green);
  border-color: rgba(52, 211, 153, .45);
  background: rgba(52, 211, 153, .08);
}
.eye-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
  flex-shrink: 0;
}
.eye-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.eye-btn.filtering {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.tx-seg.hide-unmatched,
.slide-card.hide-unmatched {
  display: none;
}


/* ── Tabs ───────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  position: relative;
}
.tab-bar-ink {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  transition: left .28s cubic-bezier(.4, 0, .2, 1),
              width .28s cubic-bezier(.4, 0, .2, 1);
  border-radius: 1px;
  z-index: 2;
}
.tab-btn {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: .03em;
  text-transform: uppercase;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .2s, background .2s;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  flex: 1;
}
.tab-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
}
.tab-btn:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, .04);
}
[data-bs-theme=light] .tab-btn:hover:not(.active) {
  background: rgba(0, 0, 0, .04);
}
.tab-count {
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  display: none;
  font-weight: 700;
}
.tab-count.visible {
  display: inline;
}
.tab-btn .tab-lbl {
  display: none;
}
.tab-btn.active .tab-lbl {
  display: inline;
}


/* ── Sliding panels ─────────────────────────────────────────── */
.panels-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.panels-track {
  display: flex;
  width: 100%;
  height: 100%;
  will-change: transform;
  transition: transform .32s cubic-bezier(.4, 0, .2, 1);
}
.panels-track > * {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}


/* ── Transcript panel ───────────────────────────────────────── */
.transcript-panel {
  padding: 8px 10px;
}
.tx-seg {
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  gap: 10px;
  transition: background .1s;
  border: 1px solid transparent;
  margin-bottom: 2px;
}
.tx-seg:hover {
  background: var(--card);
}
.tx-seg.active {
  background: var(--accent-dim);
  border-color: rgba(91, 141, 239, .25);
}
.tx-seg.search-match {
  background: rgba(251, 191, 36, .07);
  border-color: rgba(251, 191, 36, .3);
}
.tx-seg.active.search-match {
  background: rgba(91, 141, 239, .18);
  border-color: rgba(91, 141, 239, .4);
}
.tx-time {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  min-width: 38px;
  font-weight: 500;
}
.tx-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.tx-seg.active .tx-text {
  font-weight: 600;
}
mark {
  background: rgba(251, 191, 36, .3);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}


/* ── Slides panel ───────────────────────────────────────────── */
.slides-panel {
  padding: 10px;
}
.slide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.slide-card {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  background: var(--bg);
  position: relative;
}
.slide-card:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}
.slide-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.slide-card.search-match {
  border-color: rgba(251, 191, 36, .6);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, .12);
}
.slide-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.slide-foot {
  padding: 4px 7px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slide-num {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
}
.slide-ts {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 500;
}
.match-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--amber);
  color: #000;
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  display: none;
}
.slide-card.search-match .match-badge {
  display: block;
}


/* ── Translate panel ────────────────────────────────────────── */
.translate-panel {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.tr-label {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.tr-row {
  display: flex;
  gap: 6px;
}
.tr-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
  display: none;
}
.tr-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width .4s;
}
.tr-status {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  margin-top: 4px;
  min-height: 16px;
}
.tl-toggle {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.tl-btn {
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.tl-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}


/* ── Session panel ──────────────────────────────────────────── */
.session-panel {
  padding: 8px 10px;
}
.session-header {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  padding: 4px 2px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.session-count {
  margin-left: auto;
  background: var(--border);
  color: var(--muted);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
}
.session-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 2rem;
  font-family: var(--mono);
}
.sv-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
  color: inherit;
  margin-bottom: 7px;
  transition: all .15s;
  cursor: pointer;
}
.sv-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: inherit;
}
.sv-thumb {
  width: 96px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #000;
}
.sv-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sv-dur {
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 9px;
  font-family: var(--mono);
  background: rgba(0, 0, 0, .8);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
}
.sv-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sv-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text);
}
.sv-speaker {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sv-tags {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.sv-tag {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--tc);
  color: var(--tc);
}


/* ═══════════════════════════════════════════════════════════════
   LIBRARY PAGE
   ═══════════════════════════════════════════════════════════════ */

/* ── Search box ─────────────────────────────────────────────── */
.search-box {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.search-box i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
#search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px 9px 38px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
#search-input::placeholder {
  color: var(--muted);
}

.btn-primary-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary-nav:hover {
  background: var(--accent2);
  color: #fff;
  transform: translateY(-1px);
}


/* ── Page layout ────────────────────────────────────────────── */
.gl-body {
  padding: 3rem 2rem;
  max-width: 1240px;
  margin: 0 auto;
}
.section-head {
  margin-bottom: 1.5rem;
  margin-top: .5rem;
}
.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.1;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 1.4em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.section-count {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
}


/* ── Video card ─────────────────────────────────────────────── */
.v-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  cursor: pointer;
}
.v-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .25), 0 0 0 1px var(--accent);
  color: inherit;
}
[data-bs-theme=light] .v-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1), 0 0 0 1px var(--accent);
}
.v-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.v-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
  display: block;
}
.v-card:hover .v-thumb img {
  transform: scale(1.06);
}
.v-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .7) 0%, rgba(0, 0, 0, 0) 50%);
  pointer-events: none;
}
.v-dur {
  position: absolute;
  bottom: 9px;
  right: 9px;
  background: rgba(0, 0, 0, .8);
  color: #fff;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  letter-spacing: .02em;
}
.v-slides {
  position: absolute;
  bottom: 9px;
  left: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.v-body {
  padding: 12px 14px 14px;
  flex: 1;
}
.v-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.v-speaker {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 5px;
}
.v-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.v-tag {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid;
  color: var(--tc, var(--accent));
  border-color: var(--tc, var(--accent));
  background: transparent;
  text-decoration: none;
  transition: opacity .15s;
}
.v-tag:hover {
  opacity: .75;
}
.v-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 1px;
}
.chip {
  font-size: 11px;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted2);
}
.chip-lang {
  color: var(--green);
  border-color: rgba(52, 211, 153, .3);
  background: rgba(52, 211, 153, .06);
}
.chip-session {
  color: var(--accent2);
  border-color: rgba(124, 106, 247, .3);
  background: rgba(124, 106, 247, .06);
  text-decoration: none;
  transition: opacity .15s;
}
.chip-session:hover {
  opacity: .75;
}


/* ── Processing card ────────────────────────────────────────── */
.proc-card {
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 24px var(--accent-dim);
  animation: proc-glow 2.5s ease-in-out infinite alternate;
}
@keyframes proc-glow {
  from { box-shadow: 0 0 12px var(--accent-dim); }
  to   { box-shadow: 0 0 28px rgba(91, 141, 239, .2); }
}
.proc-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
  display: block;
}
.proc-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--surface), var(--card));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 2.5rem;
}
.proc-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.proc-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.proc-msg {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.6;
}
.proc-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.proc-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px;
  transition: width .6s ease;
}
.proc-fill.queued {
  background: var(--border2);
}
.proc-fill.err {
  background: var(--red);
}
.proc-pct {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--accent);
  text-align: right;
  font-weight: 600;
}
.proc-queue-badge {
  font-size: 10px;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(91, 141, 239, .3);
  flex-shrink: 0;
}


/* ── Search results ─────────────────────────────────────────── */
.sr-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 8px;
  margin-bottom: 4px;
}
.sr-group-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.sr-group-title {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: -.01em;
}
.sr-group-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  background: var(--border);
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: auto;
}
.sr-g-video  .sr-group-icon   { background: rgba(91, 141, 239, .15);  color: var(--accent);  }
.sr-g-video  .sr-group-title  { color: var(--accent); }
.sr-g-tx     .sr-group-icon   { background: rgba(251, 191, 36, .15);  color: var(--amber);   }
.sr-g-tx     .sr-group-title  { color: var(--amber); }
.sr-g-slide  .sr-group-icon   { background: rgba(52, 211, 153, .15);  color: var(--green);   }
.sr-g-slide  .sr-group-title  { color: var(--green); }
.sr-g-abstract .sr-group-icon { background: rgba(124, 106, 247, .15); color: var(--accent2); }
.sr-g-abstract .sr-group-title{ color: var(--accent2); }

.sr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sr-accent, #444);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.sr-card:hover {
  border-color: var(--sr-accent, var(--accent));
  box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
  color: inherit;
}
.sr-thumb-wrap {
  position: relative;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  isolation: isolate;
}
.sr-thumb {
  width: 112px;
  height: 63px;
  object-fit: cover;
  border-radius: 6px;
  background: #111;
  display: block;
}
.sr-thumb-ts {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 700;
  background: rgba(0, 0, 0, .8);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}
.sr-type-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(124, 106, 247, .12);
  color: var(--accent2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.sr-body {
  flex: 1;
  min-width: 0;
}
.sr-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-bottom: 2px;
}
.sr-match {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.sr-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.sr-tag {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid;
  color: var(--tc, var(--muted2));
  border-color: var(--tc, var(--border2));
  text-decoration: none;
}
.sr-session {
  color: var(--accent2);
  text-decoration: none;
  font-size: 11px;
}
.sr-peek-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 6px 0 6px 0;
  background: rgba(0, 0, 0, .72);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, .15);
  border-left: 1px solid rgba(255, 255, 255, .15);
  color: rgba(255, 255, 255, .85);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
  z-index: 4;
}
.sr-thumb-wrap:hover .sr-peek-btn {
  background: var(--accent);
  color: #fff;
}
.sr-peek-btn:hover {
  background: var(--accent) !important;
  color: #fff !important;
}


/* ── Scope pills ────────────────────────────────────────────── */
.scope-area {
  position: relative;
}
.scope-pills {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  position: relative;
  overflow: visible;
}
.sp-slider {
  position: absolute;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
  z-index: 0;
  transition: left .2s cubic-bezier(.4, 0, .2, 1),
              width .2s cubic-bezier(.4, 0, .2, 1),
              top .2s cubic-bezier(.4, 0, .2, 1),
              height .2s cubic-bezier(.4, 0, .2, 1);
  opacity: 0;
}
.sp {
  position: relative;
  z-index: 1;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: color .15s;
  white-space: nowrap;
}
.sp:hover,
.sp.sp-hover,
.sp.active {
  color: #fff;
}
[data-bs-theme=light] .sp-topics:hover,
[data-bs-theme=light] .sp-topics.sp-hover {
  color: var(--accent);
}
[data-bs-theme=light] .scope-pills:hover .sp.active:not(:hover) {
  color: var(--accent);
}
.sp.sp-topics {
  display: flex;
  align-items: center;
  gap: 5px;
}
.sp-chev {
  font-size: 9px;
  transition: transform .2s;
}
.sp-chev.open {
  transform: rotate(180deg);
}
.sp-divider {
  width: 1px;
  height: 16px;
  background: var(--border2);
  margin: 0 3px;
  flex-shrink: 0;
}
.sp-topics-wrap {
  position: relative;
}
.topics-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 6px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
  display: none;
  flex-direction: column;
  gap: 2px;
}
.topics-dropdown.open {
  display: flex;
}
.topic-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background .1s;
  width: 100%;
}
.topic-item:hover {
  background: var(--accent-dim);
}
.topic-pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.topic-slug {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.topic-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topic-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}
.topic-empty a {
  color: var(--accent);
}


/* ── Slide popup ────────────────────────────────────────────── */
.slide-popup {
  position: fixed;
  z-index: 502;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 64px rgba(0, 0, 0, .6);
  padding: 14px;
  width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  animation: popup-in .18s ease;
}
@keyframes popup-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.slide-popup-img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  margin-bottom: 10px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
  min-height: 200px;
}
.slide-popup-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.35;
}
.slide-popup-meta {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.slide-popup-ts {
  color: var(--accent);
  font-weight: 600;
}
.slide-popup-text {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  max-height: 80px;
  overflow-y: auto;
  font-family: var(--mono);
  white-space: pre-wrap;
}
.slide-popup-text-label {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  margin-top: 6px;
}
.slide-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.slide-popup-close:hover {
  background: var(--red);
  color: #fff;
}


/* ── Image overlay ──────────────────────────────────────────── */
.img-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, .92);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: popup-in .15s ease;
}
.img-overlay.open {
  display: flex;
}
.img-overlay img {
  max-width: min(1200px, 95vw);
  max-height: 92vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .7);
  object-fit: contain;
  cursor: default;
}
.img-overlay-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.img-overlay-close:hover {
  background: rgba(255, 255, 255, .3);
}


/* ── Empty state ────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 6rem 2rem;
}
.empty-icon {
  font-size: 3.5rem;
  color: var(--muted2);
  display: block;
  margin-bottom: 1.25rem;
  opacity: .5;
}
.empty h3 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: .5rem;
}
.empty p {
  color: var(--muted);
  font-size: 15px;
  max-width: 340px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}
.btn-primary-lg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-primary-lg:hover {
  background: var(--accent2);
  color: #fff;
  transform: translateY(-2px);
}


/* ── Tag filter bar ─────────────────────────────────────────── */
#tag-filter-bar {
  display: none;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--mono);
}
#tag-filter-bar.visible {
  display: flex;
}
.tag-filter-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  flex-shrink: 0;
}
.tag-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--mono);
  border: 1.5px solid;
  cursor: pointer;
  transition: opacity .15s;
  background: transparent;
}
.tag-active-pill:hover {
  opacity: .7;
}
.tag-active-pill .tap-x {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  opacity: .7;
  background: rgba(255, 255, 255, .15);
}
.tag-filter-clear {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  font-family: var(--mono);
  transition: color .15s;
}
.tag-filter-clear:hover {
  color: var(--red);
}
.v-card-wrap.tag-hidden {
  display: none;
}
.v-tag.tag-active {
  opacity: 1 !important;
  box-shadow: 0 0 0 2px currentColor;
}


/* ── Word cloud modal ───────────────────────────────────────── */
.wc-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.wc-modal.open {
  display: flex;
}
.wc-box {
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  width: min(1080px, 98vw);
  height: min(700px, 92vh);
  display: flex;
  flex-direction: column;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .7);
  overflow: hidden;
}

/* Head */
.wc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.wc-head-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.wc-tabs {
  display: flex;
  gap: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.wc-tab {
  padding: 5px 16px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.wc-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(91, 141, 239, .4);
}
.wc-tab:not(.active):hover {
  color: var(--text);
  background: var(--border);
}
.wc-head-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wc-filter-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid rgba(91, 141, 239, .25);
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent);
}
.wc-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--border);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.wc-close:hover {
  background: var(--red);
  color: #fff;
}

/* Controls bar */
.wc-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wc-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: all .15s;
}
.wc-check input {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.wc-check.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg);
}
.wc-sep {
  width: 1px;
  height: 18px;
  background: var(--border2);
  flex-shrink: 0;
  margin: 0 2px;
}
.wc-cmap-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
}
#wc-cmap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}
.wc-gen-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.wc-gen-btn:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}
.wc-gen-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

/* Body: viz + word list */
.wc-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.wc-viz-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 16px;
}
.wc-viz-wrap img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  display: block;
  object-fit: contain;
}
.wc-viz-wrap canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
}
.wc-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.wc-empty {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
  text-align: center;
  padding: 24px;
  line-height: 1.6;
}

/* Word list panel */
.wc-words {
  width: 240px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.wc-words-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wc-words-head-title {
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.wc-words-head-count {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted2);
  background: var(--border);
  padding: 1px 7px;
  border-radius: 999px;
}
.wc-words-hint {
  padding: 5px 14px 6px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  line-height: 1.4;
}
.wc-words-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.wc-words-search-wrap i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
.wc-words-search {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px 5px 26px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.wc-words-search:focus {
  border-color: var(--accent);
}
.wc-words-search::placeholder {
  color: var(--muted2);
}
.wc-words-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

/* Word rows */
.wc-word-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 5px 14px;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
  position: relative;
}
.wc-word-row:hover {
  background: var(--border);
}
.wc-word-label {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all .2s;
}
.wc-word-count {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted2);
  flex-shrink: 0;
  margin-left: 6px;
}
.wc-word-tmpl {
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 5px;
  background: rgba(251, 191, 36, .12);
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, .25);
  flex-shrink: 0;
  letter-spacing: .03em;
}
.wc-word-x {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: 6px;
  background: var(--border2);
  color: var(--muted);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .25;
  transition: opacity .15s, background .15s, color .15s;
}
.wc-word-row:hover .wc-word-x {
  background: var(--red);
  color: #fff;
}

/* Excluded state */
.wc-word-row.excluded {
  background: transparent;
}
.wc-word-row.excluded:hover {
  background: var(--border);
}
.wc-word-row.excluded .wc-word-label {
  color: var(--muted2);
  text-decoration: line-through;
  text-decoration-color: rgba(248, 113, 113, .8);
  text-decoration-thickness: 2px;
  opacity: .5;
}
.wc-word-row.excluded .wc-word-count {
  opacity: .3;
}
.wc-word-row.excluded .wc-word-tmpl {
  opacity: .3;
}
.wc-word-row.excluded .wc-word-x {
  opacity: 1;
  background: rgba(52, 211, 153, .12);
  color: var(--green);
}
.wc-word-row.excluded:hover .wc-word-x {
  background: var(--green);
  color: #fff;
  border-color: transparent;
}

/* Footer */
.wc-words-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
}
.wc-ex-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(248, 113, 113, .1);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, .2);
  font-weight: 600;
}
.wc-clear-ex {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color .15s;
  font-weight: 600;
}
.wc-clear-ex:hover {
  color: var(--red);
}
.wc-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  background: var(--surface);
}
.wc-dl {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--accent);
  border: 1px solid rgba(91, 141, 239, .3);
  background: var(--accent-dim);
  border-radius: 7px;
  padding: 4px 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  transition: all .15s;
}
.wc-dl:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Colour controls row */
.wc-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.wc-color-label {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  flex-shrink: 0;
}
.wc-mode-pills {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.wc-mode-pill {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all .15s;
}
.wc-mode-pill.active {
  background: var(--accent);
  color: #fff;
}
.wc-mode-pill:not(.active):hover {
  color: var(--text);
  background: var(--border);
}
.wc-preset-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
}
#wc-preset {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}
.wc-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.wc-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s, border-color .15s;
  flex-shrink: 0;
  position: relative;
}
.wc-swatch:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, .4);
}
.wc-swatch-del {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  line-height: 1;
}
.wc-swatch:hover .wc-swatch-del {
  display: flex;
}
.wc-add-color {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px dashed var(--border2);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.wc-add-color:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
#wc-color-picker {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.wc-bg-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.wc-bg-label {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.wc-bg-swatches {
  display: flex;
  gap: 4px;
}
.wc-bg-swatch {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
  flex-shrink: 0;
}
.wc-bg-swatch.active,
.wc-bg-swatch:hover {
  border-color: var(--accent);
  transform: scale(1.1);
}

/* Co-occurrence layout row */
.wc-layout-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.wc-layout-pills {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
}
.wc-layout-pill {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  transition: all .15s;
}
.wc-layout-pill.active {
  background: var(--accent2);
  color: #fff;
}
.wc-layout-pill:not(.active):hover {
  color: var(--text);
  background: var(--border);
}
.wc-color-row.hidden,
.wc-layout-row.hidden {
  display: none;
}


/* ═══════════════════════════════════════════════════════════════
   ADD PAGE
   ═══════════════════════════════════════════════════════════════ */

.add-wrap {
  max-width: 640px;
  margin: 3.5rem auto;
  padding: 0 2rem 4rem;
}
.add-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.add-header {
  padding: 2rem 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.add-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.04em;
  margin: 0;
}
.add-header p {
  font-size: 14px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.6;
}
.add-body {
  padding: 2rem;
}

.picker-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.pick-btn {
  flex: 1;
  padding: 20px 12px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.pick-btn i {
  font-size: 1.75rem;
  transition: color .2s;
}
.pick-btn:hover {
  border-color: var(--accent);
  border-style: solid;
  color: var(--text);
  background: var(--accent-dim);
}
.pick-btn:hover i {
  color: var(--accent);
}
.pick-btn.loading {
  opacity: .5;
  pointer-events: none;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 12.5px;
  font-family: var(--mono);
  color: var(--text);
}
.file-item i.icon {
  color: var(--accent);
  flex-shrink: 0;
}
.file-item .fname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item .fdir {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.csv-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 12.5px;
  font-family: var(--mono);
  color: var(--text);
  cursor: pointer;
  margin-bottom: 6px;
}
.csv-option input[type=checkbox] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}
.csv-option .csv-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.csv-option .csv-info {
  color: var(--muted);
  font-size: 10.5px;
  flex-shrink: 0;
}
.rm-btn {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  font-size: 14px;
  transition: color .15s;
}
.rm-btn:hover {
  color: var(--red);
}
.no-files {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  text-align: center;
  padding: 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}
.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.path-area {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  resize: vertical;
  min-height: 76px;
  outline: none;
  transition: border-color .2s;
  line-height: 1.6;
}
.path-area:focus {
  border-color: var(--accent);
}
.path-area::placeholder {
  color: var(--muted);
}

.error-msg {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--red);
  margin-top: 6px;
  display: none;
}

.btn-submit {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all .2s;
}
.btn-submit:hover {
  background: var(--accent2);
  transform: translateY(-1px);
}
.btn-cancel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.btn-cancel:hover {
  border-color: var(--border2);
  color: var(--text);
}


/* ── Tag picker (add page) ──────────────────────────────────── */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 44px;
  align-items: center;
}
.tag-option {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.tag-option:has(input:checked) {
  border-color: var(--tc);
  background: color-mix(in srgb, var(--tc) 12%, transparent);
}
.tag-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tag-lbl {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
}
.tag-name-hint {
  font-size: 11px;
  color: var(--muted);
  display: none;
}
.tag-option:hover .tag-name-hint {
  display: inline;
}
.tag-option:has(input:checked) .tag-name-hint {
  display: inline;
  color: var(--text2);
}
.tag-add-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tag-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* ── Abstract editor ────────────────────────────────────────── */
.abstract-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
.ab-btn {
  width: 30px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all .15s;
}
.ab-btn:hover {
  background: var(--border);
  color: var(--text);
}
.ab-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.abstract-editor {
  width: 100%;
  min-height: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  line-height: 1.7;
}
.abstract-editor:focus {
  border-color: var(--accent);
}
.abstract-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}
.abstract-editor ul,
.abstract-editor ol {
  padding-left: 1.5em;
  margin: .3em 0;
}
.abstract-editor li {
  margin: .2em 0;
}
.abstract-editor strong {
  font-weight: 700;
}
.abstract-editor em {
  font-style: italic;
}


/* ── Quick tag modal (add page) ─────────────────────────────── */
.qt-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 400;
  backdrop-filter: blur(4px);
}
.qt-overlay.open {
  display: block;
}
.qt-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 401;
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: min(480px, 90vw);
}
.qt-modal.open {
  display: block;
}
.qt-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 1rem;
}
.qt-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.qt-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 1rem;
}


/* ═══════════════════════════════════════════════════════════════
   TAGS PAGE
   ═══════════════════════════════════════════════════════════════ */

.page-wrap {
  max-width: 760px;
  margin: 3rem auto;
  padding: 0 2rem 6rem;
}
.page-head {
  margin-bottom: 2rem;
}
.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.05em;
  margin-bottom: .4rem;
}
.page-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-bottom: 2rem;
}
.form-card-title {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.color-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  flex-shrink: 0;
  height: 42px;
}
.btn-add:hover {
  background: var(--accent2);
}

.tags-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tag-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  transition: border-color .15s;
}
.tag-row:hover {
  border-color: var(--border2);
}
.tag-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}
.tag-slug {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 60px;
}
.tag-name {
  font-size: 14px;
  color: var(--text2);
  flex: 1;
}
.tag-filter-link {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.tag-filter-link:hover {
  color: var(--accent);
}
.btn-del {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all .15s;
  flex-shrink: 0;
}
.btn-del:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(248, 113, 113, .08);
}
.empty-tags {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 14px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
}


/* ═══════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.login-logo {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--text);
  text-align: center;
}
.login-logo span {
  color: var(--accent);
}
.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 28px;
}
.login-error {
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .35);
  color: var(--red);
  font-size: 13px;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 18px;
  text-align: center;
}
.login-form .gl-label {
  display: block;
  margin-bottom: 6px;
}
.login-form .gl-input {
  width: 100%;
}
.login-btn {
  width: 100%;
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter .15s, transform .1s;
}
.login-btn:hover {
  filter: brightness(1.1);
}
.login-btn:active {
  transform: translateY(1px);
}


/* ═══════════════════════════════════════════════════════════════
   ADMIN — VIDEO MANAGEMENT
   ═══════════════════════════════════════════════════════════════ */

.btn-nav-admin {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-nav-admin:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-group {
  margin-bottom: 2.5rem;
}
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  transition: border-color .15s;
}
.admin-row:hover {
  border-color: var(--border2);
}
.admin-thumb {
  width: 110px;
  height: 62px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}
.admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.admin-info {
  flex: 1;
  min-width: 0;
}
.admin-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.admin-title a:hover {
  color: var(--accent);
}
.admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 5px;
}
.admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--muted);
}
.admin-chip i {
  font-size: 10px;
  color: var(--muted2);
}
.admin-chip-lang {
  color: var(--green);
  font-weight: 600;
}
.admin-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px 2px 5px;
}
.admin-tag-pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.admin-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-edit:hover {
  background: var(--accent);
  color: #fff;
}

.btn-del-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-del-edit:hover {
  background: var(--red);
  color: #fff;
}

@media (max-width: 720px) {
  .admin-row {
    flex-wrap: wrap;
  }
  .admin-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
