/* Layout: one-column phone app, sticky header, fixed bottom tab bar, cards only for sets/places.
   Design tokens: gig-poster orange + night-sky ink, chunky display face for headings only. */
@font-face { font-family: "Bowlby One SC"; src: url("../vendor/fonts/bowlby-one-sc.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Archivo"; src: url("../vendor/fonts/archivo-wdth.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

:root {
  --bg: #fbf6ef;
  --surface: #ffffff;
  --surface-2: #f3ebe0;
  --ink: #1b1a2e;
  --muted: #6b6476;
  --line: #e4d9cb;
  --accent: #e2481c;
  --accent-ink: #ffffff;
  --accent-soft: #fde3d6;
  --blue: #2457c5;
  --blue-soft: #dde7fb;
  --good: #1f8a4c;
  --warn: #b26a00;
  --bad: #c62828;
  --bad-soft: #fde2e2;
  --warn-soft: #fff0d6;
  --good-soft: #dcf3e5;
  --shadow: 0 1px 2px rgba(27, 26, 46, .08), 0 4px 14px rgba(27, 26, 46, .06);
  --font-display: "Bowlby One SC", "Archivo", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12111c; --surface: #1c1b2a; --surface-2: #262437; --ink: #f4efe8; --muted: #a8a1b4; --line: #34314a;
    --accent: #ff6a3d; --accent-ink: #1b0e08; --accent-soft: #3a2018; --blue: #7aa4ff; --blue-soft: #1d2846;
    --good: #5fd08f; --warn: #ffb547; --bad: #ff7a7a; --bad-soft: #3a1c22; --warn-soft: #3a2c14; --good-soft: #163324;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12111c; --surface: #1c1b2a; --surface-2: #262437; --ink: #f4efe8; --muted: #a8a1b4; --line: #34314a;
  --accent: #ff6a3d; --accent-ink: #1b0e08; --accent-soft: #3a2018; --blue: #7aa4ff; --blue-soft: #1d2846;
  --good: #5fd08f; --warn: #ffb547; --bad: #ff7a7a; --bad-soft: #3a1c22; --warn-soft: #3a2c14; --good-soft: #163324;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }

.app { min-height: 100%; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px); }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
  display: grid; gap: 8px;
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; letter-spacing: .01em; line-height: 1.1; text-wrap: balance; }
.clock { font-size: 14px; color: var(--muted); text-align: right; white-space: nowrap; }
.clock b { color: var(--ink); font-weight: 700; }
.page { padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px; }
.section { display: grid; gap: 10px; }
.section > h2 { margin: 0; font-size: 13px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.note { margin: 0; color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }

/* Segmented control */
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 999px; font-weight: 650; color: var(--muted); min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Buttons */
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-weight: 650; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .5; }
.btn:focus-visible, .seg button:focus-visible, .tab:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn.on { color: var(--accent); }
.icon-btn svg, .tab svg, .btn svg { width: 24px; height: 24px; }

/* Inputs */
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 650; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; min-height: 44px; }
textarea.input { min-height: 120px; font-family: ui-monospace, monospace; font-size: 13px; }
.search { position: relative; }
.search input { padding-left: 38px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); }

/* Chips */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tag { display: inline-block; font-size: 12px; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.stage { color: #fff; }
.tag.heavy { background: var(--accent-soft); color: var(--accent); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.good { background: var(--good-soft); color: var(--good); }

/* Lists */
.list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); min-height: 56px; }
.row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row .name { font-weight: 700; font-stretch: 92%; overflow-wrap: anywhere; }
.row .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.row.tap { cursor: pointer; }
.row.past { opacity: .55; }
.row.now { background: var(--accent-soft); }
.letter { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 750; letter-spacing: .08em; padding: 4px 12px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.card.hero { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.card.hero .muted { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.card h3 { margin: 0; font-size: 20px; font-stretch: 90%; font-weight: 800; line-height: 1.2; }
.big-time { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Stage now/next board */
.stage-grid { display: grid; gap: 10px; }
.stage-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; grid-template-columns: 6px 1fr; }
.stage-card .stripe { background: var(--stage, var(--accent)); }
.stage-card .body { padding: 10px 12px; display: grid; gap: 6px; min-width: 0; }
.stage-card .sname { font-size: 12px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.slot { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.slot .t { font-size: 13px; color: var(--muted); min-width: 64px; }
.slot .b { font-weight: 700; font-stretch: 92%; overflow-wrap: anywhere; }
.slot.now .b { font-size: 18px; }
.slot .fav { color: var(--accent); }
.progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--stage, var(--accent)); }

/* Timeline */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 70px 1fr; gap: 10px; }
.tl-time { text-align: right; font-size: 14px; font-weight: 700; padding-top: 12px; }
.tl-time small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.tl-card { border-left: 3px solid var(--stage, var(--accent)); background: var(--surface); border-radius: 0 12px 12px 0; padding: 10px 12px; margin: 4px 0; display: grid; gap: 4px; }
.tl-card.conflict { box-shadow: inset 0 0 0 2px var(--bad); }
.tl-card.seen { opacity: .7; }
.tl-gap { grid-column: 2; margin: 2px 0 6px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 12px; font-size: 14px; display: grid; gap: 6px; }
.tl-walk { grid-column: 2; font-size: 13px; padding: 2px 0 2px 12px; display: flex; gap: 6px; align-items: center; }
.tl-walk.tight { color: var(--bad); font-weight: 650; }
.tl-walk.ok { color: var(--muted); }

/* Bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
}
.tab { flex: 1; border: 0; background: transparent; display: grid; justify-items: center; gap: 2px; padding: 6px 0; min-height: 56px; color: var(--muted); font-size: 12px; font-weight: 650; border-radius: 12px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] svg { stroke-width: 2.4; }

/* Sheet / dialog */
.scrim { position: fixed; inset: 0; background: rgba(10, 8, 20, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 12px; }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 0; }
.sheet h2 { margin: 0; font-size: 22px; font-stretch: 90%; font-weight: 800; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 60; font-weight: 600; max-width: calc(100% - 32px); box-shadow: var(--shadow); }

/* Map */
.map-page { position: fixed; inset: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-rows: auto 1fr; }
.map-bar { padding: calc(env(safe-area-inset-top, 0px) + 8px) max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); background: var(--bg); border-bottom: 1px solid var(--line); display: grid; gap: 8px; z-index: 5; }
#map { width: 100%; height: 100%; background: var(--surface-2); }
.map-fabs { position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); bottom: 16px; display: grid; gap: 8px; z-index: 500; }
.fab { width: 52px; height: 52px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); display: grid; place-items: center; }
.fab.on { color: var(--blue); }
.fab svg { width: 26px; height: 26px; }
.map-status { position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); bottom: 16px; z-index: 500; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; font-size: 13px; box-shadow: var(--shadow); max-width: calc(100% - 100px); }
.leaflet-container { font-family: var(--font-body); background: var(--surface-2); }
.pl { display: grid; place-items: center; }
.pl-dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.pl-label { margin-top: 2px; font-size: 11px; font-weight: 750; color: #fff; background: rgba(20, 18, 34, .78); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.me-dot { width: 20px; height: 20px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.25), 0 1px 4px rgba(0,0,0,.4); }
.pin-mark { font-size: 12px; font-weight: 800; color: #fff; padding: 3px 8px; border-radius: 10px 10px 10px 2px; box-shadow: 0 1px 4px rgba(0,0,0,.45); white-space: nowrap; }
.friend-mark { display: grid; justify-items: center; }
.friend-mark .av { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; box-shadow: 0 1px 4px rgba(0,0,0,.45); }
.friend-mark .age { font-size: 10px; font-weight: 700; color: #fff; background: rgba(20,18,34,.8); padding: 0 5px; border-radius: 6px; margin-top: 2px; }

/* Weather */
.wx-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.wx-table th, .wx-table td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.wx-table th:first-child, .wx-table td:first-child { text-align: left; }
.scroll-x { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

.empty { text-align: center; padding: 24px 12px; display: grid; gap: 10px; justify-items: center; color: var(--muted); }
.empty strong { color: var(--ink); font-size: 18px; }
.banner { border-radius: 12px; padding: 10px 12px; font-size: 14px; display: grid; gap: 6px; }
.banner.warn { background: var(--warn-soft); color: var(--ink); }
.banner.info { background: var(--blue-soft); color: var(--ink); }
.banner.sample { background: var(--accent-soft); color: var(--ink); }
details.info { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.info summary { padding: 12px 14px; font-weight: 750; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
details.info summary::after { content: "+"; color: var(--muted); }
details.info[open] summary::after { content: "–"; }
details.info .body { padding: 0 14px 12px; display: grid; gap: 10px; }
.info-item { display: grid; gap: 2px; }
.info-item b { font-size: 15px; }
.info-item span { font-size: 14px; }
.conf { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: up .18s ease-out; }
  @keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* Keep long content inside the phone width */
.page > *, .tl-item > *, .row .main, .tl-gap, .tl-card { min-width: 0; }
.tl-walk, .tl-gap, .note, .banner { overflow-wrap: anywhere; }
a.btn { text-decoration: none; }
.pl-dot.small { width: 14px; height: 14px; border-width: 2px; }

/* v1.1: never let a long label widen the page */
html, body { overflow-x: clip; max-width: 100%; }
.tag { white-space: normal; overflow-wrap: anywhere; }
.tag.stage { white-space: nowrap; }
.btn { white-space: nowrap; flex-shrink: 0; }
.tl-card .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tl-gap .row { flex-wrap: wrap; }
.kv dd { overflow-wrap: anywhere; }
@keyframes ping { 0% { transform: scale(.6); opacity: .95; } 100% { transform: scale(2.6); opacity: 0; } }
.ping { width: 44px; height: 44px; border-radius: 50%; border: 4px solid #ffd600; box-shadow: 0 0 0 3px rgba(0,0,0,.35); animation: ping .7s ease-out 3; }
@media (prefers-reduced-motion: reduce) { .ping { animation: none; opacity: .9; } }
.legend { display: grid; gap: 6px; }
.legend label { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.legend .sw { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); flex: none; }
.legend .stages { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 34px; }
