:root {
  --cream: #fff4e4;
  --paper: #fffaf2;
  --ink: #2b1438;
  --ink-soft: #5d4a66;
  --orange: #ff6b35;
  --pink: #ff3d7f;
  --yellow: #ffc93c;
  --green: #22b573;
  --green-ink: #0f6e43;
  --plum: #6c2bd9;
  --line: 3px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --r: 14px;
  --panel-w: 440px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
a { color: inherit; }

.app { display: grid; grid-template-columns: var(--panel-w) 1fr; height: 100dvh; }
.panel {
  overflow-y: auto;
  border-right: var(--line);
  background: var(--cream);
  padding: 0 18px 24px;
  scrollbar-width: thin;
}
.map-wrap { position: relative; }
#map { position: absolute; inset: 0; background: #f3e6d3; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0 12px;
  background: var(--cream);
  border-bottom: 2px dashed rgba(43, 20, 56, .25);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { width: 46px; height: 46px; flex: none; transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.brand:hover .logo { transform: rotate(-12deg) scale(1.08); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text b { font-family: "Bungee", sans-serif; font-weight: 400; font-size: 22px; letter-spacing: .5px; color: var(--orange); text-shadow: 2px 2px 0 var(--ink); }
.brand-text i { font-style: normal; font-weight: 700; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin-top: 4px; color: var(--ink-soft); }
.clock {
  font-weight: 800; font-size: 14px; white-space: nowrap;
  background: var(--paper); border: var(--line); border-radius: 999px;
  padding: 6px 12px; box-shadow: var(--shadow-sm);
  font-variant-numeric: tabular-nums;
}

/* Hero */
.hero {
  margin: 16px 0 14px;
  padding: 18px;
  border: var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
  background:
    repeating-linear-gradient(0deg, transparent 0 10px, rgba(255, 255, 255, .18) 10px 12px),
    linear-gradient(170deg, var(--yellow) 0%, var(--orange) 55%, var(--pink) 100%);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: rgba(255, 244, 228, .35); border: 3px solid rgba(43, 20, 56, .15);
}
.count { margin: 0 0 14px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
#liveCount {
  font-family: "Bungee", sans-serif; font-size: 64px; line-height: .9;
  color: var(--paper); text-shadow: 4px 4px 0 var(--ink);
  -webkit-text-stroke: 2px var(--ink);
  display: inline-block;
}
#liveCount.bump { animation: bump .45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { 0% { transform: scale(.6) rotate(-8deg); } 100% { transform: none; } }
.count-label { font-weight: 800; font-size: 19px; max-width: 12ch; line-height: 1.1; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }

.btn {
  border: var(--line); border-radius: 999px; background: var(--paper);
  padding: 10px 16px; font-weight: 800; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .12s, background .2s;
  min-height: 44px;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn-pink { background: var(--pink); color: #fff; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.btn:focus-visible, .chip:focus-visible, .seg-btn:focus-visible, select:focus-visible, .day:focus-visible { outline: 3px solid var(--plum); outline-offset: 2px; }

/* When */
.when { margin-bottom: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: var(--line); border-radius: 999px; overflow: hidden; background: var(--paper); box-shadow: var(--shadow-sm); }
.seg-btn { border: 0; background: none; padding: 10px; font-weight: 800; cursor: pointer; min-height: 44px; }
.seg-btn + .seg-btn { border-left: var(--line); }
.seg-btn.on { background: var(--ink); color: var(--yellow); }
.plan { margin-top: 10px; padding: 12px; border: var(--line); border-radius: var(--r); background: var(--paper); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 10px; }
.day { border: 2px solid var(--ink); border-radius: 10px; background: var(--cream); padding: 6px 0; font-weight: 800; font-size: 13px; cursor: pointer; }
.day.on { background: var(--orange); color: #fff; box-shadow: var(--shadow-sm); }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-time { font-family: "Bungee", sans-serif; font-size: 18px; min-width: 92px; }
input[type=range] { flex: 1; accent-color: var(--orange); height: 28px; }

/* Filters */
.filters { margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip {
  border: 2px solid var(--ink); border-radius: 999px; background: var(--paper);
  padding: 7px 12px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: transform .15s cubic-bezier(.3, 1.6, .5, 1), background .2s;
  min-height: 38px;
}
.chip:hover { transform: rotate(-2deg) scale(1.04); }
.chip[aria-pressed="true"] { background: var(--yellow); box-shadow: var(--shadow-sm); }
.filter-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
select {
  border: 2px solid var(--ink); border-radius: 10px; background: var(--paper);
  padding: 8px 10px; font-weight: 700; min-height: 40px; cursor: pointer;
}
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--green); }

.list-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 10px; font-weight: 800; }

/* Cards */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.card {
  border: var(--line); border-radius: var(--r); background: var(--paper);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  animation: cardIn .35s both;
  animation-delay: calc(var(--i, 0) * 25ms);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } }
.card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.card.active { background: #fff; box-shadow: 6px 6px 0 var(--orange); border-color: var(--ink); }
.card.dim { opacity: .62; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card h3 { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.15; }
.meta { margin: 3px 0 0; color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.pill {
  flex: none; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  border: 2px solid var(--ink); border-radius: 999px; padding: 4px 9px; white-space: nowrap;
}
.pill.live { background: var(--green); color: #fff; }
.pill.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-right: 5px; vertical-align: 1px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.pill.soon { background: var(--yellow); }
.pill.later { background: var(--cream); }
.pill.off { background: #eee3d6; color: var(--ink-soft); border-color: var(--ink-soft); }
.timer { margin: 10px 0 0; font-weight: 700; font-size: 15px; }
.timer b { color: var(--green-ink); }
.timer.soon b { color: #a15c00; }
.timer.later b { color: var(--orange); }
.bar { height: 8px; border: 2px solid var(--ink); border-radius: 99px; background: var(--cream); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--yellow)); border-right: 2px solid var(--ink); }
.deals { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.deals li { font-size: 13px; font-weight: 700; background: var(--cream); border: 1.5px solid var(--ink); border-radius: 8px; padding: 3px 8px; }
.deals li.hot { background: #ffe1ec; }
.more { display: none; margin-top: 12px; padding-top: 12px; border-top: 2px dashed rgba(43, 20, 56, .25); }
.card.active .more { display: block; }
.week { width: 100%; border-collapse: collapse; font-size: 14px; }
.week td { padding: 3px 0; vertical-align: top; }
.week td:first-child { font-weight: 800; width: 52px; }
.week tr.today td { color: var(--orange); font-weight: 800; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card-actions .btn { padding: 7px 12px; min-height: 38px; font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; }
.src { margin: 10px 0 0; font-size: 12px; color: var(--ink-soft); }
.src .old { background: #ffe8b3; border: 1.5px solid var(--ink); border-radius: 6px; padding: 1px 6px; color: var(--ink); font-weight: 700; }

.empty { border: 3px dashed var(--ink); border-radius: var(--r); padding: 22px; text-align: center; font-weight: 700; background: var(--paper); }
.empty b { display: block; font-family: "Bungee", sans-serif; font-weight: 400; font-size: 20px; margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }

.foot { margin-top: 28px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }

/* Map */
.leaflet-tile-pane { filter: sepia(.35) saturate(1.15) hue-rotate(-12deg) brightness(1.02); }
.leaflet-container { font-family: "Outfit", system-ui, sans-serif; }
.pin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--ink); background: var(--cream);
  box-shadow: 2px 2px 0 var(--ink);
  display: grid; place-items: center; font-size: 12px;
  transition: transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
.pin.live { background: var(--green); }
.pin.live::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--green); animation: ping 1.8s infinite; }
@keyframes ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.pin.soon { background: var(--yellow); }
.pin.later { background: var(--cream); }
.pin.off { background: #d9cbbb; border-color: var(--ink-soft); box-shadow: none; width: 18px; height: 18px; }
.pin.active { transform: scale(1.45); z-index: 1000; }
.leaflet-marker-icon.on-top { z-index: 9999 !important; }
.leaflet-popup-content-wrapper { border: var(--line); border-radius: 12px; box-shadow: var(--shadow); background: var(--paper); }
.leaflet-popup-tip { background: var(--ink); }
.leaflet-popup-content { margin: 10px 14px; font-size: 14px; line-height: 1.35; }
.leaflet-popup-content b { font-size: 15px; }
.legend {
  position: absolute; left: 12px; bottom: 22px; z-index: 500;
  display: flex; gap: 12px; flex-wrap: wrap;
  background: var(--paper); border: var(--line); border-radius: 999px; box-shadow: var(--shadow-sm);
  padding: 7px 14px; font-weight: 700; font-size: 13px;
}
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); margin-right: 5px; vertical-align: -1px; }
.dot.live { background: var(--green); }
.dot.soon { background: var(--yellow); }
.dot.later { background: var(--cream); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2000; background: var(--ink); color: var(--yellow);
  border-radius: 999px; padding: 10px 18px; font-weight: 800;
  box-shadow: 3px 3px 0 var(--orange);
}

/* Spin overlay */
.spin-overlay {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; place-items: center;
  background: rgba(43, 20, 56, .55);
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.spin-card {
  width: min(360px, calc(100vw - 32px));
  background: var(--paper); border: var(--line); border-radius: 20px; box-shadow: 6px 6px 0 var(--ink);
  padding: 22px; text-align: center;
}
.spin-card .reel {
  height: 60px; overflow: hidden; border: var(--line); border-radius: 12px;
  background: var(--yellow); display: grid; place-items: center;
  font-family: "Bungee", sans-serif; font-size: 20px; padding: 0 10px;
}
.spin-card .reel span { display: block; }
.spin-card p { font-weight: 700; margin: 14px 0; }
.spin-card .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 3001; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Phone */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 42dvh 1fr; height: 100dvh; }
  .map-wrap { grid-row: 1; border-bottom: var(--line); }
  .panel { grid-row: 2; border-right: 0; padding: 0 16px 24px; }
  .legend { bottom: 10px; left: 10px; font-size: 12px; padding: 5px 10px; gap: 8px; }
  #liveCount { font-size: 52px; }
  .brand-text b { font-size: 19px; }
  .logo { width: 40px; height: 40px; }
}

/* Last call + starting soon */
.pill.last { background: var(--pink); color: #fff; animation: wobble 1.6s infinite; }
@keyframes wobble { 0%, 80%, 100% { transform: none; } 85% { transform: rotate(-6deg); } 90% { transform: rotate(6deg); } 95% { transform: rotate(-3deg); } }
.timer.last b { color: #d1105a; }
.timer .tick { font-variant-numeric: tabular-nums; }
.pin.last { background: var(--pink); }
.pin.last::after { border-color: var(--pink); animation-duration: .9s; }
.dot.last { background: var(--pink); }
.rails { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.rails:empty { display: none; }
.rail h4 { margin: 0 0 8px; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.rail h4 small { background: var(--ink); color: var(--yellow); border-radius: 99px; padding: 1px 8px; font-size: 12px; }
.rail-track { display: flex; gap: 10px; overflow-x: auto; padding: 2px 4px 8px 2px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.mini {
  flex: none; width: 168px; scroll-snap-align: start; text-align: left; cursor: pointer;
  border: var(--line); border-radius: 12px; padding: 10px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px; transition: transform .15s;
}
.mini:hover { transform: translateY(-2px) rotate(-1deg); }
.r-last .mini { background: #ffe1ec; }
.r-soon .mini { background: #fff1c7; }
.mini b { font-size: 14px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .tick { font-family: "Bungee", sans-serif; font-size: 22px; line-height: 1; }
.r-last .mini .tick { color: #d1105a; }
.r-soon .mini .tick::before { content: "in "; font-family: "Outfit", sans-serif; font-weight: 800; font-size: 14px; }
.r-last .mini .tick::after { content: " left"; font-family: "Outfit", sans-serif; font-weight: 800; font-size: 14px; color: var(--ink); }
.mini em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-ink { background: var(--ink); color: var(--yellow); }

/* Bar crawl */
.crawl {
  margin-top: 16px; padding: 16px; border: var(--line); border-radius: var(--r);
  background: var(--paper); box-shadow: 6px 6px 0 var(--plum);
}
.crawl-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.crawl h3 { margin: 0; font-family: "Bungee", sans-serif; font-weight: 400; font-size: 20px; color: var(--plum); }
.x { border: 2px solid var(--ink); background: var(--cream); border-radius: 50%; width: 36px; height: 36px; font-weight: 800; cursor: pointer; }
.crawl-opts { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.crawl-opts label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; }
.mini-seg { display: flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.mini-seg button { border: 0; background: var(--cream); padding: 6px 11px; font-weight: 800; cursor: pointer; }
.mini-seg button + button { border-left: 2px solid var(--ink); }
.mini-seg button.on { background: var(--plum); color: #fff; }
.stops { list-style: none; margin: 8px 0 0; padding: 0; }
.stop { display: grid; grid-template-columns: 34px 1fr; gap: 10px; cursor: pointer; }
.stop .num {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); background: var(--plum); color: #fff;
  display: grid; place-items: center; font-family: "Bungee", sans-serif; font-size: 15px; box-shadow: var(--shadow-sm);
}
.stop-body { padding-bottom: 6px; }
.stop-body b { font-size: 16px; }
.stop-body p { margin: 2px 0 0; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.walk { margin: 0 0 6px 15px; padding: 6px 0 6px 20px; border-left: 3px dashed var(--plum); font-size: 13px; font-weight: 700; color: var(--plum); }
.crawl-sum { margin: 10px 0 0; font-weight: 800; }
.crawl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.crawl-actions .btn { min-height: 40px; padding: 7px 13px; font-size: 14px; }
.crawl-empty { font-weight: 700; margin: 8px 0 0; }
.crawl-pin {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--ink); background: var(--plum); color: #fff;
  display: grid; place-items: center; font-family: "Bungee", sans-serif; font-size: 14px; box-shadow: 2px 2px 0 var(--ink);
}
