@font-face {
  font-family: "Kenyan Coffee";
  src: url("../assets/fonts/Kenyan Coffee Bd.otf") format("opentype");
  font-weight: 700;
}
@font-face {
  font-family: "Kenyan Coffee";
  src: url("../assets/fonts/Kenyan Coffee Rg.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Kenyan Coffee";
  src: url("../assets/fonts/Kenyan Coffee Rg It.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
}

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-border: #2a3240;
  --accent: #f99e1a;
  --accent-2: #3fa7d6;
  --measure: #a855f7;
  --text: #e6edf3;
  --text-dim: #8b96a5;
}

* { box-sizing: border-box; }

html {
  margin: 0;
}
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
}

h1, h2, h3, .hero-name {
  font-family: "Kenyan Coffee", system-ui, sans-serif;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.toggle-label input { accent-color: var(--accent); }

/* --- Hero picker buttons (used inside the CHANGE HERO overlay) --- */
.hero-btn {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--bg);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.hero-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-btn:hover { border-color: var(--text-dim); }
.hero-btn.selected { border-color: var(--accent); }
.hero-btn.hero-btn-blocked {
  cursor: not-allowed;
  opacity: 0.3;
}
.hero-btn.hero-btn-blocked img { filter: grayscale(1) brightness(0.6); }
.hero-btn.hero-btn-blocked:hover { border-color: transparent; }
.hero-btn-spacer { visibility: hidden; pointer-events: none; }

/* --- Map viewport ---
   Dragging to pan/measure is a custom pointer-based interaction, not a
   native browser drag or text selection - without these, a fast or
   slightly-off drag can trigger the browser's own text highlighting or
   start dragging an <img> as a native "ghost" drag-and-drop image instead
   of running our drag logic. */
#map-viewport {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
#map-viewport.grabbing { cursor: grabbing; }
#map-viewport.measure-mode { cursor: crosshair; }
#map-viewport img {
  -webkit-user-drag: none;
  user-drag: none;
}

.map-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.map-stage img.map-image {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* --- Lineup markers --- */
.marker {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff3;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(249, 158, 26, 0.6);
}
.marker img { width: 18px; height: 18px; pointer-events: none; }

.marker-target {
  position: absolute;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 2px solid #fff;
  overflow: hidden;
  cursor: pointer;
}
.marker-target img { width: 100%; height: 100%; object-fit: cover; }

.marker-line {
  position: absolute;
  top: 0; left: 0;
  pointer-events: none;
  overflow: visible;
}
.marker-line line {
  stroke: url(#lineup-gradient);
  stroke-width: 7;
}

.markers-layer.hidden { display: none; }

/* --- Rollout markers (start/end, revealed on click) --- */
.rollout-marker {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: var(--accent-2);
  border: 2px solid #fff3;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.rollout-marker.revealed { border-color: #fff; }
.rollout-target {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 3px;
  background: var(--accent-2);
  border: 2px solid #fff;
}
.rollout-line {
  stroke: var(--accent-2);
  stroke-width: 2.5;
}

/* --- Popup --- */
.popup {
  position: fixed;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 14px;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.popup h3 { margin: 0 0 6px; font-size: 15px; color: var(--accent); }
.popup video {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 8px;
  background: #000;
  display: block;
}
.popup p { margin: 4px 0; font-size: 13px; color: var(--text-dim); line-height: 1.4; }
.popup .stat { color: var(--text); font-weight: 600; }
.popup .close-btn {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 16px;
}

/* --- Jump spot overlay: a draggable rectangular window (distinct from the
   small hover .popup) that hosts the embedded YouTube demo for a spot. --- */
.jump-spot-overlay {
  position: fixed;
  width: 360px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.55);
  z-index: 40;
  overflow: hidden;
}
.jso-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 13px; font-weight: 700;
  cursor: grab;
  user-select: none;
}
.jso-header:active { cursor: grabbing; }
.jso-close {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 15px; padding: 0 2px;
}
.jso-body { padding: 10px; }
.jso-video-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
.jso-video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* YouTube Shorts are vertical (9:16) - a 16:9 box would letterbox them badly */
.jump-spot-overlay.is-short { width: 220px; }
.jump-spot-overlay.is-short .jso-video-wrap { aspect-ratio: 9 / 16; }
#jso-desc { margin: 8px 0 0; font-size: 13px; color: var(--text-dim); line-height: 1.4; }

/* --- Measure mode toggle button ---
   Hidden while the CHANGE HERO or CHANGE MAP overlay is open: it sits in
   the same bottom-left corner as those pickers and just clutters them. */
#hero-overlay:not([hidden]) ~ .measure-toggle,
#hero-overlay:not([hidden]) ~ .ruler-readout,
#hero-overlay:not([hidden]) ~ #ruler-svg,
#map-select-overlay:not([hidden]) ~ .measure-toggle,
#map-select-overlay:not([hidden]) ~ .ruler-readout,
#map-select-overlay:not([hidden]) ~ #ruler-svg {
  display: none;
}
.measure-toggle {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 25;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--measure);
  color: white;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.5);
}
.measure-toggle.active {
  background: #fff;
  color: var(--measure);
}

/* --- Ruler readout --- */
.ruler-readout {
  position: absolute;
  left: 84px;
  bottom: 20px;
  z-index: 25;
  background: var(--panel);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-family: "Noto Sans", system-ui, sans-serif;
  display: none;
}
.ruler-readout.visible { display: block; }
.ruler-readout .big { font-size: 20px; font-weight: 700; color: var(--measure); }
#ruler-throw-type-row {
  margin-top: 6px;
}
#ruler-throw-type {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 12px;
  text-transform: capitalize;
}

.ruler-line {
  stroke-width: 6;
}
.ruler-origin-dot {
  fill: #0095ff;
}
.ruler-end-dot {
  fill: #f7c03e;
}
.ruler-radius-circle {
  fill: #000000;
  fill-opacity: 0.4;
  stroke: #f7c03e;
  stroke-opacity: 1;
  stroke-width: 6;
}

.hidden-note {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-dim);
  z-index: 25;
}
