  /* ===== Run tracking (beta) =====
     Styles for run.js. The colours come from app.css (--bg, --red and
     so on), so the run screen matches the rest of the app. */

  .betatag{
    font-style:normal;font-family:'Inter',system-ui,sans-serif;
    font-size:10px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;
    color:var(--dim);border:1px solid var(--line);border-radius:5px;padding:2px 6px;
  }
  #runCard .progempty b{color:var(--ink);font-weight:600;}
  #runCard .genbtn{margin-top:12px;}
  .runlist{margin-top:16px;}
  /* The arrow on a run row points right (it opens a screen) and must
     not flip like the Lifts arrows do. */
  .runlist .chev{transform:none !important;}

  /* The run screen covers the whole app, bottom bar included (that is
     z-index 50), but sits under the embers (60) so a saved run can
     still be celebrated. */
  .runscreen{
    position:fixed;inset:0;z-index:55;
    max-width:560px;margin:0 auto;
    background:var(--bg);
    display:none;flex-direction:column;
  }
  .runscreen.open{display:flex;}
  .runscreen [hidden]{display:none !important;}
  html.runlock,html.runlock body{overflow:hidden;}

  /* ----- map ----- */
  .rmap{
    position:relative;flex:1 1 auto;min-height:34%;
    overflow:hidden;background:#111114;
    touch-action:none;                 /* drags and pinches are the map's, not the page's */
    user-select:none;-webkit-user-select:none;
  }
  /* The map pictures arrive light-coloured. Flipping them gives a dark
     map that suits the app without needing a second, paid map style.
     Only this layer is flipped; the route and the credit sit above it. */
  .rtiles{
    position:absolute;inset:0;
    filter:invert(1) hue-rotate(180deg) saturate(.3) brightness(.82) contrast(.92);
  }
  /* Each picture is moved and stretched from its top-left corner (see
     place() in run.js). The current level sits above the old one, which
     stays underneath as a stand-in until the new pictures arrive. */
  .rtiles img{
    position:absolute;left:0;top:0;width:256px;height:256px;
    transform-origin:0 0;z-index:1;
    opacity:0;transition:opacity .2s ease;
  }
  .rtiles img.cur{z-index:2;}
  .rtiles img.in{opacity:1;}
  .rroute{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;}
  .rroute path{fill:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;}
  .rroute path.glow{stroke-width:14;opacity:.2;}
  .rroute path.dash{stroke-width:3;stroke-dasharray:1 8;}
  .rroute circle.start{fill:var(--bg);stroke:#fff;stroke-width:3;}
  .rroute circle.end{fill:#fff;stroke:var(--bg);stroke-width:2;}
  .rdot{
    position:absolute;left:-10px;top:-10px;width:20px;height:20px;border-radius:50%;
    background:var(--red);border:3px solid #fff;pointer-events:none;
    animation:rpulse 2s ease-out infinite;
  }
  @keyframes rpulse{
    0%{box-shadow:0 0 0 0 rgba(208,42,42,.55);}
    100%{box-shadow:0 0 0 18px rgba(208,42,42,0);}
  }
  .rfind{
    position:absolute;inset:0;display:grid;place-items:center;
    color:var(--dim);font-size:14px;
  }
  .rzoom{
    position:absolute;right:12px;bottom:30px;display:flex;flex-direction:column;gap:6px;
  }
  .rzoom button,.rclose,.rcentre,.rgps{
    background:rgba(22,22,26,.92);border:1px solid #32323a;color:var(--ink);
    -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  }
  .rzoom button{
    width:40px;height:40px;border-radius:10px;font-size:20px;line-height:1;
    font-family:inherit;cursor:pointer;
  }
  .rzoom button:active,.rclose:active,.rcentre:active{border-color:var(--red);}
  /* The map provider's credit. Required, and has to stay readable. */
  .rattr{
    position:absolute;right:6px;bottom:5px;
    font-size:10px;color:#b4b4bc;text-decoration:none;
    background:rgba(13,13,15,.7);padding:1px 5px;border-radius:4px;
  }

  /* ----- things floating over the map ----- */
  .rgps,.rclose{position:absolute;top:calc(12px + env(safe-area-inset-top));}
  .rgps{
    left:12px;border-radius:999px;padding:6px 12px 6px 26px;
    font-size:12px;font-weight:500;
  }
  .rgps::before{
    content:"";position:absolute;left:11px;top:50%;margin-top:-4px;
    width:8px;height:8px;border-radius:50%;background:var(--dim);
  }
  .rgps.good::before{background:#4ea35a;}
  .rgps.weak::before{background:#d9a13a;}
  .rgps.off::before{background:var(--red);}
  .rclose{
    right:12px;width:40px;height:40px;border-radius:50%;
    font-size:16px;font-family:inherit;cursor:pointer;
  }
  .rcentre{
    position:absolute;left:50%;transform:translateX(-50%);
    top:calc(12px + env(safe-area-inset-top));
    border-radius:999px;padding:8px 14px;font-size:12px;font-weight:600;
    font-family:inherit;cursor:pointer;
  }

  /* ----- numbers and buttons ----- */
  .rpanel{
    flex:0 0 auto;max-height:62%;overflow-y:auto;
    padding:16px 20px calc(18px + env(safe-area-inset-bottom));
    border-top:1px solid var(--line);background:var(--bg);
  }
  .rnote{color:var(--dim);font-size:12.5px;line-height:1.5;margin-bottom:10px;}
  .rwhen{
    font-family:var(--display);font-weight:600;font-size:13px;
    letter-spacing:.05em;color:var(--red);
  }
  .rbig{display:flex;align-items:baseline;gap:8px;}
  .rbig b{
    font-family:var(--display);font-weight:700;font-size:68px;line-height:1;
    font-variant-numeric:tabular-nums;   /* digits all one width, so the number doesn't jiggle as it counts */
  }
  .rbig span{color:var(--dim);font-size:17px;}
  .rstats{display:flex;gap:10px;margin-top:12px;}
  .rstats > div{flex:1 1 0;min-width:0;}
  .rstats b{
    display:block;font-family:var(--display);font-weight:700;font-size:25px;line-height:1.15;
    font-variant-numeric:tabular-nums;white-space:nowrap;
  }
  .rstats b i{font-style:normal;font-size:12px;font-weight:500;color:var(--dim);margin-left:2px;}
  .rstats small{color:var(--dim);font-size:11.5px;}

  .rbtns{display:flex;gap:10px;margin-top:16px;}
  .rbtn{
    flex:1 1 0;padding:16px 10px;border-radius:12px;cursor:pointer;
    font-family:var(--display);font-weight:700;font-size:18px;letter-spacing:.03em;
    background:var(--panel);border:1px solid var(--line);color:var(--ink);
  }
  .rbtn.go{background:var(--red);border-color:var(--red);color:#fff;}
  .rbtn.sure{border-color:var(--red);color:var(--red);}
  .rbtn:active{opacity:.85;}
  .rlink{
    display:block;width:100%;margin-top:12px;padding:6px;
    background:none;border:none;color:var(--dim);
    font-family:inherit;font-size:13px;text-decoration:underline;cursor:pointer;
  }

  /* ----- mile by mile ----- */
  .rsplits{margin-top:16px;}
  .rsplit{display:flex;align-items:center;gap:10px;padding:4px 0;font-size:13px;}
  .rsplit span{width:16px;color:var(--dim);text-align:right;}
  .rsplit i{flex:1;height:8px;border-radius:4px;background:var(--panel2);overflow:hidden;}
  .rsplit u{display:block;height:100%;border-radius:4px;background:linear-gradient(90deg,#7a261e,#e5372f 55%,#ffbe5c);}
  .rsplit b{width:48px;text-align:right;font-weight:600;font-variant-numeric:tabular-nums;}
  .rkey{color:var(--dim);font-size:12px;margin-top:12px;display:flex;align-items:center;gap:8px;}
  .rkey i{
    flex:0 0 auto;width:44px;height:5px;border-radius:3px;
    background:linear-gradient(90deg,#7a261e,#e5372f 55%,#ffbe5c);
  }

  @media (prefers-reduced-motion: reduce){
    .rdot{animation:none;}
    .rtiles img{transition:none;}
  }

  /* ----- choices before the start, and "how it felt" ----- */
  .ropts{margin-top:14px;display:flex;flex-direction:column;gap:8px;}
  .rchips{display:flex;flex-wrap:wrap;gap:6px;}
  .rchips button{
    background:var(--panel);border:1px solid var(--line);color:var(--dim);
    border-radius:999px;padding:8px 14px;cursor:pointer;
    font-family:inherit;font-size:13px;font-weight:500;
  }
  .rchips button[aria-pressed="true"]{border-color:var(--red);color:var(--ink);background:var(--redglow);}

  /* ----- after the run ----- */
  .rbestline{color:var(--dim);font-size:12.5px;margin-top:10px;}
  .rchart{margin-top:16px;}
  .rcharthead{display:flex;justify-content:space-between;color:var(--dim);font-size:11.5px;margin-bottom:4px;}
  .rchart svg{display:block;width:100%;height:64px;}
  .rchart polyline{fill:none;stroke:#e5372f;stroke-width:2;vector-effect:non-scaling-stroke;stroke-linejoin:round;}
  .rchart polygon{fill:rgba(229,55,47,.14);}
  .rchart line{stroke:#6a6a72;stroke-width:1;stroke-dasharray:3 4;vector-effect:non-scaling-stroke;}
  .rlog{margin-top:16px;display:flex;flex-direction:column;gap:8px;}
  /* 16px text, or an iPhone zooms the whole screen in when the box is tapped. */
  .rlog input,.rlog textarea{
    width:100%;background:var(--panel);border:1px solid var(--line);color:var(--ink);
    border-radius:9px;padding:10px 12px;font-family:inherit;font-size:16px;resize:none;
  }
  .rlog input:focus,.rlog textarea:focus{outline:none;border-color:var(--red);}
  .rroute path.thin{stroke-width:3;}

  /* ----- the Run tab: week, goal, bests ----- */
  .rgoal{height:8px;border-radius:4px;background:var(--panel2);overflow:hidden;margin-top:10px;}
  .rgoal u{display:block;height:100%;border-radius:4px;background:linear-gradient(90deg,#7a261e,#e5372f 55%,#ffbe5c);}
  .rgoalset{display:flex;align-items:center;gap:8px;margin-top:12px;color:var(--dim);font-size:13px;}
  .rgoalset input{
    width:72px;background:var(--panel);border:1px solid var(--line);color:var(--ink);
    border-radius:8px;padding:6px 8px;font-family:inherit;font-size:16px;text-align:center;
  }
  .rgoalset input:focus{outline:none;border-color:var(--red);}
  .rweeks{display:flex;gap:6px;margin-top:18px;}
  .rweek{flex:1 1 0;min-width:0;text-align:center;}
  .rweek b{display:block;height:16px;font-size:11px;font-weight:600;color:var(--dim);font-variant-numeric:tabular-nums;}
  .rweek em{display:flex;align-items:flex-end;height:64px;background:var(--panel);border-radius:5px;overflow:hidden;}
  .rweek i{display:block;width:100%;background:#5a2520;border-radius:5px 5px 0 0;}
  .rweek.now i{background:var(--red);}
  .rweek.now b{color:var(--ink);}
  .rweek span{display:block;margin-top:4px;font-size:10px;color:#6a6a72;}
  .rsub{
    font-family:var(--display);font-weight:600;font-size:13px;letter-spacing:.08em;
    text-transform:uppercase;color:var(--dim);margin-top:20px;
  }
  #runsBlock .rstats{margin-top:6px;}
  #runGround{width:100%;margin:18px 0 0;}

  /* ----- Run this again: the old route as a guide ----- */
  .rroute path.guide{stroke-width:10;opacity:.32;}
  .rguide{color:var(--ink);font-size:13px;margin-top:6px;}
  .rguide.off{color:#d9a13a;}

  /* ----- live calories: four numbers in a row need to be a bit smaller
     to fit a narrow phone, even once the clock passes an hour ----- */
  .rstats.four{gap:6px;}
  .rstats.four b{font-size:22px;}

  /* ----- choosing the voice ----- */
  .rvoice{display:flex;gap:6px;}
  /* 16px text, or an iPhone zooms in when the list is tapped. */
  .rvoice select{
    flex:1 1 auto;min-width:0;background:var(--panel);border:1px solid var(--line);color:var(--ink);
    border-radius:9px;padding:8px 10px;font-family:inherit;font-size:16px;
  }
  .rvoice button{
    flex:0 0 auto;background:var(--panel);border:1px solid var(--line);color:var(--ink);
    border-radius:9px;padding:8px 14px;font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;
  }
  .rvoice button:active{border-color:var(--red);}
  .rvoicetip{color:var(--dim);font-size:11.5px;line-height:1.45;}

  /* ----- share picture -----
     Above the run screen (55), under the embers (60). */
  .rshare{
    position:fixed;inset:0;z-index:57;max-width:560px;margin:0 auto;
    background:var(--bg);display:none;flex-direction:column;
  }
  .rshare.open{display:flex;}
  .rshare [hidden]{display:none !important;}
  .rshareview{
    flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;
    padding:calc(62px + env(safe-area-inset-top)) 20px 12px;
  }
  /* The canvas keeps its 9:16 shape and shrinks to fit. The checks show
     through only where the picture is see-through. */
  .rshareview canvas{
    display:block;height:100%;width:auto;max-width:100%;border-radius:14px;
    background:repeating-conic-gradient(#2a2a30 0 25%, #1d1d22 0 50%) 0 0/22px 22px;
    box-shadow:0 10px 30px rgba(0,0,0,.5);
  }
  .rsharepanel{
    flex:0 0 auto;display:flex;flex-direction:column;gap:10px;
    padding:14px 20px calc(18px + env(safe-area-inset-bottom));
    border-top:1px solid var(--line);
  }
  .rsharepanel .rbtns{margin-top:2px;}
  .rsharepanel .rnote{margin:0;}
