/* Heat Line — the stage holds the canvas; menus are HTML laid over it. */
.hl-stage { position: relative; aspect-ratio: 3 / 4; background: var(--bg); overflow: hidden; box-shadow: 0 0 0 1px var(--line); touch-action: none; user-select: none; -webkit-user-select: none; }
.hl-stage canvas { display: block; width: 100%; height: 100%; outline: none; object-fit: contain; }   /* letterboxed when the stage is taller or wider than the game allows */
.hl-stage canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.hl-stage.is-max { position: fixed; inset: 0; z-index: 300; aspect-ratio: auto; width: 100vw; height: 100vh; height: 100dvh; }
.hl-stage:fullscreen { aspect-ratio: auto; width: 100%; height: 100%; }

.hl-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-6) var(--space-4) var(--space-12); text-align: center; overflow-y: auto;
  background: linear-gradient(180deg, rgba(12, 9, 10, .9), rgba(12, 9, 10, .78)); touch-action: auto; }
.hl-overlay[hidden] { display: none; }
/* centred when it fits, scrollable from the top when it does not */
.hl-overlay > :first-child { margin-top: auto; }
.hl-overlay > :last-child { margin-bottom: auto; }
.hl-eyebrow { color: var(--redline-text); }
.hl-title { font: 900 clamp(56px, 17vw, 120px)/.86 var(--font-display); text-transform: uppercase; letter-spacing: -.01em; }
.hl-title--sm { font-size: clamp(40px, 11vw, 72px); }
.hl-title em { font-style: normal; color: var(--redline-text); }
.hl-text { max-width: 34em; color: var(--ink-muted); font-size: 15px; line-height: 24px; }
.hl-text b { color: var(--ink); font-weight: 600; }
.hl-goal { display: grid; gap: var(--space-1); text-align: left; max-width: 34em; color: var(--ink-muted); font-size: 14px; line-height: 22px; }
.hl-goal li { position: relative; padding-left: var(--space-6); }
.hl-goal li::before { content: ""; position: absolute; left: 0; top: 10px; width: 8px; height: 2px; background: var(--redline); }

/* Leaderboard */
.hl-board { width: 100%; max-width: 420px; display: grid; gap: var(--space-2); }
.hl-board:empty { display: none; }
.hl-board__h { color: var(--ink-muted); }
.hl-top { display: grid; text-align: left; border-top: 1px solid var(--line); }
.hl-top li { display: grid; grid-template-columns: 28px 1fr auto; gap: var(--space-2); align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font: 500 14px/20px var(--font-mono); }
.hl-top__n { color: var(--ink-muted); }
.hl-top__who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-sans); font-weight: 600; }
.hl-top__who small { font-weight: 400; color: var(--ink-muted); margin-left: var(--space-2); }
.hl-top__s { color: var(--redline-text); }
.hl-top .is-me { background: var(--blush); box-shadow: -8px 0 0 var(--blush), 8px 0 0 var(--blush); }
.hl-save { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); text-align: left; }
.hl-save > p, .hl-save > button { grid-column: 1 / -1; }
.hl-save input { min-width: 0; min-height: 44px; padding: var(--space-2) var(--space-3); font: 400 16px/24px var(--font-sans); color: var(--ink); background: var(--surface-raised); border: 0; border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--line-strong); user-select: text; -webkit-user-select: text; }
.hl-save input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hl-save button { justify-content: center; }
.hl-save__msg { color: var(--redline-text); font-size: 14px; line-height: 20px; }
.hl-save__note { color: var(--ink-muted); font-size: 12px; line-height: 18px; text-align: center; }

.hl-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-6); color: var(--ink-muted); }
.hl-keys b { color: var(--ink); font-family: var(--font-mono); letter-spacing: 0; }
.hl-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-top: var(--space-2); }
.hl-best { color: var(--ink-muted); }
.hl-score { font: 600 clamp(48px, 13vw, 88px)/1 var(--font-mono); letter-spacing: -.03em; color: var(--redline-text); display: grid; gap: var(--space-1); }
.hl-score span { color: var(--ink-muted); letter-spacing: .14em; }

.hl-films { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); width: 100%; max-width: 760px; }
.hl-film { appearance: none; cursor: pointer; text-align: left; color: var(--ink); background: var(--surface); border: 0; box-shadow: inset 0 0 0 1px var(--line); padding: var(--space-3); display: grid; gap: 2px;
  --c: 16px; clip-path: polygon(0 0, calc(100% - var(--c)) 0, 100% var(--c), 100% 100%, 0 100%); transition: background .15s, box-shadow .15s; }
.hl-film:hover:not(:disabled) { background: var(--surface-raised); box-shadow: inset 0 0 0 1px var(--redline); }
.hl-film:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; clip-path: none; }
.hl-film:disabled { cursor: not-allowed; opacity: .45; }
.hl-film.is-owned { opacity: 1; background: var(--burgundy); box-shadow: none; }
.hl-film__name { font: 800 22px/1 var(--font-display); text-transform: uppercase; }
.hl-film__heat { font: 600 30px/1.1 var(--font-mono); letter-spacing: -.03em; color: var(--redline-text); }
.hl-film.is-owned .hl-film__heat { color: var(--on-redline); }
.hl-film__cap { color: var(--ink-muted); }
.hl-film.is-owned .hl-film__cap { color: var(--on-redline); opacity: .82; }
.hl-film__cost { margin-top: var(--space-2); }

.hl-tools { position: absolute; left: 0; right: 0; bottom: var(--space-2); display: flex; justify-content: center; gap: var(--space-2); pointer-events: none; }
.hl-tools button { pointer-events: auto; appearance: none; cursor: pointer; background: rgba(12, 9, 10, .7); color: var(--ink-muted); border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); padding: 6px var(--space-3); min-height: 32px; }
.hl-tools button:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* Menus that need the whole stage hide the sound / full-screen buttons. */
.hl-stage[data-mode="garage"] .hl-tools, .hl-stage[data-mode="over"] .hl-tools { display: none; }
.hl-stage[data-mode="garage"] .hl-overlay, .hl-stage[data-mode="over"] .hl-overlay { padding-bottom: var(--space-6); }
.hl-wide { display: none; }

.hl-how { display: grid; gap: var(--space-8); margin-top: var(--space-12); }
.hl-how h2 { font: 800 36px/1 var(--font-display); text-transform: uppercase; margin-bottom: var(--space-4); }

@media (max-width: 639px) {
  .hl-film__cap { display: none; }
  .hl-film__name { font-size: 19px; }
  .hl-film__heat { font-size: 24px; }
  .hl-film__cost { margin-top: 2px; }
  .hl-stage[data-mode="garage"] .hl-title { font-size: 40px; }
  .hl-stage[data-mode="title"] .hl-title { font-size: 52px; }
  /* the phone title screen has no room for the top-drivers list; it shows after a run */
  .hl-stage[data-mode="title"] .hl-board { display: none; }
  .hl-goal { font-size: 13px; line-height: 20px; }
  .hl-stage[data-mode="over"] .hl-title { font-size: 36px; }
  .hl-stage[data-mode="over"] .hl-score { font-size: 44px; }
  .hl-text { font-size: 14px; line-height: 22px; }
}
@media (min-width: 640px) {
  .hl-stage { aspect-ratio: 16 / 9; }
  .hl-wide { display: inline; }
  .hl-overlay { gap: var(--space-4); padding: var(--space-8) var(--space-8) var(--space-16); }
  .hl-films { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); }
  .hl-film { padding: var(--space-4); }
  .hl-text { font-size: 16px; line-height: 26px; }
}
/* Phones held sideways: little height, so the menus drop what is not essential. */
@media (max-height: 500px) and (orientation: landscape) {
  .hl-overlay { gap: var(--space-2); padding: var(--space-3) var(--space-6); }
  .hl-stage .hl-title, .hl-stage[data-mode] .hl-title { font-size: 40px; }
  .hl-goal, .hl-save__note, .hl-best, .hl-stage[data-mode="title"] .hl-board, .hl-stage[data-mode="over"] .hl-text, .hl-wide { display: none; }
  .hl-stage[data-mode="over"] .hl-score { font-size: 36px; }
  .hl-text { font-size: 14px; line-height: 20px; }
  .hl-save { grid-template-columns: 1fr 1fr auto; }
  .hl-save > button { grid-column: auto; }
  .hl-board { max-width: 560px; }
  .hl-top li { padding: 3px 0; }
  .hl-film { padding: var(--space-2) var(--space-3); }
  .hl-film__cap { display: none; }
  .hl-tools { justify-content: flex-end; right: var(--space-3); }
}
@media (min-width: 960px) {
  .hl-how { grid-template-columns: 1fr 1fr; gap: var(--space-16); }
}
/* title screen: the game's key art behind the menu */
.hl-stage[data-mode="title"] .hl-overlay { background: linear-gradient(90deg, rgba(12, 9, 10, .93) 0%, rgba(12, 9, 10, .8) 45%, rgba(12, 9, 10, .35) 100%), url("/images/vt/hl-title.webp") right center / cover no-repeat; }
