/* map.spiderverses.com: the multiverse as a real map. Comic print style: ink borders, CMY misregistration, halftone. */
:root {
  --bg: #0b0918; --panel: #f4efe2; --ink: #14101c; --mute: #6b6478; --red: #e3262f; --cyan: #2ee6ff; --mag: #ff2bd6; --yellow: #ffe14d;
  --display: 'Bangers', Impact, sans-serif; --marker: 'Permanent Marker', cursive; --mono: 'Space Mono', monospace; --body: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--panel); font: 400 15px/1.5 var(--body); overflow: hidden; }
/* pinches zoom the map, never the page */
html, body { touch-action: none; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; }
.panel, .codex, .results { touch-action: pan-y; }
button { font: inherit; color: inherit; cursor: pointer; }
.ic { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -.2em; flex: none; }

#map { position: fixed; inset: 0; background: var(--bg); }
.leaflet-container { background: var(--bg); font: inherit; outline: none; }
.leaflet-tile { image-rendering: auto; }
.leaflet-tile-container img { filter: none; }

/* ---------- top bar ---------- */
.top { position: fixed; z-index: 1000; left: 12px; right: 12px; top: 12px; display: flex; align-items: center; gap: 12px; pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: #fff; background: var(--ink); border: 3px solid #000; padding: 8px 12px 6px; box-shadow: 5px 5px 0 #000, 5px 5px 0 2px var(--mag); }
.brand .mark { color: var(--red); display: inline-flex; } .brand .mark svg { width: 26px; height: 26px; }
.brand .wm { font: 400 24px/1 var(--display); letter-spacing: .05em; text-shadow: -2px 0 var(--cyan), 2px 0 var(--mag); }
.brand b { font: 400 15px/1 var(--display); letter-spacing: .14em; color: #000; background: var(--yellow); border: 2px solid #000; padding: 4px 7px 2px; rotate: -4deg; }
.search { position: relative; flex: 1; max-width: 520px; }
.sbox { display: flex; align-items: center; gap: 8px; background: var(--panel); color: var(--ink); border: 3px solid #000; padding: 0 12px; box-shadow: 5px 5px 0 #000; }
.sbox .ic { width: 20px; height: 20px; color: var(--mute); }
.sbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: 600 15px var(--body); padding: 11px 0; color: var(--ink); }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: var(--panel); color: var(--ink); border: 3px solid #000; box-shadow: 6px 6px 0 #000; max-height: min(60vh, 460px); overflow: auto; display: none; }
.results.on { display: block; }
.results button { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; border: 0; border-bottom: 2px solid #0001; background: none; padding: 10px 12px; color: var(--ink); }
.results button:hover, .results button.sel { background: var(--yellow); }
.results .t { font: 700 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: #fff; background: var(--ink); padding: 3px 6px 2px; flex: none; }
.results .n { font-weight: 800; } .results .s { color: var(--mute); font-size: 13px; }
.results .none { padding: 14px; color: var(--mute); }
.who { margin-left: auto; }

/* ---------- controls ---------- */
.tools { position: fixed; z-index: 1000; left: 12px; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: 8px; }
.tools button { width: 46px; height: 46px; display: grid; place-items: center; background: var(--panel); color: var(--ink); border: 3px solid #000; box-shadow: 4px 4px 0 #000; padding: 0; }
.tools button .ic { width: 22px; height: 22px; }
.tools button:hover { background: var(--yellow); }
.tools button:active { translate: 2px 2px; box-shadow: 2px 2px 0 #000; }
.tools button.on { background: var(--cyan); }
.tools button.wide { width: 46px; height: auto; padding: 10px 0; gap: 4px; font: 400 13px/1 var(--display); letter-spacing: .08em; writing-mode: vertical-rl; rotate: 180deg; background: var(--red); color: #fff; }
.tools button.wide .ic { rotate: 90deg; }
.coords { position: fixed; z-index: 900; right: 12px; bottom: 12px; font: 700 11px var(--mono); letter-spacing: .16em; color: var(--cyan); background: #0b0918cc; border: 2px solid #2ee6ff55; padding: 6px 10px; pointer-events: none; }
.hint { position: fixed; z-index: 900; left: 50%; bottom: 16px; translate: -50% 0; font: 700 12px var(--mono); letter-spacing: .08em; color: #000; background: var(--yellow); border: 3px solid #000; box-shadow: 4px 4px 0 #000; padding: 8px 12px; rotate: -1deg; transition: opacity .4s; white-space: nowrap; }
.hint.off { opacity: 0; pointer-events: none; }

/* ---------- labels on the map ---------- */
.lbl { position: absolute; translate: -50% -50%; text-align: center; white-space: nowrap; pointer-events: auto; cursor: pointer; font-size: var(--fs, 20px); }
.lbl b { display: block; font: 400 1em/.9 var(--display); letter-spacing: .04em; color: #fff; -webkit-text-stroke: .09em #000; paint-order: stroke fill; text-shadow: -.08em 0 var(--cyan), .08em 0 var(--mag), .1em .12em 0 #000; }
.lbl small { display: inline-block; margin-top: .25em; font: 700 max(10px, .36em)/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #000; background: var(--yellow); border: 2px solid #000; padding: .3em .5em .2em; rotate: -2deg; }
.lbl.minor b { color: #e9e3f5; }
.lbl.unch b { color: #9a93ab; -webkit-text-stroke: .06em #000; text-shadow: none; }
.lbl.sea b { color: transparent; -webkit-text-stroke: 0; text-shadow: none; font-family: var(--marker); letter-spacing: .2em; color: #ffffff55; }
.lbl:hover b { color: var(--yellow); }
.lbl.hide { display: none; }
.zl-nick .lbl.minor small, .zl-tiny .lbl small { display: none; }
.lbl.sel b { color: var(--yellow); }

/* islands you can click */
.isle { cursor: pointer; transition: stroke-opacity .2s; }
.isle:hover { stroke-opacity: 1 !important; }

/* landmarks */
.pin { position: absolute; translate: -50% -100%; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 0; }
.pin i { display: grid; place-items: center; width: 30px; height: 30px; background: var(--red); color: #fff; border: 3px solid #000; border-radius: 50% 50% 50% 0; rotate: -45deg; box-shadow: 3px 3px 0 #000; }
.pin i .ic { rotate: 45deg; width: 15px; height: 15px; }
.pin span { font: 700 11px/1.1 var(--mono); color: #000; background: var(--panel); border: 2px solid #000; padding: 3px 6px 2px; white-space: nowrap; display: none; box-shadow: 2px 2px 0 #000; }
.zp4 .pin span { display: block; }
.pin:hover i, .pin.sel i { background: var(--yellow); color: #000; }
.zp-lo .pin { display: none; }

/* web lines between Earths */
.route { stroke-dasharray: 14 10; animation: crawl 1.4s linear infinite; }
@keyframes crawl { to { stroke-dashoffset: -24; } }
.leaflet-tooltip.rt { background: var(--ink); color: #fff; border: 2px solid #000; border-radius: 0; font: 600 13px var(--body); box-shadow: 3px 3px 0 #000; padding: 6px 10px; }
.leaflet-tooltip.rt::before { display: none; }

/* speech bubble popups */
.bubble .leaflet-popup-content-wrapper { background: var(--panel); color: var(--ink); border: 3px solid #000; border-radius: 18px; box-shadow: 5px 5px 0 #000; }
.bubble .leaflet-popup-content { margin: 12px 16px; font: 400 14px/1.45 var(--body); max-width: 280px; }
.bubble .leaflet-popup-content h4 { margin: 0 0 4px; font: 400 22px/1 var(--display); letter-spacing: .03em; }
.bubble .leaflet-popup-content p { margin: 0; }
.bubble .leaflet-popup-content .tag { display: inline-block; margin-bottom: 6px; font: 700 10px var(--mono); letter-spacing: .14em; color: #fff; background: var(--ink); padding: 3px 6px 2px; }
.bubble .leaflet-popup-tip { background: var(--panel); border: 3px solid #000; box-shadow: none; }
.leaflet-popup-close-button { color: var(--ink) !important; font-size: 22px !important; }

/* ---------- the Earth file (side panel) ---------- */
.panel { position: fixed; z-index: 1100; right: 12px; top: 80px; bottom: 12px; width: min(440px, calc(100vw - 24px)); overflow: auto; background: var(--panel); color: var(--ink); border: 4px solid #000; box-shadow: 8px 8px 0 #000, 8px 8px 0 3px var(--mag); overscroll-behavior: contain; animation: pop .25s steps(4); }
@keyframes pop { from { translate: 30px 0; opacity: 0; } }
.panel .hero { position: relative; padding: 18px 18px 14px; background: var(--c, var(--ink)); color: #fff; border-bottom: 4px solid #000; overflow: hidden; }
.panel .hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, #0004 1.4px, transparent 2px) 0 0 / 9px 9px; }
.panel .hero > * { position: relative; }
.panel .close { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; display: grid; place-items: center; background: var(--panel); color: var(--ink); border: 3px solid #000; box-shadow: 3px 3px 0 #000; z-index: 2; }
.panel .num { font: 700 11px var(--mono); letter-spacing: .2em; opacity: .9; }
.panel h1 { margin: 2px 0 6px; font: 400 52px/.9 var(--display); letter-spacing: .02em; -webkit-text-stroke: 2px #000; paint-order: stroke fill; text-shadow: -3px 0 var(--cyan), 3px 0 var(--mag), 4px 4px 0 #000; }
.panel .nick { display: inline-block; font: 400 19px/1 var(--marker); color: #000; background: var(--yellow); border: 3px solid #000; padding: 4px 10px 2px; rotate: -2deg; box-shadow: 3px 3px 0 #000; }
.panel .films { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font: 700 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #000; background: #fff; border: 2px solid #000; padding: 4px 7px 3px; }
.chip.into { background: #ff8a8f; } .chip.across { background: #ff9be8; } .chip.beyond { background: #9cf3ff; } .chip.low { background: #ddd; }
.panel .body { padding: 16px 18px 22px; }
.panel .who-card { display: flex; gap: 12px; align-items: center; background: #fff; border: 3px solid #000; box-shadow: 4px 4px 0 #000; padding: 10px 12px; margin-bottom: 14px; }
.panel .who-card .em { width: 44px; height: 44px; display: grid; place-items: center; background: var(--c, var(--red)); color: #fff; border: 3px solid #000; flex: none; }
.panel .who-card .em .ic, .panel .who-card .em svg { width: 26px; height: 26px; }
.panel .who-card b { display: block; font: 400 22px/1 var(--display); letter-spacing: .03em; }
.panel .who-card span { color: var(--mute); font-size: 13px; }
.panel h3 { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font: 400 20px/1 var(--display); letter-spacing: .06em; }
.panel h3 .ic { color: var(--red); }
.panel p { margin: 0 0 10px; }
.panel .style { font-style: italic; color: #3a3446; border-left: 4px solid var(--c, var(--red)); padding-left: 10px; }
.panel ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.panel li { position: relative; padding-left: 18px; }
.panel li::before { content: ''; position: absolute; left: 2px; top: .55em; width: 8px; height: 8px; background: var(--c, var(--red)); border: 2px solid #000; rotate: 45deg; }
.panel .places button, .panel .links button, .panel .ppl button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: flex-start; background: #fff; border: 2px solid #000; padding: 8px 10px; color: var(--ink); box-shadow: 3px 3px 0 #000; }
.panel .places button:hover, .panel .links button:hover { background: var(--yellow); }
.panel .places, .panel .links, .panel .ppl { display: grid; gap: 8px; }
.panel .places b, .panel .links b, .panel .ppl b { display: block; }
.panel .places small, .panel .links small, .panel .ppl small { color: #4a4458; font-size: 13px; line-height: 1.4; }
.panel .ppl button { cursor: default; box-shadow: none; }
.panel .share { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: 400 17px/1 var(--display); letter-spacing: .08em; color: #000; background: var(--yellow); border: 3px solid #000; box-shadow: 4px 4px 0 #000; padding: 10px 14px 8px; text-decoration: none; }
.btn:hover { background: #fff; } .btn.dark { background: var(--ink); color: #fff; }
.panel .src { margin-top: 18px; font-size: 12px; color: var(--mute); }
.panel .src a { color: var(--mute); }

/* ---------- the codex ---------- */
.codex { position: fixed; inset: 0; z-index: 1200; background: #0b0918e6; backdrop-filter: blur(3px); overflow: auto; padding: 24px 16px; }
.cx-in { max-width: 1040px; margin: 0 auto; background: var(--panel); color: var(--ink); border: 4px solid #000; box-shadow: 10px 10px 0 #000, 10px 10px 0 3px var(--cyan); }
.cx-top { position: relative; padding: 20px 22px 14px; background: var(--red); color: #fff; border-bottom: 4px solid #000; }
.cx-top h2 { margin: 0; font: 400 56px/.9 var(--display); letter-spacing: .03em; -webkit-text-stroke: 2px #000; paint-order: stroke fill; text-shadow: -3px 0 var(--cyan), 3px 0 var(--mag), 4px 4px 0 #000; }
.cx-top p { margin: 6px 0 0; font-weight: 600; }
.cx-top .close { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; display: grid; place-items: center; background: var(--panel); color: var(--ink); border: 3px solid #000; box-shadow: 3px 3px 0 #000; }
.tabs { display: flex; gap: 0; border-bottom: 4px solid #000; overflow-x: auto; }
.tabs button { flex: none; border: 0; border-right: 3px solid #000; background: #fff; padding: 12px 16px 10px; font: 400 18px/1 var(--display); letter-spacing: .06em; color: var(--ink); }
.tabs button.on { background: var(--yellow); }
.cx-body { padding: 20px 22px; }
.cx-body h3 { font: 400 26px/1 var(--display); letter-spacing: .04em; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.card { text-align: left; background: #fff; border: 3px solid #000; box-shadow: 5px 5px 0 #000; padding: 0; color: var(--ink); display: flex; flex-direction: column; }
.card:hover { translate: -2px -2px; box-shadow: 7px 7px 0 #000; }
.card .bar { background: var(--c, var(--ink)); color: #fff; padding: 10px 12px 8px; border-bottom: 3px solid #000; font: 400 24px/1 var(--display); letter-spacing: .03em; -webkit-text-stroke: 1px #000; paint-order: stroke fill; }
.card .in { padding: 10px 12px 12px; }
.card .in b { display: block; } .card .in small { color: var(--mute); }
.list { display: grid; gap: 10px; }
.row { background: #fff; border: 3px solid #000; padding: 10px 14px; box-shadow: 4px 4px 0 #000; }
.row b { font-size: 16px; } .row .meta { color: var(--mute); font-size: 13px; }
.row button.go { float: right; border: 2px solid #000; background: var(--yellow); font: 700 11px var(--mono); letter-spacing: .1em; padding: 4px 8px; margin-left: 10px; }
.foot { border-top: 4px solid #000; padding: 16px 22px 20px; }
.more { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 0 0 8px; font-size: 13px; }
.more b { font: 400 16px var(--display); letter-spacing: .06em; margin-right: 4px; }
.more a { color: var(--ink); font-weight: 600; }
.note { margin: 0; font-size: 12px; color: var(--mute); }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; color: #fff; font: 400 28px var(--display); }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .top { left: 8px; right: 8px; top: 8px; gap: 8px; flex-wrap: wrap; }
  .brand { padding: 6px 9px 5px; } .brand .wm { font-size: 19px; } .brand b { font-size: 12px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .sbox input { padding: 9px 0; font-size: 16px; }
  .tools { left: 8px; top: auto; bottom: 56px; translate: none; flex-direction: row; flex-wrap: wrap; max-width: calc(100vw - 16px); }
  .tools button { width: 42px; height: 42px; }
  .tools button.wide { writing-mode: horizontal-tb; rotate: none; width: auto; padding: 0 12px; height: 42px; display: flex; }
  .tools button.wide .ic { rotate: none; }
  .coords { display: none; }
  .hint { bottom: 8px; font-size: 11px; white-space: normal; text-align: center; width: max-content; max-width: calc(100vw - 32px); }
  .panel { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 62vh; border-width: 4px 0 0; box-shadow: 0 -6px 0 #000; animation-name: up; }
  @keyframes up { from { translate: 0 40px; opacity: 0; } }
  .panel h1 { font-size: 42px; }
  .codex { padding: 0; } .cx-in { border-width: 0; box-shadow: none; min-height: 100%; }
  .cx-top h2 { font-size: 42px; }
  .cx-body { padding: 16px; } .foot { padding: 16px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; } .card .bar { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { .route { animation: none; } .panel { animation: none; } }
