﻿:root {
  /* Central design tokens: most theme changes can be done by editing this block. */
  --bg: #080810;
  --surface: #0f0f1a;
  --surface2: #16162a;
  --border: #ffffff12;
  --border-hover: #ffffff25;
  --accent: #342998;
  --accent2: #342998;
  --accent3: #6af7c8;
  --text: #eeeef5;
  --muted: #666680;
  --card: #0d0d1c;
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── GRAIN OVERLAY ── */
body::after {
  content:'';
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:9999;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity:.5;
}

/* ── HEADER ── */
header {
  flex-shrink: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,8,16,0.95);
  backdrop-filter: blur(20px);
  position: relative;
  z-index: 50;
}

.logo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-gem {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.logo-gem i {
  font-size: 20px;
  line-height: 1;
}

.logo span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 4px; }

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-status {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 999px;
  padding: 5px 9px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-status.is-authenticated {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.search-wrap {
  position: relative;
}
.search-wrap input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 14px 7px 36px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border .2s, width .3s;
}
.search-wrap input:focus { border-color: var(--accent); width: 280px; }
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap svg { position:absolute; left:11px; top:50%; transform:translateY(-50%); opacity:.4; }

.hdr-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.hdr-btn:hover { border-color: var(--border-hover); background: var(--surface); }
.hdr-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.hdr-btn.accent:hover { filter: brightness(1.15); }
.hdr-btn.red { background: var(--accent); border-color: var(--accent); color: #fff; }
.hdr-btn.red:hover { filter: brightness(1.1); transform: translateY(-1px); }

.hdr-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  position: relative;
}

.hdr-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.hdr-icon-btn[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border-hover);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  z-index: 120;
  pointer-events: none;
}

/* ── APP BODY ── */
.app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sidebar-section { padding: 16px 12px 8px; }

.sidebar-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 6px;
  margin-bottom: 6px;
}

.sb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
  gap: 8px;
  color: var(--muted);
}
.sb-item:hover { background: var(--surface2); color: var(--text); }
.sb-item.active { background: var(--accent); color: #fff; }
.sb-item.active .sb-count {
  background: rgba(255,255,255,.14);
  color: #fff;
}

.sb-item-left { display:flex; align-items:center; gap:8px; min-width:0; }
.sb-item-left span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.sb-clapper-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.sb-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.game-pill {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.avatar-sm {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items:center; justify-content:center;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 12px;
}

/* ── SORT BAR ── */
.sort-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.sort-bar label { font-size: 12px; color: var(--muted); margin-right: 2px; }

.sort-chip {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.sort-chip:hover { border-color: var(--border-hover); color: var(--text); }
.sort-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.spacer { flex: 1; }

.view-toggle { display:flex; border:1px solid var(--border); border-radius:7px; overflow:hidden; }
.vt-btn { padding:5px 10px; background:none; border:none; color:var(--muted); cursor:pointer; font-size:15px; transition:all .15s; }
.vt-btn.active { background:var(--accent); color:#fff; }

/* ── MAIN ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.clips-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.clips-scroll::-webkit-scrollbar { width: 5px; }
.clips-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius:3px; }

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 14px 0 2px;
}

/* GRID */
.clips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* LIST */
.clips-list { display:flex; flex-direction:column; gap:10px; }

/* ── CLIP CARD ── */
.clip-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, transform .25s, box-shadow .25s;
  animation: fadeUp .35s ease both;
}
.clip-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(124,106,247,0.18);
}

.thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #05050f;
  overflow: hidden;
}
.thumb-wrap video.thumb-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
  pointer-events: none;
}

.thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  transition: background .2s;
  z-index: 3;
}
.clip-card:hover .thumb-overlay { background: rgba(0,0,0,0.35); }

.play-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  transform: scale(0.85);
}
.clip-card:hover .play-btn { opacity: 1; transform: scale(1); }

.game-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: transform .15s;
  z-index: 4;
}
.game-badge:hover { transform: scale(1.05); }
.game-badge.untagged { background: rgba(102,102,128,0.4); color: var(--muted); }

.tag-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  font-size: 13px;
  display: flex; align-items:center; justify-content:center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
  z-index: 4;
}
.clip-card:hover .tag-btn { opacity: 1; }

.del-btn {
  position: absolute;
  bottom: 8px; right: 8px;
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(247,106,138,0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items:center; justify-content:center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s, transform .15s;
  z-index: 4;
}
.del-btn:hover { transform: scale(1.1); }
.clip-card:hover .del-btn { opacity: 1; }

.clip-meta {
  padding: 10px 12px;
}
.clip-filename {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.clip-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.clip-poster-row { display:flex; align-items:center; gap:5px; }

.clip-reactions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.reaction-pill i {
  font-size: 11px;
}

.reaction-pill.mine {
  border-color: var(--accent);
  color: #fff;
  background: color-mix(in srgb, var(--accent) 38%, transparent);
}

/* LIST ITEM */
.clip-list-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  animation: fadeUp .3s ease both;
}
.clip-list-item:hover { border-color: var(--accent); background: var(--surface2); }

.list-thumb {
  width: 150px;
  flex-shrink: 0;
  aspect-ratio: 16/9;
  border-radius: 7px;
  overflow: hidden;
  background: #05050f;
  position: relative;
}
.list-thumb video.thumb-video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 0.3s;
  pointer-events: none;
}
.list-thumb-overlay {
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,0.3);
  font-size: 20px;
}

.list-info { flex:1; display:flex; flex-direction:column; justify-content:center; gap:5px; }
.list-title { font-size:14px; font-weight:700; }
.list-tags { display:flex; flex-wrap:wrap; gap:6px; }
.list-tag { font-size:11px; font-family:'JetBrains Mono',monospace; background:var(--surface2); border:1px solid var(--border); padding:2px 8px; border-radius:20px; color:var(--muted); }
.list-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; }

/* ── EMPTY STATE ── */
.empty {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-icon { font-size: 56px; margin-bottom: 4px; }
.empty h2 { font-family:'JetBrains Mono',monospace; font-size:20px; color:var(--text); }
.empty p { font-size:14px; max-width:340px; line-height:1.6; }
.empty .hdr-btn { margin-top:8px; }

/* ── TIKTOK MODE ── */
.tiktok-overlay {
  position: fixed; inset: 0;
  background: #000;
  z-index: 200;
  display: none;
  flex-direction: column;
}
.tiktok-overlay.open { display: flex; }

.tiktok-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: 14px 18px;
  display: flex; align-items:center; justify-content:space-between;
  background: linear-gradient(to bottom, rgba(0,0,0,.85), transparent);
  transition: opacity .2s ease;
}

.tiktok-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tiktok-logo { font-family:'JetBrains Mono',monospace; font-weight:800; font-size:18px; letter-spacing:-.5px; }
.tiktok-close {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family:'JetBrains Mono',monospace;
  font-size:13px;
  font-weight:600;
  backdrop-filter: blur(10px);
  transition: none;
}
.tiktok-close:hover { background: rgba(255,255,255,0.1); }

.tiktok-edit {
  display: none;
}

.tiktok-feed {
  flex: 1;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.tiktok-feed::-webkit-scrollbar { display:none; }

.tiktok-slide {
  height: 100vh;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.tk-video-wrap {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tk-video {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 0;
  position: relative;
  z-index: 1;
}

.tk-thumb-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.tk-pause-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 5;
  text-shadow: 0 2px 20px rgba(0,0,0,0.8);
}
.tk-video-wrap.paused .tk-pause-indicator { opacity: 1; }

.tk-gradient-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0,0,0,.95) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
  pointer-events: none;
  z-index: 3;
}

/* Bottom info bar — compact single row */
.tk-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 6;
  padding: 12px 14px 14px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.tk-info {
  flex: 1;
  min-width: 0;
  transition: opacity .2s ease;
}
.tk-info-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.tk-game-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.tk-filename {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 6px rgba(0,0,0,.9);
  margin-bottom: 4px;
}
.tk-poster {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
}
.tk-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-left: 4px;
}

/* Side action buttons */
.tk-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-bottom: 4px;
  z-index: 6;
}
.tk-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: none;
}
.tk-action:hover { transform: none; }
.tk-action-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  backdrop-filter: blur(8px);
  transition: none;
}
.tk-action-icon i {
  font-size: 16px;
  line-height: 1;
}
.tk-action:hover .tk-action-icon { background: rgba(255,255,255,0.12); }
.tk-action span { font-size: 10px; color: rgba(255,255,255,.6); font-family: 'JetBrains Mono', monospace; }

.tk-action[data-role="react-up"] span,
.tk-action[data-role="react-down"] span {
  min-width: 54px;
  text-align: center;
}

.tk-action.react-up.active .tk-action-icon {
  /* Active reactions intentionally stay neutral (no green/red) per current UX preference. */
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

.tk-action.react-down.active .tk-action-icon {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}

.tiktok-overlay.ui-fade .tiktok-topbar,
.tiktok-overlay.ui-fade .tk-info {
  /* Auto-hide only top metadata; nav/action controls remain available while watching. */
  opacity: 0;
  pointer-events: none;
}

.tk-audio-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 8px;
}
.tk-audio-hover {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.tk-audio-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.12);
  color: white;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tk-audio-btn svg {
  width: 16px;
  height: 16px;
}
.tk-audio-pop {
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  width: 156px;
  padding: 6px 8px;
  backdrop-filter: blur(8px);
  z-index: 8;
}
.tk-audio-row:hover .tk-audio-pop,
.tk-audio-row:focus-within .tk-audio-pop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.tk-volume-inline {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.3);
  outline: none;
  cursor: pointer;
}
.tk-volume-inline::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  cursor: pointer;
}
.tk-scrub-wrap {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tk-scrub-track {
  flex: 1;
  position: relative;
  height: 8px;
  display: flex;
  align-items: center;
}
.tk-progress-inline {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 99px;
  overflow: hidden;
  pointer-events: none;
}
.tk-progress-inline .tk-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .1s linear;
}
.tk-scrub {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 2;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  outline: none;
  cursor: pointer;
}
.tk-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.tk-time-total {
  min-width: 42px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,.72);
}

/* ── GAME TAG PICKER ── */
.tag-picker {
  position: fixed;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
  animation: popIn .15s ease;
}
.tag-picker.open { display:flex; }
.tag-picker-item {
  display:flex; align-items:center; gap:8px;
  padding:7px 10px;
  border-radius:7px;
  cursor:pointer;
  font-size:13px;
  font-weight:600;
  transition:background .15s;
}
.tag-picker-item:hover { background:var(--surface2); }
.tag-picker-dot { width:10px; height:10px; border-radius:3px; flex-shrink:0; }

/* ── VIDEO MODAL ── */
.video-modal {
  position:fixed; inset:0;
  background:rgba(0,0,0,.88);
  z-index:300;
  display:none;
  align-items:center;
  justify-content:center;
  backdrop-filter:blur(8px);
}
.video-modal.open { display:flex; }
.video-modal-inner {
  position:relative;
  width:min(860px,95vw);
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
}
.video-modal video {
  width:100%;
  display:block;
  max-height:75vh;
  object-fit:contain;
  background:#000;
}
.video-modal-bar {
  padding:14px 18px;
  display:flex; align-items:center; justify-content:space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.video-modal-title { font-family:'JetBrains Mono',monospace; font-size:15px; font-weight:700; flex: 1; min-width: 180px; }
.video-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.modal-react-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 92px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, background .15s, color .15s;
}
.modal-react-btn:hover {
  border-color: var(--border-hover);
  background: var(--surface);
}
.modal-react-btn i {
  font-size: 13px;
  line-height: 1;
}
.modal-react-btn.active {
  background: var(--surface);
  border-color: var(--accent);
  color: #fff;
}
.modal-close {
  background:var(--surface2); border:1px solid var(--border);
  color:var(--text); padding:6px 14px; border-radius:7px;
  cursor:pointer; font-family:'JetBrains Mono',monospace; font-weight:600; font-size:13px;
}

.edit-modal-inner {
  width: min(520px, 95vw);
}

.edit-form {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-field label {
  font-size: 12px;
  color: var(--muted);
}

.edit-field input,
.edit-field select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 9px 10px;
  outline: none;
}

.edit-field input:focus,
.edit-field select:focus {
  border-color: var(--accent);
}

.edit-actions {
  margin-top: 2px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity:0; transform:translateY(14px); }
  to { opacity:1; transform:translateY(0); }
}
@keyframes popIn {
  from { opacity:0; transform:scale(.92); }
  to { opacity:1; transform:scale(1); }
}

/* ── GAME COLORS ── */
.g-val { --gc:#ff4655; --gb:rgba(255,70,85,0.2); }
.g-mc  { --gc:#57f287; --gb:rgba(87,242,135,0.2); }
.g-lol { --gc:#c89b3c; --gb:rgba(200,155,60,0.2); }
.g-fn  { --gc:#5699dc; --gb:rgba(86,153,220,0.2); }
.g-apex{ --gc:#cd4300; --gb:rgba(205,67,0,0.2); }
.g-cs  { --gc:#ffaa00; --gb:rgba(255,170,0,0.2); }
.g-ow  { --gc:#fa9c1a; --gb:rgba(250,156,26,0.2); }
.g-cod { --gc:#a3d977; --gb:rgba(163,217,119,0.2); }
.g-other{ --gc:#8888aa; --gb:rgba(136,136,170,0.2); }

/* ── DATE FILTER ── */
.date-filter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.date-filter .date-input-btn,
.date-filter select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.date-filter select {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.date-filter select option {
  background: var(--surface2);
  color: #fff;
}
.date-filter select option:checked {
  background: var(--accent);
  color: #fff;
}
.date-filter .date-input-btn:focus,
.date-filter select:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, white 20%);
  box-shadow: 0 0 0 3px rgba(52,41,152,.24);
}
.date-filter .date-input-btn {
  font-family: 'JetBrains Mono', monospace;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.date-filter .date-input-btn::after {
  content: '📅';
  font-size: 13px;
  opacity: .9;
}
.date-clear-btn {
  background: color-mix(in srgb, var(--surface2) 84%, black 16%);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all .15s;
}
.date-clear-btn:hover { border-color: var(--accent2); color: var(--accent2); }
.date-range-summary {
  font-size: 11px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 3px;
}

.calendar-pop {
  display: none;
  position: relative;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
  border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface2) 88%, var(--accent) 12%), var(--surface));
  box-shadow: 0 18px 44px rgba(0,0,0,.44), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 10px;
  animation: popIn .16s ease;
}
.calendar-pop.open {
  display: block;
}
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.calendar-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
}
.calendar-nav {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
}
.calendar-week,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.calendar-week div {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
  font-family: 'JetBrains Mono', monospace;
}
.calendar-day {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  min-height: 30px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.calendar-day:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
}
.calendar-day.muted {
  opacity: .35;
  pointer-events: none;
}
.calendar-day.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.calendar-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.calendar-actions button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 7px;
  cursor: pointer;
}
.calendar-actions .calendar-apply {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── MOBILE ── */
/* ── LOGIN OVERLAY ── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-overlay.hidden { display: none; }
.login-card {
  width: min(380px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.login-logo {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-error {
  font-size: 12px;
  color: #f76a8a;
  min-height: 18px;
  line-height: 1.4;
}
.login-submit {
  width: 100%;
  justify-content: center;
  padding: 10px;
  font-size: 14px;
  margin-top: 4px;
}
.login-submit:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }

/* ── MOBILE ── */
@media (max-width: 600px) {
  body { overflow: auto; height: auto; min-height: 100dvh; }

  header {
    height: auto;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }
  .header-center { order: 3; width: 100%; }
  .search-wrap { width: 100%; }
  .search-wrap input { width: 100% !important; }
  .hdr-btn span { display: none; }
  #clipCount { display: none; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .auth-status { max-width: 120px; }

  .app-body { flex-direction: column; overflow: visible; }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    padding: 8px 12px;
    gap: 6px;
    height: auto;
    min-height: unset;
  }
  .sidebar-section { padding: 0; display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
  .sidebar-label { display: none; }
  .sidebar-divider { width: 1px; height: 28px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
  .sb-item {
    white-space: nowrap;
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 5px 12px;
    font-size: 12px;
  }
  .sb-item.active { background: var(--accent); color: #fff; border-color: var(--accent); }
  .sb-count { display: none; }

  .main-area { overflow: visible; }
  .clips-scroll { overflow: visible; height: auto; }

  .sort-bar { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
  .spacer { display: none; }
  .view-toggle { margin-left: auto; }

  .clips-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
    padding: 12px;
  }

  .clip-card { font-size: 12px; }
  .clip-filename { font-size: 11px; }

  .clip-list-item { flex-wrap: wrap; }
  .list-thumb { width: 100%; aspect-ratio: 16/9; border-radius: 8px; }
  .list-actions { width: 100%; justify-content: flex-end; }

  .video-modal-inner { width: 98vw; }

}

@media (max-width: 380px) {
  .clips-grid { grid-template-columns: 1fr !important; }
}