:root {
  color-scheme: dark;
  --purple: #a34df1;
  --purple-bright: #c279ff;
  --ink: #08070a;
  --panel: rgba(10, 9, 12, .91);
  --muted: rgba(255, 255, 255, .64);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; height: 100%; margin: 0; overflow: hidden; }
body { color: #fff; background: var(--ink); font-family: "Manrope", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--purple-bright); outline-offset: 3px; }

.venue-map-page { width: 100%; height: 100vh; height: 100dvh; position: relative; isolation: isolate; overflow: hidden; background: #090a0c; }
.venue-map { width: 100vw; height: 100vh; height: 100dvh; position: fixed; z-index: 0; inset: 0; background: #dce1e5; }
.venue-map .leaflet-tile-pane { filter: none; }
.venue-map .leaflet-tile { filter: none; }
.venue-map .leaflet-control-attribution { color: rgba(255,255,255,.52); background: rgba(3,3,4,.72); font-size: 9px; }
.venue-map .leaflet-control-attribution a { color: #d2a0ff; }
.venue-map .leaflet-control-zoom { margin: 0 calc(18px + var(--safe-right)) calc(24px + var(--safe-bottom)) 0 !important; border: 0; box-shadow: 0 14px 32px rgba(0,0,0,.38); }
.venue-map .leaflet-control-zoom a { color: #fff; background: rgba(11,10,13,.92); border-color: rgba(255,255,255,.08); }
.map-vignette { display: none; }

.map-header { position: absolute; z-index: 650; top: calc(22px + var(--safe-top)); left: calc(24px + var(--safe-left)); display: flex; align-items: flex-start; gap: 14px; pointer-events: none; transition: opacity .22s ease, transform .22s ease, visibility .22s; }
.map-brand { width: 54px; height: 54px; display: grid; place-items: center; overflow: hidden; pointer-events: auto; background: rgba(9,8,11,.78); border-radius: 17px; box-shadow: 0 14px 34px rgba(0,0,0,.35); backdrop-filter: blur(12px); }
.map-brand img { width: 46px; height: 46px; display: block; object-fit: contain; }
.map-heading { padding-top: 2px; text-shadow: 0 3px 14px #000; }
.map-kicker { margin: 0 0 5px; color: var(--purple-bright); font-size: .66rem; font-weight: 800; letter-spacing: .18em; }
.map-heading h1 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.45rem); line-height: 1; letter-spacing: -.045em; }
.map-summary { margin-top: 9px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .72rem; }
.map-summary strong { color: #fff; }
.map-summary span::before { content: ""; width: 3px; height: 3px; margin-right: 8px; display: inline-block; vertical-align: middle; background: var(--purple-bright); border-radius: 50%; }

.map-controls { position: absolute; z-index: 650; top: calc(24px + var(--safe-top)); right: calc(24px + var(--safe-right)); display: flex; gap: 9px; transition: opacity .22s ease, transform .22s ease, visibility .22s; }
.map-control { min-height: 44px; padding: 9px 13px; display: flex; align-items: center; gap: 8px; color: #fff; background: rgba(13,10,16,.78); border-radius: 13px; box-shadow: 0 12px 30px rgba(0,0,0,.3); backdrop-filter: blur(12px); font-size: .7rem; font-weight: 800; }
.map-control:hover { background: rgba(35,18,48,.9); transform: translateY(-1px); }
.map-control svg { width: 18px; height: 18px; fill: none; stroke: var(--purple-bright); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 7px rgba(169,77,241,.55)); }
.map-control:disabled { opacity: .58; cursor: wait; }

.map-status { max-width: min(520px, calc(100% - 150px)); margin: 0; position: absolute; z-index: 550; left: calc(25px + var(--safe-left)); bottom: calc(22px + var(--safe-bottom)); color: rgba(255,255,255,.68); font-size: .72rem; font-weight: 700; text-shadow: 0 2px 10px #000; transition: opacity .22s ease; }
.map-loading { position: absolute; z-index: 900; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: #09080b; transition: opacity .35s ease, visibility .35s; }
.map-loading span { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,.12); border-top-color: var(--purple-bright); border-radius: 50%; animation: spin .8s linear infinite; }
.map-loading p { margin: 0; color: rgba(255,255,255,.72); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.map-loading.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.map-div-icon { background: transparent; border: 0; }
.venue-marker { width: 160px; height: 146px; position: relative; display: grid; align-content: end; justify-items: center; transform-origin: 50% 79%; transition: transform .24s ease, filter .24s ease; }
.venue-marker:hover { z-index: 2; transform: translateY(-4px) scale(1.07); }
.venue-marker img { width: 52px; height: 84px; display: block; position: relative; z-index: 2; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 8px 6px rgba(0,0,0,.68)); }
.venue-marker strong { max-width: 154px; margin-top: 5px; padding: 6px 9px; overflow: hidden; color: #fff; background: rgba(8,7,10,.94); border-radius: 9px; box-shadow: 0 8px 18px rgba(0,0,0,.32); font-size: .62rem; line-height: 1.05; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.venue-marker::after { content: ""; width: 24px; height: 8px; position: absolute; z-index: 0; bottom: 26px; background: rgba(163,77,241,.38); border-radius: 50%; filter: blur(5px); }

.user-location-icon { background: transparent; border: 0; }
.user-location { width: 54px; height: 54px; position: relative; display: grid; place-items: center; }
.user-location::before, .user-location::after { content: ""; position: absolute; border-radius: 50%; }
.user-location::before { width: 48px; height: 48px; background: rgba(163,77,241,.28); animation: locationPulse 1.8s ease-out infinite; }
.user-location::after { width: 18px; height: 18px; background: var(--purple-bright); box-shadow: 0 0 0 4px rgba(8,7,10,.9), 0 0 20px var(--purple); }

.venue-map .leaflet-popup { margin-bottom: 9px; }
.venue-popup-leaflet .leaflet-popup-content-wrapper { color: #fff; background: rgba(8,7,10,.96); border-radius: 20px; box-shadow: 0 22px 54px rgba(0,0,0,.58), inset 0 0 0 1px rgba(255,255,255,.08); backdrop-filter: blur(14px); }
.venue-popup-leaflet .leaflet-popup-tip { background: rgba(8,7,10,.96); }
.venue-popup-leaflet .leaflet-popup-content { width: 245px !important; margin: 15px; }
.venue-popup { display: grid; gap: 5px; }
.venue-popup small { color: var(--purple-bright); font-size: .57rem; font-weight: 800; letter-spacing: .1em; }
.venue-popup strong { margin-top: 2px; font-size: 1rem; line-height: 1.08; }
.venue-popup > span { color: rgba(255,255,255,.59); font-size: .67rem; line-height: 1.35; }
.venue-popup .distance { color: #d9b4fa; font-weight: 800; }
.popup-media { width: 100%; aspect-ratio: 16 / 9; margin-top: 7px; position: relative; overflow: hidden; background: #050506; border-radius: 13px; }
.popup-photo-track { width: 100%; height: 100%; display: flex; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; scrollbar-width: none; touch-action: pan-x; cursor: grab; -webkit-overflow-scrolling: touch; }
.popup-photo-track::-webkit-scrollbar { display: none; }
.popup-photo-track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.popup-photo { width: 100%; height: 100%; padding: 0; flex: 0 0 100%; overflow: hidden; scroll-snap-align: start; background: #050506; cursor: zoom-in; }
.popup-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.popup-media em { padding: 4px 7px; position: absolute; right: 7px; bottom: 7px; color: #fff; background: rgba(0,0,0,.72); border-radius: 7px; font-size: .56rem; font-style: normal; font-weight: 800; pointer-events: none; }

.venue-map-page.is-venue-selected .map-header, .venue-map-page.is-venue-selected .map-controls { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(-10px); }
.venue-map-page.is-venue-selected .map-status { opacity: 0; }

dialog { padding: 0; color: #fff; background: #09090b; border: 0; box-shadow: 0 28px 90px rgba(0,0,0,.78); }
dialog::backdrop { background: rgba(0,0,0,.8); backdrop-filter: blur(8px); }
dialog[open] { animation: dialogIn .27s cubic-bezier(.2,.8,.2,1); }
.venue-list-dialog { width: min(calc(100% - 28px), 480px); max-height: min(88dvh, 760px); border-radius: 25px; overflow: hidden; }
.dialog-shell { padding: 20px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head small { color: var(--purple-bright); font-size: .58rem; font-weight: 800; letter-spacing: .13em; }
.dialog-head h2 { margin: 7px 0 0; font-size: 1.35rem; line-height: 1.05; }
.dialog-head > button { width: 42px; height: 42px; flex: 0 0 auto; color: #fff; background: rgba(255,255,255,.09); border-radius: 50%; font-size: 1.4rem; line-height: 1; }
.venue-list-shell { max-height: min(88dvh, 760px); display: flex; flex-direction: column; overflow: hidden; }
.state-select { margin: 20px 0 12px; color: rgba(255,255,255,.56); font-size: .62rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.state-select select { width: 100%; min-height: 45px; margin-top: 7px; padding: 0 13px; color: #fff; background: #17151a; border: 0; border-radius: 12px; }
.venue-list { min-height: 0; display: grid; gap: 9px; overflow-y: auto; overscroll-behavior: contain; }
.venue-list-item { width: 100%; min-height: 68px; padding: 9px 11px; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: 11px; color: #fff; background: #151417; border-radius: 16px; text-align: left; }
.venue-list-item:hover { background: #21172a; }
.venue-list-machine { width: 43px; height: 53px; background: url("/map/arcade-marker.webp") center/contain no-repeat; image-rendering: pixelated; }
.venue-list-copy { min-width: 0; display: grid; gap: 3px; }
.venue-list-copy strong, .venue-list-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.venue-list-copy strong { font-size: .76rem; }
.venue-list-copy span { color: rgba(255,255,255,.52); font-size: .62rem; }
.venue-list-item em { color: var(--purple-bright); font-size: .56rem; font-style: normal; font-weight: 800; }

.gallery-dialog { padding: 12px; position: fixed; z-index: 5000; inset: 0; display: none; place-items: center; overflow: auto; color: #fff; background: rgba(0,0,0,.84); backdrop-filter: blur(8px); }
.gallery-dialog[open] { display: grid; animation: dialogIn .2s ease-out; }
.gallery-shell { width: min(100%, 500px); max-height: calc(100dvh - 24px); display: grid; gap: 15px; overflow: hidden; background: #09090b; border-radius: 26px; box-shadow: 0 28px 90px rgba(0,0,0,.78); }
.gallery-viewport { width: min(100%, 430px); aspect-ratio: 3 / 4; margin-inline: auto; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; scroll-snap-type: x mandatory; scrollbar-width: none; background: #030304; border-radius: 18px; touch-action: pan-x; cursor: grab; -webkit-overflow-scrolling: touch; }
.gallery-viewport::-webkit-scrollbar { display: none; }
.gallery-viewport.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.gallery-track { height: 100%; display: flex; }
.gallery-slide { width: 100%; height: 100%; flex: 0 0 100%; display: grid; place-items: center; scroll-snap-align: start; }
.gallery-slide img { width: 100%; height: 100%; display: block; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.gallery-controls { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; }
.gallery-controls button { width: 44px; height: 42px; color: #fff; background: rgba(163,77,241,.18); border-radius: 12px; }
.gallery-controls button:disabled { opacity: .32; }
.gallery-controls span { color: rgba(255,255,255,.67); font-size: .66rem; font-weight: 800; text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes locationPulse { 0% { opacity: .9; transform: scale(.55); } 80%, 100% { opacity: 0; transform: scale(1.35); } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }

@media (max-width: 680px) {
  .map-header { top: calc(13px + var(--safe-top)); left: calc(13px + var(--safe-left)); gap: 10px; }
  .map-brand { width: 46px; height: 46px; border-radius: 14px; }
  .map-brand img { width: 40px; height: 40px; }
  .map-kicker { margin-bottom: 4px; font-size: .52rem; }
  .map-heading h1 { font-size: 1.22rem; }
  .map-summary { margin-top: 6px; font-size: .62rem; }
  .map-controls { top: calc(101px + var(--safe-top)); right: calc(13px + var(--safe-right)); }
  .map-control { width: 43px; min-height: 43px; padding: 0; display: grid; place-items: center; border-radius: 13px; }
  .map-control span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .map-control svg { width: 19px; height: 19px; }
  .map-status { max-width: calc(100% - 95px); left: calc(14px + var(--safe-left)); bottom: calc(14px + var(--safe-bottom)); font-size: .61rem; }
  .venue-map .leaflet-control-zoom { margin-right: calc(12px + var(--safe-right)) !important; margin-bottom: calc(33px + var(--safe-bottom)) !important; }
  .venue-popup-leaflet .leaflet-popup-content { width: min(235px, calc(100vw - 74px)) !important; margin: 13px; }
  .venue-marker { width: 140px; height: 136px; }
  .venue-marker img { width: 48px; height: 78px; }
  .venue-marker strong { max-width: 136px; font-size: .55rem; }
  .gallery-dialog { padding: 9px; }
  .gallery-shell { max-height: calc(100dvh - 18px); }
  .dialog-shell { padding: 16px; }
  .gallery-viewport { width: min(100%, 56dvh); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
