:root {
  /* Light theme (default). Dark values are below; public/theme-init.js sets data-theme on <html>. */
  color-scheme: light;
  --bg: #f6f7f5; --surface: #fff; --ink: #1d2320; --ink-2: #39413d; --muted: #66706b; --line: #dfe3e0; --line-soft: #eef1ef;
  --accent: #0b6e4f; --accent-hover: #08573e; --accent-ink: #fff; --link: #0b6e4f;
  --ok: #1f7a4d; --warn: #a86a00; --danger: #b42318; --star: #d97706; --star-empty: #d3d8d5;
  --btn-ok: #1f7a4d; --btn-warn: #a86a00; --btn-danger: #b42318;
  --input-bg: #fff; --img-bg: #eee; --soft-bg: #f2ede6; --shadow: rgba(0,0,0,.08); --hover-tint: rgba(0,0,0,.035);
  --err-bg: #fdecea; --err-line: #f5c2bd; --ok-bg: #e8f5ee; --ok-soft: #dff3e8; --warn-bg: #fff7e6; --warn-line: #f3d9a4;
  --role-admin-bg: #d9efe6; --role-admin-ink: #0b5a40; --axis: #b9b2a7; --log-bg: #1f2328; --log-ink: #e6e1d9;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
/* Dark theme: chosen in the header, or following the device setting ("System"). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141517; --surface: #1d1f22; --ink: #e8e6e3; --ink-2: #c9c6c1; --muted: #a3a7ad; --line: #34373c; --line-soft: #2a2c30;
  --accent: #12855f; --accent-hover: #19a174; --accent-ink: #fff; --link: #5fd3a6;
  --ok: #5cc995; --warn: #e5b04a; --danger: #f2837a; --star: #f5b428; --star-empty: #4a4d52;
  --input-bg: #17191c; --img-bg: #2a2c30; --soft-bg: #2a2c30; --shadow: rgba(0,0,0,.45); --hover-tint: rgba(255,255,255,.05);
  --err-bg: #3a1f1d; --err-line: #6b2f2a; --ok-bg: #16302a; --ok-soft: #16302a; --warn-bg: #3a2e17; --warn-line: #6b5420;
  --role-admin-bg: #4a2614; --role-admin-ink: #f4b08c; --axis: #55595f; --log-bg: #0f1012; --log-ink: #e6e1d9;
}
/* Without JavaScript, still follow the device setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #141517; --surface: #1d1f22; --ink: #e8e6e3; --ink-2: #c9c6c1; --muted: #a3a7ad; --line: #34373c; --line-soft: #2a2c30;
    --accent: #12855f; --accent-hover: #19a174; --link: #5fd3a6;
    --ok: #5cc995; --warn: #e5b04a; --danger: #f2837a; --star: #f5b428; --star-empty: #4a4d52;
    --input-bg: #17191c; --img-bg: #2a2c30; --soft-bg: #2a2c30; --shadow: rgba(0,0,0,.45); --hover-tint: rgba(255,255,255,.05);
    --err-bg: #3a1f1d; --err-line: #6b2f2a; --ok-bg: #16302a; --ok-soft: #16302a; --warn-bg: #3a2e17; --warn-line: #6b5420;
    --role-admin-bg: #4a2614; --role-admin-ink: #f4b08c; --axis: #55595f; --log-bg: #0f1012;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--link); }
img { max-width: 100%; display: block; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .875rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font-family: var(--font); font-size: 1.3rem; font-weight: 800; letter-spacing: -.01em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.brand-shield .shield { width: 34px; height: 34px; display: block; }
h1, h2, h3 { font-family: var(--font); font-weight: 800; letter-spacing: -.01em; }
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a { color: var(--ink); text-decoration: none; }
nav a:hover { color: var(--link); }
form.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }

/* Buttons */
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink) !important; border: 0; border-radius: 999px;
  padding: 10px 20px; font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn-small { padding: 7px 14px; font-size: .875rem; }
.btn-big { padding: 14px 28px; font-size: 1.05rem; }
.btn-ok { background: var(--btn-ok); } .btn-warn { background: var(--btn-warn); } .btn-danger { background: var(--btn-danger); }
.btn-ghost { background: transparent; color: var(--ink) !important; border: 1px solid var(--line); }

/* Hero + search */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0 0 22px; }
.search { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.search input, .search select { min-width: 220px; }
.clear { font-size: .9rem; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); color: var(--ink); width: 100%; }
.search input, .search select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* Grid of cards */
.section-title { font-size: 1.4rem; margin: 12px 0 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card-img { position: relative; aspect-ratio: 4 / 3; background: var(--img-bg); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.count { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: .8rem; padding: 2px 8px; border-radius: 999px; }
.card-body { padding: 14px 16px 16px; }
.card h3 { margin: 4px 0 6px; font-size: 1.15rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.loc { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--muted); }
.loc a { color: var(--link); text-decoration: none; }
.loc.big { font-size: .9rem; }
.meta { margin: 0 0 8px; font-size: .9rem; }
.stars { color: var(--star); letter-spacing: 1px; }
.excerpt { margin: 0 0 10px; color: var(--ink-2); font-size: .95rem; }
.byline { margin: 0; font-size: .82rem; color: var(--muted); }
.empty, .message { text-align: center; padding: 48px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.pager { display: flex; justify-content: center; gap: 20px; margin: 28px 0; }

/* Post page */
.post { max-width: 760px; margin: 32px auto; }
.post h1 { font-size: 2rem; margin: 6px 0 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 20px 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.post-body p { margin: 0 0 1em; white-space: pre-line; }

/* Forms */
.form-page { max-width: 720px; margin: 32px auto; }
.form-page.narrow { max-width: 400px; }
.form { display: grid; gap: 18px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px 18px 18px; margin: 0; display: grid; gap: 14px; }
legend { font-weight: 700; padding: 0 6px; }
.req { font-size: .75rem; font-weight: 600; color: var(--link); text-transform: uppercase; letter-spacing: .05em; margin-left: 6px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; font-weight: normal; text-align: center; cursor: pointer; }
.drop input { border: 0; padding: 0; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.previews img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.rating { display: flex; align-items: center; gap: 14px; font-weight: 600; font-size: .92rem; }
.rating-stars { display: inline-flex; flex-direction: row-reverse; }
.rating-stars input { position: absolute; opacity: 0; width: 1px; }
.rating-stars label { font-size: 1.9rem; color: var(--star-empty); cursor: pointer; padding: 0 2px; }
.rating-stars input:checked ~ label, .rating-stars label:hover, .rating-stars label:hover ~ label { color: var(--star); }
.rating-stars input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }
.errors { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--danger); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.errors p { margin: 0; font-weight: 600; } .errors ul { margin: 6px 0 0; }

/* Moderation */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.pill { background: var(--line); border-radius: 999px; padding: 1px 8px; font-size: .78rem; margin-left: 4px; }
.flash { background: var(--ok-bg); color: var(--ok); padding: 10px 14px; border-radius: 8px; }
.mod-item { display: grid; grid-template-columns: 280px 1fr; gap: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
@media (max-width: 760px) { .mod-item { grid-template-columns: 1fr; } }
.mod-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start; }
.mod-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.mod-main h2 { margin: 4px 0 6px; font-size: 1.3rem; }
.reason { color: var(--warn); font-size: .9rem; }
.mod-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.mod-actions form { margin: 0; }
.mod-actions .reject { display: flex; gap: 8px; }
.mod-actions .reject input { width: 230px; }

.footer { color: var(--muted); font-size: .85rem; padding: 40px 20px; text-align: center; }
.footer a { color: var(--muted); }

/* Comments */
.comments { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.comments h2 { font-size: 1.4rem; margin: 0 0 16px; }
.comment { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.comment-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; margin: 0 0 6px; }
.comment .post-body p:last-child { margin-bottom: 0; }
.comment-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.comment-photos img { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; }
.comment-form-wrap { margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.comment-form-wrap h3 { margin: 0 0 12px; font-size: 1.2rem; }
.mod-item.no-photos { grid-template-columns: 1fr; }
.on-post { margin: 0 0 6px; font-size: .9rem; color: var(--muted); }
.switch { display: inline-flex; background: var(--line); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.switch a { padding: 6px 16px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.switch a.active { background: var(--surface); box-shadow: 0 1px 2px var(--shadow); }
.pill-alert { background: var(--accent); color: #fff; }

/* Admin control panel */
.admin { display: grid; grid-template-columns: 200px 1fr; gap: 28px; margin-top: 24px; }
@media (max-width: 860px) { .admin { grid-template-columns: 1fr; gap: 16px; } }
.admin-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; align-self: start; }
.admin-nav-title { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 0 0 6px 10px; }
.admin-nav a { padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.admin-nav a:hover { background: var(--line); }
.admin-nav a.active { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.admin-nav hr { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 8px 0; }
.admin-main h1 { margin-top: 0; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-head h1 { margin: 0; }
.range { display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px; }
.range a { padding: 5px 12px; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .88rem; }
.range a.active { background: var(--surface); font-weight: 600; box-shadow: 0 1px 2px var(--shadow); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; min-width: 0; }
.panel h2 { font-size: 1.15rem; margin: 0 0 10px; }
.panel h3 { font-size: 1rem; margin: 18px 0 6px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .cols { grid-template-columns: 1fr; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.tile-num { font-size: 1.9rem; font-weight: 700; font-family: var(--serif); line-height: 1.15; }
.tile-sub { font-size: .82rem; color: var(--muted); }
.chart { margin: 0; }
.chart figcaption { font-weight: 600; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .mark { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .bar:hover .mark { fill: var(--accent-hover); }
.chart .bar:hover .hit { fill: var(--hover-tint); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 6px 8px; }
.table td { border-bottom: 1px solid var(--line-soft); padding: 8px; vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.nowrap { white-space: nowrap; }
.warn-row td { background: var(--warn-bg); }
.inline-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input, .inline-form select { width: auto; padding: 6px 8px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 160px auto; gap: 12px; align-items: end; }
@media (max-width: 760px) { .row3 { grid-template-columns: 1fr; } }
.role { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--line); }
.role-admin { background: var(--role-admin-bg); color: var(--role-admin-ink); }
.toggle { border: 0; border-radius: 999px; padding: 4px 14px; font: 600 .82rem var(--font); cursor: pointer; }
.toggle.on { background: var(--ok-soft); color: var(--ok); }
.toggle.off { background: var(--soft-bg); color: var(--muted); }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .err-text { color: var(--danger); }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .status-grid { grid-template-columns: 1fr; } }
.status-grid p { margin: 4px 0; }
.log { background: var(--log-bg); color: var(--log-ink); padding: 12px; border-radius: 8px; font-size: .8rem; max-height: 360px; overflow: auto; white-space: pre-wrap; }
details summary { cursor: pointer; font-weight: 600; margin-top: 10px; }
.note { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.note p { margin: 0; } .note ul { margin: 6px 0 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: normal; }
.check input { width: auto; margin-top: 4px; }
.danger-zone { border-color: var(--err-line); }
.closed-note { background: var(--soft-bg); border-radius: 10px; padding: 12px 16px; color: var(--muted); }
.plain { list-style: none; padding: 0; } .plain li { padding: 4px 0; }
code { background: var(--soft-bg); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.errors { margin-top: 0; }
.panel { overflow-x: auto; }
.cap { text-transform: capitalize; }
.row3-even { grid-template-columns: 1fr 1fr 1fr; }
.test-row { align-items: end; }
.update-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; justify-items: start; }

/* Theme selector (header) */
.theme-switch { display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.theme-switch[hidden] { display: none; }
.theme-switch button { border: 0; background: transparent; color: var(--muted); width: 30px; height: 26px; border-radius: 999px; cursor: pointer;
  display: inline-grid; place-items: center; padding: 0; }
.theme-switch button svg { width: 16px; height: 16px; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.theme-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mod-photos img, .gallery img, .card-img img, .comment-photos img { background: var(--img-bg); }

/* System health */
.health-tiles .tile { gap: 6px; }
.meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }
.m-good { background: var(--btn-ok); } .m-warning { background: var(--btn-warn); } .m-critical { background: var(--btn-danger); } .m-unknown { background: var(--muted); }
.lvl { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: .85rem; white-space: nowrap; }
.lvl > span { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: .7rem; color: #fff; }
.lvl-good { color: var(--ok); } .lvl-good > span { background: var(--btn-ok); }
.lvl-warning { color: var(--warn); } .lvl-warning > span { background: var(--btn-warn); }
.lvl-critical { color: var(--danger); } .lvl-critical > span { background: var(--btn-danger); }
.lvl-unknown { color: var(--muted); } .lvl-unknown > span { background: var(--muted); }
.table.compact td { padding: 4px 8px; }

/* Visitor map */
.map svg { width: 100%; height: auto; }
.map .land path { fill: var(--soft-bg); stroke: var(--surface); stroke-width: .75; }
.map .land path:hover { fill: var(--line); }
.map .bubbles circle { fill: var(--accent); fill-opacity: .55; stroke: var(--surface); stroke-width: 1.5; }
.map .bubbles circle:hover { fill-opacity: .85; }
.map-legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: .85rem; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend circle { fill: var(--accent); fill-opacity: .55; stroke: var(--surface); stroke-width: 1.5; }
.map-empty { text-align: center; margin: 8px 0 0; }

/* Pinned reviews */
.pin-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--link); background: var(--soft-bg); border-radius: 999px; padding: 2px 9px 2px 7px; margin-bottom: 6px; }
.pin-icon { width: 13px; height: 13px; }
.admin-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 14px; background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; }
.build-tag { font-size: .8rem; color: var(--muted) !important; margin-top: 4px; }

/* Spam protection widgets */
.antibot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
altcha-widget {
  --altcha-color-base: var(--surface); --altcha-color-text: var(--ink); --altcha-color-border: var(--line);
  --altcha-color-border-focus: var(--accent); --altcha-color-error-text: var(--danger); --altcha-color-footer-bg: var(--soft-bg);
  --altcha-border-radius: 10px; --altcha-max-width: 320px;
}

/* Photo viewer (public/lightbox.js) */
html.lb-open { overflow: hidden; }
dialog.lightbox {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: rgba(0, 0, 0, .96); color: #fff; overscroll-behavior: contain;
}
dialog.lightbox::backdrop { background: rgba(0, 0, 0, .6); }
.lightbox .lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 56px 64px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); user-select: none; }
.lightbox .lb-btn {
  position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
}
.lightbox .lb-btn:hover, .lightbox .lb-btn:focus-visible { background: rgba(255, 255, 255, .28); outline: 2px solid #fff; outline-offset: 2px; }
.lightbox .lb-close { top: 12px; right: 12px; }
.lightbox .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count { position: absolute; bottom: 14px; left: 0; right: 0; margin: 0; text-align: center; font-size: 14px; color: rgba(255, 255, 255, .85); pointer-events: none; }
.lightbox .lb-spinner {
  position: absolute; width: 36px; height: 36px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff;
  border-radius: 50%; animation: lb-spin .8s linear infinite; display: none;
}
.lightbox.loading .lb-spinner { display: block; }
@keyframes lb-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
  .lightbox .lb-stage { padding: 56px 8px 44px; }
  .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: 6px; transform: none; width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .lightbox .lb-spinner { animation-duration: 2.4s; } }

/* ---------- Route 22 ---------- */
/* Highway-sign green hero band with a yellow "warning" stripe. */
.hero { background: var(--accent); color: #fff; border-radius: var(--radius); margin-top: 24px; padding: 40px 20px 30px;
  box-shadow: inset 0 -6px 0 #f2c300; }
.hero p { color: rgba(255,255,255,.85); }
.hero-shield .shield { width: 72px; height: 72px; margin: 0 auto 14px; display: block; border-radius: 8px; }
.hero .search select { border-color: transparent; }
.hero .btn { background: #f2c300; color: #1d2320 !important; }
.hero .clear { color: #fff; }
.hot { margin: 18px 0 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.hot .muted { color: rgba(255,255,255,.75); }
.chip { display: inline-block; background: rgba(255,255,255,.14); color: #fff !important; text-decoration: none; padding: 4px 10px; border-radius: 999px; }
.chip:hover { background: rgba(255,255,255,.25); }
.chip .muted { color: rgba(255,255,255,.7); margin-left: 2px; }
.gripe { color: inherit; }
.stars { letter-spacing: 2px; }
/* Frustration picker (post and comment forms) */
.rage-pick { display: grid; gap: 8px; font-weight: 600; font-size: .92rem; }
.rage-options { display: flex; flex-wrap: wrap; gap: 8px; }
.rage-options input { position: absolute; opacity: 0; width: 1px; }
.rage-options label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
  cursor: pointer; font-weight: 500; background: var(--input-bg); }
.rage-options label b { color: var(--star); }
.rage-options input:checked + label { background: var(--star); border-color: var(--star); color: #1d2320; }
.rage-options input:checked + label b { color: #1d2320; }
.rage-options input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Public map (/map) */
.map-page { max-width: 920px; margin: 28px auto 0; }
.map-page h1 { margin: 0 0 4px; }
.map-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.map-page .map { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 20px; }
.map-page .map figcaption { font-size: .9rem; color: var(--muted); margin-bottom: 8px; }
.map-nj svg { max-height: 78vh; display: block; margin: 0 auto; }
.map .context path { fill: var(--line-soft); stroke: var(--line); stroke-width: .75; }
.map .route22 { fill: none; stroke: #f2c300; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 7 5; }
.map-table { margin-bottom: 18px; }
.map-legend span { white-space: nowrap; }
.map .context path { opacity: .55; }
.spaced { margin-top: 12px; }

/* Public map: zoom, Route 22 towns and post pins */
.map-frame { position: relative; }
.map-frame svg.zoomable { cursor: grab; touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; aspect-ratio: 1.6; max-height: none; background: var(--surface); border-radius: 8px; }
.map-frame svg.zoomable.dragging { cursor: grabbing; }
.map-frame svg path { vector-effect: non-scaling-stroke; }
.zoom-ctl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.zoom-ctl button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1.15rem; line-height: 1; cursor: pointer; box-shadow: 0 1px 3px var(--shadow); }
.zoom-ctl button:hover { background: var(--soft-bg); }
.town-labels circle { fill: #fff; stroke: #1d2320; stroke-width: 1.5; }
.town-labels text { font-size: 12px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.town-labels .lbl.hide { display: none; }
.pins .pin path, .pin-ico { fill: #d92d20; stroke: #fff; stroke-width: 1.5; }
.pins .pin circle { fill: #fff; }
.pins .pin:hover path, .pins .pin:focus path { fill: #a8140b; }
.pins .pin:focus { outline: none; }
.pins .pin:focus-visible path { stroke: var(--ink); stroke-width: 2.5; }
.map-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 10px 16px; border-radius: 10px;
  background: rgba(20, 24, 22, .82); color: #fff; font-size: .9rem; pointer-events: none; text-align: center; max-width: 80%; }

/* Phones: stack the search boxes and button, all the same width, so they line up */
@media (max-width: 600px) {
  .search { flex-direction: column; align-items: stretch; width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; }
  .search input, .search select, .search .btn { width: 100%; min-width: 0; }
  .search .clear { align-self: center; }
}

/* Control panel on phones/tablets: the menu becomes one row of buttons above the page (swipe sideways for more),
   instead of a pinned column that the page would scroll underneath. */
@media (max-width: 860px) {
  .admin-nav { position: static; flex-direction: row; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px;
    scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .admin-nav-title, .admin-nav hr, .admin-nav .build-tag { display: none; }
  .admin-nav a { flex: none; white-space: nowrap; padding: 7px 12px; border-radius: 999px; background: var(--surface);
    border: 1px solid var(--line); font-size: .9rem; }
  .admin-nav a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) !important; box-shadow: none; }
}
/* Phones: wide tables scroll sideways inside their box instead of making the whole page wider than the screen. */
.admin-main { min-width: 0; }
@media (max-width: 860px) {
  .admin-main .table, .map-page .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-main pre { max-width: 100%; overflow-x: auto; }
}
.map-legend span.muted { white-space: normal; }

/* Traffic page and home-page alert */
.traffic-page { max-width: 920px; margin: 28px auto 0; }
.traffic-page h1 { margin: 0 0 4px; }
.traffic-page .panel { margin-top: 18px; }
.traffic-page .panel h2 { margin-top: 0; }
.incident-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.incident-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.incident-list li.serious { border-color: #d92d20; box-shadow: inset 4px 0 0 #d92d20; }
.incident-list p { margin: 2px 0; }
.inc-icon { font-size: 1.4rem; line-height: 1.2; }
.inc-delay { color: var(--danger); font-weight: 600; }
.waze .range { margin: 4px 0 8px; flex-wrap: wrap; }
.waze-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 70vh; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
/* Waze's embed has no option to hide its own header, search box or footer links, so the frame is cropped: the map
   extends 96px above the box (header + search box) and 52px below it (logo, links line, "powered by" line).
   A "Live map by Waze" credit with Waze's links is shown under the box instead (views/traffic.ejs). */
.waze-frame iframe { position: absolute; left: 0; width: 100%; top: -96px; height: calc(100% + 96px + 52px); border: 0; }
@media (min-width: 860px) { .waze-frame { aspect-ratio: 16 / 10; } }
.traffic-alert { display: block; margin: 18px 0 0; padding: 12px 16px; border-radius: var(--radius); background: #fdecea; color: #7a1a12 !important;
  border: 1px solid #f3b8b1; text-decoration: none; }
.traffic-alert .ta-more { white-space: nowrap; font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .traffic-alert { background: #3a1714; color: #ffd2cc !important; border-color: #6b2a23; } }
:root[data-theme="dark"] .traffic-alert { background: #3a1714; color: #ffd2cc !important; border-color: #6b2a23; }

/* 22 News */
.news-page { max-width: 860px; margin: 28px auto 0; }
.news-page h1 { margin: 0 0 4px; }
.news-tabs { margin: 14px 0 16px; flex-wrap: wrap; }
.news-tabs .muted { font-weight: 400; margin-left: 2px; }
.news-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.news-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.news-item.cat-crash { box-shadow: inset 4px 0 0 #d92d20; }
.news-item.cat-roads { box-shadow: inset 4px 0 0 #f2c300; }
.news-icon { font-size: 1.3rem; line-height: 1.3; }
.news-body { flex: 1; min-width: 0; }
.news-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.news-title:hover { text-decoration: underline; }
.news-body p { margin: 3px 0 0; }
.news-mod { margin-left: auto; }
.news-list.compact .news-item { padding: 10px 12px; }
.home-news { margin-top: 28px; }

/* Post cards without a photo: a Route 22 sign on highway green with the gripe, instead of an empty grey box */
.card-img.no-photo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  background: var(--accent); box-shadow: inset 0 -5px 0 #f2c300; color: #fff; padding: 12px; text-align: center; }
.card-img.no-photo .np-shield .shield { width: 56px; height: 56px; border-radius: 6px; display: block; }
.card-img.no-photo .np-gripe { font-weight: 700; font-size: .95rem; letter-spacing: .01em; }
