* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fc3dc; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#topbar { position: absolute; top: 14px; left: 16px; display: flex; flex-direction: column; gap: 4px; text-shadow: 0 1px 3px #000a; }
#money { font-size: 28px; font-weight: 800; color: #ffe17a; }
#where { font-size: 15px; opacity: .95; }
#mission { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: #0d1f16cc; border: 1px solid #ffffff22; border-radius: 12px; padding: 10px 16px; max-width: min(560px, 70vw); text-align: center; display: flex; flex-direction: column; gap: 2px; }
#m-title { color: #ffe17a; font-size: 16px; }
#m-text { font-size: 14px; }
#m-time { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
#minimap { position: absolute; right: 16px; bottom: 16px; width: 200px; height: 200px; border-radius: 50%; border: 3px solid #ffffffcc; box-shadow: 0 4px 16px #0006; background: #2b4a33; }
#speed { position: absolute; right: 236px; bottom: 24px; text-align: right; text-shadow: 0 1px 4px #000a; }
#speed b { font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; display: block; line-height: 1; }
#speed span { font-size: 13px; opacity: .8; }
#hint { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); background: #000a; padding: 8px 14px; border-radius: 10px; font-size: 15px; opacity: 0; transition: opacity .2s; white-space: nowrap; }
#hint.on { opacity: 1; }
#toasts { position: absolute; top: 90px; left: 16px; display: flex; flex-direction: column; gap: 6px; }
.toast { background: #0d1f16dd; border-left: 4px solid #ffe17a; padding: 8px 12px; border-radius: 6px; font-size: 14px; animation: tin .25s ease-out; max-width: 320px; }
@keyframes tin { from { transform: translateX(-20px); opacity: 0; } }
.round { pointer-events: auto; position: absolute; top: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #0d1f16bb; color: #fff; font-size: 20px; font-weight: 700; cursor: pointer; }
#btn-menu { right: 16px; }
#btn-map { right: 66px; }

/* touch */
#touch { position: absolute; inset: 0; }
#stick { pointer-events: auto; position: absolute; left: 24px; bottom: 24px; width: 140px; height: 140px; border-radius: 50%; background: #ffffff22; border: 2px solid #ffffff44; }
#knob { position: absolute; left: 45px; top: 45px; width: 50px; height: 50px; border-radius: 50%; background: #ffffffaa; }
.tbtn { pointer-events: auto; position: absolute; width: 68px; height: 68px; border-radius: 50%; border: 2px solid #ffffff66; background: #0d1f16aa; color: #fff; font-size: 24px; font-weight: 800; }
#t-act { right: 236px; bottom: 110px; }
#t-jump { right: 236px; bottom: 30px; }
body.touch #minimap { width: 150px; height: 150px; }
body.touch #speed { right: 16px; bottom: auto; top: 66px; }
body.touch #speed b { font-size: 34px; }

/* screens */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #0d1f16aa, #050c08ee); z-index: 10; }
.panel { width: min(620px, 92vw); max-height: 92vh; overflow: auto; background: #10261bf2; border: 1px solid #ffffff1f; border-radius: 18px; padding: 28px 32px; box-shadow: 0 20px 60px #000a; }
h1 { margin: 0 0 4px; font-size: 44px; letter-spacing: -1px; }
h1 span { color: #ffe17a; }
.lead { font-size: 19px; margin: 0 0 12px; color: #cfe8d6; }
.panel p { line-height: 1.5; color: #dfeee4; }
#load { position: relative; height: 34px; background: #ffffff14; border-radius: 10px; overflow: hidden; margin: 18px 0; }
#loadbar { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #3c8b55, #7cc58c); transition: width .2s; }
#loadtxt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
#menu-btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 12px; }
.btn { pointer-events: auto; border: 0; border-radius: 10px; padding: 12px 20px; font-size: 16px; font-weight: 700; cursor: pointer; background: #ffffff1c; color: #fff; }
.btn:hover { background: #ffffff2e; }
.btn.primary { background: #ffd23f; color: #1b1b1b; font-size: 19px; padding: 12px 36px; }
.btn.primary:hover { background: #ffe17a; }
.btn.danger { background: #c0392b; }
#help table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0 12px; }
#help td { padding: 5px 6px; border-bottom: 1px solid #ffffff14; }
#help td:first-child { color: #ffe17a; font-weight: 600; white-space: nowrap; }
#quality { font-size: 14px; display: flex; gap: 6px; align-items: center; margin: 8px 0; }
.chip { border: 1px solid #ffffff33; background: transparent; color: #fff; border-radius: 20px; padding: 5px 12px; cursor: pointer; }
.chip.on { background: #ffd23f; color: #1b1b1b; border-color: #ffd23f; }
#confirm { background: #00000033; border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.credits { font-size: 12px; opacity: .65; margin-top: 18px; }
.small { font-size: 13px; opacity: .8; }

/* big map */
#bigmap { gap: 20px; padding: 20px; }
.mapwrap { height: min(90vh, 1000px); aspect-ratio: 900 / 1000; pointer-events: auto; }
#mapc { width: 100%; height: 100%; border-radius: 12px; box-shadow: 0 10px 40px #000a; cursor: crosshair; }
.mapside { width: 240px; }
.mapside h2 { margin: 0 0 8px; }
@media (max-width: 800px) { .mapside { display: none; } #bigmap { padding: 8px; } .mapwrap { height: auto; width: 96vw; } }
