/* JTforME V60 — Stage 99½ mobile hardening and direct-route shell. */
:root {
  --v60r-vh: 100dvh;
  --v60r-vw: 100vw;
  --v60r-vtop: 0px;
  --v60r-safe-top: env(safe-area-inset-top, 0px);
  --v60r-safe-right: env(safe-area-inset-right, 0px);
  --v60r-safe-bottom: env(safe-area-inset-bottom, 0px);
  --v60r-safe-left: env(safe-area-inset-left, 0px);
  --v60r-bg: #03070a;
  --v60r-panel: rgba(4, 10, 14, .84);
  --v60r-line: rgba(255,255,255,.18);
  --v60r-ink: #f7fbff;
  --v60r-muted: #b7c3ce;
  --v60r-green: #6df0b4;
  --v60r-amber: #ffe06b;
  --v60r-red: #ff4c64;
  --v60r-blue: #75ddff;
}

html.v60r-page-locked,
body.v60r-page-locked {
  width: 100%;
  height: 100%;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.v60r-page-locked {
  position: fixed !important;
  inset-inline: 0;
  margin: 0;
  touch-action: none;
}

.v60r-direct-page {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--v60r-ink);
  background:
    radial-gradient(circle at 15% -10%, rgba(109,240,180,.12), transparent 35%),
    radial-gradient(circle at 100% 0, rgba(255,224,107,.09), transparent 33%),
    #05090d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.v60r-direct-page * { box-sizing: border-box; }

.v60r-direct-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: max(12px, var(--v60r-safe-top)) max(16px, calc(var(--v60r-safe-right) + 12px)) 12px max(16px, calc(var(--v60r-safe-left) + 12px));
}

.v60r-direct-brand,
.v60r-direct-links a {
  color: #fff;
  text-decoration: none;
}

.v60r-direct-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 1000;
  letter-spacing: -.035em;
}

.v60r-direct-brand strong { font-size: clamp(22px, 4vw, 34px); }
.v60r-direct-brand span {
  color: var(--v60r-green);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.v60r-direct-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.v60r-direct-links a {
  min-height: 40px;
  padding: 11px 13px;
  border: 1px solid var(--v60r-line);
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .035em;
}
.v60r-direct-links a:hover,
.v60r-direct-links a:focus-visible { background: #fff; color: #071016; outline: none; }

.v60r-direct-main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 0 max(8px, var(--v60r-safe-right)) max(42px, calc(var(--v60r-safe-bottom) + 28px)) max(8px, var(--v60r-safe-left));
}

.v60r-direct-note {
  width: min(920px, calc(100% - 24px));
  margin: 20px auto 0;
  padding: 18px 20px;
  border: 1px solid var(--v60r-line);
  border-radius: 18px;
  color: var(--v60r-muted);
  background: rgba(8,15,21,.78);
  line-height: 1.55;
}
.v60r-direct-note strong { color: #fff; }
.v60r-direct-note a { color: var(--v60r-green); font-weight: 900; }

.v58-rally-host .v58r-game.v60r-hardened {
  max-width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.v58r-game.v60r-hardened button,
.v58r-game.v60r-hardened canvas {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.v58r-game.v60r-hardened button { touch-action: manipulation; }
.v58r-game.v60r-hardened .v58r-stage,
.v58r-game.v60r-hardened .v58r-stage canvas,
.v58r-game.v60r-hardened .v60r-mobile-controls,
.v58r-game.v60r-hardened .v60r-mobile-controls button { touch-action: none; }

.v60r-mobile-hud,
.v60r-mobile-controls { display: none; }

.v58r-game.v60r-hardened [data-v60r-phone] {
  border-color: rgba(109,240,180,.62);
  background: linear-gradient(135deg, #1f6f55, #143f35);
  color: #fff;
  box-shadow: 0 8px 22px rgba(109,240,180,.13);
}

@media (pointer: coarse), (max-width: 820px) {
  .v58r-game.v60r-hardened [data-v60r-phone] { display: inline-flex; align-items: center; justify-content: center; }
  .v58r-game.v60r-hardened .v58r-controls button { min-height: 62px; }
  .v58r-game.v60r-hardened .v58r-toolbar button { min-height: 44px; }
}

@media (max-width: 760px) {
  .v60r-direct-header { padding-bottom: 8px; }
  .v60r-direct-brand span { display: none; }
  .v60r-direct-links a { min-height: 38px; padding: 10px 11px; font-size: 9px; }
  .v60r-direct-main { padding-inline: 0; }

  .v58r-game.v60r-direct-game { border-radius: 0; border-inline: 0; }
  .v58r-game.v60r-direct-game .v58r-marquee { display: none; }
  .v58r-game.v60r-direct-game .v58r-boundary { display: none; }
  .v58r-game.v60r-direct-game .v58r-cabinet { min-height: 0; }
  .v58r-game.v60r-direct-game .v58r-stage-column { padding: 0; }
  .v58r-game.v60r-direct-game .v58r-stage { min-height: 0; border-radius: 0; border-inline: 0; }
  .v58r-game.v60r-direct-game .v58r-stage canvas {
    height: clamp(350px, 64dvh, 560px);
    min-height: 350px;
  }
  .v58r-game.v60r-direct-game .v58r-console { padding: 10px max(10px, var(--v60r-safe-right)) max(12px, var(--v60r-safe-bottom)) max(10px, var(--v60r-safe-left)); }
  .v60r-direct-note { width: calc(100% - 20px); margin-top: 12px; font-size: 13px; }
}

/* Dedicated fixed play mode. This works even when Safari/iOS does not expose the Fullscreen API. */
.v58r-game.v60r-play-mode,
.v58r-game.v60r-play-mode.is-fullscreen {
  position: fixed !important;
  z-index: 2147483000 !important;
  top: var(--v60r-vtop, 0px) !important;
  left: 0 !important;
  width: var(--v60r-vw, 100vw) !important;
  height: var(--v60r-vh, 100dvh) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #020508 !important;
  box-shadow: none !important;
  overscroll-behavior: none;
  touch-action: none;
  contain: layout paint size;
}

.v58r-game.v60r-play-mode::after { border-radius: 0; box-shadow: inset 0 0 58px rgba(0,0,0,.34); }
.v58r-game.v60r-play-mode .v58r-marquee,
.v58r-game.v60r-play-mode .v58r-console,
.v58r-game.v60r-play-mode .v58r-boundary { display: none !important; }

.v58r-game.v60r-play-mode .v58r-cabinet,
.v58r-game.v60r-play-mode .v58r-stage-column,
.v58r-game.v60r-play-mode .v58r-stage {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

.v58r-game.v60r-play-mode .v58r-stage canvas,
.v58r-game.v60r-play-mode.is-fullscreen .v58r-stage canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: fill;
}

.v58r-game.v60r-play-mode .v60r-mobile-hud {
  position: absolute;
  z-index: 80;
  top: max(6px, var(--v60r-safe-top));
  left: max(7px, var(--v60r-safe-left));
  right: max(7px, var(--v60r-safe-right));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  pointer-events: none;
}

.v60r-mobile-readout {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 13px;
  background: rgba(2,7,10,.72);
  box-shadow: 0 8px 24px rgba(0,0,0,.26);
  backdrop-filter: blur(13px) saturate(1.1);
  -webkit-backdrop-filter: blur(13px) saturate(1.1);
}

.v60r-mobile-readout > span {
  display: grid;
  min-width: 0;
  place-items: center;
  gap: 1px;
  min-height: 45px;
  padding: 5px 7px;
  border-right: 1px solid rgba(255,255,255,.10);
}
.v60r-mobile-readout > span:last-child { border-right: 0; }
.v60r-mobile-readout small {
  color: #98a9b6;
  font-size: 6px;
  font-weight: 950;
  letter-spacing: .12em;
}
.v60r-mobile-readout strong {
  max-width: 100%;
  overflow: hidden;
  color: #fff;
  font: 1000 13px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v60r-mobile-readout > span:first-child strong { color: var(--v60r-blue); font-size: 17px; }
.v60r-mobile-readout > span:nth-child(3) strong { color: var(--v60r-green); }

.v60r-mobile-actions {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}
.v60r-mobile-actions button {
  appearance: none;
  min-width: 48px;
  min-height: 46px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px;
  background: rgba(9,18,24,.86);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  font: 950 8px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .055em;
}
.v60r-mobile-actions [data-v60r-auto][aria-pressed="true"] { border-color: rgba(109,240,180,.72); color: #c9ffe7; background: rgba(19,73,56,.88); }
.v60r-mobile-actions [data-v60r-exit] { border-color: rgba(255,76,100,.56); color: #ffd4db; }
.v60r-mobile-actions button:active { transform: translateY(2px); filter: brightness(1.2); }

.v60r-mobile-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  display: block;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.11);
}
.v60r-mobile-progress b { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--v60r-red), var(--v60r-amber), var(--v60r-green), var(--v60r-blue)); transition: width .12s linear; }

.v58r-game.v60r-play-mode .v60r-mobile-controls {
  position: absolute;
  z-index: 85;
  left: max(7px, var(--v60r-safe-left));
  right: max(7px, var(--v60r-safe-right));
  bottom: max(8px, var(--v60r-safe-bottom));
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(5px, 1.5vw, 10px);
  width: auto;
  max-width: 760px;
  margin-inline: auto;
  pointer-events: none;
}

.v58r-game.v60r-play-mode[data-auto-throttle="true"] .v60r-mobile-controls {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.v58r-game.v60r-play-mode[data-auto-throttle="true"] [data-v60r-control="gas"] { display: none; }

.v60r-mobile-controls button {
  appearance: none;
  pointer-events: auto;
  display: flex;
  min-width: 0;
  min-height: clamp(62px, 15vw, 82px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid rgba(255,255,255,.23);
  border-radius: clamp(14px, 3.8vw, 22px);
  background: linear-gradient(155deg, rgba(34,51,62,.93), rgba(7,14,19,.92));
  color: #fff;
  box-shadow: 0 7px 0 rgba(0,0,0,.78), 0 12px 30px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.08);
  font: 1000 7px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .09em;
  text-transform: uppercase;
  transform: translateZ(0);
}
.v60r-mobile-controls button span { font-size: clamp(21px, 6vw, 31px); line-height: 1; }
.v60r-mobile-controls button small { font: inherit; }
.v60r-mobile-controls button.is-steer { border-color: rgba(117,221,255,.5); background: linear-gradient(155deg, rgba(25,76,99,.95), rgba(7,24,34,.94)); }
.v60r-mobile-controls [data-v60r-control="boost"] { border-color: rgba(255,224,107,.55); color: #fff2b6; }
.v60r-mobile-controls [data-v60r-control="brake"] { border-color: rgba(255,76,100,.48); color: #ffd9df; }
.v60r-mobile-controls button:active,
.v60r-mobile-controls button.is-held {
  transform: translateY(6px) scale(.985);
  border-color: #fff;
  background: linear-gradient(155deg, #3f735f, #122f26);
  box-shadow: 0 1px 0 rgba(0,0,0,.9), 0 6px 14px rgba(0,0,0,.34), inset 0 0 18px rgba(109,240,180,.12);
}

.v58r-game.v60r-play-mode .v58r-stage-chrome {
  top: calc(max(6px, var(--v60r-safe-top)) + 57px);
  left: max(8px, var(--v60r-safe-left));
  right: max(8px, var(--v60r-safe-right));
}
.v58r-game.v60r-play-mode .v58r-pace { top: calc(max(6px, var(--v60r-safe-top)) + 92px); left: max(8px, var(--v60r-safe-left)); }
.v58r-game.v60r-play-mode .v58r-stage-progress { bottom: calc(max(8px, var(--v60r-safe-bottom)) + clamp(76px, 17vw, 96px)); }

.v58r-game.v60r-play-mode .v58r-overlay {
  z-index: 70;
  padding: calc(max(66px, var(--v60r-safe-top) + 58px)) max(10px, var(--v60r-safe-right)) calc(max(92px, var(--v60r-safe-bottom) + 82px)) max(10px, var(--v60r-safe-left));
  overflow: auto;
  overscroll-behavior: contain;
}
.v58r-game.v60r-play-mode .v58r-overlay-card {
  width: min(650px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: clamp(18px, 4vw, 38px);
  border-radius: 20px;
}
.v58r-game.v60r-play-mode .v58r-overlay-card h4 { font-size: clamp(28px, 7vw, 58px); }
.v58r-game.v60r-play-mode .v58r-overlay-card p { font-size: clamp(12px, 2.8vw, 15px); }
.v58r-game.v60r-play-mode .v58r-overlay-card > button { min-height: 54px; font-size: 10px; }

.v58r-game.v60r-play-mode .v58r-help {
  z-index: 120;
  padding: max(10px, var(--v60r-safe-top)) max(10px, var(--v60r-safe-right)) max(10px, var(--v60r-safe-bottom)) max(10px, var(--v60r-safe-left));
}
.v58r-game.v60r-play-mode .v58r-help-card { max-height: calc(var(--v60r-vh, 100dvh) - max(20px, var(--v60r-safe-top) + var(--v60r-safe-bottom))); }

@media (orientation: portrait) and (max-width: 760px) {
  .v58r-game.v60r-play-mode .v60r-mobile-hud { grid-template-columns: minmax(0, 1fr) auto; }
  .v60r-mobile-actions [data-v60r-auto] { min-width: 58px; padding-inline: 7px; }
  .v60r-mobile-actions [data-v60r-pause] { display: none; }
  .v60r-mobile-actions button { min-width: 46px; }
  .v60r-mobile-readout > span { min-height: 43px; padding-inline: 4px; }
  .v60r-mobile-readout strong { font-size: 11px; }
  .v60r-mobile-readout > span:first-child strong { font-size: 15px; }
  .v58r-game.v60r-play-mode .v58r-stage-progress span { font-size: 5px; }
}

@media (orientation: landscape) and (max-height: 620px) {
  .v58r-game.v60r-play-mode .v60r-mobile-hud { grid-template-columns: minmax(300px, 580px) auto; right: auto; width: min(100% - max(14px, var(--v60r-safe-left) + var(--v60r-safe-right)), 790px); }
  .v60r-mobile-readout > span { min-height: 39px; }
  .v60r-mobile-actions button { min-height: 40px; }
  .v58r-game.v60r-play-mode .v60r-mobile-controls {
    left: max(10px, var(--v60r-safe-left));
    right: max(10px, var(--v60r-safe-right));
    bottom: max(6px, var(--v60r-safe-bottom));
    max-width: 700px;
    gap: 8px;
  }
  .v60r-mobile-controls button { min-height: clamp(54px, 15vh, 72px); border-radius: 15px; }
  .v60r-mobile-controls button span { font-size: clamp(20px, 6vh, 28px); }
  .v58r-game.v60r-play-mode .v58r-stage-chrome { top: calc(max(5px, var(--v60r-safe-top)) + 46px); }
  .v58r-game.v60r-play-mode .v58r-pace { top: calc(max(5px, var(--v60r-safe-top)) + 78px); transform: scale(.86); transform-origin: left top; }
  .v58r-game.v60r-play-mode .v58r-stage-progress { bottom: calc(max(6px, var(--v60r-safe-bottom)) + 69px); width: min(70%, 620px); }
  .v58r-game.v60r-play-mode .v58r-overlay { padding-top: calc(max(52px, var(--v60r-safe-top) + 43px)); padding-bottom: calc(max(78px, var(--v60r-safe-bottom) + 69px)); }
  .v58r-game.v60r-play-mode .v58r-overlay-card { padding: 16px 22px; }
  .v58r-game.v60r-play-mode .v58r-overlay-card h4 { margin-block: 5px; font-size: clamp(26px, 6vh, 43px); }
  .v58r-game.v60r-play-mode .v58r-overlay-card p { margin-block: 7px; font-size: 11px; }
  .v58r-game.v60r-play-mode .v58r-overlay-card > small { display: none; }
}

@media (max-height: 470px) and (orientation: landscape) {
  .v60r-mobile-actions [data-v60r-auto] { display: none; }
  .v58r-game.v60r-play-mode .v60r-mobile-hud { width: min(100% - 16px, 610px); }
  .v58r-game.v60r-play-mode .v58r-stage-progress { display: none; }
  .v58r-game.v60r-play-mode .v58r-pace { top: 48px; }
  .v60r-mobile-controls button { min-height: 54px; }
  .v58r-game.v60r-play-mode .v58r-overlay-card p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .v60r-mobile-progress b,
  .v60r-mobile-controls button,
  .v60r-mobile-actions button { transition: none !important; }
}

@media print {
  .v60r-mobile-hud,
  .v60r-mobile-controls,
  [data-v60r-phone] { display: none !important; }
}

/* Wide-but-short phone landscape: keep the direct route game-first even when emulation fails to expose pointer:coarse. */
@media (max-width: 1100px) and (max-height: 680px) {
  .v60r-direct-header { min-height: 52px; padding-block: max(7px, var(--v60r-safe-top)) 7px; }
  .v60r-direct-brand strong { font-size: 22px; }
  .v60r-direct-main { padding-inline: 0; }
  .v58r-game.v60r-direct-game { border-radius: 0; border-inline: 0; }
  .v58r-game.v60r-direct-game .v58r-marquee,
  .v58r-game.v60r-direct-game .v58r-boundary { display: none; }
  .v58r-game.v60r-direct-game .v58r-cabinet { min-height: 0; }
  .v58r-game.v60r-direct-game .v58r-stage-column { padding: 0; border-inline: 0; }
  .v58r-game.v60r-direct-game .v58r-stage { min-height: 0; border-radius: 0; border-inline: 0; }
  .v58r-game.v60r-direct-game .v58r-stage canvas {
    height: max(300px, calc(100dvh - 52px));
    min-height: 300px;
    max-height: 620px;
  }
  .v58r-game.v60r-direct-game .v58r-console { padding: 10px; }
  .v58r-game.v60r-hardened [data-v60r-phone] { display: inline-flex; align-items: center; justify-content: center; }
}
