:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f1f0ee;
  --line: #e4e2de;
  --text: #17161a;
  --muted: #66636b;
  --accent: #e5202e;
  --accent-ink: #ffffff;
  --accent-soft: #fde8ea;
  --chip: #efeeec;
  --chip-on: #17161a;
  --chip-on-ink: #ffffff;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .06);
  --radius: 12px;
  --top-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --surface: #18181b;
    --surface-2: #222226;
    --line: #2e2e33;
    --text: #f2f1f3;
    --muted: #a19fa7;
    --accent: #ff3b47;
    --accent-soft: #3a1518;
    --chip: #26262a;
    --chip-on: #f2f1f3;
    --chip-on-ink: #0f0f11;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.logo-mark { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; background: #0b0b0e; flex-shrink: 0; }
.logo-mark canvas, .logo-word canvas { display: block; image-rendering: pixelated; }
.logo-word { font-size: 19px; letter-spacing: -.02em; font-weight: 600; line-height: 1; }
.logo-word b { font-weight: 800; }
.search { flex: 1; max-width: 560px; margin: 0 auto; position: relative; min-width: 0; }
.search input {
  width: 100%; height: 40px; padding: 0 44px 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
}
.search input:focus { border-color: var(--accent); outline: none; }
.search kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font: 12px ui-monospace, monospace; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
}
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); flex-shrink: 0; }
.sort select {
  height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); padding: 0 10px; color: var(--text);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); }

/* ---------- layout ---------- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: var(--top-h);
  width: 290px; flex-shrink: 0;
  height: calc(100vh - var(--top-h));
  overflow-y: auto;
  padding: 18px 16px 40px 20px;
  border-right: 1px solid var(--line);
}
.main { flex: 1; min-width: 0; padding: 18px 24px 60px; }

.filter { margin-bottom: 22px; }
.filter h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 10px; font-weight: 650;
  display: flex; justify-content: space-between; align-items: center;
}
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 12px; text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 0; background: var(--chip); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 13px; line-height: 1.2;
  display: inline-flex; gap: 6px; align-items: baseline;
}
.chip:hover { filter: brightness(.96); }
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); }
.chip .n { font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }
.chip.zero { opacity: .45; }
.date-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.date-range label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.date-range input, .mini-search {
  width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); padding: 0 8px; color: var(--text);
}
.mini-search { margin: 8px 0; }
.toggle { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 6px 0; cursor: pointer; }
.toggle input { margin-top: 2px; accent-color: var(--accent); }
.venue-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.venue-list li label {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 6px 10px; cursor: pointer; font-size: 13px;
}
.venue-list li label:hover { background: var(--surface-2); }
.venue-list li + li { border-top: 1px solid var(--line); }
.venue-list input { accent-color: var(--accent); }
.venue-list .n { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.venue-list .sub { display: block; color: var(--muted); font-size: 11px; }
.venue-list li.zero { opacity: .45; }
.about { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---------- grid ---------- */
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.active-filters .chip { background: var(--accent-soft); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; }
.summary { color: var(--muted); margin: 0; }
.summary .link { font-size: inherit; }
.group-h {
  font-size: 18px; font-weight: 700; letter-spacing: -.01em;
  margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px;
}
.group-h:first-child { margin-top: 0; }
.group-h .n { font-size: 13px; color: var(--muted); font-weight: 500; }
.group-h .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.grid {
  display: grid; gap: 28px 18px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.card { cursor: pointer; text-decoration: none; display: block; border-radius: var(--radius); }
.thumb {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.badge-dur {
  position: absolute; right: 6px; bottom: 6px;
  background: rgb(0 0 0 / .8); color: #fff; font-size: 12px; font-weight: 600;
  padding: 1px 5px; border-radius: 4px; font-variant-numeric: tabular-nums;
}
.badge-date {
  position: absolute; left: 8px; top: 8px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 8px; padding: 3px 8px 4px; text-align: center; line-height: 1.05;
  box-shadow: 0 2px 8px rgb(0 0 0 / .25);
}
.badge-date .d { display: block; font-size: 17px; font-weight: 800; }
.badge-date .m { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.badge-sold {
  position: absolute; left: 8px; bottom: 6px; font-size: 11px; font-weight: 700;
  background: rgb(0 0 0 / .78); color: #fff; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .04em;
}
.card-body { display: grid; grid-template-columns: 36px 1fr; gap: 10px; padding-top: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--surface-2);
  display: grid; place-items: center; font-weight: 700; color: var(--muted); font-size: 14px;
}
.c-title {
  font-weight: 600; font-size: 15px; line-height: 1.3; margin: 0 0 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.c-artist { font-size: 13px; color: var(--text); font-weight: 550; }
.c-line { font-size: 13px; color: var(--muted); }
.c-line .dot::before { content: "·"; margin: 0 5px; }
.c-genres { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pill { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--chip); color: var(--muted); }

#sentinel { height: 1px; }
.empty { text-align: center; padding: 80px 0; color: var(--muted); }
.btn {
  border: 0; border-radius: 999px; padding: 9px 16px; cursor: pointer;
  background: var(--chip-on); color: var(--chip-on-ink); font-weight: 600; text-decoration: none; display: inline-block;
}
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--text); padding-left: 0; }

/* ---------- watch view ---------- */
.watch { position: fixed; inset: var(--top-h) 0 0 0; z-index: 20; background: var(--bg); overflow-y: auto; }
.watch-bar { padding: 10px 24px 0; }
.watch-body {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px;
  padding: 8px 24px 60px; max-width: 1700px; margin: 0 auto;
}
.player { aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.w-title { font-size: 20px; line-height: 1.3; margin: 14px 0 6px; letter-spacing: -.01em; }
.w-meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.w-meta a { color: var(--muted); }
.show-card {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; display: grid; grid-template-columns: 120px 1fr; gap: 18px;
}
.show-card .poster { width: 120px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.show-card h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.01em; }
.show-card .when { font-weight: 650; color: var(--accent); }
.show-card .where { color: var(--muted); margin: 2px 0 10px; }
.show-card .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.show-card .lineup { font-size: 13px; color: var(--muted); }
.show-card .lineup button { border: 0; background: none; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: 13px; }
.show-card .other-dates { font-size: 13px; color: var(--muted); margin-top: 10px; }
.side-h { font-size: 15px; font-weight: 700; margin: 4px 0 10px; }
.side-h + .mini-list { margin-bottom: 22px; }
.mini-list { display: grid; gap: 10px; }
.mini { display: grid; grid-template-columns: 168px 1fr; gap: 10px; cursor: pointer; text-decoration: none; border-radius: 8px; }
.mini:hover .t { color: var(--accent); }
.mini .thumb { border-radius: 8px; }
.mini .t { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini .s { font-size: 12px; color: var(--muted); }
.mini.current { background: var(--surface-2); }
.mini .badge-date { padding: 2px 5px 3px; left: 5px; top: 5px; border-radius: 6px; }
.mini .badge-date .d { font-size: 13px; }
.mini .badge-date .m { font-size: 8px; }

/* ---------- responsive ---------- */
.only-narrow { display: none; }
@media (max-width: 1100px) {
  .watch-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .only-narrow { display: grid; }
  .side-head.only-narrow { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
  .only-wide { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .logo-word { display: none; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: min(320px, 88vw); height: auto;
    background: var(--bg); transform: translateX(-102%); transition: transform .2s ease;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .scrim { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .4); }
  .main { padding: 14px 16px 60px; }
  .watch-bar, .watch-body { padding-left: 16px; padding-right: 16px; }
  .show-card { grid-template-columns: minmax(0, 1fr); }
  .show-card .poster { width: 96px; }
  .mini { grid-template-columns: 140px 1fr; }
}

/* ---------- shows without a video ---------- */
.thumb.flyer { background: linear-gradient(135deg, var(--surface-2), var(--chip)); display: grid; place-items: center; }
.thumb.flyer img { position: absolute; inset: 0; object-fit: contain; }  /* letterboxed on the card colour */
.card:hover .thumb.flyer img { transform: none; }
.flyer-venue {  /* shown when there is no flyer image */
  color: var(--muted); font-weight: 700; font-size: 15px; text-align: center; padding: 0 16px; line-height: 1.25;
}
.badge-novid {
  position: absolute; right: 6px; bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--surface); color: var(--muted); padding: 2px 7px; border-radius: 4px;
  box-shadow: 0 1px 4px rgb(0 0 0 / .2);
}
.card.no-vid .c-title { color: var(--text); }
.no-video { position: relative; width: 100%; height: 100%; display: grid; place-items: center; background: #111; }
.no-video img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .35; }
.no-video-msg {
  position: relative; display: grid; gap: 10px; justify-items: center; text-align: center;
  color: #fff; padding: 20px; max-width: 30em;
}
.no-video-msg strong { font-size: 20px; }
.no-video-msg span { color: #d6d4da; }
.no-video-msg .btn { background: #fff; color: #111; }
.lineup .muted { color: var(--muted); }
/* Grid children default to min-width:auto, so a long word or the player could push the watch page wider than a
   phone screen. Let them shrink, and wrap long addresses and buttons. */
.watch-main, .watch-side, .show-card > div { min-width: 0; }
.where, .no-video-msg span { overflow-wrap: anywhere; }
.no-video-msg { max-width: min(30em, 100%); box-sizing: border-box; }
.no-video-msg .btn { white-space: normal; max-width: 100%; }
@media (max-width: 600px) {
  .no-video-msg { padding: 12px; gap: 6px; }
  .no-video-msg strong { font-size: 17px; }
  .no-video-msg span { font-size: 13px; }
}

/* ---------- accounts & saved shows ---------- */
.top-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.top-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  text-decoration: none; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap;
  max-width: 14em; overflow: hidden; text-overflow: ellipsis;
}
.top-btn:hover { background: var(--surface-2); }
.top-btn .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}
body.saved-mode #savedLink { background: var(--chip-on); color: var(--chip-on-ink); border-color: var(--chip-on); }

.card-wrap { position: relative; min-width: 0; }
.save-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center;
  background: rgb(0 0 0 / .55); color: #fff; backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .15s ease, transform .15s ease;
}
.save-btn svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.save-btn[aria-pressed="true"] { opacity: 1; background: var(--accent); }
.save-btn[aria-pressed="true"] svg path { fill: currentColor; }
.card-wrap:hover .save-btn, .save-btn:focus-visible { opacity: 1; }
.save-btn:hover { transform: scale(1.08); }
@media (hover: none) { .save-btn { opacity: 1; } }  /* touch screens can't hover to reveal it */

.btn.save-wide { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); color: var(--text); }
.btn.save-wide svg path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.btn.save-wide[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.btn.save-wide[aria-pressed="true"] svg path { fill: currentColor; }

.saved-head { display: none; align-items: center; gap: 14px; margin-bottom: 6px; }
.saved-head h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
body.saved-mode .saved-head { display: flex; }
body.saved-mode .sidebar, body.saved-mode #filtersBtn, body.saved-mode .active-filters, body.saved-mode .sort { display: none; }
.gone-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.gone-list li { display: grid; grid-template-columns: 7.5em 1fr auto; gap: 12px; align-items: baseline; padding: 10px 14px; }
.gone-list li + li { border-top: 1px solid var(--line); }
.gone-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.gone-name { min-width: 0; overflow-wrap: anywhere; }
.muted { color: var(--muted); }

dialog.auth {
  width: min(380px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text); padding: 24px; box-shadow: var(--shadow);
}
dialog.auth::backdrop { background: rgb(0 0 0 / .45); }
dialog.auth h2 { margin: 0 0 6px; font-size: 19px; }
.auth-hint { color: var(--muted); margin: 0 0 16px; font-size: 13px; }
dialog.auth label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
dialog.auth input {
  height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 12px; font-weight: 400;
}
dialog.auth input:focus { border-color: var(--accent); outline: none; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.auth-row .link { font-size: 13px; }
.auth-error { color: var(--accent); font-size: 13px; margin: 0 0 10px; }
.auth-close { position: absolute; top: 10px; right: 10px; }
#authSubmit:disabled { opacity: .6; cursor: wait; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--chip-on); color: var(--chip-on-ink); padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); font-size: 13px;
}
@media (max-width: 860px) {
  .top-btn { padding: 0 10px; max-width: 8em; }
  .gone-list li { grid-template-columns: 1fr auto; }
  .gone-when { grid-column: 1 / -1; font-size: 12px; }
}
