/* DrawPack: Road Hopper. Loaded after arcade.css, games-*.css and ui-sky.css.
   The stage reuses the cabinet of the canvas games (the shared stage in
   ui-sky.css, part 0) and adds its own pieces: the score and the coin count over the street, the ready card, the
   result card and the arrow buttons under the stage. Every rule is scoped to this game: an .rh- name, or something
   inside .rh.

   0 Shell bridge   1 Layout   2 Stage and score   3 Ready and paused   4 Result   5 Arrow buttons   6 Small screens */

/* ---------- 0. shell bridge: the few tokens this game was drawn with, mapped to the Night Arcade tokens (src/game.html).
   They are set on this game's page only. --gc is the game's colour: the first colour of its world. ---------- */
:root .view[data-view="roadhop"] { --gc: var(--g1); --hair: #ffffff14; --hair-2: #ffffff26; --dim: color-mix(in srgb, var(--muted) 80%, var(--bg));
  --r-2: var(--r-sm); --spring: var(--ease-pop); --t-2: var(--t-ui); --t-3: var(--t-panel); }

/* ---------- 1. layout ---------- */
.rh-stage { display: grid; grid-template-columns: minmax(0, 472px); justify-content: center; gap: 14px; }
.rh-main { display: grid; gap: 10px; min-width: 0; scroll-margin: 84px 0 20px; } /* a run scrolls the stage into view, clear of the bars */
.rh .rh-tc { display: none; } /* words for a keyboard, or words for a touch screen */
@media (hover: none), (pointer: coarse) { .rh .rh-kb { display: none; } .rh .rh-tc { display: revert; } }

/* ---------- 2. the stage: night streets under a bezel lit in the game colour ---------- */
.rh-cab { --rh-pad: 8px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gc) 26%, transparent), color-mix(in srgb, var(--gc) 6%, transparent) 22%, transparent 58%), #0a0d14; }
.rh-cab .cv { display: block; width: 100%; background: #07090d; transition: filter var(--t-3) var(--ease); }
.rh-cab[data-st="over"] .cv { filter: brightness(.5) saturate(.75); }
.rh-cab[data-st="pause"] .cv { filter: brightness(.55); }
.rh-hud { position: absolute; inset: var(--rh-pad) var(--rh-pad) auto; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 14px 0; pointer-events: none; transition: opacity var(--t-2) var(--ease); }
.rh-cab[data-st="ready"] .rh-hud, .rh-cab[data-st="over"] .rh-hud { opacity: 0; }
.rh-score { display: grid; justify-items: start; gap: 2px; }
.rh-score b { font-family: var(--font-display); font-weight: 800; font-size: 46px; line-height: .9; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: #fff; transform-origin: 0 60%;
  text-shadow: 0 2px 0 #000b, 0 0 24px color-mix(in srgb, var(--gc) 65%, transparent); }
.rh-score span { padding-left: 2px; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #ffffffc2; text-shadow: 0 1px 0 #000; }
.rh-purse { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 99px; font-family: var(--font-mono); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--gold);
  background: #05080cd6; border: 1px solid color-mix(in srgb, var(--coin) 36%, transparent); box-shadow: 0 10px 18px -12px #000; }
.rh-purse .coin { width: 18px; height: 18px; }

/* ---------- 3. ready and paused: the prompt and the controls sit above the robot, never on it ---------- */
.rh-ready { position: absolute; z-index: 1; left: 50%; bottom: calc(var(--rh-pad) + (100% - 2 * var(--rh-pad)) * 4 / var(--rh-rows, 12) + 12px); transform: translateX(-50%);
  width: min(100% - 36px, 330px); display: grid; gap: 10px; justify-items: center; pointer-events: none; }
.rh-ready[hidden], .rh-over[hidden] { display: none; }
.rh-go { padding: 11px 22px; border-radius: 99px; white-space: nowrap; font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -0.02em; color: #fff;
  background: #05080ce8; border: 1px solid color-mix(in srgb, var(--gc) 62%, transparent); box-shadow: 0 16px 34px -14px #000, 0 0 38px -8px var(--gc), inset 0 1px 0 #ffffff24; animation: rhBeat 1s var(--ease) infinite alternate; }
.rh-go.still { animation: none; }
@keyframes rhBeat { to { transform: scale(1.055); } }
.rh-note { margin: 0; padding: 6px 13px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--muted); background: #05080ce0; border: 1px solid var(--hair); }

/* ---------- 4. the result: one card over the dimmed street ---------- */
.rh-over { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(100% - 36px, 300px); display: grid; justify-items: center; gap: 2px; padding: 18px 16px 13px; text-align: center; border-radius: 22px;
  background: linear-gradient(180deg, #ffffff12, #ffffff05 40%, transparent), #080b11f5; border: 1px solid color-mix(in srgb, var(--gc) 40%, var(--hair)); box-shadow: 0 30px 60px -24px #000, 0 0 64px -22px var(--gc), inset 0 1px 0 #ffffff1c; animation: rhCard .38s var(--spring) both; }
@keyframes rhCard { from { opacity: 0; transform: translate(-50%, -44%) scale(.94); } }
.rh-why { font-size: 12.5px; font-weight: 700; color: color-mix(in srgb, var(--crimson) 82%, #fff); }
.rh-new { margin-top: 7px; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; color: #2a1800; background: var(--gold); animation: rhNew .7s var(--spring) .25s both; }
@keyframes rhNew { from { opacity: 0; transform: scale(.6); } }
.rh-big { margin-top: 5px; font-family: var(--font-display); font-weight: 800; font-size: 64px; line-height: 1; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; color: #fff; }
.rh-over.best .rh-big { color: var(--gold); text-shadow: 0 0 34px #ffb43d70; }
.rh-unit { font-size: 14px; font-weight: 600; color: var(--muted); }
.rh-sum { margin-top: 8px; font-size: 14px; color: var(--fg-2, #c8cde6); white-space: nowrap; }
.rh-sum b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--fg); }
.rh-sum b.g { color: var(--gold); }
.rh-over .rh-again { margin-top: 11px; padding: 12px; font-size: 17px; cursor: pointer; }

/* ---------- 5. the arrow buttons: left and right at the sides, forward over back in the middle ---------- */
.rh-pad { display: none; grid-template-columns: 1fr 1.2fr 1fr; grid-template-rows: 46px 44px; gap: 6px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
@media (max-width: 860px), (hover: none), (pointer: coarse) { .rh-pad { display: grid; } }
.rh-pad button { display: grid; place-items: center; min-width: 0; padding: 0; border-radius: 14px; color: var(--fg); cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent;
  border: 1px solid var(--line-2); background: linear-gradient(180deg, var(--panel-3), var(--panel-2)); box-shadow: inset 0 1px 0 #ffffff1a, var(--edge); }
.rh-pad svg { width: 24px; height: 24px; fill: currentColor; pointer-events: none; }
.rh-pad [data-d="left"] { grid-area: 1 / 1 / 3 / 2; } .rh-pad [data-d="left"] svg { transform: rotate(-90deg); }
.rh-pad [data-d="right"] { grid-area: 1 / 3 / 3 / 4; } .rh-pad [data-d="right"] svg { transform: rotate(90deg); }
.rh-pad [data-d="down"] { grid-area: 2 / 2; color: var(--muted); } .rh-pad [data-d="down"] svg { width: 20px; height: 20px; transform: rotate(180deg); }
.rh-pad [data-d="up"] { grid-area: 1 / 2; color: var(--g-ink); border-color: transparent; background: linear-gradient(135deg, var(--g1), color-mix(in srgb, var(--g1) 55%, var(--g2))); box-shadow: inset 0 1px 0 #ffffff80, var(--edge), 0 12px 22px -12px var(--gc); }
.rh-pad button.tap { animation: rhTap .16s var(--ease); }
@keyframes rhTap { 40% { transform: scale(.94); filter: brightness(1.3); } }


/* ---------- 6. small screens ---------- */
@media (max-width: 699px) {
  .rh-cab { --rh-pad: 6px; }
  .rh-main { scroll-margin: 76px 0 74px; } /* on a phone the menu bar covers the bottom of the screen */
  .rh-hud { padding: 9px 11px 0; }
  .rh-score b { font-size: 38px; }
  .rh-go { padding: 10px 18px; font-size: 17px; }
  .rh-ready { width: min(100% - 28px, 330px); gap: 8px; }
  .rh-over { width: min(100% - 28px, 300px); padding: 14px 13px 11px; border-radius: 18px; }
  .rh-big { font-size: 50px; }
  .rh-sum { margin-top: 9px; }
  .rh-over .rh-again { margin-top: 9px; padding: 11px; }
}
/* The light skin needs nothing here: the shell keeps every game page in its dark cabinet (.dk in arcade.css). */
/* a paused run: the prompt moves up so it does not cover the robot */
.rh-cab[data-st="pause"] .rh-ready { bottom: auto; top: calc(var(--rh-pad) + 84px); }
/* phones: room between the stage and the fixed bars when the page scrolls the stage into view */
@media (max-width: 699px) { .rh-main { scroll-margin: 76px 0 88px; } }

/* ---------- 6. Start sits on the board: in the garage rows under the robot, where no car drives. During a run the street is the
   control and the button is gone; after a run the result card on the street holds Play again ---------- */
.rh .rh-dock { position: absolute; z-index: 2; left: 50%; bottom: calc(var(--rh-pad) + (100% - 2 * var(--rh-pad)) * 1.5 / var(--rh-rows, 12)); transform: translate(-50%, 50%); width: min(100% - 36px, 330px); display: flex; justify-content: center; }
.rh .rh-dock #roadhop-go { flex: 1 1 auto; min-height: 54px; padding: 8px 22px; border-radius: 14px; font: 700 17px/1.15 var(--font-body); box-shadow: 0 10px 22px -10px #000d, inset 0 -3px 0 #0000002e; cursor: pointer; }
.rh .rh-cab:not([data-st="ready"]) .rh-dock, .rh .rh-dock:has(#roadhop-go:disabled) { display: none; }
.view[data-view="roadhop"] .ctrl:not(:has(.stat:not([hidden]))):not(:has(.gmsg:not(:empty))) { display: none; } /* nothing to set up: no empty panel */
@media (max-width: 699px) { .rh .rh-dock { width: min(100% - 28px, 330px); } .rh .rh-dock #roadhop-go { min-height: 48px; font-size: 16.5px; } }
