:root { --o: #e07a2a; --ink: #e9eef2; --dim: #8a96a3; --panel: rgba(10, 14, 20, 0.82); --line: rgba(255, 255, 255, 0.09); --clock: #7fd4ff; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #03050a; color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overflow: hidden; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }

/* ---- job hud ---- */
.job { position: absolute; inset: 0; }
.job > * { pointer-events: auto; }
.clock { position: absolute; left: 10px; top: calc(10px + var(--sat)); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px 8px; min-width: 132px; pointer-events: none; border-left: 3px solid var(--clock); }
.clabel { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--clock); font-weight: 800; }
.ctime { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.05; }
.cbar { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.cbar i { display: block; height: 100%; background: var(--clock); transition: width 0.3s linear; }
.haul { font-size: 11px; color: var(--dim); margin-top: 6px; }
.haul b { color: #ffd24a; font-size: 13px; }
.haul span { color: #ffb060; }
.job.low .ctime { color: #ffb060; animation: pulse 1s infinite; }
.job.getout .clock { border-left-color: #ff5a4a; background: rgba(60, 8, 8, 0.85); }
.job.getout .ctime { color: #ff6a5a; animation: pulse 0.5s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

.tugp { position: absolute; right: 10px; top: calc(10px + var(--sat)); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px 6px; pointer-events: none; }
.tugp canvas { width: 112px; height: 78px; display: block; }
.job.alert .tugp { animation: alert 0.4s 4; border-color: #ff5a4a; }
@keyframes alert { 50% { background: rgba(120, 20, 10, 0.9); } }
.tbars { display: grid; gap: 3px; margin-top: 3px; }
.tb { display: grid; grid-template-columns: 28px 1fr; align-items: center; font-size: 8px; font-weight: 800; color: var(--dim); letter-spacing: 0.06em; }
.tb i { display: block; height: 4px; border-radius: 2px; background: #c9d4dd; transition: width 0.3s; }
.topbtns { position: absolute; right: 10px; top: calc(132px + var(--sat)); display: flex; gap: 6px; }
.topbtns button { width: 34px; height: 30px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-weight: 900; font-size: 13px; color: var(--dim); }

.topbtns .b-map { width: auto; padding: 0 9px; font-size: 11px; color: #ffd2a8; letter-spacing: 0.06em; }
.mapov { position: absolute; inset: 0; background: rgba(2, 4, 8, 0.86); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: calc(10px + var(--sat)) 10px calc(10px + var(--sab)); z-index: 5; }
.mapov canvas { border-radius: 8px; image-rendering: pixelated; touch-action: none; cursor: crosshair; border: 1px solid var(--line); }
.maphead { color: var(--dim); font-size: 12px; }
.b-mapx { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 22px; font-weight: 800; color: var(--ink); }
.radio { position: absolute; left: 10px; right: 10px; bottom: calc(150px + var(--sab)); max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; line-height: 1.35; opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; pointer-events: none; }
.radio.on { opacity: 1; transform: none; }
.radio b { margin-right: 6px; font-weight: 800; }
.radio b::before { content: '◉ '; font-size: 9px; vertical-align: 1px; opacity: 0.8; }

.actions { position: absolute; right: 10px; bottom: calc(96px + var(--sab)); display: flex; gap: 8px; align-items: flex-end; }
.actions button { background: var(--panel); border: 1px solid rgba(224, 122, 42, 0.5); color: #ffd2a8; border-radius: 12px; padding: 0 16px; height: 44px; font-weight: 900; font-size: 13px; letter-spacing: 0.05em; }
.actions .b-home.hot { background: var(--o); color: #1a0c02; border-color: var(--o); animation: glowb 1.2s infinite; }
.actions .b-drop { border-color: var(--line); color: var(--dim); height: 36px; font-size: 11px; padding: 0 12px; }
@keyframes glowb { 50% { box-shadow: 0 0 18px rgba(224, 122, 42, 0.8); } }

.crew { position: absolute; left: 6px; right: 6px; bottom: calc(6px + var(--sab)); display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; max-width: 520px; margin: 0 auto; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 5px 4px 6px; display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto auto; column-gap: 5px; text-align: left; height: 82px; align-content: start; }
.card canvas { grid-row: 1 / 3; width: 30px; height: 30px; border-radius: 6px; }
.cn { font-weight: 900; font-size: 13px; line-height: 1.1; }
.cj { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.card .hp { grid-column: 1 / 3; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.card .hp i { display: block; height: 100%; transition: width 0.25s; }
.card .as { grid-column: 1 / 3; font-size: 9px; font-weight: 800; letter-spacing: 0.04em; margin-top: 5px; color: #9fe6a8; }
.card.tug .as { color: #ffb060; }
.card.tug { border-color: rgba(255, 176, 96, 0.45); background: rgba(40, 24, 10, 0.85); }
.card.fixed .as { color: #7fd8d0; }
.card.down { border-color: #ff5a4a; }
.card.down .as { color: #ff6a5a; animation: pulse 0.6s infinite; }
.card:not(.fixed):active { transform: scale(0.96); }
.card:not(.fixed)::after { content: '⇄'; position: absolute; right: 5px; top: 4px; font-size: 11px; color: var(--dim); }

.arrow { position: absolute; left: 0; top: 0; width: 28px; height: 28px; display: grid; place-items: center; color: #ff6a3a; font-size: 22px; text-shadow: 0 0 8px rgba(255, 80, 40, 0.9); pointer-events: none; animation: pulse 0.6s infinite; }
.banner { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); font-weight: 900; letter-spacing: 0.14em; font-size: 18px; text-align: center; padding: 8px 18px; background: rgba(5, 8, 12, 0.6); border-radius: 8px; pointer-events: none; white-space: nowrap; animation: bannerIn 0.35s; }
.banner.red { color: #ff6a5a; }
.banner.purple { color: #e0a8ff; }
.banner.gold { color: #ffd24a; }
.banner.name { color: #e9eef2; font-size: 15px; letter-spacing: 0.3em; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ---- screens ---- */
.screen { position: absolute; inset: 0; pointer-events: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: calc(16px + var(--sat)) 14px calc(24px + var(--sab)); }
.screen.title { display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(3, 5, 10, 0.35), rgba(3, 5, 10, 0.85)); }
.tbox { text-align: center; max-width: 420px; }
.tbox h1 { font-size: clamp(46px, 14vw, 84px); letter-spacing: 0.14em; margin: 0 0 6px; font-weight: 900; color: #f2e6d6; text-shadow: 0 4px 0 #7a3a10, 0 0 40px rgba(224, 122, 42, 0.5); }
.tag { color: #c9cfd6; font-size: 15px; line-height: 1.45; margin: 0 0 26px; }
.how { color: var(--dim); font-size: 13px; line-height: 1.55; margin-top: 22px; }
button.big { display: block; width: 100%; max-width: 320px; margin: 10px auto; padding: 15px; border-radius: 14px; background: var(--o); color: #1a0c02; font-weight: 900; font-size: 17px; letter-spacing: 0.06em; box-shadow: 0 6px 0 #7a3a10; }
button.big:active { transform: translateY(3px); box-shadow: 0 3px 0 #7a3a10; }
button.ghost { display: block; margin: 6px auto; padding: 10px 18px; background: transparent; color: var(--dim); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }

.screen.yard, .screen.result, .screen.pause { background: rgba(3, 5, 10, 0.72); backdrop-filter: blur(2px); }
.ybox, .rbox, .pbox { max-width: 760px; margin: 0 auto; }
.yhead { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }
.yhead h2, .rbox h2, .pbox h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: 0.04em; color: #f2e6d6; }
.sub { color: var(--dim); font-size: 12px; margin-top: 2px; }
.cr { font-size: 26px; font-weight: 900; color: #ffd24a; font-variant-numeric: tabular-nums; }
h3 { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin: 20px 0 8px; font-weight: 800; }
.yline { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.4; margin-bottom: 10px; color: #dfe5ea; }
.yline b { margin-right: 6px; }
.hullrow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.hl { font-size: 13px; color: var(--dim); }
.hl b { color: var(--ink); }
.hb { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.hb i { display: block; height: 100%; background: linear-gradient(90deg, #c9d4dd, #8ea2b4); }
.fix { background: #2a6a3a; color: #dfffe6; border-radius: 9px; padding: 8px 12px; font-weight: 800; font-size: 13px; }
.fix.poor { background: #3a3a3a; color: #999; }
.ok { color: #7fff9a; font-size: 12px; font-weight: 800; }
.jobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.jobc { text-align: left; background: linear-gradient(160deg, rgba(30, 38, 48, 0.95), rgba(14, 18, 24, 0.95)); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; padding: 12px 13px; transition: transform 0.1s; }
.jobc:active { transform: scale(0.98); }
.jobc:hover { border-color: rgba(224, 122, 42, 0.7); }
.jobc.ark { border-color: #b98cff; background: linear-gradient(160deg, rgba(50, 30, 70, 0.95), rgba(14, 10, 24, 0.95)); }
.jl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--o); font-weight: 800; }
.jobc.ark .jl { color: #d7b0ff; }
.jn { font-size: 19px; font-weight: 900; margin: 2px 0 6px; color: #f2e6d6; }
.jm { font-size: 12px; font-weight: 700; }
.jt { font-size: 12px; color: var(--dim); margin-top: 3px; }
.jh { font-size: 12px; color: #b9c2cc; margin-top: 7px; line-height: 1.4; }
.ups { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.up { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; display: grid; gap: 3px; }
.up:active { transform: scale(0.98); }
.un { font-weight: 800; font-size: 14px; }
.un em { font-style: normal; font-size: 11px; font-weight: 800; }
.ud { font-size: 11.5px; color: var(--dim); line-height: 1.35; min-height: 30px; }
.pips { display: flex; gap: 3px; }
.pips i { width: 14px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); }
.pips i.on { background: var(--o); }
.uc { font-weight: 900; color: #ffd24a; font-size: 13px; }
.up.poor .uc { color: #8a6a5a; }
.up.max { opacity: 0.55; }
.up.max .uc { color: #7fff9a; }
.foot { color: var(--dim); font-size: 12px; text-align: center; margin: 22px 0 8px; }

.rbox { max-width: 460px; padding-top: 6vh; }
.rows { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-top: 14px; }
.rr { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rr:last-child { border: 0; }
.rr b { color: #ffd24a; font-variant-numeric: tabular-nums; }
.rr.tot { font-size: 18px; font-weight: 900; }
.rr.bad, .rr.bad b { color: #ff7a6a; }
.rr.dim { color: var(--dim); }
.parts { margin-top: 12px; }
.pp { font-size: 13px; padding: 4px 0; color: #ffd2a8; }
.stats { color: var(--dim); font-size: 12.5px; margin: 14px 0 18px; text-align: center; line-height: 1.5; }
.stats b { color: #e0a8ff; }
.pbox { max-width: 360px; padding-top: 18vh; text-align: center; }

@media (min-width: 900px) {
  .clock { left: 18px; top: 18px; min-width: 170px; padding: 10px 14px; }
  .ctime { font-size: 30px; }
  .tugp { right: 18px; top: 18px; }
  .tugp canvas { width: 150px; height: 104px; }
  .topbtns { right: 18px; top: 170px; }
  .crew { left: 18px; right: auto; bottom: 18px; width: 520px; margin: 0; }
  .card { height: 88px; }
  .actions { right: 18px; bottom: 18px; }
  .actions button { height: 52px; font-size: 15px; padding: 0 24px; }
  .radio { left: 18px; bottom: 120px; }
}
