/* Карточка заезда вне масштабируемого меню: цели касания сохраняют экранный размер. */
#cr-window {
  --cr-ink: #f7f2e6; --cr-muted: #c5c5b8; --cr-gold: #ffd167; --cr-line: #4d5048;
  position: fixed; inset: var(--sat) var(--sar) var(--sab) var(--sal); margin: auto;
  width: min(680px, calc(100% - var(--sal) - var(--sar) - 20px));
  max-height: calc(100% - var(--sat) - var(--sab) - 20px); max-width: none; padding: 0;
  overflow: hidden; border: 1px solid #77786a; border-radius: 17px; background: #1c211f;
  color: var(--cr-ink); font: 15px/1.4 Arial, sans-serif; color-scheme: dark; box-shadow: 0 20px 80px #0008;
}
#cr-window::backdrop { background: #0b1212a6; }
#cr-window [hidden] { display: none !important; }
#cr-window :is(h2,p,figure,dl,dd) { margin: 0; }
#cr-window button, #cr-window select {
  border: 1px solid #737669; border-radius: 8px; padding: 9px 15px; min-height: 44px;
  background: #2c322e; color: inherit; font: 700 14px/1.2 Arial, sans-serif; cursor: pointer; touch-action: manipulation;
}
#cr-window :is(button,select):focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
#cr-window button:hover:enabled { border-color: var(--cr-gold); }
#cr-window button:disabled { opacity: .58; cursor: default; }
#cr-window .cr-card { display: flex; flex-direction: column; max-height: calc(100dvh - var(--sat) - var(--sab) - 22px); }
.cr-scroll {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  display: grid; grid-template-columns: 43% minmax(0,1fr); scrollbar-width: thin;
}
.cr-plan { position: relative; min-height: 170px; overflow: hidden; background: #232e2b; }
#cr-map { display: block; width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.cr-plan figcaption {
  display: inline-flex; position: absolute; bottom: 9px; left: 9px; gap: 12px;
  padding: 3px 7px; border-radius: 4px; background: #1b2423e8; color: #f1f2e6; font: 12px/1.45 Arial, sans-serif;
}
.cr-plan figcaption span { display: inline-flex; align-items: center; gap: 5px; }
.cr-plan figcaption i { width: 8px; height: 8px; border-radius: 50%; background: #ffd34a; }
.cr-plan figcaption span + span i { border-radius: 0; width: 10px; background: repeating-conic-gradient(#efe8d8 0 25%, #192321 0 50%) 0 / 6px 6px; }
.cr-detail { padding: 22px; align-self: center; min-width: 0; }
#cr-kind, #cr-rank small, #cr-purse > small {
  display: block; color: var(--cr-muted); font: 700 11px/1.35 Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase;
}
#cr-kind { color: var(--cr-gold); }
#cr-window h2 { margin: 6px 0 10px; font: clamp(20px,2.8vw,30px)/1.12 var(--font); text-wrap: balance; }
#cr-message, #cr-bonus { color: var(--cr-muted); overflow-wrap: anywhere; }
#cr-message { margin: 3px 0 10px !important; }
#cr-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; }
#cr-stats dt, #cr-bonus { font-size: 13px; line-height: 1.35; }
#cr-stats dt { color: var(--cr-muted); }
#cr-stats dd { margin-top: 1px; font: 700 17px/1.35 Arial, sans-serif; font-variant-numeric: tabular-nums; }
#cr-purse { border-top: 1px solid var(--cr-line); margin-top: 13px; padding-top: 12px; }
#cr-purse > div { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
#cr-money { color: var(--cr-gold); font: 23px/1.5 var(--font); }
#cr-xp { color: #cce1c0; font-weight: bold; }
.cr-rank, #cr-unlock, #cr-friends { grid-column: 1/-1; }
.cr-rank { display: grid; grid-template-columns: minmax(68px,auto) 1fr; align-items: center; gap: 14px; border-top: 1px solid var(--cr-line); padding: 12px 22px; }
.cr-rank:has(#cr-last:not([hidden])) { grid-template-columns: auto minmax(0,1fr) auto; }
#cr-window #cr-last { max-width: 115px; padding-inline: 8px; font-size: 13px; background: transparent; }
#cr-lvl { font: 36px/1 var(--font); color: var(--cr-gold); }
#cr-rank-title { display: block; font: bold 14px/1.4 Arial,sans-serif; }
#cr-bar { display: block; height: 6px; width: 100%; margin: 5px 0; overflow: hidden; border: none; border-radius: 4px; appearance: none; background: #414941; }
#cr-bar::-webkit-progress-bar { background: #414941; }
#cr-bar::-webkit-progress-value { background: var(--cr-gold); }
#cr-bar::-moz-progress-bar { background: var(--cr-gold); }
#cr-caption { color: var(--cr-muted); font: 13px/1.35 Arial,sans-serif; }
#cr-unlock { padding: 0 22px 12px; color: #f8da82; font-weight: bold; }
#map-side .mapitem[data-race] { flex-shrink: 0; }
#map-side .mapitem[data-race] .nm, #map-bar.cr-destination span { white-space: normal; overflow-wrap: anywhere; }
#map-races { grid-area: 1 / 1; width: 100%; height: 100%; min-width: 0; min-height: 0; z-index: 3; pointer-events: none; }
#map-races[hidden] { display: none; }
.race-leaders path { fill: none; stroke: #e7d098; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.race-pins [role=button] { cursor: pointer; pointer-events: all; touch-action: manipulation; color: #201e16; }
.race-hit { fill: transparent; }
.race-pins rect { fill: #ffd167; stroke: #29251c; stroke-width: 1.5; }
.race-pins text { fill: currentColor; font: bold 13px Arial,sans-serif; text-anchor: middle; }
.race-pins text.race-level { font: bold 9px Arial,sans-serif; }
.race-pins [data-locked=false] .race-level { display: none; }
.race-pins [data-locked=true] { color: #d3dbd8; }
.race-pins [data-locked=true] rect { fill: #3c4747; stroke: #98a4a0; }
.race-pins [aria-pressed=true] rect, .race-pins [role=button]:focus-visible rect { stroke: #fff; stroke-width: 3; }
#map-f [data-filter=cityRace] { background: #3e403b; border: 1px solid #8b928f; color: #d9e1db; }
#map-f [data-filter=cityRace].on { color: #302a19; border: 1px solid #ffda8b; background: #edc66b; }
#map-f [data-filter=cityRace].on .n { color: #443314; }
#map-side .mapitem[data-locked=false] { border-left: 3px solid #edc66b; background: #4f442d; }
#map-side .mapitem[data-race].sel { outline: 2px solid #fff2bb; outline-offset: -2px; }
#map-side .cr-number { flex: none; width: 26px; text-align: center; border-radius: 5px; background: #ffd167; color: #302a19; font-weight: bold; }
#map-side [data-locked=true] .cr-number { color: #e1e7e3; background: #525e5a; }
#map-side .cr-access { font-size: .87em; font-weight: normal; color: #eacb86; }
#map-side [data-locked=true] .cr-access { color: #c2ccc6; }
body.touch #map-side .mapitem[data-race] { min-height: max(58px,calc(44px / var(--uik,1))); font-size: max(17px,calc(12px / var(--uik,1))); }
body.touch #map-side .mapitem[data-race] .km { font-size: max(15px,calc(10px / var(--uik,1))); }
body.touch #map-f [data-filter=cityRace] :is(.nm,.n) { font-size: max(16px,calc(10px / var(--uik,1))); }
#cr-friends { display: flex; align-items: center; min-width: 0; gap: 8px; grid-area: 2 / 1; }
#cr-peer { flex: 1 1 90px; max-width: 100%; min-width: 0; }
#cr-friends label, #cr-no-peer { color: var(--cr-muted); font-size: 14px; }
.cr-footer { flex: none; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px 14px; padding: 12px 16px; border-top: 1px solid var(--cr-line); background: #242a26; }
#cr-modes { display: flex; align-items: stretch; border: 1px solid #5c635a; border-radius: 8px; overflow: hidden; }
#cr-window #cr-modes button { flex: 1 1 auto; border: 0; border-radius: 0; padding: 4px 8px; background: transparent; font-size: 13px; }
#cr-window #cr-modes button + button { border-left: 1px solid #5c635a; }
#cr-window #cr-modes [aria-pressed=true] { color: var(--cr-gold); background: #4b4638; box-shadow: inset 0 -3px var(--cr-gold); }
.cr-footer:has(#cr-friends:not([hidden])) #cr-modes { grid-column: 1/-1; }
.cr-footer:has(#cr-friends:not([hidden])) .cr-actions { grid-row: 2; }
.cr-actions { grid-column: 2; display: flex; gap: 8px; justify-content: flex-end; }
#cr-no-peer { flex: 1; }
#cr-window :is(#cr-go,#cr-invite) { border-color: var(--cr-gold); background: var(--cr-gold); color: #282316; }
#cr-go { min-width: 100px; }
#cr-hud { display: grid; justify-items: end; gap: 2px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--ch-edge); border-radius: 8px; background: var(--ch-panel); font: bold 12px/1.2 Arial,sans-serif; font-variant-numeric: tabular-nums; }
#cr-time { font: 18px/1.15 var(--font); color: var(--ch-gold); }
#city-readings:has(#cr-hud:not([hidden])) > :not(#cr-hud),
#city-dock:has(#cr-hud:not([hidden])) #city-street { display: none; }
@media (max-height: 480px) and (orientation: landscape) {
  .cr-scroll { grid-template-columns: 40% minmax(0,1fr); }
  .cr-detail { padding: 10px 16px; }
  #cr-window h2 { margin: 3px 0 6px; font-size: 20px; }
  .cr-plan { min-height: 118px; }
  #cr-purse { margin-top: 5px; padding-top: 5px; }
  #cr-money { font-size: 18px; }
  #cr-purse > small { display: inline; margin-right: 8px; }
  #cr-purse > div { display: inline-flex; }
  .cr-rank { padding: 5px 16px; gap: 8px; }
  #cr-lvl { font-size: 28px; }
  .cr-footer { gap: 4px 6px; padding: 5px 8px; }
  #cr-window #cr-modes button { padding-inline: 5px; }
  #cr-friends { gap: 5px; }
  #cr-friends label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #cr-friends select, #cr-friends button, .cr-actions button { padding-inline: 10px; }
  #cr-friends select { width: 0; }
  .cr-actions { gap: 4px; }
  #cr-go { min-width: 74px; }
}
@media (max-width: 490px) and (orientation: portrait) {
  .cr-scroll { grid-template-columns: minmax(0,1fr); }
  .cr-plan { height: 140px; min-height: 0; }
  .cr-detail { padding: 14px 16px; }
  .cr-footer #cr-modes { grid-column: 1/-1; }
  .cr-rank { padding-inline: 16px; }
  #cr-friends { flex-wrap: wrap; }
}
