/* ---------- Abuja Hustle UI: one design system for loading, login, menus, HUD and touch controls ---------- */
:root {
  --fh: 'Oswald', 'Bahnschrift', 'Arial Narrow', Impact, sans-serif;
  --fb: 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;
  --bg: rgba(9, 13, 17, 0.72);
  --bg-solid: #0b1014;
  --bg-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.10);
  --txt: #f2f5f3;
  --mut: #9aa7a0;
  --green: #00a86b;
  --green-d: #007a4d;
  --lime: #8bea5b;
  --gold: #ffc94d;
  --red: #ff4d4f;
  --blue: #4fa3ff;
  --r: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --gap: 16px;
  --map-w: clamp(170px, 19vw, 250px);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --tshadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: #000; overflow: hidden; position: fixed; inset: 0;
  font-family: var(--fb); color: var(--txt);
  overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  -webkit-font-smoothing: antialiased;
}
canvas { display: block; position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; }
#hud { pointer-events: none; }
button { font-family: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.off { display: none !important; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; margin: 0 2px;
  border-radius: 6px; background: #f2f5f3; color: #0b1014; font: 700 12px/1 var(--fb); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); vertical-align: middle;
}
.flag { display: flex; width: 96px; height: 6px; border-radius: 3px; overflow: hidden; }
.flag i { flex: 1; } .flag i:nth-child(odd) { background: var(--green); } .flag i:nth-child(2) { background: #fff; }
.glass { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: var(--shadow); }

/* ---------- loading ---------- */
#loading {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px;
  background: radial-gradient(120% 90% at 50% 35%, #0f2a1d 0%, #070b09 60%, #000 100%); text-align: center;
}
#loading h1 { font: 700 clamp(44px, 11vw, 92px)/0.95 var(--fh); margin: 4px 0 0; letter-spacing: 0.02em; text-transform: uppercase; }
#loading h1 span { color: var(--lime); }
#loading .tag { color: var(--mut); font-size: 14px; margin: 0; }
.loadbar { width: min(320px, 70vw); height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: 18px; }
.loadbar i { display: block; width: 35%; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--green), var(--lime)); animation: load 1.3s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-110%); } 100% { transform: translateX(300%); } }
#loadmsg { font-size: 14px; color: var(--gold); min-height: 20px; }
#loading small { position: absolute; bottom: calc(14px + var(--sab)); color: #66736c; font-size: 11px; }

/* ---------- login / register / role (auth.js) ---------- */
#authScreen {
  position: fixed; inset: 0; z-index: 25; display: none; overflow-y: auto; padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal));
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.45)); touch-action: pan-y; -webkit-user-select: text; user-select: text;
}
.pd-card {
  margin: auto; width: min(400px, 100%); padding: 26px 26px 20px; border-radius: 20px;
  background: rgba(11, 16, 20, 0.88); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.pd-card.pd-wide { width: min(820px, 100%); }
.pd-card h1 { font: 700 40px/1 var(--fh); text-transform: uppercase; letter-spacing: 0.02em; margin: 12px 0 2px; }
.pd-card h1 span { color: var(--lime); }
.pd-sub { margin: 4px 0 18px; color: var(--mut); font-size: 14px; }
.pd-sub b { color: var(--txt); }
.pd-flag { display: flex; width: 96px; height: 6px; border-radius: 3px; overflow: hidden; } .pd-flag i { flex: 1; } .pd-flag i:nth-child(odd) { background: var(--green); } .pd-flag i:nth-child(2) { background: #fff; }
.pd-tabs { display: flex; padding: 4px; gap: 4px; margin-bottom: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.pd-tabs button { flex: 1; padding: 10px; border-radius: 9px; border: 0; background: transparent; color: var(--mut); font-weight: 600; font-size: 14px; cursor: pointer; }
.pd-tabs button.on { background: rgba(255, 255, 255, 0.1); color: var(--txt); }
.pd-card label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mut); margin: 14px 0 0; }
.pd-card label small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.pd-card input {
  width: 100%; margin-top: 6px; padding: 13px 14px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(0, 0, 0, 0.35);
  color: var(--txt); font: 16px var(--fb); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.pd-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.25); }
.pd-err { min-height: 20px; color: var(--red); font-size: 13px; margin-top: 10px; }
.pd-go { width: 100%; margin-top: 4px; padding: 14px; border: 0; border-radius: 12px; background: var(--green); color: #fff; font: 600 16px var(--fb); cursor: pointer; transition: background 0.15s, transform 0.1s; }
 .pd-go:active { transform: scale(0.98); }
.pd-link { display: block; margin: 12px auto 0; padding: 8px 12px; background: none; border: 0; color: var(--txt); opacity: 0.75; cursor: pointer; font-size: 14px; font-weight: 600; }
.pd-link:hover { opacity: 1; }
.pd-note { color: #6b7872; font-size: 12px; text-align: center; margin: 8px 0 0; }
.pd-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.pd-role {
  display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 16px; border-radius: 16px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04); color: var(--txt); cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.pd-role.sel { border-color: var(--green); background: rgba(0, 168, 107, 0.12); }
.pd-role:active { transform: scale(0.98); }
.pd-role b { font: 600 20px/1.1 var(--fh); text-transform: uppercase; letter-spacing: 0.02em; }
.pd-role small { color: var(--mut); line-height: 1.4; font-size: 13px; }
.pd-ico { font-size: 30px; }
.pd-row { display: flex; justify-content: center; }
@media (max-width: 560px) {
  .pd-card { padding: 22px 18px 16px; }
  .pd-card h1 { font-size: 34px; }
  .pd-roles { grid-template-columns: 1fr; gap: 8px; }
  .pd-role { display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; row-gap: 2px; padding: 12px 14px; }
  .pd-role .pd-ico { grid-row: span 2; font-size: 28px; align-self: center; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .pd-roles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .pd-role { display: grid; grid-template-columns: 36px 1fr; column-gap: 10px; padding: 10px 12px; }
  .pd-role .pd-ico { grid-row: span 2; font-size: 26px; align-self: center; }
  .pd-role small { font-size: 12px; }
  .pd-card { padding: 16px 20px 12px; } .pd-card h1 { font-size: 28px; margin-top: 6px; } .pd-sub { margin-bottom: 10px; }
  form.pd-card { width: min(560px, 100%); display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; align-items: end; }
  form.pd-card > * { grid-column: span 2; }
  form.pd-card > label { grid-column: span 1; margin-top: 8px; }
  form.pd-card .pd-flag, form.pd-card .pd-sub { display: none; }
  form.pd-card h1 { margin: 0 0 8px; }
  .pd-card input { padding: 10px 12px; }
  .pd-err { min-height: 14px; margin-top: 6px; }
  .pd-go { padding: 11px; }
  .pd-link { margin-top: 4px; }
}

/* ---------- shared screens (title, pause) and modals ---------- */
#ui { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#ui .screen, #ui .modal { pointer-events: auto; z-index: 3; }
#touch { z-index: 1; }
#hud-dom { z-index: 2; }
.screen { position: fixed; inset: 0; display: flex; }
.btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 18px; border-radius: 12px; border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06); color: var(--txt); font: 600 17px var(--fh); letter-spacing: 0.06em; text-transform: uppercase; text-align: left; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn.sel { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.14); }
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--green); border-color: var(--green); }
.btn.primary.sel { background: #00bf7a; border-color: #00bf7a; }
.btn.danger { background: rgba(255, 77, 79, 0.2); border-color: rgba(255, 77, 79, 0.5); }
.btn .chev { margin-left: auto; opacity: 0.5; font-size: 20px; line-height: 1; }
.btn svg { width: 20px; height: 20px; flex: none; }

#menu-title { align-items: stretch; background: linear-gradient(90deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0) 80%); }
.title-wrap {
  display: flex; flex-direction: column; justify-content: center; gap: 22px; width: min(460px, 100%); height: 100%;
  padding: calc(28px + var(--sat)) 24px calc(44px + var(--sab)) calc(max(24px, 6vw) + var(--sal)); overflow-y: auto; touch-action: pan-y;
}
.brand h1 { font: 700 clamp(52px, 8vw, 96px)/0.9 var(--fh); text-transform: uppercase; letter-spacing: 0.01em; margin: 12px 0 8px; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5); }
.brand h1 span { display: block; color: var(--lime); }
.brand p { margin: 0; color: #cfd8d3; font-size: 15px; line-height: 1.4; }
.who { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); }
.who .av { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 168, 107, 0.2); font-size: 22px; }
.who b { display: block; font-size: 15px; } .who small { color: var(--mut); font-size: 13px; }
.who button { margin-left: auto; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--txt); font-weight: 600; font-size: 13px; cursor: pointer; }
.who button:hover { background: rgba(255, 255, 255, 0.08); }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-hint { color: #7c8983; font-size: 12px; }
.title-foot { position: fixed; left: 0; right: 0; bottom: calc(10px + var(--sab)); text-align: center; color: #9aa59f; font-size: 11px; text-shadow: var(--tshadow); pointer-events: none; }

/* sub panels: settings / controls / stats */
.sub { display: flex; flex-direction: column; min-height: 0; padding: 18px; }
.sub-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sub-head h2 { margin: 0; font: 600 24px var(--fh); text-transform: uppercase; letter-spacing: 0.04em; }
.sub-head .back { margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--txt); cursor: pointer; font-size: 18px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.icon-btn svg { width: 20px; height: 20px; }
.sub-body { overflow-y: auto; min-height: 0; touch-action: pan-y; margin: 0 -6px; padding: 0 6px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.set-row:last-child { border-bottom: 0; }
.set-row .lbl { flex: 1; font-size: 15px; }
.set-row .lbl small { display: block; color: var(--mut); font-size: 12px; margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 4px; padding: 3px; border-radius: 11px; background: rgba(0, 0, 0, 0.3); }
.stepper button { width: 36px; height: 34px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.08); color: var(--txt); font-size: 18px; cursor: pointer; }
.stepper button:hover { background: rgba(255, 255, 255, 0.16); }
.stepper span { min-width: 74px; text-align: center; font-weight: 600; font-size: 14px; color: var(--gold); }
.toggle { position: relative; width: 50px; height: 30px; border-radius: 15px; border: 0; background: rgba(255, 255, 255, 0.15); cursor: pointer; transition: background 0.15s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.toggle.on { background: var(--green); } .toggle.on::after { transform: translateX(20px); }
.seg { display: flex; padding: 3px; border-radius: 11px; background: rgba(0, 0, 0, 0.3); }
.seg button { padding: 7px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--mut); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button.on { background: rgba(255, 255, 255, 0.14); color: var(--txt); }
.ctl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 24px; }
.ctl { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.ctl .k { flex: none; min-width: 92px; text-align: right; }
.ctl .k kbd { margin: 0 0 0 3px; }
.ctl .tico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.25); }
.ctl .tico svg { width: 18px; height: 18px; }
.stat-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 15px; }
.stat-row span:first-child { color: var(--mut); } .stat-row span:last-child { font-weight: 600; text-align: right; }
.title-sub { flex: 1; min-height: 0; max-height: 72vh; }

#menu-pause { align-items: center; justify-content: center; padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal)); background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pause-card { display: flex; flex-direction: column; width: min(760px, 100%); max-height: 100%; padding: 20px; gap: 14px; }
.pause-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pause-top h2 { margin: 0; font: 700 34px/1 var(--fh); text-transform: uppercase; letter-spacing: 0.03em; }
.pause-top h2 span { color: var(--lime); }
.pause-top .seg { margin-left: auto; }
.pause-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; touch-action: pan-y; padding-right: 4px; }
.pause-body .sub-body { overflow: visible; margin: 0; padding: 0; }
.sub-body { overflow-x: hidden; }
.pause-actions { display: flex; gap: 10px; }
.pause-actions .btn { justify-content: center; text-align: center; }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); background: rgba(0, 0, 0, 0.45); }
.modal-card { width: min(540px, 100%); max-height: 100%; display: flex; flex-direction: column; padding: 20px; gap: 12px; }
.modal-card h2 { margin: 0; font: 700 28px/1 var(--fh); text-transform: uppercase; letter-spacing: 0.03em; color: var(--gold); }
.modal-card .quote { margin: 0; color: var(--mut); font-style: italic; font-size: 14px; }
.modal-body { overflow-y: auto; min-height: 0; touch-action: pan-y; display: flex; flex-direction: column; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--txt); font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; }
.shop-item:hover { background: rgba(255, 255, 255, 0.1); }
.shop-item .price { margin-left: auto; color: var(--lime); }
.shop-item.poor { opacity: 0.5; } .shop-item.poor .price { color: var(--red); }
.need-bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.need { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); font-size: 12px; color: var(--mut); }
.need b { display: block; font-size: 18px; color: var(--txt); margin: 2px 0 6px; }
.need i { display: block; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.need i::after { content: ''; display: block; height: 100%; width: var(--v); background: var(--c); }
.prop-list { display: flex; flex-direction: column; }
.prop-list div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 14px; }
.prop-list div span:last-child { color: var(--lime); }
.muted { color: var(--mut); font-size: 13px; line-height: 1.5; }
.section-label { font: 600 13px var(--fh); text-transform: uppercase; letter-spacing: 0.1em; color: var(--lime); margin-top: 6px; }

/* ---------- in-game HUD ---------- */
#hud-dom { position: fixed; inset: 0; }
#hud-dom .t { text-shadow: var(--tshadow); }
.col-left { position: absolute; left: calc(var(--gap) + var(--sal)); top: calc(var(--gap) + var(--sat)); bottom: calc(var(--gap) + var(--sab)); width: var(--map-w); display: flex; flex-direction: column; gap: 10px; }
.map-block { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
#hud-map { width: 100%; aspect-ratio: 1 / 0.72; border-radius: 14px; border: 2px solid rgba(0, 0, 0, 0.55); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, var(--shadow); }
.vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.bar { position: relative; height: 7px; border-radius: 4px; background: rgba(0, 0, 0, 0.55); overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform-origin: left; border-radius: 4px; transition: transform 0.25s; }
.bar.hp i { background: linear-gradient(90deg, #3fb950, #6fdc6f); }
.bar.hp.low i { background: var(--red); animation: blink 0.5s steps(2) infinite; }
.bar.ar i { background: linear-gradient(90deg, #2f81f7, #79b8ff); }
.needs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.need-s { display: flex; flex-direction: column; gap: 3px; font: 600 9px var(--fb); letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.8); text-shadow: var(--tshadow); }
.need-s .bar { height: 4px; }
.need-s.warn { color: var(--red); animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.loc-left { display: none; font-size: 12px; font-weight: 600; line-height: 1.25; }
.loc-left small { display: block; color: #cfd8d3; font-weight: 500; }
#hud-loc { position: fixed; right: calc(var(--gap) + var(--sar)); bottom: calc(var(--gap) + var(--sab)); text-align: right; }
#hud-loc b { display: block; font: 600 20px/1.2 var(--fh); letter-spacing: 0.03em; text-transform: uppercase; }
#hud-loc small { font-size: 13px; color: #d5ddd8; font-weight: 600; }

.col-right { position: absolute; right: calc(var(--gap) + var(--sar)); top: calc(var(--gap) + var(--sat)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.clock { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; color: #e8eee9; }
.money { font: 700 34px/1 var(--fh); letter-spacing: 0.02em; color: #fff; }
.money-d { font: 700 20px/1 var(--fh); height: 0; overflow: visible; transition: opacity 0.4s; }
.money-d.up { color: var(--lime); } .money-d.down { color: var(--red); }
.wcard { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 14px; margin-top: 22px; min-width: 170px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.08); }
.wcard svg { width: 30px; height: 30px; opacity: 0.9; flex: none; }
.wcard .wn { font: 600 15px/1.1 var(--fh); letter-spacing: 0.05em; text-transform: uppercase; }
.wcard .wa { font-size: 13px; color: #bfc8c3; margin-top: 2px; }
.wcard .wa b { font: 700 17px var(--fh); color: var(--gold); }
.wcard .wa b.low { color: var(--red); }
.wcard .rl { position: relative; height: 3px; margin-top: 5px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.wcard .rl i { position: absolute; inset: 0; background: var(--gold); transform-origin: left; }
.stars { display: flex; gap: 3px; font-size: 22px; line-height: 1; }
.stars span { color: rgba(0, 0, 0, 0.5); -webkit-text-stroke: 1px rgba(255, 255, 255, 0.35); text-shadow: none; }
.stars span.on { color: var(--gold); -webkit-text-stroke: 1px rgba(0, 0, 0, 0.6); }
.stars.flash span.on { animation: blink 0.25s steps(2) infinite; }
.speedo { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.08); min-width: 170px; }
.speedo .kmh { font: 700 34px/0.9 var(--fh); min-width: 60px; text-align: right; }
.speedo .kmh small { display: block; font: 600 10px var(--fb); color: var(--mut); letter-spacing: 0.1em; }
.speedo .gear { font: 700 22px var(--fh); color: var(--lime); width: 22px; text-align: center; }
.speedo .gauges { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 70px; }
.speedo .g { font: 600 9px var(--fb); color: var(--mut); letter-spacing: 0.08em; }
.speedo .bar { height: 5px; }
.speedo .fuel i { background: #e6ece8; } .speedo .fuel.low i { background: var(--red); }
.speedo .chp i { background: #6fdc6f; } .speedo .chp.low i { background: #ff8a4d; }
.speedo .rpm i { background: var(--gold); } .speedo .rpm.red i { background: var(--red); }
.radio-line { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; background: currentColor; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; } .eq i:nth-child(3) { animation-delay: -0.6s; } .eq i:nth-child(4) { animation-delay: -0.15s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.inside { text-align: right; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.inside small { display: block; font-weight: 500; color: #cfd8d3; letter-spacing: 0; }

#hud-center { position: absolute; left: 50%; transform: translateX(-50%); top: calc(14px + var(--sat)); width: max(260px, min(560px, calc(100vw - 2 * var(--map-w) - 80px))); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.objective { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 9px 16px 9px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 15px; font-weight: 600; line-height: 1.3; }
.objective::before { content: ''; flex: none; width: 4px; align-self: stretch; border-radius: 2px; background: var(--gold); }
.objective.mission { color: var(--gold); } .objective.job { color: #7cc8ff; } .objective.job::before { background: #7cc8ff; }
.objective.hint { background: none; border: 0; padding: 2px 0; font-size: 13px; color: rgba(255, 211, 77, 0.9); } .objective.hint::before { display: none; }
.timer { font: 700 28px/1 var(--fh); letter-spacing: 0.04em; }
.timer.low { color: var(--red); }
.radio-pop { white-space: nowrap; max-width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 999px; font: 600 20px var(--fh); letter-spacing: 0.04em; text-transform: uppercase; transition: opacity 0.3s; }
.radio-pop .dot { width: 10px; height: 10px; border-radius: 50%; }
.radio-pop small { font: 500 12px var(--fb); color: var(--gold); text-transform: none; letter-spacing: 0; }

#hud-feed { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.card { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 14px; border-radius: 12px; background: rgba(8, 11, 14, 0.78); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 14px; line-height: 1.45; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); animation: cardIn 0.2s ease-out; }
.card.warn { border-color: rgba(255, 167, 38, 0.6); background: rgba(40, 24, 6, 0.85); }
.card.warn::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: #ffa726; }
.card .act { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
@keyframes cardIn { from { opacity: 0; transform: translateY(-4px); } }
.col-left #hud-feed { width: max(260px, min(400px, 30vw)); }

#hud-keys { display: flex; flex-direction: column; gap: 5px; width: max-content; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); font-size: 13px; }
#hud-keys div { display: flex; align-items: center; gap: 8px; }
#hud-keys kbd { min-width: 38px; }
#hud-keys .more { color: var(--mut); font-size: 11px; }

#hud-dialog { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(64px + var(--sab)); width: max(300px, min(820px, calc(100vw - 2 * var(--map-w) - 80px))); text-align: center; font-size: clamp(15px, 1.6vw, 20px); font-weight: 600; line-height: 1.35; text-shadow: 0 2px 3px #000, 0 0 16px rgba(0, 0, 0, 0.8); }
#hud-dialog b { color: var(--gold); } #hud-dialog b.hero { color: var(--lime); }
#hud-dialog .skip { display: block; margin-top: 6px; font-size: 11px; font-weight: 500; color: #c8d0cc; }
#hud-banner { position: absolute; left: 0; right: 0; top: 34%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 16px; text-align: center; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.6) 25%, rgba(0, 0, 0, 0.6) 75%, transparent); }
#hud-banner b { font: 700 clamp(44px, 8vw, 88px)/0.95 var(--fh); letter-spacing: 0.03em; text-transform: uppercase; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.6); }
#hud-banner span { font-size: clamp(14px, 1.8vw, 20px); font-weight: 600; max-width: 90vw; }
.firewarn { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); padding: 10px 18px; border-radius: 12px; background: rgba(120, 20, 0, 0.75); color: #fff; font: 700 20px var(--fh); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; animation: blink 0.6s steps(2) infinite; }

#hud-dom.mapview .col-right, #hud-dom.mapview #hud-center, #hud-dom.mapview .map-block, #hud-dom.mapview #hud-keys, #hud-dom.mapview #hud-loc, #hud-dom.mapview #hud-dialog { visibility: hidden; }
#hud-dom.mapview #hud-sys button:not([data-sys=map]) { visibility: hidden; }

/* ---------- touch controls ---------- */
#touch { position: fixed; inset: 0; display: none; }
body.touch #touch { display: block; }
body.touch #hud-keys, body.touch #hud-loc { display: none; }
#t-look, #t-stick-zone { position: absolute; pointer-events: auto; touch-action: none; }
#t-look { inset: 0; }
#t-stick-zone { left: 0; bottom: 0; width: 45%; height: 62%; }
#t-stick { position: absolute; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.28); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); opacity: 0.55; transition: opacity 0.15s; pointer-events: none; }
#t-stick.on { opacity: 1; }
#t-stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); }
#t-stick.sprint { border-color: var(--lime); } #t-stick.sprint i { background: var(--lime); }
.tb {
  position: absolute; display: grid; place-items: center; width: 58px; height: 58px; padding: 0; border-radius: 50%; pointer-events: auto; touch-action: none;
  background: rgba(12, 16, 20, 0.5); border: 1.5px solid rgba(255, 255, 255, 0.35); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font: 600 10px var(--fb); letter-spacing: 0.06em; transition: transform 0.08s, background 0.08s;
}
.tb svg { width: 26px; height: 26px; }
.tb.on, .tb.down { background: rgba(255, 255, 255, 0.85); color: #0b1014; transform: scale(0.94); }
.tb .lbl { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, 0.85); text-shadow: var(--tshadow); }
.tb.big { width: 84px; height: 84px; } .tb.big svg { width: 36px; height: 36px; }
.tb.sm { width: 48px; height: 48px; } .tb.sm svg { width: 22px; height: 22px; }
.tb.red { background: rgba(198, 40, 40, 0.55); border-color: rgba(255, 120, 120, 0.7); }
.tb.red.down { background: #ff5a5a; color: #fff; }
.tb.green { background: rgba(0, 168, 107, 0.55); border-color: rgba(120, 255, 190, 0.7); }
.tb.green.down { background: #00d488; color: #fff; }
.tb.pill { border-radius: 22px; }
.cluster { position: absolute; right: calc(18px + var(--sar)); bottom: calc(22px + var(--sab)); width: 230px; height: 230px; display: none; pointer-events: none; }
#touch[data-mode=foot] .cl-foot, #touch[data-mode=drive] .cl-drive, #touch[data-mode=mini] .cl-mini { display: block; }
#touch[data-mode=none] #t-stick-zone, #touch[data-mode=none] #t-look, #touch[data-mode=none] #t-action { display: none; }
#touch[data-mode=mini] #t-action { display: none; }
/* on foot: fire bottom-right, the rest on an arc around it */
.cl-foot .fire { right: 0; bottom: 0; }
.cl-foot .jump { right: 102px; bottom: 0; }
.cl-foot .aim { right: 4px; bottom: 104px; }
.cl-foot .reload { right: 92px; bottom: 82px; }
.cl-foot .weapon { right: 168px; bottom: 74px; }
/* driving: pedals on the right, handbrake + horn + exit around them */
.cl-drive .gas { right: 0; bottom: 0; width: 76px; height: 112px; border-radius: 22px; }
.cl-drive .brake { right: 90px; bottom: 0; width: 70px; height: 84px; border-radius: 20px; }
.cl-drive .hb { right: 90px; bottom: 100px; }
.cl-drive .exit { right: 10px; bottom: 132px; }
.cl-drive .horn { right: 166px; bottom: 112px; }
.cl-drive .dfire { right: 172px; bottom: 34px; }
.cl-mini .maction { right: 0; bottom: 0; }
.cl-mini .mexit { right: 104px; bottom: 6px; }
#t-action {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(16px + var(--sab)); max-width: min(300px, 36vw); display: flex; align-items: center; gap: 8px;
  padding: 11px 16px 11px 12px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, 0.5); background: rgba(0, 168, 107, 0.82); color: #fff;
  font: 600 14px var(--fb); pointer-events: auto; touch-action: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); animation: cardIn 0.2s ease-out;
}
#t-action span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#t-action .tap { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); flex: none; }
#t-action .tap svg { width: 16px; height: 16px; }
#t-action.down { background: #00d488; }
/* system row: menu, map, camera, radio, phone */
#hud-sys { display: none; gap: 6px; pointer-events: auto; }
body.touch #hud-sys { display: flex; }
#hud-sys button { flex: 1; display: grid; place-items: center; height: 36px; padding: 0; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(10, 14, 18, 0.6); color: #fff; touch-action: none; }
#hud-sys button svg { width: 19px; height: 19px; }
#hud-sys button.on, #hud-sys button:active { background: rgba(255, 255, 255, 0.85); color: #0b1014; }

/* touch: map + vitals top-left, status top-right, objective + prompts top-centre, dialog above the thumbs */
body.touch { --gap: 10px; --map-w: clamp(118px, 17vw, 168px); }
body.touch .col-left { bottom: auto; }
body.touch .map-block { margin-top: 0; order: -1; }
body.touch .loc-left { display: block; }
body.touch #hud-dom .card, body.touch #hud-dialog { pointer-events: auto; }
body.touch .card .act { cursor: pointer; padding: 6px 12px 6px 6px; margin: -2px 0; border-radius: 999px; background: rgba(0, 168, 107, 0.85); font-weight: 600; }
body.touch .card .act kbd { display: none; }
body.touch .card .act::before { content: ''; width: 18px; height: 18px; border-radius: 50%; background: rgba(255, 255, 255, 0.3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center/12px no-repeat; }
body.touch .money { font-size: 26px; }
body.touch .wcard { margin-top: 14px; min-width: 0; padding: 6px 10px; gap: 8px; }
body.touch .wcard svg { width: 24px; height: 24px; }
body.touch .wcard .wn { font-size: 13px; }
body.touch .stars { font-size: 18px; }
body.touch .speedo { min-width: 0; padding: 6px 10px; }
body.touch .speedo .kmh { font-size: 26px; min-width: 46px; }
body.touch .speedo .gauges { min-width: 60px; }
body.touch #hud-center { top: calc(10px + var(--sat)); width: min(460px, calc(100vw - 2 * var(--map-w) - 60px)); }
body.touch .objective { font-size: 13px; padding: 7px 12px 7px 10px; }
body.touch .card { font-size: 13px; padding: 8px 12px; }
body.touch #hud-dialog { bottom: calc(72px + var(--sab)); width: min(560px, calc(100vw - 480px)); min-width: 240px; font-size: 15px; }
body.touch #hud-banner b { font-size: clamp(36px, 9vw, 72px); }
@media (orientation: portrait) {
  body.touch { --map-w: clamp(116px, 34vw, 168px); }
  body.touch #hud-center { top: calc(var(--left-bottom, 230px) + 8px); width: calc(100vw - 20px); }
  body.touch .col-right { max-width: calc(100vw - var(--map-w) - 36px); }
  body.touch #hud-dialog { bottom: calc(300px + var(--sab)); width: calc(100vw - 32px); }
  body.touch #hud-banner { top: 30%; }
  #t-stick-zone { width: 50%; height: 46%; }
  body.touch .cluster { right: calc(12px + var(--sar)); bottom: calc(18px + var(--sab)); transform: scale(0.92); transform-origin: right bottom; }
  #t-action { left: auto; right: 12px; transform: none; bottom: calc(262px + var(--sab)); max-width: 70vw; }
}
@media (max-height: 430px) and (orientation: landscape) {
  body.touch .cluster { transform: scale(0.82); transform-origin: right bottom; bottom: calc(10px + var(--sab)); }
  body.touch .money { font-size: 22px; }
  body.touch .wcard { margin-top: 8px; }
  body.touch #hud-dialog { width: calc(100vw - 2 * var(--map-w) - 320px); min-width: 240px; font-size: 14px; }
}
@media (max-width: 380px) and (orientation: portrait) {
  body.touch .cluster { transform: scale(0.84); }
}

/* ---------- desktop title on small screens / portrait ---------- */
@media (orientation: portrait), (max-width: 700px) {
  #menu-title { background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.85) 55%); }
  .title-wrap { width: 100%; justify-content: flex-end; padding: calc(24px + var(--sat)) 20px calc(40px + var(--sab)); gap: 16px; }
  .brand h1 { font-size: clamp(48px, 15vw, 80px); }
}
@media (max-height: 520px) and (orientation: landscape) {
  .title-wrap { gap: 12px; padding-top: calc(16px + var(--sat)); padding-bottom: calc(30px + var(--sab)); width: min(420px, 100%); }
  .brand h1 { font-size: 46px; margin: 6px 0 4px; } .brand h1 span { display: inline; }
  .brand p { font-size: 13px; }
  .menu-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .menu-list .btn { padding: 11px 14px; font-size: 15px; }
  .menu-list .btn.wide { grid-column: span 2; }
  .menu-hint { display: none; }
  .pause-card { padding: 14px; gap: 10px; } .pause-top h2 { font-size: 26px; }
}
@media (max-width: 560px) {
  .pause-card { padding: 16px; } .pause-top h2 { font-size: 28px; } .pause-top .seg { margin-left: 0; width: 100%; } .pause-top .seg button { flex: 1; }
  .need-bars { gap: 6px; }
}

/* hover only where there is a real mouse (a tap must not leave buttons "stuck" highlighted) */
@media (hover: hover) {
  .btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.14); }
  .btn.primary:hover { background: #00bf7a; border-color: #00bf7a; }
  .pd-role:hover { border-color: var(--green); background: rgba(0, 168, 107, 0.12); }
  .pd-go:hover { background: #00bf7a; }
}