:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --text: #1b1a17;
  --muted: #6f6a61;
  --border: #e4e0d8;
  --gold: #c8a04e;
  --gold-dark: #a5823a;
  --ink: #0e0d0b;
  --radius: 16px;
  /* category colors */
  --c-music: #2f6bd8;
  --c-musical: #7b3fe4;
  --c-theatre: #d6336c;
  --c-comedy: #e8770f;
  --c-dance: #0f9d76;
  --c-other: #5a6270;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#12110f; --panel:#1a1815; --text:#efece5; --muted:#a49d90; --border:#2b2823; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.serif { font-family: "Playfair Display", Georgia, "Times New Roman", serif; }

/* ---------- Header ---------- */
.site-header {
  background:
    radial-gradient(120% 140% at 82% -10%, rgba(200,160,78,.28), transparent 55%),
    linear-gradient(180deg, #1c1a16 0%, var(--ink) 100%);
  color: #f3ede0;
}
.site-header .wrap { padding: 20px 16px 22px; }
.brand h1 {
  font-family: "Playfair Display", Georgia, serif;
  margin: 0; font-size: 40px; font-weight: 800; letter-spacing: .5px;
  color: #f6efdf;
  text-shadow: 0 1px 12px rgba(200,160,78,.25);
}
.brand .spark { color: var(--gold); font-size: 22px; vertical-align: super; margin-left: 2px; }
.tagline { margin: 2px 0 0; color: #cfc6b4; font-size: 14px; }

.code-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.code-status { font-size: 13px; color: #b8b0a0; margin-right: auto; }
.code-status.active { color: #f3ede0; }
.code-status .code {
  font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px;
  background: rgba(255,255,255,.1); padding: 2px 8px; border-radius: 6px; margin-left: 4px;
}

/* ---------- Buttons ---------- */
.btn { font: inherit; font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap; transition: filter .15s, background .15s; }
.btn-gold { background: linear-gradient(180deg, #d9b264, var(--gold)); color: #2a2109; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.btn-gold:hover { filter: brightness(1.06); }
.btn-dark { background: #29251d; color: #eee3cf; border-color: #3a3428; }
.btn-dark:hover { background: #322d23; }
.btn-ghost { background: transparent; color: #b8b0a0; border-color: transparent; }
.btn-ghost:hover { color: #fff; }

/* ---------- Filters ---------- */
.filters { margin: 18px 0 8px; display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; gap: 10px; }
.filter-row.dates { align-items: center; }
.filters input, .filters select {
  font: inherit; font-size: 14px; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--panel); color: var(--text); width: 100%;
  accent-color: var(--gold);
}
#search { flex: 1 1 auto; }
#filterCategory { flex: 0 0 44%; }
.venue-select { width: 100%; }
.date-field { flex: 1; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.date-field input { font-size: 13px; }
.linkbtn { align-self: flex-start; background: none; border: none; color: var(--muted);
  font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 2px 0; }
.linkbtn:hover { color: var(--gold-dark); }

.meta { color: var(--muted); font-size: 13px; margin: 10px 2px 16px; }

/* ---------- Results ---------- */
.results { display: flex; flex-direction: column; gap: 8px; padding-bottom: 70px; }
.day-group { margin-top: 16px; }
.day-group:first-child { margin-top: 4px; }
.day-group h2 {
  margin: 0 0 12px; padding-bottom: 8px; font-size: 13px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.cards { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Card ---------- */
.card {
  position: relative; overflow: hidden; border-radius: var(--radius);
  min-height: 132px; display: flex; align-items: stretch;
  background: #26221b; box-shadow: 0 2px 10px rgba(0,0,0,.16);
  isolation: isolate;
}
.card-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.card-overlay { position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(10,9,8,.94) 0%, rgba(10,9,8,.78) 42%, rgba(10,9,8,.28) 100%); }
/* fallback gradients by category when there's no image */
.card.no-img.music   { background: linear-gradient(135deg,#1e3a7a,#3f6fd8); }
.card.no-img.musical { background: linear-gradient(135deg,#3d1d78,#7b3fe4); }
.card.no-img.theatre { background: linear-gradient(135deg,#7a1338,#d6336c); }
.card.no-img.comedy  { background: linear-gradient(135deg,#7a3d06,#e8770f); }
.card.no-img.dance   { background: linear-gradient(135deg,#0a5c45,#0f9d76); }
.card.no-img.other   { background: linear-gradient(135deg,#2b3038,#5a6270); }
.card.no-img .card-overlay { background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.12)); }

.card-content { position: relative; z-index: 1; color: #fff; padding: 15px 16px; display: flex;
  flex-direction: column; gap: 6px; width: 100%; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.card .title {
  font-family: "Playfair Display", Georgia, serif; font-weight: 700; font-size: 21px;
  line-height: 1.15; margin: 0 74px 0 0;
}
.card .sub { font-size: 13.5px; color: #e9e4da; }
.card .sub .hide-venue { color: #cbb98e; background: none; border: none; cursor: pointer;
  font: inherit; font-size: 12px; text-decoration: underline; padding: 0 0 0 4px; }
.card .sub .hide-venue:hover { color: #fff; }

.card .row2 { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; padding: 4px 10px; border-radius: 20px; color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.badge.music { background: var(--c-music); } .badge.musical { background: var(--c-musical); }
.badge.theatre { background: var(--c-theatre); } .badge.comedy { background: var(--c-comedy); }
.badge.dance { background: var(--c-dance); } .badge.other { background: var(--c-other); }
.badge .q { opacity: .85; }

.tickets { margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg,#d9b264,var(--gold)); color: #2a2109 !important;
  font-size: 13px; font-weight: 700; text-decoration: none; padding: 8px 13px; border-radius: 10px;
  text-shadow: none; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.tickets:hover { filter: brightness(1.06); }
.altlink { font-size: 11px; color: #cbb98e; text-decoration: underline; margin-left: 8px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }

.hide-x { position: absolute; top: 10px; right: 12px; z-index: 2; width: 28px; height: 28px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; font-size: 15px;
  cursor: pointer; line-height: 1; display: grid; place-items: center; }
.hide-x:hover { background: rgba(0,0,0,.7); }

.empty { text-align: center; color: var(--muted); padding: 50px 0; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #f3ede0; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 6px 22px rgba(0,0,0,.35); z-index: 20; max-width: 90vw; text-align: center; }

@media (min-width: 560px) {
  .brand h1 { font-size: 46px; }
  .card .title { font-size: 23px; }
}
