/* Pixel fonts are bundled (OFL) so the game works offline; Google Fonts in index.html is a fallback. */
@font-face { font-family: 'Press Start 2P'; src: url('fonts/press-start-2p.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'VT323'; src: url('fonts/vt323.woff2') format('woff2'); font-display: swap; }

/* Pear36 colours used by the HUD */
:root {
  --ink: #272736; --charcoal: #43434f; --iron: #606070; --grey: #7e7e8f; --silver: #c2c2d1; --white: #ffffeb;
  --yellow: #ffe478; --orange: #ff9166; --red: #eb564b; --crimson: #b0305c; --green: #8fde5d; --forest: #3ca370;
  --sky: #4da6ff; --cyan: #66ffe3; --night: #322947; --grape: #422445; --peach: #ffb570; --lime: #cfff70;
  --head: 'Press Start 2P', monospace; --body: 'VT323', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--white); font-family: var(--body); }
#game, #title, #wipe { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; }
#title { z-index: 5; cursor: pointer; }
#wipe { z-index: 10; pointer-events: none; }
.hidden, [hidden] { display: none !important; }

.panel {
  background: var(--ink);
  box-shadow: 0 -3px 0 0 var(--charcoal), 0 3px 0 0 var(--charcoal), -3px 0 0 0 var(--charcoal), 3px 0 0 0 var(--charcoal), 6px 6px 0 0 rgba(39, 39, 54, 0.6);
  padding: 6px 10px; margin: 3px;
}
.bar { height: 12px; background: var(--charcoal); border: 2px solid var(--ink); margin-top: 4px; }
.bar > div { height: 100%; width: 100%; background: var(--green); }

#hud { position: fixed; inset: 0; pointer-events: none; }
#topbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
#objective { font-size: 26px; max-width: 46vw; line-height: 1; display: flex; flex-direction: column; gap: 7px; }
#objective .steps { font-size: 8px; gap: 4px; }
#objective .step { padding: 3px 5px; }
#obj-label { font-family: var(--head); font-size: 11px; color: var(--yellow); margin-right: 10px; vertical-align: 3px; }
#timer { font-family: var(--head); font-size: 22px; position: absolute; left: 50%; transform: translateX(-50%); padding: 10px 14px; }
#timer.low { color: var(--red); animation: blink 0.5s steps(2) infinite; }
#timer.late { color: var(--red); }
#wallet { font-family: var(--head); font-size: 14px; display: flex; gap: 14px; align-items: center; }
#money { color: var(--yellow); }
#level { color: var(--cyan); font-size: 11px; }

#cargo { position: absolute; top: 96px; left: 12px; width: 230px; font-family: var(--head); font-size: 10px; }
#cargo .row { display: flex; justify-content: space-between; }
#cargo.flash { box-shadow: 0 -3px 0 0 var(--red), 0 3px 0 0 var(--red), -3px 0 0 0 var(--red), 3px 0 0 0 var(--red); }
#speedo { position: absolute; left: 12px; bottom: 12px; font-family: var(--head); display: flex; align-items: baseline; gap: 8px; }
#speed { font-size: 30px; min-width: 3ch; text-align: right; }
#speedo small { font-size: 9px; color: var(--grey); }
#gear { font-size: 14px; color: var(--yellow); margin-left: 6px; }
#minimap { position: absolute; right: 15px; bottom: 15px; width: 216px; height: 216px; image-rendering: pixelated; box-shadow: 0 -3px 0 0 var(--charcoal), 0 3px 0 0 var(--charcoal), -3px 0 0 0 var(--charcoal), 3px 0 0 0 var(--charcoal), 6px 6px 0 0 rgba(39, 39, 54, 0.6); background: var(--ink); }

#pointer { position: absolute; left: 0; top: 0; font-family: var(--head); font-size: 10px; text-align: center; transform: translate(-50%, -50%); color: var(--yellow); text-shadow: 2px 2px 0 var(--ink); }
#pointer .arrow { width: 0; height: 0; margin: 0 auto 4px; border-left: 11px solid transparent; border-right: 11px solid transparent; border-bottom: 20px solid var(--yellow); filter: drop-shadow(2px 2px 0 var(--ink)); }

#bay { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); width: 260px; text-align: center; font-family: var(--head); font-size: 11px; }
#bay .bar > div { background: var(--yellow); }

#toast { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); font-family: var(--head); font-size: 28px; color: var(--yellow); text-shadow: 4px 4px 0 var(--ink); white-space: nowrap; opacity: 0; }
#toast.show { animation: toast 1.6s ease-out forwards; }
#popups > div { position: absolute; font-family: var(--head); font-size: 12px; color: var(--red); text-shadow: 2px 2px 0 var(--ink); transform: translate(-50%, -50%); animation: pop 1s ease-out forwards; white-space: nowrap; }
#help { white-space: nowrap; position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 20px; color: var(--silver); text-shadow: 2px 2px 0 var(--ink); opacity: 0.85; }

@keyframes blink { 50% { opacity: 0.3; } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 20px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 25% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pop { 0% { opacity: 1; margin-top: 0; } 100% { opacity: 0; margin-top: -50px; } }

/* Full-screen cards: title, job board, brief, results, pause */
#screen { position: fixed; inset: 0; display: flex; align-items: safe center; justify-content: center; background: rgba(39, 39, 54, 0.55); padding: 20px 16px; overflow-y: auto; }
.card {
  background: var(--ink); width: min(620px, calc(100% - 8px)); padding: 20px 26px 24px; font-size: 22px; line-height: 1.15; margin: 4px;
  box-shadow: 0 -4px 0 0 var(--charcoal), 0 4px 0 0 var(--charcoal), -4px 0 0 0 var(--charcoal), 4px 0 0 0 var(--charcoal),
    0 -8px 0 0 var(--ink), 0 8px 0 0 var(--ink), -8px 0 0 0 var(--ink), 8px 0 0 0 var(--ink), 12px 14px 0 0 var(--night);
}
.cardtop { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 3px dashed var(--charcoal); }
.brand { font-family: var(--head); font-size: 12px; color: var(--yellow); image-rendering: pixelated; display: block; max-width: 100%; height: auto; }
.steps { display: flex; align-items: center; gap: 5px; font-family: var(--head); font-size: 8px; flex-wrap: wrap; }
.steps i { color: var(--iron); font-style: normal; }
.step { padding: 4px 6px; background: var(--charcoal); color: var(--grey); }
.step.done { color: var(--green); }
.step.on { background: var(--yellow); color: var(--ink); }
.actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.card .actions .cta { margin-top: 0; }
.btn { font-family: var(--head); font-size: 12px; color: var(--silver); background: var(--charcoal); padding: 10px 14px; cursor: pointer; }
.card .cta { cursor: pointer; }
.menu { margin: 14px 0 6px; display: flex; flex-direction: column; gap: 6px; }
.menu .item { font-family: var(--head); font-size: 14px; color: var(--silver); padding: 8px 10px; cursor: pointer; }
.menu .item.on { color: var(--yellow); background: var(--night); }
.card h1 { font-family: var(--head); font-size: 26px; color: var(--yellow); margin: 0 0 6px; line-height: 1.3; }
.card h2 { font-family: var(--head); font-size: 14px; color: var(--cyan); margin: 0 0 14px; line-height: 1.4; }
.card .sub { color: var(--silver); margin-bottom: 14px; }
.card .sub.small { font-size: 19px; color: var(--grey); margin: 6px 0 0; }
.card .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; margin: 12px 0; }
.card .kv span:nth-child(odd) { color: var(--grey); }
.card .route { font-family: var(--head); font-size: 12px; margin: 10px 0; line-height: 1.8; }
.card .note { color: var(--peach); margin: 10px 0; }
.card .cta { font-family: var(--head); font-size: 12px; color: var(--ink); background: var(--yellow); display: inline-block; padding: 10px 14px; margin-top: 14px; animation: blink 1s steps(2) infinite; }
.card .keys { color: var(--silver); font-size: 20px; margin-top: 12px; }
.card .keys b { font-family: var(--head); font-size: 10px; color: var(--white); background: var(--charcoal); padding: 3px 6px; margin-right: 4px; font-weight: normal; }
.card .lines { margin: 14px 0; }
.card .line { display: flex; justify-content: space-between; opacity: 0; animation: lineIn 0.25s forwards; }
.card .line .neg { color: var(--red); } .card .line .pos { color: var(--green); }
.card .total { font-family: var(--head); font-size: 16px; border-top: 3px solid var(--charcoal); padding-top: 10px; margin-top: 8px; display: flex; justify-content: space-between; opacity: 0; animation: lineIn 0.3s forwards; }
.card .stars { font-family: var(--head); font-size: 30px; color: var(--yellow); letter-spacing: 8px; margin: 6px 0 4px; }
.card .stars .off { color: var(--charcoal); }
.card .xpbar { height: 14px; background: var(--charcoal); margin-top: 6px; }
.card .xpbar > div { height: 100%; background: var(--cyan); }
.card .fail { color: var(--red); }
.swatch { display: inline-block; width: 12px; height: 12px; vertical-align: 0; margin-right: 6px; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }

@media (max-width: 700px) {
  #objective { font-size: 20px; } #timer { top: 54px; } #minimap { width: 140px; height: 140px; } #help { display: none; }
}
