/* Toppfart Racer – only what differs from Hover racer's look (../hoverracer/hoverracer.css, plan 4b) */

/* behind the 3D picture until it has loaded: the morning sky over the street */
.tf-stage {
  background: linear-gradient(to bottom, #5f9fe0 0%, #f1dcc4 60%, #3a3b40 100%);
}

/* THE DARK EDGE of the picture (the model game's vignette ~0,2; TUNING.look.vignette -> --vignette). Over the 3D
   picture, under the HUD; never takes a click. */
.tf-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, calc(var(--vignette, 0.2) * 3)) 130%);
}

/* bottom left: "växel 3" with the rev counter as a thin bar under it (hr-laptime's place) */
.tf-gear {
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem 0.55rem;
  background: var(--panel);
  clip-path: polygon(var(--corner) 0, 100% 0, 100% calc(100% - var(--corner)), calc(100% - var(--corner)) 100%,
    0 100%, 0 var(--corner));
}

.tf-gear .hr-digits {
  font-size: 1.7rem;
}

.tf-rev {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.25rem;
  height: 0.22rem;
  background: rgba(10, 16, 40, 0.45);
}

.tf-rev span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: #7ff2e2;
}

.tf-rev span.is-high {
  background: #ffd84a;
}

/* ?fps in the address: the numbers in a small corner (plan section 5: measured on a real Chromebook, TR-2) */
.tf-perf {
  position: absolute;
  left: 0.5rem;
  bottom: 4.2rem;
  margin: 0;
  padding: 0.15rem 0.4rem;
  font: 600 0.7rem/1.2 monospace;
  color: #fff;
  background: rgba(10, 16, 40, 0.6);
  pointer-events: none;
}

.stage.in-menu .tf-perf {
  display: none;
}

/* ----- Touch: steering arrows at the left thumb, brake + gas at the right (SHOW where to touch: plan TR-9) ----- */
.tf-touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.tf-touch[hidden] {
  display: none;
}

.tf-touch-button {
  position: absolute;
  bottom: calc(4.2rem + var(--safe-bottom, 0px));
  width: clamp(3.6rem, 12vmin, 5.6rem);
  height: clamp(3.6rem, 12vmin, 5.6rem);
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 1rem;
  background: rgba(64, 98, 186, 0.45) center / 55% no-repeat;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tf-touch-button.is-held {
  background-color: rgba(127, 242, 226, 0.6);
  border-color: #fff;
}

.tf-left {
  left: calc(0.8rem + var(--safe-left, 0px));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 4 7 12l8 8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.tf-right {
  left: calc(1.6rem + clamp(3.6rem, 12vmin, 5.6rem) + var(--safe-left, 0px));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 4l8 8-8 8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* the pedals: brake = a wide low pedal, gas = a tall narrow one (like in a car) */
.tf-brake {
  right: calc(1.6rem + clamp(3.6rem, 12vmin, 5.6rem) + var(--safe-right, 0px));
  border-color: rgba(255, 120, 120, 0.7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='8' width='18' height='9' rx='2' fill='none' stroke='white' stroke-width='2.2'/%3E%3Cpath d='M6 11h12M6 14h12' stroke='white' stroke-width='1.6'/%3E%3C/svg%3E");
}

.tf-gas {
  right: calc(0.8rem + var(--safe-right, 0px));
  height: calc(clamp(3.6rem, 12vmin, 5.6rem) * 1.45);
  border-color: rgba(127, 242, 226, 0.8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='7' y='2' width='10' height='20' rx='2' fill='none' stroke='white' stroke-width='2.2'/%3E%3Cpath d='M10 6h4M10 10h4M10 14h4M10 18h4' stroke='white' stroke-width='1.6'/%3E%3C/svg%3E");
}

/* the handbrake: above the brake pedal, a lever (the model game: hold it, steer and give gas = a slide) */
.tf-handbrake {
  right: calc(1.6rem + clamp(3.6rem, 12vmin, 5.6rem) + var(--safe-right, 0px));
  bottom: calc(4.2rem + clamp(3.6rem, 12vmin, 5.6rem) + 0.8rem + var(--safe-bottom, 0px));
  border-color: rgba(255, 207, 74, 0.8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 21 15 5' stroke='white' stroke-width='2.6' stroke-linecap='round'/%3E%3Ccircle cx='15.5' cy='4.5' r='2.6' fill='white'/%3E%3Cpath d='M5 21h10' stroke='white' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* with the touch buttons showing, the HUD's bottom panels move up out of the thumbs' way */
.tf-stage:has(.tf-touch:not([hidden])) .hr-speed {
  left: 30%;
  right: 30%;
}

.tf-stage:has(.tf-touch:not([hidden])) .tf-gear {
  top: calc((3.4rem + var(--safe-top, 0px)) / var(--hud, 1));
  bottom: auto;
}

/* top middle, under "rekord": the crashes the car still takes. A heart that goes = a crash (shown, not told) */
.tf-hits {
  top: calc((3.4rem + var(--safe-top)) / var(--hud, 1));
  left: 50%;
  transform: translateX(-50%);
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  background: var(--panel);
  clip-path: polygon(var(--corner) 0, 100% 0, 100% calc(100% - var(--corner)), calc(100% - var(--corner)) 100%,
    0 100%, 0 var(--corner));
}

.tf-heart {
  width: 1.25rem;
  height: 1.25rem;
  color: #ffd84a;
  filter: drop-shadow(0 0 0.25rem rgba(255, 216, 74, 0.6));
  transition: color 0.3s, filter 0.3s, transform 0.3s;
}

.tf-heart.is-gone {
  color: rgba(10, 16, 40, 0.55);
  filter: none;
}

.tf-heart.is-breaking {
  animation: tf-heart-break 0.7s ease-out;
}

@keyframes tf-heart-break {
  0% { color: #ff3fb4; transform: scale(1.6); filter: drop-shadow(0 0 0.5rem #ff3fb4); }
  100% { transform: scale(1); }
}

@media (max-width: 600px) {
  .tf-hits { top: calc((0.75rem + var(--safe-top)) / var(--hud, 1)); }
}

/* ----- The round's coins (score.js, TR-4): the counter under the km, the coins flowing in, the pop-ups ----- */
.tf-coins {
  top: calc((0.6rem + var(--safe-top)) / var(--hud, 1) + 2.7rem);
  left: calc((3.8rem + var(--safe-left)) / var(--hud, 1));
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.55rem 0.22rem 0.4rem;
  font-size: 1.15rem;
  background: var(--panel);
  clip-path: polygon(var(--corner) 0, 100% 0, 100% calc(100% - var(--corner)), calc(100% - var(--corner)) 100%,
    0 100%, 0 var(--corner));
}

.tf-coins .hr-digits {
  padding: 0;
  font-size: 1.5rem;
  background: none;
  clip-path: none;
}

.tf-coins.is-gain .hr-digits {
  color: #ffd84a;
}

/* the coin: a round gold coin drawn in CSS (no picture file) */
.tf-coin {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff7c2 0 12%, #ffd84a 30%, #d99a12 72%, #9a6408 100%);
  box-shadow: inset 0 0 0 0.09em #b97d0b, 0 0 0.35em rgba(255, 216, 74, 0.55);
}

.tf-streams {
  position: absolute;
  top: calc((0.6rem + var(--safe-top)) / var(--hud, 1) + 5.3rem);
  left: calc((3.8rem + var(--safe-left)) / var(--hud, 1));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  pointer-events: none;
}

.tf-stream {
  padding: 0.24rem 0.5rem 0.2rem;
  font: 700 0.85rem/1 "Orbitron", var(--font-display);
  text-transform: lowercase;
  color: #23305f;
  background: #ffd84a;
  clip-path: polygon(0.3rem 0, 100% 0, 100% calc(100% - 0.3rem), calc(100% - 0.3rem) 100%, 0 100%, 0 0.3rem);
  animation: tf-stream 0.6s ease-in-out infinite alternate;
}

.tf-stream.is-wrong {
  color: #fff;
  background: #ff3fb4;
}

.tf-stream[hidden] {
  display: none;
}

.tf-stream::after {
  content: " +";
}

@keyframes tf-stream {
  to { opacity: 0.6; }
}

.tf-pops {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* one NÄRA ÖGAT: a small yellow text BESIDE the car, on the side of the one passed (never over the car or the road
   ahead – owner, 2026-11-17); it rises and fades, the combo makes it a little bigger */
.tf-pop {
  position: absolute;
  top: 52%;
  display: flex;
  flex-direction: column;
  font: italic 900 calc(0.9rem * var(--size, 1) * var(--hud, 1))/1 "Orbitron", var(--font-display);
  color: #ffd84a;
  text-shadow: 0 0 0.4em rgba(255, 168, 0, 0.6), 0 0.08em 0.12em rgba(10, 16, 40, 0.9);
  white-space: nowrap;
  animation: tf-pop 1.3s ease-out forwards;
}

.tf-pop.is-left {
  right: 64%;
  align-items: flex-end;
}

.tf-pop.is-right {
  left: 64%;
  align-items: flex-start;
}

.tf-pop strong {
  font-size: 1.7em;
  color: #fff;
}

.tf-pop .tf-pop-combo {
  margin-top: 0.15em;
  font-size: 0.9em;
  color: #ff3fb4;
}

@keyframes tf-pop {
  0% { opacity: 0; transform: scale(0.5); }
  12% { opacity: 1; transform: scale(1.15); }
  24% { transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-2.5em) scale(0.9); }
}

.stage.in-menu .tf-coins,
.stage.in-menu .tf-streams,
.stage.in-menu .tf-pops {
  display: none;
}

/* the result: one row per post (name, how much, coins) and the total, counting up */
.tf-score-rows {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: calc(0.25 * var(--u)) calc(1 * var(--u));
  margin: calc(0.5 * var(--u)) 0;
  padding: 0;
  list-style: none;
  font-family: "Orbitron", var(--font-display);
}

.tf-score-rows li {
  display: contents;
}

.tf-score-rows span {
  padding: calc(0.2 * var(--u)) 0;
  font-size: calc(0.85 * var(--u));
}

.tf-score-rows span:first-child {
  color: rgba(246, 249, 255, 0.72);
  text-transform: lowercase;
}

.tf-score-rows span:nth-child(2) {
  text-align: right;
}

.tf-score-rows span:last-child {
  text-align: right;
  font-weight: 700;
  color: #ffd84a;
}

.tf-score-rows li:not(.is-shown) span {
  visibility: hidden;
}

.tf-score-total {
  display: flex;
  align-items: center;
  gap: calc(0.4 * var(--u));
  font: 700 calc(2.2 * var(--u))/1 "Orbitron", var(--font-display);
  color: #ffd84a;
}

.tf-wallet {
  margin: calc(0.3 * var(--u)) 0 0;
  font-size: calc(0.8 * var(--u));
  color: rgba(246, 249, 255, 0.8);
}

@media (max-width: 600px) {
  .tf-coins { left: calc((3.4rem + var(--safe-left)) / var(--hud, 1)); }
  .tf-streams { left: calc((3.4rem + var(--safe-left)) / var(--hud, 1)); }
}

@media (prefers-reduced-motion: reduce) {
  .tf-stream { animation: none; }
  .tf-pop { animation-duration: 1.6s; animation-name: tf-pop-still; }
  @keyframes tf-pop-still { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
}

/* The driver's view button (C): under the fullscreen button, shown while driving */
.tf-cockpit-button {
  top: calc(0.6rem + var(--safe-top) + 3.1rem);
  right: calc(0.6rem + var(--safe-right));
}
