/* Pocket Jet: toy colours. Navy glass panels, sunny yellow, toy red (SPEC §2). */
:root {
  color-scheme: dark;
  --glass: rgba(20, 30, 70, .62);
  --glass-strong: rgba(18, 26, 60, .9);
  --edge: rgba(255, 255, 255, .18);
  --ink: #fffaf0;
  --dim: #c9d2f0;
  --sun: #ffd23f;
  --red: #ff4b3e;
  --plum: #2a2140;
  --display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", "Trebuchet MS", system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
}
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1430; color: var(--ink); font-family: var(--body); user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font: 800 11px var(--body); background: rgba(255, 255, 255, .16); border-radius: 4px; padding: 1px 5px; }
[hidden] { display: none !important; }
.panel { position: fixed; box-sizing: border-box; background: var(--glass); border: 2px solid var(--edge); border-radius: 18px; padding: 10px 14px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 8px 24px rgba(10, 10, 40, .35); }
.k { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.v { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.v small { font-size: 13px; color: var(--dim); margin-left: 3px; }

/* ---------- the HUD ---------- */
#panel { top: calc(14px + var(--st)); left: calc(14px + var(--sl)); max-width: 300px; }
#panel .name { font-family: var(--display); font-size: 28px; font-weight: 700; line-height: 1; margin: 3px 0 9px; }
#panel .row { display: flex; gap: 18px; margin-bottom: 9px; }
#panel .row .v { min-width: 2.6em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--sun); color: var(--plum); border: 0; border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 800; }
.chips button.off { background: rgba(255, 255, 255, .12); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }
#panel .help { font-size: 12px; line-height: 1.6; color: var(--dim); margin-top: 8px; }
#map-wrap { top: calc(14px + var(--st)); right: calc(14px + var(--sr)); padding: 8px; }
#map { display: block; width: 200px; height: 160px; }
#gauges { bottom: calc(14px + var(--sb)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 8px 18px 8px 8px; }
#zoom { display: block; width: 76px; height: 76px; }
#order { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
#order span { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .12); }
#order span.you { background: var(--red); }
#speedlines { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: repeating-conic-gradient(from 0deg at 50% 52%, rgba(255, 255, 255, 0) 0deg 5deg, rgba(255, 255, 255, .22) 5deg 5.6deg, rgba(255, 255, 255, 0) 5.6deg 11deg);
  -webkit-mask-image: radial-gradient(circle at 50% 52%, transparent 0 34%, #000 62%); mask-image: radial-gradient(circle at 50% 52%, transparent 0 34%, #000 62%); }
#speedlines.on { opacity: 1; }
#gauges .mach { font-family: var(--display); font-size: 14px; font-weight: 700; color: var(--sun); height: 16px; }
#pausebtn { display: none; top: calc(14px + var(--st)); left: 50%; transform: translateX(-50%); width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 14px; letter-spacing: -2px; }
body.carded #hud { opacity: .35; }
body.at-menu #hud { display: none; }
#arrow { position: fixed; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
#arrow i { position: absolute; left: -12px; top: -14px; border-left: 12px solid transparent; border-right: 12px solid transparent; border-bottom: 28px solid var(--sun);
  filter: drop-shadow(0 0 6px rgba(255, 210, 63, .8)); transform-origin: 12px 14px; }
#toast { position: fixed; top: 34%; left: 50%; transform: translate(-50%, 0) scale(.85); opacity: 0; font-family: var(--display); font-weight: 700; font-size: 40px;
  color: var(--ink); text-shadow: 0 4px 0 #c0392b, 0 0 24px rgba(255, 120, 60, .6); pointer-events: none; transition: opacity .18s, transform .18s; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- touch: a stick for the left thumb, buttons for the right ---------- */
#touch { display: none; }
body.touch #touch { display: block; }
body.touch #pausebtn { display: block; }
body.touch #panel .help { display: none; }
body.carded #touch { display: none; }
#stick { position: fixed; left: calc(22px + var(--sl)); bottom: calc(22px + var(--sb)); width: 136px; height: 136px; border-radius: 50%; background: rgba(20, 30, 70, .45);
  border: 2px solid var(--edge); touch-action: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: rgba(255, 250, 240, .85); box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
#t-buttons { position: fixed; right: calc(22px + var(--sr)); bottom: calc(22px + var(--sb)); display: flex; gap: 12px; align-items: flex-end; }
#t-buttons button { width: 74px; height: 74px; border-radius: 50%; background: rgba(20, 30, 70, .55); border: 2px solid var(--edge); font-size: 13px; font-weight: 800; line-height: 1.1; touch-action: none; }
#t-buttons button.on { background: var(--sun); color: var(--plum); }
#t-brake { width: 88px !important; height: 88px !important; }
#t-look { position: absolute; right: 104px; bottom: 100px; width: 62px !important; height: 62px !important; font-size: 11px !important; }   /* above Brake */
#t-zoom { width: 92px !important; height: 92px !important; background: rgba(255, 75, 62, .7) !important; font-family: var(--display); font-size: 16px !important; letter-spacing: .04em; }
body.touch #gauges { bottom: calc(176px + var(--sb)); }

/* ---------- cards: start and pause ---------- */
.card { position: fixed; inset: 0; display: flex; padding: max(16px, var(--st)) max(16px, var(--sr)) max(16px, var(--sb)) max(16px, var(--sl));
  background: radial-gradient(ellipse at center, rgba(20, 14, 48, .25), rgba(20, 14, 48, .65)); overflow-y: auto; }
.card-in { margin: auto; box-sizing: border-box; width: min(440px, 100%); background: var(--glass-strong); border: 2px solid var(--edge); border-radius: 24px; padding: 22px 24px;
  box-shadow: 0 18px 48px rgba(10, 10, 40, .5); display: flex; flex-direction: column; gap: 12px; }
.card h1 { font-family: var(--display); font-size: 40px; font-weight: 700; line-height: 1; margin: 0; color: var(--ink); text-wrap: balance; }
#menu h1 { font-size: 52px; color: var(--sun); text-shadow: 0 4px 0 #c0392b; }
.card p { margin: 0; font-size: 15px; line-height: 1.5; }
.card .hint { font-size: 13px; color: var(--dim); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting > span { font-weight: 800; font-size: 14px; }
.seg { display: inline-flex; background: rgba(255, 255, 255, .1); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 800; color: var(--dim); }
.seg button.on { background: var(--sun); color: var(--plum); }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.card button.primary, .buttons button { border: 0; border-radius: 999px; padding: 11px 22px; font-family: var(--display); font-size: 20px; font-weight: 600;
  background: rgba(255, 255, 255, .14); }
.card button.primary { background: var(--red); box-shadow: 0 4px 0 #a32a20; }
/* the menu's list of events */
.events-k { display: flex; justify-content: space-between; margin-top: 4px; }
.events-k .total { color: var(--sun); }
#events { display: flex; flex-direction: column; gap: 6px; }
.ev { display: flex; align-items: center; gap: 12px; text-align: left; background: rgba(255, 255, 255, .08); border: 2px solid transparent; border-radius: 16px; padding: 8px 12px; }
.ev:not(:disabled):hover { border-color: rgba(255, 255, 255, .3); }
.ev:disabled { opacity: .5; cursor: default; }
.ev .num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--sun); color: var(--plum); font-family: var(--display); font-weight: 700; font-size: 18px; }
.ev .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev .nm b { font-family: var(--display); font-weight: 600; font-size: 19px; }
.ev .nm small { color: var(--dim); font-size: 12.5px; line-height: 1.35; }
.ev .st { flex: none; font-size: 13px; font-weight: 800; color: var(--dim); }
.ev.free .num { background: var(--red); color: var(--ink); font-size: 16px; }
.st i { font-style: normal; color: rgba(255, 255, 255, .22); font-size: 17px; }
.st i.on { color: var(--sun); }
/* an event's card: its goals, a star count for each */
.goals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.goals li { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.goals .st { flex: none; width: 58px; }
/* results */
.big-stars { display: flex; gap: 10px; font-size: 54px; line-height: 1; }
.big-stars i { font-style: normal; color: rgba(255, 255, 255, .18); transform: scale(.8); transition: color .25s, transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.big-stars i.on { color: var(--sun); transform: scale(1); text-shadow: 0 4px 0 #c0392b; }
.new-best { color: var(--sun); font-family: var(--display); font-weight: 700; font-size: 20px !important; }
button:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
body.touch .keys-hint { display: none; }

@media (prefers-reduced-motion: reduce) { #toast, .big-stars i { transition: none; } #speedlines { display: none; } }
@media (max-width: 760px) {
  #panel { padding: 8px 11px; max-width: 220px; }
  #panel .name { font-size: 21px; margin-bottom: 7px; }
  #panel .help { display: none; }
  .v { font-size: 20px; }
  #map { width: 130px; height: 104px; }
  #gauges { gap: 12px; padding: 6px 12px 6px 6px; }
  #zoom { width: 58px; height: 58px; }
}
@media (max-height: 520px) {   /* a phone held sideways: compact panels */
  #panel { padding: 7px 11px; }
  #panel .name { font-size: 19px; margin: 2px 0 6px; }
  #panel .help { display: none; }
  .v { font-size: 19px; }
  #map { width: 120px; height: 96px; }
  #gauges { gap: 10px; padding: 5px 12px 5px 5px; }
  #zoom { width: 52px; height: 52px; }
  #order { display: none; }
  body.touch #gauges { bottom: calc(14px + var(--sb)); }
  #stick { width: 116px; height: 116px; }
  .card-in { padding: 16px 18px; gap: 9px; }
  .card h1 { font-size: 30px; }
  #menu h1 { font-size: 38px; }
  .ev { padding: 5px 10px; }
  .ev .nm small { display: none; }
}
