/* ==========================================================================
   Chasing Cardboard — shared stylesheet
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------ */
:root {
  /* Brand */
  --indigo:       #3b4cca;
  --indigo-deep:  #232f8f;
  --indigo-dark:  #1a2166;
  --gold:         #ffcb05;
  --gold-deep:    #e0a800;
  --coral:        #ff5a5f;

  /* Neutrals */
  --ink:          #14162e;
  --ink-soft:     #4a4f70;
  --ink-faint:    #7b7fa0;
  --line:         #e4e3f0;
  --paper:        #f6f5fb;
  --card:         #ffffff;

  /* Holographic sheen used for accents */
  --holo: linear-gradient(110deg,
            #6ee7ff 0%, #a78bfa 24%, #ff9ad5 48%,
            #ffd66e 72%, #7ef0c0 100%);

  /* Structure */
  --nav-h:        66px;
  --radius:       16px;
  --radius-sm:    10px;
  --radius-lg:    24px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(20, 22, 46, .06),
                0 2px 8px rgba(20, 22, 46, .06);
  --shadow-md:  0 4px 12px rgba(20, 22, 46, .08),
                0 12px 32px rgba(20, 22, 46, .10);
  --shadow-lg:  0 8px 24px rgba(20, 22, 46, .10),
                0 24px 60px rgba(20, 22, 46, .16);

  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* --- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }

/* Must beat the display values our components set on themselves */
[hidden] { display: none !important; }

/* Decorative dot grid behind content pages */
body.has-page-bg {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(59, 76, 202, .10) 1px, transparent 0);
  background-size: 22px 22px;
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--ink);
  margin: 0 0 .6em;
}

h1 { font-size: clamp(2rem, 5vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
h3 { font-size: 1.12rem; }

p { margin: 0 0 1.1em; }

a { color: var(--indigo); }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--card);
  color: var(--ink);
  padding: .7rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* --- Navbar ------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2rem);
  background: linear-gradient(180deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  box-shadow: 0 2px 20px rgba(26, 33, 102, .28);
}

/* Holographic hairline under the nav */
.site-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--holo);
  background-size: 200% 100%;
  animation: holo-drift 14s linear infinite;
  opacity: .95;
}

@keyframes holo-drift {
  from { background-position:   0% 50%; }
  to   { background-position: 200% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header::after { animation: none; }
  html { scroll-behavior: auto; }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  text-decoration: none;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.16rem;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition: transform .25s var(--ease);
}
.brand:hover { transform: translateY(-1px); }

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .25));
  transition: transform .35s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }

.site-nav {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.site-nav a {
  position: relative;
  display: inline-block;
  color: rgba(255, 255, 255, .88);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  padding: .5rem .9rem;
  border-radius: 999px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.site-nav a:hover {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}
.site-nav a[aria-current='page'] {
  color: var(--ink);
  background: var(--gold);
  box-shadow: 0 2px 10px rgba(255, 203, 5, .35);
}

.nav-cta {
  color: var(--ink) !important;
  background: #fff;
  font-weight: 700 !important;
  box-shadow: var(--shadow-sm);
}
.nav-cta:hover {
  background: var(--gold) !important;
  color: var(--ink) !important;
  transform: translateY(-1px);
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  padding: .85rem 1.5rem;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease),
              background .2s var(--ease);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  box-shadow: 0 4px 14px rgba(59, 76, 202, .35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(59, 76, 202, .42);
}

.btn-gold {
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
  box-shadow: 0 4px 14px rgba(224, 168, 0, .35);
}
.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(224, 168, 0, .45);
}

.btn-ghost {
  color: var(--indigo);
  background: transparent;
  border: 2px solid var(--line);
}
.btn-ghost:hover { border-color: var(--indigo); background: #fff; }

/* --- Content pages ------------------------------------------------------ */
.page {
  max-width: 780px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + clamp(2.5rem, 6vw, 4.5rem))
           clamp(1.15rem, 5vw, 2rem)
           clamp(3rem, 8vw, 5rem);
}

.eyebrow {
  display: inline-block;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--indigo);
  background: rgba(59, 76, 202, .09);
  padding: .35rem .8rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.lede {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.prose { color: var(--ink-soft); }
.prose strong { color: var(--ink); font-weight: 650; }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  overflow: hidden;
}

.card-holo::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--holo);
}

/* Feature row */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin: 2.25rem 0;
  padding: 0;
  list-style: none;
}

.feature {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.3rem;
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(59, 76, 202, .1);
  margin-bottom: .85rem;
  font-size: 1.25rem;
}

.feature h3 { margin-bottom: .3rem; font-size: 1.02rem; }
.feature p  { margin: 0; font-size: .92rem; color: var(--ink-soft); line-height: 1.55; }

/* Callout */
.callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 2.5rem;
  padding: clamp(1.4rem, 4vw, 2rem);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.callout h2 { color: #fff; margin: 0 0 .3rem; }
.callout p  { margin: 0; color: rgba(255, 255, 255, .82); font-size: .96rem; }
.callout > div { min-width: 220px; flex: 1 1 380px; }

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem clamp(1.15rem, 5vw, 2rem);
  text-align: center;
  font-size: .88rem;
  color: var(--ink-faint);
}
.site-footer a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: var(--indigo); text-decoration: underline; }
.site-footer nav { margin-bottom: .5rem; display: flex; gap: 1.25rem; justify-content: center; flex-wrap: wrap; }

/* --- Small screens ------------------------------------------------------ */
@media (max-width: 700px) {
  :root { --nav-h: 60px; }

  body { font-size: 16px; }

  .site-header { padding: 0 .85rem; gap: .5rem; }
  .brand { font-size: .98rem; gap: .45rem; }
  .brand-mark { width: 26px; height: 26px; }
  .site-nav { gap: .15rem; }
  .site-nav a { padding: .45rem .75rem; font-size: .88rem; }

  /* The logo already returns you to the map, so drop the duplicate link */
  .site-nav .nav-map { display: none; }
  .hide-sm { display: none; }
}

/* =========================================================================
   Interactive store map (index.html)
   ========================================================================= */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.map-shell {
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  display: grid;
  grid-template-columns: 360px 1fr;
  background: var(--paper);
}

.map-holder { position: relative; overflow: hidden; isolation: isolate; }

#map {
  width: 100%;
  height: 100%;
  background: #dfe3ee;
  z-index: 1;
}

/* --- Sidebar ------------------------------------------------------------ */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(20, 22, 46, .06);
  z-index: 20;
}

.panel-head {
  position: relative;
  padding: 1.15rem 1.15rem .9rem;
  border-bottom: 1px solid var(--line);
}

.sheet-close { display: none; }

/* Search */
.search-row {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 999px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search-row:focus-within {
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(59, 76, 202, .12);
}

.search-icon {
  display: grid;
  place-items: center;
  width: 40px;
  flex: none;
  color: var(--ink-faint);
}
.search-icon svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}

#search {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  padding: .7rem .25rem;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  outline: none;
}
#search::-webkit-search-cancel-button { cursor: pointer; }

.search-go {
  flex: none;
  margin: 4px;
  padding: .45rem .95rem;
  border: 0;
  border-radius: 999px;
  background: var(--indigo);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.search-go:hover { background: var(--indigo-deep); }

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .7rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-soft);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.chip:hover { border-color: var(--indigo); color: var(--indigo); }
.chip svg {
  width: 15px; height: 15px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
.chip-clear {
  background: rgba(59, 76, 202, .08);
  border-color: transparent;
  color: var(--indigo);
}
.chip-clear strong { font-weight: 700; }

.search-status:empty { display: none; }
.search-status {
  margin: .6rem 0 0;
  font-size: .84rem;
  color: var(--ink-soft);
}

.geo-hint {
  margin: .6rem 0 0;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--ink-soft);
  background: rgba(255, 203, 5, .16);
  border-radius: var(--radius-sm);
  padding: .5rem .65rem;
}
.geo-hint kbd {
  font: inherit;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 .3rem;
}

/* Filters */
.filters {
  margin: .9rem 0 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: .1rem;
}

.filter {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .42rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .89rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  transition: background .18s var(--ease);
}
.filter:hover { background: var(--paper); }

.filter input {
  position: absolute;
  width: 1px; height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.filter-dot {
  width: 13px; height: 13px;
  flex: none;
  border-radius: 4px;
  border: 2px solid var(--c, var(--indigo));
  background: var(--c, var(--indigo));
  position: relative;
  transition: background .18s var(--ease);
}
.filter input:not(:checked) ~ .filter-dot { background: transparent; }
.filter input:focus-visible ~ .filter-dot {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.filter input:not(:checked) ~ .filter-label { color: var(--ink-faint); text-decoration: line-through; }

.filter[data-cat="independent"] { --c: #3b4cca; }
.filter[data-cat="occasional"]  { --c: #c2185b; }
.filter[data-cat="chain"]       { --c: #e0a800; }

.filter-label { flex: 1 1 auto; }

.filter-count {
  font-size: .78rem;
  font-weight: 700;
  color: var(--ink-faint);
  background: var(--paper);
  border-radius: 999px;
  padding: .1rem .5rem;
}

/* List */
.list-head {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  padding: .85rem 1.15rem .5rem;
}
.list-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}
.list-head span {
  font-size: .82rem;
  color: var(--ink-faint);
}

.shop-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0 .65rem .65rem;
  list-style: none;
}

.cc-card {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .65rem .7rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .16s var(--ease);
}
.cc-card:hover { background: var(--paper); }

.cc-card-dot {
  width: 9px; height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--pin);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pin) 18%, transparent);
}

.cc-card-body { display: flex; flex-direction: column; min-width: 0; }

.cc-card-name {
  font-weight: 600;
  font-size: .92rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-card-meta {
  font-size: .78rem;
  color: var(--ink-faint);
}

.cc-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: .9rem;
}
.cc-empty p { margin: 0 0 .5rem; }

.panel-foot {
  padding: .8rem 1.15rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.btn-block { display: flex; width: 100%; }
.panel-foot p {
  margin: .6rem 0 0;
  font-size: .76rem;
  color: var(--ink-faint);
  text-align: center;
}

/* --- Markers, clusters, popups ----------------------------------------- */
.cc-pin-wrap { background: none; border: 0; }

.cc-pin {
  display: block;
  width: 28px; height: 34px;
  transition: transform .18s var(--ease), filter .18s var(--ease);
  filter: drop-shadow(0 2px 3px rgba(20, 22, 46, .35));
  transform-origin: 50% 100%;
}
.cc-pin svg { width: 100%; height: 100%; fill: var(--pin); }
.cc-pin:hover, .cc-pin.is-active {
  transform: scale(1.22);
  filter: drop-shadow(0 4px 7px rgba(20, 22, 46, .45));
  z-index: 1000;
}

.cc-cluster {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 800;
  font-size: .88rem;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-deep) 100%);
  box-shadow: 0 0 0 5px rgba(59, 76, 202, .22), 0 3px 10px rgba(20, 22, 46, .3);
  transition: transform .18s var(--ease);
}
.cc-cluster:hover { transform: scale(1.08); }
.cc-cluster-md { box-shadow: 0 0 0 6px rgba(59, 76, 202, .2), 0 3px 12px rgba(20, 22, 46, .3); }
.cc-cluster-lg {
  background: linear-gradient(135deg, var(--indigo-deep) 0%, var(--indigo-dark) 100%);
  box-shadow: 0 0 0 7px rgba(35, 47, 143, .2), 0 4px 14px rgba(20, 22, 46, .34);
  font-size: .95rem;
}

.cc-you {
  background: none;
  border: 0;
}
.cc-you span {
  display: block;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #2f7cf6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(47, 124, 246, .28), 0 2px 6px rgba(0, 0, 0, .3);
}

.cc-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0;
  overflow: hidden;
}
.cc-popup-wrap .leaflet-popup-content { margin: 0; width: auto !important; }
.cc-popup-wrap .leaflet-popup-tip { box-shadow: var(--shadow-sm); }

.cc-popup { padding: .95rem 1rem 1rem; font-family: inherit; }

.cc-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--pin);
  background: color-mix(in srgb, var(--pin) 12%, transparent);
  padding: .2rem .5rem;
  border-radius: 999px;
  margin-bottom: .45rem;
}

.cc-popup h3 {
  margin: 0 0 .35rem;
  font-size: 1.02rem;
  line-height: 1.25;
}

.cc-popup-notes,
.cc-popup-dist {
  margin: 0 0 .5rem;
  font-size: .84rem;
  line-height: 1.45;
  color: var(--ink-soft);
  white-space: pre-line;
}
.cc-popup-dist { color: var(--ink-faint); }

.cc-popup-actions { display: flex; gap: .4rem; margin-top: .7rem; }

.cc-btn-sm {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink-soft);
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.cc-btn-sm:hover { border-color: var(--indigo); color: var(--indigo); }
.cc-btn-solid {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}
.cc-btn-solid:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); color: #fff; }

/* Leaflet chrome tuned to match the site */
.leaflet-control-zoom a {
  border-radius: 10px !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-sm);
}
.leaflet-control-zoom { border: 0 !important; box-shadow: none !important; }
.leaflet-control-zoom a:first-child { margin-bottom: 4px; }
.leaflet-control-attribution {
  font-size: .7rem !important;
  background: rgba(255, 255, 255, .82) !important;
  border-radius: 8px 0 0 0;
}

/* --- Loading overlay ---------------------------------------------------- */
.map-loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(246, 245, 251, .92);
  text-align: center;
  color: var(--ink-soft);
  font-size: .95rem;
}
.map-loading[hidden] { display: none; }

.spinner {
  display: block;
  width: 34px; height: 34px;
  margin: 0 auto .8rem;
  border: 3px solid rgba(59, 76, 202, .2);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* --- Mobile: sidebar becomes a bottom sheet ----------------------------- */
.sheet-toggle { display: none; }

@media (max-width: 860px) {
  .map-shell { grid-template-columns: 1fr; }

  .panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: min(82vh, 620px);
    border-right: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 40px rgba(20, 22, 46, .22);
    transform: translateY(102%);
    transition: transform .34s var(--ease);
    z-index: 40;
  }
  body.sheet-open .panel { transform: none; }

  .panel::before {
    content: '';
    position: absolute;
    top: .5rem; left: 50%;
    transform: translateX(-50%);
    width: 40px; height: 4px;
    border-radius: 999px;
    background: var(--line);
  }

  .panel-head { padding-top: 2.2rem; }

  .sheet-close {
    display: grid;
    place-items: center;
    position: absolute;
    top: 1.05rem; right: .9rem;
    width: 30px; height: 30px;
    border: 0;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink-faint);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
  }

  .sheet-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    position: absolute;
    left: 50%;
    bottom: 1.15rem;
    transform: translateX(-50%);
    z-index: 35;
    padding: .75rem 1.35rem;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-family: 'Outfit', system-ui, sans-serif;
    font-weight: 700;
    font-size: .95rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
  }
  .sheet-toggle svg {
    width: 17px; height: 17px;
    fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round;
  }
  body.sheet-open .sheet-toggle { display: none; }

  .leaflet-control-attribution { font-size: .62rem !important; }
}

/* =========================================================================
   Submission form (submit.html)
   ========================================================================= */

.submit-form { padding: 0; }

/* Honeypot — off-screen rather than display:none, so bots still fill it */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.form-section {
  padding: clamp(1.4rem, 4vw, 2rem);
  border-bottom: 1px solid var(--line);
}
.form-section:first-of-type { padding-top: clamp(1.6rem, 4vw, 2.2rem); }

.form-section > h2 {
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.25rem;
}

.field { margin-bottom: 1.15rem; border: 0; padding: 0; }
.field:last-child { margin-bottom: 0; }

.field > label,
.field > legend {
  display: block;
  font-size: .92rem;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: .4rem;
  padding: 0;
}

.req { color: var(--coral); font-weight: 700; }
.opt {
  font-weight: 500;
  font-size: .82rem;
  color: var(--ink-faint);
  margin-left: .2rem;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field textarea {
  width: 100%;
  padding: .72rem .9rem;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.55; }

.field input:hover,
.field textarea:hover { border-color: #d3d2e4; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 4px rgba(59, 76, 202, .13);
}

.field.has-error input,
.field.has-error textarea { border-color: var(--coral); }
.field.has-error input:focus,
.field.has-error textarea:focus { box-shadow: 0 0 0 4px rgba(255, 90, 95, .16); }

.field-hint {
  margin: .4rem 0 0;
  font-size: .82rem;
  color: var(--ink-faint);
  line-height: 1.5;
}

.field-error {
  margin: .4rem 0 0;
  font-size: .84rem;
  font-weight: 600;
  color: var(--coral);
  display: none;
}
.field-error.is-shown { display: block; }

.field-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
}

/* Store type picker */
.type-grid { display: grid; gap: .55rem; }

.type-option {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem .95rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.type-option:hover { border-color: #d3d2e4; background: var(--paper); }

.type-option input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 18px; height: 18px;
  margin: .18rem 0 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.type-option input:checked {
  border-color: var(--c, var(--indigo));
  border-width: 6px;
}
.type-option input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.type-option[data-cat="independent"] { --c: #3b4cca; }
.type-option[data-cat="occasional"]  { --c: #c2185b; }
.type-option[data-cat="chain"]       { --c: #e0a800; }

.type-option:has(input:checked) {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 6%, transparent);
}

.type-body { display: flex; flex-direction: column; gap: .1rem; }
.type-name { font-weight: 650; font-size: .93rem; color: var(--ink); }
.type-hint { font-size: .82rem; color: var(--ink-faint); line-height: 1.45; }

/* Postcode + lookup */
.postcode-row { display: flex; gap: .6rem; align-items: stretch; }
.postcode-row input { max-width: 190px; text-transform: uppercase; }
.btn-find { flex: none; padding: .72rem 1.15rem; font-size: .92rem; }
.btn-find:disabled { opacity: .65; cursor: progress; transform: none; }

/* Location picker */
.locate {
  margin-top: 1.15rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fade-in .3s var(--ease) both;
}

@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.locate-head { padding: .9rem 1rem .75rem; background: var(--paper); }
.locate-head h3 { margin: 0 0 .15rem; font-size: .95rem; }
.locate-head p  { margin: 0; font-size: .84rem; color: var(--ink-soft); line-height: 1.5; }

.locate-map { height: 300px; background: #dfe3ee; }
.locate-map .leaflet-control-attribution { font-size: .65rem !important; }

.locate-coords {
  margin: 0;
  padding: .65rem 1rem;
  font-size: .82rem;
  color: var(--ink-faint);
  background: var(--paper);
  border-top: 1px solid var(--line);
}
.locate-coords:empty { display: none; }

/* Duplicate warning */
.dupe-warn {
  margin-top: 1.15rem;
  padding: .95rem 1.1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 203, 5, .14);
  border: 1px solid rgba(224, 168, 0, .35);
  font-size: .88rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
.dupe-warn strong { display: block; color: var(--ink); margin-bottom: .4rem; }
.dupe-warn ul { margin: 0 0 .5rem; padding-left: 1.1rem; }
.dupe-warn li { margin-bottom: .15rem; font-weight: 600; color: var(--ink); }
.dupe-warn li span { font-weight: 400; color: var(--ink-faint); }
.dupe-warn p { margin: 0; font-size: .84rem; }

/* Footer of the form */
.form-foot {
  padding: clamp(1.4rem, 4vw, 2rem);
  text-align: center;
}

.form-error {
  margin: 0 0 1rem;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 90, 95, .1);
  border: 1px solid rgba(255, 90, 95, .3);
  color: #b3262b;
  font-size: .9rem;
  font-weight: 600;
}

.btn-submit {
  width: 100%;
  max-width: 320px;
  position: relative;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
}
.btn-submit:disabled { cursor: progress; }

.btn-spin {
  display: none;
  width: 17px; height: 17px;
  border: 2px solid rgba(20, 22, 46, .25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-submit.is-loading .btn-label { opacity: .55; }
.btn-submit.is-loading .btn-spin { display: block; }

.form-foot-note {
  margin: .85rem 0 0;
  font-size: .82rem;
  color: var(--ink-faint);
}

/* Success state */
.submit-done { text-align: center; }

.done-mark {
  width: 58px; height: 58px;
  margin: .25rem auto 1rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(59, 76, 202, .1);
}
.done-mark svg {
  width: 28px; height: 28px;
  fill: none; stroke: var(--indigo); stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.submit-done h2 { margin-bottom: .5rem; }
.submit-done .prose { max-width: 46ch; margin: 0 auto 1.5rem; }

.done-actions {
  display: flex;
  gap: .6rem;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .postcode-row { flex-direction: column; }
  .postcode-row input { max-width: none; }
  .btn-find { width: 100%; }
  .locate-map { height: 260px; }
  .btn-submit { max-width: none; }
}

.cc-loading-hint {
  display: inline-block;
  margin: .75rem 0 0;
  padding: .6rem .85rem;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .8rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

/* =========================================================================
   Map themes
   A data-map-theme attribute on <html> swaps the look: 'classic' (plain) or
   'pixel' (16-bit handheld-RPG styling, original artwork). Both pin shapes
   ship in every marker, so switching is pure CSS and rebuilds nothing.

   Palette sampled from a GBA-era town scene: mint grass, sand paths, sky
   roofs, deep slate outlines.
   ========================================================================= */

/* --- Theme toggle button ------------------------------------------------ */
.theme-toggle {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem .55rem .8rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  font-size: .85rem;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease),
              background .2s var(--ease);
}
.theme-toggle:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }

.theme-icon {
  width: 17px; height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* --- Pin shapes --------------------------------------------------------- */
.pin-shape { width: 100%; height: 100%; }
.pin-pixel { display: none; }

.pin-classic path { fill: var(--pin); }

.px-dark { fill: #2b3050; }
.px-body { fill: var(--pin); }
.px-hi   { fill: rgba(255, 255, 255, .5); }
.px-sh   { fill: rgba(43, 48, 80, .22); }
.px-dot  { fill: #fffdf0; }

/* --- Pixel theme -------------------------------------------------------- */
:root[data-map-theme='pixel'] {
  --px-grass:    #73cea5;
  --px-grass-lt: #bde7a5;
  --px-sand:     #ede68c;
  --px-sky:      #addeef;
  --px-roof:     #95c6d5;
  --px-ink:      #43496b;
  --px-ink-deep: #2b3050;
  --px-paper:    #fffdf0;
  --px-rule:     #ded7b8;
  --px-font: 'Press Start 2P', ui-monospace, 'Courier New', monospace;

  /* Tune the basemap from these two: the filter pushes greens and water
     toward the palette, the wash lays sand over the land. */
  --map-filter: saturate(2.2) hue-rotate(-12deg) brightness(1.04);
  --map-warmth: rgba(237, 230, 140, .40);
}

/* Recolour the tile images themselves — never the pane Leaflet transforms */
:root[data-map-theme='pixel'] .leaflet-tile { filter: var(--map-filter); }

:root[data-map-theme='pixel'] .map-holder::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  background: var(--map-warmth);
  mix-blend-mode: multiply;
}

/* Hard inner border, like the edge of a handheld screen */
:root[data-map-theme='pixel'] .map-holder::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 24;
  pointer-events: none;
  box-shadow: inset 0 0 0 4px var(--px-ink-deep);
}

/* Markers */
:root[data-map-theme='pixel'] .pin-classic { display: none; }
:root[data-map-theme='pixel'] .pin-pixel   { display: block; }

:root[data-map-theme='pixel'] .cc-pin {
  filter: drop-shadow(2px 2px 0 rgba(43, 48, 80, .35));
  transform-origin: 14px 34px;
}
:root[data-map-theme='pixel'] .cc-pin:hover,
:root[data-map-theme='pixel'] .cc-pin.is-active {
  transform: translateY(-2px) scale(1.1);
  filter: drop-shadow(2px 4px 0 rgba(43, 48, 80, .4));
}

/* Clusters as chunky bevelled badges.
   Note: no `position` here — Leaflet owns that (see the 11 Sept offset bug). */
:root[data-map-theme='pixel'] .cc-cluster {
  border-radius: 0;
  background: var(--px-grass);
  color: var(--px-ink-deep);
  font-family: var(--px-font);
  font-size: .62rem;
  letter-spacing: 0;
  text-shadow: none;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, .6),
    inset -2px -2px 0 rgba(43, 48, 80, .2),
    0 0 0 3px var(--px-ink-deep),
    4px 4px 0 rgba(43, 48, 80, .3);
}
:root[data-map-theme='pixel'] .cc-cluster:hover { transform: translate(-1px, -1px); }
:root[data-map-theme='pixel'] .cc-cluster-md { background: var(--px-sky); }
:root[data-map-theme='pixel'] .cc-cluster-lg { background: var(--px-sand); font-size: .68rem; }

:root[data-map-theme='pixel'] .cc-you span {
  border-radius: 0;
  background: #ff5a5f;
  border-color: #fffdf0;
  box-shadow: 0 0 0 3px var(--px-ink-deep);
}

/* Popups as dialogue boxes */
:root[data-map-theme='pixel'] .cc-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 0;
  background: var(--px-paper);
  box-shadow: 0 0 0 4px var(--px-ink-deep), 6px 6px 0 rgba(43, 48, 80, .28);
}
:root[data-map-theme='pixel'] .cc-popup-wrap .leaflet-popup-tip {
  background: var(--px-ink-deep);
  box-shadow: none;
}
:root[data-map-theme='pixel'] .cc-popup h3 { font-family: var(--px-font); font-size: .72rem; line-height: 1.5; }
:root[data-map-theme='pixel'] .cc-badge {
  border-radius: 0;
  font-family: var(--px-font);
  font-size: .52rem;
  letter-spacing: 0;
  padding: .32rem .5rem;
  color: var(--px-ink-deep);
  background: color-mix(in srgb, var(--pin) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--pin);
}
:root[data-map-theme='pixel'] .cc-btn-sm {
  border-radius: 0;
  border: 3px solid var(--px-ink-deep);
  font-family: var(--px-font);
  font-size: .55rem;
  line-height: 1.6;
  color: var(--px-ink-deep);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .5), 3px 3px 0 rgba(43, 48, 80, .25);
}
:root[data-map-theme='pixel'] .cc-btn-solid {
  background: var(--px-sky);
  color: var(--px-ink-deep);
}
:root[data-map-theme='pixel'] .cc-btn-sm:active { transform: translate(3px, 3px); box-shadow: inset 2px 2px 0 rgba(43,48,80,.15); }

/* Sidebar as a game menu panel */
:root[data-map-theme='pixel'] .panel {
  background: var(--px-paper);
  border-right: 4px solid var(--px-ink-deep);
}
:root[data-map-theme='pixel'] .panel-head,
:root[data-map-theme='pixel'] .panel-foot { border-color: var(--px-rule); }

:root[data-map-theme='pixel'] .search-row {
  border-radius: 0;
  border: 3px solid var(--px-ink-deep);
  background: #fff;
  box-shadow: inset 2px 2px 0 rgba(43, 48, 80, .1);
}
:root[data-map-theme='pixel'] .search-row:focus-within {
  box-shadow: inset 2px 2px 0 rgba(43, 48, 80, .1), 0 0 0 3px var(--px-grass);
}
:root[data-map-theme='pixel'] .search-go {
  border-radius: 0;
  margin: 3px;
  font-family: var(--px-font);
  font-size: .56rem;
  background: var(--px-ink);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .3), inset -2px -2px 0 rgba(0, 0, 0, .25);
}
:root[data-map-theme='pixel'] .chip {
  border-radius: 0;
  border: 2px solid var(--px-ink-deep);
  font-family: var(--px-font);
  font-size: .56rem;
  padding: .5rem .7rem;
  color: var(--px-ink-deep);
  box-shadow: 2px 2px 0 rgba(43, 48, 80, .2);
}
:root[data-map-theme='pixel'] .chip:active { transform: translate(2px, 2px); box-shadow: none; }
:root[data-map-theme='pixel'] .chip-clear { background: var(--px-grass-lt); }

:root[data-map-theme='pixel'] .filter-dot { border-radius: 0; box-shadow: 0 0 0 2px var(--px-ink-deep); }
:root[data-map-theme='pixel'] .filter:hover { background: var(--px-grass-lt); }
:root[data-map-theme='pixel'] .filter-count {
  border-radius: 0;
  font-family: var(--px-font);
  font-size: .5rem;
  padding: .28rem .45rem;
  background: var(--px-grass-lt);
  color: var(--px-ink-deep);
}
:root[data-map-theme='pixel'] .geo-hint { border-radius: 0; background: var(--px-sand); color: var(--px-ink-deep); }
:root[data-map-theme='pixel'] .geo-hint kbd { border-radius: 0; border-color: var(--px-ink-deep); }

:root[data-map-theme='pixel'] .list-head h2 { font-family: var(--px-font); font-size: .62rem; line-height: 1.6; }
:root[data-map-theme='pixel'] .cc-card { border-radius: 0; }
:root[data-map-theme='pixel'] .cc-card:hover { background: var(--px-grass-lt); }
:root[data-map-theme='pixel'] .cc-card-dot {
  border-radius: 0;
  width: 10px; height: 10px;
  box-shadow: 0 0 0 2px var(--px-ink-deep);
}

/* Buttons get the classic two-tone bevel and a press that actually moves */
:root[data-map-theme='pixel'] .btn,
:root[data-map-theme='pixel'] .theme-toggle,
:root[data-map-theme='pixel'] .sheet-toggle {
  border-radius: 0;
  border: 3px solid var(--px-ink-deep);
  font-family: var(--px-font);
  font-size: .62rem;
  line-height: 1.7;
  color: var(--px-ink-deep);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, .5),
    inset -2px -2px 0 rgba(43, 48, 80, .2),
    4px 4px 0 rgba(43, 48, 80, .3);
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
:root[data-map-theme='pixel'] .btn:hover,
:root[data-map-theme='pixel'] .theme-toggle:hover,
:root[data-map-theme='pixel'] .sheet-toggle:hover {
  transform: translate(1px, 1px);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, .5),
    inset -2px -2px 0 rgba(43, 48, 80, .2),
    3px 3px 0 rgba(43, 48, 80, .3);
}
:root[data-map-theme='pixel'] .btn:active,
:root[data-map-theme='pixel'] .theme-toggle:active,
:root[data-map-theme='pixel'] .sheet-toggle:active {
  transform: translate(4px, 4px);
  box-shadow: inset 2px 2px 0 rgba(43, 48, 80, .18);
}
:root[data-map-theme='pixel'] .theme-toggle { background: var(--px-paper); }
:root[data-map-theme='pixel'] .sheet-toggle { background: var(--px-sand); }
:root[data-map-theme='pixel'] .btn-gold  { background: var(--px-sand); }
:root[data-map-theme='pixel'] .btn-primary { background: var(--px-sky); color: var(--px-ink-deep); }

/* Leaflet's own chrome */
:root[data-map-theme='pixel'] .leaflet-control-zoom a {
  border-radius: 0 !important;
  border: 3px solid var(--px-ink-deep) !important;
  background: var(--px-paper);
  color: var(--px-ink-deep) !important;
  font-family: var(--px-font);
  font-size: .7rem;
  box-shadow: 2px 2px 0 rgba(43, 48, 80, .3);
}
:root[data-map-theme='pixel'] .leaflet-control-attribution {
  border-radius: 0;
  background: rgba(255, 253, 240, .9) !important;
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .cc-pin { transition: none; }
}

@media (max-width: 860px) {
  .theme-toggle {
    top: .7rem;
    left: .7rem;
    padding: .45rem .8rem .45rem .65rem;
    font-size: .78rem;
  }
  :root[data-map-theme='pixel'] .theme-toggle,
  :root[data-map-theme='pixel'] .sheet-toggle { font-size: .5rem; }
}

/* =========================================================================
   Easter eggs
   ========================================================================= */

/* --- Toast -------------------------------------------------------------- */
.cc-toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: .15rem;
  padding: .8rem 1.3rem;
  border: 3px solid var(--px-ink-deep, #2b3050);
  border-radius: 0;
  background: var(--px-paper, #fffdf0);
  color: var(--px-ink-deep, #2b3050);
  text-align: center;
  box-shadow: 5px 5px 0 rgba(43, 48, 80, .3);
  animation: toast-in .3s steps(3) both;
}
.cc-toast strong {
  font-family: 'Press Start 2P', ui-monospace, monospace;
  font-size: .62rem;
  line-height: 1.6;
}
.cc-toast span { font-size: .84rem; color: var(--ink-soft); }
.cc-toast.is-going { animation: toast-out .5s ease-in both; }

@keyframes toast-in  { from { transform: translate(-50%, 20px); opacity: 0; } }
@keyframes toast-out { to   { transform: translate(-50%, 20px); opacity: 0; } }

/* --- The wanderer -------------------------------------------------------
   Add artwork by dropping a strip in sprites/ and listing it in
   sprites/sprites.json. map.js picks one at random and sets every variable
   below per sheet — size and frame count both come from the file and its
   name, so there is nothing here to change. These are only the fallbacks.
   ------------------------------------------------------------------------ */
:root {
  --sprite-url:    url('sprites/wanderer-right-6.png');
  --sprite-frames: 6;
  --sprite-w:      32px;
  --sprite-h:      32px;
  --sprite-scale:  2;      /* drawn at 2x so the pixels stay chunky */
  --sprite-fps:    .72s;   /* time for one full walk cycle */
  --sprite-travel: 18s;    /* time to cross the map */
}

.cc-wanderer {
  position: absolute;
  bottom: 2.2rem;
  left: 0;
  z-index: 26;
  pointer-events: none;
  width:  calc(var(--sprite-w) * var(--sprite-scale));
  height: calc(var(--sprite-h) * var(--sprite-scale));
  background-image: var(--sprite-url);
  background-repeat: no-repeat;
  background-size: calc(var(--sprite-w) * var(--sprite-frames) * var(--sprite-scale)) auto;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(43, 48, 80, .28));
  animation: crit-walk var(--sprite-fps) steps(6) infinite,
             crit-cross var(--sprite-travel) linear forwards;
}

/* Walking the other way: mirror the sprite and cross in reverse */
.cc-wanderer.is-backwards {
  animation: crit-walk var(--sprite-fps) steps(6) infinite,
             crit-cross-back var(--sprite-travel) linear forwards;
}

/* ...unless there's a left-facing sheet, in which case the art already faces
   the right way and flipping it would undo the drawing */
.cc-wanderer.is-backwards.is-drawn-facing {
  animation: crit-walk var(--sprite-fps) steps(6) infinite,
             crit-cross-back-flat var(--sprite-travel) linear forwards;
}

@keyframes crit-walk {
  to { background-position-x: calc(var(--sprite-w) * var(--sprite-frames) * var(--sprite-scale) * -1); }
}
@keyframes crit-cross {
  from { transform: translateX(-80px) scaleX(1); }
  to   { transform: translateX(calc(100vw + 80px)) scaleX(1); }
}
@keyframes crit-cross-back {
  from { transform: translateX(calc(100vw + 80px)) scaleX(-1); }
  to   { transform: translateX(-80px) scaleX(-1); }
}
@keyframes crit-cross-back-flat {
  from { transform: translateX(calc(100vw + 80px)); }
  to   { transform: translateX(-80px); }
}

@media (prefers-reduced-motion: reduce) { .cc-wanderer { display: none; } }

/* --- Foil finish --------------------------------------------------------- */
body.is-foil .cc-pin,
body.is-foil .cc-cluster {
  animation: foil 1.1s linear 4;
}
@keyframes foil {
  0%   { filter: hue-rotate(0deg)   saturate(1)   brightness(1); }
  25%  { filter: hue-rotate(90deg)  saturate(1.8) brightness(1.25); }
  50%  { filter: hue-rotate(180deg) saturate(2.2) brightness(1.35); }
  75%  { filter: hue-rotate(270deg) saturate(1.8) brightness(1.25); }
  100% { filter: hue-rotate(360deg) saturate(1)   brightness(1); }
}

/* =========================================================================
   Night map — unlocked, not listed. Inherits everything from the pixel
   theme, then repaints it after dark.
   ========================================================================= */
:root[data-map-theme='night'] {
  --px-grass:    #2f6f6a;
  --px-grass-lt: #3d8a7d;
  --px-sand:     #4a4470;
  --px-sky:      #2a3560;
  --px-ink:      #0f1430;
  --px-ink-deep: #070a1c;
  --px-paper:    #1b2145;
  --px-rule:     #2e376b;
  --px-font: 'Press Start 2P', ui-monospace, 'Courier New', monospace;

  --map-filter: saturate(1.4) hue-rotate(175deg) brightness(.55) contrast(1.15);
  --map-warmth: rgba(30, 40, 96, .55);
}

:root[data-map-theme='night'] .leaflet-tile { filter: var(--map-filter); }

:root[data-map-theme='night'] .map-holder::before {
  content: '';
  position: absolute; inset: 0; z-index: 22;
  pointer-events: none;
  background: var(--map-warmth);
  mix-blend-mode: multiply;
}
:root[data-map-theme='night'] .map-holder::after {
  content: '';
  position: absolute; inset: 0; z-index: 24;
  pointer-events: none;
  box-shadow: inset 0 0 0 4px var(--px-ink-deep),
              inset 0 0 120px rgba(0, 0, 0, .5);
}

/* Pins glow after dark */
:root[data-map-theme='night'] .pin-classic { display: none; }
:root[data-map-theme='night'] .pin-pixel   { display: block; }
:root[data-map-theme='night'] .cc-pin {
  filter: drop-shadow(0 0 5px var(--pin)) drop-shadow(2px 2px 0 rgba(0, 0, 0, .5));
}
:root[data-map-theme='night'] .px-dark { fill: #070a1c; }
:root[data-map-theme='night'] .px-dot  { fill: #eaf6ff; }

:root[data-map-theme='night'] .cc-cluster {
  border-radius: 0;
  background: #2f6f6a;
  color: #eaf6ff;
  font-family: var(--px-font);
  font-size: .62rem;
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, .22),
    inset -2px -2px 0 rgba(0, 0, 0, .35),
    0 0 0 3px #070a1c,
    0 0 14px rgba(90, 220, 200, .5);
}
:root[data-map-theme='night'] .cc-cluster-md { background: #35508f; }
:root[data-map-theme='night'] .cc-cluster-lg { background: #6b4fa8; }

/* Panel, buttons and popups follow the pixel rules but in the dark palette */
:root[data-map-theme='night'] .panel { background: #141935; color: #cdd6f5; }
:root[data-map-theme='night'] .panel-head,
:root[data-map-theme='night'] .panel-foot { border-color: var(--px-rule); }
:root[data-map-theme='night'] .search-row { background: #0f1430; border: 3px solid #070a1c; border-radius: 0; }
:root[data-map-theme='night'] #search { color: #eaf6ff; }
:root[data-map-theme='night'] .list-head h2,
:root[data-map-theme='night'] .cc-card-name { color: #eaf6ff; }
:root[data-map-theme='night'] .cc-card-meta,
:root[data-map-theme='night'] .list-head span { color: #8e9ad4; }
:root[data-map-theme='night'] .cc-card:hover { background: #1f2750; }
:root[data-map-theme='night'] .filter { color: #b6c0ea; }
:root[data-map-theme='night'] .filter:hover { background: #1f2750; }
:root[data-map-theme='night'] .filter-count { background: #252d59; color: #cdd6f5; border-radius: 0; font-family: var(--px-font); font-size: .5rem; }
:root[data-map-theme='night'] .filter-dot { border-radius: 0; box-shadow: 0 0 0 2px #070a1c; }
:root[data-map-theme='night'] .chip { background: #1f2750; color: #cdd6f5; border: 2px solid #070a1c; border-radius: 0; font-family: var(--px-font); font-size: .56rem; }
:root[data-map-theme='night'] .search-go { background: #35508f; border-radius: 0; font-family: var(--px-font); font-size: .56rem; }
:root[data-map-theme='night'] .btn,
:root[data-map-theme='night'] .theme-toggle,
:root[data-map-theme='night'] .sheet-toggle {
  border-radius: 0;
  border: 3px solid #070a1c;
  font-family: var(--px-font);
  font-size: .62rem;
  line-height: 1.7;
  color: #eaf6ff;
  background: #35508f;
  backdrop-filter: none;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .18),
              inset -2px -2px 0 rgba(0, 0, 0, .35),
              4px 4px 0 rgba(0, 0, 0, .4);
}
:root[data-map-theme='night'] .btn-gold { background: #6b4fa8; }
:root[data-map-theme='night'] .cc-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 0;
  background: #1b2145;
  color: #cdd6f5;
  box-shadow: 0 0 0 4px #070a1c, 6px 6px 0 rgba(0, 0, 0, .45);
}
:root[data-map-theme='night'] .cc-popup h3 { color: #eaf6ff; font-family: var(--px-font); font-size: .72rem; line-height: 1.5; }
:root[data-map-theme='night'] .cc-popup-wrap .leaflet-popup-tip { background: #070a1c; }
:root[data-map-theme='night'] .leaflet-control-zoom a {
  border-radius: 0 !important;
  border: 3px solid #070a1c !important;
  background: #1b2145;
  color: #eaf6ff !important;
  font-family: var(--px-font);
}
