@font-face {
  font-family: "Golos Text";
  src: url("./assets/fonts/golos-cyrillic.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("./assets/fonts/golos-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2113,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
:root {
  color-scheme: dark;
  font-family: "Golos Text", system-ui, sans-serif;
  --ink: #f6f1e7;
  --muted: #a9b1b9;
  --panel: #151a20;
  --line: #353c42;
  --accent: #ffcd59;
  --route: #6babff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #11161d; color: var(--ink); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--route); outline-offset: 4px; }
[hidden] { display: none !important; }

#game { position: relative; width: 100%; height: 100%; height: 100dvh; overflow: hidden; isolation: isolate; }
#city, .cabin, .vignette { position: absolute; inset: 0; width: 100%; height: 100%; }
#city { display: block; background: #89929c; }
.cabin { background: url("./assets/cockpit.png") center bottom / 100% 100% no-repeat; pointer-events: none; }
.vignette { background: linear-gradient(180deg, #06080c69, transparent 20%, transparent 82%, #07090dd4); pointer-events: none; }
.left-mirror { position: absolute; left: .36%; top: 64%; width: 7.42%; height: 12.75%; pointer-events: none; }
.rear-mirror {
  position: absolute; z-index: 1; left: 50%; top: calc(var(--safe-top) + 80px); transform: translateX(-50%);
  width: clamp(144px, 15vw, 220px); height: 53px; border-radius: 13px;
  box-shadow: 0 3px 12px #080b0e9c, inset 0 0 0 5px #19191d;
  pointer-events: none; overflow: hidden;
}
.rear-mirror-screen { position: absolute; inset: 5px; }
.rear-mirror > span {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); padding: 2px 7px; border-radius: 4px;
  background: #171a20e8; color: #ffdc8e; font-size: .76rem; white-space: nowrap;
}
#game[data-gear="R"] .rear-mirror { width: clamp(180px, 22vw, 300px); height: 91px; }
.shift-bar {
  position: absolute; inset: var(--safe-top) var(--safe-right) auto var(--safe-left); z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  height: 70px; padding: 0 clamp(16px, 2.7vw, 42px);
  background: #10151ae8; border-bottom: 1px solid #ffffff24;
}
.brand, .account, .area, .score, .order-top, .order-status, .nav-heading, .nav-footer { display: flex; align-items: center; }
.brand { gap: 11px; }
.brand > div { display: flex; gap: 12px; align-items: baseline; }
.brand strong { color: var(--accent); font-size: 2rem; line-height: 1; font-weight: 950; letter-spacing: -.075em; }
.brand > div span { color: #c8cbd0; font-size: .81rem; }
.taxi-mark { width: 29px; height: 29px; padding: 5px; border-radius: 7px; background: var(--accent); display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); transform: skewX(-6deg); }
.taxi-mark i { background: #181a1e; }
.taxi-mark i:nth-child(2) { grid-column: 3; }
.taxi-mark i:nth-child(3) { grid-column: 2; grid-row: 2; }
.taxi-mark i:nth-child(4) { display: none; }
.area { color: #d9dce1; gap: 8px; font-size: .86rem; white-space: nowrap; }
.location-dot { border: 2px solid var(--accent); width: 9px; height: 9px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); margin-right: 3px; }
.area-divider { color: #707983; }
.account { gap: clamp(10px, 1.6vw, 22px); justify-content: flex-end; }
.wallet { display: grid; color: var(--muted); font-size: .77rem; line-height: 1.2; white-space: nowrap; }
.wallet strong, .score strong { color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
.score { gap: 5px; }
.score-star { color: var(--accent); line-height: 1; }
.garage-button, .dialog-head button, .recover {
  background: #ffffff0d; border: 1px solid #ffffff26; color: var(--ink); border-radius: 8px; padding: 8px 12px;
}
.garage-button:hover, .recover:hover { background: #ffffff20; }

.order {
  position: absolute; z-index: 2; top: calc(var(--safe-top) + 92px); left: calc(var(--safe-left) + clamp(16px, 2.7vw, 42px)); width: min(300px, 35vw);
  border: 1px solid #ffffff36; border-radius: 12px; background: #151a20ee; padding: 15px 16px 14px;
  box-shadow: 0 12px 36px #0b0f1570;
}
.order-top { justify-content: space-between; gap: 6px; }
.order-status { gap: 7px; font-size: .83rem; color: #e1dfd7; font-weight: 650; }
.order-status i { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; flex: 0 0 7px; }
.car-class { padding: 3px 7px; color: #ded1ae; border: 1px solid #696048; border-radius: 5px; font-size: .77rem; }
.order h1 { margin: 12px 0 3px; font-size: clamp(1.26rem, 2.5vw, 1.76rem); line-height: 1.08; letter-spacing: -.04em; }
#order-place { margin: 7px 0 0; font-size: .95rem; line-height: 1.24; }
.order-detail { margin: 7px 0 0; color: #b7bdc4; font-size: .85rem; line-height: 1.3; }
#order-action { width: 100%; margin-top: 14px; min-height: 42px; display: flex; justify-content: space-between; align-items: center; gap: 7px; padding: 8px 10px; font-weight: 790; color: #211a0d; border: 0; border-radius: 7px; background: var(--accent); }
#order-action:hover { background: #ffdf8d; }
#order-action:disabled { background: #292e36; color: #dedfe0; }
kbd { font: 650 .76rem system-ui, sans-serif; display: inline-grid; min-width: 1.55rem; min-height: 1.42rem; place-items: center; padding: 0 4px; color: inherit; border: 1px solid currentColor; border-radius: 4px; opacity: .84; }
#order-action:disabled kbd { visibility: hidden; }
.alert { position: absolute; z-index: 3; top: calc(var(--safe-top) + 84px); left: 50%; transform: translateX(-50%); text-align: center; width: max-content; max-width: calc(100% - 24px); padding: 9px 13px; background: #191c22f7; border: 1px solid #b59b65; border-radius: 8px; font-size: .9rem; }
.alert[data-kind="fine"] { border-color: #ed796c; }

.instrument { position: absolute; z-index: 1; left: 44%; bottom: 10%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(5, auto); gap: 8px; align-items: center; background: #100f12ed; border: 1px solid #ffffff30; border-radius: 8px; padding: 4px 9px; min-width: 108px; text-align: center; box-shadow: 0 3px 13px #0008; }
.instrument strong { display: block; font-size: clamp(1.55rem, 2.9vw, 2.8rem); line-height: .95; font-weight: 760; font-variant-numeric: tabular-nums; }
.speed-unit { color: #c8b38f; font-size: .68rem; }
.gear { color: var(--accent); font: 700 .82rem ui-monospace, monospace; }
.turn-lamp { color: #6b7167; opacity: .45; line-height: 1; font-size: 1.05rem; }
.turn-lamp[data-on="true"] { color: #8cf59f; opacity: 1; animation: turn-signal .72s steps(1) infinite; }
@keyframes turn-signal { 55% { opacity: .2; } }
.limit { width: 25px; height: 25px; display: grid; place-items: center; color: #202229; background: #eeeae0; border: 3px solid #d7574e; border-radius: 50%; font-size: .7rem; font-weight: 850; }
.instrument[data-speeding="true"] #speed { color: #ff887d; }

.signal-status {
  position: absolute; z-index: 2; top: calc(var(--safe-top) + 92px); right: calc(var(--safe-right) + clamp(16px, 2.7vw, 42px));
  display: flex; gap: 9px; align-items: center; padding: 7px 10px; border: 1px solid #ffffff37;
  border-radius: 9px; color: var(--ink); background: #151a20e8; box-shadow: 0 8px 20px #0c0d124d;
}
.signal-status > span:last-child { display: grid; gap: 1px; font-size: .82rem; line-height: 1.14; }
#signal-distance { color: #bbc1cb; font-size: .77rem; }
.signal-lights { display: grid; gap: 2px; padding: 3px 4px; background: #0e1116; border-radius: 5px; }
.signal-lights i { width: 7px; height: 7px; border-radius: 50%; background: #39404a; }
.signal-status[data-color="red"] i:nth-child(1) { background: #ff6759; box-shadow: 0 0 8px #ff6759b8; }
.signal-status[data-color="yellow"] i:nth-child(2) { background: #ffcf65; box-shadow: 0 0 8px #ffcf65b8; }
.signal-status[data-color="green"] i:nth-child(3) { background: #80ed99; box-shadow: 0 0 8px #80ed99b8; }

.navigator {
  position: absolute; z-index: 2; right: calc(var(--safe-right) + clamp(15px, 4vw, 64px)); bottom: max(7%, calc(var(--safe-bottom) + 22px)); width: clamp(155px, 15.4vw, 241px);
  background: #11151b; border: 2px solid #44464a; border-radius: 19px; padding: 8px;
  box-shadow: 0 16px 30px #090e14a8, inset 0 0 0 1px #0e0d0d;
}
.phone-speaker { background: #3d444a; border-radius: 7px; width: 26px; height: 3px; margin: 0 auto 6px; }
.nav-heading { gap: 8px; min-height: 48px; padding: 6px 8px; border-radius: 9px 9px 0 0; background: #203c69; }
.nav-icon { min-width: 20px; text-align: center; color: #dceeff; font-size: 1.3rem; }
.nav-heading > div { min-width: 0; }
.nav-heading strong { color: #fff; font-size: 1.05rem; font-weight: 800; display: block; line-height: 1.14; }
.nav-heading div span { display: block; color: #c1d4f0; font-size: .78rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#minimap { display: block; width: 100%; aspect-ratio: 1.22; background: #232c37; }
.nav-footer { color: #c0c9d7; justify-content: space-between; background: #202631; padding: 6px 8px; font-size: .76rem; border-radius: 0 0 8px 8px; }
.north { display: grid; place-items: center; font-size: .66rem; width: 17px; height: 17px; border-radius: 50%; border: 1px solid #7e8ea3; }
.key-help { position: absolute; z-index: 2; display: flex; align-items: center; gap: 15px; white-space: nowrap; bottom: calc(var(--safe-bottom) + 13px); left: 50%; transform: translateX(-50%); color: #e0ddd5; font-size: .77rem; }
.key-help > span { display: inline-flex; align-items: center; gap: 3px; }
.attribution { position: absolute; z-index: 2; bottom: calc(var(--safe-bottom) + 14px); right: calc(var(--safe-right) + 14px); color: #c5c4c2; font-size: .73rem; }
.touch-controls { display: none; }

dialog { color: var(--ink); width: min(440px, calc(100vw - 28px)); background: #191e26; border: 1px solid #545a62; border-radius: 13px; padding: 19px; box-shadow: 0 25px 70px #000a; }
dialog::backdrop { background: #0c1016ba; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dialog-head h2 { margin: 0; font-size: 1.5rem; }
.dialog-head button { font-size: 1.3rem; line-height: 1; }
.car-row { min-height: 69px; border-top: 1px solid var(--line); padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.car-row div span { display: block; color: var(--muted); margin-top: 3px; font-size: .83rem; }
.car-row button { background: var(--accent); color: #211a0d; padding: 8px 10px; border-radius: 7px; border: 0; font-weight: 740; }
.car-row button:disabled { background: #303742; color: #cdd3db; }
.recover { width: 100%; margin-top: 8px; }

@media (max-width: 960px) { .brand > div span { display: none; } }
@media (pointer: coarse), (max-width: 740px) {
  #game { touch-action: none; }
  .shift-bar { height: 50px; padding: 0 12px; }
  .rear-mirror { top: calc(var(--safe-top) + 57px); width: 119px; height: 36px; border-radius: 9px; }
  .rear-mirror-screen { inset: 4px; }
  #game[data-gear="R"] .rear-mirror { width: 167px; height: 64px; }
  .signal-status { top: calc(var(--safe-top) + 60px); right: calc(var(--safe-right) + 10px); padding: 5px 7px; gap: 5px; }
  .signal-status > span:last-child, #signal-distance { font-size: .72rem; }
  .brand { gap: 7px; }
  .brand strong { font-size: 1.45rem; }
  .taxi-mark { width: 21px; height: 21px; padding: 4px; }
  .area { font-size: .75rem; gap: 4px; }
  .account { gap: 8px; }
  .wallet { font-size: .69rem; }
  .wallet strong, .score strong { font-size: .82rem; }
  .garage-button { min-height: 38px; padding: 4px 7px; font-size: .79rem; }
  .order { top: calc(var(--safe-top) + 60px); left: calc(var(--safe-left) + 10px); padding: 9px 10px; width: clamp(175px, 33vw, 230px); border-radius: 9px; }
  .order h1 { font-size: 1.13rem; margin-top: 6px; }
  #order-place { font-size: .82rem; margin-top: 4px; }
  .order-detail { font-size: .76rem; margin-top: 4px; }
  .order-status, .car-class { font-size: .72rem; }
  #order-action { min-height: 42px; margin-top: 7px; font-size: .85rem; }
  #order-action kbd, .key-help { display: none; }
  .alert { top: auto; bottom: calc(var(--safe-bottom) + 94px); font-size: .8rem; }
  .navigator { right: calc(var(--safe-right) + 10px); bottom: calc(var(--safe-bottom) + 85px); width: 132px; border-radius: 12px; padding: 4px; }
  .nav-heading { min-height: 33px; padding: 3px 5px; gap: 2px; }
  .nav-heading strong { font-size: .83rem; }
  .nav-heading div span, .nav-footer { font-size: .67rem; }
  .nav-footer { padding: 3px 5px; }
  .phone-speaker { display: none; }
  #minimap { aspect-ratio: 1.55; }
  .instrument { bottom: calc(var(--safe-bottom) + 67px); min-width: 80px; gap: 5px; left: 46%; padding: 4px 6px; }
  .touch-controls { display: flex; justify-content: space-between; position: absolute; z-index: 3; bottom: calc(var(--safe-bottom) + 23px); left: calc(var(--safe-left) + 12px); right: calc(var(--safe-right) + 12px); pointer-events: none; }
  .steering, .pedals { display: flex; align-items: end; gap: 6px; }
  .steering { position: relative; }
  .touch-controls button { pointer-events: auto; touch-action: none; user-select: none; min-width: 44px; min-height: 52px; padding: 3px 6px; border-radius: 11px; border: 1px solid #ffffff59; background: #1c242fe6; color: #fff7e9; font-weight: 700; font-size: .77rem; }
  .steering button { width: clamp(44px, 8vw, 64px); font-size: 2.1rem; line-height: .8; }
  .turn-buttons { display: flex; gap: 6px; position: absolute; bottom: calc(100% + 5px); left: 0; }
  .turn-buttons button { min-height: 40px; font-size: 1.2rem; background: #171d26e8; }
  .turn-buttons button[aria-pressed="true"] { color: #91f0a4; border-color: #91f0a4; }
  #gear-toggle { display: grid; place-content: center; min-width: 52px; line-height: 1; gap: 3px; }
  #gear-toggle strong { font-size: 1.03rem; }
  #gear-toggle span { font-size: .59rem; }
  #gear-toggle[aria-pressed="true"] { color: #ffda91; border-color: #ffda91; }
  .pedals button:last-child { width: clamp(49px, 8vw, 64px); background: #f2be51; color: #181a1c; border-color: #f5d48b; }
  .touch-controls button[data-held="true"] { color: #181a1c; background: #ffde8c; outline: 2px solid #ffde8c; outline-offset: 1px; }
  .attribution { bottom: calc(var(--safe-bottom) + 5px); }
}
@media (orientation: portrait) and (max-width: 740px) {
  .area { display: none; }
  .shift-bar { grid-template-columns: auto 1fr; }
  .cabin { background-size: auto 84%; background-position: 42% bottom; }
  .left-mirror { display: none; }
  .rear-mirror { top: calc(var(--safe-top) + 254px); }
  .navigator { bottom: calc(var(--safe-bottom) + 112px); }
  .instrument { bottom: calc(var(--safe-bottom) + 121px); left: 30%; }
  .alert { bottom: calc(var(--safe-bottom) + 214px); }
}
@media (orientation: landscape) and (max-height: 430px) {
  .order { width: min(222px, 34vw); }
  .nav-footer { display: none; }
  #minimap { border-radius: 0 0 5px 5px; }
  .navigator { width: 116px; }
}
@media (orientation: landscape) and (min-width: 640px) and (pointer: coarse) {
  .turn-buttons { bottom: 0; left: calc(100% + 7px); }
  .turn-buttons button { width: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .turn-lamp[data-on="true"] { animation: none; }
}
