/* ============ Base / Reset ============ */
:root {
  --bg: #0f1923;
  --bg-alt: #0b1218;
  --panel: #17222e;
  --panel-2: #1e2b39;
  --border: #263545;
  --border-soft: #1e2a36;
  --accent: #ff4655;
  --accent-hover: #ff5c69;
  --text: #ece8e1;
  --text-muted: #8b98a5;
  --text-faint: #5d6b78;
  --good: #4ade80;
  --warning: #fbbf24;
  --blue: #4f98ff;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font-head: "Rajdhani", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: radial-gradient(1200px 600px at 80% -10%, rgba(255, 70, 85, 0.08), transparent 60%),
    radial-gradient(1000px 500px at 0% 0%, rgba(79, 152, 255, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-head);
  letter-spacing: 0.02em;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
}

input, select, textarea {
  font-family: var(--font-body);
  color: var(--text);
}

img {
  -webkit-user-drag: none;
}

.hidden {
  display: none !important;
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 18, 24, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #b32233);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 17px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(255, 70, 85, 0.35);
}

.brand h1 {
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand .tagline {
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  padding: 9px 15px;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 70, 85, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 70, 85, 0.06);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(255, 70, 85, 0.5);
}

.btn-danger:hover {
  background: rgba(255, 70, 85, 0.12);
}

.btn-block {
  width: 100%;
}

/* ============ Login ============ */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: radial-gradient(800px 400px at 50% -10%, rgba(255, 70, 85, 0.12), transparent 60%), var(--bg);
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 340px;
  padding: 32px 28px;
  text-align: center;
  animation: modalIn 0.18s ease;
}

.login-card .brand-logo {
  margin: 0 auto 16px;
  width: 52px;
  height: 52px;
  font-size: 22px;
}

.login-card h2 {
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 20px;
}

#loginForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#loginPassword {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  text-align: center;
  color: var(--text);
}

#loginPassword:focus {
  border-color: var(--accent);
}

.login-error {
  color: var(--accent);
  font-size: 13px;
  margin: -4px 0;
}

/* ============ Layout ============ */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ============ Sidebar ============ */
.sidebar {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 76px;
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
  }
}

.filter-group h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* map list */
.map-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.map-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  padding: 8px 10px;
  text-align: left;
}

.map-btn:hover {
  background: var(--panel-2);
}

.map-btn.active {
  background: rgba(255, 70, 85, 0.12);
  border-color: rgba(255, 70, 85, 0.4);
  color: #fff;
}

.map-btn .map-count {
  font-size: 12px;
  color: var(--text-faint);
}

/* agent grid */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.agent-btn {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
}

.agent-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-btn:hover {
  border-color: var(--accent);
}

.agent-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 70, 85, 0.4);
}

.agent-btn.any {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* segmented control */
.seg {
  display: flex;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 4px;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ============ Content ============ */
.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ============ Minimap ============ */
.minimap-panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
}

.minimap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.minimap-header h2 {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spot-toggle {
  display: flex;
  gap: 8px;
}

.spot-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.spot-btn:hover {
  border-color: var(--accent);
}

.spot-btn.active {
  border-color: var(--accent);
  background: rgba(255, 70, 85, 0.12);
  color: #fff;
}

.minimap-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* zoom controls */
.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.zoom-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  border-radius: 5px;
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.zoom-btn:hover {
  background: var(--accent);
  color: #fff;
}

.zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* scrollable / zoomable minimap */
.minimap-scroll {
  max-height: 520px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
  user-select: none;
  cursor: grab;
}

.minimap-scroll:active {
  cursor: grabbing;
}

.minimap-canvas {
  position: relative;
  width: 100%;
  transform-origin: top left;
  transition: transform 0.12s ease;
}

.minimap-canvas img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

#minimapMarkers {
  position: absolute;
  inset: 0;
}

/* position markers (start / end) */
.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #0f1923;
  border: 2px solid #fff;
  overflow: hidden;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  z-index: 2;
}

.map-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-marker:hover {
  transform: translate(-50%, -50%) scale(1.25);
}

.map-marker.start {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 152, 255, 0.35);
}

.map-marker.end {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 70, 85, 0.35);
}

.map-marker.no-icon.start { background: var(--blue); }
.map-marker.no-icon.end { background: var(--accent); }

.map-marker .mm-count {
  position: absolute;
  top: -4px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 1.5px solid #fff;
}

.map-marker.highlight {
  animation: markerPulse 1s ease;
}

@keyframes markerPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9); }
  100% { box-shadow: 0 0 0 24px rgba(255, 255, 255, 0); }
}

/* legend */
.minimap-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  display: inline-block;
}

.legend-dot.start { background: var(--blue); }
.legend-dot.end { background: var(--accent); }

.mm-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* Map gallery (shown when no map is selected) */
.gallery-title {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.map-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.map-gallery-item {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.map-gallery-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.map-gallery-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: var(--bg-alt);
}

.map-gallery-item span {
  display: block;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 4px;
  color: var(--text);
}

/* Modal minimap (click to set start/end) */
.modal-minimap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.modal-minimap-scroll {
  position: relative;
  max-height: 360px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
  user-select: none;
  cursor: crosshair;
}

.modal-minimap-canvas {
  position: relative;
  width: 100%;
  transform-origin: top left;
  transition: transform 0.12s ease;
}

.modal-minimap-canvas img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

#modalMinimapMarkers {
  position: absolute;
  inset: 0;
}

.spot-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============ Results head ============ */
.results-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-head h2 {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 11px;
}

/* ============ Grid & Cards ============ */
.lineup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.card-image {
  position: relative;
  height: 165px;
  background: var(--bg-alt);
  overflow: hidden;
}

.card-image > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-image .image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-size: 54px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.12);
  background: radial-gradient(400px 200px at 20% 0%, rgba(255, 70, 85, 0.12), transparent 60%), var(--bg-alt);
}

.card-agent-avatar {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  background: var(--panel-2);
}

.card-agent-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-clip-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 9px;
  backdrop-filter: blur(4px);
}

.card-ability {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.7);
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 6px;
  padding: 3px 8px;
  backdrop-filter: blur(4px);
}

.card-ability img {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.card-title {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-map { background: rgba(79, 152, 255, 0.15); color: #8fb9ff; }
.badge-agent { background: rgba(255, 70, 85, 0.15); color: #ff8f98; }
.badge-type { background: rgba(251, 191, 36, 0.12); color: #ffd166; }
.badge-side { background: rgba(74, 222, 128, 0.12); color: #8df0b0; }
.badge-tag { background: var(--panel-2); color: var(--text-muted); border: 1px solid var(--border-soft); }

.card-spots {
  font-size: 13px;
  color: var(--text-muted);
}

.card-spots a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
}

.card-spots a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-description {
  font-size: 13px;
  color: var(--text-muted);
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-clips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.card-actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
}

.card-actions .btn {
  flex: 1;
}

.card-flash {
  animation: cardFlash 1.5s ease;
}

@keyframes cardFlash {
  0% { box-shadow: 0 0 0 0 rgba(255, 70, 85, 0.7); border-color: var(--accent); }
  40% { box-shadow: 0 0 0 10px rgba(255, 70, 85, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 70, 85, 0); }
}

/* ============ Empty state ============ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  color: var(--text-faint);
  margin-bottom: 14px;
}

.empty-state h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  margin-bottom: 18px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(6, 10, 14, 0.75);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.modal-header h2 {
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--accent);
  background: rgba(255, 70, 85, 0.08);
}

.modal form {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-span-2 {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(255, 70, 85, 0.05);
}

.dropzone small {
  display: block;
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 12px;
}

.media-preview {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.media-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.media-preview-video {
  width: 100%;
  max-height: 240px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #000;
}

/* clip list in modal */
.clip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.clip-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 6px;
}

.clip-item .clip-thumb {
  width: 64px;
  height: 44px;
  border-radius: 5px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.clip-item .clip-thumb img,
.clip-item .clip-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-item .clip-thumb .play-ic {
  color: #fff;
}

.clip-item .clip-meta {
  flex: 1;
  font-size: 12.5px;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip-item .clip-meta b {
  color: var(--text);
  font-weight: 600;
}

.clip-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.clip-error {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.clip-item-error .clip-meta {
  color: var(--accent);
}

.dropzone.busy {
  pointer-events: none;
  opacity: 0.55;
}
.dropzone.busy::after {
  content: 'Uploading…';
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ============ Detail modal ============ */
.detail-modal {
  max-width: 780px;
}

.detail-content {
  padding: 22px;
}

.detail-hero {
  position: relative;
  width: 100%;
  height: 260px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-alt);
  margin-bottom: 16px;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero .image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-size: 80px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.12);
  background: radial-gradient(500px 250px at 20% 0%, rgba(255, 70, 85, 0.12), transparent 60%), var(--bg-alt);
}

.detail-title {
  font-family: var(--font-head);
  font-size: 24px;
  margin-bottom: 10px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-positions {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.detail-positions b {
  color: var(--text);
}

.detail-description {
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--text);
  margin-bottom: 18px;
}

/* clip slideshow */
.detail-slides {
  position: relative;
}

.detail-slides-title {
  font-family: var(--font-head);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.detail-slides-viewport {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  min-height: 60px;
}

.detail-slide {
  display: none;
}

.detail-slide.active {
  display: block;
}

.detail-slide video,
.detail-slide img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: contain;
  margin: 0 auto;
  background: #000;
}

.slide-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 5;
  transition: background 0.15s ease;
}

.slide-nav:hover {
  background: var(--accent);
}

.slide-prev { left: 10px; }
.slide-next { right: 10px; }

.slide-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.slide-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}

.slide-dot.active {
  background: var(--accent);
  transform: scale(1.25);
}

/* ============ Cluster popover ============ */
.cluster-popover {
  position: fixed;
  z-index: 90;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 260px;
  max-width: 340px;
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}

.cluster-popover-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 6px 8px;
}

/* mini-map with pins inside the popover */
.cluster-map {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border-soft);
  margin-bottom: 6px;
  pointer-events: none;
}

.cluster-map img {
  display: block;
  width: 100%;
  height: auto;
}

.cluster-map-pins {
  position: absolute;
  inset: 0;
}

.cluster-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.cluster-pin.start {
  background: var(--blue);
}

.cluster-pin.end {
  background: var(--accent);
}

/* cluster start dots shown on the real map */
#clusterStartDots {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none; /* let clicks reach the markers beneath */
}

.cluster-start {
  /* zero-size anchor pinned exactly at the coordinate; pin + label are
     absolutely positioned children so the pin is never offset by the label */
  position: absolute;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto; /* the dots themselves must stay clickable */
}

.cs-pin {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(79, 152, 255, 0.35);
  transition: transform 0.1s ease;
}

.cs-label {
  position: absolute;
  left: 11px;
  top: 0;
  transform: translateY(-50%);
  background: rgba(11, 18, 24, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--blue);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.detail-no-clips {
  color: var(--text-faint);
  font-size: 13px;
  padding: 12px 2px;
}

/* thumbnail preview when hovering a blue start dot */
.dot-thumb {
  position: fixed;
  z-index: 1000;
  width: 150px;
  background: rgba(11, 18, 24, 0.95);
  border: 1px solid var(--blue);
  border-radius: 8px;
  padding: 6px;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  text-align: center;
}
.dot-thumb img {
  width: 100%;
  max-height: 90px;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}
.dot-thumb .dot-thumb-title {
  margin-top: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dot-thumb.no-img {
  display: grid;
  place-items: center;
  min-height: 48px;
}
.dot-thumb.no-img .dot-thumb-title {
  margin-top: 0;
}

.cluster-start:hover .cs-pin {
  transform: translate(-50%, -50%) scale(1.3);
}

.cluster-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.cluster-item:hover {
  background: var(--panel);
}

.cluster-item img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}

.cluster-item .ci-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-item .ci-meta small {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
}

/* ============ Ability filter ============ */
#abilityFilter {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  cursor: pointer;
  color: var(--text);
}

#abilityFilter:focus {
  border-color: var(--accent);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  animation: toastIn 0.2s ease;
}

.toast.toast-success { border-color: rgba(74, 222, 128, 0.5); }
.toast.toast-error { border-color: rgba(255, 70, 85, 0.6); }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ Scrollbars ============ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ============ Responsive ============ */
@media (max-width: 620px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-span-2 {
    grid-column: span 1;
  }

  .minimap-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
