:root { --ink: #1e2633; --asph: #2b3442; --asph2: #1c2430; --org: #ff8a1f; --org2: #c9620a; --yel: #ffd23f; --cream: #fff7ea; --green: #2fae66; --red: #e5484d; --teal: #1fa3a8;
  font-size: clamp(11px, min(2.1vh, 1.5vw) + 4px, 24px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #a9c77a; font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; color: var(--ink);
  touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
canvas#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: 0; }
button:focus { outline: none; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* HUD */
#hud { position: fixed; left: 8px; top: 8px; right: 8px; pointer-events: none; z-index: 5; }
.row1 { display: flex; gap: 6px; align-items: stretch; margin-right: 9.2rem; flex-wrap: wrap; }
body.play-help .row1 { margin-right: 12.2rem; }
body.portrait #hud { top: calc(14px + 2.6rem); }
body.portrait .row1, body.portrait.play-help .row1 { margin-right: 0; }
.pill { background: var(--asph); color: #fff; border: 2px solid var(--org); border-radius: 9px; padding: 2px 9px 3px; box-shadow: 0 2px 0 rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: flex-start; min-width: 4.2rem; line-height: 1.05; }
.pill .lab, .meter .lab { font-size: .62rem; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.pill b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pill .u { font-size: .55rem; opacity: .7; }
.pill.warn { border-color: var(--red); background: #6b2328; }
.meters { background: var(--asph); border: 2px solid var(--org); border-radius: 9px; padding: 3px 8px; display: flex; flex-direction: column; justify-content: center; gap: 2px; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.meter { display: flex; align-items: center; gap: 6px; color: #fff; }
.meter .lab { width: 3.4rem; }
.meter i { display: block; width: 5.6rem; height: .5rem; background: rgba(255,255,255,.18); border-radius: 9px; overflow: hidden; }
.meter u { display: block; height: 100%; width: 100%; background: var(--green); border-radius: 9px; transition: width .2s; }
#mFuel u { background: #ffb21f; } #mDmg u { background: var(--red); } #mLoad u { background: #48b8f0; }
.meter.low .lab { color: #ff9a9a; }
#obj { margin-top: 6px; display: inline-block; background: rgba(255,247,234,.95); color: var(--ink); border: 2px solid var(--org); padding: 4px 11px; border-radius: 99px;
  font-size: .86rem; font-weight: 700; max-width: calc(100vw - 20px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 0 rgba(0,0,0,.2); }
#obj.pulse { animation: objp .6s ease-out; }
@keyframes objp { 0% { transform: scale(1.12); background: var(--yel); } 100% { transform: scale(1); } }
#btns { position: fixed; right: 8px; top: 8px; display: flex; gap: 6px; z-index: 30; }
.ib { width: 2.6rem; height: 2.6rem; min-width: 34px; min-height: 34px; border-radius: 10px; background: var(--asph); color: #fff; border: 2px solid var(--org);
  box-shadow: 0 2px 0 rgba(0,0,0,.25); display: grid; place-items: center; padding: 0; }
.ib svg { width: 62%; height: 62%; }
.ib.off { background: #6b7280; border-color: #c9ccd2; }
#banner { position: fixed; left: 50%; top: 36%; transform: translate(-50%, -50%); font-size: 3.2rem; font-weight: 900; color: var(--yel); z-index: 7; pointer-events: none;
  text-shadow: 0 3px 0 var(--ink), 0 0 10px rgba(0,0,0,.35); -webkit-text-stroke: 2px var(--ink); white-space: nowrap; }
#banner.pop { animation: pop .5s ease-out; }
#banner.small { font-size: 2rem; }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.4); } 60% { transform: translate(-50%, -50%) scale(1.15); } 100% { transform: translate(-50%, -50%) scale(1); } }

/* touch controls */
#touch { position: fixed; inset: auto 0 0 0; height: 0; z-index: 8; }
.tg { position: fixed; bottom: max(10px, env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: flex-end; }
.tg.left { left: 10px; } .tg.right { right: 10px; }
.tb { width: min(18vmin, 92px); height: min(18vmin, 92px); min-width: 58px; min-height: 58px; border-radius: 18px; background: rgba(43,52,66,.82); color: #fff;
  border: 3px solid rgba(255,255,255,.9); display: grid; place-items: center; font-weight: 900; font-size: .85rem; touch-action: none; text-align: center; line-height: 1; }
.tb small { font-size: .62rem; opacity: .9; }
.tb svg { width: 55%; height: 55%; }
.tb.gas { background: rgba(47,174,102,.88); height: min(24vmin, 118px); min-height: 72px; }
.tb.brake { background: rgba(229,72,77,.85); }
.tb.horn { width: min(12vmin, 60px); height: min(12vmin, 60px); min-width: 44px; min-height: 44px; border-radius: 50%; background: rgba(255,138,31,.85); }
.tb.on { transform: scale(.93); filter: brightness(1.25); }

/* overlay panels */
#ov { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; pointer-events: none; }
#ov.dim { background: rgba(20,26,36,.45); }
.panel { pointer-events: auto; position: absolute; left: 50%; top: 50%; width: 780px; height: 432px; transform-origin: 50% 50%;
  background: var(--asph); color: #fff; border: 4px solid var(--org); border-radius: 20px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  display: flex; flex-direction: column; gap: 7px; font-size: 16px;
  background-image: repeating-linear-gradient(90deg, transparent 0 34px, rgba(255,255,255,.06) 34px 58px); background-size: 100% 6px; background-repeat: no-repeat; background-position: 0 100%; }
.panel.small { width: 520px; height: 330px; }
body.portrait .panel { width: 370px; height: 700px; }
body.portrait .panel.small { width: 350px; height: 420px; }
.mhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hr { display: flex; align-items: center; gap: 8px; }
.hr .slot #btns { position: static; }
.logo h1 { margin: 0; font-size: 38px; line-height: 1; color: #fff; text-shadow: 0 3px 0 var(--org2); }
.logo .sub { font-size: 15px; color: var(--org); font-weight: 800; margin-top: 2px; letter-spacing: .03em; }
body.portrait .logo h1 { font-size: 30px; }
h2 { margin: 0; font-size: 28px; color: var(--yel); }
.starbox { background: var(--yel); color: var(--ink); border-radius: 12px; padding: 3px 11px; font-size: 21px; display: flex; gap: 6px; align-items: center; border: 3px solid #fff; font-weight: 800; }
.starbox .st { color: #e07800; }
.intro { margin: 0; font-size: 13.5px; line-height: 1.3; opacity: .95; }
.gsub { margin: 0; font-size: 14px; }
.tabs { display: flex; gap: 8px; }
.tab { background: var(--asph2); color: #fff; border: 2px solid #4a5568; padding: 5px 18px; border-radius: 10px; font-weight: 800; font-size: 16px; }
.tab.on { background: var(--org); border-color: #fff; color: var(--ink); }
.levels { display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: minmax(0, 1fr); gap: 7px; flex: 1; min-height: 0; }
.levels.parks { grid-template-columns: repeat(3, 1fr); }
body.portrait .levels { grid-template-columns: repeat(3, 1fr); }
body.portrait .levels:not(.parks) .lv .r { display: none; } /* 4 rows of missions on a phone: the route is shown in the countdown instead */
.lv { background: var(--cream); color: var(--ink); border-radius: 12px; border: 3px solid #fff; padding: 5px 6px; display: flex; flex-direction: column; text-align: left;
  gap: 1px; cursor: pointer; position: relative; box-shadow: 0 3px 0 rgba(0,0,0,.35); min-height: 0; overflow: hidden; }
.lv .n { position: absolute; right: 6px; top: 3px; font-size: 22px; font-weight: 900; color: rgba(30,38,51,.18); }
.lv b { font-size: 14px; line-height: 1.1; padding-right: 18px; }
.lv .r { font-size: 11px; line-height: 1.15; opacity: .78; }
.lv .c { font-size: 11px; font-weight: 700; color: var(--org2); }
.lv .s { font-size: 15px; letter-spacing: 1px; color: #c9c2b3; margin-top: auto; }
.lv .s .on { color: #f0a800; }
.lv.sel { outline: 4px solid var(--yel); }
.lv.lock { filter: grayscale(.8); opacity: .6; }
.lv.lock .s { font-size: 11px; color: var(--ink); }
.lv:active { transform: translateY(2px); }
.lv .reg { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.mfoot { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.big { background: var(--org); color: var(--ink); font-weight: 900; font-size: 23px; padding: 8px 32px; border-radius: 14px; border: 3px solid #fff; box-shadow: 0 4px 0 var(--org2); }
.big.alt { background: var(--yel); box-shadow: 0 4px 0 #b88f00; }
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--org2); }
.sec { background: #fff; color: var(--asph); font-weight: 800; font-size: 16px; padding: 8px 15px; border-radius: 12px; box-shadow: 0 3px 0 #8a94a3; display: inline-flex; align-items: center; gap: 7px; }
.gIcon { width: 18px; height: 14px; border: 3px solid currentColor; border-top-width: 6px; border-radius: 3px 3px 0 0; }
.keys { display: flex; gap: 10px; justify-content: center; font-size: 12px; opacity: .92; flex-wrap: wrap; max-width: 420px; }
kbd { display: inline-block; background: #fff; color: var(--ink); border-radius: 5px; padding: 0 5px; margin: 0 1px; font-family: inherit; font-weight: 800; box-shadow: 0 2px 0 #8a94a3; }
.touchhint { display: none; }
body.touch .touchhint { display: inline; }
body.touch .keys span:not(.touchhint) { display: none; }

/* garage */
.trucks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; flex: 1; min-height: 0; }
body.portrait .trucks { grid-template-columns: 1fr 1fr; }
.tk { background: var(--cream); color: var(--ink); border-radius: 12px; border: 3px solid #fff; padding: 6px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; min-height: 0; overflow: hidden; }
.tk canvas { width: 100%; flex: 1; min-height: 30px; object-fit: contain; }
.tk b { font-size: 16px; } .tk span { font-size: 11px; line-height: 1.15; opacity: .8; }
.tk .st { font-size: 12px; font-weight: 800; color: var(--org2); }
.tk.sel { outline: 4px solid var(--yel); }
.tk.lock { opacity: .55; filter: grayscale(.7); }
.paints { display: flex; align-items: center; gap: 8px; font-weight: 800; }
#paints { display: flex; gap: 7px; flex-wrap: wrap; }
.pt { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; }
.pt.sel { outline: 3px solid var(--yel); outline-offset: 2px; }

/* result */
.rstars { display: flex; justify-content: center; gap: 10px; font-size: 46px; line-height: 1; color: #59616e; }
.rstars .on { color: var(--yel); text-shadow: 0 3px 0 #b88f00; animation: pop2 .4s ease-out both; }
@keyframes pop2 { 0% { transform: scale(.2); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
#rLines { display: flex; flex-direction: column; gap: 4px; flex: 1; justify-content: center; font-size: 17px; }
#rLines div { display: flex; justify-content: space-between; background: rgba(255,255,255,.08); padding: 4px 12px; border-radius: 8px; }
#rLines .why { justify-content: center; color: var(--yel); font-weight: 800; background: none; text-align: center; }
