*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #060a14; }
body::before {
  content: ''; position: fixed; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 28px 28px; pointer-events: none; z-index: 0;
}
#canvas {
  position: fixed; top: 0; left: 0; z-index: 1;
  cursor: grab; touch-action: none;
  /* iOS Safari: force the canvas onto its own GPU layer at full resolution.
     Without these, Safari may composite the canvas into a downsampled tile
     while keeping DOM text crisp — exactly what causes "DOM sharp, canvas
     blurry" on iPhones. */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  image-rendering: -webkit-optimize-contrast;
}
#canvas.dragging { cursor: grabbing; }
#hamburger {
  flex-shrink: 0;
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.16);
  border-radius: 7px; cursor: pointer; pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  transition: background 0.15s, border-color 0.15s;
}
#hamburger:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.35); }
#hamburger span { display: block; width: 14px; height: 1.5px; background: rgba(255,255,255,0.88); border-radius: 1px; }
#header {
  position: fixed; top: 24px; left: 24px; z-index: 30;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  padding: 16px 20px 18px;
  background: linear-gradient(180deg, rgba(7,10,18,0.92), rgba(7,10,18,0.58));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.35);
  transition: left 0.28s ease;
}
#header.pushed { left: calc(360px + 20px); }
.h-row { display: flex; align-items: center; gap: 14px; }
.h-title {
  font-family: 'Bebas Neue', cursive; font-size: 46px; letter-spacing: 6px;
  color: #ffffff; line-height: 0.95; text-shadow: 0 2px 16px rgba(0,0,0,0.45);
}
.h-pip {
  width: 10px; height: 10px; border-radius: 50%; background: #ff9f1c;
  align-self: center; flex-shrink: 0; box-shadow: 0 0 18px rgba(255,159,28,0.95);
}
.h-sub {
  font-family: 'Barlow Condensed', sans-serif; font-size: 19px; font-weight: 700;
  letter-spacing: 2.4px; color: rgba(255,255,255,0.92); text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.38);
}
#sidebar {
  position: fixed; top: 0; left: 0; height: 100%; width: 360px; z-index: 25;
  display: flex; flex-direction: column; gap: 28px;
  padding: 28px 26px 36px;
  background: linear-gradient(180deg, rgba(7,10,18,0.98), rgba(7,10,18,0.94));
  border-right: 1px solid rgba(255,255,255,0.09);
  box-shadow: 6px 0 40px rgba(0,0,0,0.5);
  transform: translateX(-100%); transition: transform 0.28s ease;
  overflow-y: auto;
}
#sidebar.open { transform: translateX(0); }
.sb-section { display: flex; flex-direction: column; gap: 12px; }
.sb-heading {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: 2.4px; text-transform: uppercase; color: rgba(255,255,255,0.42);
}
.sb-body {
  font-family: 'DM Mono', monospace; font-size: 12px; font-weight: 300;
  line-height: 1.7; letter-spacing: 0.4px; color: rgba(255,255,255,0.72);
}
.sb-link { color: rgba(255,255,255,0.9); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.sb-link:hover { color: #ff9f1c; }
.sb-nav {
  display: flex; gap: 6px; padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sb-nav-btn {
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  background: none; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px; color: rgba(255,255,255,0.5);
  padding: 6px 14px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sb-nav-btn:hover { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.3); }
.sb-nav-btn.active { color: #fff; border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.07); }
.sb-page { display: flex; flex-direction: column; gap: 24px; }
.sb-hidden { display: none; }
.sb-donate {
  display: inline-block; font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: 1.8px; text-transform: uppercase;
  color: rgba(255,255,255,0.7); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px; padding: 8px 16px; text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.sb-donate:hover { color: #fff; border-color: rgba(255,255,255,0.5); }
#vp {
  position: fixed; top: 24px; right: 38px; z-index: 10; pointer-events: auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  padding: 16px 20px 18px;
  background: linear-gradient(180deg, rgba(7,10,18,0.92), rgba(7,10,18,0.58));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0,0,0,0.35);
  text-align: right;
}
#vp-close {
  position: absolute; top: -11px; right: -11px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(7,10,18,0.98); border: 1px solid rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.92); font-family: 'DM Mono', monospace;
  font-size: 18px; line-height: 1; display: flex; align-items: center;
  justify-content: center; cursor: pointer; padding: 0; pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4); transition: background 0.15s, border-color 0.15s;
}
#vp-close:hover { background: rgba(20,24,38,1); border-color: rgba(255,255,255,0.55); color: #fff; }
#vp.hidden { display: none; }
#vp-show {
  position: fixed; top: 24px; right: 38px; z-index: 10;
  font-family: 'Barlow Condensed', sans-serif; font-size: 14px; font-weight: 700;
  letter-spacing: 2.4px; text-transform: uppercase; white-space: nowrap;
  color: rgba(255,255,255,0.92);
  background: linear-gradient(180deg, rgba(7,10,18,0.92), rgba(7,10,18,0.72));
  border: 1px solid rgba(255,255,255,0.18); border-radius: 10px;
  padding: 10px 18px; cursor: pointer; pointer-events: auto;
  box-shadow: 0 6px 18px rgba(0,0,0,0.32); transition: background 0.15s, border-color 0.15s;
  display: none; align-items: center; justify-content: center;
}
#vp-show.visible { display: flex; }
#vp-show:hover { background: rgba(20,24,38,1); border-color: rgba(255,255,255,0.42); color: #fff; }
.vp-main {
  font-family: 'Barlow Condensed', sans-serif; font-size: 19px; font-weight: 700;
  letter-spacing: 2.4px; color: rgba(255,255,255,0.92); text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0,0,0,0.38);
}
.vp-meta {
  font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 400;
  letter-spacing: 1.5px; color: rgba(255,255,255,0.86);
  text-shadow: 0 2px 10px rgba(0,0,0,0.38);
}
.vp-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  max-width: 420px;
}
.vp-link {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: rgba(255,255,255,0.96);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  pointer-events: auto;
}
.vp-link:hover { opacity: 0.88; }
.vp-link-nba { color: #ff9f1c; }
.vp-link-hoops { color: #ffd84d; }
.vp-counts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  width: 100%;
}
.vp-count-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}
.vp-count-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.74);
}
.vp-count-value {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 1.2px;
}
.vp-count-value.nba { color: #ff9f1c; }
.vp-count-value.hoops { color: #ffd84d; }
.vp-count-value.combined { color: rgba(255,255,255,0.94); }
.vp-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 14px;
  margin-top: 2px;
  width: 100%;
}
.vp-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px; font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  user-select: none;
}
.vp-filter input {
  accent-color: #ff9f1c;
  cursor: pointer;
}
.vp-filter-hoops input {
  accent-color: #ffd84d;
}
.vp-filter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}
.vp-filter-dot.nba { color: #ff9f1c; background: #ff9f1c; }
.vp-filter-dot.hoops { color: #ffd84d; background: #ffd84d; }
#hint {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px; letter-spacing: 3px;
  text-transform: uppercase; color: rgba(255,255,255,0.12);
  z-index: 10; pointer-events: none; transition: opacity 2s;
}
#hint.gone { opacity: 0; }


/* ── Popup card ── */
#popup {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  max-width: 360px;
}
#popup.visible { opacity: 1; }
#popup-inner {
  background: rgba(7, 9, 18, 0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 16px 20px 18px;
  backdrop-filter: blur(20px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
}
#popup-date {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 10px;
}
#popup-desc {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: rgba(232,232,242,0.82);
  line-height: 1.55;
}
#popup-source {
  margin-top: 12px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.58);
}
#popup-source a {
  color: rgba(255,159,28,0.92);
  text-decoration: underline;
}
/* desktop: popup-inner becomes interactive only when locked (clicked) */
#popup.locked #popup-inner { pointer-events: auto; cursor: auto; }

/* connector line from bubble to card */
#popup-stem {
  position: absolute;
  width: 1px;
  background: rgba(255,255,255,0.18);
  transform-origin: top center;
}


@media (max-width: 760px) {
  #header {
    top: 12px; left: 14px; right: 12px;
    padding: 12px 14px 13px; gap: 6px; border-radius: 12px;
  }
  #sidebar { width: 270px; }
  #header.pushed { left: calc(270px + 10px); right: 12px; }
  .h-row { gap: 10px; }
  .h-title { font-size: 31px; letter-spacing: 3.2px; }
  .h-pip { width: 8px; height: 8px; }
  .h-sub { font-size: 12px; letter-spacing: 1.5px; line-height: 1.2; }
  #vp {
    left: 14px; right: 12px; top: 96px;
    padding: 11px 14px 12px;
    align-items: flex-start; text-align: left; border-radius: 12px;
  }
  .vp-main {
    font-size: 15px;
    letter-spacing: 1.7px;
  }
  .vp-meta {
    font-size: 11px;
    letter-spacing: 1.1px;
    line-height: 1.3;
  }
  .vp-count-label { font-size: 11px; letter-spacing: 1.2px; }
  .vp-count-value { font-size: 11px; letter-spacing: 0.9px; }
  .vp-filter { font-size: 11px; }
  #hint {
    bottom: 22px; font-size: 11px; letter-spacing: 2px;
    color: rgba(255,255,255,0.22); padding: 0 18px; text-align: center;
  }
  #popup { max-width: min(320px, calc(100vw - 22px)); }
  #popup-inner { padding: 14px 16px 15px; }
  #popup-date { font-size: 12px; letter-spacing: 1.6px; }
  #popup-desc { font-size: 15px; line-height: 1.45; }
  #popup-source { font-size: 11px; letter-spacing: 1px; }
  /* mobile: popup is always interactive when visible (tap → links work) */
  #popup.visible #popup-inner { pointer-events: auto; }
  /* mobile vp-show position is set by JS; just clear CSS defaults */
  #vp-show { bottom: auto; }
}

