/* ldn.pub — minimal. neutral palette, single sans-serif family, restrained accents. */

:root {
  --paper:        #ffffff;
  --bg:           #f5f5f7;
  --paper-deep:   #e8e8ed;
  --paper-shade:  #f5f5f7;
  --ink:          #1d1d1f;
  --ink-soft:     #3c3c43;
  --ink-muted:    #86868b;
  --ink-faint:    #c7c7cc;

  --ale:          #a87a14;
  --ale-deep:     #7e5a0d;
  --ale-bright:   #c8951e;
  --claret:       #a87a14;
  --hop:          #1f6e43;
  --hop-bright:   #2a8559;
  --foam:         #f3e6c2;

  --border:       #d2d2d7;
  --border-soft:  #e5e5ea;
  --border-strong:#86868b;
  --fill:         #f5f5f7;

  --radius:       8px;
  --radius-lg:    12px;
  --radius-pill:  980px;

  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter Tight", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono:    "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --topbar-h: 56px;
  --shadow-card: 0 1px 0 rgba(0,0,0,0.02), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-pop:  0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); color: var(--ink); }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

body.pubs-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ale); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

::selection { background: rgba(184,93,36,0.18); color: var(--ink); }

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--ink);
}
h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.05; letter-spacing: -0.028em; font-weight: 600; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); line-height: 1.1; letter-spacing: -0.02em; font-weight: 600; }
h3 { font-size: 1.0625rem; line-height: 1.3; letter-spacing: -0.01em; font-weight: 600; }

.display { font-family: var(--font-display); font-weight: 600; }
.display-italic, em.display-italic {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  color: var(--ale);
  letter-spacing: -0.022em;
}
em.serif, .serif-italic {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.eyebrow::before { display: none; }

.fleuron, .rule-fleuron { display: none; }

/* ---------- Layout helpers ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(1.25rem, 3vw, 2rem); }
.section { padding: clamp(2.5rem, 5vw, 5rem) 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: end; gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-head .title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--ink);
}
.section-head .sub {
  font-family: var(--font-body);
  font-size: 0.86rem;
  letter-spacing: 0;
  color: var(--ink-muted);
}

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar .wrap.topbar-inner {
  max-width: none;
  padding-left: clamp(1rem, 2.5vw, 1.5rem);
  padding-right: clamp(1rem, 2.5vw, 1.5rem);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem 0;
  min-height: 44px;
}
.brand-block { display: inline-flex; align-items: center; gap: 0.65rem; min-width: 0; }
.brand-tag {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.86rem;
  font-weight: 400;
  color: var(--ink-muted);
  letter-spacing: -0.005em;
  display: none;
  white-space: nowrap;
  line-height: 1;
}
.brand-tag::before { content: ""; margin: 0; }
@media (min-width: 760px) { .brand-tag { display: inline-block; } }

/* ---------- Brand / logo ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.014em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}
.brand:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; color: var(--ink); }
.brand-text { display: inline-block; white-space: nowrap; }
/* Accent-coloured trailing dot, used in headings + the brand wordmark */
.dot { color: var(--ale); }
.brand .dot {
  font-style: normal;
  color: var(--ale);
  font-weight: 600;
  font-size: 1em;
  margin: 0;
  display: inline;
  transform: none;
}
h1 .dot, h2 .dot, .sb-volume .dot { color: var(--ale); }
.brand-icon {
  color: var(--ale);
  flex-shrink: 0;
  display: block;
}

/* ---------- Nav ---------- */
.nav {
  display: flex; gap: 0.05rem; align-items: center;
  font-family: var(--font-body);
  font-size: 0.86rem;
}
.nav a {
  padding: 0.4rem 0.8rem;
  text-decoration: none;
  color: var(--ink-muted);
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  letter-spacing: -0.005em;
  font-weight: 500;
}
.nav a:hover { color: var(--ink); background: rgba(0,0,0,0.04); text-decoration: none; }
.nav a.active { color: var(--ink); }
.nav a.active::after { content: ""; }

.nav-count {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 0.24rem 0.6rem;
  border: 0;
  background: var(--fill);
  color: var(--ink);
  letter-spacing: 0;
  margin-left: 0.4rem;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 0.55rem 1.15rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover { background: #000; color: var(--paper); text-decoration: none; }
.btn-ale { background: var(--ale); border-color: var(--ale); }
.btn-ale:hover { background: var(--ale-deep); border-color: var(--ale-deep); color: var(--paper); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--fill); color: var(--ink); border-color: var(--ink-muted); }

/* ---------- Stamps / tags ---------- */
.stamp {
  display: inline-flex; align-items: center;
  padding: 0.16rem 0.55rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  background: var(--fill);
  color: var(--ink-muted);
  border: 0;
  border-radius: var(--radius-pill);
}
.stamp.claret { background: rgba(184,93,36,0.1); color: var(--ale-deep); }
.stamp.ale    { background: var(--foam); color: var(--ale-deep); }
.stamp.hop    { background: rgba(31,110,67,0.1); color: var(--hop); }

/* "Complete" pill — clean filled badge */
.stamp-complete {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--hop);
  background: rgba(31,110,67,0.1);
  border: 0;
  border-radius: var(--radius-pill);
}
.stamp-complete::before {
  content: "✓";
  font-size: 0.8em;
  margin-right: 0;
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3rem);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: end;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; align-items: start; } }

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  margin: 0;
}
.hero-title em, .hero-title .display-italic {
  font-style: normal;
  color: var(--ale);
  font-weight: 600;
}
.hero-sub {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1.5vw, 1.15rem);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0;
}

/* ---------- Stat bar ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 2.5rem;
}
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  padding: 1.5rem 1rem 1.5rem 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.35rem;
}
.stat:last-child { border-right: 0; }
.stat:not(:first-child) { padding-left: 1rem; }
@media (max-width: 720px) {
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3vw, 2.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-value.ale { color: var(--ale); }
.stat-label {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
}

/* ---------- Borough grid ---------- */
.borough-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  align-items: start;
}
.borough-card {
  background: var(--paper);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  position: relative;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  min-height: 160px;
}
.borough-card:hover {
  border-color: var(--border);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.borough-card.done {
  background: var(--paper);
  border-color: var(--border-soft);
}
.borough-card.done .b-progress-fill { background: var(--hop); }

.borough-card .eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
  text-transform: none;
  font-variant-numeric: tabular-nums;
}
.borough-card .eyebrow::before { display: none; }

.b-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin-top: 0.25rem;
}
.b-count {
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.05rem;
}
.b-progress {
  margin-top: auto;
  height: 3px;
  background: var(--fill);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.b-progress-fill {
  height: 100%;
  background: var(--ale);
  border-radius: 2px;
  transition: width 0.45s cubic-bezier(.2,.7,.3,1);
}
.b-badge {
  position: absolute;
  top: 1.1rem; right: 1.1rem;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
}

/* ---------- Tube grid ---------- */
.tube-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.75rem;
  align-items: start;
}
.tube-card {
  background: var(--paper);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.tube-card:hover { border-color: var(--border); box-shadow: 0 4px 16px rgba(0,0,0,0.04); }
.tube-card.done { background: var(--paper); border-color: var(--border-soft); }
.tube-card-head {
  width: 100%;
  display: grid;
  grid-template-columns: 4px 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.15rem;
  background: transparent;
  border: 0;
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}
.tube-card.open .tube-card-head { border-bottom: 1px solid var(--border-soft); }
.tube-stripe {
  align-self: stretch;
  width: 4px;
  border-radius: 2px;
}
.tube-info {
  display: flex; flex-direction: column; gap: 0.05rem;
  min-width: 0;
}
.tube-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--ink);
  line-height: 1.2;
}
.tube-count {
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}
.tube-progress {
  width: 64px;
  height: 2px;
  background: var(--border-soft);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}
.tube-progress-fill {
  position: absolute; inset: 0;
  width: 0%;
  background: var(--ale);
  transition: width 0.45s cubic-bezier(.2,.7,.3,1);
}
.tube-chevron {
  display: inline-flex;
  color: var(--ink-muted);
  transition: transform 0.2s;
}
.tube-card.open .tube-chevron { transform: rotate(180deg); }

.tube-stops {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.5rem;
  max-height: 380px;
  overflow-y: auto;
}
.tube-stop {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 0.7rem;
  align-items: center;
  padding: 0.55rem 1.15rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.1s;
}
.tube-stop:hover { background: var(--fill); }
.tube-stop.missing {
  grid-template-columns: 1fr auto;
  color: var(--ink-muted);
  cursor: default;
}
.tube-stop.missing:hover { background: transparent; }
.stop-tick {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--paper);
}
.stop-tick svg { opacity: 0; transition: opacity 0.15s; }
.tube-stop.ticked .stop-tick { background: var(--hop); border-color: var(--hop); }
.tube-stop.ticked .stop-tick svg { opacity: 1; }
.stop-main { display: flex; flex-direction: column; min-width: 0; }
.stop-name { font-size: 0.92rem; font-weight: 500; letter-spacing: -0.005em; color: var(--ink); }
.tube-stop.ticked .stop-name {
  color: var(--ink-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.stop-pub { font-size: 0.78rem; color: var(--ink-muted); }
.stop-note {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-style: normal;
}

/* ---------- Filter bar (challenges page) ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  padding: 0.5rem 0 1rem;
  margin-bottom: 0.5rem;
}
.filter-bar select {
  font-family: var(--font-body);
  font-size: 0.86rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius-pill);
}
.filter-bar label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: inline-flex; gap: 0.4rem; align-items: center;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
}
.filter-bar label input[type="checkbox"] { accent-color: var(--ale); }

/* ============================================================
   PUBS PAGE — map + docked sidebar
   ============================================================ */
.pubs-page {
  position: relative;
  background: var(--paper-shade);
  --sidebar-w: 380px;
}
.pubs-page[data-sidebar="hidden"] { --sidebar-w: 0px; }

#map {
  position: fixed;
  top: var(--topbar-h);
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background: var(--paper-deep);
  transition: left 0.34s cubic-bezier(.2,.7,.3,1), bottom 0.34s cubic-bezier(.2,.7,.3,1);
}

/* ---------- Sidebar shell — docked left rail ----------
   Width stays fixed (so the content doesn't reflow during the slide); the
   --sidebar-w variable is only used to push the map. transform handles
   the actual show/hide motion. */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: 380px;
  height: calc(100dvh - var(--topbar-h));
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--border-soft);
  box-shadow: 4px 0 24px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  z-index: 10;
  overflow: hidden;
  transition: transform 0.34s cubic-bezier(.2,.7,.3,1);
}
.pubs-page[data-sidebar="hidden"] .sidebar {
  transform: translateX(-100%);
  pointer-events: none;
}

/* ---------- Sidebar masthead ---------- */
.sb-masthead {
  position: relative;
  padding: 1.1rem 1.15rem 1rem;
  border-bottom: 1px solid rgba(50,45,30,0.07);
  flex-shrink: 0;
}
.sb-masthead-top {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.sb-mark {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ale);
  flex-shrink: 0;
}
.sb-volume {
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-volume b { color: var(--ink); font-weight: 600; }
.sb-collapse {
  width: 28px; height: 28px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sb-collapse:hover {
  background: rgba(255,255,255,0.6);
  border-color: rgba(50,45,30,0.1);
  color: var(--ink);
}

/* ---------- Progress display ---------- */
.sb-progress {
  display: flex; flex-direction: column; gap: 0.55rem;
}
.sb-progress-headline {
  font-family: var(--font-body);
  font-style: normal;
  color: var(--ink);
  display: flex; align-items: baseline; gap: 0.4rem;
  flex-wrap: wrap;
  line-height: 1;
}
.sb-progress-headline .num {
  font-family: var(--font-body);
  font-weight: 600;
  font-style: normal;
  color: var(--ink);
  font-size: 2.6rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.sb-progress-headline .of {
  display: none;
}
.sb-progress-headline .denom {
  font-family: var(--font-mono);
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-size: 0.86rem;
  color: var(--ink-muted);
  letter-spacing: 0;
}
.sb-progress-headline .word {
  font-family: var(--font-body);
  font-style: normal;
  color: var(--ink-muted);
  font-size: 0.78rem;
  letter-spacing: -0.003em;
  margin-left: 0.4rem;
}

.sb-bar {
  height: 4px;
  background: rgba(50,45,30,0.08);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.sb-bar > span {
  position: absolute; inset: 0; right: auto;
  width: 0%;
  background: linear-gradient(90deg, var(--ale), var(--ale-bright));
  border-radius: 2px;
  transition: width 0.55s cubic-bezier(.2,.7,.3,1);
}

.sb-progress-meta {
  display: flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-body);
  font-size: 0.74rem;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}
.sb-progress-meta b {
  color: var(--ink);
  font-weight: 600;
}
.sb-progress-meta .sep { color: var(--ink-faint); }
.sb-progress-meta .quip {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.74rem;
  letter-spacing: -0.003em;
  color: var(--ale);
  font-weight: 500;
  margin-left: auto;
  text-transform: none;
}

/* ---------- Tabs ---------- */
.sb-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 1.15rem;
  flex-shrink: 0;
}
.sb-tab {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0.7rem 0;
  margin-right: 1rem;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.15s;
}
.sb-tab:last-child { margin-right: 0; }
.sb-tab .sb-tab-count {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  margin-left: 0.35rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  vertical-align: 0.05em;
}
.sb-tab:hover { color: var(--ink); }
.sb-tab.active { color: var(--ink); font-weight: 600; }
.sb-tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--ale);
  border-radius: 2px 2px 0 0;
}

/* ---------- Filters ---------- */
.sb-controls {
  padding: 0.85rem 1.15rem 0.7rem;
  display: flex; flex-direction: column; gap: 0.55rem;
  border-bottom: 1px solid rgba(50,45,30,0.06);
  flex-shrink: 0;
}
.sb-controls[hidden] { display: none; }

.sb-search {
  position: relative;
  display: flex; align-items: center;
}
.sb-search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--ink-faint);
  pointer-events: none;
}
.sb-search input[type="search"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 0.55rem 0.95rem 0.55rem 2.3rem;
  border: 1px solid rgba(50,45,30,0.12);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  outline: none;
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.sb-search input[type="search"]::placeholder {
  color: var(--ink-faint);
  font-style: normal;
  font-family: var(--font-body);
  font-size: 0.88rem;
}
.sb-search input[type="search"]:focus {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(184, 93, 36, 0.55);
  box-shadow: 0 0 0 3px rgba(184, 93, 36, 0.14);
}
.sb-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 14px; width: 14px;
  background: var(--ink-faint);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M3 3l8 8M11 3l-8 8' stroke='black' stroke-width='2' stroke-linecap='round' fill='none'/></svg>") center/contain no-repeat;
  cursor: pointer;
}

.sb-filterrow {
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}

/* Segmented control: all / to-do / done */
.sb-seg {
  display: inline-flex;
  background: rgba(50,45,30,0.07);
  border-radius: var(--radius-pill);
  padding: 2px;
  gap: 1px;
}
.sb-seg button {
  padding: 0.32rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;

  font-variant-numeric: tabular-nums;
}
.sb-seg button:hover { color: var(--ink); }
.sb-seg button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.sb-borough-select {
  flex: 1; min-width: 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.36rem 0.7rem;
  border: 1px solid rgba(50,45,30,0.12);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.sb-borough-select:hover { background: rgba(255,255,255,0.8); border-color: rgba(50,45,30,0.18); }
.sb-borough-select:focus { border-color: rgba(184,93,36,0.55); background: rgba(255,255,255,0.95); }

.sb-more-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.sb-iconbtn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sb-iconbtn:hover {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(50,45,30,0.12);
  color: var(--ink);
}

.sb-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 0.4rem;
  z-index: 30;
  display: none;
}
.sb-menu[data-open="1"] { display: block; }
.sb-menu .menu-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  padding: 0.5rem 0.65rem 0.3rem;
}
.sb-menu .menu-item {
  display: flex; align-items: center; gap: 0.55rem;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0.5rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.12s;
}
.sb-menu .menu-item:hover { background: var(--fill); }
.sb-menu .menu-item.danger { color: var(--claret); }
.sb-menu .menu-item.danger:hover { background: rgba(184, 93, 36, 0.08); }
.sb-menu .menu-item .check {
  width: 14px; opacity: 0; color: var(--ale);
}
.sb-menu .menu-item.active .check { opacity: 1; }
.sb-menu .menu-divider {
  height: 1px;
  background: var(--border-soft);
  margin: 0.35rem 0.4rem;
}

/* ---------- Sidebar scroll area ---------- */
.sb-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 1.15rem 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.sb-panel { }
.sb-panel[hidden] { display: none; }

/* Borough sections inside the sidebar */
.borough-group {
  margin-bottom: 0.4rem;
}
/* Sticky header — fully opaque so scrolling content can't bleed through, and
   negative-margin tricks let the white extend to the gutters of the scroll
   pane so there's no visible gap at the very top while scrolling. */
.borough-group-head {
  position: sticky; top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.15rem 0.55rem;
  margin: 0 -1.15rem;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.borough-group-num {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0;
  color: var(--ink-faint);
  text-transform: none;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.borough-group-name {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--ink);
  line-height: 1.1;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.borough-group-progress {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.borough-group-progress .pct {
  color: var(--ink-muted);
  font-weight: 400;
  font-family: var(--font-mono);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.borough-group-progress .mini-bar {
  width: 32px; height: 3px;
  background: rgba(50,45,30,0.1);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.borough-group-progress .mini-bar > span {
  position: absolute; inset: 0; width: 0%;
  background: var(--ale);
  border-radius: 2px;
  transition: width 0.45s cubic-bezier(.2,.7,.3,1);
}
.borough-group.complete .borough-group-progress .mini-bar > span { background: var(--hop); }

/* ---------- Pub list (sidebar) ---------- */
.pub-list {
  list-style: none; margin: 0; padding: 0;
}
.pub-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.6rem 0.1rem;
  border-bottom: 1px solid rgba(50,45,30,0.07);
  cursor: pointer;
  transition: background 0.12s, padding 0.15s;
}
.pub-item:last-child { border-bottom: 0; }
.pub-item:hover {
  background: rgba(255,255,255,0.55);
  padding-left: 0.35rem;
}
.pub-item:hover .pub-name { color: var(--ale-deep); }

.pub-tick {
  width: 20px; height: 20px;
  border: 1.5px solid var(--border-strong);
  background: rgba(255,255,255,0.4);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
  color: var(--paper);
}
.pub-tick:hover {
  border-color: var(--ale);
  background: rgba(184, 93, 36, 0.08);
  transform: scale(1.1);
}
.pub-tick svg { opacity: 0; transition: opacity 0.15s; }
.pub-item.ticked .pub-tick { background: var(--hop); border-color: var(--hop); color: var(--paper); transform: rotate(-6deg); }
.pub-item.ticked .pub-tick svg { opacity: 1; }

.pub-info { min-width: 0; }
.pub-name {
  display: block;
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--ink);
  transition: color 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pub-meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-muted);
  margin-top: 0.14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pub-item.ticked .pub-name {
  font-style: normal;
  color: var(--ink-muted);
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(122,43,43,0.45);
}
.pub-item.ticked:hover .pub-name { color: var(--ink-soft); }
.pub-item.ticked .pub-meta { color: var(--ink-faint); }
.pub-visit {
  position: relative;
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 0.2rem;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: -0.003em;
  color: var(--claret);
  cursor: pointer;
}
.pub-visit::before {
  content: "✓";
  font-style: normal;
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--claret);
  opacity: 0.85;
}
.pub-visit-text {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: -0.003em;
  color: var(--claret);
  font-variant-numeric: tabular-nums;
}
.pub-visit input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: transparent;
  pointer-events: none;
}
.pub-visit:hover .pub-visit-text { color: var(--ale-deep); }

/* Action icons appear on hover */
.pub-actions {
  display: flex; gap: 0.05rem; align-items: center;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
}
.pub-item:hover .pub-actions,
.pub-item:focus-within .pub-actions {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
@media (hover: none) {
  .pub-actions {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}
.iconbtn {
  width: 26px; height: 26px;
  border: 0;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-muted);
  text-decoration: none;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.iconbtn:hover {
  background: rgba(255,255,255,0.85);
  color: var(--ink);
  text-decoration: none;
}

.pub-item.flash { animation: flash 1.4s cubic-bezier(.2,.7,.3,1); }
@keyframes flash {
  0%   { background: var(--foam); }
  30%  { background: var(--foam); }
  100% { background: transparent; }
}

/* ---------- Empty state ---------- */
.sb-empty {
  padding: 2.4rem 0.5rem 1.5rem;
  text-align: center;
}
.sb-empty .empty-mark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.8rem;
  color: var(--ale);
  line-height: 1;
  opacity: 0.85;
}
.sb-empty h3 {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin: 0.5rem 0 0.3rem;
}
.sb-empty p {
  font-family: var(--font-body);
  font-size: 0.84rem;
  color: var(--ink-muted);
  margin: 0;
  max-width: 26ch;
  margin-inline: auto;
}

/* ---------- Sidebar footer ---------- */
.sb-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--border-soft);
  background: var(--paper);
  padding: 0.6rem 1.15rem;
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.74rem;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
}
.sb-foot .sb-quip { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-foot button {
  background: transparent;
  border: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
  transition: color 0.15s, background 0.15s;
}
.sb-foot button:hover { color: var(--claret); background: rgba(122,43,43,0.06); }

/* ---------- Mini cards (challenges tab in sidebar) ---------- */
.mini-section { padding: 0.5rem 0 0.6rem; }
.mini-head {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--ink-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.7rem 0.1rem 0.5rem;
}
.mini-head::before {
  content: ""; width: 1.5rem; height: 1px; background: var(--ale); flex-shrink: 0;
}
.mini-head .mini-head-italic {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: -0.005em;

  color: var(--ink);
  margin-left: 0.05em;
}

.mini-card {
  display: block;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(50,45,30,0.1);
  border-radius: 10px;
  margin-bottom: 0.4rem;
  overflow: hidden;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  color: var(--ink);
}
.mini-card:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(50,45,30,0.22);
  text-decoration: none;
  transform: translateY(-1px);
}
.mini-card.done {
  background: rgba(42, 108, 69, 0.06);
  border-color: rgba(42, 108, 69, 0.22);
}
.mini-card.done .mini-progress-fill { background: var(--hop); }

.mini-card-head {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.625rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.mini-card:not(.tube) {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}
.mini-stripe {
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
}
.mini-card-num {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  align-self: center;
}
.mini-card-main { min-width: 0; }
.mini-card-name {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.15;

}
.mini-card-count {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.mini-progress {
  width: 50px;
  height: 2px;
  background: rgba(50,45,30,0.1);
  border-radius: 1px;
  overflow: hidden;
  flex-shrink: 0;
}
.mini-progress-fill {
  height: 100%;
  background: var(--ale);
  transition: width 0.45s cubic-bezier(.2,.7,.3,1);
}
.mini-chevron {
  display: inline-flex;
  color: var(--ink-muted);
  transition: transform 0.2s;
}
.mini-card.open .mini-chevron { transform: rotate(180deg); }
.mini-card.open .mini-card-head { border-bottom: 1px solid rgba(50,45,30,0.1); }

.mini-stops {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}
.mini-stop {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 0.55rem;
  align-items: center;
  padding: 0.42rem 0.85rem;
  cursor: pointer;
}
.mini-stop:hover { background: rgba(0,0,0,0.03); }
.mini-stop.missing {
  grid-template-columns: 1fr auto;
  color: var(--ink-muted);
  cursor: default;
}
.mini-stop.missing:hover { background: transparent; }
.mini-stop .stop-tick {
  width: 13px; height: 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--paper);
}
.mini-stop .stop-tick svg { opacity: 0; }
.mini-stop.ticked .stop-tick { background: var(--hop); border-color: var(--hop); }
.mini-stop.ticked .stop-tick svg { opacity: 1; }
.mini-stop.ticked .stop-name { text-decoration: line-through; color: var(--ink-muted); }
.mini-stop .stop-main { display: flex; flex-direction: column; min-width: 0; }
.mini-stop .stop-name { font-size: 0.84rem; font-weight: 500; letter-spacing: -0.005em; color: var(--ink); }
.mini-stop .stop-pub { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.02em; color: var(--ink-muted); }
.mini-stop .stop-note { font-family: var(--font-display); font-style: italic; font-size: 0.8rem; color: var(--ink-muted); }

/* ---------- Sidebar toggle (when sidebar hidden) ---------- */
.sidebar-toggle {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  left: 12px;
  z-index: 20;
  height: 36px;
  padding: 0 0.95rem 0 0.7rem;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-radius: 8px;
  display: none;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.sidebar-toggle svg { color: var(--ale); flex-shrink: 0; }
.sidebar-toggle:hover {
  background: #ffffff;
  border-color: var(--border);
}
.sidebar-toggle-label { display: inline; }
.pubs-page[data-sidebar="hidden"] .sidebar-toggle {
  display: inline-flex;
  animation: sidebar-toggle-in 0.25s cubic-bezier(.2,.7,.3,1);
}
@keyframes sidebar-toggle-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Half-screen / medium widths — narrower rail */
@media (max-width: 1099px) {
  .pubs-page { --sidebar-w: 320px; }
  .sidebar { width: 320px; }
}

/* Narrow / mobile — sidebar becomes a bottom sheet so the map keeps the full width.
   Map shrinks from the bottom to make room when the sheet is open. */
@media (max-width: 720px) {
  .pubs-page { --sidebar-w: 0px; }
  #map { left: 0; bottom: 0; }
  /* Sidebar fills the entire viewport below the topbar — full-screen drawer */
  .sidebar {
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--topbar-h));
    max-width: none;
    border-right: 0;
    border-top: 0;
    border-radius: 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
    transform: translateY(0);
  }
  .pubs-page[data-sidebar="hidden"] .sidebar {
    transform: translateY(calc(100% + 12px));
    pointer-events: none;
  }
  /* Beefier close target (X-shaped chevron when rotated) on mobile */
  .sb-collapse {
    width: 36px; height: 36px;
    background: var(--fill);
    border-radius: 50%;
  }
  .sb-collapse svg { transform: rotate(-90deg); }

  /* Floating "Show list" pill at the bottom of the map */
  .sidebar-toggle {
    top: auto;
    bottom: 18px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    height: 46px;
    padding: 0 1.4rem;
    border-radius: var(--radius-pill);
    font-size: 0.92rem;
    font-weight: 600;
    background: var(--ale);
    color: #ffffff;
    border-color: var(--ale-deep);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  }
  .sidebar-toggle:hover {
    transform: translateX(-50%);
    background: var(--ale-deep);
    color: #ffffff;
    border-color: var(--ale-deep);
  }
  .sidebar-toggle svg { color: #ffffff; }
  /* On mobile we keep the same stack: zoom + compass + geolocate + voronoi */
  .map-tool-btn { top: calc(var(--topbar-h) + 150px); right: 10px; }
  /* When the full-screen drawer is open, hide every map-only chrome that
     would otherwise float above it (Voronoi button, borough/line cards). */
  .pubs-page:not([data-sidebar="hidden"]) .map-tool-btn,
  .pubs-page:not([data-sidebar="hidden"]) .map-card-stack {
    display: none;
  }
}

/* ---------- Map popup ---------- */
.maplibregl-popup { font-family: var(--font-body); }
.maplibregl-popup-content {
  border: 1px solid var(--border-soft) !important;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, 0.97) !important;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-pop) !important;
  padding: 1rem 1.1rem !important;
  min-width: 260px;
  max-width: 320px;
  color: var(--ink);
}
.maplibregl-popup-tip { display: none !important; }
.maplibregl-popup-close-button {
  font-size: 1.25rem !important;
  right: 6px !important;
  top: 4px !important;
  color: var(--ink-muted) !important;
}
.popup-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.2;
  margin-right: 1rem;
  margin-bottom: 0.2rem;
  color: var(--ink);
}
.popup-meta {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  margin-bottom: 0.65rem;
}
.popup-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.55rem;
  margin: 0 0 0.2rem;
}
.popup-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: -0.003em;
  padding: 0.42rem 0.95rem;
  background: var(--ale);
  color: #ffffff;
  border: 0;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: background 0.15s;
}
.popup-btn:hover { background: var(--ale-deep); color: #ffffff; }
.popup-btn.ticked { background: var(--hop); }
.popup-btn.ticked:hover { background: var(--hop-bright); }
.popup-meta-visit {
  position: relative;
  display: inline-flex; align-items: center;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: -0.003em;
  color: var(--claret);
  cursor: pointer;
  padding: 0.18rem 0.45rem;
  background: var(--fill);
  border-radius: 6px;
}
.popup-meta-visit-text { font-variant-numeric: tabular-nums; }
.popup-meta-visit input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: transparent;
  pointer-events: none;
}
.popup-meta-visit:hover { background: var(--border-soft); }
.popup-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 0.85rem;
  margin: 0.85rem 0 0;
  padding: 0.7rem 0 0;
  border-top: 1px solid var(--border-soft);
  font-size: 0.78rem;
  letter-spacing: -0.003em;
}
.popup-facts dt {
  color: var(--ink-muted);
  font-weight: 500;
}
.popup-facts dd {
  color: var(--ink-soft);
  margin: 0;
  word-break: break-word;
}
.popup-facts dd a { color: var(--ale); }
.popup-facts dd a:hover { color: var(--ale-deep); }
.popup-icons {
  display: flex; gap: 0.35rem;
  margin: 0.85rem -0.15rem 0;
  flex-wrap: wrap;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border-soft);
}
.popup-iconbtn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: -0.003em;
  color: var(--ink);
  background: var(--fill);
  padding: 0.36rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.popup-iconbtn:hover { background: var(--border-soft); color: var(--ink); text-decoration: none; }

/* ---------- Sidebar notice card ---------- */
.sb-notice {
  display: flex; align-items: flex-start; gap: 0.5rem;
  margin-top: 0.85rem;
  padding: 0.55rem 0.7rem;
  background: var(--fill);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink-muted);
  letter-spacing: -0.003em;
}
.sb-notice svg { flex-shrink: 0; margin-top: 0.18rem; color: var(--ink-faint); }

/* ---------- Borough colour dot ---------- */
.borough-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* ---------- Sidebar foot links ---------- */
.sb-foot { justify-content: space-between; }
.sb-foot a { color: var(--ink-muted); text-decoration: none; }
.sb-foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.sb-foot-link { font-size: 0.72rem; flex-shrink: 0; }
.sb-foot-links { display: inline-flex; gap: 0.85rem; flex-shrink: 0; }

/* ---------- Section tabs (used on the Boroughs page) ---------- */
.section-tabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 1.5rem;
}
.section-tab {
  position: relative;
  background: transparent;
  border: 0;
  padding: 0.65rem 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.15s;
}
.section-tab:hover { color: var(--ink); }
.section-tab.active { color: var(--ink); font-weight: 600; }
.section-tab.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--ale);
  border-radius: 2px 2px 0 0;
}
.section-panel[hidden] { display: none; }

/* ---------- Map toast (transient status messages) ---------- */
.map-toast {
  position: fixed;
  top: calc(var(--topbar-h) + 14px);
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 13;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.12);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-toast[hidden] { display: none !important; }
.map-toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.map-toast svg { color: var(--ale); flex-shrink: 0; }
:root.dark .map-toast {
  background: rgba(28, 28, 30, 0.96);
  border-color: var(--border-soft);
  color: var(--ink);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}
@media (max-width: 720px) {
  /* Hide the toast when the full-screen drawer is up — it'd float above it */
  .pubs-page:not([data-sidebar="hidden"]) .map-toast { display: none !important; }
}

/* ---------- Map tool buttons (Voronoi toggle, etc.) ---------- */
.map-tool-btn {
  /* Stack: 10 inset + 58 zoom + 8 + 29 compass + 8 + 29 geolocate + 8 gap = 150px */
  position: fixed;
  top: calc(var(--topbar-h) + 150px);
  right: 10px;
  z-index: 11;
  width: 29px; height: 29px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  transition: background 0.15s, color 0.15s;
}
.map-tool-btn:hover { background: #ffffff; }
.map-tool-btn.active { background: var(--ale); color: #ffffff; box-shadow: 0 0 0 2px var(--ale-deep); }
:root.dark .map-tool-btn { background: rgba(28, 28, 30, 0.94); color: var(--ink); box-shadow: 0 0 0 2px rgba(255,255,255,0.12); }
:root.dark .map-tool-btn:hover { background: rgba(40, 40, 42, 1); }
:root.dark .map-tool-btn.active { background: var(--ale); color: #ffffff; box-shadow: 0 0 0 2px var(--ale-deep); }
@media (max-width: 720px) {
  .map-tool-btn { top: calc(var(--topbar-h) + 96px); right: 10px; }
}

/* ---------- Floating selected-context cards (borough + tube line) ---------- */
.map-card-stack {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  right: 64px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}
.map-card {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem 0.55rem 0.8rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255,255,255,0.6) inset;
  font-family: var(--font-body);
  color: var(--ink);
  max-width: 280px;
}
.map-card[hidden] { display: none; }
.map-line-stripe {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  flex-shrink: 0;
}
.map-borough-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ale);
}
.map-borough-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.map-borough-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.014em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-borough-count {
  font-family: var(--font-body);
  font-size: 0.74rem;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 0.05rem;
}
.map-borough-card.done .map-borough-count { color: var(--hop); }

/* Stop showing the legacy fixed positioning on the inner cards */
.map-borough-card { position: relative; top: auto; right: auto; }
.map-borough-clear {
  width: 24px; height: 24px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.map-borough-clear:hover { background: rgba(0,0,0,0.05); color: var(--ink); }

@media (max-width: 720px) {
  .map-borough-card {
    right: 12px;
    max-width: calc(100vw - 24px);
  }
}

/* Add a clear gap between MapLibre's stacked nav-control groups */
.maplibregl-ctrl-top-right .maplibregl-ctrl-group + .maplibregl-ctrl-group {
  margin-top: 8px !important;
}

/* ---------- Stats page: bars + recent list ---------- */
.bars { display: flex; flex-direction: column; gap: 0.45rem; }
.bar-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 2.6rem;
  gap: 0.7rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--ink-soft);
  letter-spacing: -0.003em;
}
.bar-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  position: relative;
  height: 8px;
  background: var(--fill);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  position: absolute; inset: 0; right: auto;
  width: 0%;
  background: linear-gradient(90deg, var(--ale), var(--ale-bright));
  border-radius: 4px;
  transition: width 0.45s cubic-bezier(.2,.7,.3,1);
}
.bar-count {
  text-align: right;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.recent-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex; flex-direction: column;
}
.recent-list li {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  gap: 0.85rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border-soft);
  font-size: 0.92rem;
  letter-spacing: -0.003em;
}
.recent-list li:first-child { border-top: 0; padding-top: 0; }
.recent-date { font-family: var(--font-body); font-size: 0.78rem; font-weight: 400; letter-spacing: -0.003em; color: var(--ink-muted); }
.recent-name { color: var(--ink); font-weight: 500; }
.recent-borough { color: var(--ink-muted); font-size: 0.82rem; }

@media (max-width: 740px) {
  #content, #content-2,
  #stats-content, #stats-content-2,
  .stats-grid { grid-template-columns: 1fr !important; }
  .stats-grid .span-2 { grid-column: auto; }
  .bar-row { grid-template-columns: 4.5rem 1fr 2.4rem; }
  .recent-list li { grid-template-columns: 6rem 1fr; }
  .recent-list li .recent-borough { grid-column: 2; font-size: 0.78rem; }
  .highlights { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Stats page chrome: sort dropdown, card head, vbars, highlights ---------- */
.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select-input {
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 0.5rem 2.1rem 0.5rem 0.9rem;
  border: 1px solid var(--border-soft);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.select-input:hover { border-color: var(--border); }
.select-input:focus { border-color: var(--ale); box-shadow: 0 0 0 3px rgba(184, 93, 36, 0.14); }
.select-chevron {
  position: absolute;
  right: 0.7rem;
  pointer-events: none;
  color: var(--ink-muted);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.card-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.014em;
  color: var(--ink);
}
.card-meta {
  font-family: var(--font-body);
  font-size: 0.74rem;
  color: var(--ink-muted);
  letter-spacing: -0.003em;
  font-variant-numeric: tabular-nums;
}

/* Stats page grid — single grid for even spacing across all cards */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.stats-grid .span-2 { grid-column: 1 / -1; }

/* Vertical bar charts */
.chart-vbars {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  height: 160px;
}
.vbar {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.vbar-track {
  flex: 1;
  display: flex;
  align-items: flex-end;
  position: relative;
  padding-top: 1.1rem;
}
.vbar-fill {
  width: 100%;
  background: var(--ale);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.5s cubic-bezier(.2,.7,.3,1);
}
.vbar.empty .vbar-fill {
  background: var(--border-soft);
  min-height: 1px;
  opacity: 0.55;
}
.vbar-count {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  color: var(--ink-muted);
  margin-bottom: 0.25rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.vbar-label {
  margin-top: 0.5rem;
  font-size: 0.66rem;
  color: var(--ink-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.003em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Highlights tile grid */
.highlights {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}
.hl {
  padding: 0.7rem 0.8rem;
  background: var(--fill);
  border-radius: 8px;
}
.hl-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: -0.003em;
}
.hl-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.014em;
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}

/* Borough card head with colour dot */
.borough-card .b-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.1rem;
}
.borough-card .b-head .borough-dot {
  width: 10px;
  height: 10px;
}

/* ---------- Diary tab (sidebar): chronological visited list with stars ---------- */
.diary-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.diary-item {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.7rem;
  padding: 0.65rem 0.1rem;
  border-bottom: 1px solid rgba(50, 45, 30, 0.06);
  cursor: pointer;
  transition: background 0.12s, padding 0.15s;
}
.diary-item:hover { background: rgba(255, 255, 255, 0.55); padding-left: 0.35rem; }
.diary-item:last-child { border-bottom: 0; }
.diary-date {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.2rem;
}
.diary-info { display: flex; flex-direction: column; min-width: 0; }
.diary-head { display: flex; align-items: center; gap: 0.45rem; }
.diary-head .borough-dot { width: 8px; height: 8px; }
.diary-name {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: -0.005em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diary-meta {
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: -0.003em;
  color: var(--ink-muted);
  margin-top: 0.12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.diary-stars {
  display: inline-flex;
  gap: 0;
  margin-top: 0.25rem;
}

/* ---------- Star rating buttons ---------- */
.star {
  width: 18px; height: 18px;
  background: transparent;
  border: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0;
  transition: color 0.12s, transform 0.12s;
}
.star.active { color: var(--ale); }
.star.hover-on { color: var(--ale-bright); }
.star:hover { transform: scale(1.12); }
/* When previewing a hover, dim the existing rating so the preview reads cleanly */
.diary-stars.is-previewing .star.active:not(.hover-on),
.popup-stars.is-previewing .star.active:not(.hover-on) {
  color: var(--ink-faint);
}

.popup-stars {
  display: inline-flex;
  gap: 0;
  margin: 0.45rem 0 0;
}
.popup-stars .star { width: 22px; height: 22px; font-size: 18px; }

/* Diary filter — star rating chips */
.diary-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.4rem 0 0.65rem;
}
.diary-filter-btn {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: -0.003em;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-soft);
  background: var(--paper);
  color: var(--ink-muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.diary-filter-btn:hover { color: var(--ink); border-color: var(--border); }
.diary-filter-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Diary month headers */
.diary-month-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1rem 0 0.45rem;
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.014em;
  color: var(--ink);
  border-bottom: 1px solid var(--border-soft);
  cursor: default;
}
.diary-month-head:first-child { padding-top: 0.4rem; margin-top: 0; }
.diary-month-head:hover { background: transparent; padding-left: 0; }
.diary-month-count {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* ---------- Prose / about ---------- */
.prose { max-width: 64ch; }
.prose a { font-weight: 600; }
.prose p {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  margin: 0 0 1.15rem;
  font-weight: 400;
}
.prose p strong { font-weight: 600; color: var(--ink); }
.prose p em {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink);
  font-size: 1em;
}
.prose h2 {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.2;
  margin: 2.5rem 0 0.75rem;
  color: var(--ink);
}
.prose h2::before { content: ""; display: none; }

.pullquote {
  position: relative;
  font-family: var(--font-display);
  font-style: normal;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.015em;
  color: var(--ink);
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--ink);
  margin: 2rem 0;
}
.pullquote em { font-style: normal; color: var(--ale); font-weight: 600; }
.pullquote::before { content: ""; display: none; }

.credit {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-soft);
  margin-top: 2.5rem;
}

/* ---------- Side card ---------- */
.side-card {
  background: var(--paper);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.side-card.accent { background: var(--paper); border-color: var(--border-soft); }
.side-card .side-label {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-muted);
}
.side-card ol {
  font-family: var(--font-body);
  font-size: 0.96rem;
  line-height: 1.7;
  padding-left: 1.6rem;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  counter-reset: m;
  list-style: none;
}
.side-card ol li {
  position: relative;
  padding-left: 0.4rem;
  margin-bottom: 0.15rem;
  counter-increment: m;
}
.side-card ol li::before {
  content: counter(m, decimal-leading-zero);
  position: absolute;
  left: -1.8rem;
  top: 0.1rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--ale);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.side-card .live-stat {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 400;
  letter-spacing: -0.018em;
  line-height: 1;
  color: var(--ink);
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.5rem;
  margin-top: 4rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0;
  color: var(--ink-muted);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}
.footer a { color: var(--ink-soft); text-decoration: none; }
.footer a:hover { color: var(--ink); text-decoration: underline; }
.footer .footer-right { display: flex; gap: 1.25rem; }

/* ---------- Reveal animations ---------- */
.reveal { opacity: 0; transform: translateY(8px); animation: reveal 0.65s cubic-bezier(.2,.7,.3,1) forwards; }
.reveal-1 { animation-delay: 0.04s; }
.reveal-2 { animation-delay: 0.14s; }
.reveal-3 { animation-delay: 0.24s; }
.reveal-4 { animation-delay: 0.34s; }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; border: 2px solid transparent; }
.sb-scroll::-webkit-scrollbar { width: 8px; }
.sb-scroll::-webkit-scrollbar-thumb { background: rgba(50,45,30,0.18); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.sb-scroll::-webkit-scrollbar-thumb:hover { background: rgba(50,45,30,0.32); background-clip: padding-box; border: 2px solid transparent; }

/* ============================================================
   DARK MODE — applied via .dark class on <html> (theme.js sets this on
   load based on localStorage or OS preference; the topbar toggle flips it).
   ============================================================ */
:root.dark {
    --paper:        #1c1c1e;
    --bg:           #000000;
    --paper-deep:   #2c2c2e;
    --paper-shade:  #0a0a0c;
    --ink:          #f5f5f7;
    --ink-soft:     #d1d1d6;
    --ink-muted:    #8e8e93;
    --ink-faint:    #48484a;
    --border:       #38383a;
    --border-soft:  #2c2c2e;
    --border-strong:#86868b;
    --fill:         #2c2c2e;
    --foam:         rgba(110, 44, 51, 0.18);
    --shadow-card:  0 1px 0 rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.4);
    --shadow-pop:   0 8px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3);
}
:root.dark {
  background: var(--bg); color: var(--ink);
}
:root.dark body { background: var(--bg); color: var(--ink); }

:root.dark ::selection { background: rgba(184, 93, 36, 0.35); color: var(--ink); }

:root.dark .topbar { background: rgba(28, 28, 30, 0.7); border-bottom-color: var(--border-soft); }
:root.dark .nav a:hover { background: rgba(255, 255, 255, 0.06); }
:root.dark .nav-count { background: var(--fill); }

:root.dark .sidebar {
  background: rgba(28, 28, 30, 0.78);
  border-right-color: var(--border-soft);
  box-shadow: 4px 0 24px rgba(0,0,0,0.45);
}
:root.dark .borough-group-head {
  background: rgba(28, 28, 30, 0.96);
  border-bottom-color: var(--border-soft);
}
:root.dark .pub-item { border-bottom-color: rgba(255,255,255,0.05); }
:root.dark .pub-item:hover { background: rgba(255,255,255,0.04); }
:root.dark .pub-item:hover .pub-name { color: var(--ale-bright); }
:root.dark .pub-tick { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.18); }

:root.dark .iconbtn:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }

:root.dark .sb-search input[type="search"] {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}
:root.dark .sb-search input[type="search"]:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(184, 93, 36, 0.55);
  box-shadow: 0 0 0 3px rgba(184, 93, 36, 0.18);
}
:root.dark .sb-borough-select {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}
:root.dark .sb-borough-select:hover { background: rgba(255, 255, 255, 0.09); }

:root.dark .sb-seg { background: rgba(255, 255, 255, 0.06); }
:root.dark .sb-seg button.active {
  background: rgba(255, 255, 255, 0.16);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

:root.dark .sb-iconbtn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}
:root.dark .sb-collapse:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

:root.dark .sb-menu {
  background: rgba(40, 40, 42, 0.97);
  border-color: var(--border-soft);
}
:root.dark .sb-menu .menu-item:hover { background: rgba(255, 255, 255, 0.06); }
:root.dark .sb-menu .menu-divider { background: var(--border-soft); }

:root.dark .sb-foot { background: rgba(20, 20, 22, 0.7); border-top-color: var(--border-soft); }
:root.dark .sb-notice { background: rgba(255, 255, 255, 0.05); }

:root.dark .borough-card,
:root.dark .tube-card,
:root.dark .side-card {
  background: var(--paper);
  border-color: var(--border-soft);
}
:root.dark .borough-card:hover,
:root.dark .tube-card:hover {
  border-color: var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}
:root.dark .borough-card.done,
:root.dark .tube-card.done {
  background: var(--paper);
  border-color: var(--border-soft);
}
:root.dark .b-progress,
:root.dark .tube-progress,
:root.dark .mini-progress { background: rgba(255,255,255,0.08); }

:root.dark .sidebar-toggle {
  background: rgba(28, 28, 30, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}
:root.dark .sidebar-toggle:hover { background: rgba(40, 40, 42, 1); }

:root.dark .maplibregl-popup-content {
  background: rgba(28, 28, 30, 0.97) !important;
  border-color: var(--border-soft) !important;
  color: var(--ink);
}
:root.dark .maplibregl-popup-tip { display: none !important; }
:root.dark .popup-iconbtn { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
:root.dark .popup-iconbtn:hover { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
:root.dark .popup-facts { border-top-color: var(--border-soft); }
:root.dark .popup-icons { border-top-color: var(--border-soft); }

:root.dark .stamp-complete { background: rgba(31, 110, 67, 0.22); color: #4ec98e; }
:root.dark .stamp.claret  { background: rgba(184, 93, 36, 0.18); color: #d4806e; }
:root.dark .stamp.hop     { background: rgba(31, 110, 67, 0.2);  color: #4ec98e; }

:root.dark .maplibregl-ctrl-group { background: rgba(28,28,30,0.92) !important; border: 1px solid var(--border-soft) !important; }
:root.dark .maplibregl-ctrl-group button { background-color: transparent !important; }
:root.dark .maplibregl-ctrl-attrib { background: rgba(28,28,30,0.7) !important; color: var(--ink-muted) !important; }
:root.dark .maplibregl-ctrl-attrib a { color: var(--ink-soft) !important; }

:root.dark .footer { border-top-color: var(--border-soft); }

/* Dark map: invert + hue-rotate the basemap canvas. Pub circles & line layers
   are rendered onto the same canvas so they invert too — accent colours read
   as their complements but stay clearly distinguishable. */
:root.dark #map .maplibregl-canvas {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) saturate(0.85);
}

/* Dark mode: lift muted text + restore tab visibility */
:root.dark { --ink-muted: #b3b3b8; --ink-faint: #6e6e74; }
:root.dark .sb-tabs { border-bottom-color: var(--border-soft); }
:root.dark .sb-tab { color: var(--ink-muted); }
:root.dark .sb-tab:hover { color: var(--ink); }
:root.dark .sb-tab.active { color: var(--ink); }
:root.dark .sb-tab.active::after { background: var(--ale-bright); }
:root.dark .section-tabs { border-bottom-color: var(--border-soft); }
:root.dark .section-tab.active::after { background: var(--ale-bright); }
:root.dark .pub-meta,
:root.dark .recent-borough,
:root.dark .diary-meta,
:root.dark .diary-date,
:root.dark .vbar-label,
:root.dark .card-meta,
:root.dark .stat-label,
:root.dark .borough-card .b-count { color: var(--ink-muted); }
:root.dark .map-card { background: rgba(28, 28, 30, 0.96); border-color: var(--border-soft); color: var(--ink); }
:root.dark .map-borough-clear:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
:root.dark .theme-toggle { color: var(--ink-muted); }
:root.dark .theme-toggle:hover { background: var(--fill); color: var(--ink); border-color: var(--border-soft); }
:root.dark .diary-filter-btn { background: transparent; border-color: var(--border-soft); color: var(--ink-muted); }
:root.dark .diary-filter-btn:hover { color: var(--ink); border-color: var(--border); }
:root.dark .diary-filter-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
:root.dark .select-input { background: var(--paper); border-color: var(--border-soft); color: var(--ink); }
:root.dark .select-input:hover { border-color: var(--border); }
:root.dark .hl { background: var(--fill); }
:root.dark .bar-track { background: var(--fill); }
:root.dark .vbar.empty .vbar-fill { background: var(--border-soft); }
:root.dark .recent-list li { border-top-color: var(--border-soft); }
:root.dark .pub-list .pub-item { border-bottom-color: var(--border-soft); }
:root.dark .diary-month-head { color: var(--ink); border-bottom-color: var(--border-soft); }
:root.dark .diary-item { border-bottom-color: var(--border-soft); }
:root.dark .borough-group-head { color: var(--ink); }

/* Dark-mode: sidebar Boroughs / Tube mini-cards */
:root.dark .mini-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-soft);
  color: var(--ink);
}
:root.dark .mini-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
}
:root.dark .mini-card.done {
  background: rgba(31, 110, 67, 0.14);
  border-color: rgba(31, 110, 67, 0.32);
}
:root.dark .mini-card.open .mini-card-head { border-bottom-color: var(--border-soft); }
:root.dark .mini-card-name { color: var(--ink); }
:root.dark .mini-card-count { color: var(--ink-muted); }
:root.dark .mini-card-num { color: var(--ink-faint); }
:root.dark .mini-progress { background: rgba(255, 255, 255, 0.08); }
:root.dark .mini-stop:hover { background: rgba(255, 255, 255, 0.05); }
:root.dark .mini-stop .stop-tick { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.22); color: var(--paper); }
:root.dark .mini-stop.ticked .stop-tick { background: var(--hop); border-color: var(--hop); }
:root.dark .mini-stop .stop-name { color: var(--ink); }
:root.dark .mini-stop .stop-pub { color: var(--ink-muted); }
:root.dark .mini-stop .stop-note { color: var(--ink-muted); }
:root.dark .mini-stop.ticked .stop-name { color: var(--ink-muted); }
:root.dark .mini-head { color: var(--ink-muted); }
:root.dark .mini-head .mini-head-italic { color: var(--ink); }

:root.dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
:root.dark ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); }
:root.dark .sb-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
:root.dark .sb-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.24); }

/* ---------- Help page: feature grid ---------- */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.help-card {
  padding: 1.4rem 1.4rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.help-card:hover {
  border-color: var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--foam);
  color: var(--ale);
  margin-bottom: 0.75rem;
}
.help-icon svg { width: 18px; height: 18px; }
.help-card h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.014em;
  margin: 0 0 0.45rem;
  color: var(--ink);
}
.help-card p {
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.55;
  letter-spacing: -0.003em;
  color: var(--ink-soft);
  margin: 0;
}
.help-card a { color: var(--ale); font-weight: 500; }
.help-card a:hover { color: var(--ale-deep); }

.prose-list {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink-soft);
  padding-left: 1.4rem;
  margin: 1rem 0;
}
.prose-list li { margin-bottom: 0.5rem; }

:root.dark .help-card { background: var(--paper); border-color: var(--border-soft); }
:root.dark .help-card:hover { border-color: var(--border); box-shadow: 0 4px 16px rgba(0,0,0,0.35); }
:root.dark .help-icon { background: rgba(168, 122, 20, 0.18); color: var(--ale-bright); }

/* ---------- Theme toggle button (in topbar nav) ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  margin: 0 0.15rem 0 0.4rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  background: var(--fill);
  color: var(--ink);
  border-color: var(--border-soft);
}
.theme-toggle .sun  { display: none; }
.theme-toggle .moon { display: inline-block; }
:root.dark .theme-toggle .sun  { display: inline-block; }
:root.dark .theme-toggle .moon { display: none; }
