:root {
  --bg: #ffffff;
  --card: #ffffff;
  --surface: #f3f3f3;
  --text: #111111;
  --muted: #6b6b6b;
  --red: #d10600;
  --red-soft: #ffe8e6;
  --border: #ececec;
  --gold: #b8860b;
  --header-bg: rgba(255,255,255,0.92);
  --shadow: 0 6px 20px rgba(0,0,0,0.06);
  --cta-h: 88px;
  --tile: 158px;
  --tile-gap: 8px;
}

[data-theme="dark"] {
  --bg: #000000;
  --card: #111111;
  --surface: #1a1a1a;
  --text: #f5f5f5;
  --muted: #9a9a9a;
  --red: #e10600;
  --red-soft: rgba(225,6,0,0.16);
  --border: #2a2a2a;
  --gold: #ffb800;
  --header-bg: rgba(0,0,0,0.92);
  --shadow: 0 8px 24px rgba(0,0,0,0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.demo-banner {
  background: #111; color: #fff;
  font-size: 11px; font-weight: 600;
  text-align: center; padding: 7px 12px;
}
.demo-banner span { color: #ffcc66; }

.race-count {
  display: flex; align-items: baseline; justify-content: flex-start; flex-wrap: wrap; gap: 8px 18px;
  max-width: 1200px; margin: 0 auto;
  padding: 10px 12px 6px;
  font-size: 12px; font-weight: 600;
}
.race-count-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 0 1 auto; }
.race-count a { color: var(--muted); font-weight: 600; }
.race-count-copy span { color: var(--text); font-weight: 500; font-size: 13px; line-height: 1.35; }
.race-count strong { color: var(--red); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; font-size: 13px; }

.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 800; font-size: 15px; letter-spacing: -0.03em; }
.logo span { color: var(--red); }
.tagline { font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.header-right { display: flex; align-items: center; gap: 6px; }
.spots-count, .nav-link, .theme-btn {
  font-size: 12px; font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-btn {
  width: 44px; height: 44px; padding: 0;
  cursor: pointer;
}

.stories {
  max-width: 1200px; margin: 0 auto;
  padding: 8px 10px 2px;
}
.stories-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; margin-bottom: 8px;
}
.stories-label a { color: var(--red); text-transform: none; letter-spacing: 0; font-weight: 700; }
.stories-row {
  display: flex; flex-wrap: wrap; gap: 8px 6px;
  padding-bottom: 6px;
  max-height: 196px;
  overflow: hidden;
}
.stories-row::-webkit-scrollbar { display: none; }
.story {
  flex: 0 0 78px; text-align: center; background: none; border: 0; cursor: pointer; color: var(--text);
}
.story-img {
  width: 72px; height: 72px; border-radius: 18px; overflow: hidden;
  border: 2px solid var(--red); position: relative; background: #ddd;
}
.story-img img { width: 100%; height: 100%; object-fit: cover; }
.story-pin {
  position: absolute; bottom: 4px; left: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 8px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid #fff;
}
.story span {
  display: block; margin-top: 5px; font-size: 10px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 78px;
}

.toolbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 8px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.toolbar::-webkit-scrollbar { display: none; }
.filters { display: flex; gap: 8px; flex-wrap: nowrap; }
.map-toggle { margin: 0; padding: 0; flex-shrink: 0; }
.map-toggle button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.map-section {
  display: none;
}
.map-section.open { display: block; }
.map-container {
  position: relative;
  width: 100%;
  height: calc(var(--tile) * 2.5 + var(--tile-gap));
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
#map { width: 100%; height: 100%; background: var(--surface); }
.map-key {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 18px 8px 6px;
  font-size: 9px;
  color: #fff;
  line-height: 1.3;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  pointer-events: none;
}
.map-expand {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 6;
  border: 0;
  background: #fff;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.map-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #111;
  display: none;
  flex-direction: column;
}
.map-lightbox.open { display: flex; }
.map-lightbox-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.map-lightbox-bar button {
  border: 0;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}
#map-full { flex: 1; min-height: 0; }

.filters {
  margin: 0;
  padding: 0;
  display: flex; gap: 6px; overflow-x: auto;
  flex: 1;
}
.filters::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
}
.filter-btn.active {
  background: var(--red); border-color: var(--red); color: #fff;
}

.workspace {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4px 8px calc(var(--cta-h) + 16px);
}
.workspace::after { content: ""; display: table; clear: both; }
.map-col {
  display: none;
  width: 280px;
  margin: 0 var(--tile-gap) var(--tile-gap) 0;
}
.workspace.map-on .map-col { display: block; float: left; }
.venues-col { min-width: 0; }
.grid-wrap { max-width: none; margin: 0; padding: 0; }
.masonry { display: contents; }

@media (max-width: 699px) {
  .header { padding: 8px 10px; }
  .header-inner { align-items: flex-start; gap: 8px; }
  .tagline { max-width: 42vw; }
  .header-right { flex-shrink: 0; gap: 4px; }
  .header-right .nav-link, .spots-count {
    padding: 8px 10px;
    min-height: 36px;
    font-size: 11px;
  }
  .theme-btn { width: 36px; height: 36px; min-height: 36px; }
  .stories-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-height: none;
  }
  .story { flex: 0 0 72px; }
  .empty-live { padding: 20px 8px 8px; min-height: 120px; }
  .legal-footer { padding-bottom: 12px; }
  .workspace { padding-left: 6px; padding-right: 6px; }
  .workspace.map-on .map-col {
    float: none;
    width: 100%;
  }
  .map-container { height: 200px; }
  .card {
    width: calc((100% - 8px) / 3);
    margin: 0 4px 8px 0;
  }
  .card:nth-child(3n) { margin-right: 0; }
  .story { flex: 0 0 calc(25% - 6px); max-width: calc(25% - 6px); }
  .story-img { width: 100%; height: auto; aspect-ratio: 1; }
  .header-right .nav-link { padding: 8px 10px; font-size: 11px; min-height: 40px; }
}

.card {
  float: left;
  width: var(--tile);
  margin: 0 var(--tile-gap) var(--tile-gap) 0;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: var(--surface);
  display: block;
}
.card.prime { box-shadow: 0 0 0 1px rgba(184,134,11,0.45); }
.card > img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.card-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 36px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.62));
  color: #fff; font-size: 12px; font-weight: 700;
  padding-right: 10px;
  padding-left: 40px;
}

.card-letter {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 42px;
  font-weight: 800;
}
.empty-live { padding: 28px 8px 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.empty-live a { color: var(--red); font-weight: 700; }
.partner-row-note { font-size: 11px; color: var(--muted); margin: -4px 0 8px; font-weight: 500; }
.partner-row-wrap {
  padding: 8px 16px 88px;
}
.partner-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0 12px;
}
.partner-chip {
  flex: 0 0 auto;
  width: 92px;
  text-decoration: none;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.partner-chip img,
.partner-chip .card-letter {
  width: 92px;
  height: 92px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  font-size: 28px;
}
.partner-chip span {
  display: block;
  margin-top: 6px;
  line-height: 1.2;
}

.card-pointer {
  position: absolute; bottom: 10px; left: 8px;
  z-index: 3;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

.card-qr, .mini-qr, .ticket-qr {
  position: absolute;
  z-index: 3;
  width: 40px; height: 40px;
  aspect-ratio: 1 / 1;
  background: #fff;
  border-radius: 6px;
  padding: 3px;
  border: 1.5px solid var(--red);
  overflow: hidden;
  box-sizing: border-box;
}
.card-qr { bottom: 8px; right: 8px; }
.card-qr img, .mini-qr img, .ticket-qr img, .partner-qr img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: contain !important;
  object-position: center;
  display: block;
}

.cta-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  padding: 10px 14px 16px;
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}
.cta-btn {
  display: block; max-width: 760px; margin: 0 auto;
  background: var(--red); color: #fff;
  text-align: center; padding: 14px;
  min-height: 44px;
  border-radius: 14px; font-weight: 800; font-size: 14px;
  border: 0; width: 100%; cursor: pointer;
}

.legal-footer {
  max-width: 760px;
  margin: 8px auto 0;
  padding: 0 12px 12px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.partner-hero {
  position: relative;
  overflow: hidden;
  height: 46vh;
  max-height: 420px;
}
.partner-hero > img,
#partner-hero-img {
  width: 100%;
  height: 46vh;
  max-height: 420px;
  object-fit: cover;
}
.partner-qr {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 4;
  width: 120px; height: 120px;
  aspect-ratio: 1 / 1;
  background: #fff;
  padding: 6px;
  border-radius: 12px;
  border: 2px solid var(--red);
  box-sizing: border-box;
  overflow: hidden;
}
.partner-sheet {
  background: var(--bg); color: var(--text);
  border-radius: 22px 22px 0 0;
  margin-top: -22px;
  padding: 16px 16px calc(var(--cta-h) + 24px);
  position: relative;
  z-index: 2;
}
.partner-title { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.partner-meta { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.partner-desc { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.btn-primary, .btn-secondary {
  flex: 1; text-align: center; padding: 13px 8px;
  min-height: 44px;
  border-radius: 12px; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  min-width: 140px;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-secondary {
  background: transparent; color: var(--red);
  border: 1.5px solid var(--red);
}
.partner-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.partner-chip {
  display: inline-flex; align-items: center;
  padding: 8px 12px; min-height: 40px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}

.leaflet-container { background: var(--surface); font-family: inherit; }
.leaflet-popup-content-wrapper {
  background: var(--card); color: var(--text); border-radius: 12px;
  border: 1px solid var(--border);
}
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content a { color: var(--red); font-weight: 700; }

.title-block { max-width:1200px; margin:0 auto; padding:8px 12px 4px; text-align:center; }
.title-block h1 { font-size:16px; font-weight:800; letter-spacing:-0.03em; }
.title-block p { font-size:11px; color:var(--muted); margin-top:2px; }
.section-label { font-size:11px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; padding:8px 2px 6px; display:flex; justify-content:space-between; }

.cal-wrap { padding-bottom: calc(var(--cta-h) + 36px) !important; }

@media (min-width: 1400px) {
  .workspace, .header-inner, .stories, .toolbar { max-width: 1560px; }
}
@media (min-width: 1800px) {
  .workspace, .header-inner, .stories, .toolbar { max-width: 1840px; }
  :root { --tile: 172px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .stories { max-height: 100px; overflow: hidden; }
  .cta-bar { padding: 6px 12px 8px; }
  .cta-btn { padding: 8px; font-size: 12px; }
  .grid-wrap { padding-bottom: 64px; }
  .map-container { height: 220px; }
  .partner-hero, .partner-hero > img, #partner-hero-img { height: 32vh; max-height: 220px; }
  .partner-qr { width: 88px; height: 88px; }
}

.hub { max-width: 720px; margin: 0 auto; padding: 16px 16px 80px; }
.hub-kicker { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.hub-h { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 28px 0 10px; }
.hub-cities { display: grid; gap: 12px; }
.hub-card {
  display: grid; grid-template-columns: 1fr 72px; grid-template-rows: auto auto;
  gap: 8px 12px; align-items: center;
  border: 1px solid var(--border); border-radius: 16px; padding: 14px;
  background: var(--card);
}
.hub-card-main { display: flex; gap: 12px; align-items: center; grid-column: 1; text-decoration: none; color: inherit; }
.hub-flag { border-radius: 4px; object-fit: cover; }
.hub-card h3 { font-size: 18px; font-weight: 800; }
.hub-hook { font-size: 13px; color: var(--red); font-weight: 600; margin-top: 2px; }
.hub-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hub-qr { width: 72px; height: 72px; grid-column: 2; grid-row: 1 / span 2; background: #fff; border-radius: 8px; }
.hub-buy {
  grid-column: 1; font-size: 12px; font-weight: 700; color: #fff; background: var(--red);
  text-align: center; border-radius: 10px; padding: 8px;
}
.hub-events { display: flex; flex-direction: column; gap: 8px; }
.hub-ev { display: grid; grid-template-columns: 88px 1fr; gap: 4px 10px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.hub-ev-when { color: var(--muted); font-size: 12px; }
.hub-ev-note { display: block; color: var(--muted); font-size: 12px; }
.hub-links { display: flex; flex-wrap: wrap; gap: 8px; }
.hub-link {
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 12px;
  font-size: 12px; font-weight: 700;
}
