:root {
  color-scheme: light dark;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5b626b;
  --line: #dcdad3;
  --accent: #125e8a;
  --accent-text: #ffffff;
  --hover: #eef3f6;
  --warn-bg: #fdf1d8;
  --warn-text: #6b4a00;
  --error: #a4262c;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --surface: #1e2227;
    --text: #e8e9ea;
    --muted: #a3a9b1;
    --line: #363b42;
    --accent: #7cc0e8;
    --accent-text: #0b1a24;
    --hover: #272c33;
    --warn-bg: #3a2f14;
    --warn-text: #f3d48c;
    --error: #ff9b9f;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button, .button, input { font: inherit; color: inherit; }
button, .button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover:not(:disabled), .button:hover { background: var(--hover); }
button:disabled { opacity: .4; cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover, .button.primary:hover { background: var(--accent); filter: brightness(1.1); }

input[type="search"], input[type="text"] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  width: 100%;
}

/* Header */
/* Stays at the top while the page scrolls, above the calendar and the lists; clear of a phone's notch. */
.site-header { background: var(--accent); position: sticky; top: 0; z-index: 6; padding-top: env(safe-area-inset-top); }
html { scroll-padding-top: calc(60px + env(safe-area-inset-top)); }
.header-row { display: flex; justify-content: space-between; align-items: center; min-height: 52px; gap: 12px; }
/* The app's icon (home), then the name of the tab being viewed. */
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--accent-text); text-decoration: none; }
.brand-row .brand { display: inline-flex; flex: none; border-radius: 8px; }
.brand img { display: block; width: 32px; height: 32px; border-radius: 8px; }
.tab-title { font-weight: 700; font-size: 1.15rem; color: var(--accent-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand:focus-visible { outline-color: var(--accent-text); }
/* Add a poster: quiet, in the header's own colours. */
.poster-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; background: transparent; color: var(--accent-text);
  border: 0; border-radius: 8px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.poster-button:hover:not(:disabled) { background: color-mix(in srgb, var(--accent-text) 14%, transparent); }
.poster-button svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.poster-button:focus-visible { outline-color: var(--accent-text); }
/* Narrow phones: the camera alone, so the title keeps to one line beside the tip jar and the QR. */
@media (max-width: 384px) { .poster-button span { display: none; } }
.header-actions { display: flex; align-items: center; gap: 2px; margin-right: -8px; }
/* The tip jar and Share the app: bare icons, sized as in Planning Map (cup 22px, QR 20px). */
.share-button { display: inline-flex; align-items: center; justify-content: center; padding: 8px; background: transparent;
  color: var(--accent-text); border: 0; border-radius: 8px; flex: none; }
.share-button:hover { background: color-mix(in srgb, var(--accent-text) 14%, transparent); }
#tip-button svg { width: 22px; height: 22px; }
#share-button svg { width: 20px; height: 20px; }
.share-button svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share-button:focus-visible { outline-color: var(--accent-text); }
.share-dialog { width: min(380px, calc(100vw - 24px)); text-align: center; }
.share-dialog h2 { padding: 0 2rem; }
.share-qr { width: min(260px, 70vw); margin: 12px auto 6px; padding: 8px; background: #fff; border-radius: 8px; }
.share-qr svg { display: block; width: 100%; height: auto; }
.share-url { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; margin: 0; }
.tip-cup svg { width: 44px; height: 44px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tip-link { display: inline-block; margin: 6px 0 2px; padding: 10px 22px; border-radius: var(--radius); background: var(--accent); color: var(--accent-text); font-weight: 700; text-decoration: none; }
.tip-link:hover { filter: brightness(1.08); }
.poster-form label, .poster-dialog label[for] { display: block; font-weight: 600; margin: 10px 0 4px; }
.poster-form input, .poster-dialog textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font: inherit; color: inherit; }
.poster-form input { text-transform: uppercase; letter-spacing: .06em; }
.poster-preview { display: block; max-width: 100%; max-height: 45dvh; margin: 0 auto 6px; border-radius: var(--radius); }
.poster-who { margin-top: 16px; font-size: .9rem; }
.link-button { padding: 0; border: 0; background: none; color: var(--link, var(--accent)); text-decoration: underline; font-size: inherit; cursor: pointer; }
.link-button:hover:not(:disabled) { background: none; }
label.button { cursor: pointer; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 16px 0 10px; }
.views { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.views a { padding: 6px 12px; text-decoration: none; color: var(--text); background: var(--surface); }
.views a + a { border-left: 1px solid var(--line); }
.views a:hover { background: var(--hover); }
.views a.active { background: var(--accent); color: var(--accent-text); }
.pager { display: flex; align-items: center; gap: 8px; flex: 1 1 280px; min-width: 0; }
.pager h1 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.pager button { padding: 2px 12px; font-size: 1.2rem; line-height: 1.3; }

/* Keeps the view buttons and Choose on one line on narrow phones, scaling with the screen width:
   "Next 7 days" is "7 days" there. */
@media (max-width: 480px) {
  .toolbar { column-gap: 6px; }
  .views .wide-only { display: none; }
  .views a, #calendar-button {
    padding: 6px clamp(5px, 2.4vw, 12px);
    font-size: clamp(.75rem, 3.9vw, 1rem);
    white-space: nowrap;
  }
}

/* Date picker */
/* Anchored to the toolbar rather than the button, so that it fits on a phone screen. */
.toolbar { position: relative; }
.calendar {
  position: absolute;
  left: 0;
  z-index: 5;
  margin-top: 6px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
}
.calendar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.calendar-head button { padding: 0 10px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.calendar-weekday { font-size: .75rem; color: var(--muted); padding: 2px 0; }
.calendar-grid button { padding: 5px 0; border: 0; background: none; border-radius: 4px; font-size: .9rem; }
.calendar-grid button:hover:not(:disabled) { background: var(--hover); }
.calendar-grid button.outside { color: var(--muted); }
.calendar-grid button.selected { background: var(--hover); font-weight: 600; }
.calendar-grid button.now { outline: 1px solid var(--accent); }
.calendar-month-link { display: block; margin-top: 8px; text-align: center; font-size: .9rem; }

/* Filters */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.search-row { flex: 1 1 260px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.search { flex: 1 1 auto; position: relative; min-width: 0; }
/* Room on the right for the microphone, inside the box. */
.search:has(.voice-button:not([hidden])) input { padding-right: 40px; }
.voice-button { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); display: inline-flex; padding: 4px 6px; border: 0;
  background: none; color: var(--accent); border-radius: 50%; }
.voice-button[hidden], .all-tabs[hidden] { display: none; }
.voice-button:hover:not(:disabled) { background: var(--hover); }
.voice-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.voice-button.listening { color: var(--error); animation: listening 1.2s ease-in-out infinite; }
.voice-button.listening svg rect { fill: currentColor; }
@keyframes listening { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .voice-button.listening { animation: none; } }
.voice-note { flex-basis: 100%; margin: 0; font-size: .88rem; color: var(--warn-text); }
.voice-note[hidden] { display: none; }
/* Search every tab: on, it's in the accent colour, like a pressed button above. */
.all-tabs { flex: none; padding: 5px 10px; border-radius: 14px; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.all-tabs[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.all-tabs[aria-pressed="true"]:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
.everywhere-count { color: var(--muted); font-weight: 400; }
.everywhere-open { float: right; font-size: .85rem; font-weight: 400; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.venue-filter summary { cursor: pointer; }
.venue-toggle { display: block; margin-top: 8px; padding: 3px 10px; font-size: .9rem; }
.venue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin-top: 6px; }
.venue-filter[open] { flex-basis: 100%; }

/* Results */
#results.loading { opacity: .45; }
.summary { color: var(--muted); margin: 12px 0 4px; min-height: 1.4em; font-size: .95rem; }
.summary-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.roadworks-map-button { margin-top: 8px; padding: 6px 12px; font-size: .9rem; border-color: #ffa31a; }
.roadworks-map-button[hidden] { display: none; }
.map-frame-large { height: min(62dvh, 560px); }
.map-frame .leaflet-popup-content { margin: 10px 12px; }
.rw-popup { display: grid; gap: 6px; justify-items: start; font-size: .82rem; line-height: 1.35; }
.rw-popup button { padding: 4px 12px; font-size: .85rem; }
.rw-popup p { margin: 0; }
.empty { padding: 28px 0; color: var(--muted); }
.day h2 { font-size: 1rem; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.event-list { list-style: none; margin: 0; padding: 0; }
.event {
  display: grid;
  grid-template-columns: 5.2em 1fr;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 4px;
}
.event-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-main { min-width: 0; }
.event-title { display: block; font-weight: 600; }
.event-meta { display: block; color: var(--muted); font-size: .9rem; }
/* After a place on the Pubs tab that's a restaurant rather than a pub. */
.restaurant-mark { font-size: .95em; cursor: help; }
/* On a day's deals: a small "+" in the Deals colour, as the pub has offers on every day too, in the popup. */
.every-day-mark { color: #8a5a00; font-weight: 700; cursor: help; }
@media (prefers-color-scheme: dark) { .every-day-mark { color: #e0a43a; } }
.cancelled .event-title, .month-event.cancelled .month-event-text { text-decoration: line-through; }

.dot { display: inline-block; flex: none; width: .65em; height: .65em; border-radius: 50%; margin-right: .4em; background: var(--muted); }
/* Colours say what kind of show it is, matching the buttons above. The venue tag's text says where. */
.venue-tag { flex: none; width: 4.6em; margin-right: .45em; padding: 0 2px; border: 1.5px solid var(--muted); border-radius: 4px;
  font-size: .72em; font-weight: 600; line-height: 1.45; text-align: center; white-space: nowrap; overflow: hidden; color: var(--text); }
[data-kind="film"] { --kind: #1f6fb2; }
[data-kind="theatre"] { --kind: #b0303f; }
[data-kind="music"] { --kind: #6b3fa0; }
[data-kind="opera"] { --kind: #8a5300; }
[data-kind="dance"] { --kind: #b02f7c; }
/* Yellow is too pale for white writing, so comedy has dark. */
[data-kind="comedy"] { --kind: #f5c518; --kind-text: #1f2328; }
[data-kind="family"] { --kind: #2e7d32; }
[data-kind="talks"] { --kind: #00707a; }
[data-kind="services"] { --kind: #4f5b6b; }
[data-kind="other"] { --kind: #6b6b6b; }
.dot[data-kind] { background: var(--kind); }
.event-time .venue-tag { display: block; margin-top: 4px; font-size: .78em; }
/* Area names run longer than venues' short names, so these boxes fit their words. */
.event-time .pub-tag { width: auto; min-width: 4.6em; max-width: max-content; padding: 0 5px; }
.venue-tag[data-kind] { border-color: var(--kind); background: var(--kind); color: var(--kind-text, #fff); }
/* Rows of equal buttons, filled when on and outlined when off. */
.kind-pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; flex-basis: 100%; }
/* All, first in each row of buttons, in the site's own blue. */
.all-pill { --kind: var(--accent); --kind-text: var(--accent-text); }
.kind-pill { padding: 5px 2px; border: 1.5px solid var(--kind); border-radius: 14px; background: var(--kind); color: var(--kind-text, #fff);
  font: inherit; font-size: .82rem; font-weight: 600; line-height: 1.3; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kind-pill[aria-pressed="false"] { background: transparent; color: var(--text); }
/* Buttons' usual hover colour would hide which state it's in. */
.kind-pill:hover:not(:disabled) { background: var(--kind); filter: brightness(1.1); }
.kind-pill[aria-pressed="false"]:hover:not(:disabled) { background: var(--hover); filter: none; }
.kind-pills[hidden] { display: none; }
/* Narrow phones: labels need every pixel of their column. */
.kind-pill.long-word { padding-inline: 0; font-size: .76rem; letter-spacing: -.02em; }
@media (max-width: 359px) { .kind-pill { padding-inline: 0; } }
.pub-pills { grid-template-columns: repeat(3, 1fr); }
[data-kind="pub-live-music"] { --kind: #6b3fa0; }
[data-kind="pub-open-mic"] { --kind: #c2410c; }
[data-kind="pub-quiz"] { --kind: #1f6fb2; }
[data-kind="pub-deals"] { --kind: #8a5a00; }
[data-kind="pub-other"] { --kind: #2e7d32; }
/* Festivals: music in purple as elsewhere, each genre its own colour, then food, drink and the rest. */
.festival-pills { grid-template-columns: repeat(4, 1fr); }
[data-kind="fest-music"] { --kind: #6b3fa0; }
[data-kind="fest-rock"] { --kind: #b0303f; }
[data-kind="fest-folk"] { --kind: #2e7d32; }
[data-kind="fest-jazz"] { --kind: #1f6fb2; }
[data-kind="fest-blues"] { --kind: #2c3e9e; }
[data-kind="fest-country"] { --kind: #8a5300; }
[data-kind="fest-soul"] { --kind: #b02f7c; }
[data-kind="fest-food"] { --kind: #c2410c; }
/* Amber, like a pint: too pale for white writing. */
[data-kind="fest-drink"] { --kind: #f5b301; --kind-text: #1f2328; }
[data-kind="fest-family"] { --kind: #00707a; }
[data-kind="fest-other"] { --kind: #6b6b6b; }
/* Events and Ongoing. */
[data-kind="town-music"] { --kind: #6b3fa0; }
[data-kind="town-comedy"] { --kind: #f5c518; --kind-text: #1f2328; }
[data-kind="town-stage"] { --kind: #b0303f; }
[data-kind="town-family"] { --kind: #00707a; }
[data-kind="town-markets"] { --kind: #c2410c; }
[data-kind="town-art"] { --kind: #8a5300; }
[data-kind="town-active"] { --kind: #1f6fb2; }
[data-kind="town-lights"] { --kind: #b02f7c; }
[data-kind="town-cruises"] { --kind: #2c3e9e; }
/* Amber, like a roadworks sign: too pale for white writing. */
[data-kind="town-roadworks"] { --kind: #ff9f1c; --kind-text: #1f2328; }
[data-kind="town-other"] { --kind: #6b6b6b; }
/* Roadworks by type, as on the map: red for a closed road, blue for lights, amber for a contraflow. */
.roadwork-pills { grid-template-columns: repeat(4, 1fr); }
.pills-label { grid-column: 1 / -1; margin-top: 2px; font-size: .85rem; color: var(--muted); }
[data-kind="rw-closure"] { --kind: #c62828; }
[data-kind="rw-lights"] { --kind: #1565c0; }
[data-kind="rw-contraflow"] { --kind: #ffa31a; --kind-text: #1f2328; }
[data-kind="rw-other"] { --kind: #6b6b6b; }
[data-kind="rw-mine"] { --kind: #7b1fa2; }
/* My pubs: the Pubs tab's button for just them, the list to tick them on, and the popup's button. */
[data-kind="my-pubs"] { --kind: #00695c; }
.my-pubs-search { width: 100%; margin: 4px 0 8px; }
.my-pubs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 60vh; overflow-y: auto; font-size: .92rem; }
.my-pubs-list label { display: flex; align-items: baseline; gap: 6px; padding: 4px 2px; cursor: pointer; }
.my-pubs-list input { flex: none; accent-color: #00695c; }
.star-button.my-pub-button[aria-pressed="true"] { color: #00695c; border-color: #00695c; background: #e0f2ef; }
@media (prefers-color-scheme: dark) {
  .star-button.my-pub-button[aria-pressed="true"] { color: #4db6ac; border-color: #4db6ac; background: transparent; }
}
.my-roads-pills { grid-template-columns: repeat(4, 1fr); }
/* Distance, set on the Pubs tab for every tab: the slider, how far, and where from. */
.distance-row { display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 6px 8px; flex-basis: 100%; }
.distance-step { width: 30px; height: 30px; padding: 0; border-radius: 50%; font-size: 1.1rem; font-weight: 700; line-height: 1; }
.distance-row[hidden] { display: none; }
.distance-label { font-weight: 600; font-size: .9rem; }
.distance-row input[type="range"] { width: 100%; min-width: 0; accent-color: var(--accent); }
.distance-value { font-size: .9rem; white-space: nowrap; min-width: 6.5em; text-align: right; }
@media (max-width: 420px) { .distance-value { min-width: 0; } }
.distance-from { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.distance-from button { padding: 4px 10px; border-radius: 14px; font-size: .85rem; }
.distance-from button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.distance-from input { flex: 1; min-width: 0; max-width: 10em; text-transform: uppercase; }
.distance-from input::placeholder { text-transform: none; }
.distance-note { flex-basis: 100%; margin: 0; font-size: .88rem; color: var(--muted); }
.distance-note[hidden] { display: none; }
.distance-note .link-button { margin-left: 6px; }
.my-roads-edit { grid-column: span 3; justify-self: start; padding: 6px 12px; font-size: .9rem; }
.my-roads-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: .9rem; }
.my-roads-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.link-button { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; cursor: pointer; }
.rw-works { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.rw-label { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--kind); color: var(--kind-text, #fff); font-size: .85rem; font-weight: 600; }
.rw-how { color: var(--muted); }
.rw-key { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--text); }
.rw-key li { display: flex; align-items: center; gap: 6px; }
.rw-swatch { width: 36px; height: 10px; flex: none; }

/* Month */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin-top: 8px; }
.month-head { padding: 4px 6px; font-size: .8rem; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.month-day { min-height: 104px; padding: 3px 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); min-width: 0; }
.month-day.outside { background: transparent; }
.month-day.outside .month-date { color: var(--muted); }
.month-day.now .month-date { font-weight: 700; color: var(--accent); }
.month-date { font-size: .85rem; color: var(--text); text-decoration: none; }
.month-date:hover { text-decoration: underline; }
.month-day ul { list-style: none; margin: 2px 0 0; padding: 0; }
.month-event { display: flex; align-items: baseline; width: 100%; border: 0; background: none; padding: 1px 2px; text-align: left; font-size: .78rem; line-height: 1.3; }
.month-event-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.on-narrow { display: none; }

@media (max-width: 720px) {
  .month { display: block; border: 0; }
  .month-head, .month-day.none, .month-day.outside { display: none; }
  .month-day { min-height: 0; border: 0; border-bottom: 1px solid var(--line); padding: 8px 4px; background: none; }
  .month-date { font-weight: 600; }
  .month-event { font-size: .95rem; padding: 3px 2px; }
  .on-wide { display: none; }
  .on-narrow { display: inline; }
  .event { grid-template-columns: 4.4em 1fr; }
}
/* Pubs' area names ("Christchurch", "Ashley Cross") need a wider column than times and venues' short names. */
body[data-tab="pubs"] .event { grid-template-columns: 6.4em 1fr; }

/* Dialogs */
.dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
}
.dialog::backdrop { background: rgb(0 0 0 / .5); }
/* Takes up no height, so the button floats over the image, and stays in view while scrolling. */
.dialog-close-holder { position: sticky; top: 0; height: 0; display: flex; justify-content: flex-end; z-index: 2; }
.dialog-close {
  width: 2.25rem;
  height: 2.25rem;
  margin: -8px -10px 0 0;
  padding: 0;
  flex: none;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  box-shadow: 0 1px 5px rgb(0 0 0 / .3);
}
.dialog h2 { margin: 0 0 6px; padding-right: 2rem; font-size: 1.25rem; }
.dialog h2:focus { outline: none; }
.dialog h3 { margin: 14px 0 4px; font-size: 1rem; }
/* Shown whole, not cropped: some are posters with the programme printed on them. */
.event-image-link { display: block; margin-bottom: 12px; }
/* Festival logos are often see-through, made for a site's own background: pale ones vanish on white and
   dark ones on black, so a mid grey suits either. Photos and posters cover it. */
.event-image { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #8a9099; }
.event-facts { margin: 0; color: var(--muted); }
.event-hours { margin-top: 8px; white-space: pre-line; }
.event-description { white-space: pre-line; margin: 12px 0; overflow-wrap: anywhere; }
.other-dates ul { margin: 0; padding: 0; list-style: none; columns: 2; font-size: .92rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.error { color: var(--error); }
.warning { background: var(--warn-bg); color: var(--warn-text); padding: 8px 12px; border-radius: var(--radius); }

/* Footer */
.site-footer { color: var(--muted); font-size: .85rem; padding-top: 18px; padding-bottom: 28px; }
.site-footer p { margin: 0 0 8px; }

/* Tabs. The page leaves room below its content so that they never cover the end of it. */
body { padding-bottom: calc(3.4rem + env(safe-area-inset-bottom)); }
.tabs {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 4;
  display: flex;
  /* In the header's colour, as in the other apps. */
  background: var(--accent);
  padding-bottom: env(safe-area-inset-bottom);
}
/* Each tab takes an equal share, so more can be added. An outline icon fills in when selected. */
.tabs a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 5px;
  font-size: .72rem;
  line-height: 1.2;
  text-decoration: none;
  color: color-mix(in srgb, var(--accent-text) 72%, transparent);
}
/* Only with a mouse: on a touchscreen the tint would stay on the last tab tapped. */
@media (hover: hover) { .tabs a:hover { background: color-mix(in srgb, var(--accent-text) 12%, transparent); } }
.tabs a.active { color: var(--accent-text); font-weight: 600; }
.source-note { margin: 18px 0 0; font-size: .85rem; }
.tabs a:focus-visible { outline-color: var(--accent-text); outline-offset: -4px; }
.tab-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.tabs a.active .tab-icon { fill: currentColor; }
.tabs a.active .tab-icon-cut { fill: var(--accent); stroke: none; }
.tabs a.active .tab-icon-line { stroke: var(--accent); }
.tabs a.active .tab-icon-open { fill: none; }
/* Starred things: a gold star after the title in any list, and the popup's button to star or unstar. */
.star-mark { color: #c99400; }
.star-button[aria-pressed="true"] { color: #8a6500; border-color: #c99400; background: #fff6d6; }
@media (prefers-color-scheme: dark) {
  .star-mark { color: #f5c518; }
  .star-button[aria-pressed="true"] { color: #f5c518; border-color: #f5c518; background: transparent; }
}
.month-event-text.with-place { overflow: visible; white-space: normal; overflow-wrap: anywhere; min-width: 0; font-weight: 600; }
.month-event-place { display: block; color: var(--muted); font-size: .92em; font-weight: 400; }
.map-frame { height: min(60dvh, 440px); margin-top: 10px; }
.map-frame iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: var(--radius); }
.map-frame.map-missing { height: auto; }
.map-canvas { width: 100%; height: 100%; border-radius: var(--radius); }
.map-note { margin: 8px 0 0; font-size: .85rem; }

/* Status page */
.status-page { padding-bottom: 28px; }
.status-heading { font-size: 1.3rem; margin: 18px 0 6px; }
.status-subheading { font-size: 1.05rem; margin: 22px 0 6px; }
.status-problems { margin: 0; padding-left: 1.2em; color: var(--error); overflow-wrap: anywhere; }
.status-table-wrap { overflow-x: auto; }
.status-table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
.status-table th, .status-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.status-table th { color: var(--muted); font-weight: 600; }
.status-bad td { color: var(--error); }
.past .event-title, .past .event-time, .past .event-meta { opacity: .6; }
.past .event-title { font-weight: 500; }
.expected-note { margin: .25rem 0 .5rem; font-size: .9rem; }

/* Admin page: posters and their events waiting for approval. */
.admin-card { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 600px) { .admin-card { grid-template-columns: 1fr; } }
.admin-poster { display: block; width: 100%; height: auto; border-radius: var(--radius); background: #8a9099; }
.admin-card-body p { margin: 0 0 8px; }
/* Cropping: the photo takes the card's full width, to be big enough to work on. */
.admin-card.cropping, .admin-card.admin-print { grid-template-columns: 1fr; }
.admin-approve-all { align-items: center; gap: 10px; margin-bottom: 12px; }
.admin-photo-tools { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: .9rem; }
.crop-help { margin: 0 0 8px; font-size: .9rem; }
.crop-area { position: relative; display: block; max-width: min(100%, 640px); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; border-radius: var(--radius); }
.crop-area img { display: block; width: 100%; height: auto; pointer-events: none; }
.crop-box { position: absolute; border: 2px solid #fff; outline: 1px solid #000; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); cursor: move; }
.crop-handle { position: absolute; width: 18px; height: 18px; background: #fff; border: 1px solid #000; border-radius: 50%; }
.crop-handle.nw { left: -10px; top: -10px; cursor: nwse-resize; }
.crop-handle.ne { right: -10px; top: -10px; cursor: nesw-resize; }
.crop-handle.sw { left: -10px; bottom: -10px; cursor: nesw-resize; }
.crop-handle.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
.admin-note { white-space: pre-line; }
.admin-photo-choice { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: .9rem; }
.admin-event { padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.admin-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.admin-field { display: flex; flex-direction: column; gap: 2px; font-size: .85rem; font-weight: 600; }
.admin-field[hidden] { display: none; }
.admin-field input, .admin-field select, .admin-field textarea { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font: inherit; font-weight: 400; color: inherit; }
.admin-field:has(textarea) { grid-column: 1 / -1; }
.admin-shown { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.admin-inline { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.admin-inline input { flex: 1 1 200px; width: auto; text-transform: none; letter-spacing: normal; }
.admin-inline label { width: 100%; }
.admin-new-code p { margin: 0 0 4px; }
.admin-code { font-size: 1.4rem; font-weight: 700; letter-spacing: .08em; font-variant-numeric: tabular-nums; user-select: all; }
.admin-form input { text-transform: none; letter-spacing: normal; }
.admin-signout { margin-top: 28px; }
