/* Экран мини-игры «Ночная смена». */
.drive {
  max-width: 1180px;
  margin: auto;
}
.drive-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.drive-top h1 {
  margin: 6px 0 4px;
}
.drive-sub {
  margin: 0;
  max-width: 52ch;
}
.drive-modes {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.drive-modes button {
  padding: 9px 12px;
  font-size: 12px;
  border-radius: 999px;
}
.drive-settings {
  display: grid;
  gap: 10px;
  justify-items: end;
}
.drive-volume {
  display: grid;
  gap: 8px;
  min-width: min(320px, 92vw);
  background: #12241f;
  border: 2px solid #3f6b5f;
  border-radius: 14px;
  padding: 12px 14px;
  color: #c6d5c3;
  font-size: 12px;
}
.volume-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.volume-row label {
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #9fb6a8;
  white-space: nowrap;
}
.volume-row input[type="range"] {
  width: 100%;
  accent-color: #d5ff5f;
  background: transparent;
  cursor: pointer;
}
.volume-row output {
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #d5ff5f;
}
.volume-note {
  margin: 2px 0 0;
  font-size: 11px;
  color: #6a7870;
}
.drive-stage {
  position: relative;
  width: min(100%, max(300px, min(78vh, 880px) * 0.75));
  aspect-ratio: 3/4;
  margin: auto;
  border-radius: 28px;
  overflow: hidden;
  background: #0b1613;
  box-shadow:
    0 30px 70px #17312e38,
    inset 0 0 0 3px #17312e;
  border: 3px solid #17312e;
  container-type: size;
}
#drive-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.hud {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  color: #f2f7ee;
  font-family: system-ui, sans-serif;
}
.hud-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
  gap: 6px;
  align-items: stretch;
}
.hud-row-2 {
  grid-template-columns: 1fr auto 72px;
  grid-template-rows: 100%;
  align-items: center;
  height: 26px;
  gap: 8px;
}
.hud-hearts {
  display: flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
}
.hud-chip {
  position: relative;
  background: #0e1f1bdb;
  border: 1px solid #35534a;
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  height: 66px;
  backdrop-filter: blur(4px);
}
.hud-label {
  font-size: 10px;
  line-height: 1;
  letter-spacing: 1.4px;
  font-weight: 800;
  color: #9fb6a8;
}
.hud-chip strong {
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hud-chip small {
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: #9fb6a8;
}
#hud-record {
  position: absolute;
  bottom: 5px;
  left: 10px;
  right: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/* Касса возврата живёт под суммой в кассе: ровно та цифра, что сгорит при аварии. */
#hud-cashout {
  position: absolute;
  bottom: 5px;
  left: 10px;
  right: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #d5ff5f;
}
.hud-score.beat small {
  color: #ffd85e;
}
.hud-level {
  text-align: right;
}
.hud-level strong {
  color: #ffd85e;
  overflow: visible;
}
.hud-level.beating {
  animation: heatpulse 0.5s ease-in-out 3 alternate;
}
.touch-pause {
  pointer-events: auto;
  width: 36px;
  height: 44px;
  padding: 0;
  align-self: center;
  border-radius: 10px;
  border: 1px solid #35534a;
  background: #0e1f1bdb;
  color: #d5ff5f;
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.touch-pause:hover {
  background: #17312e;
}
.hud-cash strong {
  color: #8fe3a8;
  transition:
    transform 0.12s ease-out,
    color 0.25s;
}
.hud-cash.pulse strong {
  color: #d5ff5f;
  transform: scale(1.16);
}
.hud-economy {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 4px 10px;
  padding: 7px 10px;
  background: #0e1f1bdb;
  border: 1px solid #35534a;
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.4;
  color: #aabeb2;
  font-variant-numeric: tabular-nums;
}
.hud-economy > span {
  white-space: nowrap;
  min-width: 0;
}
.hud-economy b {
  color: #a5ffef;
}
.hud-economy .loss,
.result .result-profit strong.loss {
  color: #ff9e9e;
}
.hud-economy small {
  color: #ff9e9e;
  grid-column: 1/-1;
}
.intro-specs {
  font-size: 12px !important;
  color: #a5ffef !important;
}
.intro-tariff {
  border: 1px solid #806e37;
  border-radius: 10px;
  padding: 10px;
  color: #ffe495 !important;
}
.result .result-profit strong {
  font-size: 24px;
  color: #a5ffef;
}
.car-preview {
  float: right;
  width: 84px;
  height: 112px;
  margin: 0 0 8px 12px;
  background: #244035;
  border-radius: 12px;
}
.intro-grid {
  clear: both;
}
.hud-hearts i {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border-radius: 5px;
  background: #d5ff5f;
  border: 2px solid #17312e;
  display: block;
  transform: rotate(45deg);
  box-shadow: 0 0 8px #d5ff5f33;
}
.hud-hearts i.lost {
  background: #2b4038;
  box-shadow: none;
  opacity: 0.55;
}
.hud-hearts i.hurt {
  background: #ff9d4d;
  box-shadow: 0 0 12px #ff9d4d66;
}
.hud-heat {
  display: flex;
  gap: 2px;
  align-items: center;
  font-size: 16px;
  line-height: 1;
}
.hud-heat i {
  color: #3a5049;
  font-style: normal;
  font-weight: 800;
}
.hud-heat i.on {
  color: #ffd85e;
  text-shadow: 0 0 10px #ff9d3d;
}
.hud-combo {
  height: 100%;
  align-content: center;
  line-height: 1;
  font-weight: 900;
  font-size: 20px;
  text-align: right;
  white-space: nowrap;
  color: #ffd85e;
  text-shadow: 2px 2px 0 #17312e;
  letter-spacing: -0.5px;
}
#hud-combo[hidden] {
  display: block !important;
  visibility: hidden;
}
.hud-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: auto;
  min-height: 44px;
}
.hud-powers {
  position: absolute;
  left: calc(clamp(64px, 22cqw, 118px) + 20px);
  right: 90px;
  bottom: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 4px;
}
.hud-powers b {
  font-size: 11px;
  letter-spacing: 0.6px;
  background: #12251fde;
  border: 2px solid #3f6b5f;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
  color: #a5ffef;
}
.hud-nitro {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(68%, 320px);
  line-height: 1;
}
.nitro-track {
  flex: 1;
  max-width: 180px;
  height: 12px;
  border-radius: 999px;
  background: #12251fe6;
  border: 1px solid #52766a;
  overflow: hidden;
}
.nitro-track i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7fe3d8, #ffd85e);
  border-radius: 999px;
  transition: width 0.1s linear;
}
.nitro-hint {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #9fb6a8;
  white-space: nowrap;
}
.hud-nitro.ready .nitro-hint {
  color: #ffd85e;
}
.hud-speed {
  position: absolute;
  right: 12px;
  bottom: 10px;
  text-align: right;
  line-height: 1;
  display: grid;
  gap: 2px;
}
.hud-speed strong {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  text-shadow: 2px 2px 0 #17312e;
}
.hud-speed span {
  font-size: 9px;
  font-weight: 800;
  color: #9fb6a8;
  letter-spacing: 1px;
}
.bribe-prompt {
  width: 100%;
  background: #1d1030ed;
  border: 1px solid #ffd85e;
  border-radius: 10px;
  padding: 5px 8px;
  text-align: center;
  box-shadow: 0 8px 24px #0006;
}
.bribe-lead {
  margin: 0;
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 900;
  color: #ff7ab8;
  line-height: 1.4;
}
.bribe-cost {
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.3;
}
.bribe-cost strong {
  font-size: 18px;
  font-weight: 900;
  color: #ffd85e;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.bribe-cost span {
  font-size: 10px;
  font-weight: 700;
  color: #c6d5c3;
}
.bribe-cost.insufficient strong {
  color: #ff7a7a;
}
.bribe-bar {
  height: 4px;
  border-radius: 999px;
  background: #0000005c;
  overflow: hidden;
}
.bribe-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: #ffd85e;
}
/* Цена отказа и альтернатива нитро — то, что игрок решает за полторы секунды */
.bribe-prompt small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.25;
  font-weight: 700;
  color: #ffd85e;
}
.drive-touch {
  position: absolute;
  right: 12px;
  bottom: 64px;
  display: none;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}
.drive-touch button {
  width: 76px;
  height: 44px;
  border: 1px solid #8b773f;
  border-radius: 12px;
  font-weight: 900;
  font-size: 12px;
  padding: 0 8px;
  background: #ffd85e;
  color: #12241f;
  box-shadow: 0 3px 0 #a5892f;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.drive-touch .touch-nitro {
  background: #7fe3d8;
  border-color: #418e83;
  box-shadow: 0 3px 0 #3d8b83;
}
.drive-touch button:active {
  transform: translateY(2px);
  box-shadow: none;
}
/* Пока идёт диалог с патрулем, кнопка «Взятка» подсвечена: на таймер в 1.5 с */
.drive-touch button.armed {
  border-color: #ffd85e;
  box-shadow: 0 0 0 2px #ffd85e73, 0 3px 0 #3d8b83;
}
.hud button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.drive-touch button {
  touch-action: none;
}
@media (hover: none) and (pointer: coarse) {
  .drive-touch {
    display: flex;
  }
}
.overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #08120fd9;
  overflow: auto;
}
.overlay-card {
  max-width: 640px;
  width: 100%;
  max-height: calc(100% - 30px);
  overflow: auto;
  background: #12241f;
  border: 3px solid #d5ff5f;
  border-radius: 22px;
  padding: 24px;
  color: #eaf3e6;
  box-shadow: 0 24px 60px #000a;
}
.overlay-card.narrow {
  max-width: 420px;
  text-align: center;
}
/* Строка решения на паузе: цифра должна читаться как цифра */
.pause-state {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 800;
  color: #8fe3a8;
  font-variant-numeric: tabular-nums;
}
.pause-state.loss {
  color: #ff9e9e;
}
.overlay-card h2 {
  margin: 2px 0 12px;
  font-size: 30px;
  letter-spacing: -1.4px;
  color: #d5ff5f;
}
.overlay-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 1.4px;
  color: #9fb6a8;
  text-transform: uppercase;
}
.overlay-card p {
  color: #c6d5c3;
  line-height: 1.6;
  font-size: 14px;
}
.overlay-card .actions {
  margin-top: 18px;
}
.overlay-card a {
  border: 1px solid #3f6b5f;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 700;
  text-decoration: none;
  color: #eaf3e6;
}
.intro-grid {
  display: grid;
  gap: 16px;
  margin-top: 6px;
}
.intro-help {
  clear: both;
  margin-top: 12px;
  border-top: 1px solid #35534a;
  padding-top: 12px;
}
.intro-help summary {
  cursor: pointer;
  color: #a5ffef;
  font-size: 13px;
  font-weight: 700;
}
.touch-instructions {
  display: none;
}
.intro-goal {
  clear: both;
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #ffd85e;
}
@media (hover: none) and (pointer: coarse) {
  .touch-instructions {
    display: block;
    font-size: 12px !important;
    color: #a5ffef !important;
    clear: both;
  }
}
@media (min-width: 640px) {
  .intro-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.keys,
.rules {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: #c6d5c3;
}
.keys kbd {
  background: #20362e;
  border: 1px solid #47685c;
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 2px 7px;
  font: inherit;
  font-size: 12px;
  color: #d5ff5f;
}
.rules b {
  color: #ffd85e;
}
.intro-perk {
  background: #20362e;
  border-left: 4px solid #d5ff5f;
  border-radius: 0 12px 12px 0;
  padding: 12px 14px;
  font-weight: 600;
}
#drive-intro .eyebrow {
  margin: 0 0 8px;
}
#drive-intro .intro-perk {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  margin: 8px 0;
}
#drive-intro .car-preview {
  width: 64px;
  height: 86px;
  margin-left: 8px;
}
#drive-intro .intro-tariff {
  font-size: 12px;
  line-height: 1.4;
  padding: 8px;
  margin: 8px 0;
}
#drive-intro .actions {
  clear: both;
  margin-top: 12px;
}
.intro-record {
  font-weight: 800;
  color: #ffd85e;
}
.pause-keys {
  margin: 14px 0 0;
  text-align: left;
}
.drive-result-grade {
  display: flex;
}
.grade {
  display: flex;
  align-items: center;
  gap: 18px;
}
.grade > strong {
  font-size: 76px;
  line-height: 0.8;
  font-weight: 900;
  letter-spacing: -6px;
  color: #d5ff5f;
  text-shadow: 4px 4px 0 #20362e;
}
.stats {
  list-style: none;
  margin: 18px 0 6px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
}
.stats li {
  background: #20362e;
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
}
.stats span {
  font-size: 11px;
  letter-spacing: 1.2px;
  color: #9fb6a8;
  font-weight: 800;
  text-transform: uppercase;
}
.stats strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.result-note {
  font-size: 13px;
  font-style: italic;
  color: #ffd85e;
  min-height: 20px;
}
.result-stars {
  margin: 2px 0 0;
  font-size: 26px;
  letter-spacing: 6px;
  color: #ffd85e;
  text-shadow: 2px 2px 0 #20362e;
}
.result-stars .off {
  color: #3d5a4f;
  text-shadow: none;
}
.result-caption {
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #9fc4b6;
}
.result-caption:empty {
  display: none;
}
.grade > div {
  min-width: 0;
}
#result-score {
  font-size: 18px;
  font-weight: 800;
  color: #f2f7ee;
  font-variant-numeric: tabular-nums;
}
.result-meta {
  margin: 2px 0 0;
  font-size: 13px;
  color: #9fb6a8;
}
.hud-heat.alarm i.on {
  animation: heatpulse 0.6s ease-in-out infinite alternate;
}
@keyframes heatpulse {
  to {
    text-shadow: 0 0 16px #ff6a6a;
  }
}
.drive-disclaimer {
  font-size: 12px;
  color: #6a7870;
  max-width: 760px;
  margin: 22px auto 0;
  text-align: center;
  line-height: 1.6;
}
body[data-page="drive"] main {
  max-width: 1280px;
  padding-top: 26px;
}
body[data-page="drive"] .drive .eyebrow {
  color: #6b8d2e;
}
.drive .badge-car {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: #ecf3e3;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 13px;
  color: #304d27;
}
@media (max-width: 800px) {
  .drive-stage {
    width: min(100%, calc(100vw - 24px));
    height: auto;
    aspect-ratio: 3/4;
  }
  .overlay-card {
    padding: 18px;
  }
}
@media (max-width: 900px) and (orientation: landscape) {
  .drive-stage {
    width: min(100%, calc((100svh - 24px) * 0.75));
  }
}
@media (max-width: 520px) {
  body[data-page="drive"] main {
    padding: 18px 12px;
  }
  .drive-top {
    gap: 12px;
    margin-bottom: 14px;
  }
  .drive-settings {
    justify-items: start;
  }
  .drive-sub {
    font-size: 13px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stats li {
    padding: 8px 10px;
  }
  .stats strong {
    font-size: 17px;
  }
  .stats span {
    font-size: 10px;
  }
  .grade > strong {
    font-size: 56px;
  }
  .overlay-card h2 {
    font-size: 24px;
  }
}
@container (max-width:520px) {
  .hud {
    padding: 10px;
    gap: 6px;
  }
  .hud-chip {
    padding: 7px 8px;
    height: 60px;
  }
  .hud-chip strong {
    font-size: 18px;
    letter-spacing: -0.5px;
  }
  .hud-label {
    font-size: 9px;
    letter-spacing: 0.8px;
  }
  .hud-chip small {
    font-size: 9px;
    letter-spacing: 0;
  }
  .hud-hearts {
    gap: 4px;
  }
  .hud-hearts i {
    width: 14px;
    height: 14px;
    border-radius: 4px;
  }
  .hud-row-2 {
    grid-template-columns: 1fr auto 62px;
    gap: 6px;
    height: 24px;
  }
  .hud-heat {
    font-size: 14px;
    gap: 1px;
  }
  .hud-combo {
    font-size: 18px;
  }
  .hud-speed strong {
    font-size: 30px;
  }
  .hud-economy {
    font-size: 9px;
    gap: 3px 6px;
    padding: 6px 8px;
  }
  .hud-nitro {
    width: 62%;
    left: 10px;
    bottom: 10px;
  }
  .nitro-key {
    display: none;
  }
  .overlay-card {
    padding: 16px;
  }
}
@container (max-width:330px) {
  .hud-row {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 30px;
    gap: 4px;
  }
  .touch-pause {
    width: 30px;
  }
  .hud-chip {
    padding: 7px 5px;
  }
  .hud-chip strong {
    font-size: 16px;
  }
  .hud-economy {
    font-size: 9px;
  }
  .hud-hearts i {
    width: 12px;
    height: 12px;
  }
  .hud-row-2 {
    grid-template-columns: 1fr auto 54px;
    gap: 4px;
  }
  .hud-heat {
    font-size: 12px;
  }
  .hud-combo {
    font-size: 16px;
  }
}
@container (max-height:720px) {
  .overlay-card {
    padding: 16px;
  }
  .overlay-card h2 {
    font-size: 22px;
    margin: 0 0 8px;
  }
  .overlay-card h3 {
    margin-bottom: 4px;
  }
  .overlay-card p {
    font-size: 13px;
    line-height: 1.45;
  }
  .intro-grid {
    gap: 10px;
  }
  .keys,
  .rules {
    gap: 4px;
    font-size: 12px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stats li {
    padding: 7px 10px;
  }
  .stats strong {
    font-size: 16px;
  }
  .stats span {
    font-size: 10px;
  }
  .grade > strong {
    font-size: 52px;
  }
  .result-stars {
    font-size: 22px;
  }
}
@container (max-height:560px) {
  .drive-disclaimer {
    font-size: 11px;
  }
}
@container (max-height:420px) {
  .hud {
    gap: 4px;
  }
  .hud-chip {
    height: 50px;
    padding: 5px;
    gap: 2px;
  }
  .hud-row-2 {
    height: 22px;
  }
  .hud-economy {
    grid-template-columns: 1.45fr 1fr;
  }
  .hud-economy .eco-revenue,
  .hud-economy .eco-when {
    display: none;
  }
  .hud-actions {
    height: 40px;
  }
}
/* Давление: полоса облавы, кнопка кассы, комментатор и таблица заезда. */
.hud-raid {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2a1020e6;
  border: 2px solid #ff7a7a;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 11px;
  color: #ffd0d0;
}
.hud-raid .hud-label {
  color: #ff9e9e;
}
.raid-track {
  flex: 1;
  height: 10px;
  min-width: 80px;
  border-radius: 999px;
  background: #0000005c;
  overflow: hidden;
}
.raid-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9d4d, #ff4d6d);
  transition: width 0.12s linear;
}
.hud-raid.tight {
  animation: raidflash 0.45s ease-in-out infinite alternate;
  box-shadow: 0 0 22px #ff4d6d99;
}
.hud-raid small {
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
@keyframes raidflash {
  to {
    border-color: #ffd85e;
    background: #3a1a10f2;
  }
}
.hud-retire {
  pointer-events: auto;
  height: 32px;
  border: 1px solid #3f6b5f;
  border-radius: 999px;
  background: #0e1f1bdb;
  color: #a5ffef;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.hud-retire:hover {
  background: #17312e;
  color: #d5ff5f;
}
.hud-retire.risky {
  color: #ff9e9e;
  border-color: #7a4152;
}
.drive-caster {
  position: absolute;
  left: 0;
  bottom: calc(100% + 2px);
  width: clamp(64px, 22cqw, 118px);
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px #0008) saturate(1.05);
}
.caster-source {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.board {
  margin-top: 16px;
  background: #0e1f1bcc;
  border: 2px solid #3f6b5f;
  border-radius: 16px;
  padding: 14px;
  color: #eaf3e6;
}
.board-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.board-top h3 {
  margin: 0;
}
.board-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.board-filters button {
  border: 1px solid #3f6b5f;
  border-radius: 999px;
  background: transparent;
  color: #9fb6a8;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  cursor: pointer;
}
/* Кнопка-переключатель в шапке обязана выглядеть включённой, а не только называться */
.drive-modes button[aria-pressed="true"] {
  border-color: #ffd85e;
  color: #ffd85e;
}
.board-filters button[aria-pressed="true"] {
  background: #d5ff5f;
  color: #12241f;
  border-color: #d5ff5f;
}
.board-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.board-table th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 1px;
  color: #9fb6a8;
  text-transform: uppercase;
  padding: 4px 6px;
}
.board-table td {
  padding: 6px;
  border-top: 1px solid #244035;
  color: #c6d5c3;
}
.board-table td:nth-child(1) {
  color: #9fb6a8;
  font-weight: 900;
}
.board-table strong {
  color: #d5ff5f;
  font-size: 14px;
}
.board-table .me td {
  background: #20362e;
  color: #f2f7ee;
}
.board-table .me strong {
  color: #ffd85e;
}
.board-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: #9fb6a8;
}
.result-gif {
  display: block;
  width: min(100%, 300px);
  margin: 0 auto 12px;
  border-radius: 16px;
  border: 3px solid #244035;
}
.result-gif.win {
  border-color: #d5ff5f;
}
.result-rank {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 800;
  color: #a5ffef;
}
@container (max-width:520px) {
  .board-table td,
  .board-table th {
    padding: 4px;
  }
  .board-name {
    max-width: 70px;
  }
  .hud-powers {
    right: 70px;
    bottom: 24px;
    gap: 3px;
  }
  .hud-powers b {
    padding: 3px 5px;
    font-size: 8px;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
  }
}
@container (max-height:720px) {
  .board {
    padding: 10px;
  }
  .board-table {
    font-size: 11px;
  }
  .result-gif {
    width: min(100%, 210px);
    margin-bottom: 8px;
  }
  .hud-raid {
    padding: 4px 8px;
    gap: 6px;
  }
  .hud-raid small {
    display: none;
  }
}

/* Поездка занимает весь экран; навигация и рейтинг остаются на сайте. */
body[data-page="drive"] {
  background: #08120f;
  overflow: hidden;
}
body[data-page="drive"] .site-header,
body[data-page="drive"] .site-footer {
  display: none;
}
body[data-page="drive"] main {
  width: 100%;
  max-width: none;
  padding: 0 !important;
  min-height: 0;
}
body[data-page="drive"] .drive {
  max-width: none;
  margin: 0;
}
body[data-page="drive"] .drive-stage {
  width: 100%;
  height: 100dvh;
  aspect-ratio: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.drive-top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: 48px;
  margin: 0;
  padding: 6px 12px;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  background: #08120fdb;
  color: #eaf3e6;
}
.drive-top > a {
  color: #d5ff5f;
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
  width: 32px;
  text-align: center;
}
body[data-page="drive"] .drive-top h1 {
  font-size: 14px;
  letter-spacing: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  line-height: 1.2;
}
.drive-settings {
  position: relative;
  gap: 0;
  flex-shrink: 0;
}
.drive-modes {
  flex-wrap: nowrap;
  gap: 4px;
}
.drive-modes button {
  font-size: 11px;
  padding: 6px 8px;
  background: #20362e;
  border-color: #35534a;
  color: #c6d5c3;
}
.drive-volume {
  position: absolute;
  right: 0;
  top: 42px;
  z-index: 4;
}
.hud {
  top: 48px;
  max-width: 540px;
  margin: auto;
  gap: 5px;
}
.hud-chip {
  height: 52px;
  padding: 6px 9px;
  gap: 3px;
}
.hud-chip strong {
  font-size: 20px;
}
#hud-cash {
  font-size: clamp(12px, 4vw, 20px);
}
.hud-chip small {
  display: none;
}
.hud-economy {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10px;
  padding: 4px 8px;
}
.hud-economy > span {
  display: none;
}
.hud-economy .eco-profit,
.hud-economy .eco-when {
  display: block;
}
.bribe-prompt small {
  display: none;
}
.hud-economy small {
  font-size: 10px;
}
.hud-raid {
  padding: 4px 8px;
}
.hud-raid small {
  display: none;
}
.overlay {
  padding: 58px 14px 14px;
}
.overlay-card {
  max-width: 520px;
  max-height: 100%;
  padding: 18px;
  border-width: 2px;
}
.overlay-card h2 {
  font-size: 24px;
}
.overlay-card .actions {
  gap: 8px;
  margin-top: 12px;
}
.overlay-card .actions a,
.overlay-card .actions button {
  font-size: 13px;
  padding: 10px 12px;
}
#drive-intro .car-preview {
  float: none;
  display: block;
  margin: 12px auto;
  width: 70px;
  height: 94px;
}
#intro-perk:empty {
  display: none;
}
#drive-intro .intro-tariff {
  border: 0;
  padding: 0;
}
.intro-help {
  text-align: left;
  font-size: 12px;
}
.stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
}
.stats li {
  padding: 8px;
}
.stats strong {
  font-size: 17px;
}
.stats span {
  font-size: 10px;
  letter-spacing: 0.3px;
}
#result-rank {
  font-size: 12px;
  line-height: 1.3;
  margin: 12px 0;
}
.result-gif {
  width: min(100%, 170px);
  max-height: 130px;
  object-fit: cover;
}
.grade > strong {
  font-size: 54px;
}
.grade {
  gap: 12px;
}
#result-score {
  margin: 4px 0;
  font-size: 18px;
}
#result-meta {
  font-size: 12px;
  margin: 0;
}
.result-stars {
  margin: 4px 0 0 !important;
  line-height: 1;
  font-size: 20px !important;
}
@media (max-width: 520px) {
  .drive-top {
    padding: 6px;
    gap: 4px;
  }
  .drive-top > a {
    width: 26px;
  }
  .drive-modes button {
    padding: 7px 6px;
    font-size: 10px;
  }
  .drive-modes #drive-calm {
    display: none;
  }
  .hud {
    padding: 8px;
  }
  .hud-chip {
    height: 48px;
  }
  .hud-chip strong {
    font-size: 18px;
  }
  .overlay-card {
    padding: 14px;
  }
}
@media (max-height: 500px) {
  .hud {
    top: 40px;
    padding: 5px;
    gap: 3px;
    max-width: 500px;
  }
  .drive-top {
    height: 40px;
  }
  .hud-chip {
    height: 42px;
    padding: 4px 6px;
  }
  .hud-chip strong {
    font-size: 16px;
  }
  .hud-economy {
    display: flex;
  }
  .hud-actions {
    height: 32px;
  }
  .hud-nitro {
    bottom: 8px;
  }
  .drive-caster {
    width: 58px;
  }
  .overlay {
    padding: 46px 10px 8px;
  }
  .result-gif {
    float: right;
    width: 100px;
    margin: 0 0 6px 8px;
    max-height: 80px;
  }
  .overlay-card h2 {
    font-size: 20px;
  }
  .overlay-card .actions {
    margin-top: 8px;
  }
  .stats {
    margin: 8px 0;
  }
  .stats li {
    padding: 5px;
  }
  .grade > strong {
    font-size: 36px;
  }
}
/* Полноценная страница лидерборда. */
.leaderboard {
  max-width: 980px;
  margin: 0 auto 40px;
}
.leader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.leader-head h1 {
  margin: 0 !important;
}
.leader-head a {
  padding: 12px 18px;
  border-radius: 10px;
  text-decoration: none;
  color: #17312e;
  font-weight: 800;
}
.leader-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.leader-period {
  display: flex;
  gap: 6px;
}
.leader-period button[aria-pressed="true"] {
  background: #17312e;
  color: #d5ff5f;
}
.leader-personal {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.leader-personal > div {
  background: #e9ede2;
  padding: 18px;
  border-radius: 14px;
  display: grid;
  gap: 6px;
}
.leader-personal span {
  font-size: 12px;
  color: #6a7870;
}
.leader-personal strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}
.leader-table-wrap {
  overflow: auto;
  border: 1px solid #dce1d6;
  border-radius: 16px;
  background: #fff;
}
.leader-table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.leader-table th {
  font-size: 12px;
  color: #6a7870;
  padding: 16px 20px;
}
.leader-table td {
  padding: 18px 20px;
  border-top: 1px solid #e9ede2;
}
.leader-table td:first-child {
  width: 64px;
  font-weight: 800;
  color: #6a7870;
}
.leader-table td:last-child {
  text-align: right;
}
.leader-table td small {
  display: block;
  font-size: 12px;
  color: #6a7870;
  margin-top: 5px;
}
.leader-table td strong {
  overflow-wrap: anywhere;
}
.leader-table td:last-child strong {
  font-size: 23px;
}
.leader-table .me {
  background: #eff8dd;
}
.leader-table a {
  color: #47672a;
}
.leader-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
  font-size: 13px;
}
.leader-empty {
  text-align: center;
  padding: 40px;
  background: #e9ede2;
  border-radius: 16px;
}
@media (max-width: 520px) {
  .leader-personal {
    gap: 6px;
  }
  .leader-personal > div {
    padding: 12px 8px;
  }
  .leader-personal strong {
    font-size: 21px;
  }
  .leader-head h1 {
    font-size: 26px !important;
  }
  .leader-filters {
    gap: 12px;
  }
  .leader-table th,
  .leader-table td {
    padding: 12px 9px;
  }
  .leader-table td:last-child strong {
    font-size: 18px;
  }
  .leader-table td small {
    font-size: 11px;
  }
  .leader-pager {
    gap: 10px;
  }
  .leader-pager button {
    padding: 10px;
  }
}

.overlay-card .actions a.primary {
  color: #17312e;
}
body[data-page="drive"] #result-kicker {
  color: #a8be95;
  margin: 0 0 10px;
  letter-spacing: 1px;
  font-size: 10px;
}
.result-stars:empty {
  display: none;
}
@media (max-width: 520px) {
  .result-gif {
    width: 130px;
    max-height: 94px;
  }
  .result .actions a {
    padding: 9px 10px;
    font-size: 12px;
  }
  .result .grade h2 {
    font-size: 21px;
  }
}
