:root {
  --navy: #0F1B33;
  --navy2: #16254A;
  --navy3: #1E2F5C;
  --line: #2C3D69;
  --yellow: #FFC62B;
  --text: #FFFFFF;
  --muted: #B9C4DA;
  --danger: #FF6B6B;
  --ok: #3DDC97;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--navy);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px; }
a { color: var(--yellow); }
a:hover { color: #FFE08A; }
h1, h2, .eyebrow { font-family: Bungee, Inter, sans-serif; font-weight: 400; letter-spacing: .3px; }
h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.1; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.y { color: var(--yellow); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.pre { white-space: pre-line; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { color: var(--yellow); font-size: 14px; letter-spacing: 2px; margin-bottom: 8px; text-transform: uppercase; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--navy); position: sticky; top: 0; z-index: 1000; }
.brand img { display: block; height: 40px; width: auto; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover { background: var(--navy2); color: var(--text); }
.nav a.on { background: var(--navy3); color: var(--yellow); }
.nav a.btn { color: var(--navy); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--yellow); color: var(--navy); border: 0; border-radius: 12px; padding: 10px 18px; min-height: 44px; font: 700 16px Inter, sans-serif; cursor: pointer; text-decoration: none; }
.btn:hover { background: #FFD458; color: var(--navy); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border: 2px solid var(--line); }
.btn-ghost:hover { background: var(--navy2); color: var(--text); }
.btn-danger { background: var(--danger); color: #1a0000; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 18px; }
.full { width: 100%; }
.linkish { background: none; border: 0; color: var(--yellow); font: 600 14px Inter, sans-serif; cursor: pointer; padding: 8px 4px; min-height: 36px; text-decoration: underline; }
.linkish.danger { color: var(--danger); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* cards & layout */
.card { background: var(--navy2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.grid2, .grid3 { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 16px; }
.grid2 .card, .grid3 .card { margin: 0; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.hero { padding: 32px 4px 24px; max-width: 760px; }
.hero.small { padding-top: 16px; }
.lead { font-size: 18px; color: var(--muted); }
.badge-callout { margin-top: 16px; color: var(--yellow); font-weight: 600; }
.star { color: var(--yellow); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin-bottom: 4px; }
.town-list { list-style: none; padding: 0; margin: 0; }
.town-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.town-list li:last-child { border-bottom: 0; }
.pill { background: var(--navy3); color: var(--text); border-radius: 999px; padding: 2px 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; margin: 4px 4px 0 0; text-decoration: none; }
.prose li { margin-bottom: 8px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-weight: 600; margin-top: 8px; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .filters select, .filters input:not([type=checkbox]) {
  width: 100%; background: var(--navy); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; font: 16px Inter, sans-serif;
}
.form textarea { resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus, .filters select:focus { outline: 2px solid var(--yellow); outline-offset: 1px; }
.form .btn { margin-top: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500 !important; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--yellow); flex: none; }
.inline-check { margin: 0 !important; align-items: center; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.error { background: rgba(255,107,107,.12); border: 1px solid var(--danger); color: #FFC4C4; border-radius: 10px; padding: 10px 12px; }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.seg legend { font-weight: 600; margin-bottom: 6px; }
.seg label { display: flex; gap: 10px; align-items: center; background: var(--navy); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 0; min-height: 44px; }
.seg input { accent-color: var(--yellow); width: 20px; height: 20px; }

.flash { max-width: 1100px; margin: 12px auto 0; padding: 12px 16px; border-radius: 10px; font-weight: 600; width: calc(100% - 32px); }
.flash.ok { background: rgba(61,220,151,.14); border: 1px solid var(--ok); }
.flash.err { background: rgba(255,107,107,.14); border: 1px solid var(--danger); }

/* map page */
.map-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input:not([type=checkbox]) { width: auto; min-width: 140px; flex: 1 1 140px; }
.filters.bar { margin-bottom: 16px; }
#map { height: 62vh; min-height: 360px; border-radius: var(--radius); border: 1px solid var(--line); z-index: 1; }
#map.picking { cursor: crosshair; outline: 3px solid var(--yellow); }
.pick-hint { position: sticky; bottom: 12px; z-index: 900; margin: 10px auto 0; background: var(--yellow); color: var(--navy); font-weight: 700; padding: 10px 12px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.pick-hint[hidden] { display: none; }
.pick-hint .btn-ghost { color: var(--navy); border-color: var(--navy); }
.pick-hint .btn { background: var(--navy); color: var(--yellow); }
.feed { margin-top: 16px; }
.feed-h { display: flex; gap: 10px; align-items: center; }
.report-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.report-btn { width: 100%; text-align: left; background: var(--navy2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; font: inherit; }
.report-btn:hover { border-color: var(--yellow); }
.report-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-d { margin: 6px 0; white-space: pre-line; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 2px solid var(--navy); flex: none; }
.by { color: var(--muted); font-size: 14px; }
.fm-badge { display: inline-block; background: var(--yellow); color: var(--navy); font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--navy2); color: var(--text); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; font: 15px/1.45 Inter, sans-serif; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop-h { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.pop-d { margin: 8px 0; white-space: pre-line; }
.pop-a { display: flex; gap: 10px; margin-top: 6px; }
.leaflet-container { background: #dfe5ee; }

dialog.dlg { background: var(--navy2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
dialog.dlg::backdrop { background: rgba(5,10,20,.7); }

/* pets */
.pet-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .pet-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .pet-grid { grid-template-columns: 1fr 1fr 1fr; } }
.pet { background: var(--navy2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.pet img, .pet-nophoto { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--navy3); display: block; }
.pet-nophoto { display: flex; align-items: center; justify-content: center; font-family: Bungee, sans-serif; color: var(--muted); font-size: 28px; }
.pet-body { padding: 14px 16px; }
.pet-body h2 { margin: 8px 0 4px; }
.pet.reunited { opacity: .7; }
.pet-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--navy3); }
.tag.lost { background: var(--danger); color: #1a0000; }
.tag.found { background: var(--ok); color: #002313; }
.tag.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.tag.lvl-urgent { background: var(--danger); color: #1a0000; }
.tag.lvl-warning { background: var(--yellow); color: var(--navy); }
.pet-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.alert.urgent { border-color: var(--danger); }
.alert.warning { border-color: var(--yellow); }

/* account / admin */
.founding-card { display: flex; gap: 14px; align-items: center; background: var(--navy); border: 2px solid var(--yellow); border-radius: 12px; padding: 14px; margin: 8px 0 14px; }
.founding-card .star { font-size: 32px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.stat { background: var(--navy2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-family: Bungee, sans-serif; font-weight: 400; font-size: 28px; color: var(--yellow); }
.stat span { color: var(--muted); font-size: 14px; }
.stat.hot { border-color: var(--danger); }
.flag-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.quote { margin: 6px 0 0; padding: 8px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.banned td { opacity: .5; text-decoration: line-through; }
details summary { cursor: pointer; min-height: 32px; }

.foot { border-top: 1px solid var(--line); padding: 20px 16px 28px; color: var(--muted); font-size: 14px; text-align: center; display: grid; gap: 8px; }
.foot-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.foot-note { font-size: 13px; }

.stat-link { text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--yellow); color: inherit; }
.ad-stats { margin-top: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ad-cta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-cta h2, .ad-cta p { margin: 0; }
.mini-select { background: var(--navy); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 40px; font: 14px Inter, sans-serif; }

.section-h { font-size: 26px; margin: 8px 0 14px; }
.tiers { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 10px; }
@media (min-width: 860px) { .tiers { grid-template-columns: repeat(3, 1fr); } }
.tier { position: relative; background: var(--navy2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; display: flex; flex-direction: column; }
.tier.popular { border: 2px solid var(--yellow); }
.tier-flag { position: absolute; top: -12px; left: 20px; background: var(--yellow); color: var(--navy); font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .5px; }
.tier h3 { font-family: Bungee, sans-serif; font-weight: 400; font-size: 22px; margin: 4px 0 4px; }
.tier-price { font-family: Bungee, sans-serif; color: var(--yellow); font-size: 26px; margin: 6px 0 10px; }
.tier-list { list-style: none; padding: 0; margin: 0 0 18px; flex: 1; }
.tier-list li { padding: 7px 0 7px 26px; position: relative; border-bottom: 1px solid var(--line); }
.tier-list li:last-child { border-bottom: 0; }
.tier-list li::before { content: '\2713'; position: absolute; left: 2px; color: var(--yellow); font-weight: 800; }
.sponsors { margin: 16px 0; background: var(--navy2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.sponsors-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.sponsors-h .eyebrow { margin: 0; font-size: 12px; }
.sponsor-row { display: flex; gap: 10px; flex-wrap: wrap; }
.sponsor { display: flex; align-items: center; gap: 10px; background: var(--navy); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; text-decoration: none; color: var(--text); min-height: 52px; }
a.sponsor:hover { border-color: var(--yellow); color: var(--text); }
.sponsor img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; }
.sp-text { display: flex; flex-direction: column; line-height: 1.25; }
.sp-text span { color: var(--muted); font-size: 13px; }
.sp-town { border-color: var(--yellow); }
.presenter { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.presenter-in { display: inline-flex; align-items: center; gap: 12px; background: var(--navy2); border: 1px solid var(--yellow); border-radius: 12px; padding: 10px 14px; text-decoration: none; color: var(--text); width: fit-content; }
.presenter-in img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; }
.mini-logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; vertical-align: middle; }

.addon-h { font-family: Bungee, sans-serif; font-weight: 400; font-size: 20px; margin: 26px 0 12px; }
.addons { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .addons { grid-template-columns: 1fr 1fr; } }
.addon { background: var(--navy2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.addon h3 { font-family: Bungee, sans-serif; font-weight: 400; font-size: 18px; margin: 0 0 4px; }
.addon p { margin: 0; }
.addon-r { text-align: right; flex-shrink: 0; }
.addon-r .tier-price { font-size: 20px; margin: 0 0 8px; }

.map-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* Crime pins on the map */
.n574-pin span { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 3px solid #0F1B33; box-shadow: 0 2px 6px rgba(0,0,0,.45); font-size: 16px; line-height: 1; }
.n574-pin { background: none; border: 0; }

/* Header scanner button and home/board layout */
.nav-scan { margin-left: 4px; }
.home-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .home-grid { grid-template-columns: 1fr 1fr; } .home-wide { grid-column: 1 / -1; } }
.home-card h2 { margin-top: 0; }
.big-ad { border: 2px solid var(--yellow); }
.topic-row { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; color: var(--text); text-decoration: none; background: var(--navy2); }
.topic-row:hover { border-color: var(--yellow); }
.topic-row strong { display: block; }
.reply { border-left: 3px solid var(--line); padding: 8px 12px; margin: 10px 0; }

/* v16: article links on pins and reports */
.story-link { display: inline-block; margin: 4px 0 6px; font-weight: 600; color: var(--gold, #d4a24c); text-decoration: underline; }
.report-link { padding: 0 12px 10px; }

/* v17: numbers page */
.res-table { width: 100%; border-collapse: collapse; margin: 6px 0 22px; }
.res-table th, .res-table td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.12); }
.res-table th { width: 90px; font-weight: 600; white-space: nowrap; }
.notice { padding: 10px 12px; border-radius: 10px; background: rgba(255,198,43,.12); }
