:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #f7f3ff;
  background: #110e1b;
  --line: #37304c;
  --muted: #b9afce;
  --pink: #ff81cb;
}
* { box-sizing: border-box; }
body {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: radial-gradient(ellipse at 55% -10%, #2d183a, transparent 58%), #110e1b;
}
.top, footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem 1rem;
  padding-inline: clamp(0.85rem, 3vw, 2rem);
}
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas: "identity support actions";
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.youtube-support {
  grid-area: support;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.36rem 0.68rem;
  border: 1px solid #5d2a4a;
  border-radius: 0.5rem;
  background: #2b152b;
  color: #fff5fa;
  font-size: 0.8rem;
  text-align: center;
  text-decoration: none;
}
.youtube-support:hover { background: #3a1d3b; }
.youtube-support:focus-visible { outline-offset: -3px; }
.youtube-support strong { color: #ffb1d5; text-decoration: underline; text-underline-offset: 0.17em; }
.youtube-play {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.02rem;
  border-radius: 0.28rem;
  background: #e00026;
  color: white;
  font-size: 0.62rem;
}
.header-actions { grid-area: actions; justify-self: end; display: flex; align-items: center; gap: .55rem; }
.header-actions .watch-route { background: #edff38; border-color: #edff38; color: #181b08; }
.header-actions .watch-route:hover { background: #f5ff90; border-color: #f5ff90; }
.subscribe-dialog {
  width: min(29rem, calc(100vw - 1.5rem));
  padding: clamp(1rem, 5vw, 1.8rem);
  border: 1px solid #925075;
  border-radius: 1rem;
  background: radial-gradient(ellipse at top, #382041, #191326 67%);
  color: #f7f3ff;
  text-align: center;
}
.subscribe-dialog::backdrop { background: #100b1ac9; }
.subscribe-dialog img { object-fit: contain; }
.subscribe-dialog h2 { margin: .55rem 0; font-size: clamp(1.3rem, 6vw, 1.85rem); line-height: 1.14; }
.subscribe-dialog p { margin: .65rem 0 1.15rem; color: #e5d9f2; }
.subscribe-dialog a {
  display: block;
  padding: .82rem .5rem;
  border-radius: .52rem;
  background: #ffafd9;
  color: #240d25;
  font-weight: 750;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.subscribe-dialog a:hover { background: #ffcbe6; }
.subscribe-dialog form { margin-top: .65rem; }
.subscribe-dialog button { min-height: 2.65rem; }
.route-player { width: min(64rem, calc(100vw - 1rem)); max-height: calc(100dvh - 1rem); padding: .85rem; border: 1px solid #716088; border-radius: .85rem; background: #191326; color: inherit; }
.route-player::backdrop { background: #0d0b15df; }
.route-player-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .65rem; }
.route-player-header h2 { margin: 0; font-size: 1.15rem; }
.route-player video { display: block; width: 100%; max-height: calc(100dvh - 6rem); border-radius: .45rem; aspect-ratio: 16/9; background: #0b0912; }
.identity { grid-area: identity; display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.identity img { object-fit: contain; flex: 0 0 auto; }
.heading p {
  color: var(--pink);
  margin: 0 0 0.12rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}
.heading p span { color: var(--muted); }
h1 {
  margin: 0;
  font-family: Bahnschrift, "Arial Narrow", "Segoe UI", sans-serif;
  font-size: clamp(1.18rem, 3.3vw, 1.75rem);
  line-height: 1.04;
}
.explorer {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-columns: clamp(17rem, 23vw, 24rem) minmax(0, 1fr);
  background: #151222;
}
.map-area {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: radial-gradient(ellipse at 50% 38%, #26203a, #151222 78%);
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #191326;
  border-right: 1px solid var(--line);
}
.sidebar-header { padding: 1.25rem 1rem 0.65rem; }
.sidebar h2 { font-size: 1.24rem; margin: 0 0 0.85rem; }
.search { display: grid; row-gap: 0.38rem; font-size: 0.875rem; color: var(--muted); }
.search input {
  width: 100%;
  min-height: 2.65rem;
  padding: 0.45rem 0.7rem;
  color: #f7f3ff;
  font: inherit;
  border: 1px solid #544768;
  border-radius: 0.55rem;
  background: #110e1b;
}
.search input::placeholder { color: #9b91af; }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.filters button { min-height: 2.15rem; padding: 0.36rem 0.58rem; }
.filters button[aria-pressed="true"],
#names[aria-pressed="true"], #pins[aria-pressed="true"] {
  background: #ffe0fa;
  border-color: #ffe0fa;
  color: #30142e;
}
.sidebar-results { overflow: auto; padding: 0 1rem 1rem; scrollbar-color: #654971 #1b1427; }
.result-count { margin: 0.25rem 0 0.55rem; color: var(--muted); font-size: 0.875rem; }
.result-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 0.4rem; }
.found-count { font-size: 0.8rem; color: #b7ed88; }
.filters .time-filter { border-color: #edff38; color: #edff38; }
.filters .time-filter[aria-pressed="true"] { background: #edff38; color: #17190a; }
.time-route-note {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.65rem;
  border-inline-start: 2px solid #edff38;
  background: #262635;
  font-size: 0.82rem;
  line-height: 1.45;
}
.progress-error { margin: 0 0 0.6rem; color: #ffcf9b; font-size: 0.8rem; }
.result-list, .source-list ul { padding: 0; margin: 0; list-style: none; }
.result-list { display: grid; gap: 0.45rem; }
.result-row { display: grid; grid-template-columns: minmax(0, 1fr) 2.5rem; gap: 0.36rem; }
.result-item {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  align-items: center;
  column-gap: 0.55rem;
  white-space: normal;
  padding: 0.55rem 0.7rem;
}
.result-item[aria-current="true"] { border-color: var(--pin-color); }
.result-photo {
  width: 3.2rem;
  height: 2.35rem;
  display: block;
  border-radius: 0.35rem;
  object-fit: cover;
  box-shadow: 0 0 0 1px #746485;
}
.result-progress { padding: 0; min-height: 2.5rem; align-self: center; color: #b9afce; }
.result-progress[aria-pressed="true"], .detail-progress[aria-pressed="true"] {
  border-color: #a8de77;
  background: #263b22;
  color: #d2ffa9;
}
.result-item strong { display: block; }
.result-item small { display: block; color: var(--muted); margin-top: 0.15rem; font-size: 0.8rem; }
.result-item .time-command { color: #edff38; font-weight: 700; }
.category-dot { justify-self: center; width: 0.62rem; height: 0.62rem; border-radius: 50%; background: var(--pin-color); }
.time-badge {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--pin-color);
  color: #17190a;
  font-weight: 850;
}
.result-item[data-challenge="true"] .category-dot { outline: 1px solid #fff6dc; }
.source-list { margin-top: 1rem; font-size: 0.875rem; color: var(--muted); }
.source-list summary { cursor: pointer; padding-bottom: 0.45rem; }
.source-list li { padding: 0.4rem 0; border-top: 1px solid #322842; }
.source-list a { color: #ffc3ea; text-underline-offset: 0.2rem; }
.source-list p { margin: 0.15rem 0 0; }
.viewport { position: relative; min-height: 0; overflow: hidden; }
.viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, #cfc2ff21 0.8px, transparent 1px) 0 0 / 24px 24px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse, transparent 5%, black 85%);
}
#map {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#map.dragging { cursor: grabbing; }
#map:focus-visible { outline-offset: -3px; }
.markers { position: absolute; inset: 0; pointer-events: none; }
.pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 1.98rem;
  min-height: 1.98rem;
  height: 1.98rem;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fbf3ff;
  background: var(--pin-color);
  color: #1a1123;
  box-shadow: 0 2px 10px #160c25bf;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  font: 800 0.82rem/1 system-ui, sans-serif;
}
.pin[data-region="true"] { border-style: dashed; }
.pin[data-found="true"] { color: #153111; background: #b7ed88; }
.pin:hover, .pin[aria-pressed="true"] {
  background: var(--pin-color);
  border-color: white;
  box-shadow: 0 0 0 3px #1b142a, 0 0 0 5px var(--pin-color);
  z-index: 1;
}
.pin[hidden], .map-detail[hidden] { display: none; }
.pin[data-challenge="true"] { color: #fff6dc; }
.pin[data-challenge="true"][data-found="true"] { color: #153111; background: #b7ed88; }
.pin[data-challenge="true"]:hover,
.pin[data-challenge="true"][aria-pressed="true"] { box-shadow: 0 0 0 3px #0b0b11, 0 0 0 5px #fff6dc; }
.pin[data-time-travel="true"] {
  background: var(--pin-color);
  color: #181b08;
  border-color: #282b0a;
  box-shadow: 0 0 0 1px #f7ff93, 0 2px 10px #141016d9;
}
.pin[data-time-travel="true"]:hover,
.pin[data-time-travel="true"][aria-pressed="true"] { box-shadow: 0 0 0 3px #181b08, 0 0 0 5px var(--pin-color); }
.pin[data-time-travel="true"][data-found="true"]::after {
  content: "✓";
  position: absolute;
  right: -0.38rem;
  top: -0.38rem;
  padding: 0.12rem;
  border-radius: 50%;
  background: #263b22;
  color: #d2ffa9;
}
.map-detail {
  position: absolute;
  width: min(22rem, calc(100% - 1.25rem));
  max-height: calc(100% - 1.25rem);
  overflow: auto;
  z-index: 2;
  top: 0.65rem;
  right: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid #716088;
  border-radius: 0.75rem;
  background: #20182ef7;
  box-shadow: 0 0.45rem 1.9rem #10091ca0;
}
.map-detail h2 { font-size: 1.15rem; margin: 0.2rem 2.25rem 0.35rem 0; }
.detail-progress { min-height: 2.1rem; margin-top: 0.3rem; padding: 0.35rem 0.65rem; }
.map-detail .tag { margin: 0; font-size: 0.8rem; color: var(--pin-color); font-weight: 750; }
.map-detail[data-challenge="true"] .tag { color: #fff6dc; }
.challenge-steps { margin: 0.2rem 0 0; padding-inline-start: 1.15rem; }
.challenge-steps li + li { margin-top: 0.35rem; }
.challenge-related { min-height: 2.1rem; padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.time-navigation { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.time-navigation button { min-height: 2.1rem; padding: 0.35rem 0.65rem; }
.map-detail dl { display: grid; row-gap: 0.2rem; margin: 0.7rem 0; font-size: 0.9rem; }
.map-detail dt { color: var(--muted); font-size: 0.8rem; margin-top: 0.28rem; font-weight: 650; }
.map-detail dd { margin: 0; line-height: 1.4; }
.point-photo { margin: 0.8rem 0 0; }
.detail-photo { width: 100%; height: auto; max-height: 12.8rem; display: block; object-fit: contain; background: #110d1b; border-radius: 0.5rem; }
.point-photo figcaption { margin-top: 0.28rem; font-size: 0.75rem; color: var(--muted); }
.map-detail .close-detail { position: absolute; right: 0.55rem; top: 0.5rem; min-height: 2rem; padding: 0.2rem 0.52rem; }
.map-status {
  position: absolute;
  top: 45%;
  inset-inline: 0;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.toolbox {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  justify-content: center;
  padding: 0 0.7rem 0.7rem;
}
button {
  min-height: 2.7rem;
  padding: 0.45rem 0.8rem;
  border-radius: 0.55rem;
  border: 1px solid #57486b;
  background: #251e36;
  color: inherit;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
button:hover { background: #392747; border-color: var(--pink); }
button:disabled { opacity: 0.48; cursor: default; }
button:disabled:hover { background: #251e36; border-color: #57486b; }
:focus-visible { outline: 2px solid #f3a7ff; outline-offset: 3px; }
.stepper { display: flex; align-items: center; }
.stepper button { min-width: 2.8rem; font-size: 1.35rem; line-height: 1; }
.stepper button:first-child { border-radius: 0.55rem 0 0 0.55rem; }
.stepper button:last-child { border-radius: 0 0.55rem 0.55rem 0; }
output {
  display: grid;
  place-items: center;
  min-width: 4.2rem;
  min-height: 2.7rem;
  border-block: 1px solid #57486b;
  background: #1b162a;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.fit { background: #49304c; border-color: #8e5b82; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.83rem; }
footer p, footer a { margin: 0; padding-block: 0.52rem; }
footer a { color: #e5cee6; text-underline-offset: 0.2rem; }
.credits { display: flex; flex-wrap: wrap; column-gap: 0.8rem; }
@media (max-width: 800px) {
  .top { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "identity actions" "support support"; }
}
@media (max-width: 740px) {
  .explorer { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(9rem, 32%); }
  .map-area { grid-row: 1; }
  .sidebar { grid-row: 2; border-right: 0; border-top: 1px solid var(--line); }
  .sidebar-header { padding: 0.55rem 0.65rem 0.28rem; }
  .sidebar h2 { display: none; }
  .sidebar-results { padding: 0 0.65rem 0.6rem; }
  .filters { margin-top: 0.35rem; }
  .filters button { min-height: 1.9rem; }
  footer { flex-wrap: wrap; row-gap: 0; padding-block: 0.3rem; }
  footer p, footer a { padding-block: 0.12rem; }
  .fullscreen { padding-inline: 0.58rem; }
  .identity img { width: 39px; height: 39px; }
  .toolbox { gap: 0.3rem; padding: 0.15rem 0.35rem 0.4rem; flex-wrap: wrap; }
  .toolbox button { padding-inline: 0.55rem; }
  .stepper button { min-width: 2rem; }
}
@media (max-width: 550px) {
  .top { gap: .45rem; padding-inline: .65rem; }
  .heading p { font-size: .61rem; }
  .heading h1 { font-size: 1.13rem; }
  .header-actions .fullscreen { display: none; }
  .header-actions .watch-route { padding-inline: .55rem; font-size: .77rem; }
  .explorer { grid-template-rows: minmax(0, 1fr) minmax(10rem, 41%); }
  #instructions { display: none; }
  .map-detail { width: min(22rem, calc(100% - .8rem)); left: .4rem; right: auto; top: .4rem; }
}
