
  :root {
    --panel: #ffffff;
    --bar: #C9E8FA;
    --ink: #1a1d21;
    --muted: #6b7280;
    --line: #e3e6ea;
    --accent: #0b7fd4;
    --accent-dark: #0a6cb4;     --fc: #d97706;              --fc-map: #ffc061;          --fcline: #f0b464;          --seektrack: rgba(26, 29, 33, .18);     --barh: 52px;
    --maxw: 600px;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; overflow: hidden; }
  body {
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    display: flex;
    flex-direction: column;
  }

  #stage { flex: 1 1 auto; position: relative; min-height: 200px; }
  #map { position: absolute; inset: 0; background: #202a33; }
  .leaflet-container { font: inherit; }
  .leaflet-control-attribution { font-size: 10px; }

  .city i, .city span { position: absolute; }
  .city i {
    left: -3px; top: -3px; width: 6px; height: 6px;
    border-radius: 50%; background: #f2f4f6;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .75);
  }
  .city span {
    left: 7px; top: -7px;
    white-space: nowrap;
    font-size: 10.5px;
    color: #dfe3e8;
    text-shadow: 0 0 3px #000, 0 0 2px #000, 0 0 1px #000;
  }
  .city.major i { left: -4px; top: -4px; width: 8px; height: 8px; background: #fff; }
  .city.major span { left: 9px; top: -8px; font-size: 12px; font-weight: 600; color: #fff; }

  .pin i {
    position: absolute;
    left: -7px; top: -7px; width: 14px; height: 14px;
    border-radius: 50%;
    background: #ffb020;
    border: 2px solid #1a1d21;
    box-shadow: 0 0 0 3px rgba(255, 176, 32, .35), 0 1px 4px rgba(0, 0, 0, .6);
  }
  .pin span {
    position: absolute; left: 15px; top: -8px;
    white-space: nowrap; font-size: 11.5px; font-weight: 600;
    color: #ffd489;
    text-shadow: 0 0 3px #000, 0 0 2px #000, 0 0 1px #000;
  }
  .pin b {
    position: absolute; left: 15px; top: 5px;
    white-space: nowrap; font-size: 11px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #cfd6dd;
    text-shadow: 0 0 3px #000, 0 0 2px #000, 0 0 1px #000;
  }
  .pin b.fc { color: var(--fc-map); }
  .pin.noloc b { top: -8px; font-size: 11.5px; }

  #bar {
    position: absolute;
    left: 8px; right: 8px;
    max-width: var(--maxw);
    margin-left: auto; margin-right: auto;
    bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    z-index: 1040;
    height: var(--barh);
    background: var(--bar);
    border: 0;
    border-radius: 26px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
  }

  .btn {
    flex: 0 0 auto;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 50%;
    height: 38px;
    width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
  }
  .btn:disabled { cursor: default; }
  .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  .btn.primary:disabled { background: #9dc4e4; border-color: #9dc4e4; color: #fff; }
  .btn:not(.primary):disabled { opacity: .45; }
  .btn svg { display: block; }

  @media (hover: hover) {
    .btn:hover:not(:disabled) { background: #f3f5f7; border-color: #c4c9d0; }
    .btn.primary:hover:not(:disabled) {
      background: var(--accent-dark);
      border-color: var(--accent-dark);
    }
  }
  .btn.primary:active:not(:disabled) {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
  }

  #time {
    flex: 0 0 auto;
    min-width: 68px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.1;
    text-align: right;
    white-space: nowrap;
  }
  #time small { display: block; font-weight: 400; font-size: 10.5px; color: var(--muted); }
  #time.fc { color: var(--fc); }
  #time.fc small { color: var(--fc); }

  .seekwrap { flex: 1 1 auto; min-width: 60px; position: relative; display: flex; }
  .seekwrap::before {
    content: "";
    position: absolute; left: 0; right: 0; top: 50%;
    height: 3px; margin-top: -1.5px; border-radius: 2px;
    background:
      linear-gradient(to right,
        transparent 0, transparent calc(var(--split, 1) * 100%),
        var(--fcline) calc(var(--split, 1) * 100%), var(--fcline) 100%),
      linear-gradient(to right,
        var(--accent) 0, var(--accent) calc(var(--pos, 0) * 100%),
        transparent calc(var(--pos, 0) * 100%), transparent 100%),
      linear-gradient(var(--seektrack), var(--seektrack));
    pointer-events: none;
  }

  #seek {
    flex: 1 1 auto;
    min-width: 0;
    height: 24px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    position: relative;
    z-index: 1;
    cursor: pointer;
  }
  #seek::-webkit-slider-runnable-track {
    height: 24px; background: transparent; border: 0;
  }
  #seek::-moz-range-track {
    height: 24px; background: transparent; border: 0;
  }
  #seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    margin-top: 5px;     border: 0; border-radius: 50%;
    background: var(--accent);
  }
  #seek::-moz-range-thumb {
    width: 14px; height: 14px;
    border: 0; border-radius: 50%;
    background: var(--accent);
  }
  #seek:active::-webkit-slider-thumb { background: var(--accent-dark); }
  #seek:active::-moz-range-thumb { background: var(--accent-dark); }

  #fcbadge {
    position: absolute;
    top: 66px; left: 50%; transform: translateX(-50%);
    z-index: 500;
    background: rgba(26, 29, 33, .82);
    color: var(--fc);
    border: 1px solid rgba(255, 176, 32, .45);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
    pointer-events: none;
    backdrop-filter: blur(2px);
  }
  #fcbadge[hidden] { display: none; }

  #tapflash {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 25vw; max-width: 500px;
    height: 25vw; max-height: 500px;
    z-index: 800;
    pointer-events: none;
    opacity: 0;
  }
  #tapflash svg { display: block; width: 100%; height: 100%; }
  #tapflash circle { fill: rgba(16, 20, 24, .62); }
  #tapflash path { fill: #fff; }


  #panel {
    position: absolute;
    left: 0; right: 0;
    max-width: var(--maxw);
    margin-left: auto; margin-right: auto;
    bottom: calc(48px + var(--barh) + env(safe-area-inset-bottom, 0px));
    background: var(--panel);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 22px rgba(0, 0, 0, .13);
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 11px;
    z-index: 1200;
    max-height: 78%;
    overflow-y: auto;
  }
  #panel[hidden] { display: none; }

  .prow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  label.f { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }
  #opacity { width: 120px; accent-color: var(--accent); }

  .tbtn {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 7px 12px;
    font: inherit; font-size: 12.5px; font-weight: 600;
    cursor: pointer;
  }
  @media (hover: hover) {
    .tbtn:hover { background: #f3f5f7; border-color: #c4c9d0; }
  }
  .tbtn svg { display: block; }

  #legend { display: flex; width: 100%; height: 13px; }
  #legend .sw { flex: 1 1 0; height: 100%; }
  #legend .sw:first-child { border-radius: 3px 0 0 3px; }
  #legend .sw:last-child { border-radius: 0 3px 3px 0; }
  #legendticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }
  .legendbox { display: flex; flex-direction: column; gap: 4px; }

  #about { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
  #about a { color: var(--muted); }
  #about b { color: var(--ink); }
  #about b.fcnote { color: var(--fc); }
  .stale { color: #b45309; font-weight: 600; }

  .phead { display: flex; align-items: center; justify-content: space-between; }
  .phead h3 { margin: 0; font-size: 13px; font-weight: 600; }
  #close {
    border: 0; background: none; color: var(--muted);
    font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px;
  }

  #msg { margin: auto; max-width: 560px; padding: 28px 24px; text-align: center; color: var(--muted); }
  #msg code {
    display: block; margin-top: 12px; padding: 10px 12px; background: #fff;
    border: 1px solid var(--line); border-radius: 7px; color: var(--ink);
    font-size: 12.5px; word-break: break-all;
  }

  @media (max-width: 600px) {
    :root { --barh: 48px; }
    #time { font-size: 14px; }
    #panel { max-height: 70%; }
  }
