/* The ring race in #raceHud (task U4, src/ui/raceui.js draws it, src/plugins/race.js
   says what). styles.css only says how far down the box starts (under the
   monster's sleepy bar, at each screen size); everything else is here.

   The box is stretched right across the screen and its sideways shift is taken
   off, so the things inside it that belong to the WHOLE screen - the arrow
   that slides round the edge, the big 3-2-1-GO, the finish card - can be
   position:fixed and mean the screen (a shifted parent would make "fixed" mean
   the parent). The clock still sits in the middle of it, where styles.css put it. */
#raceHud{left:0;right:0;transform:none;display:flex;flex-direction:column;align-items:center;gap:8px}
#raceHud .hidden{display:none !important}

/* The clock: GATE 3/12 | 0:42.3 | +3, and the QUIT button beside it */
.raceRow{display:flex;align-items:stretch;gap:8px}
.raceBox{display:flex;align-items:center;gap:12px;background:var(--panel);border:2px solid #f0a819;
  border-radius:14px;padding:7px 16px;box-shadow:0 4px 14px rgba(0,0,0,.4)}
.raceGate{font-size:13px;font-weight:800;letter-spacing:.14em;color:#ffd764}
.raceTime{font-size:28px;font-weight:900;font-variant-numeric:tabular-nums;letter-spacing:.02em;color:#fff;min-width:96px;text-align:center}
.racePen{font-size:16px;font-weight:900;color:#ff8a6a;font-variant-numeric:tabular-nums}

/* QUIT: a kid presses it in flight, so 64 px square on an iPad. */
.raceStop{width:64px;min-height:64px;border-radius:14px;background:var(--panel);border:1px solid var(--edge);
  font-size:22px;font-weight:900;line-height:1;color:var(--ink);opacity:.85;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}
.raceStop small{font-size:10px;font-weight:800;letter-spacing:.14em;color:var(--dim)}
.raceStop:active{transform:scale(.94);opacity:1}

/* 3 - 2 - 1 - GO!  /  MISSED! +3  /  LAST GATE!  /  FINISH!
   Just under the middle of the screen: the next gate hangs just OVER the
   middle (level with the aeroplane, seen from the chase camera), and the
   words must not sit on it. */
.raceBig{position:fixed;z-index:21;left:50%;top:48%;transform:translate(-50%,-50%);pointer-events:none;
  font-size:64px;font-weight:900;letter-spacing:.04em;color:#ffd764;white-space:nowrap;
  text-shadow:0 3px 0 rgba(0,0,0,.55),0 0 22px rgba(0,0,0,.5);animation:raceBig .9s ease-out both}
.raceBig.count{font-size:92px;color:#fff}
.raceBig.go{color:#8dff6a}
.raceBig.miss{font-size:44px;color:#ff8a6a}
@keyframes raceBig{
  0%{opacity:0;transform:translate(-50%,-50%) scale(.5)}
  18%{opacity:1;transform:translate(-50%,-50%) scale(1.15)}
  30%{transform:translate(-50%,-50%) scale(1)}
  100%{opacity:1;transform:translate(-50%,-50%) scale(1)}}

/* The arrow round the screen's edge: a gold dart in a dark disc, the distance
   under it. raceui.js moves the whole thing with translate() and turns the
   dart. It is centred on its point with the negative margins. */
.raceArrow{position:fixed;z-index:20;left:0;top:0;width:64px;height:64px;margin:-32px 0 0 -32px;pointer-events:none;
  border-radius:50%;background:rgba(10,18,34,.72);border:2px solid #f0a819;box-shadow:0 0 16px rgba(255,190,50,.55)}
.raceArrow i{position:absolute;left:0;top:0;width:100%;height:100%;display:block}
.raceArrow i::before{content:"";position:absolute;left:50%;top:9px;margin-left:-13px;
  border-left:13px solid transparent;border-right:13px solid transparent;border-bottom:30px solid #ffd23f}
.raceArrow i::after{content:"";position:absolute;left:50%;top:36px;margin-left:-5px;width:10px;height:14px;background:#ffd23f;border-radius:0 0 3px 3px}
.raceArrow span{position:absolute;left:50%;top:100%;transform:translateX(-50%);margin-top:4px;
  font-size:12px;font-weight:900;letter-spacing:.06em;color:#ffd764;white-space:nowrap;text-shadow:0 1px 3px #000}

/* The finish card: the time, the medal, the three times to beat. */
.raceCard{position:fixed;z-index:21;left:50%;top:30%;transform:translateX(-50%);pointer-events:none;text-align:center;
  background:rgba(14,22,40,.93);border:3px solid #f0a819;border-radius:20px;padding:16px 30px 14px;min-width:300px;
  box-shadow:0 10px 30px rgba(0,0,0,.55);animation:raceCard .45s ease-out both}
@keyframes raceCard{from{opacity:0;transform:translateX(-50%) scale(.7)}}
.raceCardTitle{font-size:15px;font-weight:900;letter-spacing:.18em;color:#9fb0c8}
.raceCardTime{font-size:50px;font-weight:900;font-variant-numeric:tabular-nums;color:#fff;line-height:1.1}
.raceCardMiss{font-size:13px;font-weight:800;letter-spacing:.12em;color:#ffb39f}
.raceCardMedal{font-size:30px;font-weight:900;letter-spacing:.06em;margin:2px 0 6px}
.raceCardMedal.gold{color:#ffd23f}
.raceCardMedal.silver{color:#dfe7f2}
.raceCardMedal.bronze{color:#e8a06a}
.raceCardMedal.ribbon{color:#7fd6ff}
.raceCardNote{font-size:14px;font-weight:800;letter-spacing:.1em;color:#8dff6a}
.raceCardPars{margin-top:8px;font-size:14px;font-weight:800;font-variant-numeric:tabular-nums;color:#c9d6ea;letter-spacing:.04em}

/* A phone on its side is 390 px tall: 160 px down (where styles.css starts the
   box, under the sleepy bar) is the middle of the picture, right on the gate.
   Up under the gauges instead; a monster AND a race at once can share. */
@media (max-height:520px){
  #raceHud{top:calc(58px + var(--safeT))}
}
/* A phone: everything a size down. */
@media (max-height:520px),(max-width:700px){
  .raceBox{padding:4px 12px;gap:8px}
  .raceTime{font-size:22px;min-width:78px}
  .raceStop{width:48px;min-height:48px;font-size:17px}
  .raceBig{font-size:44px}
  .raceBig.count{font-size:66px}
  .raceBig.miss{font-size:30px}
  .raceCard{top:18%;padding:10px 20px;min-width:240px}
  .raceCardTime{font-size:34px}
  .raceCardMedal{font-size:22px}
  .raceArrow{width:52px;height:52px;margin:-26px 0 0 -26px}
  .raceArrow i::before{top:6px;margin-left:-11px;border-left-width:11px;border-right-width:11px;border-bottom-width:24px}
  .raceArrow i::after{top:28px}
}
