:root {
  /* Light theme (default). Dark values are below; public/theme-init.js sets data-theme on <html>. */
  color-scheme: light;
  --bg: #faf8f5; --surface: #fff; --ink: #1f2328; --ink-2: #3a3f45; --muted: #6a6f76; --line: #e6e1d9; --line-soft: #f0ece6;
  --accent: #c2521f; --accent-hover: #9a3f15; --accent-ink: #fff; --link: #c2521f;
  --ok: #1f7a4d; --warn: #a86a00; --danger: #b42318; --star: #e3a008; --star-empty: #d6d0c6;
  --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: #fbe3d6; --role-admin-ink: #8a3410; --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: #c2521f; --accent-hover: #d9672f; --accent-ink: #fff; --link: #f0905f;
  --ok: #5cc995; --warn: #e5b04a; --danger: #f2837a; --star: #f2b632; --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-hover: #d9672f; --link: #f0905f;
    --ok: #5cc995; --warn: #e5b04a; --danger: #f2837a; --star: #f2b632; --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 { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; flex: none; }
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; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--img-bg); }
/* Every card's photo fills the same 4:3 frame, centred, so titles and text line up across a row (the full photo is on the review). */
.card-img img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.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; flex: 1; display: flex; flex-direction: column; }
.card-body .byline { margin-top: auto; }  /* name · date at the bottom of every card in a row */
.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; }

/* 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; } }

/* Approve / reject from an email link (views/mod/email-action.ejs) */
.email-action .email-choices { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; margin: 18px 0 8px; align-items: end; }
.email-action .email-choices form { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); display: grid; gap: 10px; }
.email-action .email-choices form.chosen { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.email-action .btn-approve { background: #1f7a3a; }
.email-action .btn-reject { background: #b3261e; }
@media (max-width: 620px) { .email-action .email-choices { grid-template-columns: 1fr; } }
.form-page.email-action { max-width: 760px; }
.spaced { margin-top: 12px; }

/* 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 { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-main pre { max-width: 100%; overflow-x: auto; }
}

/* Product link on a review (views/post.ejs) and for moderators */
.product-link { margin: -4px 0 10px; }
.product-link-label { color: var(--muted); }
.product-link a { word-break: break-all; }
.product-link-mod a { word-break: break-all; }

/* Moderator: edit a review (views/mod/edit.ejs) */
.form-page.edit-review { max-width: 760px; }
.edit-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.edit-photo { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface); }
.edit-photo-frame { aspect-ratio: 1; overflow: hidden; border-radius: 6px; display: grid; place-items: center; background: var(--soft-bg); }
.edit-photo-frame img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s ease; }
.edit-photo-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.edit-photo-tools .btn { min-width: 36px; padding: 4px 8px; font-size: 1.05rem; line-height: 1; }
.edit-photo-remove { display: flex; gap: 6px; align-items: center; font-size: .9rem; margin-left: auto; }
.edit-photo-remove input { width: auto; margin: 0; }
.edit-photo:has(.edit-photo-remove input:checked) { border-color: var(--danger); opacity: .6; }
.edit-photo.turned { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .edit-photo-frame img { transition: none; } }
/* Disputes (views/dispute.ejs, the Disputes section of views/post.ejs, views/mod/disputes.ejs) */
.dispute-cta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 4px 0 20px; }
.disputed-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--danger); color: var(--danger); font-size: .8rem; font-weight: 600; text-decoration: none; vertical-align: 1px; }
.disputes { margin: 8px 0 28px; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--danger); border-radius: 10px; background: var(--surface); }
.disputes h2 { margin-top: 0; }
.dispute + .dispute { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.dispute-relation { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--soft-bg); font-size: .8rem; }
.form-page.dispute-page { max-width: 760px; }
.disputed-review { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface); margin-bottom: 14px; }
.disputed-review p { margin: 2px 0; }
.disputed-title { font-weight: 600; }
/* My Story (views/index.ejs section, views/story.ejs page; written in Control panel → My Story) */
.my-story { margin: 8px 0 32px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.my-story h2 { margin-top: 0; }
.story-body p, .story-body li { line-height: 1.65; }
.story-body ul, .story-body ol { margin: 0 0 1em; padding-left: 1.6em; }
.story-body blockquote { margin: 0 0 1em; padding: 2px 0 2px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.story-more { font-weight: 600; }
.story-reviews-title { margin: 20px 0 10px; font-size: 1.05rem; }
.story-reviews { margin-bottom: 0; display: grid; gap: 20px; }
/* A linked review: its card, and its next three photos filling the space beside it */
.story-review { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: stretch; }
.story-photos { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; min-height: 0; }
.story-photos a { position: relative; display: block; overflow: hidden; border-radius: 12px; min-height: 140px; background: var(--img-bg); }
.story-photos img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-photos.n-3 a:first-child, .story-photos.n-2 a { grid-column: 1 / -1; }
.story-photos.n-1 a { grid-column: 1 / -1; grid-row: 1 / -1; }
@media (max-width: 760px) {
  .story-review { grid-template-columns: 1fr; }
  .story-photos { grid-template-rows: none; grid-auto-rows: 160px; }
}
.story-page { margin: 0; }

/* Cover photo: chosen on the review form (public/submit.js) and on the moderator Edit page */
.preview-pick { position: relative; padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; line-height: 0; }
.preview-pick img { display: block; }
.preview-pick .cover-tag { display: none; position: absolute; left: 4px; top: 4px; padding: 2px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.4; }
.preview-pick[aria-pressed="true"] { border-color: var(--accent); }
.preview-pick[aria-pressed="true"] .cover-tag { display: block; }
.preview-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.edit-photo-cover { display: flex; gap: 6px; align-items: center; font-size: .9rem; }
.edit-photo-cover input { width: auto; margin: 0; }
.edit-photo:has(.edit-photo-cover input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* Photo captions: boxes under each preview on the review form, captions under gallery photos and in the viewer */
.previews:has(.preview-item) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.preview-item { display: grid; gap: 6px; align-content: start; }
.preview-item .preview-pick { width: 100%; }
.preview-item input { font-size: .85rem; padding: 6px 8px; }
.gallery-photo { margin: 0; display: grid; gap: 6px; align-content: start; }
.gallery-photo figcaption { font-size: .88rem; color: var(--muted); line-height: 1.4; }
.lightbox .lb-caption { position: absolute; left: 0; right: 0; bottom: 40px; margin: 0 auto; max-width: min(90vw, 760px); padding: 6px 12px; text-align: center;
  color: #fff; font-size: .95rem; line-height: 1.4; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); pointer-events: none; }
.edit-photo-caption { font-size: .85rem; padding: 6px 8px; }
.lightbox .lb-stage { padding-bottom: 96px; }
@media (max-width: 600px) { .lightbox .lb-stage { padding-bottom: 110px; } .lightbox .lb-caption { bottom: 56px; } }

/* Front-page visitor map (views/index.ejs; picture from /visitor-map.svg) */
.visitor-map { margin: 36px 0 8px; }
.visitor-map-img { display: block; width: 100%; height: auto; max-width: 980px; margin: 10px auto 4px; }
.map-credit { text-align: center; }
.story-body a { word-break: break-all; }

/* Browse by place (front page) and more reviews (review page): plain links that search engines can follow */
.browse-places { margin: 32px 0 8px; }
.browse-label { margin: 14px 0 6px; font-size: 1rem; color: var(--muted); }
.browse-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.browse-list li { white-space: nowrap; }
.related { margin: 36px 0 12px; }
.related h2 { font-size: 1.3rem; margin-bottom: 14px; }

/* Formatting editor for review text (public/rich-editor.js) and formatted review text */
.rte-field { display: grid; gap: 6px; }
.rte-label { font-weight: 600; font-size: .92rem; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--soft-bg); }
.rte-btn { min-width: 36px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 400; cursor: pointer; }
.rte-btn:hover { background: var(--hover-tint); }
.rte-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.rte-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rte-b { font-weight: 700; } .rte-i { font-style: italic; } .rte-u { text-decoration: underline; } .rte-s { text-decoration: line-through; }
.rte-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.rte-editor { border: 1px solid var(--line); border-radius: 0 0 8px 8px; padding: 10px 12px; background: var(--input-bg); color: var(--ink); line-height: 1.5; overflow-wrap: anywhere; }
.rte-editor:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.rte-editor p, .post-body p { margin: 0 0 1em; }
.rte-editor p:last-child { margin-bottom: 0; }
.rte-editor ul, .rte-editor ol, .post-body ul, .post-body ol { margin: 0 0 1em; padding-left: 1.6em; }
.rte-editor blockquote, .post-body blockquote { margin: 0 0 1em; padding: 2px 0 2px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.rte-msg { color: var(--accent); margin: 0; }

.rte-bar { position: relative; }
.rte-emoji { position: absolute; z-index: 5; top: 100%; right: 0; left: 0; display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px var(--shadow); max-height: 220px; overflow: auto; }
.rte-emoji[hidden] { display: none; }
.rte-emoji button { width: 38px; height: 38px; font-size: 1.35rem; line-height: 1; border: 0; border-radius: 6px; background: transparent; cursor: pointer; padding: 0; }
.rte-emoji button:hover, .rte-emoji button:focus-visible { background: var(--hover-tint); outline: 2px solid var(--accent); }

/* Passkeys */
.passkey-box { text-align: center; margin-top: 14px; }
.passkey-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.passkey-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
