/* ConfigureX Ride (mini game) */
.ride { position: fixed; inset: 0; z-index: 9999; background: #120a24; font-family: system-ui, sans-serif; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; }
.ride[hidden] { display: none; }
body.ride-open { overflow: hidden; }
.ride-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ride-hud { position: absolute; top: 16px; left: 18px; right: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; }
.ride-score, .ride-best { display: grid; gap: 2px; padding: 10px 14px; border-radius: 14px; background: #120a24a8; backdrop-filter: blur(6px); border: 1px solid #ffffff1f; }
.ride-best { text-align: right; }
.ride-k { color: #ffb36b; font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.ride-score b, .ride-best b { font-family: var(--teko, sans-serif); font-size: 38px; line-height: .9; letter-spacing: .02em; }
.ride-sub { color: #d6c9ff; font-size: 11.5px; }
.ride-speed { display: flex; align-items: baseline; gap: 4px; padding: 6px 14px; border-radius: 14px; background: #120a24a8; border: 1px solid #ffffff1f; }
.ride-speed b { font-family: var(--teko, sans-serif); font-size: 46px; line-height: .9; }
.ride-speed span { color: #d6c9ff; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.ride-combo { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); font-family: var(--teko, sans-serif); font-size: 64px; color: #7dffb0; text-shadow: 0 4px 24px #00ff8866; pointer-events: none; transition: transform .15s; }
.ride-combo.hot { color: #ffe27a; text-shadow: 0 4px 30px #ffb000aa; transform: translateX(-50%) scale(1.15); }
.ride-pop { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); font-family: var(--teko, sans-serif); font-size: 72px; letter-spacing: .03em; color: #fff; text-shadow: 0 6px 30px #ff5f8f; opacity: 0; pointer-events: none; white-space: nowrap; }
.ride-pop.go { animation: ride-pop 1.4s ease-out; }
.ride-heat { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 12px; border: 2px solid #ffb020; border-radius: 12px; background: #2a0d06e6; color: #ffe0b0; font-weight: 700; font-size: 15px; letter-spacing: .02em; box-shadow: 0 0 24px #ff5a1488; pointer-events: none; animation: ride-heat-pulse .8s ease-in-out infinite alternate; }
.ride-heat[hidden] { display: none; }
.ride-heat-icon { font-size: 22px; color: #ffcc33; line-height: 1; }
@keyframes ride-heat-pulse { from { border-color: #ffb020; box-shadow: 0 0 14px #ff5a1466; } to { border-color: #ff3b1f; box-shadow: 0 0 30px #ff3b1fbb; } }
@media (prefers-reduced-motion: reduce) { .ride-heat { animation: none; } }
@keyframes ride-pop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }
.ride-meter { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: 220px; text-align: center; pointer-events: none; }
.ride-meter svg { width: 220px; height: 120px; overflow: visible; }
.ride-arc { fill: none; stroke: #ffffff2e; stroke-width: 14; stroke-linecap: round; }
.ride-arc-sweet { fill: none; stroke: #4dff9a; stroke-width: 14; }
.ride-arc-danger { fill: none; stroke: #ff4d6d; stroke-width: 14; }
.ride-meter line { stroke: #fff; stroke-width: 5; stroke-linecap: round; }
.ride-meter circle { fill: #fff; }
.ride-meter-label { margin-top: -6px; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; text-shadow: 0 2px 8px #000; }
.ride-panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); padding: 26px 26px 20px; border-radius: 22px; background: #160d2ce8; border: 1px solid #ffffff26; box-shadow: 0 30px 80px #0009; text-align: center; backdrop-filter: blur(10px); }
.ride-panel[hidden] { display: none; }
.ride-title { font-family: var(--teko, sans-serif); font-size: 48px; line-height: 1; background: linear-gradient(90deg, #ffe27a, #ff5f8f); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ride-panel p { margin: 12px 0 0; color: #e4dcff; font-size: 14px; line-height: 1.55; }
.ride-panel .g { color: #4dff9a; font-weight: 700; }
.ride-panel kbd { padding: 2px 8px; border-radius: 6px; background: #ffffff1f; border: 1px solid #ffffff33; font: inherit; font-weight: 800; }
.ride-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
.ride-stats span { padding: 6px 10px; border-radius: 99px; background: #ffffff14; color: #f3eeff; font-size: 12px; }
.ride-go { margin-top: 18px; width: 100%; padding: 14px; border: 0; border-radius: 14px; background: linear-gradient(90deg, #ff8a3d, #ff4f8b); color: #fff; font: inherit; font-size: 17px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; box-shadow: 0 10px 30px #ff4f8b55; }
.ride-small { font-size: 11.5px !important; color: #a99fd0 !important; }
.ride-exit { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 38px; height: 38px; border-radius: 50%; border: 1px solid #ffffff33; background: #120a24b0; color: #fff; font-size: 16px; cursor: pointer; }
.ride-touch { position: absolute; left: 0; right: 0; bottom: 16px; display: none; justify-content: space-between; padding: 0 16px; }
.ride-touch button { width: 34vw; max-width: 170px; height: 84px; border-radius: 20px; border: 2px solid #ffffff40; background: #120a24b8; color: #fff; font: inherit; font-size: 16px; font-weight: 900; letter-spacing: .1em; touch-action: none; }
.ride-touch #ride-gas { border-color: #4dff9a99; color: #4dff9a; }
.ride-touch #ride-brake { border-color: #ff4d6d99; color: #ff8aa0; }
.ride-touch button.down { transform: scale(.96); background: #ffffff22; }
@media (pointer: coarse), (max-width: 760px) {
  .ride-touch { display: flex; }
  .ride-meter { bottom: 112px; transform: translateX(-50%) scale(.8); }
  .ride-score b, .ride-best b { font-size: 28px; } .ride-speed b { font-size: 34px; }
  .ride-hud { top: 64px; } .ride-combo { top: 150px; font-size: 48px; } .ride-pop { font-size: 50px; }
  .ride-best { display: none; }
}
.lab-ride-btn svg { width: 15px; height: 15px; }
.ride-exit { top: auto; bottom: 18px; left: auto; right: 18px; transform: none; }
@media (pointer: coarse), (max-width: 760px) { .ride-exit { top: 12px; bottom: auto; right: 12px; } }
.ride-touch #ride-lean { width: 22vw; max-width: 110px; border-color: #ffd36b99; color: #ffd36b; }
.ride-arc-boost { fill: none; stroke: #b36bff; stroke-width: 14; filter: drop-shadow(0 0 6px #b36bff); }
.ride-panel .b { color: #c99bff; font-weight: 700; }
/* score + speed live in the angle meter */
.ride-pop { display: none; }
.ride-meter { width: 260px; bottom: 12px; }
.ride-meter-read { display: flex; justify-content: center; gap: 22px; margin-top: 4px; }
.ride-meter-read div { display: flex; align-items: baseline; gap: 4px; padding: 4px 12px; border-radius: 12px; background: #120a24b8; border: 1px solid #ffffff1f; }
.ride-meter-read b { font-family: var(--teko, sans-serif); font-size: 34px; line-height: .95; color: #fff; }
.ride-meter-read span { color: #d6c9ff; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.ride-meter-sub { margin-top: 3px; color: #d6c9ff; font-size: 11px; text-shadow: 0 1px 4px #000; }
@media (pointer: coarse), (max-width: 760px) { .ride-meter { bottom: 108px; } .ride-meter-read b { font-size: 26px; } }
.ride-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; margin-bottom: 10px; font-size: 12.5px; }
.ride-sound { position: absolute; bottom: 18px; right: 66px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid #ffffff33; background: #120a24b0; color: #fff; font-size: 16px; cursor: pointer; }
@media (pointer: coarse), (max-width: 760px) { .ride-sound { top: 12px; bottom: auto; right: 58px; } }

/* ---- chain, missions and level (the fun layer) ---- */
.ride-chain { position: absolute; top: 160px; left: 50%; transform: translateX(-50%); padding: 3px 12px 5px; border-radius: 99px; color: #7dffe0; font-family: var(--teko, sans-serif); font-size: 26px; letter-spacing: .04em; text-shadow: 0 2px 14px #00ffc880; pointer-events: none; white-space: nowrap;
  background: linear-gradient(90deg, #7dffe033 calc(var(--chain-left, 0) * 100%), transparent 0) no-repeat; }
.ride-chain:empty { display: none; }
.ride-missions { position: absolute; top: 16px; left: 18px; display: grid; gap: 6px; width: 250px; pointer-events: none; }
.ride-missions:empty { display: none; }
.rm { position: relative; display: flex; justify-content: space-between; gap: 8px; overflow: hidden; padding: 6px 10px 8px; border-radius: 10px; background: #120a24b8; border: 1px solid #ffffff1f; font-size: 12px; font-weight: 700; color: #e9e2ff; }
.rm i { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #ff8a3d, #ff4f8b); transition: width .25s ease; }
.rm .rm-n { color: #b9adff; font-variant-numeric: tabular-nums; }
.rm.done { border-color: #4dff9a88; color: #b6ffd0; animation: rm-done .6s ease-out; }
.rm.done i { background: #4dff9a; }
@keyframes rm-done { 0% { transform: scale(1.06); box-shadow: 0 0 24px #4dff9a99; } 100% { transform: none; box-shadow: none; } }
.ride-prog { margin-top: 16px; text-align: left; }
.rp-head { display: flex; align-items: baseline; gap: 10px; }
.rp-head b { font-family: var(--teko, sans-serif); font-size: 28px; line-height: 1; color: #ffe27a; }
.rp-gain { color: #7dffb0; font-size: 13px; font-weight: 800; }
.rp-xp { margin-left: auto; color: #b9adff; font-size: 12px; font-weight: 700; }
.rp-bar { height: 8px; margin-top: 6px; border-radius: 99px; background: #ffffff1a; overflow: hidden; }
.rp-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffe27a, #ff4f8b); }
.rp-done { display: grid; gap: 4px; margin-top: 10px; }
.rp-done span { color: #7dffb0; font-size: 12.5px; font-weight: 700; }
.rp-k { margin: 12px 0 6px; color: #ffb36b; font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.rp-list { display: grid; gap: 6px; }
.rp-list .rm { background: #ffffff10; }
@media (pointer: coarse), (max-width: 760px) {
  .ride-missions { top: 58px; left: 10px; width: 190px; gap: 4px; }
  .rm { padding: 4px 8px 6px; font-size: 10.5px; }
  .ride-chain { top: 200px; font-size: 20px; }
  .ride-panel { max-height: calc(100dvh - 24px); overflow-y: auto; }
}

/* ---- police chase ---- */
.ride-cops { position: absolute; top: 120px; right: 18px; display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 2px 10px; width: 170px; padding: 8px 12px 10px; border-radius: 12px; background: #120a24c4; border: 1px solid #ff3a4a66; pointer-events: none; animation: ride-cops-flash .5s steps(2) infinite; }
.ride-cops[hidden] { display: none; }
.ride-cops-k { color: #ff8a96; font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.ride-cops b { justify-self: end; font-family: var(--teko, sans-serif); font-size: 26px; line-height: .9; color: #fff; }
.ride-cops-bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: #ffffff1a; overflow: hidden; }
.ride-cops-bar i { display: block; height: 100%; background: linear-gradient(90deg, #3f8cff, #ff3a4a); transition: width .15s linear; }
.ride-cops.close { border-color: #ff3a4a; box-shadow: 0 0 24px #ff3a4a88; }
@keyframes ride-cops-flash { 0% { border-color: #ff3a4a99; } 100% { border-color: #3f8cff99; } }
@media (pointer: coarse), (max-width: 760px) { .ride-cops { top: 58px; right: 10px; width: 130px; padding: 6px 10px 8px; } .ride-cops b { font-size: 20px; } }
@media (prefers-reduced-motion: reduce) { .ride-cops { animation: none; } }
.ride-goal { color: #ffe9b0 !important; font-weight: 700; }
/* phones: the keyboard instructions don't apply, and the touch buttons wait until the ride starts */
@media (pointer: coarse), (max-width: 760px) {
  #ride-panel-text { display: none; }
  .ride:has(.ride-panel:not([hidden])) .ride-touch { display: none; }
  .ride-panel { padding: 20px 18px 16px; }
  .ride-title { font-size: 40px; }
}

/* ---- mode picker: Cops & Riders / Freeride ---- */
.ride-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.ride-modes .ride-go { margin-top: 0; display: grid; gap: 3px; padding: 12px 10px; text-align: center; }
.ride-mode b { font-size: 16px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.ride-mode span { font-size: 11px; font-weight: 600; opacity: .85; text-transform: none; letter-spacing: 0; }
#ride-free { background: linear-gradient(90deg, #2b5cff, #7a4dff); }
.ride-mode.is-last { outline: 2px solid #ffffffcc; outline-offset: 2px; }
.ride-panel.free-mode .ride-goal { display: none; }
.ride-cops-note { grid-column: 1 / -1; color: #d6c9ff; font-size: 10.5px; font-weight: 700; }
.ride-cops.slow { border-color: #ffb020; box-shadow: 0 0 24px #ffb02099; }
.ride-cops.slow .ride-cops-note { color: #ffcf5a; }
.ride-cops { width: 200px; }
@media (pointer: coarse), (max-width: 760px) { .ride-cops { width: 150px; } .ride-mode b { font-size: 14px; } }

/* ---- ride mode switch (Controller Lab modes) and warnings ---- */
.ride-mode-switch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid #ffffff26; border-radius: 12px; background: #120a24c4; backdrop-filter: blur(6px); }
.ride-mode-switch[hidden] { display: none; }
.ride-mode-switch button { min-width: 64px; height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: #cfc6f2; font: inherit; font-size: 12.5px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.ride-mode-switch button:hover { background: #ffffff14; color: #fff; }
.ride-mode-switch button.on { background: linear-gradient(180deg, #ff8a3d, #ff4f8b); color: #fff; box-shadow: 0 4px 14px #ff4f8b55; }
.ride-mode-k { padding: 0 6px 0 4px; color: #8f86b8; font-size: 10px; font-weight: 800; }
.ride-warn { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border: 1px solid #ffb020; border-radius: 99px; background: #2a1a08e0; color: #ffcf5a; font-size: 12px; font-weight: 800; letter-spacing: .04em; pointer-events: none; }
.ride-warn.info { border-color: #4dff9a88; background: #0f2a1ae0; color: #9dffc4; }
.ride-warn[hidden] { display: none; }
.ride-exit { z-index: 2; }
@media (pointer: coarse), (max-width: 760px) { .ride-mode-switch { top: 12px; } .ride-mode-switch button { min-width: 52px; height: 30px; font-size: 11px; } .ride-mode-k { display: none; } .ride-warn { top: 54px; } }

.ride-heat { top: 104px; }
.ride-scene-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; color: #cfc6f2; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ride-scene-pick select { flex: 1; max-width: 220px; height: 34px; padding: 0 10px; border: 1px solid #ffffff2e; border-radius: 9px; background: #1d1236; color: #fff; font: inherit; font-size: 13px; letter-spacing: 0; text-transform: none; }
/* rider gear + top runs */
.ride-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.ride-picks .ride-scene-pick select { max-width: 150px; }
.ride-board { margin-top: 12px; padding: 10px 12px; border: 1px solid #ffffff1f; border-radius: 10px; background: #ffffff08; }
.ride-board[hidden] { display: none; }
.ride-board-k { color: #cfc6f2; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ride-board ol { margin: 6px 0 0; padding-left: 22px; color: #fff; font-size: 12.5px; }
.ride-board li { padding: 2px 0; }
.ride-board li b { display: inline-block; min-width: 64px; font-variant-numeric: tabular-nums; }
.ride-board li span { color: #b9b0dc; font-size: 11.5px; }
.ride-board li.is-new b { color: #7dffb0; }
@media (max-width: 760px) { .ride-picks { grid-template-columns: 1fr; } }

/* iPhone: keep the pedals above the home bar and the buttons clear of the notch / status bar */
@media (pointer: coarse), (max-width: 760px) {
  .ride-touch { bottom: calc(16px + env(safe-area-inset-bottom)); padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .ride-exit, .ride-sound, .ride-mode-switch { top: calc(12px + env(safe-area-inset-top)); }
  .ride-exit { right: max(12px, env(safe-area-inset-right)); }
}
