:root {
  --accent: #ff7a2f;
  --cream: #efe7d6;
  --cream-2: #e6dcc6;
  --ink: #20242b;
  --ink-soft: #4a4f57;
  --green: #3fae5a;
  --red: #d2473f;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  --display: 'Baloo 2', var(--font);
}

* { box-sizing: border-box; }

/* Twemoji (flight.html im Cloud-OBS): Emojis als Grafiken */
img.emoji { height: 1.05em; width: 1.05em; margin: 0 .06em; vertical-align: -0.15em; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: #eef2f8;
  background: #0b0f17;
}

#map { position: absolute; inset: 0; }

/* ============================ Runner card ============================ */
.card {
  position: absolute;
  top: 22px;
  left: 22px;
  width: 350px;
  max-width: calc(100vw - 44px);
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 26px;
  padding: 16px;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255,255,255,0.5);
  /* the usercard layers above everything on the map (flight box, timecard, toasts)
     — only the donate modal (60) sits higher */
  z-index: 30;
  transition: opacity 0.3s ease;
}
/* Hidden until the first real state arrives — avoids a flash of placeholder data */
.card.loading { opacity: 0; }
.card::-webkit-scrollbar { width: 0; }

.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar-ring {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 50%;
  padding: 4px;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  flex: none;
}
.avatar {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #cfc6b2;
}
.live-dot {
  position: absolute; right: 1px; bottom: 1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #2ecc71; border: 3px solid var(--cream);
  box-shadow: 0 0 0 0 rgba(46,204,113,0.7);
  animation: pulse 1.8s infinite;
}
.live-dot.stale { background: #9aa0a6; animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46,204,113,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}
.runner-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.5px;
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
/* standalone "live" button, top-right of the map */
.live-btn {
  position: absolute; top: 22px; right: 22px; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  padding: 12px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff3b3b, #e10e0e);
  color: #fff;
  font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: 0.5px;
  box-shadow: 0 12px 30px rgba(225, 14, 14, 0.5), inset 0 1px 0 rgba(255,255,255,0.25);
}
.live-btn:hover { filter: brightness(1.07); }
.live-pulse {
  width: 11px; height: 11px; border-radius: 50%; background: #fff;
  animation: livePulse 1.5s infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.65); }
  70% { box-shadow: 0 0 0 9px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.live-tw { width: 19px; height: 19px; opacity: 0.95; }

/* sub-sections */
.section {
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.section:last-child { margin-bottom: 0; }
.sec-label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  color: var(--ink);
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 10px;
}
.sec-label .ic { font-size: 16px; filter: saturate(1.1); }

.pill-dark {
  background: #1b1f26;
  color: #fff;
  border-radius: 12px;
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  padding: 8px 10px;
  font-variant-numeric: tabular-nums;
}
.pill-budget {
  font-size: 22px; padding: 10px;
  background: #2fa455;
  color: #fff;
}

/* donations */
.donate-btn {
  display: block; text-align: center; text-decoration: none;
  margin-top: 10px; padding: 9px;
  border-radius: 11px;
  font-family: var(--display); font-weight: 800; font-size: 15px;
  color: #fff; background: linear-gradient(180deg, #ff9d2e, #f57a14);
  box-shadow: 0 4px 12px rgba(245, 122, 20, 0.42);
}
.donate-btn:hover { filter: brightness(1.06); }
.donate-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--ink-soft);
  margin: 11px 0 5px;
}
.donate-meta #donate-today { color: var(--ink); font-family: var(--display); letter-spacing: 0; }
.donate-meta #donate-today.full { color: #2f9e54; }
.donate-track {
  height: 7px; border-radius: 6px; background: rgba(0,0,0,0.14);
  overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.18);
}
.donate-track > span {
  display: block; height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, #3fbf6a, #2f9e54);
  transition: width 0.6s ease;
}

.two-col { display: flex; gap: 12px; }
.two-col .col { flex: 1; }
.col-head {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
.pill-green, .pill-red {
  border-radius: 11px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 8px;
  color: #fff;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.pill-green { background: var(--green); }
.pill-red { background: var(--red); margin-bottom: 0; }

/* Strecke section tinted with the accent colour */
.section.strecke {
  background:
    color-mix(in srgb, var(--accent) 26%, #ffffff);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.section.strecke .pill-dark { font-size: 18px; }
.section.zeit .pill-dark { font-size: 16px; letter-spacing: 0.3px; }
#remaining-time.danger { background: var(--red); }
#remaining-time.warn { background: #d98a1f; }

/* collected states */
.states-section.empty { display: none; }
.states-count {
  margin-left: auto; font-size: 13px; font-weight: 800;
  color: color-mix(in srgb, var(--accent) 80%, #000);
}
.states-row { display: flex; flex-wrap: wrap; gap: 7px; }
.state-chip {
  width: 32px; height: 22px; border-radius: 5px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3); border: 1px solid rgba(0,0,0,0.12);
}
.state-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.state-chip.latest { box-shadow: 0 0 0 2px var(--accent), 0 1px 4px rgba(0,0,0,0.35); }

/* progress bar inside the Strecke section */
.progress { margin: 12px 0; }
.progress-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.progress-meta #progress-pct {
  font-family: var(--display); font-weight: 800; font-size: 16px;
  color: color-mix(in srgb, var(--accent) 80%, #000);
}
.progress-cap {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--ink-soft);
}
.progress-track {
  height: 10px; border-radius: 8px;
  background: rgba(0,0,0,0.14);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.18);
}
.progress-track > span {
  display: block; height: 100%; width: 0;
  border-radius: 8px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 75%, #fff),
    color-mix(in srgb, var(--accent) 90%, #000));
  transition: width 0.7s ease;
}

.togo-band {
  background: color-mix(in srgb, var(--accent) 88%, #000);
  border-radius: 14px;
  padding: 10px 12px 8px;
  text-align: center;
  color: #fff;
}
.togo-km {
  font-family: var(--display);
  font-weight: 800;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0.5px;
}
.togo-label {
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  opacity: 0.92; margin-top: 4px;
}

/* Tagesziel — same section shell as the others, with an accent left accent rail */
.daily-section {
  position: relative;
  border-left: 4px solid var(--accent);
  padding-left: 12px;
}
.daily-section.empty { display: none; }
.daily-section .sec-label .ic { filter: none; }
.daily-goal { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.daily-reward { margin-top: 8px; }
.reward-pill {
  display: inline-block;
  background: color-mix(in srgb, var(--accent) 88%, #000);
  color: #fff;
  font-family: var(--display); font-weight: 700; font-size: 13px;
  padding: 4px 11px; border-radius: 20px;
}
.reward-pill:empty { display: none; }

/* bottom-left time card (TAG + Ortszeit) */
.timecard {
  position: absolute;
  left: 22px; bottom: 22px;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 18px;
  padding: 12px 18px;
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.5);
  z-index: 5;
}
.tc-day {
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  color: var(--accent);
}
.tc-divider { width: 1px; align-self: stretch; background: rgba(0,0,0,0.14); }
.tc-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ink-soft);
}
.tc-time {
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px; line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tc-zone {
  font-size: 11px; font-weight: 600; color: var(--ink-soft); margin-top: 2px;
  display: flex; align-items: center; gap: 5px;
}
.loc-flag {
  width: 20px; height: 14px; border-radius: 3px; object-fit: cover;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35); display: none;
}
.tc-weather { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tc-weather.hidden { display: none; }
.tw-emoji { font-size: 22px; line-height: 1; }
.tw-temp { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--ink); }

/* ============================ Live flight data box ============================ */
.flight-box {
  position: absolute;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 18px;
  padding: 11px 20px;
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.5);
  z-index: 5;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.flight-box.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(18px);
  pointer-events: none;
}
/* route — the most prominent part of the box (where the flight goes) */
.fb-route { display: flex; flex-direction: column; gap: 4px; }
.fb-route-codes { display: flex; align-items: center; gap: 9px; }
.fb-plane { font-size: 18px; line-height: 1; color: #ff3ea5; }
.fb-code {
  font-family: var(--display); font-weight: 800; font-size: 27px; line-height: 1;
  color: var(--ink); letter-spacing: 0.5px;
}
.fb-arrow { font-size: 20px; font-weight: 800; color: #ff3ea5; line-height: 1; }
.fb-route-sub {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
}
.fb-callsign { font-weight: 800; color: #ff3ea5; letter-spacing: 0.2px; }
.fb-cities { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.fb-divider { width: 1px; align-self: stretch; background: rgba(0,0,0,0.14); }
.fb-stat { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.fb-label {
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-soft);
}
.fb-value {
  font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--ink);
}

/* ============================ Milestone toast ============================ */
.milestone-toast {
  position: absolute; top: 22px; left: 50%;
  transform: translateX(-50%) translateY(-150%);
  z-index: 15;
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 18px;
  padding: 12px 22px 12px 16px;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.5),
              0 0 0 3px color-mix(in srgb, var(--accent) 65%, transparent);
  transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.35), opacity 0.4s ease;
}
.milestone-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.milestone-toast[hidden] { display: none; }
.ms-flag { width: 46px; height: 32px; border-radius: 6px; object-fit: cover;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35); }
.ms-line1 { font-size: 11px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent); }
.ms-line2 { font-family: var(--display); font-weight: 800; font-size: 20px;
  color: var(--ink); margin-top: 1px; }

/* ============================ Destination airport pin ============================ */
.dest-pin { display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.dest-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #ff3ea5; border: 2.5px solid #fff;
  box-shadow: 0 0 10px rgba(255, 62, 165, 0.8), 0 2px 5px rgba(0,0,0,0.5);
}
.dest-label {
  font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: 0.3px;
  color: #fff; background: rgba(0,0,0,0.72);
  padding: 2px 9px; border-radius: 11px; border: 1px solid rgba(255,255,255,0.18);
  white-space: nowrap;
}

/* ============================ Cinema mode (flight.html) ============================ */
/* Full-screen map for the in-stream flight cam: hide every UI element except the
   map itself and the flight info box (bottom-center, slightly enlarged for OBS). */
body.cinema .card,
body.cinema .timecard,
body.cinema .live-btn,
body.cinema .milestone-toast,
body.cinema .modal-overlay,
body.cinema .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none !important; }
body.cinema .flight-box { transform: translateX(-50%) scale(1.15); transform-origin: bottom center; }
body.cinema .flight-box.hidden { transform: translateX(-50%) scale(1.15) translateY(20px); }

/* ============================ Finish celebration ============================ */
.finish-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.35), rgba(0,0,0,0.62));
  pointer-events: none;
}
.finish-overlay[hidden] { display: none; }
.finish-card {
  text-align: center;
  padding: 34px 48px 30px;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.5),
              0 0 0 4px color-mix(in srgb, var(--accent) 70%, transparent);
  color: var(--ink);
  animation: finishPop 0.6s cubic-bezier(0.18, 0.9, 0.3, 1.3) both;
}
@keyframes finishPop {
  0% { transform: scale(0.6) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.finish-emoji { font-size: 56px; line-height: 1; animation: finishWave 1.6s ease-in-out infinite; }
@keyframes finishWave { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.finish-title {
  font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1;
  letter-spacing: 1px; margin-top: 10px;
  color: var(--accent);
}
.finish-name {
  font-family: var(--display); font-weight: 800; font-size: 26px;
  color: var(--ink); margin-top: 6px;
}
.finish-sub { font-size: 15px; font-weight: 600; color: var(--ink-soft); margin-top: 6px; }
.finish-stats {
  margin-top: 16px; display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}
.finish-stats .fs {
  background: rgba(255,255,255,0.5); border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px; padding: 8px 14px;
}
.finish-stats .fs .v { font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--ink); }
.finish-stats .fs .k { font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--ink-soft); margin-top: 1px; }

/* flight-trail hover tooltip — cream card like START/ZIEL, fades in/out */
.flight-tip-wrap { pointer-events: none; }
.flight-tip {
  position: relative;
  text-align: center; white-space: nowrap;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 6px 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.5);
  pointer-events: none;
  opacity: 0;
  transform: translateY(7px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
/* downward pointer that aims at the line */
.flight-tip::before, .flight-tip::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
}
.flight-tip::before { bottom: -9px; border-top: 9px solid rgba(0, 0, 0, 0.14); }
.flight-tip::after  { bottom: -7px; border-top: 8px solid var(--cream-2); }
.flight-tip.show { opacity: 1; transform: translateY(0) scale(1); }
.flight-tip .ft-main {
  font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: 0.8px;
  color: #ff3ea5;
}
.flight-tip .ft-sub { font-size: 11px; font-weight: 600; color: var(--ink-soft); margin-top: 1px; }

/* ============================ Flight marker ============================ */
.plane-marker { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.plane-icon {
  width: 38px; height: 38px; color: #fff;
  filter: drop-shadow(0 0 7px var(--accent)) drop-shadow(0 2px 3px rgba(0,0,0,0.7));
  transition: transform 0.6s ease;
}
.plane-label {
  margin-top: 2px;
  font-family: var(--display); font-weight: 800; font-size: 12px; letter-spacing: 0.3px;
  color: #fff; background: rgba(0,0,0,0.72);
  padding: 2px 9px; border-radius: 11px; border: 1px solid rgba(255,255,255,0.18);
  white-space: nowrap;
}

/* ============================ Map markers ============================ */
/* Circle + downward pointer; the tail tip sits exactly on the coordinate
   (marker is anchored 'bottom'). */
.map-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--pin, #ff7a2f) 55%, transparent))
          drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5));
}
.map-pin .pin-circle {
  position: relative;
  z-index: 2;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--pin, #ff7a2f);
  border: 3px solid #fff;
  box-shadow: 0 0 18px var(--pin, #ff7a2f);
  display: flex; align-items: center; justify-content: center;
}
.map-pin .pin-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: #cfc6b2;
}
.map-pin .pin-tail {
  position: relative;
  z-index: 1;
  width: 0; height: 0;
  margin-top: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 15px solid var(--pin, #ff7a2f);
}

/* runner pin — bigger, white+accent double ring, live radar ping */
.map-pin.runner .pin-circle {
  width: 54px; height: 54px;
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px var(--pin, #ff7a2f),
              0 0 24px 3px color-mix(in srgb, var(--pin, #ff7a2f) 65%, transparent);
}
.map-pin.runner .pin-img { width: 44px; height: 44px; }
.map-pin.runner .pin-tail {
  margin-top: -6px;
  border-left-width: 9px; border-right-width: 9px; border-top-width: 17px;
}
.map-pin.runner .pin-ping {
  position: absolute;
  left: 50%; top: 0;
  width: 54px; height: 54px; margin-left: -27px;
  border-radius: 50%;
  border: 3px solid var(--pin, #ff7a2f);
  z-index: 0;
  pointer-events: none;
  animation: pinping 2.1s ease-out infinite;
}
@keyframes pinping {
  0%   { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(2.4); opacity: 0; }
}
/* smaller solid endpoint pins (start / goal) */
.map-pin.endpoint .pin-circle {
  width: 28px; height: 28px;
  background: #fff;
  border: 4px solid var(--pin, #ff7a2f);
  box-shadow: 0 0 16px var(--pin, #ff7a2f);
}
.map-pin.endpoint .pin-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--pin, #ff7a2f);
}
.map-pin.endpoint .pin-tail { margin-top: -7px; border-top-width: 13px; }

/* START / ZIEL labels in the user-card (cream) design */
.endpoint-label {
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 5px 12px;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.5);
}
.endpoint-label .el-main {
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1.2px;
  line-height: 1.1;
}
.endpoint-label .el-sub {
  font-size: 11px; font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.1;
}

/* runner name label above the pin — matches the cream card labels */
.runner-label {
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--pin, #ff7a2f);
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 3px 12px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.5);
}
.runner-label:empty { display: none; }

/* ============================ Donation info popup ============================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px);
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  position: relative; width: 100%; max-width: 380px;
  background: linear-gradient(180deg, var(--cream), var(--cream-2));
  border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 24px;
  padding: 26px 24px 24px; color: var(--ink); text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.5);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 10px; right: 14px; border: none; background: transparent;
  font-size: 28px; line-height: 1; color: var(--ink-soft); cursor: pointer; padding: 2px 6px;
}
.modal-close:hover { color: var(--ink); }
.modal-emoji { font-size: 40px; line-height: 1; }
.modal-title { font-family: var(--display); font-weight: 800; font-size: 22px; margin: 8px 0 14px; color: var(--ink); }
.modal-body { text-align: center; font-size: 14px; line-height: 1.5; color: var(--ink-soft); }
.modal-body p { margin: 0 0 10px; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body b { color: var(--ink); }
.modal-cta {
  display: block; margin-top: 18px; padding: 13px; border-radius: 13px; text-decoration: none;
  font-family: var(--display); font-weight: 800; font-size: 16px; color: #fff;
  background: linear-gradient(180deg, #ff9d2e, #f57a14); box-shadow: 0 6px 16px rgba(245, 122, 20, 0.42);
}
.modal-cta:hover { filter: brightness(1.06); }

/* grab handle + chevron for the mobile bottom-sheet (hidden on desktop) */
.card-grip { display: none; }
.card-chevron { display: none; }

/* ============================ Mobile (phones) ============================ */
/* Keep the map full-screen. The time card sits compact at the top-left, and the
   runner card becomes a bottom sheet you can tap to expand — collapsed it's just a
   small handle so the whole map stays visible. */
@media (max-width: 640px) {
  /* lock the page: the map is full-screen and the card is a sheet — nothing should
     scroll or rubber-band the page itself (that's what hijacked the drag) */
  html, body { overflow: hidden; overscroll-behavior: none; height: 100%; height: 100dvh; }
  /* map fills the dynamic viewport (covers behind the iOS Safari toolbar too) */
  #map { height: 100%; height: 100dvh; }

  /* time/day card → compact, top-left (clear of the notch / status bar) */
  .timecard {
    top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; bottom: auto;
    padding: 8px 12px; gap: 10px; border-radius: 14px;
  }

  /* milestone toast → compact, and clearly BELOW the timecard (which is ~90px
     tall with weather + city on phones) so it never covers the day display */
  .milestone-toast {
    top: calc(env(safe-area-inset-top, 0px) + 108px);
    /* shrink-to-fit of left:50% caps an absolute box at half the viewport —
       force the real content width so the text doesn't wrap needlessly */
    width: max-content;
    max-width: calc(100vw - 24px);
    gap: 10px;
    padding: 8px 14px 8px 10px;
    border-radius: 14px;
  }
  .ms-flag { width: 34px; height: 24px; border-radius: 4px; }
  .ms-line1 { font-size: 9px; }
  .ms-line2 { font-size: 15px; }
  .tc-day { font-size: 19px; }
  .tc-time { font-size: 18px; }
  .tc-label { font-size: 9px; }
  .tc-zone { font-size: 10px; }
  .tw-emoji { font-size: 18px; }
  .tw-temp { font-size: 15px; }

  /* Twitch button → compact "LIVE" only, so it doesn't cover the time card */
  .live-btn { top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; padding: 8px 12px; font-size: 12px; gap: 7px; }
  .live-btn .live-tw { width: 17px; height: 17px; }
  .lb-extra { display: none; }

  /* keep the location from pushing the weather chip under the Twitch button */
  .tc-zone span { display: inline-block; max-width: 120px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

  /* runner card → collapsible bottom sheet. Fixed + dvh so it tracks the iOS Safari
     toolbar and always reaches the true bottom edge (no black gap behind the bar). */
  .card {
    position: fixed;
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: none;
    height: 84vh; max-height: 84vh;
    height: 84dvh; max-height: 84dvh;
    border-radius: 22px 22px 0 0;
    padding: 6px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    overscroll-behavior: contain;
    transform: translateY(calc(84vh - 84px)); /* collapsed: only the header peeks */
    transform: translateY(calc(84dvh - 84px));
    transition: transform 0.38s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .card.expanded { transform: translateY(0); overflow-y: auto; -webkit-overflow-scrolling: touch; }

  /* the grab handle + a chevron in the header */
  .card-grip {
    display: block; width: 42px; height: 5px; border-radius: 3px;
    background: rgba(0, 0, 0, 0.22); margin: 4px auto 8px;
  }
  .card-head { cursor: pointer; }
  .card-chevron {
    display: block; margin-left: auto; font-size: 22px; line-height: 1;
    color: var(--ink-soft); transition: transform 0.3s ease;
  }
  .card.expanded .card-chevron { transform: rotate(180deg); }

  /* flight box → just above the collapsed handle, wraps if needed */
  .flight-box {
    left: 12px; right: 12px; bottom: 92px; transform: none;
    width: auto; flex-wrap: wrap; justify-content: center; row-gap: 8px; gap: 12px;
  }
  .flight-box.hidden { transform: translateY(12px); }
  .flight-box .fb-divider { display: none; }
}
