/* Yinzer Town Square — Halloween Check (beta). Black and gold brand; Halloween pieces lean spooky. */
:root {
  --bg: #0f0e0c; --panel: #171512; --panel-2: #1f1c17; --line: #2e2a22; --line-2: #3b352a;
  --fg: #f3eee2; --muted: #a69f8f; --gold: #ffb612; --gold-2: #ffce31; --gold-ink: #1a1400;
  --gold-soft: rgba(255, 182, 18, 0.14); --good: #4cbf6b; --warn: #e8a33d; --bad: #e0634f;
  --pumpkin: #f26b1d; --purple: #7b4bd6; --focus: #ffd56a;
  --display: "Zilla Slab", "Rockwell", Georgia, serif; --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace; --spooky: "Creepster", "Zilla Slab", serif;
  --strip-h: 34px; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: var(--body); font-size: 16px; line-height: 1.5; padding-bottom: calc(var(--strip-h) + 92px + env(safe-area-inset-bottom, 0px)); }
a { color: var(--gold); }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }
.inner { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.tabular { font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

/* Header */
header.site { position: sticky; top: 0; z-index: 50; background: #0f0e0c; border-bottom: 1px solid var(--line); }
header.site .inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 10px; padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--fg); min-width: 0; }
.brand img { border-radius: 50%; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--fg); text-decoration: none; font-weight: 500; font-size: 14px; padding: 7px 12px; border-radius: 10px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; }
.nav a svg { width: 18px; height: 18px; fill: var(--gold); flex: none; }
.nav a:hover { background: var(--panel-2); border-color: var(--line-2); }
.nav a[aria-current="page"] { background: var(--gold); color: var(--gold-ink); font-weight: 600; box-shadow: 0 0 0 3px rgba(255,182,18,.18); }
.nav a[aria-current="page"] svg { fill: var(--gold-ink); }
.nav .nav-btn { background: transparent; color: var(--fg); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 12px; font-size: 14px; font-weight: 500; cursor: pointer; }
.nav .nav-btn:hover { border-color: var(--gold); }
.toast { position: fixed; left: 50%; bottom: calc(var(--strip-h) + 16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--gold); color: var(--gold-ink); font-weight: 600; padding: 10px 16px; border-radius: 999px; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.share-row .btn { font-size: 13.5px; }
.ribbon { position: absolute; top: 14px; right: -34px; transform: rotate(35deg); background: var(--pumpkin); color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.2em; padding: 3px 44px; pointer-events: none; }
@media (max-width: 720px) {
  header.site .inner { flex-direction: column; align-items: stretch; gap: 8px; }
  .nav { justify-content: flex-start; }
  .nav a { padding: 6px 10px; font-size: 14px; }
  .ribbon { top: 8px; right: -40px; font-size: 10px; }
}


/* Sections */
section.block { margin-top: 32px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 720px) { .grid.cols-2 { grid-template-columns: 1fr; } }

/* Hero (spooky) */
.hero { margin-top: 20px; position: relative; overflow: hidden; border-radius: 16px; border: 1px solid var(--line-2);
  background: radial-gradient(1200px 400px at 20% -20%, rgba(123, 75, 214, 0.35), transparent 60%), radial-gradient(800px 300px at 90% 120%, rgba(242, 107, 29, 0.32), transparent 60%), linear-gradient(180deg, #14110e, #0f0e0c); padding: 28px 24px; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.hero h1 { font-family: var(--spooky); font-weight: 400; font-size: clamp(34px, 6vw, 60px); letter-spacing: 0.02em; color: var(--pumpkin); text-shadow: 0 2px 0 #4a1a05; }
.hero .sub { margin-top: 8px; max-width: 62ch; color: var(--fg); }
.hero .count { text-align: center; background: rgba(0,0,0,0.35); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 22px; min-width: 150px; }
.hero .count .n { font-family: var(--spooky); font-size: 56px; line-height: 1; color: var(--gold-2); }
.hero .count .l { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hero .moon { position: absolute; right: 190px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff7d6, #e3d7ad 60%, #b9ad86); opacity: .12; pointer-events: none; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero .moon { display: none; } }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .v { font-family: var(--display); font-size: 26px; font-weight: 700; }
.stat .k { font-size: 13.5px; color: var(--muted); }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } }

/* Search & controls */
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; }
.search input { flex: 1; background: transparent; border: 0; color: var(--fg); font: inherit; font-size: 16px; min-width: 0; outline: none; }
.search input::placeholder { color: var(--muted); }
select.sel, .btn { background: var(--panel); color: var(--fg); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.btn:hover, select.sel:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--fg); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }

/* Municipality cards */
.munis { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 14px; }
.muni { display: block; text-decoration: none; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; transition: border-color .15s, transform .15s; min-width: 0; }
.muni:hover { border-color: var(--gold); }
.muni .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.muni .name { font-family: var(--display); font-size: 19px; font-weight: 700; }
.muni .type { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.muni .homes { margin-top: 6px; font-size: 14px; }
.muni .homes b { color: var(--gold-2); font-size: 18px; }
.muni .tot { margin-top: 8px; font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muni .tot .t { color: var(--fg); font-family: var(--body); font-variant-numeric: tabular-nums; font-size: 14.5px; font-weight: 500; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: 2px 8px; border: 1px solid transparent; white-space: nowrap; }
.tag.good { color: var(--good); border-color: var(--good); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.bad { color: var(--bad); border-color: var(--bad); }
.tag.gold { background: var(--gold); color: var(--gold-ink); }
.tag.dim { color: var(--muted); border-color: var(--line-2); }
.tag.purple { color: #c9b3ff; border-color: var(--purple); }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line-2); border-radius: 12px; }

/* Search results */
.results { display: grid; gap: 8px; margin-top: 12px; }
.res { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; text-decoration: none; color: var(--fg); }
.res:hover { border-color: var(--gold); }
.res .a { font-weight: 600; }
.res .m { font-size: 13px; color: var(--muted); }

/* Municipality page */
.page-head { margin-top: 20px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.back { font-size: 14px; }
.tot-card { border-left: 4px solid var(--pumpkin); }
.tot-card .time { font-family: var(--display); font-weight: 700; font-size: 38px; color: var(--gold-2); line-height: 1.05; }
.tot-card .date { font-family: var(--body); font-variant-numeric: tabular-nums; font-size: 15px; color: var(--muted); margin-top: 6px; }
.tot-card .note { margin-top: 8px; font-size: 14px; color: var(--muted); }
.buildings { display: grid; gap: 10px; }
.bld { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bld .bh { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel-2); }
.bld .bh .nm { font-family: var(--display); font-size: 18px; font-weight: 700; }
.bld .bh .cnt { font-family: var(--body); font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.unit { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 10px 16px; border-top: 1px solid var(--line); align-items: start; }
.unit .u { font-weight: 500; }
.unit .sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.unit .sub .w { display: block; }
.unit .side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.unit .src { font-size: 13.5px; white-space: nowrap; }
@media (max-width: 560px) { .unit { grid-template-columns: 1fr; } .unit .side { justify-content: flex-start; } }
.works { display: grid; gap: 6px; }
.work { display: flex; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-size: 15px; }
.work .c { color: var(--muted); font-family: var(--body); font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; }
.minimap { height: 280px; border-radius: 12px; border: 1px solid var(--line-2); overflow: hidden; }

/* Map page */
.mapwrap { margin-top: 16px; height: 520px; height: min(640px, 70svh); border-radius: 14px; border: 1px solid var(--line-2); overflow: hidden; }
.leaflet-container, .leaflet-container * { -webkit-tap-highlight-color: transparent; }
.map-hint { position: absolute; inset: auto 0 0 0; text-align: center; font-size: 12px; color: var(--muted); background: rgba(15,14,12,.75); padding: 4px; pointer-events: none; z-index: 400; }
.maprel { position: relative; height: 100%; }
/* List page */
.area { margin-top: 22px; }
.area-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; border-bottom: 2px solid var(--gold); padding-bottom: 6px; margin-bottom: 8px; }
.area-head h2 { font-size: 22px; }
.area-head .meta { font-size: 13.5px; color: var(--muted); }
.addr-list { display: grid; gap: 4px; }
.addr { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); text-decoration: none; color: var(--fg); }
.addr:hover { border-color: var(--gold); }
.addr .a { font-weight: 500; }
.addr .a small { color: var(--muted); font-weight: 400; }
.addr .n { font-family: var(--body); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); white-space: nowrap; }
.addr .n.multi { color: var(--pumpkin); font-weight: 600; }

.leaflet-container { background: #0b0a09; font-family: var(--body); }
.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(0.8) contrast(0.9) saturate(0.4); }
.leaflet-popup-content-wrapper { background: var(--panel); color: var(--fg); border: 1px solid var(--line-2); border-radius: 10px; }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.4; }
.leaflet-popup-content b { font-family: var(--display); font-size: 16px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a { background: var(--panel); color: var(--fg); border-bottom-color: var(--line-2); }
.leaflet-control-attribution { background: rgba(15,14,12,.8) !important; color: var(--muted) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--gold) !important; }
.map-note { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; min-width: 640px; background: var(--panel); }
th, td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-top: 0; background: var(--panel-2); cursor: pointer; user-select: none; white-space: nowrap; }
th[aria-sort="ascending"]::after { content: " ▲"; color: var(--gold); }
th[aria-sort="descending"]::after { content: " ▼"; color: var(--gold); }
tr.tonight td { background: rgba(242, 107, 29, 0.08); }
td.name { font-weight: 600; white-space: nowrap; }
td .note { color: var(--muted); font-size: 13.5px; }
td.time { font-family: var(--body); font-variant-numeric: tabular-nums; white-space: nowrap; }
td.name a { color: var(--fg); text-decoration: none; border-bottom: 1px dotted var(--line-2); }
td.name a:hover { color: var(--gold); }

/* About */
.prose { max-width: 70ch; display: grid; gap: 12px; }
.prose h2 { margin-top: 12px; }
.prose ul { margin: 0; padding-left: 20px; }
.notice { border-left: 4px solid var(--bad); background: rgba(224,99,79,.08); padding: 12px 16px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Legal strip (thin, tap to expand) */
.legal-strip { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #14120f; border-top: 1px solid var(--line-2); padding-bottom: env(safe-area-inset-bottom, 0px); }
.legal-toggle { width: 100%; display: flex; align-items: center; gap: 10px; background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 12.5px; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); min-height: var(--strip-h); cursor: pointer; text-align: left; }
.legal-toggle .info { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--gold); color: var(--gold); font-family: var(--display); font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.legal-toggle .short { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legal-toggle .chev { flex: none; color: var(--muted); transition: transform .2s; }
.legal-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.legal-body { padding: 4px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); font-size: 13.5px; color: var(--fg); display: grid; gap: 8px; max-width: 70ch; }
.legal-body .email { color: var(--gold); user-select: all; }
/* First-visit gate */
.gate { position: fixed; inset: 0; z-index: 100; background: rgba(5,4,3,.82); display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate-card { background: var(--panel); border: 1px solid var(--line-2); border-top: 4px solid var(--gold); border-radius: 16px; padding: 26px 24px; max-width: 460px; width: 100%; display: grid; gap: 12px; justify-items: center; text-align: center; }
.gate-card img { border-radius: 50%; }
.gate-card h2 { font-size: 26px; }
.gate-card p { font-size: 15px; line-height: 1.5; }
.btn.big { padding: 12px 20px; font-size: 16px; border-radius: 12px; }
/* Floating share */
.fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--strip-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 45; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--gold); color: var(--gold-ink); box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 0 2px rgba(255,182,18,.25); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fab svg { width: 24px; height: 24px; fill: var(--gold-ink); }
.fab:hover { background: var(--gold-2); }
/* Town picker (list page) */
.picker { position: relative; }
.picker-field { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1.5px solid var(--gold); border-radius: 12px; padding: 10px 14px; box-shadow: 0 0 0 4px rgba(255,182,18,.08); }
.picker-field svg { width: 20px; height: 20px; fill: var(--gold); flex: none; }
.picker-field input { flex: 1; background: transparent; border: 0; color: var(--fg); font: inherit; font-size: 16px; min-width: 0; outline: none; }
.picker-field .count { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.picker-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.5); max-height: 60vh; overflow-y: auto; z-index: 35; padding: 6px; }
.picker-menu .grp { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); padding: 10px 10px 4px; }
.picker-menu button { width: 100%; display: flex; justify-content: space-between; gap: 10px; background: transparent; border: 0; color: var(--fg); font: inherit; font-size: 15px; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.picker-menu button:hover, .picker-menu button[aria-selected="true"] { background: var(--panel-2); }
.picker-menu button .n { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.quick { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 14px; }
.quick input { flex: 1; background: transparent; border: 0; color: var(--fg); font: inherit; font-size: 15px; min-width: 0; outline: none; }
.list-controls { display: grid; grid-template-columns: 1.2fr 1fr; gap: 10px; margin-top: 14px; }
@media (max-width: 720px) { .list-controls { grid-template-columns: minmax(0, 1fr); } }
.list-controls > * { min-width: 0; }
/* Your town card + tonight banner */
.tonight-card { margin-top: 20px; border-radius: 16px; padding: 18px 20px; background: linear-gradient(135deg, #2a1206, #0f0e0c 70%); border: 1px solid var(--pumpkin); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.tonight-card .t1 { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 4.5vw, 34px); color: var(--pumpkin); line-height: 1.15; }
.tonight-card .t2 { color: var(--fg); margin-top: 4px; }
.mytown { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line-2); border-left: 4px solid var(--gold); border-radius: 12px; padding: 12px 16px; }
.mytown .lbl { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mytown .nm { font-family: var(--display); font-size: 20px; font-weight: 700; }
.mytown .hrs { color: var(--muted); font-size: 14px; }
/* Tips */
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 16px; }
.tip { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.tip .ico { font-size: 28px; line-height: 1; }
.tip h2, .tip h3 { margin-top: 8px; font-size: 17px; }
.tip p { margin-top: 6px; color: var(--muted); font-size: 14.5px; }

/* hidden attribute always wins */
[hidden] { display: none !important; }
.gate-card #gateOk { width: 100%; justify-content: center; margin-top: 6px; }

/* No sideways panning on phones: clip anything that pokes past the edge */
body { overflow-x: clip; overscroll-behavior-y: none; -webkit-overflow-scrolling: touch; }
@supports not (overflow-x: clip) { body { overflow-x: hidden; } }
html { overflow-x: visible; }
.legal-toggle .short { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* iPhone notch / status bar in the installed app */
header.site { padding-top: env(safe-area-inset-top, 0px); }
/* First-visit card can scroll on short screens */
.gate { overflow-y: auto; align-items: safe center; }
.gate-card { max-height: 100%; overflow-y: auto; }

/* audit: facility tag, readable ribbon text, bigger tap targets */
.tag.facility { background: rgba(255,182,18,.14); color: var(--gold); border: 1px solid rgba(255,182,18,.35); }
.ribbon { color: #1a1400; }
.legal-toggle { min-height: 40px; }
:root { --strip-h: 40px; }
.nav a { min-height: 40px; }

/* Hours page on phones: each town becomes a card instead of a sideways-scrolling table */
.only-phone { display: none; }
@media (max-width: 720px) {
  .only-phone { display: inline-block; }
  .tablewrap { overflow: visible; border: 0; border-radius: 0; }
  #hoursTable { min-width: 0; background: transparent; }
  #hoursTable thead { display: none; }
  #hoursTable tbody, #hoursTable tr, #hoursTable td { display: block; }
  #hoursTable tr { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; display: grid !important; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; }
  #hoursTable tr.tonight { border-color: var(--pumpkin); }
  #hoursTable td { padding: 3px 0; border: 0; background: transparent; }
  #hoursTable td.name a { font-family: var(--display); font-weight: 700; font-size: 16.5px; text-decoration: none; color: var(--fg); }
  #hoursTable td.name { grid-column: 1; grid-row: 1; min-width: 0; }
  #hoursTable td[data-l="Hours"] { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; font-size: 15px; }
  #hoursTable td[data-l="Date"] { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 14px; }
  #hoursTable td[data-l="Source"] { grid-column: 2; grid-row: 2; text-align: right; }
  #hoursTable td[data-l="Note"] { grid-column: 1 / -1; font-size: 13.5px; color: var(--muted); }
  #hoursTable td[data-l]::before { content: none; }
  #hoursTable td.empty-cell { display: none; }
  #hoursTable td .note { display: inline; }
}

/* Maps stay under the sticky header while scrolling */
.minimap, .mapwrap, .leaflet-container { position: relative; z-index: 0; isolation: isolate; }
.work .c a { color: var(--gold); text-decoration: none; margin-left: 8px; font-size: 13.5px; }
.work .c a:hover { text-decoration: underline; }

.work .addr-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.work .addr-link:hover { color: var(--gold); border-color: var(--gold); }

/* text-valued stats (like hours) stay on one line */
.stat .v:not(.tabular) { font-size: clamp(20px, 5.5vw, 28px); white-space: nowrap; }

/* "new version ready" bar: sits above the legal strip, out of the way */
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--strip-h) + 14px + env(safe-area-inset-bottom, 0px)); z-index: 60; width: min(560px, calc(100% - 32px)); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); color: var(--fg); border: 1px solid var(--gold); border-radius: 14px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.5); font-size: 14.5px; }
.update-bar span { flex: 1 1 200px; }
.update-bar .btn { padding: 8px 12px; }

/* ---------- header: brand, nav, install link (one consolidated block) ---------- */
:root { --install-top: 10px; --brand-gap: 0px; }
header.site { overflow: hidden; }
header.site .inner { position: relative; }
.nav-btn.install { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 0; border-radius: 8px; color: var(--muted); font: inherit; font-size: 12px; letter-spacing: .02em; padding: 4px 6px; min-height: 28px; min-width: 28px; cursor: pointer; margin-left: auto; align-self: center; }
.nav-btn.install svg { width: 14px; height: 14px; fill: currentColor; }
.nav-btn.install:hover, .nav-btn.install:focus-visible { color: var(--gold); }
.nav-btn.install .short { display: none; }
@media (max-width: 1100px) {
  header.site .inner { flex-direction: column; align-items: stretch; gap: 8px; padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .brand { padding-right: 76px; margin-bottom: var(--brand-gap); }
  .nav { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 2px; width: 100%; max-width: 640px; }
  .nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 11px; line-height: 1.1; border-radius: 10px; min-height: 0; }
  .nav a svg { width: 20px; height: 20px; }
  .nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav a[aria-current="page"] { box-shadow: none; }
  .nav-btn.install { position: absolute; top: var(--install-top); right: max(12px, env(safe-area-inset-right, 0px)); margin: 0; }
  .nav-btn.install .long { display: none; }
  .nav-btn.install .short { display: inline; }
}
@media (max-width: 360px) { .brand-name { font-size: 17px; } }

/* ---------- no sideways panning on iPhone ---------- */
html { overflow-x: clip; overscroll-behavior-x: none; }
body { overscroll-behavior-x: none; }
.hero, .tonight-card, .mytown, .card, .bld, .work { overflow: hidden; }

/* ---------- skip link, focus ---------- */
.skip { left: 8px; top: -200px; transform: none; }
.skip:focus { top: 8px; }
#main:focus { outline: none; }

/* ---------- update bar: centered, above dialogs ---------- */
.update-bar { z-index: 120; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.update-bar span { flex: none; }
.update-bar .row { display: flex; gap: 10px; justify-content: center; }

/* ---------- share button stays out of the way of the expanded info bar ---------- */
body.legal-open .fab { display: none; }

/* ---------- map clusters, MapTiler logo ---------- */
.marker-cluster { background: color-mix(in srgb, var(--gold) 32%, transparent); border-radius: 50%; }
.marker-cluster div { width: 30px; height: 30px; margin: 5px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); font: 600 13px/30px var(--body); text-align: center; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.mt-logo { display: inline-block; padding: 12px 8px 8px 0; }
.mt-logo img { display: block; width: 67px; height: 20px; }

/* ---------- form controls readable against panels (3:1) ---------- */
select.sel, .search, .quick { border-color: color-mix(in srgb, var(--muted) 60%, transparent); }

/* ---------- sortable table headers ---------- */
.th-btn { background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; cursor: pointer; text-align: inherit; }
.th-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* print-only blocks stay hidden on screen */
.print-only { display: none !important; }
.ph-county h2 { margin-top: 18px; }
.ph-list { columns: 2; column-gap: 28px; }
@media (max-width: 720px) { .ph-list { columns: 1; } }
.ph-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.ph-row .muted { white-space: nowrap; }

/* About page: jump buttons and heading offset under the sticky header */
.about-jumps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.about-jumps .btn { font-size: 13px; padding: 6px 10px; }
.prose h2[id] { scroll-margin-top: 0; }
.prose h2[id]:focus { outline: none; }
.prose h3 { margin: 14px 0 4px; font-size: 16px; }
.prose ol { margin: 0; padding-left: 22px; }
.prose ol li { margin-bottom: 6px; }

/* audit 3 */
/* Tap-for-meaning labels and the little (i) buttons */
button.tag { font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: inherit; background: none; line-height: 1.5; cursor: pointer; }
.tag.has-tip::after { content: "ⓘ"; content: "ⓘ" / ""; margin-left: 4px; font-size: 10px; opacity: .8; }
.tag.has-tip:hover { filter: brightness(1.2); }
.tag.has-tip:focus-visible, .info-i:focus-visible, .linkish:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.info-i { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 8px; vertical-align: middle; border-radius: 50%; border: 1px solid var(--line-2); background: none; color: var(--muted); font: italic 700 14px/1 Georgia, serif; cursor: pointer; }
.info-i:hover { color: var(--gold); border-color: var(--gold); }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 12px; font-weight: 400; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.tipbox { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--strip-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 80; width: min(440px, calc(100vw - 24px)); }
.tipbox-in { background: var(--panel-2); color: var(--fg); border: 1px solid var(--gold); border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.55); }
.tipbox-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tipbox-h b { font-family: var(--display); font-size: 19px; }
.tipbox p { margin: 8px 0 6px; line-height: 1.45; }
.tipbox a { font-size: 13px; }
.glossary { display: grid; gap: 10px; margin: 0; }
.glossary div { border-left: 3px solid var(--gold); padding-left: 10px; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 2px 0 0; color: var(--muted); }
/* Find your town */
.find { margin-top: 16px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; }
.find-l { display: block; font-family: var(--display); font-weight: 700; font-size: 22px; margin-bottom: 8px; }
.find-row { display: flex; gap: 8px; flex-wrap: wrap; }
.find-row input { flex: 1 1 220px; min-width: 0; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--muted); background: var(--bg); color: var(--fg); }
.find-row input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--gold); }
.find-row .btn { white-space: nowrap; min-height: 46px; }
.find-list { margin-top: 10px; display: grid; gap: 6px; }
.find-list:empty { display: none; }
.find-list .grp { font-size: 13.5px; color: var(--muted); }
.find-list button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--fg); cursor: pointer; }
.find-list button:hover, .find-list button:focus-visible { border-color: var(--gold); outline: none; }
.find-list .h { color: var(--muted); font-size: 13px; }
.find-note { font-size: 13px; margin: 8px 0 0; }
/* Your-town countdown card */
.tonight-card .lbl { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tonight-card.live { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.tonight-card.live .t1 { color: var(--gold-2); }
.tonight-card.done { border-color: var(--line-2); }
.tonight-card.done .t1 { color: var(--fg); }
.load-fail p { margin: 0 0 12px; }
#setTown.is-mine::before { content: "★ "; content: "★ " / ""; color: var(--gold); }

/* tap-to-load town map and the map-break message */
.map-gate { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center;
  background: radial-gradient(circle at 50% 40%, var(--panel-2), var(--panel) 70%); }
.map-gate p { margin: 0; font-size: 13.5px; max-width: 26em; }
.map-rest { position: absolute; left: 12px; right: 12px; top: 50%; transform: translateY(-50%); z-index: 500; display: grid; gap: 4px; text-align: center;
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--gold); border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.map-rest b { font-family: var(--display); font-size: 17px; }
.map-rest span { font-size: 14px; color: var(--muted); }
#bigmap, #minimap { position: relative; }
.leaflet-container .map-rest a, .map-rest a { color: var(--gold); text-decoration: underline; }

/* audit 5 */
.find-list a.find-st { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--fg); text-decoration: none; }
.find-list a.find-st:hover, .find-list a.find-st:focus-visible { border-color: var(--gold); outline: 2px solid var(--focus); outline-offset: 1px; }
.find-list button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
details.cov { margin: -4px 0 12px; }
details.cov summary { cursor: pointer; color: var(--gold); font-size: 14.5px; width: fit-content; }
details.cov p { margin: 8px 0 0; font-size: 14px; }
.minimap.gated { height: 100%; min-height: 150px; }
@media (max-width: 720px) { .minimap.gated { height: auto; } }
@media (max-width: 600px) {
  .brand-sub .sub-more { display: none; }
  .hero { padding: 18px 16px; gap: 12px; }
  .hero h1 { font-size: 34px; }
  .hero .sub { font-size: 15px; }
  .hero .count { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px; min-width: 0; }
  .hero .count .n { font-size: 36px; }
  .hero .count .l { margin-top: 0; }
  .bld .bh { flex-direction: column; align-items: flex-start; gap: 2px; }
  .bld .bh .cnt { white-space: normal; }
  .fab { width: 46px; height: 46px; }
  .fab svg { width: 20px; height: 20px; }
}
@media (max-width: 400px) { .work { flex-wrap: wrap; } .work .c { white-space: normal; } }

/* audit 6 */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* banners on every page */
.season-over, .stale-note { margin-top: 16px; display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; background: var(--panel-2); border: 2px solid var(--pumpkin); font-size: 15.5px; }
.season-over b, .stale-note b { font-family: var(--display); font-size: 20px; color: var(--pumpkin); }
.stale-note { border-color: var(--gold); }
.stale-note b { color: var(--gold-2); }
/* focus and jumps never land under the sticky header or the bottom bar (--hdr is the header's real height, set by app.js) */
html { scroll-padding-top: calc(var(--hdr, 90px) + 12px); scroll-padding-bottom: 72px; }
@media (max-width: 1100px) { html { scroll-padding-top: calc(var(--hdr, 150px) + 12px); } }
/* big zoom / short screens: the bars stop floating so the page has room */
.tipbox-in { max-height: calc(100dvh - 24px); overflow-y: auto; }
@media (max-height: 500px) {
  header.site { position: static; }
  html { scroll-padding-top: 12px; }
  .legal-strip { position: static; }
  body { padding-bottom: 0; }
  .fab { display: none; }
  .tipbox { bottom: 12px; }
}
/* bigger tap targets (about 44 px) without making things look bigger */
.chip { min-height: 40px; padding: 8px 14px; }
.addr { min-height: 44px; }
main .btn { min-height: 44px; }
.find-list button, .find-list a.find-st { min-height: 48px; }
.work .c a { display: inline-block; padding: 10px 4px; margin-left: 6px; }
.unit .src { display: inline-block; padding: 8px 0; }
button.tag.has-tip, .info-i, .linkish { position: relative; }
button.tag.has-tip::before, .info-i::before, .linkish::before { content: ""; position: absolute; inset: -10px -3px; }
.leaflet-bar a, .leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
/* Windows high contrast */
@media (forced-colors: active) {
  .nav a svg, .fab svg { fill: CanvasText; }
  .fab { border: 2px solid ButtonText; }
  .nav a[aria-current="page"] { border: 2px solid Highlight; }
}
