:root {
  --ink: #0b2a3f;
  --ink-deep: #071b29;
  --turquoise: #1f9fb5;
  --gold: #e7b416;
  --pomegranate: #c8322b;
  --paper: #fbf6ea;
  --tap: 56px; /* minimum touch target height */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink-deep);
  color: var(--paper);
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
}

#app {
  position: relative;
  height: 100%;
  max-width: 560px; /* keeps a portrait frame on desktop and tablets */
  margin: 0 auto;
  overflow: hidden;
  /* Menus: the painted city-and-railway picture under a soft shade that keeps text readable
     (--menu-bg is set from main.ts, so the path works under any base URL). */
  background:
    linear-gradient(180deg, rgba(5, 22, 38, 0.62) 0%, rgba(5, 22, 38, 0.18) 38%, rgba(5, 22, 38, 0.12) 60%, rgba(5, 22, 38, 0.5) 100%),
    var(--menu-bg, none) center / cover no-repeat,
    linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%);
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
}

#game-canvas.is-visible {
  display: block;
}

#ui-root {
  position: absolute;
  inset: 0;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}

#ui-root > * {
  pointer-events: auto;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow-y: auto;
  touch-action: pan-y;
}

.screen--boot {
  justify-content: center;
  font-size: 18px;
}

.title {
  margin: 28px 0 0;
  font-size: clamp(34px, 11vw, 52px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--gold);
  text-shadow: 0 3px 0 var(--pomegranate), 0 6px 14px rgba(0, 0, 0, 0.45);
}

.title--small {
  font-size: clamp(24px, 7vw, 32px);
  text-shadow: none;
}

.stats {
  display: flex;
  gap: 16px;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(5, 22, 38, 0.55);
}

.chip {
  align-self: flex-end;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 700;
}

.menu {
  width: 100%;
  max-width: 360px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

/* The play button spans the row; the other entries sit two to a row so all nine fit a phone. */
.menu > .menu__button--primary {
  grid-column: 1 / -1;
}

.menu > .menu__button:not(.menu__button--primary) {
  font-size: 15px;
  padding: 0 6px;
}

.menu__button {
  width: 100%;
  max-width: 360px;
  min-height: var(--tap);
  border-radius: 16px;
  background: var(--turquoise);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.menu__button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.menu__button--primary {
  min-height: 68px;
  background: var(--gold);
  color: var(--ink-deep);
  font-size: 24px;
}

/* Feature whose architecture exists but which is not built yet. */
.menu__button.is-pending {
  background: rgba(255, 255, 255, 0.12);
  opacity: 0.75;
}

.cities {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.city {
  --c1: #ffb238;
  --c2: #ff7a1a;
  --lip: #c4500a;
  position: relative;
  min-height: 84px;
  padding: 12px 14px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(180deg, var(--c1) 0%, var(--c2) 100%);
  /* A thick lip underneath and a shine on top: the button stands out of the screen. */
  box-shadow:
    0 8px 0 var(--lip),
    0 14px 18px rgba(0, 0, 0, 0.35),
    inset 0 3px 0 rgba(255, 255, 255, 0.45),
    inset 0 -6px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  margin-bottom: 6px;
}
.city::before {
  /* the glossy highlight across the top half */
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 5px;
  height: 38%;
  border-radius: 18px 18px 40px 40px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.city:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--lip), 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 3px 0 rgba(255, 255, 255, 0.45);
}
.city[data-city='ANDIJAN'] { --c1: #ffb238; --c2: #ff6f1a; --lip: #b84a08; }
.city[data-city='FERGANA'] { --c1: #5fe07f; --c2: #1fa84f; --lip: #127535; }
.city[data-city='SAMARKAND'] { --c1: #4fd8f5; --c2: #1685d0; --lip: #0d5a93; }
.city[data-city='TASHKENT'] { --c1: #b27bff; --c2: #6b2fe0; --lip: #45179c; }
.city[data-city='TASHKENT_METRO'] { --c1: #5c95ff; --c2: #1f4fd8; --lip: #13308f; }

.city__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), 0 3px 0 rgba(0, 0, 0, 0.18);
}
.city__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.city__name {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 0 6px rgba(0, 0, 0, 0.15);
}
.city__meta {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.95;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}
.city__state {
  align-self: flex-start;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 10px;
  background: rgba(7, 27, 41, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.city__play {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: var(--c2);
  background: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2), inset 0 -3px 0 rgba(0, 0, 0, 0.1);
}

.city--dark { color: #fff; }

.city.is-locked {
  --c1: #b9c2cc;
  --c2: #8a96a3;
  --lip: #5e6873;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(7, 27, 41, 0.85);
}
.daily-button {
  align-self: center;
  background: rgba(255, 255, 255, 0.12);
}

.daily-button.is-ready {
  background: var(--gold);
  color: var(--ink-deep);
  animation: pulse 0.8s ease-in-out infinite alternate;
}

.daily {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.daily__tile {
  position: relative;
  padding: 8px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

/* The seventh day is the big one: it spans the rest of the last row. */
.daily__tile:last-child {
  grid-column: span 2;
}

.daily__tile.is-today {
  outline: 3px solid var(--gold);
  background: rgba(231, 180, 22, 0.16);
}

.daily__tile.is-done {
  opacity: 0.55;
}

.daily__reward {
  font-size: 14px;
}

.daily__check {
  position: absolute;
  top: 4px;
  right: 6px;
  color: #5fe08a;
  font-weight: 900;
}

.daily__wait {
  margin: 0;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .daily-button.is-ready {
    animation: none;
  }
}

.badge {
  display: inline-block;
  min-width: 22px;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 11px;
  background: var(--pomegranate);
  color: #fff;
  font-size: 13px;
  vertical-align: middle;
}

.setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting__label {
  font-size: 14px;
  font-weight: 800;
}

.setting__slider {
  width: 100%;
  height: 36px;
  accent-color: var(--gold);
  touch-action: pan-x;
}

.setting__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setting__choices .chip {
  align-self: auto;
}

.chip.is-on {
  background: var(--gold);
  color: var(--ink-deep);
}

.setting__code {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--paper);
  font: inherit;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  user-select: text;
}

.goal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.goal.is-done {
  outline: 2px solid var(--gold);
}

.goal.is-claimed {
  opacity: 0.5;
}

.goal__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
}

.goal__count,
.goal__state {
  font-size: 12px;
  opacity: 0.85;
  white-space: nowrap;
}

.rating {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rating__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.rating__row.is-first {
  background: rgba(231, 180, 22, 0.18);
}

.rating__place {
  width: 28px;
  font-size: 20px;
  font-weight: 900;
  color: var(--gold);
  text-align: center;
}

.rating__info {
  display: flex;
  flex-direction: column;
  font-size: 12px;
}

.rating__info strong {
  font-size: 18px;
}

.panel__actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.result--extra:empty,
.duel-code[hidden],
.hud__shout[hidden] {
  display: none;
}

.duel-code {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.06em;
  user-select: text;
  word-break: break-all;
}

.hud__duel {
  background: rgba(200, 50, 43, 0.85);
}

/* Speech bubble for what the characters shout. */
.hud__shout {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  max-width: 86%;
  padding: 10px 16px;
  border-radius: 18px;
  background: #fff;
  color: var(--ink-deep);
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.hud__shout::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -10px;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

.panel {
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  padding: 16px;
  border-radius: 20px;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel__title {
  margin: 0;
  color: var(--gold);
}

.note {
  margin: 0;
  font-size: 13px;
  opacity: 0.8;
}

.character-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.character {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.character.is-selected {
  outline: 3px solid var(--gold);
  background: rgba(231, 180, 22, 0.16);
}

.character.is-locked .character__portrait {
  filter: grayscale(0.7) brightness(0.75);
}

.character__portrait {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
}

.character__portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character__name {
  font-size: 13px;
  line-height: 1.1;
}

.character__state {
  position: absolute;
  top: 10px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 9px;
  background: rgba(7, 27, 41, 0.85);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.character__state.is-on {
  background: var(--gold);
  color: var(--ink-deep);
}

.character__outfit {
  margin: 0;
  font-size: 13px;
  text-align: center;
  opacity: 0.9;
}

.hud {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none !important;
}

.hud button {
  pointer-events: auto;
}

.hud__top {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.hud__pause {
  align-self: auto;
  width: 48px;
  min-height: 48px;
  padding: 0;
  background: rgba(7, 27, 41, 0.7);
  font-size: 16px;
  letter-spacing: 2px;
}

.hud__stats {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(7, 27, 41, 0.7);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.hud__score {
  font-size: 28px;
  line-height: 1;
  color: var(--gold);
}

.hud__coins {
  color: var(--gold);
}

.hud__city {
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(7, 27, 41, 0.7);
  font-size: 14px;
  font-weight: 700;
}

.banner {
  align-self: stretch;
  padding: 8px 12px;
  border-radius: 12px;
  margin-top: auto;
  background: rgba(7, 27, 41, 0.6);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.banner--error {
  background: rgba(7, 27, 41, 0.9);
  font-size: 14px;
}

.shop__balance {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
}

.upgrade {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border-left: 5px solid var(--bonus, var(--gold));
}

.upgrade__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
}

.upgrade__pips {
  display: flex;
  gap: 4px;
}

.upgrade__pips i {
  width: 16px;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.upgrade__pips i.is-on {
  background: var(--bonus, var(--gold));
}

.upgrade__time {
  font-size: 12px;
  opacity: 0.85;
}

.upgrade__buy {
  flex: none;
  min-width: 96px;
  min-height: 48px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--gold);
  color: var(--ink-deep);
  font-weight: 900;
  font-size: 14px;
}

.upgrade__buy.is-short {
  background: rgba(255, 255, 255, 0.18);
  color: var(--paper);
}

.upgrade__buy:disabled {
  background: transparent;
  color: var(--paper);
  opacity: 0.7;
  cursor: default;
}

.hud__bonuses {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bonus {
  min-width: 132px;
  padding: 6px 10px 7px;
  border-radius: 12px;
  background: rgba(7, 27, 41, 0.75);
  border-left: 5px solid var(--bonus, var(--gold));
  font-size: 13px;
  font-weight: 800;
}

.bonus--magnet { --bonus: #ff6b5e; }
.bonus--sneakers { --bonus: #5fe08a; }
.bonus--carpet { --bonus: #c58cff; }
.bonus--boost { --bonus: #ffcc00; }
.bonus--shield { --bonus: #6fd6ff; }

.bonus__bar {
  display: block;
  height: 5px;
  margin-top: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.bonus__fill {
  display: block;
  height: 100%;
  background: var(--bonus, var(--gold));
  transform-origin: left center;
}

.hud__danger {
  align-self: center;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(200, 50, 43, 0.92);
  font-size: 15px;
  font-weight: 800;
  animation: pulse 0.7s ease-in-out infinite alternate;
}

.hud__danger[hidden],
.record[hidden],
.hud__pause[hidden] {
  display: none;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.hud.is-shaking {
  animation: shake 0.35s ease-out;
}

@keyframes shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-7px, 3px); }
  50% { transform: translate(6px, -2px); }
  75% { transform: translate(-3px, 1px); }
  100% { transform: translate(0, 0); }
}

.panel--over {
  align-items: center;
  text-align: center;
}

.record {
  padding: 6px 14px;
  border-radius: 14px;
  background: var(--gold);
  color: var(--ink-deep);
  font-weight: 900;
}

.result {
  font-size: 16px;
  opacity: 0.9;
}

.result--big {
  font-size: 34px;
  font-weight: 900;
  color: var(--gold);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .hud__danger,
  .hud.is-shaking {
    animation: none;
  }
}

.overlay--pause {
  pointer-events: auto;
}

.overlay[hidden] {
  display: none;
}

.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(24px, env(safe-area-inset-bottom));
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  text-align: center;
}

/* Short phones: tighten the menu so the last row stays on screen. */
@media (max-height: 700px) {
  .menu {
    gap: 7px;
    margin-top: 2px;
  }
}

/* Skateboard button, bottom left of the run screen. */
.hud__skate {
  position: absolute;
  left: 14px;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px)); /* above the toast line */
  width: 64px;
  height: 64px;
  border: 3px solid #fff;
  border-radius: 18px;
  background: linear-gradient(160deg, #ff9f1c, #ff5e3a);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  color: #fff;
  font-weight: 900;
  pointer-events: auto;
  display: grid;
  place-items: center;
  padding: 0;
}
.hud__skate:disabled { filter: grayscale(1); opacity: 0.6; }
.hud__skate.is-riding { background: linear-gradient(160deg, #2ec4b6, #118ab2); }
.hud__skate-icon { font-size: 30px; line-height: 1; }
.hud__skate-count {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  background: #fff;
  color: #ff5e3a;
  font-size: 14px;
  line-height: 24px;
}
.hud__skate-bar {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5px;
  height: 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: none;
}
.hud__skate.is-riding .hud__skate-bar { display: block; }
.hud__skate-fill { display: block; height: 100%; background: #fff; transform-origin: left; }

.hud__station { background: #1659b8; }
.hud__station[hidden] { display: none; }

/* Word being spelled from letters on the track, and the hearts earned. */
.hud__word {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 14px;
  background: rgba(7, 27, 41, 0.7);
}
.hud__word-letters { display: flex; gap: 3px; }
.hud__letter {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.45);
  font-weight: 900;
  font-size: 16px;
}
.hud__letter.is-got {
  background: linear-gradient(160deg, #c86bff, #6a1fd1);
  color: #fff;
  box-shadow: 0 0 0 2px #ffc83d inset;
}
.hud__letter.is-pop, .hud__hearts.is-pop { animation: letter-pop 0.5s ease-out; }
.hud__hearts {
  font-weight: 900;
  font-size: 17px;
  color: #ff5d7a;
  white-space: nowrap;
}
@keyframes letter-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); }
  100% { transform: scale(1); }
}
/* A heart saved the runner: a soft pink flash over the screen. */
.hud.is-saved::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 93, 122, 0.45), rgba(255, 93, 122, 0) 70%);
  animation: heart-flash 0.9s ease-out forwards;
}
@keyframes heart-flash {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Heart offer: big heart, a ring that runs down, yes / no. */
.overlay--offer { background: rgba(60, 0, 25, 0.45); }
.panel--offer { text-align: center; align-items: center; }
.offer__heart { font-size: 64px; line-height: 1; animation: heart-beat 0.8s ease-in-out infinite; }
.offer__ring {
  --left: 1;
  width: 74px;
  height: 74px;
  margin: 4px auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#ff5d7a calc(var(--left) * 360deg), rgba(255, 255, 255, 0.15) 0);
}
.offer__count {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #2a0d1c;
  font-size: 30px;
  font-weight: 900;
}
@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.18); }
  45% { transform: scale(0.96); }
  60% { transform: scale(1.1); }
}

/* The metro announcer's words, like subtitles at the bottom of the screen. */
.hud__announce {
  position: absolute;
  left: 50%;
  bottom: calc(150px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(92%, 420px);
  padding: 10px 14px 10px 44px;
  border-radius: 14px;
  background: rgba(16, 64, 160, 0.88);
  border: 2px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  text-align: left;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}
.hud__announce::before {
  content: '\1F4E2';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
}
.hud__announce[hidden] { display: none; }

/* x2 fruit chip from a gift box, under the running bonuses. */
.hud__bonuses--extra { margin-top: 4px; }
.bonus--double { background: linear-gradient(160deg, #ffcf3d, #ff8a1c); color: #3a1d00; }

/* Gift box opening, near the top of the screen; it never blocks taps. */
.gift-pop {
  position: absolute;
  top: calc(280px + env(safe-area-inset-top));
  left: 50%;
  width: 220px;
  height: 230px;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gift-pop[hidden] { display: none; }
.gift-pop__title {
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(7, 27, 41, 0.75);
  color: #ffd84d;
  font-weight: 900;
  font-size: 15px;
}
.gift-pop__box {
  --face: #2a55c9;
  --edge: #173c9e;
  position: relative;
  width: 92px;
  height: 92px;
  margin-top: 12px;
}
.gift-pop__box--premium { --face: #e3262f; --edge: #a5111a; }
.gift-pop__box--epic { --face: #8c3ae8; --edge: #5a14ad; }
.gift-pop__body {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  height: 70px;
  border-radius: 10px;
  background: linear-gradient(90deg, transparent 42%, #ffc21f 42%, #ffc21f 58%, transparent 58%), linear-gradient(160deg, var(--face), var(--edge));
  border: 4px solid #ffc21f;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 900;
  color: #fff3b0;
  text-shadow: 0 2px 0 #8a5a00;
}
.gift-pop__lid {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(90deg, transparent 42%, #ffc21f 42%, #ffc21f 58%, transparent 58%), var(--face);
  border: 4px solid #ffc21f;
  z-index: 1;
}
.gift-pop__lid::before, .gift-pop__lid::after {
  /* the bow */
  content: '';
  position: absolute;
  top: -20px;
  width: 22px;
  height: 18px;
  border: 5px solid #ffc21f;
  border-radius: 50% 50% 4px 50%;
}
.gift-pop__lid::before { left: 22px; transform: rotate(-20deg); }
.gift-pop__lid::after { right: 22px; transform: scaleX(-1) rotate(-20deg); }
.gift-pop__rays {
  position: absolute;
  top: 40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 230, 120, 0.55) 0 10deg, rgba(255, 230, 120, 0) 10deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 35%, transparent 70%);
  mask: radial-gradient(circle, #000 35%, transparent 70%);
  opacity: 0;
  z-index: -1;
}
.gift-pop__prize {
  position: absolute;
  top: 70px;
  display: grid;
  justify-items: center;
  opacity: 0;
}
.gift-pop__icon { font-size: 54px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.3)); }
.gift-pop__label {
  margin-top: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  background: #fff;
  color: #3a1d00;
  font-weight: 900;
  font-size: 17px;
  white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
.gift-pop.is-open .gift-pop__box { animation: gift-shake 0.5s ease-in-out, gift-away 0.4s ease-in 1.1s forwards; }
.gift-pop.is-open .gift-pop__lid { animation: gift-lid 0.45s ease-out 0.5s forwards; }
.gift-pop.is-open .gift-pop__rays { animation: gift-rays 1.6s ease-out 0.55s forwards; }
.gift-pop.is-open .gift-pop__prize { animation: gift-prize 0.5s cubic-bezier(.2, 1.6, .5, 1) 0.6s forwards; }
.gift-pop.is-open { animation: gift-fade 0.4s ease-in 2.2s forwards; }
@keyframes gift-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-9deg) scale(1.05); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg) scale(1.08); }
  80% { transform: rotate(5deg); }
}
@keyframes gift-lid {
  to { transform: translateY(-70px) rotate(-35deg); opacity: 0; }
}
@keyframes gift-away {
  to { transform: translateY(30px) scale(0.6); opacity: 0; }
}
@keyframes gift-rays {
  0% { opacity: 0; transform: scale(0.4) rotate(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.1) rotate(60deg); }
}
@keyframes gift-prize {
  from { opacity: 0; transform: translateY(40px) scale(0.3); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes gift-fade { to { opacity: 0; } }

/* Speed bonus: thin wind streaks rushing out from the middle, only round the edges. */
.hud.is-boosting::after {
  content: '';
  position: fixed;
  inset: -10%;
  pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% 45%, rgba(255, 255, 255, 0.5) 0deg 0.6deg, rgba(255, 255, 255, 0) 0.6deg 7deg);
  -webkit-mask: radial-gradient(ellipse at 50% 45%, transparent 38%, #000 75%);
  mask: radial-gradient(ellipse at 50% 45%, transparent 38%, #000 75%);
  animation: wind 0.35s linear infinite;
  opacity: 0.7;
}
@keyframes wind {
  from { transform: scale(1) rotate(0deg); opacity: 0.45; }
  50% { opacity: 0.8; }
  to { transform: scale(1.12) rotate(2deg); opacity: 0.45; }
}

/* A place sign: the name of the landmark the runner is passing, like a road sign. */
.hud__place {
  position: absolute;
  top: calc(222px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: 86%;
  padding: 8px 16px 8px 40px;
  border-radius: 14px;
  background: linear-gradient(180deg, #2b9e5a, #1d7a43);
  border: 3px solid #fff;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 5px 0 #11552d, 0 8px 14px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.hud__place::before {
  content: '\1F4CD';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
}
.hud__place[hidden] { display: none; }
.hud__place.is-in { animation: place-in 0.45s cubic-bezier(.2, 1.4, .5, 1); }
@keyframes place-in {
  from { transform: translate(-50%, -30px) scale(0.6); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

/* ---------- Account (sign-in) ---------- */
.account-chip {
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
}

.panel.account { gap: 10px; }

.account__now {
  margin: 0;
  font-weight: 800;
  text-align: center;
}

.account__button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 0 16px;
  border-radius: 18px;
  font-size: 17px;
  font-weight: 800;
  text-align: left;
  color: #fff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.account__button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.32); }
.account__button:disabled { opacity: 0.6; }
.account__button.is-on { outline: 3px solid var(--gold); }
.account__button--google { background: linear-gradient(180deg, #2fa866, #1d7f4a); }
.account__button--telegram { background: linear-gradient(180deg, #37aee2, #1e96c8); }
.account__button--guest { background: linear-gradient(180deg, #f0c64a, #d29c12); color: var(--ink-deep); }

.account__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 20px;
  flex: none;
}

.account__guest {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.account__name {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  color: var(--paper);
  font-size: 17px;
}

.account__message:empty { display: none; }
.account__message {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(231, 180, 22, 0.18);
  font-size: 14px;
}

.account__privacy { font-size: 12px; opacity: 0.75; }

/* ---------- Records ---------- */
.rating__heading {
  margin: 10px 0 4px;
  font-size: 16px;
  color: var(--gold);
}

.records {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.records__card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

.records__card strong { font-size: 20px; }
.records__card span { font-size: 12px; opacity: 0.8; }
.records__card.is-big { grid-column: 1 / -1; background: linear-gradient(180deg, rgba(231, 180, 22, 0.35), rgba(231, 180, 22, 0.15)); }
.records__card.is-big strong { font-size: 30px; }

.records__cities {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.records__cities li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.records__cities li.is-empty { opacity: 0.55; }

/* ---------- First-run guide ---------- */
.guide {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  width: min(320px, 86vw);
  padding: 14px 16px 12px;
  border-radius: 22px;
  background: rgba(6, 26, 44, 0.82);
  border: 2px solid rgba(255, 216, 77, 0.7);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  text-align: center;
  pointer-events: auto;
  animation: guide-in 0.35s ease-out;
}
.guide[hidden] { display: none; }
.guide.is-ok { opacity: 0.4; transition: opacity 0.3s; }
.guide.is-done { border-color: #6fe08a; }
.guide__count { font-size: 12px; opacity: 0.7; font-weight: 700; }
.guide__art { position: relative; height: 74px; display: grid; place-items: center; }
.guide__hand { font-size: 46px; display: inline-block; }
.guide__text { font-size: 18px; font-weight: 800; line-height: 1.25; }
.guide__skip {
  margin-top: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 13px;
  font-weight: 700;
}
.guide--left .guide__hand { transform: scaleX(-1); animation: guide-left 1.1s ease-in-out infinite; }
.guide--right .guide__hand { animation: guide-right 1.1s ease-in-out infinite; }
.guide--up .guide__hand { transform: rotate(-90deg); animation: guide-up 1.1s ease-in-out infinite; }
.guide--down .guide__hand { transform: rotate(90deg); animation: guide-down 1.1s ease-in-out infinite; }
.guide--skate .guide__hand { animation: guide-tap 0.9s ease-in-out infinite; }
.guide__tap {
  position: absolute; left: 50%; top: 8px; width: 26px; height: 26px; margin-left: -13px;
  border-radius: 50%; border: 3px solid #ffd84d; animation: guide-ring 0.9s ease-out infinite;
}
.guide--fruit .guide__hand, .guide--letters .guide__hand, .guide--trains .guide__hand { animation: guide-bob 1s ease-in-out infinite; }
@keyframes guide-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes guide-left { 0%, 100% { transform: scaleX(-1) translateX(-34px); } 50% { transform: scaleX(-1) translateX(34px); } }
@keyframes guide-right { 0%, 100% { transform: translateX(-34px); } 50% { transform: translateX(34px); } }
@keyframes guide-up { 0%, 100% { transform: translateY(24px) rotate(-90deg); } 50% { transform: translateY(-20px) rotate(-90deg); } }
@keyframes guide-down { 0%, 100% { transform: translateY(-20px) rotate(90deg); } 50% { transform: translateY(24px) rotate(90deg); } }
@keyframes guide-tap { 0%, 40%, 100% { transform: translateY(6px); } 20%, 60% { transform: translateY(16px); } }
@keyframes guide-ring { from { opacity: 1; transform: scale(0.6); } to { opacity: 0; transform: scale(2); } }
@keyframes guide-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Clothes shop ---------- */
.panel.wardrobe { gap: 8px; }
.wardrobe__balance { align-self: flex-end; font-weight: 800; padding: 4px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.12); }
.wardrobe__stagebox {
  display: grid; place-items: center; height: 230px; border-radius: 22px;
  background: radial-gradient(circle at 50% 70%, #3f9fb8 0%, #1d5a73 55%, #0f2f45 100%);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.wardrobe__stage { width: 230px; height: 230px; touch-action: none; }
.wardrobe__loading { font-size: 28px; opacity: 0.7; }
.wardrobe__heroes { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.wardrobe__hero {
  flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; padding: 0;
  background: rgba(255, 255, 255, 0.12); border: 3px solid transparent;
}
.wardrobe__hero img { width: 100%; height: 100%; object-fit: cover; }
.wardrobe__hero.is-on { border-color: var(--gold); }
.wardrobe__tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.wardrobe__tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 4px 2px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.1); font-size: 11px; font-weight: 700;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.wardrobe__tab span:first-child { font-size: 20px; }
.wardrobe__tab.is-on { background: var(--turquoise); }
.wardrobe__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wardrobe__item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px;
  border-radius: 16px; background: rgba(255, 255, 255, 0.08); border: 2px solid transparent;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.wardrobe__item.is-on { border-color: var(--gold); background: rgba(231, 180, 22, 0.18); }
.wardrobe__swatch { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.wardrobe__item--none .wardrobe__swatch { background: rgba(255, 255, 255, 0.12); font-size: 18px; }
.wardrobe__name { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.15; }
.wardrobe__price { font-size: 12px; font-weight: 800; color: var(--gold); }
.wardrobe__price.is-owned { color: #8fe3a0; }
.wardrobe__action:empty { display: none; }
.wardrobe__swatch.has-picture { width: 72px; height: 72px; background: radial-gradient(circle at 50% 45%, rgba(255,255,255,0.22), rgba(255,255,255,0.05) 70%); }
.wardrobe__swatch.has-picture img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Renaming a hero ---------- */
.rename { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.rename__label { font-weight: 700; font-size: 14px; opacity: 0.85; }
.rename__row { display: flex; gap: 6px; }
.rename__input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; font-weight: 700; padding: 10px 12px;
  border-radius: 14px; border: 2px solid rgba(255, 255, 255, 0.18); background: rgba(0, 0, 0, 0.25); color: inherit;
}
.rename__input:focus { outline: none; border-color: var(--gold); }
.rename__save { flex: none; width: auto; padding: 10px 16px; margin: 0; }
.rename__reset { align-self: flex-start; background: none; border: none; color: inherit; opacity: 0.75; text-decoration: underline; font: inherit; font-size: 13px; padding: 2px 0; }
