:root {
  --ink: #4a3526; --paper: #fff8ea; --paper2: #f4e8cf; --line: #5b4230;
  --green: #6cbf4b; --green-d: #4c9a34; --red: #e5574b; --gold: #f2b830; --blue: #4aa3df;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Baloo 2", "Quicksand", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #a9dcf5; font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; filter: saturate(1.12) contrast(1.03); touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; }
.ic { display: block; flex: none; }
.th { display: block; flex: none; object-fit: contain; pointer-events: none; }
span[data-ic], #i-veh, #i-music, #i-view, #h-weather { display: inline-flex; }

/* tilt-shift: blur the far and near edges so the world reads as a miniature */
.tilt { position: fixed; left: 0; right: 0; height: 24vh; pointer-events: none; z-index: 1; -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
#blur-top { top: 0; -webkit-mask-image: linear-gradient(to bottom, #000, transparent); mask-image: linear-gradient(to bottom, #000, transparent); }
#blur-bot { bottom: 0; height: 18vh; -webkit-mask-image: linear-gradient(to top, #000, transparent); mask-image: linear-gradient(to top, #000, transparent); }
body.noblur .tilt, body.fp .tilt { display: none; }
body.fp .camctl { display: none; }

.card { background: var(--paper); border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 5px 0 rgba(74, 53, 38, .35); }
.card.big { padding: 22px; width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
#title-card { max-height: calc(100vh - 190px); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#hud > * { pointer-events: auto; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 3px solid var(--line); border-radius: 999px; padding: 5px 14px 5px 9px; box-shadow: 0 4px 0 rgba(74, 53, 38, .3); font-size: 15px; white-space: nowrap; }
.tl { position: absolute; top: 12px; left: 12px; display: flex; gap: 8px; flex-wrap: wrap; max-width: 44vw; }
.profile { padding-left: 5px; }
.profile div { display: flex; flex-direction: column; line-height: 1.1; }
.profile small { opacity: .7; font-size: 11px; }
#h-avatar svg { display: block; border-radius: 50%; border: 2px solid var(--line); }
.lvl { display: flex; flex-direction: column; gap: 3px; min-width: 66px; }
.lvl b { font-size: 11px; line-height: 1; }
.bar { height: 7px; background: #e6d7b9; border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 9px; transition: width .3s; }
.bar.en i { background: var(--green); }
.bar.en.low i { background: var(--red); }
.tc { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none !important; }
.zone { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: #fff; background: rgba(60, 42, 30, .7); border-radius: 99px; padding: 3px 11px; }
.tr { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.rbtn { width: 50px; height: 52px; border-radius: 16px; border: 3px solid var(--line); background: var(--paper); box-shadow: 0 4px 0 rgba(74, 53, 38, .3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; transition: transform .08s; }
.rbtn small { font-size: 9px; font-weight: 800; line-height: 1; }
.rbtn:hover { background: #fff; transform: translateY(-1px); }
.rbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(74, 53, 38, .3); }
.rbtn.sm { width: 40px; height: 40px; border-radius: 50%; }
#quest { position: absolute; top: 76px; right: 12px; width: 270px; padding: 10px 12px; font-size: 13px; line-height: 1.3; }
#quest .qh { display: flex; justify-content: space-between; align-items: center; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .75; margin-bottom: 4px; }
#quest .qh span { display: inline-flex; align-items: center; gap: 4px; }
#quest .bar { margin-top: 7px; }
#quest .bar i { background: var(--green); }
#quest small { display: block; margin-top: 3px; opacity: .7; font-size: 11px; }
.bl { position: absolute; left: 12px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; width: 172px; }
.mapcard { padding: 6px; }
#mini { width: 100%; aspect-ratio: 1; display: block; border-radius: 10px; image-rendering: pixelated; }
.legend { display: flex; justify-content: space-between; font-size: 10px; font-weight: 700; padding: 4px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 3px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.keys { padding: 8px 10px; font-size: 11px; line-height: 1.2; display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; }
kbd { background: var(--paper2); border: 2px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 0 5px; font-family: inherit; font-weight: 800; font-size: 10px; white-space: nowrap; text-align: center; }
.camctl { position: absolute; right: 12px; bottom: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bottom { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 7px; max-width: calc(100vw - 420px); pointer-events: none !important; }
.bottom > * { pointer-events: auto; }
#toolhelp { padding: 3px 12px; border-radius: 999px; background: rgba(60, 42, 30, .78); color: #fff; font-size: 12px; text-align: center; pointer-events: none; }
#toolhelp b { color: #ffd45e; }
#hotbar, #subbar { display: flex; gap: 6px; padding: 7px; background: var(--paper); border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 5px 0 rgba(74, 53, 38, .35); }
#subbar { max-width: min(900px, calc(100vw - 420px)); flex-wrap: wrap; justify-content: center; align-items: stretch; }
.tool { position: relative; width: 64px; height: 62px; border-radius: 14px; border: 2px solid transparent; background: var(--paper2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; flex: none; }
.tool .n { font-size: 11px; font-weight: 800; }
.tool .k { position: absolute; top: 3px; left: 5px; font-size: 9px; font-weight: 800; background: var(--line); color: #fff; border-radius: 5px; padding: 0 4px; }
.tool .c { position: absolute; top: 2px; right: 3px; font-size: 10px; font-weight: 800; background: var(--blue); color: #fff; border-radius: 8px; padding: 0 5px; }
.tool:hover { background: #fff; }
.tool.sel { border-color: var(--line); background: #ffe08a; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12); transform: translateY(-4px); }
.opt { flex: none; min-width: 78px; border-radius: 12px; border: 2px solid transparent; background: var(--paper2); padding: 4px 8px 5px; display: flex; flex-direction: column; align-items: center; font-size: 11px; font-weight: 800; gap: 1px; }
.opt small { font-weight: 700; opacity: .85; font-size: 10px; display: inline-flex; align-items: center; gap: 2px; }
.opt.sel { border-color: var(--line); background: #ffe08a; }
.opt.locked { opacity: .45; }
.opt.poor .cost { color: #b33a2e; }
.cost { display: inline-flex; align-items: center; gap: 5px; }
.cost span { display: inline-flex; align-items: center; gap: 1px; }
.subnote { padding: 8px 12px; font-size: 13px; }

#tip { position: fixed; z-index: 8; pointer-events: none; display: none; align-items: center; gap: 6px; background: rgba(48, 34, 24, .92); color: #fff; font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 10px; white-space: nowrap; transform: translate(16px, 18px); box-shadow: 0 3px 8px rgba(0, 0, 0, .25); }
#tip.show { display: flex; }
#tip.bad { background: rgba(170, 55, 45, .95); }
#tip.go { background: rgba(52, 110, 40, .95); }
#tip em { font-style: normal; display: inline-flex; align-items: center; gap: 1px; background: rgba(255, 255, 255, .18); border-radius: 6px; padding: 0 5px; font-size: 11px; }
#banner { position: fixed; top: 22%; left: 50%; transform: translateX(-50%); z-index: 7; pointer-events: none; display: flex; align-items: center; gap: 10px; font-size: 30px; font-weight: 900; color: #fff8ea; text-shadow: 0 3px 0 var(--line), 0 -2px 0 var(--line), 2px 0 0 var(--line), -2px 0 0 var(--line); opacity: 0; transition: opacity .6s; white-space: nowrap; }
#banner.show { opacity: 1; }
#banner .ic { filter: drop-shadow(0 2px 0 var(--line)); }

/* ---------- title / onboarding ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(255, 248, 234, .2), rgba(64, 110, 140, .5)); overflow: auto; padding: 16px; }
.title-wrap { display: flex; flex-direction: column; align-items: center; }
.logo { margin: 0; font-size: clamp(44px, 9vw, 84px); font-weight: 900; letter-spacing: -.02em; color: #fff8ea; text-shadow: 0 4px 0 var(--line), 0 -3px 0 var(--line), 3px 0 0 var(--line), -3px 0 0 var(--line), 3px 4px 0 var(--line), -3px 4px 0 var(--line), 0 9px 0 rgba(74, 53, 38, .35); }
.logo span { color: #ffd45e; }
.tag { margin: 6px 0 18px; font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(74, 53, 38, .7); text-align: center; }
h2 { margin: 0 0 12px; font-size: 22px; display: flex; align-items: center; gap: 8px; }
h2 small { font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; margin-left: auto; margin-right: 40px; }
h3 { margin: 16px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; opacity: .75; }
h3 small { text-transform: none; letter-spacing: 0; }
p { line-height: 1.45; }
.plist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 14px; background: var(--paper2); cursor: pointer; text-align: left; width: 100%; font-size: 15px; }
.prow:hover { background: #fff; }
.prow > svg { border-radius: 50%; border: 2px solid var(--line); flex: none; }
.prow .info { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.prow .info b { display: flex; align-items: center; gap: 5px; }
.prow .info small { opacity: .7; }
.prow .x { border: none; background: none; opacity: .5; padding: 6px; }
.prow .x:hover { opacity: 1; color: var(--red); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 3px solid var(--line); border-radius: 14px; background: var(--green); color: #fff; font-weight: 800; font-size: 16px; padding: 10px 18px; box-shadow: 0 4px 0 var(--green-d); text-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-d); }
.btn.alt { background: var(--paper2); color: var(--ink); box-shadow: 0 4px 0 #cdbb97; text-shadow: none; }
.btn.red { background: var(--red); box-shadow: 0 4px 0 #b33a2e; }
.btn.small { font-size: 13px; padding: 5px 11px; border-width: 2px; border-radius: 10px; box-shadow: 0 3px 0 var(--green-d); }
.btn.small.alt { box-shadow: 0 3px 0 #cdbb97; }
.btn:disabled { filter: grayscale(.9); opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 18px; }
.row.between { justify-content: space-between; }
label.f { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 13px; flex: 1; min-width: 150px; }
input[type=text], input[type=password] { font-family: inherit; font-size: 16px; padding: 9px 12px; border: 3px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); outline: none; width: 100%; user-select: text; -webkit-user-select: text; }
input:focus { border-color: var(--blue); }
.sw { display: flex; gap: 6px; flex-wrap: wrap; }
.sw button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgba(74, 53, 38, .35); padding: 0; }
.sw button.sel { border-color: var(--line); transform: scale(1.15); box-shadow: 0 0 0 3px #ffd45e; }
.favs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fav { border: 2px solid rgba(74, 53, 38, .35); border-radius: 12px; background: var(--paper2); padding: 8px 10px; text-align: left; font-size: 14px; font-weight: 800; display: grid; grid-template-columns: auto 1fr; gap: 0 8px; align-items: center; }
.fav .ic { grid-row: span 2; }
.fav small { font-weight: 600; opacity: .75; font-size: 11px; }
.fav.sel { border-color: var(--line); background: #ffe08a; }
.look { display: flex; gap: 16px; align-items: center; }
.look .pv svg { border-radius: 50%; border: 3px solid var(--line); display: block; }
.look .pick { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.look .pick > div { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; }
.look .pick > div > span { width: 38px; }
.note { font-size: 12px; opacity: .72; margin: 10px 0 0; line-height: 1.4; }
.err { color: #b33a2e; font-weight: 700; font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(48, 34, 24, .45); padding: 16px; }
#modal-card { position: relative; }
.mx { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); background: var(--paper2); padding: 0; display: grid; place-items: center; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { border: 2px solid var(--line); background: var(--paper2); border-radius: 10px; padding: 6px 14px; font-weight: 800; font-size: 14px; }
.tabs button.sel { background: #ffe08a; }
.list { display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 6px; background: var(--paper2); border-radius: 12px; font-size: 14px; }
.item .info { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.item .info small { opacity: .7; font-size: 11px; }
.item.locked { opacity: .5; }
.price { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; min-width: 52px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cell { background: var(--paper2); border-radius: 12px; padding: 6px 4px 8px; text-align: center; font-size: 11px; font-weight: 800; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cell .q { position: absolute; top: 4px; right: 6px; background: var(--line); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; }
.cell .btn { margin-top: 2px; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 2px dashed rgba(74, 53, 38, .15); font-size: 15px; font-weight: 700; }
.set small { display: block; font-weight: 600; opacity: .65; font-size: 11px; }
.help { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; font-size: 14px; align-items: center; }
.help .ti { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; background: var(--paper2); border-radius: 8px; padding: 3px 8px; }
.help kbd { font-size: 12px; padding: 1px 7px; }
.steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.55; }
.meter { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; margin-bottom: 12px; }
.meter .bar { flex: 1; height: 10px; }

#fade { position: fixed; inset: 0; background: #10162b; opacity: 0; pointer-events: none; transition: opacity .7s; z-index: 60; }
#fade.on { opacity: 1; pointer-events: auto; }
#toasts { position: fixed; top: 110px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 7px; background: var(--paper); border: 3px solid var(--line); border-radius: 14px; padding: 7px 14px; font-weight: 700; font-size: 14px; box-shadow: 0 4px 0 rgba(74, 53, 38, .3); animation: pop .25s ease-out, out .4s 3.2s forwards; }
.toast.good { background: #dff5c9; }
.toast.bad { background: #ffd9d2; }
@keyframes pop { from { transform: translateY(-10px) scale(.9); opacity: 0; } }
@keyframes out { to { opacity: 0; transform: translateY(-8px); } }
#floats { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.float { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 2px; font-weight: 900; font-size: 19px; color: #fff; text-shadow: 0 2px 0 var(--line), 0 -1px 0 var(--line), 1px 0 0 var(--line), -1px 0 0 var(--line); animation: rise 1.3s ease-out forwards; white-space: nowrap; }
.float img { filter: drop-shadow(0 2px 0 rgba(74, 53, 38, .6)); }
@keyframes rise { to { transform: translate(-50%, -90px); opacity: 0; } }

@media (max-width: 900px) {
  .bl .keys { display: none; } .bl { width: 120px; bottom: 96px; }
  #quest { width: 200px; font-size: 12px; }
  .bottom { max-width: calc(100vw - 12px); bottom: 8px; } #subbar { max-width: calc(100vw - 12px); }
  .tool { width: 46px; height: 52px; } .tool .n { font-size: 9px; } .tool .k { display: none; }
  .camctl { bottom: 96px; right: 8px; }
  #hotbar { gap: 3px; padding: 5px; }
  .profile div, .rbtn small { display: none; } .rbtn { width: 42px; height: 42px; }
  #toolhelp { display: none; }
}

#prompt { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 8; pointer-events: none; display: none; align-items: center; gap: 8px; background: rgba(48, 34, 24, .92); color: #fff; font-size: 15px; font-weight: 800; padding: 8px 16px; border-radius: 14px; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); white-space: nowrap; }
#prompt.show { display: flex; }
#prompt kbd { color: var(--ink); font-size: 13px; padding: 1px 8px; }
#quest small.job { display: flex; align-items: center; gap: 4px; margin-top: 7px; padding-top: 6px; border-top: 2px dashed rgba(74, 53, 38, .2); opacity: 1; font-weight: 800; color: #7a35a6; }

/* trailer mode: nothing but the film */
body.promo #hud, body.promo #title, body.promo #tip, body.promo #toasts, body.promo #banner, body.promo #prompt, body.promo #floats, body.promo .tilt, body.promo #modal { display: none !important; }
body.promo canvas#c { visibility: hidden; }
#film { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; z-index: 90; }
#film-ui { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 95; display: flex; gap: 10px; align-items: center; color: #fff; font-weight: 800; font-size: 14px; text-shadow: 0 1px 3px #000; }

/* ---------- missions, wanted level, dialogue, banners, map ---------- */
#stars { position: absolute; top: 74px; left: 12px; display: flex; align-items: center; gap: 2px; background: rgba(30, 22, 16, .78); border-radius: 999px; padding: 4px 12px 4px 8px; color: #fff; pointer-events: none !important; }
#stars span { display: inline-flex; color: #6b6158; }
#stars span .ic path { fill: #4a4038; stroke: #2a221c; }
#stars span.on .ic path { fill: #ffd54a; stroke: #8a5a14; }
#stars small { margin-left: 6px; font-weight: 800; font-size: 12px; }
#stars.lost span.on { animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
#mhud { position: absolute; top: 108px; left: 50%; transform: translateX(-50%); min-width: 300px; max-width: 420px; padding: 9px 14px 10px; text-align: center; }
#mhud .mt { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: #a8741a; }
#mhud .mo { font-weight: 800; font-size: 15px; margin: 4px 0 2px; }
#mhud .mtime { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
#mhud .mtime.low { color: #d9382c; animation: blink .6s steps(2) infinite; }
#mhud .mx2 { font-size: 12px; font-weight: 700; opacity: .8; margin-bottom: 4px; }
#mhud .btn { margin-top: 4px; }
#wpchip { position: absolute; top: 104px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; background: rgba(40, 90, 40, .88); color: #fff; border-radius: 999px; padding: 4px 12px 4px 6px; font-size: 13px; pointer-events: none !important; }
#wpchip .arr { display: inline-flex; transform-origin: 50% 50%; }
#wpchip .arr .ic { transform: rotate(-90deg); }
#say { position: fixed; left: 50%; bottom: 178px; transform: translateX(-50%) translateY(10px); z-index: 9; max-width: min(560px, calc(100vw - 32px)); background: var(--paper); border: 3px solid var(--line); border-radius: 16px; padding: 8px 14px; box-shadow: 0 5px 0 rgba(74, 53, 38, .3); display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; font-size: 15px; }
#say.show { opacity: 1; transform: translateX(-50%); }
#say b { font-size: 12px; color: #a8741a; text-transform: uppercase; letter-spacing: .05em; }
#bigban { position: fixed; left: 0; right: 0; top: 30%; z-index: 80; text-align: center; pointer-events: none; opacity: 0; transform: scale(.9); transition: opacity .3s, transform .3s; }
#bigban.show { opacity: 1; transform: none; }
#bigban .bt { font-size: clamp(36px, 6vw, 72px); font-weight: 900; letter-spacing: .04em; color: #fff8ea; text-shadow: 0 4px 0 var(--line), 0 -3px 0 var(--line), 3px 0 0 var(--line), -3px 0 0 var(--line), 0 10px 24px rgba(0, 0, 0, .35); }
#bigban .bs { display: inline-block; margin-top: 8px; font-size: 17px; font-weight: 800; color: #fff; background: rgba(30, 22, 16, .75); border-radius: 12px; padding: 6px 14px; max-width: 80vw; }
#bigban.pass .bt { color: #ffd45e; }
#bigban.fail .bt { color: #ff7a6a; }
#bigban.good .bt { color: #9ff07a; }
#bigban.title .bt { font-size: clamp(28px, 4vw, 46px); }
#bigban.count .bt { font-size: clamp(80px, 12vw, 150px); color: #ffd45e; }
#lbox-t, #lbox-b { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 30; transition: height .35s; pointer-events: none; }
#lbox-t { top: 0; } #lbox-b { bottom: 0; }
body.talking #lbox-t, body.talking #lbox-b { height: 9vh; }
body.talking #hud .bottom, body.talking #hud .bl, body.talking #hud .camctl { opacity: 0; pointer-events: none !important; }
#dlg { position: fixed; left: 50%; bottom: calc(9vh + 16px); transform: translateX(-50%); z-index: 45; width: min(760px, calc(100vw - 32px)); display: flex; gap: 14px; align-items: flex-start; background: var(--paper); border: 3px solid var(--line); border-radius: 18px; padding: 14px 16px; box-shadow: 0 6px 0 rgba(74, 53, 38, .35); }
#dlg .dp svg { border-radius: 14px; border: 3px solid var(--line); display: block; }
#dlg .dbody { flex: 1; min-width: 0; }
#dlg .dn { font-weight: 900; font-size: 17px; }
#dlg .dn small { font-weight: 700; font-size: 12px; opacity: .65; margin-left: 4px; }
#dlg .dt { font-size: 16px; line-height: 1.45; margin: 6px 0 10px; min-height: 46px; cursor: pointer; }
#dlg .dt.type { animation: typein .45s steps(30) both; }
@keyframes typein { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
#dlg .dc { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
#dlg kbd { font-size: 10px; padding: 0 4px; color: var(--ink); }
#bigmap { width: min(640px, calc(100vw - 80px)); aspect-ratio: 1; display: block; border-radius: 12px; border: 3px solid var(--line); cursor: crosshair; image-rendering: pixelated; }
#modal-card:has(#bigmap) { width: min(700px, calc(100vw - 32px)); }
.legend.big { font-size: 12px; flex-wrap: wrap; gap: 10px; justify-content: flex-start; padding: 8px 0 0; }
.legend.big i { width: 11px; height: 11px; }

/* mouse look: a small aiming dot in the middle of the screen while the cursor is captured */
body.mlook #hud::after { content: ''; position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 1.5px rgba(40, 30, 20, .55); pointer-events: none; z-index: 5; }
body.mlook #cursorTip, body.mlook .ctip { display: none !important; }
/* frame-rate counter (Menu → Show frame rate) */
#fps { position: fixed; right: 10px; bottom: 10px; z-index: 60; font: 600 12px/1 system-ui, sans-serif; color: #fff; background: rgba(30, 24, 18, .6);
  padding: 4px 7px; border-radius: 6px; pointer-events: none; }

/* speedometer + turbo meter (driving) */
#speedo { position: fixed; right: 22px; bottom: 132px; z-index: 40; display: none; min-width: 150px; padding: 10px 14px 10px; border-radius: 16px;
  background: rgba(28, 22, 16, .72); color: #fff; font-family: inherit; text-align: right; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
#speedo.on { display: block; }
#speedo b { font-size: 40px; line-height: 1; font-weight: 800; letter-spacing: -1px; }
#speedo small { margin-left: 5px; font-size: 13px; opacity: .8; }
#speedo i { display: block; height: 7px; margin-top: 8px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
#speedo u { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #3fb6ff, #8ef0ff); transition: width .12s linear; }
#speedo.boost u { background: linear-gradient(90deg, #ff8a2a, #ffd34d); }
#speedo.boost b { color: #ffd34d; }
#speedo em { display: block; margin-top: 6px; font-size: 11px; font-style: normal; opacity: .7; }

/* navigation chip: green for a waypoint, gold for a mission objective */
#wpchip.mission { background: rgba(150, 105, 10, .9); }
#wpchip small { margin-left: 4px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; opacity: .92; }
/* big map: mission list */
.mlist { margin-top: 10px; display: grid; gap: 6px; }
.mlist h4 { margin: 4px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.mrow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; text-align: left; padding: 8px 12px; border-radius: 12px;
  border: 2px solid rgba(74, 53, 38, .25); background: rgba(255, 255, 255, .55); font: inherit; color: inherit; cursor: pointer; }
.mrow b { grid-column: 1; } .mrow small { grid-column: 1; opacity: .75; } .mrow span { grid-column: 2; grid-row: 1 / span 2; font-weight: 700; color: #5a8a2a; display: inline-flex; align-items: center; gap: 4px; }
button.mrow:hover { background: #fff; border-color: #d9a21e; }
.mrow.cur { cursor: default; border-color: #d9a21e; background: rgba(255, 236, 170, .6); }
/* big map: map and mission list side by side on wide screens, and never taller than the window */
#modal-card:has(#bigmap) { width: min(1040px, calc(100vw - 32px)); display: grid; grid-template-columns: auto 1fr; column-gap: 18px; align-items: start; }
#modal-card:has(#bigmap) > h2, #modal-card:has(#bigmap) > .note, #modal-card:has(#bigmap) > .legend, #modal-card:has(#bigmap) > .row { grid-column: 1 / -1; }
#bigmap { width: min(640px, 66vh, calc(100vw - 80px)); }
.mlist { margin-top: 0; max-height: min(640px, 66vh); overflow: auto; align-content: start; }
@media (max-width: 820px) { #modal-card:has(#bigmap) { grid-template-columns: 1fr; } .mlist { margin-top: 10px; } }
