/* Shared by the viewer and the planner: colour tokens, base, key strip, cards, seat map. */
:root {
  --bg: #f7f6f3; --panel: #ffffff; --ink: #1d1d1b; --muted: #6b6a65; --line: #d9d7d0; --soft: #efeee9;
  --seat: #ffffff; --seat-line: #3a3a36; --seat-ink: #3a3a36;
  --w: #2f6fb3; --w-bg: #e3eefa; --x: #9a9892; --x-bg: #eeede9; --r: #b86a12; --r-bg: #fbefdf; --l-bg: #d3d2cc;
  --acc: #16796f; --acc-bg: #e1f1ee; --ok: #2e7d4f; --bad: #b3261e; --hover: #1d1d1b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151514; --panel: #1f1f1d; --ink: #ecebe6; --muted: #a09e97; --line: #3a3936; --soft: #2a2a27;
    --seat: #262624; --seat-line: #b9b7b0; --seat-ink: #d6d4cd;
    --w: #7fb2ea; --w-bg: #1d2e42; --x: #7c7a74; --x-bg: #2a2a28; --r: #e8a656; --r-bg: #3a2a15; --l-bg: #4a4944;
    --acc: #5fc4b8; --acc-bg: #173a36; --ok: #6fcf97; --bad: #f28b82; --hover: #ffffff;
  }
}
:root[data-theme="dark"] {
  --bg: #151514; --panel: #1f1f1d; --ink: #ecebe6; --muted: #a09e97; --line: #3a3936; --soft: #2a2a27;
  --seat: #262624; --seat-line: #b9b7b0; --seat-ink: #d6d4cd;
  --w: #7fb2ea; --w-bg: #1d2e42; --x: #7c7a74; --x-bg: #2a2a28; --r: #e8a656; --r-bg: #3a2a15; --l-bg: #4a4944;
  --acc: #5fc4b8; --acc-bg: #173a36; --ok: #6fcf97; --bad: #f28b82; --hover: #ffffff;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "PingFang HK", "Noto Sans HK", sans-serif; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 20px; padding-bottom: 10px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: end; justify-content: space-between; }
header > div { min-width: 0; }
.headctl { display: flex; align-items: center; gap: 8px; min-width: 0; }
.headctl #venue { min-width: 0; max-width: min(60vw, 460px); text-overflow: ellipsis; }
h1 { font-size: 20px; margin: 0 0 2px; font-weight: 650; }
.sub { color: var(--muted); }
.byline { color: var(--muted); font-size: 12px; margin-top: 2px; }
.byline a { color: inherit; }
select, button { font: inherit; color: var(--ink); }
select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); max-width: 100%; }

/* key figures: pinned while scrolling */
.keybar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; padding-top: 10px; padding-bottom: 10px; }
.key { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
.key b { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.key span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key.main { background: var(--acc-bg); border-color: var(--acc); grid-column: span 2; }
.key.main b { font-size: 26px; color: var(--acc); }
.key .ok { color: var(--ok); } .key .neg { color: var(--bad); }
.key.alert { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.key.alert b { color: var(--bad); }
.key.flash b { animation: flash .5s ease; }
@keyframes flash { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .key.flash b { animation: none; } }
@media (max-width: 600px) {
  /* one compact row that scrolls sideways, so the pinned strip stays short */
  .keys { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  .key { padding: 4px 8px; } .key b { font-size: 16px; } .key.main { grid-column: auto; } .key.main b { font-size: 20px; }
  .key span { font-size: 11px; }
}
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.card { scroll-margin-top: calc(var(--keys-h, 80px) + 12px); }
.card h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 12px; font-weight: 650; }

.switch { appearance: none; flex: none; width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.switch:checked { background: var(--acc); } .switch:checked::after { transform: translateX(12px); }
.switch:focus-visible, .seg input:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* light/dark switch: sun and moon icons with a sliding knob (see theme.js) */
.themeswitch { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: space-between;
  width: 64px; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 15px;
  background: var(--soft); cursor: pointer; }
.themeswitch:hover { border-color: var(--muted); }
.themeswitch:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.themeswitch .knob { position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 1px 2px rgb(0 0 0 / .25);
  transition: transform .18s ease; }
.themeswitch .ico { position: relative; z-index: 1; width: 15px; height: 15px; fill: none; stroke: var(--muted);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke .18s; }
.themeswitch[aria-checked="true"] .knob { transform: translateX(34px); }
.themeswitch[aria-checked="false"] .sun { stroke: var(--r); }
.themeswitch[aria-checked="true"] .moon { stroke: var(--acc); }
/* before the script runs, follow the system preference so the switch does not flicker */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .themeswitch:not([aria-checked="true"]) .knob { transform: translateX(34px); }
  :root:not([data-theme="light"]) .themeswitch:not([aria-checked="true"]) .sun { stroke: var(--muted); }
  :root:not([data-theme="light"]) .themeswitch:not([aria-checked="true"]) .moon { stroke: var(--acc); }
}
@media (prefers-reduced-motion: reduce) { .themeswitch .knob, .themeswitch .ico { transition: none; } }

.tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.tools button { font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer; border: 1px solid var(--line); background: var(--bg); }
.swatch { display: inline-flex; align-items: center; gap: 5px; margin-right: 12px; }
/* the map frame: fixed height, scrolls; the drawing is sized by the zoom (seatmap.js) */
#map { margin-top: 12px; height: clamp(340px, calc(100vh - var(--keys-h, 80px) - 150px), 1400px); overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overscroll-behavior: contain; }
#map svg { display: block; margin: 0 auto; }
.zoomctl { display: inline-flex; align-items: center; gap: 4px; }
.zoomctl button { min-width: 30px; font-size: 13px; line-height: 1.2; }
.zoomctl .zlevel { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.seat rect { fill: var(--seat); stroke: var(--seat-line); stroke-width: 1; }
.seat text { fill: var(--seat-ink); font-size: 7.5px; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; pointer-events: none; }
.seat.W rect { fill: var(--w-bg); stroke: var(--w); } .seat.W text { fill: var(--w); font-weight: 700; }
.seat.X rect { fill: var(--x-bg); stroke: var(--x); } .seat.X text { fill: var(--x); }
.seat.X line { stroke: var(--x); stroke-width: 1; pointer-events: none; }
.seat.R rect { fill: var(--r-bg); stroke: var(--r); } .seat.R .inner { fill: none; stroke: var(--r); stroke-width: .8; }
.seat.R text { fill: var(--r); }
.seat.L rect { fill: var(--l-bg); }
.seat.off { opacity: .22; } .seat.off rect { stroke-dasharray: 2.5 1.5; }
.seat:hover rect, .seat:focus rect { stroke: var(--hover); stroke-width: 2; }
.seat:focus { outline: none; }
.pitband { display: none; } .pitband.on { display: inline; }
.pitband rect, .pitband polygon { fill: none; stroke: var(--r); stroke-dasharray: 4 3; }
.pitband text { fill: var(--r); font-size: 11px; font-weight: 650; dominant-baseline: central; }
.blockedarea { fill: var(--ink); }
.standing rect { fill: none; stroke: var(--muted); stroke-dasharray: 2 2; }
.standing text { fill: var(--muted); font-size: 7.5px; text-anchor: middle; dominant-baseline: central; }
.standing.on rect { stroke: var(--acc); stroke-dasharray: none; fill: var(--acc-bg); } .standing.on text { fill: var(--acc); }
.standing .place:hover rect, .standing .place:focus rect { stroke: var(--hover); stroke-width: 2; }
.rowlabel { fill: var(--muted); font-size: 10px; font-weight: 600; dominant-baseline: central; }
/* developer overlay: aisles, block axes and boundaries (shown by the Developer mode toggle) */
.dev { display: none; }
.devmode .dev { display: block; }
.dev-aisle { fill: none; stroke: var(--acc); stroke-width: 1; stroke-dasharray: 5 3; }
.dev-inner, .dev-outer { fill: none; stroke: var(--muted); stroke-width: .8; stroke-dasharray: 3 3; }
.dev-axis { fill: none; stroke: var(--bad); stroke-width: 1; }
.dev-dot { fill: var(--bad); }
.dev-label { fill: var(--bad); font-size: 6.5px; text-anchor: middle; display: none; }
/* the overlay is dim; a highlighted element (and its label) comes forward */
.dev > :not(.hl) { opacity: .2; }
.hl { stroke: #f59e0b !important; stroke-width: 2.6 !important; opacity: 1 !important; }
.dev > .dev-label.hl { display: block; opacity: 1; fill: #f59e0b; }
.dev > .dev-grid { opacity: 1; }
.dev-grid line, .dev-grid circle { fill: none; stroke: var(--line); stroke-width: .5; }
.dev-grid .major { stroke: var(--muted); stroke-width: .6; stroke-dasharray: 2 3; }
.dev-grid text { fill: var(--muted); font-size: 7px; }
.devlabels .dev > .dev-label { display: block; opacity: .85; }
.seat.geo-hl rect { stroke: #f59e0b; stroke-width: 2.4; }
/* vomitorium: an entrance cutting a gap through some rows only */
.vomitorium { fill: var(--acc-bg); stroke: var(--acc); stroke-width: .8; stroke-dasharray: 4 3; opacity: .5; }
.vomitorium-label { fill: var(--acc); font-size: 9px; font-weight: 700; text-anchor: middle; }
.zonelabel { fill: var(--ink); font-size: 13px; font-weight: 650; text-anchor: middle; }
.zonelabel.off { fill: var(--muted); text-decoration: line-through; }
.stage { fill: var(--bg); stroke: var(--line); }
.disclaimer rect { fill: var(--bg); stroke: var(--line); }
.disclaimer text { fill: var(--ink); font-size: 10px; }
.disclaimer .lead { font-weight: 700; }
.disclaimer a text { fill: var(--acc); text-decoration: underline; }
/* a customised version (the customiser, the planner): the user's own, not published data */
.disclaimer.custom rect { fill: var(--acc-bg); stroke: var(--acc); }
.disclaimer.custom .lead { fill: var(--acc); }
.stagetext { fill: var(--muted); font-size: 11px; text-anchor: middle; dominant-baseline: central; letter-spacing: .1em; }
.note { color: var(--muted); font-size: 12px; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--panel); }
.btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--r-bg); color: var(--r); font-weight: 600; }
.tag.ok { background: var(--acc-bg); color: var(--ok); }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num { text-align: right; }
td.num.alert { color: var(--bad); font-weight: 700; }
.tablewrap { overflow-x: auto; }
#tip { position: fixed; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 9px; border-radius: 6px; font-size: 12px; max-width: 280px; display: none; z-index: 10; }
#tip b { font-size: 13px; }
#tip .off { color: color-mix(in srgb, var(--bg) 70%, var(--bad)); }
footer.site { border-top: 1px solid var(--line); margin-top: 8px; padding: 20px 0 36px; font-size: 13px; color: var(--muted); }
footer.site h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; margin: 0 0 8px; }
footer.site p { margin: 0 0 8px; max-width: 820px; overflow-wrap: anywhere; }
footer.site a { color: inherit; }
footer.site .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.err { color: var(--bad); }
