:root {
  --font-heavy: GameHeavy, Grobold, "Grobold", "Volkswagen Heavy", "Volkswagen Serial Heavy", "Cooper Black", "Arial Black", Impact, sans-serif;
  --game-ui-scale: 1;
  --game-popup-scale: 1;
  --game-popup-max-width: calc(100vw - 24px);
  --game-popup-max-height: calc(100vh - 24px);
  --outline-1:
    -1px -1px 0 #050306,
    0 -1px 0 #050306,
    1px -1px 0 #050306,
    -1px 0 0 #050306,
    1px 0 0 #050306,
    -1px 1px 0 #050306,
    0 1px 0 #050306,
    1px 1px 0 #050306,
    0 2px 0 #050306;
  --outline-2:
    -2px -2px 0 #050306,
    0 -2px 0 #050306,
    2px -2px 0 #050306,
    -2px 0 0 #050306,
    2px 0 0 #050306,
    -2px 2px 0 #050306,
    0 2px 0 #050306,
    2px 2px 0 #050306,
    0 4px 0 #050306;
  --outline-3:
    -3px -3px 0 #050306,
    0 -3px 0 #050306,
    3px -3px 0 #050306,
    -3px 0 0 #050306,
    3px 0 0 #050306,
    -3px 3px 0 #050306,
    0 3px 0 #050306,
    3px 3px 0 #050306,
    0 5px 0 #050306;
  --bottom-label-outline:
    -1px -1px 0 #050306,
    0 -1px 0 #050306,
    1px -1px 0 #050306,
    -1px 0 0 #050306,
    1px 0 0 #050306,
    -1px 1px 0 #050306,
    0 1px 0 #050306,
    1px 1px 0 #050306,
    0 2px 0 #050306,
    0 3px 0 rgba(5, 3, 6, 0.48);
  color: #fff;
  font-family: var(--font-heavy);
  background: #1b1020;
}

@font-face {
  font-family: GameHeavy;
  src:
    url("../assets/fonts/GROBOLD.ttf?v=be665adfbc2a5") format("truetype"),
    local("Grobold"),
    local("GROBOLD"),
    local("Volkswagen Heavy"),
    local("Volkswagen Serial Heavy"),
    local("Volkswagen-Serial-Heavy"),
    local("Cooper Black");
  font-style: normal;
  font-weight: 900;
  font-display: block;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overflow: clip;
  background: #1b1020;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

body,
#game {
  position: fixed;
  inset: 0;
  max-width: 100vw;
  overflow: hidden;
  overflow: clip;
}

#game {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: stretch;
  overflow: hidden;
  background: #8ff3df;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 420ms ease;
}

.loading-screen-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.loading-progress {
  position: fixed;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: calc(max(24px, env(safe-area-inset-bottom, 0px)) + 4px);
  left: max(24px, env(safe-area-inset-left, 0px));
  z-index: 1001;
  display: block;
  max-width: 740px;
  margin: 0 auto;
  padding: 0;
}

.loading-progress-copy {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 18px 0;
  color: #fff;
  font-size: clamp(20px, 2.4vw, 32px);
  font-weight: 1000;
  line-height: 1;
  pointer-events: none;
  -webkit-text-stroke: 0.55px #050306;
  paint-order: stroke fill;
  text-shadow: var(--bottom-label-outline);
  transform: translateZ(0);
  backface-visibility: hidden;
}

.loading-progress-bar {
  position: relative;
  height: 54px;
}

.loading-progress-fill-layer {
  position: absolute;
  inset: 3px;
  z-index: 2;
  overflow: hidden;
  border-radius: 9px;
}

.loading-progress-track {
  position: absolute;
  inset: 0;
  z-index: 1;
  isolation: isolate;
  border: 3px solid rgba(8, 7, 10, 0.86);
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
}

.loading-progress-track::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 9px;
  background: rgba(22, 14, 25, 0.72);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18);
}

.loading-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  width: 0%;
  height: 100%;
  border-radius: 9px;
  background: linear-gradient(90deg, #35ee62, #ffe95f, #ff932e, #ff4dd2);
  box-shadow: none;
  transition: width 160ms ease;
  transform: translateZ(0);
}

body:not(.is-loading) .loading-screen {
  opacity: 0;
  pointer-events: none;
}

body.loading-complete .loading-screen {
  display: none;
}

@media (pointer: coarse) {
  .loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding:
      calc(env(safe-area-inset-top, 0px) + 14px)
      max(12px, env(safe-area-inset-right, 0px))
      calc(env(safe-area-inset-bottom, 0px) + 14px)
      max(12px, env(safe-area-inset-left, 0px));
    background: linear-gradient(180deg, #8ff3df 0%, #f6c9ff 54%, #8ff3df 100%);
  }

  .loading-screen-image {
    width: min(100%, 720px);
    height: auto;
    max-height: calc(100dvh - 132px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    object-fit: contain;
    object-position: center;
    flex: 0 1 auto;
    filter: drop-shadow(0 8px 0 rgba(25, 13, 34, 0.18));
  }

  .loading-progress {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: min(390px, calc(100vw - 30px));
    max-width: none;
    margin: 0 auto;
    flex: 0 0 auto;
  }

  .loading-progress::before {
    content: none;
    display: none;
  }

  .loading-progress-bar {
    height: 46px;
  }

  .loading-progress-copy {
    padding: 0 15px;
    font-size: clamp(18px, 5.2vw, 24px);
    line-height: 1;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .loading-screen {
    gap: 6px;
    padding:
      calc(env(safe-area-inset-top, 0px) + 10px)
      max(12px, env(safe-area-inset-right, 0px))
      calc(env(safe-area-inset-bottom, 0px) + 10px)
      max(12px, env(safe-area-inset-left, 0px));
  }

  .loading-screen-image {
    max-height: calc(100dvh - 88px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .loading-progress {
    width: min(520px, calc(100vw - 44px));
  }

  .loading-progress::before {
    content: none;
    display: none;
  }

  .loading-progress-bar {
    height: 38px;
  }

  .loading-progress-copy {
    padding: 0 14px;
    font-size: clamp(16px, 3vw, 20px);
  }
}

/* Character customizer */
.icon-button.character {
  z-index: 2;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(135deg, #7ee9ff 0%, #7976ff 48%, #c06ef2 100%);
}

.icon-button.character .character-icon-slot {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 78px;
  height: 69px;
  overflow: visible;
  transform: translateX(-50%);
}

.character-icon-image {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.38));
}

.icon-button.character strong {
  position: absolute;
  right: 3px;
  bottom: 7px;
  left: 3px;
  font-size: 19px;
}

#characterOverlay {
  z-index: 82;
}

.character-modal {
  position: relative;
  display: grid;
  width: min(390px, calc(100vw - 28px));
  height: min(540px, calc(100vh - 72px));
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 4px;
  padding: 15px;
  border: 5px solid #180c21;
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.72), transparent 33%),
    linear-gradient(160deg, #8cecff 0%, #a5bfff 48%, #d7a8ff 100%);
  box-shadow:
    inset 0 6px 0 rgba(255, 255, 255, 0.42),
    inset 0 -7px 0 rgba(62, 31, 118, 0.18),
    0 10px 0 rgba(0, 0, 0, 0.34),
    0 24px 48px rgba(19, 8, 37, 0.34);
  overflow: visible;
}

.character-modal::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px solid rgba(24, 12, 33, 0.24);
  border-radius: 17px;
  pointer-events: none;
}

.character-close {
  position: absolute;
  top: -20px;
  right: -20px;
  z-index: 6;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  padding: 5px 0 0;
  border: 4px solid #180913;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff6e9f, #d42166);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), 0 5px 0 rgba(0, 0, 0, 0.32);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 34px;
  line-height: 1;
  text-shadow: var(--outline-2);
}

.character-title-box {
  position: absolute;
  top: -34px;
  left: 50%;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 2px 9px 4px 16px;
  border: 4px solid #110810;
  border-radius: 12px;
  background: linear-gradient(180deg, #b9f2ff 0%, #61c9f7 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.42),
    0 5px 0 rgba(0, 0, 0, 0.28);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 32px;
  line-height: 0.95;
  text-shadow: var(--outline-3);
  transform: translateX(-50%);
  white-space: nowrap;
}

.character-title-icon {
  display: grid;
  width: 30px;
  height: 46px;
  flex: 0 0 30px;
  place-items: center;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.34));
  transform: translate(-13px, -2px);
}

.character-title-icon img {
  display: block;
  width: 47px;
  height: 47px;
  object-fit: contain;
}

.character-preview-shell {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.36), transparent 57%),
    #bdefff;
}

.character-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.character-part-controls {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.character-part-controls.hidden {
  display: none;
}

.character-arrow {
  --arrow-row: 18%;
  position: absolute;
  top: var(--arrow-row);
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  padding: 0;
  border: 4px solid #06142f;
  border-radius: 16px;
  background: linear-gradient(145deg, #28569d 0%, #102a5d 100%);
  box-shadow:
    inset 0 5px 0 rgba(121, 190, 255, 0.36),
    0 6px 0 rgba(6, 20, 47, 0.38);
  cursor: pointer;
  pointer-events: auto;
  transform: translateY(-50%);
}

.character-arrow:hover {
  filter: brightness(1.08);
}

.character-arrow:active {
  margin-top: 3px;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.62), 0 3px 0 rgba(7, 29, 77, 0.32);
}

.character-arrow.is-left {
  left: 28px;
}

.character-arrow.is-right {
  right: 28px;
}

.character-arrow span {
  width: 46px;
  height: 46px;
  background: url("../assets/icons/character-arrow-blue-hd.png?v=be665adfbc2a5") center / contain no-repeat;
  filter: brightness(1.55) saturate(0.72);
}

.character-arrow.is-left span {
  transform: rotate(180deg);
}

.character-arrow.is-right span {
  transform: none;
}

.character-arrow.row-hair {
  --arrow-row: 17%;
}

.character-arrow.row-shirt {
  --arrow-row: 42%;
}

.character-arrow.row-pants {
  --arrow-row: 66%;
}

.character-arrow.row-shoes {
  --arrow-row: 88%;
}

.character-palette-panel {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: 86px;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: center;
  padding: 11px 14px 15px;
  border: 4px solid #180c21;
  border-radius: 18px;
  background: rgba(255, 250, 244, 0.93);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.75),
    0 6px 0 rgba(0, 0, 0, 0.27);
}

.character-palette-swatch {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  max-width: 66px;
  justify-self: center;
  border: 4px solid #24142f;
  border-radius: 15px;
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.3),
    0 4px 0 rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.character-palette-swatch:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.character-palette-swatch:active {
  transform: translateY(1px) scale(0.96);
}

.character-palette-swatch.is-selected {
  outline: 4px solid #fff;
  outline-offset: -8px;
  box-shadow:
    0 0 0 4px #7049d0,
    inset 0 5px 0 rgba(255, 255, 255, 0.35),
    0 5px 0 rgba(0, 0, 0, 0.3);
}

@media (max-width: 520px), (max-height: 700px) {
  .character-modal {
    width: min(350px, calc(100vw - 18px));
    height: min(495px, calc(100vh - 64px));
    gap: 4px;
    padding: 11px;
  }

  .character-title-box {
    top: -30px;
    padding: 1px 7px 3px 12px;
    font-size: 27px;
  }

  .character-title-icon {
    width: 28px;
    height: 40px;
    flex-basis: 28px;
  }

  .character-title-icon img {
    width: 42px;
    height: 42px;
  }

  .character-close {
    top: -15px;
    right: -15px;
    width: 42px;
    height: 42px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 28px;
  }

  .character-arrow {
    width: 49px;
    height: 49px;
    border-radius: 13px;
  }

  .character-arrow.is-left {
    left: 22px;
  }

  .character-arrow.is-right {
    right: 22px;
  }

  .character-palette-panel {
    min-height: 70px;
    gap: 8px;
    padding: 8px 10px 11px;
  }

  .character-palette-swatch {
    max-width: 54px;
    border-radius: 12px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .character-modal {
    width: min(330px, calc(100vw - 18px));
    height: calc(100vh - 56px);
  }

  .character-palette-panel {
    min-height: 58px;
  }

  .character-palette-swatch {
    max-width: 44px;
  }
}

body.is-loading .hud,
body.is-loading .speed-popups,
body.is-loading .center-message,
body.is-loading .modal-overlay,
body.is-loading .mobile-controls,
body.is-loading .win-claim-toast,
body.is-loading .revive-offer {
  visibility: hidden;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.hud {
  position: fixed;
  z-index: 2;
  pointer-events: none;
}

.hud-top {
  top: 4px;
  right: 18px;
  left: 18px;
}

.top-hud {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 14px;
}

.stage-question {
  position: fixed;
  top: 62px;
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  width: fit-content;
  min-width: 0;
  max-width: min(360px, calc(100vw - 56px));
  padding: 2px 10px 3px;
  border: 2px solid rgba(255, 213, 246, 0.96);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 178, 239, 0.98), rgba(217, 112, 222, 0.98)),
    radial-gradient(circle at 24% 20%, rgba(255, 239, 251, 0.78), transparent 42%);
  color: #ffffff;
  font-size: 34px;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  text-shadow: none;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    0 5px 0 rgba(0, 0, 0, 0.34),
    0 12px 24px rgba(0, 0, 0, 0.28);
}

.stage-question-canvas {
  display: block;
  width: auto;
  max-width: 260px;
  height: auto;
}

.speed-title,
.hearts-title,
.multiplier-stack span,
.progress-label,
.wins-badge,
.stage-strip,
.panel strong,
.icon-button strong,
.custom-speed-button strong,
.emoji-hud-button strong,
.emoji-choice,
.center-message strong,
.rebirth-modal h2,
.rebirth-level,
.rebirth-multiplier-card,
.rebirth-progress,
.rebirth-button,
.rebirth-speed,
.speed-popup {
  -webkit-text-stroke: 0;
  font-family: var(--font-heavy);
  paint-order: stroke fill;
  text-shadow: var(--outline-2);
}

.speed-title,
.hearts-title {
  position: relative;
  display: block;
  width: clamp(232px, 20.5vw, 268px);
  min-height: 48px;
  padding: 0;
  border: 4px solid #102234;
  border-radius: 14px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.96), rgba(214, 253, 255, 0.9) 58%, rgba(164, 231, 255, 0.82)),
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, 0.9), transparent 28%);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.72),
    inset 0 -3px 0 rgba(39, 117, 155, 0.2),
    0 4px 0 rgba(7, 13, 22, 0.78),
    0 7px 16px rgba(0, 0, 0, 0.24);
  color: #fff;
  font-size: clamp(31px, 2.75vw, 41px);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 0.95;
  text-align: left;
  text-shadow: var(--outline-3);
}

.speed-title {
  transform: translate(-72px, 3px);
}

.hearts-title {
  position: absolute;
  top: 3px;
  left: calc(50% + 92px);
  width: clamp(164px, 13vw, 182px);
  min-height: 42px;
  border-width: 3px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.96), rgba(255, 202, 226, 0.92) 58%, rgba(255, 151, 190, 0.86)),
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, 0.9), transparent 28%);
}

.hearts-title.is-low {
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.96), rgba(255, 164, 184, 0.95) 58%, rgba(255, 82, 119, 0.9)),
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, 0.9), transparent 28%);
  animation: low-heart-pulse 980ms ease-in-out infinite;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.72),
    inset 0 -3px 0 rgba(155, 39, 54, 0.38),
    0 4px 0 rgba(7, 13, 22, 0.78),
    0 0 10px 2px rgba(255, 24, 62, 0.82),
    0 0 24px 5px rgba(255, 52, 86, 0.46),
    0 0 42px 7px rgba(255, 92, 120, 0.22);
}

@keyframes low-heart-pulse {
  0%,
  100% {
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.72),
      inset 0 -3px 0 rgba(155, 39, 54, 0.38),
      0 4px 0 rgba(7, 13, 22, 0.78),
      0 0 9px 2px rgba(255, 24, 62, 0.72),
      0 0 22px 5px rgba(255, 52, 86, 0.4),
      0 0 38px 6px rgba(255, 92, 120, 0.18);
  }
  50% {
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.78),
      inset 0 -3px 0 rgba(155, 39, 54, 0.5),
      0 4px 0 rgba(7, 13, 22, 0.78),
      0 0 13px 3px rgba(255, 20, 58, 0.92),
      0 0 30px 7px rgba(255, 46, 82, 0.58),
      0 0 50px 9px rgba(255, 94, 122, 0.3);
  }
}

.hearts-title .speed-title-copy strong {
  left: 43%;
  top: 2px;
}

.hearts-title .speed-title-copy span {
  left: 2px;
  top: 30px;
  font-size: clamp(14px, 1.15vw, 18px);
}

@media (pointer: fine) and (max-width: 1728px) {
  .hearts-title .speed-title-copy strong {
    left: 50%;
    font-size: 0.7em;
    top: 56%;
    transform: translate(-50%, -50%);
  }
}

.speed-title-icon {
  position: absolute;
  left: -39px;
  top: 70%;
  z-index: 1;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  color: #ffe65e;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 58px;
  line-height: 1;
  text-shadow:
    -3px -3px 0 #102234,
    0 -3px 0 #102234,
    3px -3px 0 #102234,
    -3px 0 0 #102234,
    3px 0 0 #102234,
    -3px 3px 0 #102234,
    0 3px 0 #102234,
    3px 3px 0 #102234,
    0 6px 0 rgba(7, 13, 22, 0.7);
  transform: translateY(-50%) rotate(-8deg);
}

.hearts-title-icon {
  position: absolute;
  left: -52px;
  top: 60%;
  z-index: 1;
  display: grid;
  width: 94px;
  height: 94px;
  place-items: center;
  transform: translateY(-50%) rotate(-7deg);
  filter: drop-shadow(0 6px 0 rgba(7, 13, 22, 0.72));
}

.hearts-title-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.speed-title-copy {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  min-width: 0;
}

.speed-title-copy strong {
  position: relative;
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 5px;
  color: #fff;
  -webkit-text-fill-color: #fff;
  font-size: 0.86em;
  line-height: 1.05;
  white-space: nowrap;
  transform: translateX(-50%);
  -webkit-text-stroke: 3px #050306;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #050306;
}

.speed-title-copy strong::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: #fff;
  -webkit-text-fill-color: #fff;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

#topSpeedValue {
  color: #fff;
  -webkit-text-fill-color: #fff;
  width: min(210px, calc(100% - 44px));
  text-align: center;
}

@media (pointer: fine) {
  #topSpeedValue {
    top: 1px;
  }
}

#topSpeedValue::after {
  content: none;
}

.speed-title-copy span {
  display: block;
  position: absolute;
  left: 9px;
  top: 33px;
  color: #fff;
  font-size: clamp(16px, 1.35vw, 20px);
  line-height: 1;
  text-shadow: var(--outline-3);
}

.is-safari .speed-title,
.is-safari .hearts-title,
.is-safari .multiplier-stack span,
.is-safari .progress-label,
.is-safari .wins-badge,
.is-safari .stage-strip,
.is-safari .panel strong,
.is-safari .icon-button strong,
.is-safari .center-message strong,
.is-safari .rebirth-modal h2,
.is-safari .rebirth-level,
.is-safari .rebirth-multiplier-card,
.is-safari .rebirth-progress,
.is-safari .rebirth-button,
.is-safari .rebirth-speed,
.is-safari .speed-popup {
  -webkit-text-stroke: 1.2px #050306;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 #050306;
}

.is-safari .speed-title,
.is-safari .hearts-title,
.is-safari .rebirth-modal h2 {
  -webkit-text-stroke-width: 2px;
  text-shadow: 0 5px 0 #050306;
}

.is-safari .speed-title-copy span {
  -webkit-text-stroke: 1.4px #050306;
  text-shadow: 0 4px 0 #050306;
}

.is-safari .speed-title-copy strong {
  -webkit-text-stroke: 3px #050306;
  text-shadow: 0 3px 0 #050306;
}

.is-safari .speed-title-copy strong::after {
  -webkit-text-stroke: 0;
  -webkit-text-fill-color: #fff;
  text-shadow: none;
}

.is-safari .progress-label,
.is-safari .wins-badge,
.is-safari .rebirth-level,
.is-safari .rebirth-multiplier-card,
.is-safari .rebirth-progress,
.is-safari .rebirth-button {
  -webkit-text-stroke-width: 1.7px;
  text-shadow: 0 4px 0 #050306;
}

.is-safari .stage-strip,
.is-safari .progress-label {
  -webkit-text-stroke: 0.55px #050306;
  paint-order: stroke fill;
  text-shadow: var(--bottom-label-outline);
}

.multiplier-stack {
  display: grid;
  gap: 7px;
  align-content: center;
}

.multiplier-stack.right {
  text-align: right;
}

.multiplier-stack span {
  color: #ff8f2c;
  font-size: clamp(12px, 1.1vw, 16px);
  font-weight: 1000;
  line-height: 1.12;
  letter-spacing: 0;
}

.multiplier-stack.right span:first-child {
  color: #ffffff;
}

.multiplier-stack.right span:last-child {
  color: #ffffff;
}

#trailMultiplierTop {
  color: #ffd4f4;
  -webkit-text-fill-color: #ffd4f4;
  -webkit-text-stroke: 1px #ff49da;
  text-shadow:
    0 2px 0 #9c0b74,
    0 3px 5px rgba(63, 0, 48, 0.42);
}

#rebirthMultiplierTop {
  color: #c9f5ff;
  -webkit-text-fill-color: #c9f5ff;
  -webkit-text-stroke: 1px #31dfff;
  text-shadow:
    0 2px 0 #006c89,
    0 3px 5px rgba(0, 38, 54, 0.42);
}

.hud-left {
  top: 86px;
  left: 14px;
  display: grid;
  gap: 10px;
  overflow: visible;
}

.wins-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: 150px;
  color: #fff;
  font-size: 40px;
  font-weight: 1000;
  line-height: 1;
  text-shadow: var(--outline-2);
}

.wins-badge span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  -webkit-text-stroke: 0;
  font-size: 27px;
}

.trophy-icon-image,
.trophy-inline-icon {
  display: block;
  object-fit: contain;
  filter:
    drop-shadow(0 -1px 0 #080402)
    drop-shadow(1px 0 0 #080402)
    drop-shadow(0 1px 0 #080402)
    drop-shadow(-1px 0 0 #080402)
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.34));
}

.trophy-icon-image {
  width: 40px;
  height: 40px;
}

.menu-grid {
  display: grid;
  grid-template-columns: 110px;
  gap: 10px;
  overflow: visible;
}

.icon-button {
  position: relative;
  display: grid;
  width: 110px;
  height: 106px;
  place-items: center;
  padding: 7px;
  border: 3px solid #140b08;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  overflow: visible;
  pointer-events: auto;
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.35),
    0 7px 0 rgba(0, 0, 0, 0.35),
    0 9px 18px rgba(0, 0, 0, 0.25);
}

.icon-button::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 8px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 28% 28%, rgba(255, 255, 255, 0.4), transparent 24%);
  opacity: 0.9;
}

.icon-button span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 54px;
  height: 50px;
  place-items: center;
  font-size: 38px;
  -webkit-text-stroke: 0;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5));
}

.menu-icon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.icon-button .rebirth-icon-slot {
  width: 80px;
  height: 66px;
  justify-items: center;
  overflow: visible;
}

.rebirth-icon-image {
  width: 80px;
  height: 80px;
  margin: 0;
  transform: translateY(-6px);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5));
}

.icon-button .trail-icon-slot {
  width: 96px;
  height: 66px;
  justify-items: center;
  overflow: visible;
}

.trail-icon-image {
  width: 94px;
  height: 94px;
  object-fit: contain;
  margin-top: -11px;
  transform: translateX(-6px);
  border-radius: 8px;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.5));
}

.icon-button strong {
  position: relative;
  z-index: 1;
  align-self: end;
  font-size: 23px;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
}

.menu-alert {
  position: absolute;
  z-index: 3;
  top: -8px;
  right: -8px;
  display: none;
  width: 26px;
  height: 26px;
  border: 3px solid #140b08;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, #fff7a8 0 18%, transparent 20%),
    radial-gradient(circle, #ff3030 0 54%, #b40019 56% 100%);
  box-shadow:
    0 0 0 3px rgba(255, 37, 58, 0.22),
    0 0 18px rgba(255, 36, 48, 0.95),
    0 4px 0 rgba(0, 0, 0, 0.3);
  animation: menu-alert-pulse 1.05s ease-in-out infinite;
}

.icon-button.has-alert .menu-alert {
  display: block;
}

.rebirth-button.rebirth-ready {
  animation: rebirth-ready-bounce 1.35s ease-in-out infinite;
}

@keyframes rebirth-ready-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 0 0 rgba(126, 244, 255, 0));
  }
  50% {
    transform: translateY(-4px) scale(1.035);
    filter: drop-shadow(0 0 10px rgba(126, 244, 255, 0.65));
  }
}

@keyframes menu-alert-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow:
      0 0 0 3px rgba(255, 37, 58, 0.18),
      0 0 14px rgba(255, 36, 48, 0.75),
      0 4px 0 rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: scale(1.15);
    box-shadow:
      0 0 0 6px rgba(255, 37, 58, 0.16),
      0 0 26px rgba(255, 36, 48, 1),
      0 4px 0 rgba(0, 0, 0, 0.3);
  }
}

.icon-button:hover {
  transform: translateY(2px);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.32),
    0 5px 0 rgba(0, 0, 0, 0.35),
    0 8px 16px rgba(0, 0, 0, 0.25);
}

.icon-button.blue {
  background: linear-gradient(145deg, #b9ecff, #6faee8);
}

.icon-button.red {
  background: linear-gradient(145deg, #ff9b92, #d83b3b);
}

.icon-button.icy {
  background: linear-gradient(145deg, #c9eeff, #75b3df);
}

.icon-button.cyan {
  background: linear-gradient(145deg, #6ab7ff, #6657d9);
}

.icon-button.purple {
  background: linear-gradient(145deg, #c9a5ff, #7a45ce);
}

.icon-button.violet {
  background: linear-gradient(145deg, #d19aff, #8a50bb);
}

.icon-button.fire {
  background: linear-gradient(145deg, #ff655f, #b9151d);
}

.icon-button.gift {
  z-index: 1;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.3), transparent 32%),
    linear-gradient(135deg, #ff5fae 0%, #ffcf4a 28%, #6df76e 50%, #58d8ff 72%, #b166ff 100%);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.42),
    0 7px 0 rgba(0, 0, 0, 0.38),
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 0 15px 5px rgba(255, 79, 184, 0.72),
    0 0 28px 10px rgba(255, 220, 76, 0.4),
    0 0 40px 14px rgba(84, 224, 255, 0.34);
  animation: gift-ui-glow 1.65s ease-in-out infinite;
}

.icon-button.skin {
  z-index: 2;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.26), transparent 34%),
    linear-gradient(135deg, #66f0ff 0%, #75f49a 35%, #ffdb58 68%, #ff72c8 100%);
}

.icon-button.skin .skin-icon-slot {
  position: absolute;
  top: 5px;
  left: 50%;
  z-index: 1;
  width: 104px;
  height: 62px;
  justify-items: center;
  overflow: visible;
  transform: translateX(-50%);
}

.skin-icon-image {
  width: 116px;
  height: 79px;
  object-fit: contain;
  transform: translate(-14px, -7px);
  filter: none;
}

.icon-button.skin strong {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 7px;
  z-index: 2;
}

.icon-button.gift::before {
  inset: 9px;
  z-index: auto;
  border-radius: 8px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 28% 28%, rgba(255, 255, 255, 0.4), transparent 24%);
  opacity: 0.9;
  filter: none;
  transform: none;
  animation: none;
}

.icon-button.gift:hover {
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.32),
    0 5px 0 rgba(0, 0, 0, 0.35),
    0 0 0 4px rgba(255, 255, 255, 0.2),
    0 0 17px 6px rgba(255, 79, 184, 0.78),
    0 0 30px 11px rgba(255, 220, 76, 0.44),
    0 0 42px 15px rgba(84, 224, 255, 0.38);
}

.icon-button.gift.has-alert {
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.42),
    0 7px 0 rgba(0, 0, 0, 0.38),
    0 0 0 4px rgba(255, 255, 255, 0.18),
    0 0 15px 5px rgba(255, 79, 184, 0.72),
    0 0 28px 10px rgba(255, 220, 76, 0.4),
    0 0 40px 14px rgba(84, 224, 255, 0.34);
}

.icon-button.gift::after {
  content: none;
}

@keyframes gift-ui-glow {
  0%,
  100% {
    box-shadow:
      inset 0 4px 0 rgba(255, 255, 255, 0.42),
      0 7px 0 rgba(0, 0, 0, 0.38),
      0 0 0 4px rgba(255, 255, 255, 0.16),
      0 0 13px 4px rgba(255, 79, 184, 0.62),
      0 0 25px 9px rgba(255, 220, 76, 0.32),
      0 0 36px 12px rgba(84, 224, 255, 0.26);
  }
  50% {
    box-shadow:
      inset 0 4px 0 rgba(255, 255, 255, 0.48),
      0 7px 0 rgba(0, 0, 0, 0.38),
      0 0 0 5px rgba(255, 255, 255, 0.24),
      0 0 20px 7px rgba(255, 62, 180, 0.86),
      0 0 36px 13px rgba(255, 232, 82, 0.52),
      0 0 50px 18px rgba(80, 230, 255, 0.44);
  }
}

.icon-button .gift-icon-slot {
  width: 76px;
  height: 62px;
  justify-items: center;
  overflow: visible;
}

.gift-icon-image {
  width: 60px;
  height: 60px;
  object-fit: contain;
  transform: translate(-1px, -3px);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.42));
}

.hidden {
  display: none !important;
}

html.is-chromebook .leaderboard,
html.is-chromebook .panel,
html.is-chromebook .modal-overlay {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html.is-chromebook .menu-alert,
html.is-chromebook .rebirth-button.rebirth-ready,
html.is-chromebook .icon-button.gift {
  animation: none;
}

.leaderboard {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 6px);
  right: calc(env(safe-area-inset-right, 0px) + 11px);
  z-index: 5;
  width: min(254px, calc(100vw - 28px));
  padding: 6px 7px 1px;
  border: 3px solid #130916;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(75, 31, 94, 0.96), rgba(28, 12, 38, 0.95)),
    radial-gradient(circle at 18% 0%, rgba(255, 137, 224, 0.28), transparent 42%);
  color: #fff;
  pointer-events: none;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 rgba(0, 0, 0, 0.3),
    0 14px 28px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(7px);
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 13px;
  gap: 2px;
  margin-bottom: 3px;
}

.leaderboard-header strong {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  min-width: 0;
  gap: 3px;
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 14px;
  line-height: 13px;
  text-shadow: 0 1px 0 #100615, 0 0 2px #100615;
  white-space: nowrap;
}

.leaderboard-room-code {
  display: inline-block;
  margin-left: 0;
  color: #fbe8ff;
  font-size: 11px;
  line-height: 13px;
  white-space: nowrap;
}

.leaderboard-room-code b {
  color: #ffe985;
  font-size: 12px;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) 46px 36px;
  align-items: center;
  gap: 2px;
}

.leaderboard-grid > :nth-child(2) {
  transform: translateX(-3px);
}

.leaderboard-grid-head {
  height: 12px;
  padding: 0 2px;
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 9.5px;
  line-height: 1;
  text-shadow: 0 1px 0 #100615;
}

.leaderboard-body {
  display: grid;
  gap: 1px;
}

.leaderboard-row {
  box-sizing: border-box;
  height: 16px;
  min-height: 16px;
  padding: 0 3px;
  border: 1px solid rgba(16, 7, 18, 0.68);
  border-radius: 5px;
  background: rgba(12, 5, 17, 0.34);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 0 #09030c;
}

.leaderboard-row > span:not(.leaderboard-name) {
  font-size: 12px;
  letter-spacing: -0.3px;
  -webkit-text-stroke: 1.2px #050306;
  paint-order: stroke fill;
  text-shadow: 0 1px 0 #050306;
}

.leaderboard-row.is-local {
  background: rgba(255, 215, 64, 0.24);
  border-color: rgba(255, 240, 135, 0.78);
}

.leaderboard-name {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.leaderboard-player-name {
  box-sizing: border-box;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  margin: -3px 0;
  padding: 3px;
  color: #fff;
  font-size: 13px;
  font-style: normal;
  line-height: 1;
  letter-spacing: -0.15px;
  text-overflow: ellipsis;
  -webkit-text-stroke: 1.35px var(--player-outline, #151018);
  paint-order: stroke fill;
  text-shadow: 0 1px 0 var(--player-outline, #151018), 0 0 1px var(--player-outline, #151018);
  white-space: nowrap;
}

.leaderboard-name i {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-grid;
  width: 12px;
  height: 12px;
  margin-right: 3px;
  padding-top: 1px;
  place-items: center;
  border-radius: 999px;
  background: rgba(19, 9, 22, 0.58);
  color: #ffe985;
  font-style: normal;
  font-size: 9.5px;
}

.leaderboard-row:nth-child(1) .leaderboard-name i {
  border: 1px solid #fff0a3;
  background: linear-gradient(180deg, #ffe978, #d99a16);
  color: #fff4e8;
  box-shadow: 0 0 5px rgba(255, 215, 65, 0.72);
}

.leaderboard-row:nth-child(2) .leaderboard-name i {
  border: 1px solid #ffc4ec;
  background: linear-gradient(180deg, #ff9dde, #d943a6);
  color: #fff4e8;
  box-shadow: 0 0 5px rgba(255, 91, 196, 0.58);
}

.leaderboard-row:nth-child(3) .leaderboard-name i {
  border: 1px solid #f4f7ff;
  background: linear-gradient(180deg, #e9edf6, #929caf);
  color: #fff4e8;
  box-shadow: 0 0 4px rgba(218, 229, 248, 0.55);
}

.leaderboard-row:nth-child(4) .leaderboard-name i {
  border: 1px solid #f4bd8b;
  background: linear-gradient(180deg, #d9955f, #93502e);
  color: #fff4e8;
  box-shadow: 0 0 4px rgba(193, 105, 58, 0.52);
}

.room-code-panel {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: auto;
}

.room-code-toggle {
  display: none;
}

.room-code-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 5px;
}

.room-code-form input,
.room-code-form button {
  min-width: 0;
  height: 25px;
  border: 2px solid #130916;
  border-radius: 6px;
  font-family: var(--font-heavy);
  font-size: 12px;
  line-height: 1;
  outline: none;
}

.room-code-form input {
  padding: 1px 7px 0;
  background: rgba(255, 255, 255, 0.9);
  color: #26152b;
  text-transform: lowercase;
}

.room-code-form input.is-error::placeholder {
  color: #a51d34;
  font-size: 11px;
  opacity: 1;
  text-transform: none;
}

.room-code-form button {
  padding: 0 5px;
  background: linear-gradient(180deg, #67ff8f, #17b848);
  color: #fff;
  text-shadow: var(--outline-1);
  cursor: pointer;
}

.room-code-status {
  min-height: 10px;
  margin-top: 3px;
  color: #fff2a8;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
  text-shadow: var(--outline-1);
}

.room-code-status:empty {
  display: none;
}

.sound-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: auto;
  left: calc(env(safe-area-inset-left, 0px) + 14px);
  z-index: 32;
  display: grid;
  width: 48px;
  height: 48px;
  padding: 4px;
  place-items: center;
  border: 3px solid #130916;
  border-radius: 10px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.78), transparent 22%),
    linear-gradient(180deg, #fff589 0%, #ffc83f 50%, #ff9f2e 100%);
  cursor: pointer;
  pointer-events: auto;
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.34),
    0 5px 0 rgba(0, 0, 0, 0.34),
    0 12px 22px rgba(0, 0, 0, 0.24);
}

.sound-toggle::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 7px;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.58), transparent 28%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.26) 0 5px, rgba(255, 137, 36, 0.16) 5px 10px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.sound-toggle img {
  position: relative;
  z-index: 1;
  display: block;
  width: 39px;
  height: 39px;
  object-fit: contain;
  filter:
    drop-shadow(0 -1px 0 #080402)
    drop-shadow(1px 0 0 #080402)
    drop-shadow(0 1px 0 #080402)
    drop-shadow(-1px 0 0 #080402)
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.34));
}

.sound-toggle:hover {
  transform: translateY(-1px);
}

.sound-toggle:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.28),
    0 3px 0 rgba(0, 0, 0, 0.34),
    0 8px 16px rgba(0, 0, 0, 0.2);
}

.sound-toggle.is-muted {
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.78), transparent 22%),
    linear-gradient(180deg, #a8fff0 0%, #3fd9ff 52%, #4f8cff 100%);
}

.multiplier-stack.right {
  display: none;
}

.hud-right {
  top: 316px;
  right: 14px;
  display: grid;
  gap: 10px;
}

.emoji-hud-button {
  position: relative;
  display: grid;
  justify-self: end;
  width: 84px;
  height: 80px;
  margin-right: 0;
  place-items: center;
  padding: 6px;
  border: 3px solid #140b08;
  border-radius: 11px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.52), transparent 25%),
    linear-gradient(145deg, #a8f4ff 0%, #48c9ff 52%, #2b79ff 100%);
  color: #fff;
  cursor: pointer;
  overflow: visible;
  pointer-events: auto;
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.38),
    0 7px 0 rgba(0, 0, 0, 0.35),
    0 10px 22px rgba(0, 0, 0, 0.25);
}

.emoji-hud-button::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 7px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.24) 0 7px, rgba(34, 153, 255, 0.12) 7px 14px);
  pointer-events: none;
}

.emoji-hud-button:hover,
.emoji-hud-button.is-open {
  transform: translateY(2px);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.34),
    0 5px 0 rgba(0, 0, 0, 0.35),
    0 0 22px rgba(255, 236, 89, 0.58);
}

.emoji-hud-icon {
  position: absolute;
  top: -2px;
  left: 50%;
  z-index: 1;
  display: grid;
  width: 76px;
  height: 54px;
  place-items: center;
  transform: translateX(-50%);
}

.emoji-hud-icon img {
  display: block;
  width: 76px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.48));
}

.emoji-hud-button strong {
  position: relative;
  z-index: 1;
  align-self: end;
  justify-self: center;
  margin-bottom: 1px;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  -webkit-text-stroke: 0.55px #050306;
  text-shadow: var(--bottom-label-outline);
}

.custom-speed-button {
  position: relative;
  display: grid;
  justify-self: end;
  width: 84px;
  height: 80px;
  margin-right: 0;
  place-items: center;
  padding: 6px;
  border: 3px solid #140b08;
  border-radius: 11px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.54), transparent 25%),
    linear-gradient(145deg, #d9ff9a 0%, #8dff86 52%, #38d96a 100%);
  color: #fff;
  cursor: pointer;
  overflow: visible;
  pointer-events: auto;
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.38),
    0 7px 0 rgba(0, 0, 0, 0.35),
    0 10px 22px rgba(0, 0, 0, 0.25);
}

.custom-speed-button::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 7px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.24) 0 7px, rgba(51, 215, 96, 0.13) 7px 14px);
  pointer-events: none;
}

.custom-speed-button:hover,
.custom-speed-button:not(.is-locked).is-open {
  transform: translateY(2px);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.34),
    0 5px 0 rgba(0, 0, 0, 0.35),
    0 0 22px rgba(155, 255, 116, 0.58);
}

.custom-speed-button.is-locked {
  filter: saturate(0.45) brightness(0.76);
}

.custom-speed-icon {
  position: absolute;
  top: 1px;
  left: 50%;
  z-index: 1;
  display: grid;
  width: 72px;
  height: 48px;
  place-items: center;
  overflow: visible;
  border-radius: 8px;
  transform: translateX(-50%);
}

.custom-speed-icon img {
  display: block;
  width: 68px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.48));
}

.custom-speed-button strong {
  position: relative;
  z-index: 1;
  align-self: end;
  justify-self: center;
  margin-bottom: -2px;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  -webkit-text-stroke: 0.55px #050306;
  text-shadow: var(--bottom-label-outline);
}

.emoji-menu {
  position: fixed;
  top: 306px;
  right: calc(env(safe-area-inset-right, 0px) + 108px);
  z-index: 34;
  display: grid;
  grid-template-columns: repeat(4, 54px);
  gap: 8px;
  padding: 17px;
  border: 4px solid #140b08;
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.38), transparent 28%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.13) 0 10px, rgba(57, 146, 255, 0.11) 10px 20px),
    linear-gradient(180deg, #baf6ff 0%, #73d7ff 52%, #58b4ff 100%);
  pointer-events: auto;
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.34),
    inset 0 -5px 0 rgba(15, 86, 152, 0.24),
    0 8px 0 rgba(0, 0, 0, 0.32),
    0 16px 28px rgba(0, 0, 0, 0.26);
}

.emoji-menu::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid rgba(10, 43, 76, 0.72);
  border-radius: 11px;
  pointer-events: none;
}

.emoji-choice {
  position: relative;
  z-index: 1;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  padding: 3px;
  border: 3px solid #140b08;
  border-radius: 14px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.56), transparent 28%),
    linear-gradient(180deg, #ffd95b, #ff9b2f);
  cursor: pointer;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.42),
    0 4px 0 rgba(0, 0, 0, 0.34);
}

.emoji-choice:hover {
  transform: translateY(2px) scale(1.04);
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.66), transparent 28%),
    linear-gradient(180deg, #fff06d, #ffb13d);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.42),
    0 2px 0 rgba(0, 0, 0, 0.34),
    0 0 18px rgba(255, 226, 89, 0.52);
}

.emoji-choice img {
  display: block;
  width: 43px;
  height: 43px;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.38));
}

.emoji-shortcut {
  position: absolute;
  z-index: 2;
  top: -7px;
  left: -7px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 2px solid #140b08;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #ffe46b);
  color: #ffffff;
  font-family: var(--font-heavy);
  font-size: 12px;
  line-height: 1;
  -webkit-text-stroke: 0.35px #140b08;
  text-shadow:
    -1px -1px 0 #140b08,
    0 -1px 0 #140b08,
    1px -1px 0 #140b08,
    -1px 0 0 #140b08,
    1px 0 0 #140b08,
    0 1px 0 #140b08;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.42),
    0 2px 0 rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.panel {
  position: relative;
  width: 118px;
  border: 3px solid #140b08;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(67, 34, 89, 0.92), rgba(35, 17, 47, 0.92));
  color: #fff;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.18), 0 6px 0 rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.panel {
  padding: 8px 10px;
}

.panel-compact-stat {
  width: 84px;
  padding-right: 7px;
  padding-left: 7px;
  background:
    radial-gradient(circle at 24% 13%, rgba(255, 255, 255, 0.58), transparent 26%),
    linear-gradient(145deg, #ffc5f3 0%, #ff82d8 52%, #e64fbc 100%);
  overflow: hidden;
  text-align: center;
}

.panel-compact-stat::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 14%, rgba(255, 255, 255, 0.42), transparent 24%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0 5px, transparent 5px 11px);
  pointer-events: none;
}

.panel-compact-stat span {
  position: relative;
  z-index: 1;
  font-size: 8px;
}

.panel-compact-stat strong {
  position: relative;
  z-index: 1;
  font-size: 10px;
}

.panel span {
  display: block;
  color: #efe4ff;
  font-family: var(--font-heavy);
  font-size: 14px;
  font-weight: 1000;
  text-shadow: var(--outline-1);
}

.panel strong {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-size: 23px;
  line-height: 1;
}

.panel.panel-compact-stat > .multiplier-label {
  position: relative;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  font-size: 14px;
}

.panel.panel-compact-stat > .multiplier-label::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  pointer-events: none;
}

.panel.panel-compact-stat strong {
  margin-top: 5px;
  font-size: 16px;
}

.panel.panel-compact-stat > #boost {
  color: #fff;
  -webkit-text-fill-color: #fff;
  -webkit-text-stroke: 0;
  paint-order: normal;
  text-shadow: var(--outline-1);
}

.hud-bottom {
  right: 18px;
  bottom: 28px;
  left: 18px;
}

/*
 * Desktop HUD groups are authored at their full-size presentation dimensions.
 * Scale them together when the game is embedded in a smaller browser area so
 * their proportions stay intact while their edge anchors remain predictable.
 * Touch layouts have their own purpose-built rules below and in mobile.css.
 */
@media (pointer: fine) {
  html:not(.has-touch-controls) .hud-top {
    transform: scale(var(--game-ui-scale));
    transform-origin: top center;
  }

  html:not(.has-touch-controls) .hud-left {
    transform: scale(var(--game-ui-scale));
    transform-origin: top left;
  }

  html:not(.has-touch-controls) .hud-right,
  html:not(.has-touch-controls) .leaderboard,
  html:not(.has-touch-controls) .emoji-menu {
    transform: scale(var(--game-ui-scale));
    transform-origin: top right;
  }

  html:not(.has-touch-controls) .hud-bottom {
    transform: scale(var(--game-ui-scale));
    transform-origin: bottom center;
  }

  html:not(.has-touch-controls) .sound-toggle {
    transform: scale(var(--game-ui-scale));
    transform-origin: top left;
  }

  html:not(.has-touch-controls) .sound-toggle:hover {
    transform: translateY(-1px) scale(var(--game-ui-scale));
  }

  html:not(.has-touch-controls) .sound-toggle:active {
    transform: translateY(2px) scale(var(--game-ui-scale));
  }

  html.is-compact-ui:not(.has-touch-controls) .hud-left {
    top: clamp(50px, 10vh, 86px);
    left: 10px;
  }

  html.is-compact-ui:not(.has-touch-controls) .hud-right {
    top: clamp(164px, 40vh, 292px);
    right: 10px;
  }

  html.is-compact-ui:not(.has-touch-controls) .hud-bottom {
    right: 12px;
    bottom: 14px;
    left: 12px;
  }

  html.is-compact-ui:not(.has-touch-controls) .leaderboard {
    top: calc(env(safe-area-inset-top, 0px) + 6px);
    right: calc(env(safe-area-inset-right, 0px) + 7px);
  }

  html.is-compact-ui:not(.has-touch-controls) .sound-toggle {
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: calc(env(safe-area-inset-left, 0px) + 10px);
  }

  html.is-compact-ui:not(.has-touch-controls) .emoji-menu {
    top: clamp(154px, 38vh, 282px);
    right: calc(env(safe-area-inset-right, 0px) + 84px);
  }
}

.progress-wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: 0;
}

.stage-strip {
  display: grid;
  place-items: center;
  position: relative;
  width: min(280px, calc(100vw - 44px));
  margin: 0 auto 7px;
  padding: 5px 14px 7px;
  border: 3px solid #12070f;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--stage-label-top, #ffe1f3) 0%, var(--stage-label-bottom, #ff9ed4) 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 1000;
  text-align: center;
  white-space: nowrap;
  -webkit-text-stroke: 0.5px #050306;
  paint-order: stroke fill;
  text-shadow: var(--bottom-label-outline);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.6),
    0 4px 0 rgba(0, 0, 0, 0.28),
    0 0 14px var(--stage-label-glow, rgba(255, 158, 212, 0.28));
}

.stage-strip[data-mask-stud="1"]::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: var(--stage-title-stud-mask-x, -999px);
  top: 50%;
  width: 9px;
  height: 20px;
  transform: translateY(-48%);
  pointer-events: none;
  background: linear-gradient(180deg, var(--stage-label-top, #ffe1f3) 0%, var(--stage-label-bottom, #ff9ed4) 100%);
}

.progress-label {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 18px 0;
  color: #fff;
  font-size: clamp(20px, 2.4vw, 32px);
  font-weight: 1000;
  line-height: 1;
  pointer-events: none;
  -webkit-text-stroke: 0.55px #050306;
  paint-order: stroke fill;
  text-shadow: var(--bottom-label-outline);
  transform: translateZ(0);
  backface-visibility: hidden;
}

.progress-label span {
  display: flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}

.hud-outlined-text-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.hud-smooth-readout {
  position: relative;
  overflow: visible;
}

.hud-smooth-readout .hud-outlined-text-canvas {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  transform-origin: right center;
}

.hud-smooth-readout[data-hud-text-align="left"] .hud-outlined-text-canvas {
  right: auto;
  left: 0;
  transform-origin: left center;
}

.progress-label #level {
  flex: 1 1 40%;
}

.progress-label #speed {
  justify-content: flex-end;
  flex: 1 1 60%;
  text-align: right;
  transform: none;
}

.progress-track {
  position: relative;
  height: 54px;
  overflow: hidden;
  border: 3px solid rgba(8, 7, 10, 0.86);
  border-radius: 12px;
  background: rgba(22, 14, 25, 0.72);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    0 4px 0 rgba(0, 0, 0, 0.28);
}

.progress-track::after {
  content: none;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 0%;
  height: 100%;
  border-radius: 9px;
  background: linear-gradient(90deg, #35ee62, #ffe95f, #ff932e, #ff4dd2);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.18),
    inset 0 -4px 0 rgba(0, 0, 0, 0.1);
  transition: width 160ms ease;
  transform: translateZ(0);
}

.center-message {
  position: fixed;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  min-width: min(360px, calc(100vw - 32px));
  gap: 5px;
  padding: 18px 20px;
  border: 3px solid #08070a;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 94, 194, 0.92), rgba(87, 39, 138, 0.92));
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.25), 0 8px 0 rgba(0, 0, 0, 0.35);
  animation: center-message-pop 620ms cubic-bezier(0.18, 0.9, 0.22, 1) both;
}

.center-message.hidden {
  display: none;
}

.center-message strong {
  color: #ffe85e;
  font-size: 32px;
  font-weight: 1000;
  line-height: 1;
}

.center-message span {
  color: #fff;
  font-size: 16px;
  font-weight: 1000;
  text-shadow: 0 2px 0 #08070a;
}

.mobile-controls {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.mobile-stick,
.mobile-jump,
.mobile-camera-zone {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
}

.mobile-stick {
  position: absolute;
  z-index: 2;
  left: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  width: 112px;
  height: 112px;
  border: 3px solid rgba(7, 5, 12, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.52), transparent 25%),
    rgba(20, 16, 26, 0.42);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.18),
    0 5px 0 rgba(0, 0, 0, 0.24),
    0 10px 22px rgba(0, 0, 0, 0.28);
}

.mobile-stick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border: 3px solid #12070f;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.86), transparent 28%),
    linear-gradient(180deg, #fff799, #51ee89);
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.12),
    0 4px 0 rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%);
}

.mobile-jump {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border: 3px solid #12070f;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.85), transparent 28%),
    linear-gradient(180deg, #ff8bd6, #7d58ff);
  overflow: hidden;
  padding: 0;
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.3),
    0 6px 0 rgba(0, 0, 0, 0.34),
    0 12px 24px rgba(0, 0, 0, 0.22);
}

.mobile-jump-icon {
  display: block;
  width: 104%;
  height: 104%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
  transform: translateY(1px);
}

.mobile-camera-zone {
  position: absolute;
  z-index: 1;
  top: 84px;
  right: 0;
  bottom: 136px;
  width: 52vw;
}

@keyframes center-message-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.82);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(28, 8, 35, 0.42);
  backdrop-filter: blur(5px);
  pointer-events: auto;
}

.modal-overlay.hidden {
  display: none;
}

#worldPortalOverlay {
  z-index: 88;
}

.world-portal-modal {
  position: relative;
  width: min(410px, calc(100vw - 28px));
  overflow: hidden;
  padding: 24px 24px 22px;
  border: 5px solid #180913;
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.58), transparent 22%),
    repeating-linear-gradient(-18deg, rgba(255, 255, 255, 0.1) 0 8px, transparent 8px 22px),
    linear-gradient(145deg, #ff75c7 0%, #a671ff 48%, #66eaff 100%);
  box-shadow:
    inset 0 6px 0 rgba(255, 255, 255, 0.34),
    inset 0 -7px 0 rgba(48, 10, 92, 0.18),
    0 10px 0 rgba(0, 0, 0, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.3);
  color: #fff;
  text-align: center;
}

.world-portal-modal::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 3px solid rgba(24, 9, 19, 0.72);
  border-radius: 16px;
  pointer-events: none;
}

.world-portal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 4px solid #180913;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff6e9f, #d42166);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), 0 4px 0 rgba(0, 0, 0, 0.3);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 26px;
  line-height: 1;
  text-shadow: var(--outline-2);
}

.world-portal-kicker {
  position: relative;
  display: inline-block;
  margin: 0 auto 10px;
  padding: 6px 18px;
  border: 3px solid #180913;
  border-radius: 999px;
  background: #fff36a;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-shadow: var(--outline-2);
  text-transform: uppercase;
}

.world-portal-modal h2 {
  position: relative;
  margin: 6px 4px 20px;
  color: #fff;
  font-family: var(--font-heavy);
  font-size: clamp(22px, 4.2vw, 29px);
  line-height: 1.05;
  white-space: nowrap;
  text-shadow: var(--outline-3), 0 5px 0 rgba(67, 19, 92, 0.42);
}

.world-portal-confirm {
  position: relative;
  min-width: 210px;
  padding: 12px 26px 13px;
  border: 4px solid #180913;
  border-radius: 16px;
  background: linear-gradient(180deg, #82ff76 0%, #22d966 100%);
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.38), 0 6px 0 rgba(0, 0, 0, 0.32);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 24px;
  text-shadow: var(--outline-2);
  transition: transform 120ms ease, filter 120ms ease;
}

.world-portal-confirm:hover {
  filter: brightness(1.07);
  transform: translateY(-2px);
}

.world-portal-confirm:active,
.world-portal-close:active {
  transform: translateY(3px);
}

.world-portal-confirm:focus-visible,
.world-portal-close:focus-visible {
  outline: 4px solid #fff36a;
  outline-offset: 3px;
}

@media (max-height: 520px) {
  .world-portal-modal {
    padding: 16px 20px 15px;
  }

  .world-portal-kicker {
    margin-bottom: 6px;
    padding: 4px 15px;
    font-size: 13px;
  }

  .world-portal-modal h2 {
    margin-bottom: 14px;
    font-size: 23px;
  }

  .world-portal-confirm {
    padding-block: 9px 10px;
    font-size: 21px;
  }
}

#mathQuizOverlay {
  z-index: 86;
}

.rebirth-modal {
  position: relative;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  padding: clamp(16px, 3vw, 30px);
  border: 5px solid #180913;
  border-radius: 24px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.42), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 38%),
    repeating-linear-gradient(-18deg, rgba(255, 255, 255, 0.1) 0 9px, transparent 9px 24px),
    linear-gradient(160deg, #ff80cd 0%, #a5efff 48%, #8b72ff 100%);
  box-shadow:
    inset 0 6px 0 rgba(255, 255, 255, 0.32),
    inset 0 -8px 0 rgba(48, 10, 92, 0.16),
    0 12px 0 rgba(0, 0, 0, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.rebirth-modal::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid rgba(24, 9, 19, 0.78);
  border-radius: 17px;
  pointer-events: none;
}

.rebirth-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 1;
  width: 54px;
  height: 54px;
  border: 4px solid #180913;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff6e9f, #d42166);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 34px;
  line-height: 1;
  text-shadow: var(--outline-2);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), 0 5px 0 rgba(0, 0, 0, 0.32);
}

.rebirth-close,
.trail-close,
.daily-close,
.math-quiz-close {
  display: grid;
  place-items: center;
  padding: 5px 0 0;
}

.rebirth-kicker {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-top: 6px;
  margin-bottom: 14px;
  padding: 5px 14px 7px;
  border: 3px solid #180913;
  border-radius: 999px;
  background: #ffe968;
  color: #fff;
  font-size: clamp(15px, 2.3vw, 22px);
  line-height: 1;
  text-shadow: none;
}

.rebirth-modal h2 {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.8vw, 18px);
  margin: 0 54px 12px;
  color: #fff;
  font-size: clamp(44px, 8vw, 76px);
  line-height: 0.95;
  text-shadow: var(--outline-3);
}

.rebirth-modal h2 span {
  display: block;
}

.rebirth-title-icon {
  width: clamp(58px, 7.4vw, 88px);
  height: clamp(58px, 7.4vw, 88px);
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 0 #050306) drop-shadow(0 0 10px rgba(126, 244, 255, 0.38));
}

.rebirth-level {
  position: relative;
  z-index: 1;
  width: min(330px, 74%);
  margin: 0 auto 16px;
  padding: 12px 14px;
  border: 4px solid #180913;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff59a, #ffcf4e);
  color: #fff;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.42), 0 5px 0 rgba(0, 0, 0, 0.24);
}

.rebirth-multiplier-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
  margin-bottom: 10px;
}

.rebirth-multiplier-card {
  display: grid;
  min-width: 0;
  min-height: clamp(76px, 14vw, 104px);
  place-items: center;
  padding: 8px;
  border: 4px solid #180913;
  border-radius: 14px;
  background: linear-gradient(180deg, #bdf6ff, #4dc7ff);
  color: #fff;
  font-size: clamp(24px, 4.5vw, 42px);
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.38), 0 5px 0 rgba(0, 0, 0, 0.2);
}

.rebirth-arrow {
  color: #ffe968;
  font-size: clamp(34px, 5vw, 52px);
  text-shadow: var(--outline-2);
}

.rebirth-modal p {
  position: relative;
  z-index: 1;
  margin: 4px 0 10px;
  color: #fff;
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 1000;
  text-shadow: var(--outline-2);
}

.rebirth-progress {
  position: relative;
  z-index: 1;
  padding: 8px 14px;
  border: 4px solid #180913;
  border-radius: 12px;
  background: rgba(61, 27, 92, 0.62);
  color: #fff;
  font-size: clamp(24px, 4.2vw, 40px);
  line-height: 1;
}

.rebirth-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(220px, 420px);
  justify-content: center;
  margin-top: 14px;
}

.rebirth-button {
  min-height: clamp(62px, 10vw, 78px);
  border: 5px solid #180913;
  border-radius: 16px;
  background: linear-gradient(180deg, #7dff84, #22b74d);
  color: #fff;
  cursor: pointer;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1;
  box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.34), 0 7px 0 rgba(0, 0, 0, 0.35);
}

.rebirth-button.locked {
  filter: grayscale(0.55);
  opacity: 0.72;
}

.rebirth-speed {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: #fff;
  font-size: clamp(20px, 3.5vw, 34px);
  line-height: 1;
}

.trail-modal {
  position: relative;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  padding: clamp(16px, 3vw, 28px);
  border: 5px solid #180913;
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.38), transparent 18%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 24px),
    linear-gradient(160deg, #ff8bd5 0%, #aa78ff 52%, #68ddff 100%);
  box-shadow:
    inset 0 6px 0 rgba(255, 255, 255, 0.3),
    0 12px 0 rgba(0, 0, 0, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.28);
}

.skin-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1040px, calc(100vw - 28px));
  height: auto;
  max-height: calc(100vh - 28px);
  overflow: hidden;
  padding: clamp(12px, 2.1vw, 20px) clamp(16px, 3vw, 28px) clamp(16px, 3vw, 28px);
  border: 5px solid #180913;
  border-radius: 24px;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.38), transparent 18%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 24px),
    linear-gradient(140deg, #82f2ff 0%, #a98bff 50%, #ff92db 100%);
  box-shadow:
    inset 0 6px 0 rgba(255, 255, 255, 0.3),
    0 12px 0 rgba(0, 0, 0, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.28);
}

.revive-offer {
  position: fixed;
  left: 50%;
  top: clamp(112px, 15vh, 132px);
  z-index: 5;
  display: inline-grid;
  grid-template-columns: 28px auto 28px;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: fit-content;
  max-width: min(280px, calc(100vw - 90px));
  min-height: 38px;
  padding: 5px 8px 6px;
  border: 3px solid #140912;
  border-radius: 10px;
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 255, 255, 0.32), transparent 18%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 7px, transparent 7px 18px),
    linear-gradient(180deg, #31eb5c, #079f2d);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: clamp(14px, 1.85vw, 18px);
  line-height: 1;
  text-align: center;
  text-shadow: var(--outline-2);
  overflow: visible;
  transform: translateX(-50%);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.28),
    0 4px 0 rgba(0, 0, 0, 0.38),
    0 0 10px rgba(74, 255, 103, 0.42),
    0 0 20px rgba(74, 255, 103, 0.18);
  animation: revive-offer-aura 1.65s ease-in-out infinite;
}

.revive-offer::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.34);
  border-radius: 7px;
  pointer-events: none;
}

.revive-offer::after {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -1;
  border: 2px solid rgba(106, 255, 126, 0.32);
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  animation: revive-offer-ring 1.65s ease-out infinite;
}

.revive-offer strong {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding-inline: 0.06em 0.12em;
  overflow: visible;
  white-space: nowrap;
}

.revive-offer-question {
  display: inline-block;
  min-width: 0.42em;
  margin-left: 0.02em;
  padding-inline: 0 0.04em;
  overflow: visible;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 1.12em;
  line-height: 1;
  text-shadow: var(--outline-2);
}

.revive-offer-wing {
  position: relative;
  z-index: 1;
  display: block;
  flex: 0 0 auto;
  width: 28px;
  height: 21px;
  background: url("../assets/icons/revive-wing.png?v=be665adfbc2a5") center / contain no-repeat;
  filter:
    drop-shadow(0 2px 0 #170812)
    drop-shadow(0 0 5px rgba(255, 255, 255, 0.82));
  transform: translateY(-2px);
}

.revive-offer-wing.right {
  transform: translateY(-2px) scaleX(-1);
}

@keyframes revive-offer-aura {
  0%,
  100% {
    transform: translateX(-50%);
    box-shadow:
      inset 0 4px 0 rgba(255, 255, 255, 0.28),
      0 4px 0 rgba(0, 0, 0, 0.38),
      0 0 10px rgba(74, 255, 103, 0.38),
      0 0 18px rgba(74, 255, 103, 0.16);
  }
  50% {
    transform: translateX(-50%);
    box-shadow:
      inset 0 4px 0 rgba(255, 255, 255, 0.34),
      0 4px 0 rgba(0, 0, 0, 0.36),
      0 0 14px rgba(135, 255, 95, 0.5),
      0 0 28px rgba(135, 255, 95, 0.2);
  }
}

@keyframes revive-offer-ring {
  0% {
    opacity: 0.36;
    transform: scale(0.96);
  }
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

.math-quiz-modal {
  position: relative;
  width: min(620px, calc(100vw - 28px));
  padding: 24px 26px 28px;
  border: 5px solid #170812;
  border-radius: 24px;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 255, 255, 0.55), transparent 16%),
    repeating-linear-gradient(-24deg, rgba(255, 255, 255, 0.14) 0 10px, transparent 10px 24px),
    linear-gradient(150deg, #ff72c7 0%, #fff173 48%, #7ff4ff 100%);
  text-align: center;
  box-shadow:
    inset 0 6px 0 rgba(255, 255, 255, 0.36),
    0 12px 0 rgba(0, 0, 0, 0.36),
    0 18px 34px rgba(0, 0, 0, 0.26);
}

.is-hearts-quiz .math-quiz-modal {
  width: min(520px, calc(100vw - 28px));
  padding: 14px 20px 18px;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.48), transparent 15%),
    repeating-linear-gradient(-24deg, rgba(255, 255, 255, 0.13) 0 10px, transparent 10px 24px),
    linear-gradient(150deg, #ff80a4 0%, #ffb1a8 46%, #ffd5ce 100%);
}

.is-hearts-quiz .math-quiz-modal h2 {
  margin-top: 24px;
  margin-bottom: 6px;
  font-size: clamp(34px, 5.4vw, 46px);
}

.math-quiz-modal::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid rgba(23, 8, 18, 0.72);
  border-radius: 17px;
  pointer-events: none;
}

.math-quiz-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 1;
  width: 50px;
  height: 50px;
  border: 4px solid #170812;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff6e9f, #d42166);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 31px;
  line-height: 1;
  text-shadow: var(--outline-2);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), 0 5px 0 rgba(0, 0, 0, 0.32);
}

.is-hearts-quiz .math-quiz-close {
  display: none;
}

.math-quiz-kicker,
.math-quiz-progress,
.math-quiz-question,
.math-quiz-feedback,
.math-quiz-form button,
.math-quiz-keypad button {
  position: relative;
  z-index: 1;
  font-family: var(--font-heavy);
  text-shadow: var(--outline-2);
}

.math-quiz-kicker {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-top: -8px;
  margin-bottom: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  text-shadow:
    -1px -1px 0 #07162f,
    0 -1px 0 #07162f,
    1px -1px 0 #07162f,
    -1px 0 0 #07162f,
    1px 0 0 #07162f,
    -1px 1px 0 #07162f,
    0 1px 0 #07162f,
    1px 1px 0 #07162f,
    0 2px 0 rgba(7, 22, 47, 0.62);
}

.is-hearts-quiz .math-quiz-kicker {
  margin-top: 3px;
  margin-bottom: 8px;
}

.kicker-time {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 7px;
  min-width: 156px;
  min-height: 28px;
  place-items: center;
  border: 2px solid #07162f;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8fbff, #aeefff 58%, #72d8ff);
  color: #ffffff;
  font-size: 18px;
  text-transform: uppercase;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.58),
    0 2px 0 rgba(7, 22, 47, 0.28);
}

.is-hearts-quiz .kicker-time {
  position: relative;
  min-width: 184px;
  min-height: 28px;
  height: 28px;
  padding: 0 46px 0 14px;
  border: 2px solid #3d0712;
  border-color: #3d0712;
  background: linear-gradient(180deg, #ff8ca7, #f13d67 58%, #bf1238);
  font-size: 18px;
  overflow: visible;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.52),
    0 2px 0 rgba(61, 7, 18, 0.34),
    0 0 12px rgba(255, 42, 80, 0.28);
}

.is-hearts-quiz .math-quiz-progress {
  font-size: 20px;
}

.is-hearts-quiz .math-quiz-question {
  margin: 10px auto 12px;
  padding: 12px 16px 10px;
  font-size: clamp(38px, 7.8vw, 66px);
}

.is-hearts-quiz .math-quiz-answer-field,
.is-hearts-quiz .math-quiz-answer-field input {
  height: 54px;
}

.is-hearts-quiz .math-quiz-form button {
  min-width: 126px;
  font-size: 25px;
}

.is-hearts-quiz .math-quiz-feedback {
  min-height: 24px;
  margin-top: 6px;
}

.is-hearts-quiz .kicker-time span {
  transform: translateY(1px);
}

.kicker-heart-icon {
  position: absolute;
  right: -18px;
  top: 50%;
  display: block;
  width: 62px;
  height: 62px;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 rgba(23, 8, 18, 0.46));
  transform: translateY(-50%);
}

.math-quiz-modal h2 {
  position: relative;
  z-index: 1;
  margin: 0 44px 10px;
  color: #fff;
  font-size: clamp(38px, 6vw, 52px);
  line-height: 0.95;
  text-shadow: var(--outline-3);
}

.math-quiz-progress {
  color: #fff;
  font-size: 22px;
}

.math-quiz-question {
  margin: 14px auto;
  width: min(430px, 100%);
  padding: 16px 18px 14px;
  border: 4px solid #170812;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #c9fbff);
  color: #fff;
  font-size: clamp(42px, 9vw, 76px);
  line-height: 1;
  -webkit-text-stroke: 0;
  paint-order: stroke fill;
  text-shadow: var(--outline-2);
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.55), 0 6px 0 rgba(0, 0, 0, 0.24);
}

.math-quiz-question-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.math-quiz-mark {
  display: inline-block;
  transform: translateY(0.03em);
  font-family: var(--font-heavy);
  font-size: 0.95em;
  font-weight: 900;
}

.math-quiz-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: min(430px, 100%);
  margin: 0 auto;
}

.math-quiz-answer-field {
  position: relative;
  min-width: 0;
  height: 62px;
  overflow: visible;
}

.math-quiz-answer-field::after {
  content: attr(data-value);
  position: absolute;
  inset: -10px 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #fff;
  font: 900 36px/1 var(--font-heavy);
  text-align: center;
  text-shadow:
    -2px -2px 0 #170812,
    0 -2px 0 #170812,
    2px -2px 0 #170812,
    -2px 0 0 #170812,
    2px 0 0 #170812,
    -2px 2px 0 #170812,
    0 2px 0 #170812,
    2px 2px 0 #170812,
    0 4px 0 #170812;
  pointer-events: none;
}

.math-quiz-answer-field.is-wrong::after {
  color: #ff4f6f;
}

.math-quiz-answer-field input {
  box-sizing: border-box;
  appearance: textfield;
  -moz-appearance: textfield;
  position: relative;
  z-index: 1;
  min-width: 0;
  width: 100%;
  height: 62px;
  padding: 0 12px;
  border: 4px solid #170812;
  border-radius: 14px;
  background: #fff;
  color: transparent;
  caret-color: #170812;
  font: 900 32px var(--font-heavy);
  text-align: center;
  text-shadow: none;
  outline: none;
  box-shadow: inset 0 4px 0 rgba(0, 0, 0, 0.08);
}

.math-quiz-answer-field input::-webkit-outer-spin-button,
.math-quiz-answer-field input::-webkit-inner-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.is-samsung-galaxy-tablet .math-quiz-answer-field input:disabled {
  opacity: 1;
  pointer-events: none;
  -webkit-text-fill-color: transparent;
}

.math-quiz-form button {
  min-width: 136px;
  border: 4px solid #170812;
  border-radius: 14px;
  background: linear-gradient(180deg, #8dff74, #29c85d);
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.36), 0 5px 0 rgba(0, 0, 0, 0.28);
}

.math-quiz-keypad {
  position: relative;
  z-index: 1;
  display: none;
  width: min(430px, 100%);
  margin: 10px auto 0;
  gap: 8px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.has-touch-controls .math-quiz-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.math-quiz-keypad button {
  min-height: 44px;
  border: 3px solid #170812;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #b9f7ff);
  color: #fff;
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.48), 0 4px 0 rgba(0, 0, 0, 0.26);
}

.math-quiz-feedback {
  min-height: 34px;
  margin-top: 10px;
  color: #fff;
  font-size: 22px;
}

.math-quiz-feedback.bad {
  color: #ff4a6b;
}

.math-quiz-feedback.good {
  color: #fff;
}

.math-quiz-dots {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.math-quiz-dots span {
  width: 18px;
  height: 18px;
  border: 3px solid #170812;
  border-radius: 50%;
  background: #fff;
}

.math-quiz-dots span.done {
  background: #56ff75;
}

@media (pointer: coarse) {
  .math-quiz-modal,
  .math-quiz-modal * {
    font-family: var(--font-heavy);
    letter-spacing: 0;
  }

  .math-quiz-answer-field input {
    caret-color: transparent;
  }

  .math-quiz-keypad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(300px, 100%);
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .math-quiz-modal {
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 22px);
    padding: 16px 16px 18px;
    overflow: hidden;
  }

  .math-quiz-modal::before {
    inset: 8px;
    border-radius: 14px;
  }

  .math-quiz-close {
    top: 8px;
    right: 10px;
    width: 42px;
    height: 42px;
    font-size: 25px;
  }

  .math-quiz-kicker {
    margin-top: -4px;
    margin-bottom: 12px;
  }

  .math-quiz-modal h2 {
    margin: 0 42px 7px;
    font-size: clamp(30px, 9vw, 42px);
  }

  .math-quiz-progress {
    font-size: 18px;
  }

  .math-quiz-question {
    width: min(310px, 100%);
    margin: 10px auto;
    padding: 12px 14px 10px;
    font-size: clamp(38px, 12vw, 58px);
  }

  .math-quiz-form {
    width: min(300px, 100%);
    grid-template-columns: minmax(0, 1fr) minmax(98px, 0.58fr);
    gap: 8px;
  }

  .math-quiz-answer-field,
  .math-quiz-answer-field input {
    height: 48px;
  }

  .math-quiz-answer-field::after {
    inset: -7px 10px;
    font-size: 30px;
  }

  .math-quiz-form button {
    min-width: 0;
    border-width: 3px;
    border-radius: 11px;
    font-size: clamp(18px, 5.4vw, 21px);
  }

  .math-quiz-keypad {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(300px, 100%);
    gap: 6px;
    margin-top: 8px;
  }

  .math-quiz-keypad button {
    min-height: 40px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 22px;
  }

  .math-quiz-keypad button[data-quiz-key="1"],
  .math-quiz-keypad button[data-quiz-key="4"],
  .math-quiz-keypad button[data-quiz-key="7"] {
    grid-column: 1;
  }

  .math-quiz-keypad button[data-quiz-key="2"],
  .math-quiz-keypad button[data-quiz-key="5"],
  .math-quiz-keypad button[data-quiz-key="8"] {
    grid-column: 2;
  }

  .math-quiz-keypad button[data-quiz-key="3"],
  .math-quiz-keypad button[data-quiz-key="6"],
  .math-quiz-keypad button[data-quiz-key="9"] {
    grid-column: 3;
  }

  .math-quiz-keypad button[data-quiz-key="0"] {
    grid-column: 1 / span 2;
  }

  .math-quiz-keypad button[data-quiz-key="back"] {
    grid-column: 3;
    background: linear-gradient(180deg, #ffd4e2, #ff6f9f);
    color: #fff;
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.5),
      0 4px 0 rgba(87, 8, 30, 0.38),
      0 0 10px rgba(255, 86, 135, 0.28);
  }

  .math-quiz-feedback {
    min-height: 20px;
    margin-top: 5px;
    font-size: 16px;
  }

  .math-quiz-dots {
    margin-top: 3px;
    gap: 6px;
  }

  .math-quiz-dots span {
    width: 12px;
    height: 12px;
    border-width: 2px;
  }
}

/* Final viewport anchors and modal proportions for landscape phones only. */
@media (orientation: landscape) {
  html.has-touch-controls:not(.is-tablet-device) .mobile-controls {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    margin: 0 !important;
    translate: none !important;
    transform: none !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .mobile-stick {
    position: fixed !important;
    top: auto !important;
    right: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    inset-inline-start: 0 !important;
    margin: 0 !important;
    translate: none !important;
    transform: none !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .mobile-jump {
    position: fixed !important;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    inset-inline-end: 0 !important;
    margin: 0 !important;
    translate: none !important;
    transform: none !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .sound-toggle {
    left: 92px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal h2,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-modal h2 {
    font-size: clamp(18px, 2.7vw, 22px) !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-form button,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-form button {
    font-size: 12px !important;
    text-shadow: var(--outline-1) !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-modal {
    box-sizing: border-box !important;
    width: min(500px, calc(100vw - 132px)) !important;
    max-height: calc(100dvh - 10px) !important;
    padding: 7px 8px 9px !important;
    overflow: hidden !important;
    border-width: 3px !important;
    border-radius: 13px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-close {
    top: 6px !important;
    right: 7px !important;
    width: 32px !important;
    height: 32px !important;
    border-width: 2px !important;
    border-radius: 8px !important;
    font-size: 20px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-modal .daily-title-box {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: max-content !important;
    margin: 0 auto 6px !important;
    padding: 1px 8px 3px 3px !important;
    border-width: 2px !important;
    border-radius: 8px !important;
    font-size: 19px !important;
    translate: none !important;
    transform: none !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-calendar {
    width: 25px !important;
    height: 25px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-calendar img {
    width: 43px !important;
    height: 41px !important;
    transform: translate(-8px, -7px) !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-reward-list {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 12px 4px !important;
    max-height: calc(100dvh - 58px) !important;
    padding: 12px 1px 4px !important;
    overflow: visible !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-card {
    grid-template-rows: 34px minmax(24px, auto) 27px !important;
    row-gap: 3px !important;
    min-height: 104px !important;
    padding: 15px 3px 4px !important;
    border-width: 2px !important;
    border-radius: 8px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-day {
    top: -14px !important;
    min-width: 43px !important;
    padding: 2px 4px 4px !important;
    border-width: 2px !important;
    border-radius: 6px !important;
    font-size: 10px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-duration {
    top: 4px !important;
    right: -3px !important;
    gap: 2px !important;
    padding: 2px 4px 3px !important;
    border-width: 2px !important;
    font-size: 8px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-clock {
    width: 10px !important;
    height: 10px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-icon {
    width: 48px !important;
    height: 34px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-icon img {
    height: 32px !important;
    max-width: 48px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-icon-trail img {
    height: 40px !important;
    max-width: 58px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-icon-treadmill img {
    width: 100% !important;
    height: 100% !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-icon-skin img {
    top: -15px !important;
    width: 68px !important;
    height: 78px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-card strong,
  html.has-touch-controls:not(.is-tablet-device) .daily-card-day-2 strong,
  html.has-touch-controls:not(.is-tablet-device) .daily-card-day-4 strong {
    min-height: 24px !important;
    font-size: 9px !important;
    line-height: 1 !important;
    white-space: normal !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .daily-card button {
    min-height: 27px !important;
    padding: 2px 3px 4px !important;
    border-width: 2px !important;
    border-radius: 6px !important;
    font-size: 9px !important;
  }
}

@media (orientation: portrait) {
  html.has-touch-controls .skin-card[data-skin-card="bunny_runner"] .skin-preview-image {
    height: 72px !important;
    bottom: 0 !important;
  }
}

/*
 * Hard landscape-phone layout. Tablets keep their established tablet cascade;
 * these forced anchors and compact quiz dimensions are only for phones.
 */
@media (orientation: landscape) {
  html.has-touch-controls:not(.is-tablet-device) .hud-left {
    position: fixed !important;
    top: 4px !important;
    right: auto !important;
    left: 0 !important;
    inset-inline-start: 0 !important;
    width: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    grid-template-columns: 44px !important;
    justify-content: start !important;
    justify-items: start !important;
    align-items: start !important;
    gap: 3px !important;
    translate: none !important;
    transform: none !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .hud-left .wins-badge,
  html.has-touch-controls:not(.is-tablet-device) .hud-left .menu-grid,
  html.has-touch-controls:not(.is-tablet-device) .hud-left .icon-button {
    right: auto !important;
    left: 0 !important;
    margin-right: 0 !important;
    margin-left: 0 !important;
    justify-self: start !important;
    translate: none !important;
    transform: none !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .sound-toggle {
    position: fixed !important;
    top: 4px !important;
    right: auto !important;
    left: 56px !important;
    margin: 0 !important;
    translate: none !important;
    transform: none !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .stage-question {
    top: calc(env(safe-area-inset-top, 0px) + 54px) !important;
    max-width: min(200px, calc(100vw - 260px)) !important;
    padding: 1px 7px 2px !important;
    border-width: 2px !important;
    font-size: 24px !important;
    line-height: 1 !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .stage-question-canvas {
    width: min(180px, 24vw) !important;
    max-width: 100% !important;
    height: auto !important;
  }

  html.has-touch-controls:not(.is-tablet-device) #mathQuizOverlay {
    padding: 4px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-modal {
    box-sizing: border-box !important;
    width: min(520px, calc(100vw - 128px)) !important;
    max-height: calc(100dvh - 8px) !important;
    padding: 6px 12px 7px !important;
    overflow: hidden !important;
    border-width: 3px !important;
    border-radius: 13px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal::before {
    inset: 4px !important;
    border-width: 2px !important;
    border-radius: 9px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-close {
    top: 5px !important;
    right: 6px !important;
    width: 30px !important;
    height: 30px !important;
    padding-top: 2px !important;
    border-width: 2px !important;
    border-radius: 7px !important;
    font-size: 19px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-kicker,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-kicker {
    margin: -2px 0 1px !important;
    font-size: 11px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .kicker-time,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .kicker-time {
    min-width: 100px !important;
    min-height: 18px !important;
    height: 18px !important;
    padding: 0 8px !important;
    font-size: 10px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal h2,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-modal h2 {
    margin: 0 34px 0 !important;
    font-size: clamp(21px, 3.4vw, 28px) !important;
    line-height: 0.92 !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-progress,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-progress {
    font-size: 12px !important;
    line-height: 1 !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-question,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-question {
    box-sizing: border-box !important;
    width: min(330px, 100%) !important;
    margin: 3px auto 4px !important;
    padding: 5px 8px 4px !important;
    border-width: 3px !important;
    border-radius: 9px !important;
    font-size: clamp(29px, 4.8vw, 42px) !important;
    line-height: 1 !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-form {
    width: min(330px, 100%) !important;
    grid-template-columns: minmax(0, 1fr) 78px !important;
    gap: 5px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field input,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-answer-field,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-answer-field input {
    height: 32px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field input {
    border-width: 2px !important;
    border-radius: 8px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field::after {
    inset: -4px 6px !important;
    font-size: 20px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-form button,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-form button {
    min-width: 0 !important;
    border-width: 2px !important;
    border-radius: 8px !important;
    font-size: 15px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-keypad {
    width: min(300px, 100%) !important;
    gap: 4px !important;
    margin-top: 5px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-keypad button {
    min-height: 28px !important;
    padding: 1px 4px !important;
    border-width: 2px !important;
    border-radius: 7px !important;
    font-size: 16px !important;
    line-height: 1 !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-feedback {
    min-height: 11px !important;
    margin-top: 2px !important;
    font-size: 11px !important;
    line-height: 1 !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-dots {
    gap: 4px !important;
    margin-top: 1px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-dots span {
    width: 8px !important;
    height: 8px !important;
    border-width: 1px !important;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .math-quiz-modal {
    width: min(620px, calc(100vw - 144px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 12px);
    padding: 10px 18px 12px;
    border-width: 3px;
    border-radius: 14px;
    overflow: hidden;
  }

  .is-hearts-quiz .math-quiz-modal {
    width: min(640px, calc(100vw - 144px));
    padding: 10px 18px 12px;
  }

  .math-quiz-modal::before {
    inset: 5px;
    border-width: 2px;
    border-radius: 10px;
  }

  .math-quiz-close {
    top: 6px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-width: 3px;
    border-radius: 8px;
    font-size: 21px;
  }

  .math-quiz-kicker {
    margin-top: -2px;
    margin-bottom: 3px;
    font-size: 12px;
  }

  .kicker-time {
    min-width: 112px;
    min-height: 21px;
    font-size: 12px;
  }

  .math-quiz-modal h2,
  .is-hearts-quiz .math-quiz-modal h2 {
    margin: 0 36px 2px;
    font-size: clamp(22px, 4.1vw, 31px);
  }

  .math-quiz-progress,
  .is-hearts-quiz .math-quiz-progress {
    font-size: 13px;
  }

  .math-quiz-question,
  .is-hearts-quiz .math-quiz-question {
    width: min(410px, 100%);
    margin: 4px auto 5px;
    padding: 9px 10px 7px;
    border-width: 3px;
    border-radius: 10px;
    font-size: clamp(34px, 5.8vw, 54px);
    -webkit-text-stroke-width: 0;
    text-shadow: var(--outline-2);
  }

  .math-quiz-form {
    width: min(410px, 100%);
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .math-quiz-answer-field,
  .math-quiz-answer-field input,
  .is-hearts-quiz .math-quiz-answer-field,
  .is-hearts-quiz .math-quiz-answer-field input {
    height: 36px;
  }

  .math-quiz-answer-field input {
    border-width: 3px;
    border-radius: 9px;
  }

  .math-quiz-answer-field::after {
    inset: -5px 8px;
    font-size: 23px;
    text-shadow: var(--outline-1);
  }

  .math-quiz-form button,
  .is-hearts-quiz .math-quiz-form button {
    min-width: 88px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 17px;
  }

  .math-quiz-keypad {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(360px, 100%);
    gap: 7px;
    margin-top: 8px;
  }

  .math-quiz-keypad button {
    min-height: 36px;
    border-width: 2px;
    border-radius: 7px;
    font-size: 18px;
    text-shadow: var(--outline-1);
  }

  .math-quiz-keypad button[data-quiz-key="1"],
  .math-quiz-keypad button[data-quiz-key="4"],
  .math-quiz-keypad button[data-quiz-key="7"] {
    grid-column: 1;
  }

  .math-quiz-keypad button[data-quiz-key="2"],
  .math-quiz-keypad button[data-quiz-key="5"],
  .math-quiz-keypad button[data-quiz-key="8"] {
    grid-column: 2;
  }

  .math-quiz-keypad button[data-quiz-key="3"],
  .math-quiz-keypad button[data-quiz-key="6"],
  .math-quiz-keypad button[data-quiz-key="9"] {
    grid-column: 3;
  }

  .math-quiz-keypad button[data-quiz-key="0"] {
    grid-column: 1 / span 2;
  }

  .math-quiz-keypad button[data-quiz-key="back"] {
    grid-column: 3;
    background: linear-gradient(180deg, #ffd4e2, #ff6f9f);
    color: #fff;
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.5),
      0 4px 0 rgba(87, 8, 30, 0.38),
      0 0 10px rgba(255, 86, 135, 0.28);
  }

  .math-quiz-feedback,
  .is-hearts-quiz .math-quiz-feedback {
    min-height: 15px;
    margin-top: 2px;
    font-size: 12px;
  }

  .math-quiz-dots {
    margin-top: 2px;
    gap: 5px;
  }

  .math-quiz-dots span {
    width: 8px;
    height: 8px;
    border-width: 2px;
  }
}

.quiz-confetti {
  position: fixed;
  z-index: 120;
  width: var(--confetti-w, 20px);
  height: var(--confetti-h, 34px);
  border: 2px solid rgba(23, 8, 18, 0.42);
  border-radius: 4px;
  pointer-events: none;
  will-change: transform, opacity;
  animation: quiz-confetti-burst var(--confetti-duration, 1900ms) cubic-bezier(0.16, 0.72, 0.24, 1) var(--confetti-delay, 0ms) forwards;
}

@keyframes quiz-confetti-burst {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(0deg) scale(0.62);
  }
  12% {
    opacity: 1;
    transform: translate(var(--confetti-pop-x), var(--confetti-pop-y)) rotate(var(--confetti-pop-rot)) scale(var(--confetti-scale, 1));
  }
  64% {
    opacity: 1;
    transform: translate(var(--confetti-float-x), var(--confetti-float-y)) rotate(var(--confetti-mid-rot)) scale(var(--confetti-scale, 1));
  }
  100% {
    opacity: 0;
    transform: translate(var(--confetti-x), var(--confetti-y)) rotate(var(--confetti-rot)) scale(0.72);
  }
}

/* Keep the main HUD type stable while the browser or game viewport is resized. */
.speed-title,
.hearts-title {
  width: 260px;
  font-size: 38px;
}

.hearts-title {
  width: 178px;
  font-size: 36px;
}

.speed-title-copy strong,
.hearts-title .speed-title-copy strong {
  font-size: 31px;
}

#topSpeedValue {
  top: 4px;
}

.hearts-title .speed-title-copy strong {
  left: 50%;
  top: 6px;
  font-size: 31px;
  transform: translateX(-50%);
}

.is-windows-pc .hearts-title .speed-title-copy strong {
  top: 2px;
}

.speed-title-copy span,
.hearts-title .speed-title-copy span {
  font-size: 18px;
}

@media (pointer: coarse) {
  .speed-title {
    width: 172px;
    font-size: 26px;
  }

  .hearts-title {
    width: 112px;
    height: 36px;
    min-height: 36px;
    font-size: 23px;
  }

  .speed-title-copy strong {
    top: 6px;
    font-size: 22px;
  }

  .hearts-title .speed-title-copy strong {
    left: 54%;
    top: 7px;
    font-size: 20px;
  }

  .speed-title-copy span {
    top: 23px;
    font-size: 10px;
  }

  .hearts-title .speed-title-copy span {
    top: 24px;
    font-size: 9px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .speed-title {
    width: min(162px, calc(100vw - 207px));
    font-size: 25px;
  }

  .hearts-title {
    width: 112px;
    font-size: 23px;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .speed-title {
    width: 190px;
    font-size: 26px;
  }

  .hearts-title {
    width: 118px;
    font-size: 23px;
  }
}

.trail-modal::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid rgba(24, 9, 19, 0.76);
  border-radius: 17px;
  pointer-events: none;
}

.trail-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 54px;
  height: 54px;
  border: 4px solid #180913;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff6e9f, #d42166);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 34px;
  line-height: 1;
  text-shadow: var(--outline-2);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), 0 5px 0 rgba(0, 0, 0, 0.32);
}

.trail-balance,
.trail-shop-header,
.trail-modal h2,
.trail-scroll-wrap,
.trail-card {
  position: relative;
  z-index: 1;
}

.trail-shop-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 26px);
  min-height: 92px;
  margin: 6px 70px 10px;
}

.trail-modal h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(44px, 8vw, 76px);
  line-height: 0.95;
  text-align: center;
  text-shadow: var(--outline-3);
}

.trail-balance {
  position: absolute;
  left: -48px;
  top: 50%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 12px;
  border: 4px solid #180913;
  border-radius: 12px;
  background: rgba(65, 29, 94, 0.72);
  color: #fff;
  font-size: clamp(22px, 3.6vw, 34px);
  line-height: 1;
  text-shadow: var(--outline-2);
  transform: translateY(-50%);
}

.trophy-inline-icon {
  width: 42px;
  height: 42px;
}

.trail-scroll-wrap {
  display: grid;
  grid-template-columns: 1fr 20px;
  gap: 8px;
  align-items: stretch;
}

.trail-list {
  position: relative;
  display: grid;
  max-height: min(52vh, 430px);
  gap: 12px;
  overflow-y: auto;
  padding: 2px 4px 4px 0;
  cursor: grab;
  scrollbar-width: none;
  touch-action: pan-x;
  user-select: none;
}

.trail-list::-webkit-scrollbar {
  display: none;
}

.trail-list.is-dragging {
  cursor: grabbing;
}

.trail-scrollbar {
  position: relative;
  min-height: 100%;
  border: 4px solid #180913;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 40%),
    linear-gradient(180deg, #7432ab, #4a206b);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.26),
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    3px 0 0 rgba(0, 0, 0, 0.24);
  cursor: pointer;
  pointer-events: auto;
}

.trail-scrollbar span {
  position: absolute;
  top: -4px;
  right: -4px;
  left: -4px;
  min-height: 54px;
  border: 4px solid #180913;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.52), transparent 42%),
    linear-gradient(180deg, #fff478 0%, #ffb52e 52%, #ff65b7 100%);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.42),
    0 2px 0 rgba(0, 0, 0, 0.22);
  cursor: grab;
  will-change: transform, height;
}

.trail-scrollbar span:hover,
.trail-scrollbar.is-dragging span {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.6), transparent 42%),
    linear-gradient(180deg, #fff9a6 0%, #ffc540 52%, #ff7ac5 100%);
}

.trail-scrollbar.is-dragging span {
  cursor: grabbing;
}

.trail-card {
  display: grid;
  grid-template-columns: 118px 1fr minmax(138px, 170px);
  align-items: center;
  gap: 14px;
  min-height: 118px;
  padding: 12px;
  border: 4px solid #180913;
  border-radius: 16px;
  background-color: var(--trail-dark);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--trail-color), white 12%), color-mix(in srgb, var(--trail-dark), black 4%));
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.26), 0 6px 0 rgba(0, 0, 0, 0.26);
}

.trail-preview {
  position: relative;
  height: 88px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.trail-preview::before,
.trail-preview span {
  content: "";
  position: absolute;
  inset: 12px 6px;
  border: 12px solid var(--trail-color);
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(-18deg);
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.24));
}

.trail-preview span {
  inset: 30px 24px;
  border-width: 7px;
  opacity: 0.72;
}

.trail-copy strong,
.trail-copy span,
.trail-buy {
  font-family: var(--font-heavy);
  text-shadow: var(--outline-2);
}

.trail-copy {
  display: grid;
  gap: 8px;
  color: #fff;
}

.trail-copy strong {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 0.95;
}

.trail-copy span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: clamp(17px, 2.6vw, 25px);
  line-height: 1;
}

.trail-shoe {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter:
    hue-rotate(118deg)
    saturate(2.2)
    brightness(1.04)
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.42));
  transform: rotate(-12deg);
}

.trail-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 68px;
  border: 4px solid #180913;
  border-radius: 13px;
  background: linear-gradient(180deg, #fff478, #ffb52e);
  color: #fff;
  cursor: pointer;
  font-size: clamp(18px, 2.6vw, 27px);
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.38), 0 5px 0 rgba(0, 0, 0, 0.25);
}

.trail-buy span {
  text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}

.trail-buy:disabled {
  cursor: default;
  filter: grayscale(0.25);
  opacity: 0.78;
}

.trail-buy.equipped {
  background: linear-gradient(180deg, #91f4ff, #2f9dff);
}

.skin-modal::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px solid rgba(24, 9, 19, 0.76);
  border-radius: 17px;
  pointer-events: none;
}

.skin-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 54px;
  height: 54px;
  border: 4px solid #180913;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff6e9f, #d42166);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 34px;
  line-height: 1;
  text-shadow: var(--outline-2);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), 0 5px 0 rgba(0, 0, 0, 0.32);
}

.skin-shop-header,
.skin-card-shell {
  position: relative;
  z-index: 1;
}

.skin-shop-header {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 82px;
  margin: 0 64px 4px;
}

.skin-modal h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(44px, 8vw, 76px);
  line-height: 0.95;
  text-align: center;
  text-shadow: var(--outline-3);
}

.skin-balance {
  position: absolute;
  left: 0;
  top: 50%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 5px 12px;
  border: 3px solid rgba(24, 9, 19, 0.78);
  border-radius: 11px;
  background: rgba(65, 29, 94, 0.72);
  color: #fff;
  font-size: clamp(20px, 3.2vw, 30px);
  line-height: 1;
  text-shadow: var(--outline-2);
  transform: translateY(-50%);
}

.skin-balance .trophy-inline-icon {
  width: 32px;
  height: 32px;
}

.skin-reset-timer {
  position: absolute;
  top: 50%;
  right: 0;
  display: grid;
  grid-template-columns: 44px auto;
  grid-template-areas:
    "icon label"
    "icon timer";
  align-items: center;
  justify-items: start;
  column-gap: 4px;
  row-gap: 6px;
  padding: 3px 6px 4px 2px;
  border: 2px solid rgba(24, 9, 19, 0.8);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 42%),
    rgba(48, 35, 137, 0.78);
  color: #fff;
  line-height: 1;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    0 3px 0 rgba(0, 0, 0, 0.25);
  transform: translateY(-50%);
}

.skin-reset-timer > span {
  grid-area: icon;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  line-height: 1;
  text-shadow: none;
  filter:
    drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.85))
    drop-shadow(1px 0 0 rgba(0, 0, 0, 0.85))
    drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.85))
    drop-shadow(0 1px 0 rgba(0, 0, 0, 0.85))
    drop-shadow(0 2px 0 rgba(0, 0, 0, 0.32));
}

.skin-reset-timer > span img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.skin-reset-timer em {
  grid-area: label;
  color: #ffc8ee;
  font-size: clamp(14px, 1.85vw, 21px);
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.92),
    -1px -1px 0 rgba(0, 0, 0, 0.92),
    1px -1px 0 rgba(0, 0, 0, 0.92),
    -1px 1px 0 rgba(0, 0, 0, 0.92),
    1px 1px 0 rgba(0, 0, 0, 0.92),
    -2px 0 0 rgba(0, 0, 0, 0.82),
    2px 0 0 rgba(0, 0, 0, 0.82),
    0 -2px 0 rgba(0, 0, 0, 0.82),
    0 2px 0 rgba(0, 0, 0, 0.82);
}

.skin-reset-timer strong {
  grid-area: timer;
  justify-self: start;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: #fff;
  font-size: clamp(15px, 2.15vw, 22px);
  line-height: 0.9;
  text-shadow: var(--outline-2);
  white-space: nowrap;
}

.skin-reset-time-rest {
  margin-left: 0;
}

.skin-list {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-rows: 110px;
  gap: 14px;
  flex: 0 0 auto;
  max-width: 100%;
  height: auto;
  min-height: 0;
  overflow: visible;
  padding: 8px 8px 10px;
  cursor: default;
  scrollbar-width: none;
  touch-action: manipulation;
  user-select: none;
}

.skin-list::-webkit-scrollbar {
  display: none;
}

.skin-list.is-dragging {
  cursor: default;
}

.skin-scrollbar {
  display: none;
}

.skin-card-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-row: span 2;
  min-height: 0;
  border-radius: 16px;
}

.skin-overlay-active .skin-card-shell .glowing-wrapper {
  z-index: 0;
  overflow: visible;
}

.skin-overlay-active .skin-card-shell .glowing-wrapper,
.skin-overlay-active .skin-card-shell .glowing-container,
.skin-overlay-active .skin-card-shell .glowing-container--blur-wrapper,
.skin-overlay-active .skin-card-shell .glowing-border,
.skin-overlay-active .skin-card-shell .glowing-border::after {
  border-radius: 18px;
}

.skin-card {
  position: relative;
  z-index: 1;
  isolation: isolate;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto 46px;
  gap: 5px;
  min-height: 0;
  height: 100%;
  padding: 10px;
  border: 0;
  border-radius: 16px;
  background-color: var(--skin-dark);
  background:
    radial-gradient(circle at 32% 14%, rgba(255, 255, 255, 0.58), transparent 18%),
    linear-gradient(180deg, color-mix(in srgb, var(--skin-pop, var(--skin-color)), white 14%) 0%, color-mix(in srgb, var(--skin-pop, var(--skin-color)), var(--skin-dark) 22%) 48%, color-mix(in srgb, var(--skin-dark), black 8%) 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.26),
    inset 0 0 0 2px rgba(255, 255, 255, 0.2),
    0 6px 0 rgba(0, 0, 0, 0.22),
    0 0 18px color-mix(in srgb, var(--skin-color), transparent 48%);
  overflow: hidden;
}

.skin-card::before,
.skin-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.skin-card::before {
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(116deg, rgba(255, 255, 255, 0.2), transparent 34%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 24px);
}

.skin-card::after {
  z-index: 0;
  left: 0;
  right: 0;
  bottom: 54px;
  height: 78px;
  background: linear-gradient(180deg, transparent, rgba(24, 9, 19, 0.5));
}

.skin-card > * {
  position: relative;
  z-index: 1;
}

.skin-card-badge {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  min-width: 58px;
  padding: 6px 10px 5px;
  border: 3px solid #180913;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff9fdf, #ff4ab5);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 17px;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  -webkit-text-stroke: 0;
  paint-order: normal;
  text-shadow:
    -2px 0 0 #180913,
    2px 0 0 #180913,
    0 -2px 0 #180913,
    0 2px 0 #180913,
    -2px -2px 0 #180913,
    2px -2px 0 #180913,
    -2px 2px 0 #180913,
    2px 2px 0 #180913,
    0 3px 0 #180913,
    0 5px 0 rgba(24, 9, 19, 0.44);
  transform: rotate(-4deg);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.6),
    0 3px 0 rgba(0, 0, 0, 0.28),
    0 0 12px rgba(255, 74, 181, 0.52);
}

.skin-card-badge.is-daily {
  background: linear-gradient(180deg, #fff070, #ffb52e);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.6),
    0 3px 0 rgba(0, 0, 0, 0.28),
    0 0 12px rgba(255, 181, 46, 0.52);
}

.skin-card-shell.is-wide {
  grid-column: 3 / span 2;
  grid-row: 3 / span 2;
}

.skin-card-shell.is-tall {
  grid-row: span 4;
}

.skin-card-style-0 {
  --skin-pop: color-mix(in srgb, var(--skin-color), #27e5ff 18%);
}

.skin-card-style-1 {
  --skin-pop: color-mix(in srgb, var(--skin-color), #ff6fd1 18%);
}

.skin-card-style-2 {
  --skin-pop: color-mix(in srgb, var(--skin-color), #ffe14d 24%);
}

.skin-card-style-3 {
  --skin-pop: color-mix(in srgb, var(--skin-color), #62ff9d 20%);
}

.skin-card-style-4 {
  --skin-pop: color-mix(in srgb, var(--skin-color), #8a6bff 18%);
}

.skin-card-style-5 {
  --skin-pop: color-mix(in srgb, var(--skin-color), #ff7759 22%);
}

.skin-card[data-skin-card="skater_cap"] {
  background-color: #ff58c8;
  background:
    radial-gradient(circle at 30% 14%, rgba(255, 255, 255, 0.68), transparent 18%),
    linear-gradient(135deg, #ff4fb8 0%, #ffcf3f 22%, #63f56d 42%, #45d8ff 62%, #8b5cff 82%, #ff58c8 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.32),
    inset 0 0 0 2px rgba(255, 255, 255, 0.24),
    0 6px 0 rgba(0, 0, 0, 0.22),
    0 0 20px rgba(255, 88, 200, 0.55),
    0 0 30px rgba(69, 216, 255, 0.36);
}

.skin-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  margin: -6px -6px 0;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.68), transparent 28%),
    radial-gradient(circle at 50% 82%, rgba(24, 9, 19, 0.22), transparent 42%),
    rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.skin-card.has-skin-image {
  grid-template-rows: minmax(0, 1fr) auto 46px;
}

.skin-card.has-skin-image .skin-preview {
  margin: -6px -6px 0;
  border-radius: 14px 14px 10px 10px;
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 255, 255, 0.72), transparent 26%),
    radial-gradient(circle at 50% 82%, rgba(24, 9, 19, 0.24), transparent 44%),
    rgba(255, 255, 255, 0.14);
}

.skin-preview-image {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: block;
  width: auto;
  height: 176px;
  max-width: none;
  object-fit: contain;
  object-position: center top;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.18));
  transform: translateX(-50%);
}

.skin-card[data-skin-card="bunny_runner"] .skin-preview-image {
  height: 150px;
  bottom: -6px;
}

.skin-card[data-skin-card="default"] .skin-preview-image {
  height: 264px;
  bottom: -108px;
}

.skin-card[data-skin-card="street_runner"] .skin-preview-image {
  height: 158px;
  bottom: -4px;
}

.skin-card[data-skin-card="skater_cap"] .skin-preview-image {
  height: 246px;
  bottom: -92px;
}

.skin-card[data-skin-card="pirate"] .skin-preview-image {
  height: 262px;
  bottom: -104px;
}

.skin-card[data-skin-card="pirate"] .skin-preview {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 242, 136, 0.72), transparent 27%),
    radial-gradient(circle at 50% 82%, rgba(213, 28, 37, 0.34), transparent 44%),
    linear-gradient(180deg, rgba(255, 72, 64, 0.34), rgba(232, 29, 38, 0.28));
}

.skin-card[data-skin-card="winter_hero"] .skin-preview-image {
  top: 50%;
  bottom: auto;
  width: 84%;
  height: auto;
  transform: translate(-50%, -50%);
}

.skin-model-preview {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  pointer-events: none;
}

.skin-card.has-skin-image .skin-copy {
  position: relative;
  margin-top: 0;
}

.skin-card-shell.is-tall .skin-preview-image {
  height: 360px;
}

.skin-figure {
  position: relative;
  width: 48px;
  height: 80px;
  border: 5px solid #180913;
  border-radius: 22px 22px 16px 16px;
  background: linear-gradient(180deg, var(--skin-color), var(--skin-dark));
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.16),
    0 6px 0 rgba(0, 0, 0, 0.24);
}

.skin-figure::before,
.skin-figure::after {
  content: "";
  position: absolute;
  background: #180913;
}

.skin-figure::before {
  top: -30px;
  left: 50%;
  width: 46px;
  height: 42px;
  border: 5px solid #180913;
  border-radius: 50%;
  background: color-mix(in srgb, var(--skin-color), white 28%);
  transform: translateX(-50%);
}

.skin-figure::after {
  right: -22px;
  bottom: 18px;
  width: 14px;
  height: 48px;
  border-radius: 12px;
  box-shadow: -76px 0 0 #180913, -51px 43px 0 -1px #180913, -22px 43px 0 -1px #180913;
  transform: rotate(-11deg);
}

.skin-copy strong,
.skin-copy span,
.skin-buy {
  font-family: var(--font-heavy);
  text-shadow: var(--outline-2);
}

.skin-copy {
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 4px;
  color: #fff;
  min-height: 0;
  text-align: center;
}

.skin-copy strong {
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 0.95;
  text-align: center;
}

.skin-copy span {
  font-size: clamp(16px, 2.2vw, 22px);
  line-height: 1;
}

.skin-buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 5px;
  min-height: 46px;
  border: 4px solid #180913;
  border-radius: 13px;
  background: linear-gradient(180deg, #fff478, #ffb52e);
  color: #fff;
  cursor: pointer;
  font-size: clamp(15px, 1.55vw, 20px);
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.38), 0 5px 0 rgba(0, 0, 0, 0.25);
}

.skin-buy .trophy-inline-icon {
  width: 28px;
  height: 28px;
}

.skin-buy:disabled {
  cursor: default;
  filter: grayscale(0.25);
  opacity: 0.78;
}

.skin-buy.equipped {
  background: linear-gradient(180deg, #91f4ff, #2f9dff);
}

.skin-buy.reward-only,
.skin-buy.reward-only:disabled {
  background: linear-gradient(110deg, #ff4b63, #ff9d35, #ffe94e, #5eea77, #51dfff, #8871ff, #ff65cf);
  filter: none;
  opacity: 1;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.38), 0 5px 0 rgba(0, 0, 0, 0.25);
}

.daily-modal {
  position: relative;
  width: min(940px, calc(100vw - 24px));
  max-height: calc(100vh - 28px);
  overflow: visible;
  padding: clamp(48px, 6vw, 72px) clamp(16px, 2.6vw, 26px) clamp(16px, 2.6vw, 26px);
  border: 6px solid #120712;
  border-radius: 18px;
  background:
    radial-gradient(circle at 10% 18%, rgba(255, 255, 255, 0.65) 0 4px, transparent 5px) 0 0 / 34px 34px,
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 35%),
    linear-gradient(140deg, #fff7a8 0%, #82f2ff 34%, #ff92db 70%, #a98bff 100%);
  box-shadow:
    inset 0 7px 0 rgba(255, 255, 255, 0.48),
    inset 0 -10px 0 rgba(79, 23, 128, 0.24),
    0 0 0 3px rgba(255, 255, 255, 0.72),
    0 0 0 8px rgba(39, 12, 34, 0.34),
    0 12px 0 rgba(0, 0, 0, 0.34),
    0 18px 34px rgba(0, 0, 0, 0.3);
}

.daily-modal::before {
  content: none;
}

.daily-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 54px;
  height: 54px;
  border: 4px solid #180913;
  border-radius: 12px;
  background: linear-gradient(145deg, #ff6e9f, #d42166);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-heavy);
  font-size: 34px;
  line-height: 1;
  text-shadow: var(--outline-2);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.34), 0 5px 0 rgba(0, 0, 0, 0.32);
}

.daily-modal h2,
.daily-reward-list {
  position: relative;
  z-index: 1;
}

.daily-modal .daily-title-box {
  position: absolute;
  top: -42px;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 2px 12px 4px 6px;
  border: 4px solid #110810;
  border-radius: 12px;
  background: linear-gradient(180deg, #ff8ec8 0%, #ff56a8 100%);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: clamp(22px, 3.4vw, 35px);
  line-height: 0.95;
  text-shadow: var(--outline-3);
  transform: translateX(-50%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.42),
    0 5px 0 rgba(0, 0, 0, 0.28);
}

.daily-calendar {
  display: grid;
  place-items: center;
  width: clamp(38px, 5vw, 50px);
  height: clamp(38px, 5vw, 50px);
  overflow: visible;
  border-radius: 8px;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.34));
}

.daily-calendar img {
  display: block;
  width: clamp(58px, 7.4vw, 78px);
  height: clamp(52px, 6.8vw, 72px);
  object-fit: contain;
  transform: translate(-15px, -11px);
}

.custom-speed-modal {
  position: relative;
  width: min(430px, calc(100vw - 28px));
  padding: 22px 22px 20px;
  border: 5px solid #140b08;
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.54), transparent 30%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0 12px, rgba(255, 80, 188, 0.12) 12px 24px),
    linear-gradient(180deg, #ffc5f3 0%, #ff82d8 48%, #e64fbc 100%);
  color: #fff;
  text-align: center;
  pointer-events: auto;
  box-shadow:
    inset 0 6px 0 rgba(255, 255, 255, 0.36),
    0 8px 0 rgba(0, 0, 0, 0.36),
    0 18px 34px rgba(0, 0, 0, 0.32);
}

.custom-speed-modal::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 3px dashed rgba(255, 255, 255, 0.26);
  border-radius: 12px;
  pointer-events: none;
}

.custom-speed-close {
  position: absolute;
  top: -16px;
  right: -13px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 3px solid #140b08;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff06d, #ff8bd8);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 20px;
  text-shadow: var(--outline-1);
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.34);
}

.custom-speed-modal h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 12px;
  color: #fff;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 0.95;
  white-space: nowrap;
  text-shadow: var(--outline-2);
}

.custom-speed-readout {
  position: relative;
  z-index: 1;
  display: inline-grid;
  min-width: 142px;
  margin-bottom: 16px;
  padding: 8px 16px 10px;
  border: 3px solid #140b08;
  border-radius: 13px;
  background: linear-gradient(180deg, #fff4a8, #ff8bd8);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.44),
    0 4px 0 rgba(0, 0, 0, 0.28);
}

.custom-speed-readout span {
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 15px;
  line-height: 1;
  text-shadow: var(--outline-1);
}

.custom-speed-readout strong {
  color: #fff;
  display: block;
  margin-top: 7px;
  font-size: 18px;
  line-height: 1;
  text-shadow: var(--outline-1);
}

.custom-speed-slider {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 34px;
  margin: 4px 0 8px;
  appearance: none;
  border: 3px solid #140b08;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #44c8ff 0 var(--custom-speed-fill, 100%), rgba(255, 255, 255, 0.42) var(--custom-speed-fill, 100%) 100%),
    linear-gradient(180deg, #32153a, #160817);
  cursor: pointer;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.2),
    0 4px 0 rgba(0, 0, 0, 0.28);
}

.custom-speed-slider::-webkit-slider-thumb {
  appearance: none;
  width: 38px;
  height: 38px;
  border: 4px solid #140b08;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff6a8, #ff7fd5);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.44),
    0 3px 0 rgba(0, 0, 0, 0.35);
}

.custom-speed-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 4px solid #140b08;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff6a8, #ff7fd5);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.44),
    0 3px 0 rgba(0, 0, 0, 0.35);
}

.custom-speed-scale {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 14px;
  text-shadow: var(--outline-1);
}

.custom-speed-max-mini {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 82px;
  margin: 0 0 12px auto;
  padding: 4px 8px 6px;
  border: 3px solid #140b08;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff4a8, #ff8bd8);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 12px;
  line-height: 1;
  text-shadow: var(--outline-1);
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.38),
    0 3px 0 rgba(0, 0, 0, 0.32);
}

.custom-speed-apply {
  position: relative;
  z-index: 1;
  min-width: 156px;
  padding: 8px 16px 10px;
  border: 3px solid #140b08;
  border-radius: 12px;
  background: linear-gradient(180deg, #d9ff9a, #61e86d);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 18px;
  text-shadow: var(--outline-1);
  cursor: pointer;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.38),
    0 4px 0 rgba(0, 0, 0, 0.32);
}

.daily-reward-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  overflow: visible;
  padding: 38px 2px 8px;
}

.daily-card {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: 82px 1fr minmax(42px, auto);
  row-gap: 7px;
  align-items: center;
  justify-items: center;
  min-height: 190px;
  padding: 34px 8px 8px;
  border: 4px solid #12070f;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 32%),
    linear-gradient(180deg, var(--daily-card-top, #68ccff) 0%, var(--daily-card-bottom, #1495d4) 100%);
  color: #fff;
  text-align: center;
  box-shadow: inset 0 5px 0 rgba(255, 255, 255, 0.28), 0 6px 0 rgba(0, 0, 0, 0.28);
}

.daily-card-shell {
  position: relative;
  isolation: isolate;
}

.daily-card-day-1 {
  --daily-card-top: #76d8ff;
  --daily-card-bottom: #0987d0;
}

.daily-overlay-active .glowing-wrapper {
  z-index: 0;
  overflow: visible;
}

.daily-overlay-active .daily-card-shell .glowing-wrapper,
.daily-overlay-active .daily-card-shell .glowing-container,
.daily-overlay-active .daily-card-shell .glowing-container--blur-wrapper,
.daily-overlay-active .daily-card-shell .glowing-border,
.daily-overlay-active .daily-card-shell .glowing-border::after {
  border-radius: 24px;
}

.daily-overlay-active .daily-card-shell .glowing-container {
  opacity: 1;
}

.daily-overlay-active .daily-card-shell .glowing-container--blur-wrapper {
  filter: blur(calc(var(--glowingWidth) / 2 * var(--glowingBlurRatio))) saturate(1.8) brightness(1.45);
}

.daily-overlay-active .daily-card-shell .glowing-border::after {
  opacity: 1;
}

.daily-card-day-2 {
  --daily-card-top: #5cf0b0;
  --daily-card-bottom: #0ca66e;
}

.daily-card-day-3 {
  --daily-card-top: #ff8fdd;
  --daily-card-bottom: #b540ee;
}

.daily-card-day-4 {
  --daily-card-top: #ffe36c;
  --daily-card-bottom: #ff9c22;
}

.daily-card-day-5 {
  --daily-card-top: #ff9fcf;
  --daily-card-bottom: #ff4f9b;
}

.daily-card.is-locked {
  filter: none;
}

.daily-card.is-locked .daily-day,
.daily-card.is-locked .daily-icon,
.daily-card.is-locked strong,
.daily-card.is-locked button:not([data-daily-countdown]) {
  filter: saturate(0.82);
}

.daily-card.is-claimed {
  filter: grayscale(0.18);
  opacity: 0.9;
}

.daily-day,
.daily-card strong,
.daily-card button {
  font-family: var(--font-heavy);
  text-shadow: var(--outline-2);
}

.daily-day {
  position: absolute;
  top: -39px;
  left: 50%;
  z-index: 2;
  min-width: 92px;
  padding: 8px 12px 10px;
  border: 4px solid #12070f;
  border-radius: 9px;
  background: #fff;
  color: #fff;
  font-size: 21px;
  line-height: 1;
  transform: translateX(-50%);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.65), 0 4px 0 rgba(0, 0, 0, 0.26);
}

.daily-day-text {
  display: inline-block;
  transform: translateY(2px);
}

.daily-duration {
  position: absolute;
  top: 11px;
  right: -6px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px 6px;
  border: 3px solid #130712;
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdf7, #ffd7ef);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 15px;
  line-height: 1;
  text-shadow: var(--outline-2);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.72), 0 3px 0 rgba(0, 0, 0, 0.24);
}

.daily-clock {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.22));
}

.daily-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 104px;
  height: 82px;
  line-height: 1;
  overflow: visible;
}

.daily-icon::before {
  content: none;
  position: absolute;
  z-index: 1;
  width: 50px;
  height: 34px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 248, 154, 0.34) 0%, rgba(255, 190, 34, 0.16) 52%, rgba(255, 169, 26, 0) 78%);
  filter: blur(3px);
  transform: translateY(7px);
}

.daily-icon img {
  position: relative;
  z-index: 3;
  display: block;
  width: auto;
  height: 62px;
  max-width: 104px;
  object-fit: contain;
  filter: none;
}

.daily-icon-wins img,
.daily-icon-trophyMultiplier img {
  filter:
    drop-shadow(0 -2px 0 #080408)
    drop-shadow(2px 0 0 #080408)
    drop-shadow(0 2px 0 #080408)
    drop-shadow(-2px 0 0 #080408);
}

.daily-icon-speed img,
.daily-icon-multiplier img {
  filter:
    drop-shadow(0 -1px 0 #080408)
    drop-shadow(1px 0 0 #080408)
    drop-shadow(0 1px 0 #080408)
    drop-shadow(-1px 0 0 #080408);
}

.daily-icon-trail img {
  height: 76px;
  max-width: 116px;
  transform: translateY(-4px);
}

.daily-icon-treadmill img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: none;
}

.daily-icon-skin img {
  position: absolute;
  top: -38px;
  left: 50%;
  width: 150px;
  height: 172px;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  transform: translateX(-50%);
}

.daily-card strong {
  position: relative;
  z-index: 2;
  display: grid;
  align-items: center;
  min-height: 52px;
  font-size: 21px;
  line-height: 1;
}

.daily-card-day-4 strong {
  white-space: nowrap;
  font-size: 19px;
}

.daily-card-day-2 strong {
  white-space: nowrap;
  font-size: 19px;
}

.daily-card button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 42px;
  padding: 4px 8px 7px;
  border: 3px solid #15080f;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff86d, #ffb72f);
  color: #fff;
  cursor: pointer;
  font-size: 19px;
  line-height: 0.92;
  overflow: visible;
  text-shadow: var(--outline-1);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.42), 0 4px 0 rgba(0, 0, 0, 0.25);
}

.daily-card button:disabled {
  cursor: default;
  filter: grayscale(0.35);
  opacity: 0.76;
}

.daily-card button[data-daily-countdown]:disabled {
  filter: saturate(1.08);
  opacity: 0.96;
}

.daily-card button[data-daily-claimed]:disabled {
  background: linear-gradient(180deg, #2fa85a, #126a35);
}

.daily-claimed-text {
  display: inline-block;
  transform: translateY(2px);
}

.daily-button-day-text {
  display: inline-block;
  transform: translateY(4px);
}

.daily-countdown-text {
  display: inline-block;
  font-size: 22px;
  transform: translateY(2px);
}

/* Keep desktop popup artwork proportional in short or embedded viewports. */
@media (pointer: fine) {
  html:not(.has-touch-controls) .modal-overlay {
    overflow: hidden;
  }

  html:not(.has-touch-controls) .rebirth-modal,
  html:not(.has-touch-controls) .trail-modal,
  html:not(.has-touch-controls) .skin-modal,
  html:not(.has-touch-controls) .daily-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    max-height: var(--game-popup-max-height);
    transform: translate(-50%, -50%) scale(var(--game-popup-scale));
    transform-origin: center;
  }

  html:not(.has-touch-controls) .rebirth-modal,
  html:not(.has-touch-controls) .trail-modal {
    width: min(760px, var(--game-popup-max-width));
  }

  html:not(.has-touch-controls) .skin-modal {
    width: min(1040px, var(--game-popup-max-width));
  }

  html:not(.has-touch-controls) .daily-modal {
    width: min(940px, var(--game-popup-max-width));
  }

  html:not(.has-touch-controls) .trail-list {
    max-height: min(430px, calc(var(--game-popup-max-height) - 170px));
  }
}

@media (max-width: 680px) {
  .trail-card {
    grid-template-columns: 82px 1fr;
  }

  .trail-buy {
    grid-column: 1 / -1;
  }

  .daily-modal {
    width: min(440px, calc(100vw - 20px));
    max-height: calc(100vh - 120px);
    padding: 44px 12px 14px;
    border-width: 5px;
  }

  .daily-modal .daily-title-box {
    top: -36px;
    padding: 2px 10px 4px 5px;
    border-width: 4px;
    font-size: clamp(23px, 8.5vw, 34px);
  }

  .daily-calendar {
    width: 40px;
    height: 40px;
  }

  .daily-calendar img {
    width: 58px;
    height: 54px;
    transform: translate(-12px, -9px);
  }

  .daily-close {
    top: 28px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 28px;
  }

  .daily-reward-list {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 10px;
    max-height: 58vh;
    overflow-y: auto;
    padding: 28px 2px 12px;
  }

  .daily-card {
    grid-template-rows: 58px minmax(34px, auto) minmax(34px, auto);
    row-gap: 5px;
    min-height: 154px;
    padding: 24px 6px 7px;
    border-width: 3px;
    border-radius: 10px;
  }

  .daily-day {
    top: -24px;
    min-width: 70px;
    padding: 5px 8px 7px;
    border-width: 3px;
    border-radius: 8px;
    font-size: 17px;
  }

  .daily-duration {
    top: 8px;
    right: -4px;
    gap: 3px;
    padding: 3px 6px 5px;
    border-width: 2px;
    font-size: 11px;
  }

  .daily-clock {
    width: 14px;
    height: 14px;
  }

  .daily-icon {
    width: 82px;
    height: 56px;
  }

  .daily-icon img {
    height: 46px;
    max-width: 82px;
  }

  .daily-icon-trail img {
    height: 58px;
    max-width: 90px;
  }

  .daily-icon-treadmill img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  .daily-icon-skin img {
    top: -26px;
    left: 50%;
    width: 104px;
    height: 118px;
    transform: translateX(-50%);
  }

  .daily-card strong {
    min-height: 34px;
    font-size: 16px;
  }

  .daily-card-day-4 strong {
    font-size: 15px;
  }

  .daily-card-day-2 strong {
    white-space: nowrap;
    font-size: 15px;
  }

  .daily-card button {
    min-height: 34px;
    padding: 3px 5px 5px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 15px;
  }

  .daily-countdown-text {
    font-size: 17px;
  }
}

.speed-popups {
  position: fixed;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.multiplayer-status {
  flex: 0 0 auto;
  padding: 2px 4px 3px;
  border: 1px solid rgba(19, 9, 22, 0.82);
  border-radius: 5px;
  background: rgba(29, 14, 42, 0.66);
  color: #fff;
  font-family: var(--font-heavy);
  font-size: 8px;
  line-height: 1;
  text-shadow: var(--outline-1);
  transform: translate(3px, -1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 2px 0 rgba(0, 0, 0, 0.24);
}

.speed-popup {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-size: 22px;
  font-weight: 1000;
  line-height: 1;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.speed-popup .speed-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  transform: rotate(-14deg);
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.48));
}

.win-claim-popup {
  position: fixed;
  z-index: 7;
  top: 45%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: clamp(7px, 1.1vw, 12px);
  max-width: min(90vw, 680px);
  padding: 14px clamp(20px, 3vw, 38px) 18px;
  border: clamp(3px, 0.35vw, 5px) solid #180913;
  border-radius: 22px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.74), transparent 27%),
    linear-gradient(135deg, #fff46b 0%, #ffbe2e 48%, #ff6db8 100%);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.48),
    inset 0 -5px 0 rgba(128, 37, 0, 0.2),
    0 7px 0 #6b210d,
    0 15px 30px rgba(0, 0, 0, 0.34),
    0 0 34px rgba(255, 225, 65, 0.68);
  overflow: visible;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.62);
  animation: win-claim-pop 1.45s cubic-bezier(0.18, 0.9, 0.22, 1) forwards;
}

.win-claim-popup::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255, 255, 255, 0.52);
  border-radius: 14px;
  pointer-events: none;
}

.win-claim-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.win-claim-copy small {
  color: #7c265a;
  font-family: var(--font-heavy);
  font-size: clamp(11px, 1.25vw, 16px);
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.win-claim-popup strong {
  display: block;
  min-width: 0;
  color: #fff;
  font-family: var(--font-heavy);
  font-size: clamp(24px, 3.6vw, 48px);
  font-weight: 1000;
  line-height: 1.12;
  white-space: nowrap;
  max-width: calc(90vw - clamp(50px, 7vw, 82px) - clamp(7px, 1.1vw, 12px) - clamp(32px, 5.2vw, 64px));
  text-shadow:
    -3px -3px 0 #090306,
    3px -3px 0 #090306,
    -3px 3px 0 #090306,
    3px 3px 0 #090306,
    0 4px 0 #c33c38,
    0 12px 18px rgba(0, 0, 0, 0.38);
}

.is-safari .win-claim-popup strong {
  -webkit-text-stroke: 2px #090306;
  paint-order: stroke fill;
  text-shadow:
    0 6px 0 #5c2600,
    0 16px 24px rgba(0, 0, 0, 0.42);
}

.win-claim-trophy {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: clamp(50px, 7vw, 82px);
  height: clamp(50px, 7vw, 82px);
  font-size: clamp(32px, 4.4vw, 58px);
  line-height: 1;
}

.win-claim-trophy .trophy-icon-image {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 0 #351400) drop-shadow(0 10px 12px rgba(0, 0, 0, 0.32));
  animation: win-claim-trophy-bounce 620ms cubic-bezier(0.2, 1.35, 0.35, 1) both;
}

.trophy-claim-confetti {
  position: fixed;
  z-index: 9;
  width: 11px;
  height: 18px;
  border: 1px solid rgba(24, 9, 19, 0.28);
  border-radius: 3px;
  pointer-events: none;
  animation: trophy-claim-confetti-burst 1050ms cubic-bezier(0.12, 0.72, 0.22, 1) var(--claim-delay) forwards;
}

.trophy-claim-confetti:nth-child(3n) {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

@keyframes win-claim-trophy-bounce {
  0% { transform: scale(0.3) rotate(-18deg); }
  58% { transform: scale(1.18) rotate(8deg); }
  78% { transform: scale(0.94) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes trophy-claim-confetti-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
  }
  12% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--claim-x)), calc(-50% + var(--claim-y))) scale(1) rotate(var(--claim-rot));
  }
}

@keyframes win-claim-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.32) rotate(-2deg);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.76) rotate(1deg);
  }
  32% {
    transform: translate(-50%, -50%) scale(0.68) rotate(0deg);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -58%) scale(0.68);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -72%) scale(0.56);
  }
}

@media (pointer: coarse) {
  .has-touch-controls .mobile-controls {
    display: block;
  }

  .stage-question {
    top: calc(env(safe-area-inset-top, 0px) + 50px);
  }

  .hud-top {
    top: max(4px, env(safe-area-inset-top, 0px));
    right: 8px;
    left: 8px;
  }

  .top-hud {
    display: flex;
    justify-content: center;
    gap: 0;
  }

  .speed-title {
    width: min(218px, 52vw);
    min-height: 39px;
    border-width: 3px;
    border-radius: 10px;
    font-size: clamp(24px, 6.1vw, 31px);
    transform: none;
  }

  .hearts-title {
    top: 1px;
    right: 0;
    left: auto;
    width: min(112px, 27vw);
    min-height: 34px;
    border-width: 2px;
    border-radius: 9px;
    font-size: clamp(18px, 4.9vw, 24px);
  }

  .speed-title-icon {
    left: -25px;
    width: 46px;
    height: 46px;
    font-size: 39px;
    text-shadow:
      -2px -2px 0 #102234,
      0 -2px 0 #102234,
      2px -2px 0 #102234,
      -2px 0 0 #102234,
      2px 0 0 #102234,
      -2px 2px 0 #102234,
      0 2px 0 #102234,
      2px 2px 0 #102234,
      0 4px 0 rgba(7, 13, 22, 0.7);
  }

  .hearts-title-icon {
    left: -27px;
    width: 50px;
    height: 50px;
  }

  .speed-title-copy strong {
    top: 4px;
    -webkit-text-stroke-width: 2px;
    text-shadow: 0 2px 0 #050306;
  }

  .speed-title-copy span {
    top: 25px;
    left: 7px;
    font-size: 12px;
    text-shadow: var(--outline-1);
  }

  .hearts-title .speed-title-copy strong {
    left: 55%;
    top: 4px;
  }

  .hearts-title .speed-title-copy span {
    top: 23px;
    left: 7px;
    font-size: 10px;
  }

  .multiplier-stack {
    display: none;
  }

  .hud-left {
    top: calc(env(safe-area-inset-top, 0px) + 54px);
    left: 8px;
    gap: 5px;
    transform: none;
  }

  .wins-badge {
    width: auto;
    gap: 0;
    font-size: 24px;
    text-shadow: var(--outline-1);
  }

  .wins-badge span {
    width: 32px;
    height: 32px;
  }

  .trophy-icon-image {
    width: 26px;
    height: 26px;
  }

  .menu-grid {
    grid-template-columns: repeat(3, 48px);
    gap: 6px;
  }

  .icon-button {
    width: 48px;
    height: 48px;
    padding: 3px;
    border-width: 2px;
    border-radius: 8px;
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.32),
      0 4px 0 rgba(0, 0, 0, 0.35),
      0 6px 12px rgba(0, 0, 0, 0.24);
  }

  .icon-button::before {
    inset: 5px;
    border-radius: 6px;
  }

  .icon-button span,
  .icon-button .rebirth-icon-slot,
  .icon-button .trail-icon-slot,
  .icon-button .gift-icon-slot {
    width: 34px;
    height: 28px;
  }

  .rebirth-icon-image {
    width: 42px;
    height: 42px;
    transform: translate(-6px, -4px);
  }

  .trail-icon-image {
    width: 43px;
    height: 43px;
    margin-top: -4px;
    transform: translate(-3px, -2px);
  }

  .gift-icon-image {
    width: 36px;
    height: 36px;
  }

  .icon-button strong {
    font-size: 10px;
    text-shadow: 0 1px 0 #050306;
  }

  .menu-alert {
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    border-width: 2px;
  }

  .hud-right {
    display: none;
  }

  .leaderboard {
    top: calc(env(safe-area-inset-top, 0px) + 74px);
    right: calc(env(safe-area-inset-right, 0px) + 5px);
    width: 170px;
    padding: 5px 5px 1px;
    border-width: 2px;
    border-radius: 8px;
  }

  .leaderboard-grid-head,
  .leaderboard-body {
    display: none;
  }

  .leaderboard-header {
    display: block;
    margin-bottom: 3px;
  }

  .leaderboard-header strong {
    display: block;
    font-size: 11px;
    line-height: 1;
  }

  .leaderboard-header strong::first-letter {
    font-size: inherit;
  }

  .leaderboard-room-code {
    display: inline-block;
    margin-left: 14px;
    font-size: 10px;
  }

  .leaderboard-room-code b {
    font-size: 11px;
  }

  .multiplayer-status {
    display: none;
  }

  .room-code-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 23px;
    padding: 0 7px;
    border: 1px solid #130916;
    border-radius: 5px;
    background: linear-gradient(180deg, #5fe4ff, #2789e8);
    color: #fff;
    font-family: var(--font-heavy);
    font-size: 10px;
    line-height: 1;
    text-shadow: var(--outline-1);
    cursor: pointer;
    pointer-events: auto;
  }

  .room-code-toggle::after {
    content: ">";
    font-size: 12px;
    transform: rotate(90deg);
    transition: transform 140ms ease;
  }

  .leaderboard.is-room-code-open .room-code-toggle::after {
    transform: rotate(-90deg);
  }

  .leaderboard:not(.is-room-code-open) .room-code-panel {
    display: none;
  }

  .room-code-panel {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .room-code-form {
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 4px;
  }

  .room-code-form input,
  .room-code-form button {
    height: 23px;
    border-width: 1px;
    border-radius: 5px;
    font-size: 10px;
  }

  .room-code-form input {
    padding-inline: 5px;
  }

  .room-code-status {
    min-height: 9px;
    margin-top: 2px;
    font-size: 9px;
  }

  .hud-bottom {
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 132px);
    left: 12px;
  }

  .progress-wrap {
    max-width: min(420px, 100%);
  }

  .stage-strip {
    width: min(178px, calc(100vw - 44px));
    margin-bottom: 5px;
    padding: 3px 10px 5px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 14px;
  }

  .progress-track {
    height: 38px;
    border-width: 2px;
    border-radius: 9px;
  }

  .progress-label {
    gap: 8px;
    padding: 3px 9px 0;
    font-size: clamp(14px, 3.9vw, 19px);
    text-shadow: var(--bottom-label-outline);
  }

  .mobile-stick {
    left: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    width: 104px;
    height: 104px;
  }

  .mobile-stick span {
    width: 44px;
    height: 44px;
  }

  .mobile-jump {
    right: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
    width: 82px;
    height: 82px;
    font-size: 15px;
  }

  .center-message {
    min-width: min(300px, calc(100vw - 26px));
    padding: 13px 15px;
  }

  .center-message strong {
    font-size: 25px;
  }

  .center-message span {
    font-size: 13px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .leaderboard {
    display: none;
  }

  .hud-top {
    right: 7px;
    left: 7px;
  }

  .top-hud {
    justify-content: flex-start;
  }

  .speed-title {
    width: min(172px, calc(100vw - 138px));
    min-height: 36px;
    margin-left: 28px;
    font-size: clamp(22px, 6vw, 28px);
    transform: none;
  }

  .speed-title-icon {
    left: -28px;
    width: 48px;
    height: 48px;
    font-size: 41px;
  }

  .speed-title-copy span {
    top: 23px;
    left: 10px;
    font-size: 11px;
  }

  .hearts-title {
    top: 1px;
    right: 0;
    left: auto;
    width: min(112px, 27vw);
    height: 36px;
    min-height: 36px;
    border-width: 3px;
    border-radius: 10px;
    font-size: clamp(18px, 4.9vw, 24px);
  }

  .hearts-title-icon {
    left: -25px;
    width: 46px;
    height: 46px;
  }

  .hearts-title .speed-title-copy strong {
    left: 54%;
    top: 6px;
    font-size: 0.92em;
  }

  .hearts-title .speed-title-copy span {
    top: 24px;
    left: 7px;
    font-size: 9px;
  }

  .hud-left {
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    left: 8px;
    gap: 4px;
  }

  .wins-badge {
    font-size: 22px;
  }

  .wins-badge span {
    width: 30px;
    height: 30px;
  }

  .trophy-icon-image {
    width: 25px;
    height: 25px;
  }

  .menu-grid {
    grid-template-columns: 46px;
    gap: 5px;
  }

  .icon-button {
    width: 46px;
    height: 46px;
  }

  .icon-button span,
  .icon-button .rebirth-icon-slot,
  .icon-button .trail-icon-slot,
  .icon-button .gift-icon-slot {
    width: 32px;
    height: 27px;
  }

  .icon-button strong {
    font-size: 9px;
  }

  .mobile-stick {
    left: 4px;
    bottom: 2px;
    width: 92px;
    height: 92px;
  }

  .mobile-stick span {
    width: 39px;
    height: 39px;
  }

  .mobile-jump {
    right: 4px;
    bottom: 4px;
    width: 78px;
    height: 78px;
    font-size: 14px;
  }

  .hud-bottom {
    right: 90px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
    left: 96px;
  }

  .progress-wrap {
    max-width: min(250px, 100%);
  }

  .stage-strip {
    width: min(168px, 100%);
    margin-bottom: 4px;
    padding: 2px 6px 4px;
    font-size: 11px;
  }

  .progress-track {
    height: 38px;
    background: rgba(22, 14, 25, 0.62);
  }

  .progress-label {
    gap: 4px;
    overflow: hidden;
    flex-wrap: nowrap;
    padding: 3px 7px 2px;
    font-size: clamp(8px, 2.65vw, 12px);
    line-height: 1.18;
  }

  .progress-label #level {
    max-width: 42%;
    overflow: hidden;
    text-overflow: clip;
  }

  .progress-label #speed {
    max-width: 58%;
    overflow: hidden;
    text-overflow: clip;
    transform: none;
  }

  .stage-strip,
  .progress-label {
    -webkit-text-stroke: 0.55px #050306;
    paint-order: stroke fill;
    text-shadow: var(--bottom-label-outline);
  }

  .is-safari .stage-strip,
  .is-safari .progress-label {
    -webkit-text-stroke: 0.55px #050306;
    text-shadow: var(--bottom-label-outline);
  }

  .speed-title-copy strong {
    text-shadow: 0 1px 0 #050306;
  }
}

/* Keep mobile trail header items in real layout flow after all compact overrides. */
@media (pointer: coarse) {
  .trail-shop-header,
  .has-touch-controls .trail-shop-header {
    display: grid !important;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr) !important;
    align-items: center !important;
    justify-content: stretch !important;
    column-gap: 8px !important;
    min-height: 44px !important;
    margin: 2px 46px 7px 8px !important;
  }

  .trail-balance,
  .has-touch-controls .trail-balance {
    position: static !important;
    top: auto !important;
    left: auto !important;
    max-width: 132px !important;
    min-width: 0 !important;
    justify-self: start !important;
    transform: none !important;
  }

  .trail-balance strong,
  .has-touch-controls .trail-balance strong {
    display: block !important;
    min-width: 0 !important;
    max-width: 78px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .trail-modal h2,
  .has-touch-controls .trail-modal h2 {
    min-width: 0 !important;
    justify-self: center !important;
    overflow: hidden !important;
    font-size: clamp(24px, 7vw, 36px) !important;
    text-align: center !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .trail-shop-header,
  .has-touch-controls .trail-shop-header {
    grid-template-columns: minmax(86px, auto) minmax(0, 1fr) !important;
    min-height: 36px !important;
    margin: 0 38px 5px 6px !important;
    column-gap: 6px !important;
  }

  .trail-balance,
  .has-touch-controls .trail-balance {
    max-width: 118px !important;
    padding: 2px 7px 3px !important;
    font-size: 14px !important;
  }

  .trail-balance strong,
  .has-touch-controls .trail-balance strong {
    max-width: 66px !important;
  }

  .trail-modal h2,
  .has-touch-controls .trail-modal h2 {
    font-size: clamp(21px, 3.8vw, 28px) !important;
  }
}

@media (pointer: coarse) {
  .trail-shop-header,
  .has-touch-controls .trail-shop-header {
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
    column-gap: 8px;
    min-height: 44px;
    margin: 2px 46px 7px 8px;
  }

  .trail-balance,
  .has-touch-controls .trail-balance {
    position: static;
    top: auto;
    left: auto;
    max-width: 132px;
    min-width: 0;
    justify-self: start;
    transform: none;
  }

  .trail-balance strong,
  .has-touch-controls .trail-balance strong {
    display: block;
    min-width: 0;
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .trail-modal h2,
  .has-touch-controls .trail-modal h2 {
    min-width: 0;
    justify-self: center;
    overflow: hidden;
    font-size: clamp(24px, 7vw, 36px);
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .trail-shop-header,
  .has-touch-controls .trail-shop-header {
    grid-template-columns: minmax(86px, auto) minmax(0, 1fr);
    min-height: 36px;
    margin: 0 38px 5px 6px;
    column-gap: 6px;
  }

  .trail-balance,
  .has-touch-controls .trail-balance {
    max-width: 118px;
    padding: 2px 7px 3px;
    font-size: 14px;
  }

  .trail-balance strong,
  .has-touch-controls .trail-balance strong {
    max-width: 66px;
  }

  .trail-modal h2,
  .has-touch-controls .trail-modal h2 {
    font-size: clamp(21px, 3.8vw, 28px);
  }
}

@media (pointer: coarse) {
  .trail-shop-header,
  .has-touch-controls .trail-shop-header {
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
    column-gap: 8px;
    min-height: 44px;
    margin: 2px 46px 7px 8px;
  }

  .trail-balance,
  .has-touch-controls .trail-balance {
    position: static;
    top: auto;
    left: auto;
    max-width: 132px;
    min-width: 0;
    justify-self: start;
    transform: none;
  }

  .trail-balance strong,
  .has-touch-controls .trail-balance strong {
    display: block;
    min-width: 0;
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .trail-modal h2,
  .has-touch-controls .trail-modal h2 {
    min-width: 0;
    justify-self: center;
    overflow: hidden;
    font-size: clamp(24px, 7vw, 36px);
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .trail-shop-header,
  .has-touch-controls .trail-shop-header {
    grid-template-columns: minmax(86px, auto) minmax(0, 1fr);
    min-height: 36px;
    margin: 0 38px 5px 6px;
    column-gap: 6px;
  }

  .trail-balance,
  .has-touch-controls .trail-balance {
    max-width: 118px;
    padding: 2px 7px 3px;
    font-size: 14px;
  }

  .trail-balance strong,
  .has-touch-controls .trail-balance strong {
    max-width: 66px;
  }

  .trail-modal h2,
  .has-touch-controls .trail-modal h2 {
    font-size: clamp(21px, 3.8vw, 28px);
  }
}

@media (pointer: coarse) {
  .sound-toggle {
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: auto;
    left: calc(env(safe-area-inset-left, 0px) + 8px);
    width: 44px;
    height: 44px;
    padding: 3px;
    border-width: 2px;
    border-radius: 9px;
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.32),
      0 4px 0 rgba(0, 0, 0, 0.34),
      0 8px 16px rgba(0, 0, 0, 0.22);
  }

  .sound-toggle::before {
    inset: 4px;
    border-radius: 6px;
  }

  .sound-toggle img {
    width: 35px;
    height: 35px;
  }
}

@media (pointer: coarse) {
  .trail-modal {
    width: min(580px, calc(100vw - 86px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    padding: 10px 8px 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .trail-modal::before {
    inset: 8px;
    border-width: 3px;
    border-radius: 11px;
  }

  .trail-close {
    top: 9px;
    right: 10px;
    width: 42px;
    height: 42px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 28px;
  }

  .trail-modal h2 {
    margin: 0;
    font-size: clamp(28px, 9vw, 44px);
    line-height: 1;
  }

  .trail-shop-header {
    gap: 8px;
    min-height: 50px;
    margin: 2px 48px 6px;
  }

  .trail-balance {
    gap: 5px;
    left: 0;
    margin: 0;
    padding: 3px 9px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 16px;
    text-shadow: var(--outline-1);
  }

  .trail-scroll-wrap {
    grid-template-columns: 1fr 14px;
    gap: 5px;
  }

  .trail-list {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 132px);
    gap: 6px;
    padding: 2px 2px 4px 0;
  }

  .trail-scrollbar {
    border-width: 2px;
    border-radius: 12px;
  }

  .trail-scrollbar span {
    top: -2px;
    right: -2px;
    left: -2px;
    min-height: 42px;
    border-width: 2px;
    border-radius: 12px;
  }

  .trail-card {
    grid-template-columns: 48px minmax(0, 1fr) minmax(58px, 76px);
    gap: 5px;
    min-height: 64px;
    padding: 5px;
    border-width: 3px;
    border-radius: 10px;
  }

  .trail-preview {
    height: 42px;
    border-radius: 9px;
  }

  .trail-preview::before,
  .trail-preview span {
    inset: 8px 4px;
    border-width: 8px;
  }

  .trail-preview span {
    inset: 20px 16px;
    border-width: 5px;
  }

  .trail-copy {
    gap: 3px;
    min-width: 0;
  }

  .trail-copy strong {
    overflow: hidden;
    font-size: clamp(14px, 4.4vw, 18px);
    line-height: 0.95;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: var(--outline-1);
  }

  .trail-copy span {
    gap: 3px;
    font-size: 10px;
    text-shadow: var(--outline-1);
  }

  .trail-shoe {
    width: 16px;
    height: 16px;
  }

  .trail-buy {
    min-height: 34px;
    gap: 2px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 10px;
    text-shadow: var(--outline-1);
  }

  .trail-buy .trophy-inline-icon {
    width: 22px;
    height: 22px;
  }
}

@media (pointer: coarse) {
  .trail-modal {
    width: min(580px, calc(100vw - 86px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    padding: 10px 8px 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .trail-modal::before {
    inset: 8px;
    border-width: 3px;
    border-radius: 11px;
  }

  .trail-close {
    top: 9px;
    right: 10px;
    width: 42px;
    height: 42px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 28px;
  }

  .trail-modal h2 {
    margin: 0;
    font-size: clamp(28px, 9vw, 44px);
    line-height: 1;
  }

  .trail-shop-header {
    gap: 8px;
    min-height: 50px;
    margin: 2px 48px 6px;
  }

  .trail-balance {
    gap: 5px;
    left: 0;
    margin: 0;
    padding: 3px 9px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 16px;
    text-shadow: var(--outline-1);
  }

  .trail-scroll-wrap {
    grid-template-columns: 1fr 14px;
    gap: 5px;
  }

  .trail-list {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 132px);
    gap: 6px;
    padding: 2px 2px 4px 0;
  }

  .trail-scrollbar {
    border-width: 2px;
    border-radius: 12px;
  }

  .trail-scrollbar span {
    top: -2px;
    right: -2px;
    left: -2px;
    min-height: 42px;
    border-width: 2px;
    border-radius: 12px;
  }

  .trail-card {
    grid-template-columns: 52px 1fr minmax(70px, 88px);
    gap: 6px;
    min-height: 58px;
    padding: 5px;
    border-width: 3px;
    border-radius: 10px;
  }

  .trail-preview {
    height: 42px;
    border-radius: 9px;
  }

  .trail-preview::before,
  .trail-preview span {
    inset: 8px 4px;
    border-width: 8px;
  }

  .trail-preview span {
    inset: 20px 16px;
    border-width: 5px;
  }

  .trail-copy {
    gap: 4px;
  }

  .trail-copy strong {
    font-size: clamp(17px, 5.4vw, 23px);
    text-shadow: var(--outline-1);
  }

  .trail-copy span {
    gap: 4px;
    font-size: 12px;
    text-shadow: var(--outline-1);
  }

  .trail-shoe {
    width: 18px;
    height: 18px;
  }

  .trail-buy {
    min-height: 36px;
    gap: 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 12px;
    text-shadow: var(--outline-1);
  }

  .icon-button.skin .skin-icon-slot {
    top: -3px;
    width: 50px;
    height: 27px;
  }

  .skin-icon-image {
    width: 58px;
    height: 40px;
    transform: translateX(-6px);
  }

  .icon-button.skin strong {
    right: 3px;
    bottom: 3px;
    left: 3px;
  }

  .skin-modal {
    width: min(580px, calc(100vw - 86px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    padding: 7px 8px 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .skin-modal::before {
    inset: 8px;
    border-width: 3px;
    border-radius: 11px;
  }

  .skin-close {
    top: 9px;
    right: 10px;
    width: 42px;
    height: 42px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 28px;
  }

  .skin-shop-header {
    min-height: 50px;
    margin: 0 45px 5px 6px;
    justify-content: center;
  }

  .skin-modal h2 {
    margin: 0;
    font-size: clamp(28px, 9vw, 44px);
    line-height: 1;
  }

  .skin-balance {
    gap: 4px;
    left: 0;
    margin: 0;
    padding: 2px 7px 3px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 14px;
    text-shadow: var(--outline-1);
  }

  .skin-balance .trophy-inline-icon {
    width: 22px;
    height: 22px;
  }

  .skin-reset-timer {
    grid-template-columns: 28px auto;
    column-gap: 3px;
    row-gap: 4px;
    padding: 2px 4px 3px 2px;
  border-width: 2px;
  border-radius: 7px;
  }

  .skin-reset-timer > span {
    width: 28px;
    height: 28px;
  }

  .skin-reset-timer em {
    font-size: 10px;
  }

  .skin-reset-timer strong {
    font-size: 11px;
    text-shadow: var(--outline-1);
  }

  .skin-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-rows: clamp(64px, 13.5vh, 82px);
    gap: 7px;
    height: auto;
    min-height: 0;
    padding: 6px;
  }

  .skin-scrollbar {
    display: none;
  }

  .skin-card-shell {
    grid-row: span 2;
    border-radius: 11px;
  }

  .skin-card {
    grid-template-rows: 78px auto 38px;
    gap: 5px;
    min-height: 0;
    padding: 6px;
    border-radius: 11px;
  }

  .skin-card-badge {
    top: 7px;
    left: 7px;
    min-width: 44px;
    padding: 4px 7px 3px;
    border-width: 2px;
    font-size: 12px;
  }

  .skin-card-shell.is-wide {
    grid-column: span 1;
    grid-row: span 2;
  }

  .skin-card-shell.is-tall {
    grid-row: span 2;
  }

  .skin-overlay-active .skin-card-shell .glowing-wrapper,
  .skin-overlay-active .skin-card-shell .glowing-container,
  .skin-overlay-active .skin-card-shell .glowing-container--blur-wrapper,
  .skin-overlay-active .skin-card-shell .glowing-border,
  .skin-overlay-active .skin-card-shell .glowing-border::after {
    border-radius: 13px;
  }

  .skin-preview {
    border-radius: 9px;
  }

  .skin-card.has-skin-image {
    grid-template-rows: 92px auto 38px;
    gap: 4px;
    min-height: 0;
  }

  .skin-card.has-skin-image .skin-preview {
    margin: -1px -1px 0;
    border-radius: 9px 9px 7px 7px;
  }

  .skin-preview-image {
    bottom: 0;
    height: 108px;
    max-width: 94%;
    transform: translateX(-50%);
  }

  .skin-card[data-skin-card="bunny_runner"] .skin-preview-image {
    height: 94px;
    bottom: -5px;
  }

  .skin-card[data-skin-card="default"] .skin-preview-image {
    height: 158px;
    bottom: -68px;
  }

  .skin-card[data-skin-card="street_runner"] .skin-preview-image {
    height: 82px;
    max-width: 86%;
    bottom: 0;
  }

  .skin-card[data-skin-card="skater_cap"] .skin-preview-image {
    height: 148px;
    bottom: -56px;
  }

  .skin-card[data-skin-card="pirate"] .skin-preview-image {
    height: 158px;
    bottom: -66px;
  }

  .skin-card[data-skin-card="winter_hero"] .skin-preview-image {
    top: 50%;
    bottom: auto;
    width: 90%;
    height: auto;
    transform: translate(-50%, -50%);
  }

  .skin-card.has-skin-image .skin-copy {
    margin-top: 0;
  }

  .skin-card-shell.is-tall .skin-preview-image {
    height: 142px;
  }

  .skin-card-shell.is-tall .skin-card[data-skin-card="street_runner"] .skin-preview-image {
    height: 86px;
    max-width: 84%;
    bottom: 0;
  }

  .skin-figure {
    transform: scale(0.68);
  }

  .skin-copy {
    gap: 4px;
  }

  .skin-copy strong {
    font-size: clamp(15px, 4.8vw, 20px);
    text-shadow: var(--outline-1);
  }

  .skin-copy span {
    font-size: 13px;
    text-shadow: var(--outline-1);
  }

  .skin-buy {
    margin-top: 3px;
    min-height: 38px;
    gap: 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 13px;
    text-shadow: var(--outline-1);
  }

  .skin-buy .trophy-inline-icon {
    width: 20px;
    height: 20px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .skin-modal {
    width: min(520px, calc(100vw - 28px));
    padding: 8px 8px 9px;
  }

  .skin-close {
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    font-size: 25px;
  }

  .skin-shop-header {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    grid-template-areas:
      "title title"
      "balance reset";
    gap: 6px;
    align-items: center;
    min-height: 0;
    margin: 0 0 6px;
    padding-right: 2px;
  }

  .skin-modal h2 {
    grid-area: title;
    justify-self: center;
    width: calc(100% - 90px);
    min-width: 0;
    padding: 0;
    font-size: clamp(27px, 10vw, 40px);
  }

  .skin-balance,
  .skin-reset-timer {
    position: static;
    top: auto;
    right: auto;
    left: auto;
    max-width: 100%;
    transform: none;
  }

  .skin-balance {
    grid-area: balance;
    justify-self: start;
    min-width: 0;
    padding: 2px 6px 3px;
    font-size: 13px;
  }

  .skin-balance .trophy-inline-icon {
    width: 20px;
    height: 20px;
  }

  .skin-reset-timer {
    grid-area: reset;
    justify-self: end;
    grid-template-columns: 24px minmax(0, auto);
    column-gap: 2px;
    row-gap: 3px;
    min-width: 0;
    padding: 2px 4px 3px 1px;
  }

  .skin-reset-timer > span {
    width: 24px;
    height: 24px;
  }

  .skin-reset-timer em {
    overflow: hidden;
    max-width: 78px;
    font-size: 9px;
    text-overflow: ellipsis;
  }

  .skin-reset-timer strong {
    gap: 2px;
    font-size: 10px;
  }

  .skin-list {
    height: auto;
  }

  .skin-scrollbar {
    display: none;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .skin-modal {
    width: min(720px, calc(100vw - 86px));
    padding: 6px 8px 8px;
  }

  .skin-shop-header {
    min-height: 38px;
    margin: 0 42px 4px 4px;
  }

  .skin-modal h2 {
    font-size: clamp(24px, 5vw, 34px);
  }

  .skin-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(53px, 15vh, 66px);
    gap: 6px;
    padding: 5px;
  }

  .skin-card {
    grid-template-rows: minmax(0, 1fr) auto 30px;
    gap: 3px;
    padding: 5px;
  }

  .skin-card.has-skin-image {
    grid-template-rows: minmax(0, 1fr) auto 30px;
  }

  .skin-preview-image {
    height: 82px;
  }

  .skin-card[data-skin-card="bunny_runner"] .skin-preview-image {
    height: 82px;
    bottom: -3px;
  }

  .skin-card[data-skin-card="default"] .skin-preview-image,
  .skin-card[data-skin-card="skater_cap"] .skin-preview-image,
  .skin-card[data-skin-card="pirate"] .skin-preview-image {
    height: 104px;
    bottom: -38px;
  }

  .skin-card[data-skin-card="street_runner"] .skin-preview-image {
    height: 68px;
  }

  .skin-copy strong {
    font-size: clamp(13px, 3.2vw, 17px);
  }

  .skin-buy {
    min-height: 30px;
    margin-top: 1px;
    border-width: 2px;
    border-radius: 8px;
    font-size: 12px;
  }

  .stage-question {
    top: calc(env(safe-area-inset-top, 0px) + 46px);
  }

  .revive-offer {
    top: calc(env(safe-area-inset-top, 0px) + 120px);
    grid-template-columns: 18px auto 18px;
    gap: 2px;
    width: fit-content;
    max-width: min(240px, calc(100vw - 124px));
    min-height: 30px;
    padding: 3px 6px 4px;
    border-width: 2px;
    border-radius: 8px;
    font-size: clamp(10px, 2.45vw, 14px);
    text-shadow: var(--outline-1);
  }

  .revive-offer strong {
    padding-inline: 0.06em;
    white-space: nowrap;
  }

  .revive-offer-wing {
    display: block;
    width: 18px;
    height: 14px;
  }

  .rebirth-modal {
    width: min(500px, calc(100vw - 116px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    overflow-y: auto;
    padding: 9px 13px 12px;
    border-width: 3px;
    border-radius: 14px;
  }

  .rebirth-modal::before {
    inset: 5px;
    border-width: 2px;
    border-radius: 10px;
  }

  .rebirth-close,
  .trail-close,
  .daily-close {
    top: 6px;
    right: 8px;
    width: 34px;
    height: 34px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 22px;
  }

  .rebirth-kicker {
    margin-top: 0;
    margin-bottom: 4px;
    padding: 3px 9px 5px;
    border-width: 2px;
    font-size: 12px;
  }

  .rebirth-modal h2 {
    gap: 7px;
    margin: 0 38px 4px;
    font-size: clamp(24px, 4.8vw, 34px);
    text-shadow: var(--outline-2);
  }

  .rebirth-title-icon {
    width: 39px;
    height: 39px;
  }

  .rebirth-level {
    width: min(240px, 72%);
    margin-bottom: 6px;
    padding: 6px 9px;
    border-width: 3px;
    border-radius: 10px;
    font-size: clamp(20px, 4vw, 29px);
  }

  .rebirth-multiplier-row {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 3px;
    margin-bottom: 5px;
  }

  .rebirth-multiplier-card {
    min-height: 48px;
    padding: 5px 2px;
    border-width: 3px;
    border-radius: 9px;
    font-size: clamp(10px, 2.1vw, 15px);
    text-shadow: var(--outline-1);
  }

  .rebirth-arrow {
    font-size: 22px;
  }

  .rebirth-modal p {
    margin: 3px 0 5px;
    font-size: 14px;
    text-shadow: var(--outline-1);
  }

  .rebirth-progress {
    padding: 5px 9px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 18px;
  }

  .rebirth-actions {
    grid-template-columns: minmax(170px, 280px);
    margin-top: 7px;
  }

  .rebirth-button {
    min-height: 42px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 23px;
  }

  .trail-modal {
    width: min(480px, calc(100vw - 156px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    padding: 9px 9px 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .trail-modal::before {
    inset: 5px;
    border-width: 2px;
    border-radius: 10px;
  }

  .trail-modal h2 {
    margin: 0;
    font-size: clamp(22px, 4vw, 28px);
    line-height: 1.05;
    text-shadow: var(--outline-3);
  }

  .trail-shop-header {
    gap: 7px;
    min-height: 38px;
    margin: 1px 38px 4px;
  }

  .trail-balance {
    gap: 5px;
    margin: 0;
    padding: 3px 9px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 16px;
    text-shadow: var(--outline-1);
  }

  .trophy-inline-icon {
    width: 27px;
    height: 27px;
  }

  .trail-list {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 82px);
    gap: 4px;
    padding-right: 2px;
  }

  .trail-scroll-wrap {
    grid-template-columns: 1fr 14px;
    gap: 5px;
  }

  .trail-list::-webkit-scrollbar {
    display: none;
  }

  .trail-scrollbar {
    border-width: 2px;
    border-radius: 12px;
  }

  .trail-scrollbar span {
    top: -2px;
    right: -2px;
    left: -2px;
    min-height: 42px;
    border-width: 2px;
    border-radius: 12px;
  }

  .trail-card {
    grid-template-columns: 48px 1fr minmax(64px, 80px);
    gap: 5px;
    min-height: 49px;
    padding: 4px;
    border-width: 3px;
    border-radius: 10px;
  }

  .trail-preview {
    height: 34px;
    border-radius: 9px;
  }

  .trail-preview::before,
  .trail-preview span {
    inset: 8px 4px;
    border-width: 8px;
  }

  .trail-preview span {
    inset: 20px 16px;
    border-width: 5px;
  }

  .trail-copy {
    gap: 4px;
  }

  .trail-copy strong {
    font-size: clamp(15px, 2.9vw, 19px);
    text-shadow: var(--outline-1);
  }

  .trail-copy span {
    gap: 4px;
    font-size: 11px;
    text-shadow: var(--outline-1);
  }

  .trail-shoe {
    width: 18px;
    height: 18px;
  }

  .trail-buy {
    min-height: 32px;
    gap: 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 12px;
    text-shadow: var(--outline-1);
  }

  .daily-modal {
    width: min(580px, calc(100vw - 156px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    overflow: hidden;
    padding: 10px 8px 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .daily-modal .daily-title-box {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: max-content;
    margin: 0 auto 8px;
    padding: 1px 9px 3px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: clamp(17px, 3.4vw, 22px);
    text-shadow: var(--outline-3);
  }

  .daily-calendar {
    width: 28px;
    height: 28px;
  }

  .daily-calendar img {
    width: 50px;
    height: 48px;
    transform: translate(-10px, -8px);
  }

  .daily-reward-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 15px 5px;
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 76px);
    overflow-y: auto;
    padding: 15px 2px 5px;
  }

  .daily-card {
    grid-template-rows: 32px minmax(21px, auto) minmax(24px, auto);
    row-gap: 3px;
    min-height: 88px;
    padding: 14px 4px 5px;
    border-width: 3px;
    border-radius: 9px;
  }

  .daily-day {
    top: -16px;
    min-width: 46px;
    padding: 3px 5px 4px;
    border-width: 2px;
    border-radius: 7px;
    font-size: 11px;
    text-shadow: var(--outline-1);
  }

  .daily-duration {
    top: 6px;
    right: -3px;
    gap: 2px;
    padding: 2px 5px 4px;
    border-width: 2px;
    font-size: 10px;
    text-shadow: var(--outline-1);
  }

  .daily-clock {
    width: 12px;
    height: 12px;
  }

  .daily-icon {
    width: 56px;
    height: 32px;
  }

  .daily-icon img {
    height: 30px;
    max-width: 56px;
  }

  .daily-icon-trail img {
    height: 46px;
    max-width: 74px;
  }

  .daily-icon-treadmill img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  .daily-icon-skin img {
    top: -18px;
    left: 50%;
    width: 82px;
    height: 96px;
    transform: translateX(-50%);
  }

  .daily-card strong,
  .daily-card-day-4 strong {
    min-height: 26px;
    font-size: 11px;
    text-shadow: var(--outline-1);
    white-space: normal;
  }

  .daily-card-day-2 strong {
    white-space: nowrap;
  }

  .daily-card button {
    min-height: 27px;
    padding: 2px 4px 4px;
    border-width: 2px;
    border-radius: 7px;
    font-size: 11px;
  }

  .daily-countdown-text {
    font-size: 13px;
  }

  .hearts-title .speed-title-copy strong {
    top: 6px;
    transform: translateX(-50%);
  }

  .stage-strip,
  .progress-label {
    -webkit-text-stroke: 0.55px #050306;
    text-shadow: var(--bottom-label-outline);
  }

  .is-safari .stage-strip,
  .is-safari .progress-label {
    -webkit-text-stroke: 0.55px #050306;
    text-shadow: var(--bottom-label-outline);
  }

  .math-quiz-modal {
    width: min(640px, calc(100vw - 144px));
  }

  .math-quiz-form {
    width: min(410px, 100%);
  }

  .math-quiz-keypad {
    width: min(520px, 100%);
    gap: 7px;
  }

  .math-quiz-keypad button {
    min-height: 38px;
    border-radius: 9px;
    font-size: 18px;
  }
}

@media (orientation: landscape) {
  .has-touch-controls .revive-offer {
    top: calc(env(safe-area-inset-top, 0px) + 120px);
    grid-template-columns: 18px auto 18px;
    gap: 2px;
    width: fit-content;
    max-width: min(240px, calc(100vw - 124px));
    min-height: 30px;
    padding: 3px 6px 4px;
    border-width: 2px;
    border-radius: 8px;
    font-size: clamp(10px, 2.45vw, 14px);
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .revive-offer strong {
    padding-inline: 0.06em;
    white-space: nowrap;
  }

  .has-touch-controls .revive-offer-wing {
    display: block;
    width: 18px;
    height: 14px;
  }

  .has-touch-controls .rebirth-modal,
  .has-touch-controls .trail-modal {
    width: min(480px, calc(100vw - 156px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    overflow-y: auto;
    padding: 9px 9px 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .has-touch-controls .rebirth-modal {
    width: min(500px, calc(100vw - 116px));
  }

  .has-touch-controls .rebirth-modal::before,
  .has-touch-controls .trail-modal::before {
    inset: 5px;
    border-width: 2px;
    border-radius: 10px;
  }

  .has-touch-controls .rebirth-close,
  .has-touch-controls .trail-close,
  .has-touch-controls .daily-close {
    top: 6px;
    right: 8px;
    width: 34px;
    height: 34px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 22px;
  }

  .has-touch-controls .rebirth-kicker {
    margin-top: 0;
    margin-bottom: 4px;
    padding: 3px 9px 5px;
    border-width: 2px;
    font-size: 12px;
  }

  .has-touch-controls .rebirth-modal h2,
  .has-touch-controls .trail-modal h2 {
    margin: 0;
    font-size: clamp(22px, 4vw, 28px);
    line-height: 1.05;
    text-shadow: var(--outline-3);
  }

  .has-touch-controls .trail-shop-header {
    gap: 7px;
    min-height: 38px;
    margin: 1px 38px 4px;
  }

  .has-touch-controls .rebirth-title-icon {
    width: 39px;
    height: 39px;
  }

  .has-touch-controls .rebirth-level {
    width: min(240px, 72%);
    margin-bottom: 6px;
    padding: 6px 9px;
    border-width: 3px;
    border-radius: 10px;
    font-size: clamp(20px, 4vw, 29px);
  }

  .has-touch-controls .rebirth-multiplier-row {
    gap: 3px;
    margin-bottom: 5px;
  }

  .has-touch-controls .rebirth-multiplier-card {
    min-height: 48px;
    padding: 5px 2px;
    border-width: 3px;
    border-radius: 9px;
    font-size: clamp(10px, 2.15vw, 15px);
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .rebirth-arrow {
    font-size: 22px;
  }

  .has-touch-controls .rebirth-modal p {
    margin: 3px 0 5px;
    font-size: 14px;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .rebirth-progress {
    padding: 5px 9px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 18px;
  }

  .has-touch-controls .rebirth-actions {
    grid-template-columns: minmax(170px, 280px);
    margin-top: 7px;
  }

  .has-touch-controls .rebirth-button {
    min-height: 42px;
    border-width: 3px;
    border-radius: 10px;
    font-size: 23px;
  }

  .has-touch-controls .trail-balance {
    gap: 5px;
    margin: 0;
    padding: 3px 9px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 16px;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trophy-inline-icon {
    width: 27px;
    height: 27px;
  }

  .has-touch-controls .trail-list {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 82px);
    gap: 4px;
    padding-right: 2px;
  }

  .has-touch-controls .trail-scroll-wrap {
    grid-template-columns: 1fr 14px;
    gap: 5px;
  }

  .has-touch-controls .trail-scrollbar {
    border-width: 2px;
    border-radius: 12px;
  }

  .has-touch-controls .trail-scrollbar span {
    top: -2px;
    right: -2px;
    left: -2px;
    min-height: 42px;
    border-width: 2px;
    border-radius: 12px;
  }

  .has-touch-controls .trail-card {
    grid-template-columns: 48px 1fr minmax(64px, 80px);
    gap: 5px;
    min-height: 49px;
    padding: 4px;
    border-width: 3px;
    border-radius: 10px;
  }

  .has-touch-controls .trail-preview {
    height: 34px;
    border-radius: 9px;
  }

  .has-touch-controls .trail-copy strong {
    font-size: clamp(15px, 2.9vw, 19px);
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trail-copy span {
    gap: 4px;
    font-size: 11px;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trail-shoe {
    width: 18px;
    height: 18px;
  }

  .has-touch-controls .trail-buy {
    min-height: 32px;
    gap: 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 12px;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .daily-modal {
    width: min(580px, calc(100vw - 156px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 14px);
    overflow: hidden;
    padding: 10px 8px 8px;
    border-width: 3px;
    border-radius: 14px;
  }

  .has-touch-controls .daily-modal .daily-title-box {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: max-content;
    margin: 0 auto 8px;
    padding: 1px 9px 3px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: clamp(17px, 3.4vw, 22px);
    text-shadow: var(--outline-3);
  }

  .has-touch-controls .daily-calendar {
    width: 28px;
    height: 28px;
  }

  .has-touch-controls .daily-calendar img {
    width: 50px;
    height: 48px;
    transform: translate(-10px, -8px);
  }

  .has-touch-controls .daily-reward-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 15px 5px;
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 76px);
    overflow-y: auto;
    padding: 15px 2px 5px;
  }

  .has-touch-controls .daily-card {
    grid-template-rows: 32px minmax(21px, auto) minmax(24px, auto);
    row-gap: 3px;
    min-height: 88px;
    padding: 14px 4px 5px;
    border-width: 3px;
    border-radius: 9px;
  }

  .has-touch-controls .daily-day {
    top: -16px;
    min-width: 46px;
    padding: 3px 5px 4px;
    border-width: 2px;
    border-radius: 7px;
    font-size: 11px;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .daily-duration {
    top: 6px;
    right: -3px;
    gap: 2px;
    padding: 2px 5px 4px;
    border-width: 2px;
    font-size: 10px;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .daily-clock {
    width: 12px;
    height: 12px;
  }

  .has-touch-controls .daily-icon {
    width: 56px;
    height: 32px;
  }

  .has-touch-controls .daily-icon img {
    height: 30px;
    max-width: 56px;
  }

  .has-touch-controls .daily-icon-trail img {
    height: 46px;
    max-width: 74px;
  }

  .has-touch-controls .daily-icon-treadmill img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  .has-touch-controls .daily-icon-skin img {
    top: -18px;
    left: 50%;
    width: 82px;
    height: 96px;
    transform: translateX(-50%);
  }

  .has-touch-controls .daily-card strong,
  .has-touch-controls .daily-card-day-4 strong {
    min-height: 26px;
    font-size: 11px;
    text-shadow: var(--outline-1);
    white-space: normal;
  }

  .has-touch-controls .daily-card-day-2 strong {
    white-space: nowrap;
  }

  .has-touch-controls .daily-card button {
    min-height: 27px;
    padding: 2px 4px 4px;
    border-width: 2px;
    border-radius: 7px;
    font-size: 11px;
  }

  .has-touch-controls .daily-countdown-text {
    font-size: 13px;
  }

  .has-touch-controls .hearts-title .speed-title-copy strong {
    top: 6px;
    transform: translateX(-50%);
  }

  .has-touch-controls .stage-strip,
  .has-touch-controls .progress-label {
    -webkit-text-stroke: 0.55px #050306;
    text-shadow: var(--bottom-label-outline);
  }

  .has-touch-controls .math-quiz-modal {
    width: min(640px, calc(100vw - 144px));
  }

  .has-touch-controls .math-quiz-form {
    width: min(410px, 100%);
  }

  .has-touch-controls .math-quiz-keypad {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: min(360px, 100%);
    gap: 7px;
  }

  .has-touch-controls .math-quiz-keypad button {
    min-height: 38px;
    border-radius: 9px;
    font-size: 18px;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .hud-top {
    top: max(5px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
  }

  .top-hud {
    position: relative;
    justify-content: center;
  }

  .speed-title {
    width: min(258px, 32vw);
    min-height: 34px;
    margin-left: 0;
    font-size: clamp(20px, 3.5vw, 27px);
    transform: none;
  }

  .hearts-title {
    top: 1px;
    right: 0;
    left: auto;
    width: clamp(108px, 15vw, 122px);
    height: 34px;
    min-height: 34px;
    border-width: 3px;
    border-radius: 10px;
    font-size: clamp(18px, 3vw, 23px);
  }

  .hearts-title-icon {
    left: -24px;
    width: 46px;
    height: 46px;
  }

  .hearts-title .speed-title-copy strong {
    left: 50%;
    top: 6px;
    font-size: 0.86em;
    transform: translateX(-50%);
  }

  .hearts-title .speed-title-copy span {
    top: 23px;
    left: 6px;
    font-size: 8px;
  }

  .hud-left {
    top: calc(env(safe-area-inset-top, 0px) + 44px);
    left: 8px;
    width: 44px;
    gap: 3px;
    grid-template-columns: 44px;
    justify-items: start;
    align-items: start;
    justify-content: start;
  }

  .is-samsung-galaxy-tablet .hud-left {
    top: calc(env(safe-area-inset-top, 0px) + 78px);
  }

  .is-ipad .hud-left {
    top: calc(env(safe-area-inset-top, 0px) + 78px);
  }

  .is-samsung-galaxy-tablet #topSpeedValue {
    top: 7px;
  }

  .leaderboard {
    top: calc(env(safe-area-inset-top, 0px) + 56px);
    right: calc(env(safe-area-inset-right, 0px) + 5px);
    width: 166px;
  }

  .wins-badge {
    width: 44px;
    margin-left: 0;
    gap: 0;
    font-size: 19px;
    justify-content: start;
  }

  .wins-badge span {
    width: 27px;
    height: 27px;
  }

  .trophy-icon-image {
    width: 24px;
    height: 24px;
  }

  .menu-grid {
    grid-template-columns: 42px;
    gap: 4px;
    justify-content: start;
    justify-items: start;
    margin-left: 0;
    transform: translateX(0);
  }

  .icon-button {
    width: 42px;
    height: 42px;
    justify-self: start;
  }

  .icon-button span,
  .icon-button .rebirth-icon-slot,
  .icon-button .trail-icon-slot,
  .icon-button .gift-icon-slot {
    width: 30px;
    height: 25px;
  }

  .icon-button strong {
    font-size: 8px;
  }

  .mobile-stick {
    left: 22px;
    bottom: 18px;
    width: 82px;
    height: 82px;
  }

  .mobile-stick span {
    width: 34px;
    height: 34px;
  }

  .mobile-jump {
    right: 24px;
    bottom: 18px;
    width: 72px;
    height: 72px;
    font-size: 13px;
  }

  .is-samsung-galaxy-tablet .mobile-stick {
    left: 22px;
    bottom: 18px;
    width: 112px;
    height: 112px;
  }

  .is-samsung-galaxy-tablet .mobile-stick span {
    width: 48px;
    height: 48px;
  }

  .is-samsung-galaxy-tablet .mobile-jump {
    right: 24px;
    bottom: 18px;
    width: 96px;
    height: 96px;
  }

  .hud-bottom {
    right: 108px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    left: 108px;
  }

  .is-samsung-galaxy-tablet .hud-bottom {
    right: 130px;
    left: 130px;
  }

  .progress-wrap {
    max-width: 440px;
  }

  .stage-strip {
    width: min(170px, 30vw);
    margin-bottom: 3px;
    padding: 2px 8px 4px;
    font-size: 12px;
  }

  .progress-track {
    height: 32px;
  }

  .progress-label {
    overflow: hidden;
    flex-wrap: nowrap;
    padding: 1px 9px 0;
    font-size: clamp(11px, 2.3vw, 15px);
    line-height: 1;
  }

  .is-samsung-galaxy-tablet .progress-label {
    align-items: stretch;
    padding-top: 0;
  }

  .is-samsung-galaxy-tablet .progress-label span {
    align-items: center;
    height: 100%;
  }

  .is-samsung-galaxy-tablet .progress-label #speed .hud-outlined-text-canvas {
    transform: translateY(calc(-50% + 2px));
  }

  .stage-strip,
  .progress-label {
    -webkit-text-stroke: 0.55px #050306;
    paint-order: stroke fill;
    text-shadow: var(--bottom-label-outline);
  }

  .is-safari .stage-strip,
  .is-safari .progress-label {
    -webkit-text-stroke: 0.55px #050306;
    text-shadow: var(--bottom-label-outline);
  }

  .speed-title-copy strong {
    text-shadow: 0 1px 0 #050306;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .speed-title {
    width: min(162px, calc(100vw - 207px));
    margin-left: 64px;
  }

  .speed-title-icon {
    left: -12px;
    width: 42px;
    height: 42px;
    font-size: 36px;
  }

  .speed-title-copy span {
    left: 18px;
  }

  .progress-label {
    align-items: center;
    padding: 0 7px;
    line-height: 1;
  }

  .progress-label span {
    display: flex;
    align-items: center;
    min-height: 100%;
    padding-top: 0;
    padding-bottom: 0;
  }

  .progress-label #level,
  .progress-label #speed {
    align-self: stretch;
  }

  .progress-label #speed {
    transform: none;
  }

  .revive-offer,
  .has-touch-controls .revive-offer {
    grid-template-columns: 18px auto 18px;
    gap: 2px;
    width: fit-content;
    max-width: min(240px, calc(100vw - 124px));
    min-height: 30px;
    padding: 3px 6px 4px;
    font-size: clamp(10px, 2.45vw, 14px);
  }

  .revive-offer strong,
  .has-touch-controls .revive-offer strong {
    padding-inline: 0.06em;
    white-space: nowrap;
  }

  .revive-offer-wing,
  .has-touch-controls .revive-offer-wing {
    display: block;
    width: 18px;
    height: 14px;
  }
}

/* Final HUD sizing guard: avoid viewport-resize font wobble in the top bars. */
.speed-title,
.hearts-title {
  width: 260px;
  font-size: 38px;
}

.hearts-title {
  width: 178px;
  font-size: 36px;
}

.speed-title-copy strong,
.hearts-title .speed-title-copy strong {
  font-size: 31px;
}

#topSpeedValue {
  top: 4px;
}

.hearts-title .speed-title-copy strong {
  left: 50%;
  top: 6px;
  font-size: 31px;
  transform: translateX(-50%);
}

.speed-title-copy span,
.hearts-title .speed-title-copy span {
  font-size: 18px;
}

@media (pointer: coarse) {
  .speed-title {
    width: 172px;
    font-size: 26px;
  }

  .hearts-title {
    width: 112px;
    height: 36px;
    min-height: 36px;
    font-size: 23px;
  }

  .speed-title-copy strong {
    top: 6px;
    font-size: 22px;
  }

  .hearts-title .speed-title-copy strong {
    left: 54%;
    top: 7px;
    font-size: 20px;
  }

  .speed-title-copy span {
    top: 23px;
    font-size: 11px;
  }

  .hearts-title .speed-title-copy span {
    top: 24px;
    font-size: 9px;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .speed-title {
    width: min(162px, calc(100vw - 207px));
    font-size: 25px;
  }

  .hearts-title {
    width: 112px;
    font-size: 23px;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .speed-title {
    width: min(222px, 31vw);
    font-size: 26px;
    transform: translateX(-62px);
  }

  .hearts-title {
    top: 1px;
    left: calc(50% + 78px);
    right: auto;
    width: min(126px, 18vw);
    font-size: 23px;
  }

  .sound-toggle {
    top: calc(env(safe-area-inset-top, 0px) + 4px);
    left: calc(env(safe-area-inset-left, 0px) + 4px);
    right: auto;
  }

  .leaderboard {
    top: calc(env(safe-area-inset-top, 0px) + 70px);
    right: env(safe-area-inset-right, 0px);
    width: min(194px, 25vw);
    padding: 6px 7px 2px;
  }

  .leaderboard-header {
    margin-bottom: 5px;
  }

  .leaderboard-header strong {
    font-size: 12px;
    line-height: 1.1;
  }

  .leaderboard-room-code {
    display: inline-block;
    margin-top: 0;
    margin-left: 0;
    font-size: 10px;
    line-height: 1.05;
  }

  .hud-bottom {
    right: 118px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 42px);
    left: 118px;
  }

  .stage-strip {
    width: min(178px, calc(100vw - 44px));
    height: auto;
    margin-bottom: 4px;
  }

  .mobile-stick {
    left: calc(env(safe-area-inset-left, 0px) + 54px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }

  .mobile-jump {
    right: calc(env(safe-area-inset-right, 0px) + 14px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  }
}

@media (pointer: coarse) {
  .hud-right {
    top: calc(env(safe-area-inset-top, 0px) + 156px);
    right: calc(env(safe-area-inset-right, 0px) + 8px);
    display: grid;
    gap: 8px;
    justify-items: end;
  }

  .hud-right .panel {
    display: none;
  }

  .hud-right .panel-compact-stat {
    position: relative;
    display: grid;
    width: 54px;
    min-height: 58px;
    align-content: center;
    justify-items: center;
    padding: 6px 4px 7px;
    border: 3px solid #160816;
    border-radius: 12px;
    background:
      radial-gradient(circle at 28% 14%, rgba(255, 255, 255, 0.58), transparent 25%),
      linear-gradient(180deg, #ffc5f3 0%, #ff82d8 48%, #e64fbc 100%);
    text-align: center;
    overflow: visible;
    pointer-events: auto;
    box-shadow:
      inset 0 4px 0 rgba(255, 255, 255, 0.32),
      0 5px 0 rgba(0, 0, 0, 0.36),
      0 9px 16px rgba(0, 0, 0, 0.24);
  }

  .hud-right .panel-compact-stat::before {
    inset: 5px;
    border: 1px dashed rgba(255, 255, 255, 0.24);
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 52%),
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 4px, transparent 4px 10px);
  }

  .hud-right .panel-compact-stat .multiplier-label {
    display: block;
    position: relative;
    max-width: 100%;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    font-size: 9px;
    line-height: 0.96;
    text-shadow: var(--outline-1);
  }

  .hud-right .panel-compact-stat .multiplier-label::after {
    content: attr(data-label);
    position: absolute;
    inset: 0;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    pointer-events: none;
  }

  .hud-right .panel-compact-stat strong {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    text-shadow: var(--outline-1);
    box-shadow: none;
  }

  .hud-right .panel-compact-stat > #boost {
    -webkit-text-stroke: 0;
    paint-order: normal;
    text-shadow:
      -1px -1px 0 #050306,
      0 -1px 0 #050306,
      1px -1px 0 #050306,
      -1px 0 0 #050306,
      1px 0 0 #050306,
      -1px 1px 0 #050306,
      0 1px 0 #050306,
      1px 1px 0 #050306;
  }

  .emoji-hud-button {
    width: 48px;
    height: 48px;
    margin-right: 0;
    padding: 3px;
    border-width: 2px;
    border-radius: 9px;
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.36),
      0 4px 0 rgba(0, 0, 0, 0.35),
      0 7px 14px rgba(0, 0, 0, 0.24);
  }

  .custom-speed-button {
    width: 48px;
    height: 48px;
    padding: 3px;
    border-width: 2px;
    border-radius: 9px;
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.36),
      0 4px 0 rgba(0, 0, 0, 0.35),
      0 7px 14px rgba(0, 0, 0, 0.24);
  }

  .custom-speed-button::before {
    inset: 5px;
    border-radius: 6px;
  }

  .custom-speed-icon {
    top: 0;
    width: 42px;
    height: 28px;
    border-radius: 6px;
  }

  .custom-speed-icon img {
    width: 39px;
    height: 34px;
  }

  .custom-speed-button strong {
    margin-bottom: -2px;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
  }

  .emoji-hud-button::before {
    inset: 5px;
    border-radius: 6px;
  }

  .emoji-hud-icon {
    top: -1px;
    width: 42px;
    height: 30px;
  }

  .emoji-hud-icon img {
    width: 42px;
    height: 35px;
  }

  .emoji-hud-button strong {
    margin-bottom: 0;
    font-size: 9px;
    -webkit-text-stroke: 0.55px #050306;
    text-shadow: var(--bottom-label-outline);
  }

  .emoji-menu {
    top: calc(env(safe-area-inset-top, 0px) + 144px);
    right: calc(env(safe-area-inset-right, 0px) + 62px);
    grid-template-columns: repeat(4, 43px);
    gap: 6px;
    padding: 12px;
    border-width: 3px;
    border-radius: 13px;
  }

  .emoji-menu::before {
    inset: 8px;
    border-width: 2px;
    border-radius: 9px;
  }

  .custom-speed-modal {
    width: min(340px, calc(100vw - 22px));
    padding: 18px 16px 16px;
    border-width: 4px;
    border-radius: 15px;
  }

  .custom-speed-modal::before {
    inset: 9px;
    border-width: 2px;
  }

  .custom-speed-close {
    top: -13px;
    right: -10px;
    width: 34px;
    height: 34px;
    border-width: 3px;
    font-size: 16px;
  }

  .custom-speed-modal h2 {
    margin-bottom: 9px;
    font-size: clamp(23px, 7vw, 32px);
    white-space: nowrap;
  }

  .custom-speed-readout {
    min-width: 112px;
    margin-bottom: 12px;
    padding: 6px 12px 8px;
  }

  .custom-speed-readout strong {
    margin-top: 5px;
    font-size: 16px;
    text-shadow: var(--outline-1);
  }

  .custom-speed-slider {
    height: 30px;
  }

  .custom-speed-slider::-webkit-slider-thumb {
    width: 34px;
    height: 34px;
  }

  .custom-speed-scale {
    font-size: 11px;
  }

  .custom-speed-max-mini {
    min-width: 70px;
    margin-bottom: 9px;
    padding: 3px 7px 5px;
    border-width: 2px;
    font-size: 10px;
  }

  .custom-speed-apply {
    min-width: 128px;
    padding: 7px 12px 9px;
    font-size: 14px;
  }

  .emoji-choice {
    width: 43px;
    height: 43px;
    padding: 2px;
    border-width: 2px;
    border-radius: 11px;
  }

  .emoji-choice img {
    width: 34px;
    height: 34px;
  }

  .emoji-shortcut {
    top: -5px;
    left: -5px;
    width: 16px;
    height: 16px;
    border-width: 1px;
    font-size: 10px;
  }
}

@media (pointer: coarse) and (orientation: landscape) {
  .hud-right {
    top: calc(env(safe-area-inset-top, 0px) + 184px);
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .has-touch-controls .trail-modal,
  .trail-modal {
    width: min(390px, calc(100vw - 28px));
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 58px);
    overflow: hidden;
    padding: 10px 8px 9px;
    border-width: 3px;
    border-radius: 14px;
  }

  .has-touch-controls .trail-modal::before,
  .trail-modal::before {
    inset: 6px;
    border-width: 2px;
    border-radius: 10px;
  }

  .has-touch-controls .trail-close,
  .trail-close {
    top: 7px;
    right: 8px;
    width: 36px;
    height: 36px;
    border-width: 3px;
    border-radius: 9px;
    font-size: 23px;
  }

  .has-touch-controls .trail-shop-header,
  .trail-shop-header {
    display: grid;
    grid-template-columns: minmax(82px, max-content) minmax(0, 1fr);
    gap: 5px;
    align-items: center;
    min-height: 42px;
    margin: 0 42px 7px 0;
  }

  .has-touch-controls .trail-modal h2,
  .trail-modal h2 {
    justify-self: center;
    font-size: clamp(24px, 7vw, 32px);
    line-height: 1.04;
    white-space: nowrap;
    text-shadow: var(--outline-2);
  }

  .has-touch-controls .trail-balance,
  .trail-balance {
    position: static;
    display: inline-flex;
    gap: 5px;
    min-height: 32px;
    margin: 0;
    padding: 3px 6px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: clamp(15px, 4.2vw, 19px);
    line-height: 1.05;
    overflow: visible;
    transform: none;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trophy-inline-icon,
  .trophy-inline-icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
  }

  .has-touch-controls .trail-scroll-wrap,
  .trail-scroll-wrap {
    grid-template-columns: minmax(0, 1fr) 14px;
    gap: 5px;
  }

  .has-touch-controls .trail-list,
  .trail-list {
    max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 126px);
    gap: 6px;
    overflow-y: auto;
    padding: 2px 2px 5px 0;
    touch-action: pan-y;
  }

  .has-touch-controls .trail-card,
  .trail-card {
    grid-template-columns: 48px minmax(0, 1fr) minmax(74px, 92px);
    grid-template-areas: "preview copy buy";
    gap: 6px;
    align-items: center;
    min-height: 58px;
    padding: 5px;
    border-width: 3px;
    border-radius: 10px;
    overflow: hidden;
  }

  .has-touch-controls .trail-preview,
  .trail-preview {
    grid-area: preview;
    height: 38px;
    border-radius: 9px;
  }

  .has-touch-controls .trail-preview::before,
  .trail-preview::before,
  .has-touch-controls .trail-preview span,
  .trail-preview span {
    inset: 8px 4px;
    border-width: 7px;
  }

  .has-touch-controls .trail-preview span,
  .trail-preview span {
    inset: 19px 14px;
    border-width: 4px;
  }

  .has-touch-controls .trail-copy,
  .trail-copy {
    grid-area: copy;
    gap: 5px;
    min-width: 0;
    overflow: visible;
  }

  .has-touch-controls .trail-copy strong,
  .trail-copy strong {
    display: block;
    overflow: hidden;
    font-size: clamp(16px, 4.6vw, 22px);
    line-height: 1.04;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trail-copy span,
  .trail-copy span {
    gap: 4px;
    font-size: clamp(11px, 3.2vw, 14px);
    line-height: 1.05;
    white-space: nowrap;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trail-shoe,
  .trail-shoe {
    width: 18px;
    height: 18px;
  }

  .has-touch-controls .trail-buy,
  .trail-buy {
    grid-area: buy;
    width: 100%;
    min-height: 38px;
    gap: 3px;
    padding: 3px 4px;
    border-width: 3px;
    border-radius: 9px;
    font-size: clamp(12px, 3.4vw, 16px);
    line-height: 1;
    overflow: hidden;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trail-buy .trophy-inline-icon,
  .trail-buy .trophy-inline-icon {
    width: 20px;
    height: 20px;
  }
}

@media (pointer: coarse) {
  .has-touch-controls .trail-card,
  .trail-card {
    grid-template-columns: 48px minmax(0, 1fr) minmax(70px, 86px);
    min-height: 70px;
    padding: 7px 5px;
    overflow: visible;
  }

  .has-touch-controls .trail-copy,
  .trail-copy {
    gap: 4px;
    overflow: visible;
  }

  .has-touch-controls .trail-copy strong,
  .trail-copy strong {
    overflow: visible;
    font-size: clamp(13px, 3.9vw, 17px);
    line-height: 1.2;
    text-overflow: clip;
    text-shadow: var(--outline-1);
    white-space: nowrap;
  }

  .has-touch-controls .trail-copy span,
  .trail-copy span {
    overflow: visible;
    gap: 3px;
    font-size: clamp(9px, 2.65vw, 12px);
    line-height: 1.18;
    text-shadow: var(--outline-1);
    white-space: nowrap;
  }

  .has-touch-controls .trail-shoe,
  .trail-shoe {
    width: 15px;
    height: 15px;
  }

  .has-touch-controls .trail-buy,
  .trail-buy {
    min-height: 34px;
    padding: 3px 3px 4px;
    overflow: visible;
    font-size: clamp(9px, 2.8vw, 12px);
    line-height: 1.16;
    text-shadow: var(--outline-1);
  }

  .has-touch-controls .trail-buy .trophy-inline-icon,
  .trail-buy .trophy-inline-icon {
    width: 16px;
    height: 16px;
  }
}

@media (pointer: coarse) {
  .has-touch-controls .trail-shop-header,
  .trail-shop-header {
    grid-template-columns: minmax(82px, max-content) minmax(0, 1fr) !important;
    gap: 5px !important;
    margin-left: 0 !important;
  }

  .has-touch-controls .trail-balance,
  .trail-balance {
    max-width: 108px !important;
    min-height: 32px !important;
    padding: 2px 5px 3px !important;
    font-size: 13px !important;
  }

  .has-touch-controls .trail-balance .trophy-inline-icon,
  .trail-balance .trophy-inline-icon {
    width: 24px !important;
    height: 24px !important;
  }
}

html body .hud-right .panel.panel-compact-stat > span.multiplier-label {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

/* Landscape touch layout: keep every control anchored to a clear screen edge. */
@media (pointer: coarse) and (orientation: landscape) {
  .hud-left,
  .is-ipad .hud-left,
  .is-samsung-galaxy-tablet .hud-left {
    top: 6px;
    left: 4px;
    justify-items: start;
  }

  .sound-toggle {
    top: 4px;
    right: auto;
    left: clamp(110px, 14vw, 140px);
  }

  .menu-grid,
  .wins-badge,
  .icon-button {
    margin-left: 0;
    transform: none;
  }

  .hearts-title {
    width: min(112px, 16vw);
    height: 34px;
    min-height: 34px;
  }

  .mobile-stick,
  .is-samsung-galaxy-tablet .mobile-stick {
    left: 4px;
    bottom: 4px;
  }

  .mobile-jump,
  .is-samsung-galaxy-tablet .mobile-jump {
    right: 4px;
    bottom: 4px;
  }

  .hud-bottom,
  .is-samsung-galaxy-tablet .hud-bottom {
    right: 108px;
    bottom: max(4px, env(safe-area-inset-bottom, 0px));
    left: 108px;
  }

  .revive-offer,
  .has-touch-controls .revive-offer {
    top: calc(env(safe-area-inset-top, 0px) + 72px);
    max-width: min(300px, calc(100vw - 120px));
    font-size: clamp(12px, 2vw, 16px);
  }

  .revive-offer strong,
  .has-touch-controls .revive-offer strong {
    letter-spacing: 0.01em;
    line-height: 1.08;
    white-space: nowrap;
  }

  .revive-offer-question {
    min-width: 0.7em;
    margin-left: 0.12em;
    padding: 0;
    font-size: 1em;
    letter-spacing: 0;
    vertical-align: baseline;
  }
}


/* Final mobile Trails guard: reserve real paint space for the outlined font. */
@media (pointer: coarse) {
  .has-touch-controls .trail-modal h2,
  .trail-modal h2,
  .has-touch-controls .trail-balance strong,
  .trail-balance strong,
  .has-touch-controls .trail-copy strong,
  .trail-copy strong,
  .has-touch-controls .trail-copy span,
  .trail-copy span,
  .has-touch-controls .trail-buy,
  .trail-buy {
    overflow: visible !important;
    text-overflow: clip !important;
  }

  .has-touch-controls .trail-modal h2,
  .trail-modal h2 {
    padding: 0.12em 0.16em 0.18em;
    line-height: 1.12;
  }

  .has-touch-controls .trail-balance strong,
  .trail-balance strong {
    max-width: none !important;
    padding: 0.12em 0.08em 0.16em;
    white-space: nowrap !important;
  }

  .has-touch-controls .trail-scroll-wrap,
  .trail-scroll-wrap,
  .has-touch-controls .trail-list,
  .trail-list,
  .has-touch-controls .trail-card,
  .trail-card,
  .has-touch-controls .trail-copy,
  .trail-copy {
    min-width: 0;
  }

  .has-touch-controls .trail-list,
  .trail-list {
    padding: 6px 5px 9px;
  }

  .has-touch-controls .trail-card,
  .trail-card {
    min-height: 74px;
    padding: 8px 6px;
    overflow: visible;
  }

  .has-touch-controls .trail-copy,
  .trail-copy {
    gap: 3px;
    padding: 3px 2px 4px;
    overflow: visible;
  }

  .has-touch-controls .trail-copy strong,
  .trail-copy strong {
    padding: 0.12em 0.12em 0.18em;
    margin: -0.12em -0.12em -0.18em;
    line-height: 1.22;
    white-space: nowrap;
  }

  .has-touch-controls .trail-copy span,
  .trail-copy span {
    padding: 0.1em 0.08em 0.16em;
    margin: -0.1em -0.08em -0.16em;
    line-height: 1.24;
    white-space: nowrap;
  }

  .has-touch-controls .trail-buy,
  .trail-buy {
    min-width: 0;
    min-height: 40px;
    padding: 6px 4px 7px;
    line-height: 1.2;
    white-space: nowrap;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .has-touch-controls .trail-modal,
  .trail-modal {
    width: min(400px, calc(100vw - 20px));
  }

  .has-touch-controls .trail-card,
  .trail-card {
    grid-template-columns: 44px minmax(0, 1fr) minmax(88px, 102px);
    gap: 5px;
  }

  .has-touch-controls .trail-preview,
  .trail-preview {
    height: 40px;
  }

  .has-touch-controls .trail-copy strong,
  .trail-copy strong {
    font-size: clamp(15px, 4.25vw, 19px);
  }

  .has-touch-controls .trail-copy span,
  .trail-copy span {
    font-size: clamp(9px, 2.75vw, 12px);
  }

  .has-touch-controls .trail-buy,
  .trail-buy {
    font-size: clamp(10px, 2.9vw, 13px);
  }
}


/* Final mobile Skins guard: keep outlined skin names outside clipping rows. */
@media (pointer: coarse) {
  .has-touch-controls .skin-card-shell,
  .skin-card-shell,
  .has-touch-controls .skin-copy,
  .skin-copy,
  .has-touch-controls .skin-copy strong,
  .skin-copy strong {
    overflow: visible !important;
  }

  .has-touch-controls .skin-copy,
  .skin-copy {
    position: relative;
    z-index: 4;
    display: grid;
    min-width: 0;
    min-height: 32px;
    align-content: center;
    padding: 5px 3px 6px;
    margin: -5px -3px -6px;
  }

  .has-touch-controls .skin-copy strong,
  .skin-copy strong {
    display: block;
    max-width: 100%;
    padding: 0.14em 0.16em 0.2em;
    margin: -0.14em -0.16em -0.2em;
    font-size: clamp(15px, 4.25vw, 19px);
    line-height: 1.2;
    text-align: center;
    text-overflow: clip !important;
    white-space: nowrap;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  .has-touch-controls .skin-card,
  .skin-card,
  .has-touch-controls .skin-card.has-skin-image,
  .skin-card.has-skin-image {
    grid-template-rows: minmax(0, 1fr) minmax(34px, auto) 40px;
    gap: 3px;
  }

  .has-touch-controls .skin-list,
  .skin-list {
    grid-auto-rows: clamp(68px, 13.8vh, 84px);
    padding: 8px 8px 12px;
  }
}

/* Keep the latest phone-landscape typography and Sound offset above earlier guards. */
@media (orientation: landscape) {
  html.has-touch-controls:not(.is-tablet-device) .sound-toggle {
    left: 92px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal h2,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-modal h2 {
    font-size: clamp(18px, 2.7vw, 22px) !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-form button,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-form button {
    font-size: 12px !important;
    text-shadow: var(--outline-1) !important;
  }
}

/* Compact landscape phone controls and quiz, with room for browser safe edges. */
@media (orientation: landscape) {
  html.has-touch-controls:not(.is-tablet-device) .mobile-stick {
    left: 26px !important;
    bottom: 8px !important;
    inset-inline-start: 26px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .mobile-jump {
    right: 24px !important;
    bottom: 10px !important;
    inset-inline-end: 24px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) #mathQuizOverlay {
    box-sizing: border-box !important;
    padding: 8px 76px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-modal {
    width: min(430px, 100%) !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 4px 9px 5px !important;
    border-width: 3px !important;
    border-radius: 11px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal::before {
    inset: 3px !important;
    border-width: 1px !important;
    border-radius: 7px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-close {
    top: 4px !important;
    right: 5px !important;
    width: 26px !important;
    height: 26px !important;
    border-width: 2px !important;
    border-radius: 6px !important;
    font-size: 16px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-kicker,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-kicker {
    margin: -1px 0 4px !important;
    font-size: 8px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .kicker-time,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .kicker-time {
    min-width: 82px !important;
    min-height: 14px !important;
    height: 14px !important;
    padding: 0 5px !important;
    border-width: 1px !important;
    font-size: 8px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal h2,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-modal h2 {
    margin: 0 28px 4px !important;
    font-size: 14px !important;
    line-height: 0.9 !important;
    text-shadow: var(--outline-1) !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-progress,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-progress {
    margin: 0 0 5px !important;
    font-size: 9px !important;
    line-height: 1 !important;
    text-shadow: var(--outline-1) !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-question,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-question {
    width: min(250px, 100%) !important;
    margin: 2px auto 3px !important;
    padding: 3px 6px 2px !important;
    border-width: 2px !important;
    border-radius: 7px !important;
    font-size: 28px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-form {
    width: min(250px, 100%) !important;
    grid-template-columns: minmax(0, 1fr) 60px !important;
    gap: 4px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field input,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-answer-field,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-answer-field input {
    height: 25px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field input {
    border-width: 2px !important;
    border-radius: 6px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field::after {
    inset: -3px 5px !important;
    font-size: 15px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-form button,
  html.has-touch-controls:not(.is-tablet-device) .is-hearts-quiz .math-quiz-form button {
    border-width: 2px !important;
    border-radius: 6px !important;
    font-size: 9px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-keypad {
    width: min(220px, 100%) !important;
    gap: 3px !important;
    margin-top: 4px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-keypad button {
    min-height: 20px !important;
    padding: 0 3px !important;
    border-width: 1px !important;
    border-radius: 5px !important;
    font-size: 11px !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48), 0 2px 0 rgba(0, 0, 0, 0.26) !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-feedback {
    min-height: 8px !important;
    margin-top: 1px !important;
    font-size: 8px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-dots {
    gap: 3px !important;
    margin-top: 0 !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-dots span {
    width: 6px !important;
    height: 6px !important;
    border-width: 1px !important;
  }

  html.has-touch-controls:not(.is-tablet-device) .math-quiz-kicker,
  html.has-touch-controls:not(.is-tablet-device) .kicker-time,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-modal h2,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-progress,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-answer-field::after,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-form button,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-keypad button,
  html.has-touch-controls:not(.is-tablet-device) .math-quiz-feedback {
    text-shadow: var(--outline-1) !important;
  }
}

/* Keep the temporary revive action readable on compact touch screens. */
@media (pointer: coarse) {
  html.has-touch-controls .revive-offer {
    grid-template-columns: 16px minmax(0, auto) 16px !important;
    gap: 3px !important;
    max-width: calc(100vw - 72px) !important;
    text-shadow: none !important;
  }

  html.has-touch-controls .revive-offer strong {
    display: block !important;
    max-width: 100% !important;
    padding: 0 2px !important;
    overflow: visible !important;
    font-size: clamp(11px, 3vw, 13px) !important;
    line-height: 1.05 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    -webkit-text-stroke: 0 !important;
    text-shadow:
      -0.65px -0.65px 0 #050306,
      0.65px -0.65px 0 #050306,
      -0.65px 0.65px 0 #050306,
      0.65px 0.65px 0 #050306,
      0 1px 0 #050306 !important;
  }

  html.has-touch-controls .revive-offer-wing {
    width: 16px !important;
    height: 13px !important;
  }
}
