:root {
  --bg: #1c231d;
  --bg2: #242d25;
  --card: #2b352c;
  --card2: #333f34;
  --ink: #f0ead8;
  --ink-dim: #b9b39e;
  --accent: #e8a33d;
  --accent2: #d4713f;
  --live: #ff7a5c;
  --star: #ffc94d;
  --ok: #8fc16a;
  --line: rgba(240,234,216,0.1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: manipulation;
}
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* header */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + var(--sat)) 14px 8px;
  background: linear-gradient(180deg, #161c17, #1c231d);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.title { font-weight: 800; letter-spacing: 0.06em; font-size: 17px; }
.title span { color: var(--accent); }
.sub { font-size: 11.5px; color: var(--ink-dim); margin-top: 1px; }
.statuschip {
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 20px;
  background: var(--card); color: var(--accent);
  border: 1px solid var(--line); white-space: nowrap;
}
.statuschip.live { background: #46251e; color: var(--live); border-color: #6b382c; }
.hdrchips { display: flex; gap: 6px; align-items: center; }
.langbtn { cursor: pointer; color: var(--ink); font-family: inherit; }

/* views */
#views { flex: 1; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; }
.view.active { display: flex; }
.scroll { flex: 1; overflow-y: auto; padding: 12px 12px calc(12px + var(--sab)); }

/* map */
#view-map { background: #28323b; }
#mapcanvas { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.mapctrl {
  position: absolute; right: 10px; top: 12px; display: flex; flex-direction: column; gap: 8px;
  z-index: 10;
}
.mapctrl button {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(28,35,29,0.88); color: var(--ink); font-size: 17px; font-weight: 700;
  backdrop-filter: blur(6px); cursor: pointer;
}
.mapctrl button.on { background: var(--accent); color: #221a08; border-color: transparent; }
.maphint {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px;
  font-size: 11px; color: #cfd6da; background: rgba(20,26,30,0.65);
  padding: 4px 12px; border-radius: 14px; pointer-events: none;
  transition: opacity 0.6s; z-index: 5;
  max-width: 92%; text-align: center;
}
.maphint.gone { opacity: 0; }

/* bottom sheet on map */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--bg2); border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 32px rgba(0,0,0,0.45);
  max-height: 62%; display: flex; flex-direction: column;
  padding-bottom: var(--sab);
}
.sheet.hidden { display: none; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 2px; }
.sheet .shead { padding: 8px 16px 10px; display: flex; align-items: center; gap: 10px; }
.sheet .shead .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.sheet .shead h2 { font-size: 17px; flex: 1; }
.sheet .shead .dist { font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.sheet .shead .x { background: none; border: none; color: var(--ink-dim); font-size: 20px; padding: 4px 6px; cursor: pointer; }
.sheet .sdesc { padding: 0 16px 8px; color: var(--ink-dim); font-size: 12.5px; }
.sheet .sbody { overflow-y: auto; padding: 0 12px 14px; }

/* event cards */
.evcard {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; margin-bottom: 8px;
  cursor: pointer;
}
.evcard .expand { flex-basis: 100%; max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.evcard.open .expand { max-height: 260px; }
.evcard .expand-inner {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-dim); line-height: 1.5;
}
.evcard .expand-inner b { color: var(--ink); }
.evcard .chev {
  font-size: 11px; color: var(--ink-dim); transition: transform 0.25s; line-height: 1;
}
.evcard.open .chev { transform: rotate(180deg); }
.evcard.past { opacity: 0.45; }
.evcard.live-now { border-color: #7c4234; background: #3a2c24; }
.evcard .when { flex: none; width: 52px; text-align: center; }
.evcard .when .t { font-weight: 800; font-size: 15px; }
.evcard .when .d { font-size: 10.5px; color: var(--ink-dim); }
.evcard .when .livechip { font-size: 9.5px; font-weight: 800; color: var(--live); letter-spacing: 0.08em; }
.evcard .mid { flex: 1; min-width: 0; }
.evcard .artist { font-weight: 700; font-size: 14.5px; }
.evcard .meta { font-size: 12px; color: var(--ink-dim); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.evcard .meta .sdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.evcard .walkinfo { font-size: 11.5px; color: var(--ok); margin-top: 2px; }
.evcard .walkinfo.tight { color: var(--accent); }
.evcard .walkinfo.miss { color: var(--live); }
.evcard .act { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.starbtn {
  background: none; border: none; font-size: 22px; line-height: 1;
  color: #6a6a58; cursor: pointer; padding: 4px;
}
.starbtn.on { color: var(--star); text-shadow: 0 0 12px rgba(255,201,77,0.45); }
.gobtn {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: 8px; font-size: 11px; padding: 3px 7px; cursor: pointer;
}

/* section headers in lists */
.lhead { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; color: var(--ink-dim);
  text-transform: uppercase; margin: 14px 4px 8px; }
.lhead:first-child { margin-top: 2px; }
.notice {
  background: var(--card); border: 1px dashed var(--line); border-radius: 14px;
  padding: 12px 14px; font-size: 13px; color: var(--ink-dim); margin-bottom: 10px;
}
.notice b { color: var(--ink); }
.notice button, .bigbtn {
  display: inline-block; margin-top: 8px; background: var(--accent); color: #221a08;
  border: none; border-radius: 10px; font-weight: 700; font-size: 13px;
  padding: 8px 14px; cursor: pointer;
}
.bigbtn.ghost { background: var(--card2); color: var(--ink); border: 1px solid var(--line); }
.conflict {
  background: #46251e; border: 1px solid #6b382c; color: #ffb59f;
  border-radius: 12px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 8px;
}

/* program */
.progtop { padding: 10px 12px 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.daytabs { display: flex; gap: 6px; margin-bottom: 8px; }
.daytabs button {
  flex: 1; padding: 7px 4px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-dim); font-weight: 700; font-size: 12.5px; cursor: pointer;
}
.daytabs button.on { background: var(--accent); color: #221a08; border-color: transparent; }
.daytabs button .dow { display: block; font-size: 10px; font-weight: 600; opacity: 0.75; }
.filters { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; }
.filters button {
  padding: 5px 12px; border-radius: 16px; border: 1px solid var(--line);
  background: none; color: var(--ink-dim); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.filters button.on { background: var(--card2); color: var(--ink); }
#search {
  width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 14px; outline: none;
}

/* banner */
#banner {
  position: fixed; left: 10px; right: 10px; top: calc(10px + var(--sat)); z-index: 100;
  background: #3d2b14; border: 1px solid #8a6524; color: #ffd98a;
  border-radius: 14px; padding: 12px 14px; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
#banner.hidden { display: none; }
#banner b { display: block; font-size: 14.5px; margin-bottom: 2px; }

/* up-next bar */
#upnext {
  display: flex; align-items: center; gap: 8px;
  background: #2d2415; border-top: 1px solid #4b3d1f;
  padding: 8px 12px; font-size: 12.5px; color: var(--ink);
  cursor: pointer; z-index: 25;
}
#upnext.hidden { display: none; }
#upnext .star { color: var(--star); font-size: 15px; }
#upnext .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#upnext .lead { white-space: nowrap; color: var(--ink-dim); }
#upnext .lead b { color: var(--accent); }
#upnext .golabel { color: var(--live); animation: gopulse 1.1s ease-in-out infinite; }
@keyframes gopulse { 50% { opacity: 0.45; } }

/* day chip on event cards */
.daychip { font-size: 9px; font-weight: 800; letter-spacing: 0.07em; color: var(--accent); }

/* transitions between starred events */
.trans { font-size: 12px; color: var(--ok); padding: 0 10px 8px 22px; }
.trans.tight { color: var(--accent); }
.trans.miss { color: var(--live); }

/* stage-to-stage walk chips */
.walkchips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 12px; }
.walkchips span {
  font-size: 11.5px; background: var(--card2); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px 9px; color: var(--ink-dim); white-space: nowrap;
}

/* tab bar */
#tabbar {
  display: flex; border-top: 1px solid var(--line);
  background: #161c17; padding-bottom: var(--sab); z-index: 30;
}
#tabbar button {
  flex: 1; padding: 8px 0 9px; background: none; border: none;
  color: var(--ink-dim); font-size: 11px; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; position: relative;
}
#tabbar button .ic { font-size: 19px; line-height: 1.2; filter: grayscale(1) opacity(0.75); }
#tabbar button.on { color: var(--accent); }
#tabbar button.on .ic { filter: none; }
.badge {
  position: absolute; top: 3px; right: calc(50% - 22px);
  background: var(--accent2); color: #fff; border-radius: 9px;
  font-size: 10px; font-weight: 800; padding: 1px 5px;
}
.badge.hidden { display: none; }
.flag { font-size: 12px; }
.smallnote { font-size: 11.5px; color: var(--ink-dim); text-align: center; padding: 10px 20px 4px; }
.smallnote a { color: var(--ink-dim); }
