/* Dockside: hub, briefing, HUD, overlays and touch controls. Painted art lives in assets/art; this file only frames it. */
:root {
  --ink: #07151d;
  --ink-2: #0d2029;
  --panel: rgba(7, 21, 29, 0.84);
  --panel-line: rgba(97, 217, 208, 0.22);
  --cream: #f4edda;
  --cream-dim: rgba(244, 237, 218, 0.68);
  --cyan: #61d9d0;
  --amber: #ffc44d;
  --coral: #ff7547;
  --alarm: #ff4f5f;
  --font-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --fd-bg: #07151d; --fd-accent: #ffc44d; --fd-accent-2: #61d9d0; --fd-text: #f4edda; --fd-font: var(--font-body); --fd-title-font: var(--font-display);
}
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700 800; src: local('Barlow Condensed ExtraBold'), local('Barlow Condensed Bold'), local('BarlowCondensed-ExtraBold'); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--cream); font-family: var(--font-body); -webkit-text-size-adjust: 100%; }
body { overflow: hidden; }
button { font: inherit; cursor: pointer; }
.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 8px; top: 8px; z-index: 50; background: var(--amber); color: var(--ink); padding: 6px 10px; }
.eyebrow { margin: 0 0 6px; font: 700 12px/1.2 var(--font-display); letter-spacing: 0.22em; color: var(--cyan); text-transform: uppercase; }
h1, h2, h3 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; margin: 0; }
.primary, .secondary, .tab, .job-card, .shop-card button, .docket button { border-radius: 10px; border: 1px solid var(--panel-line); min-height: 44px; }
.primary { background: var(--amber); color: var(--ink); font: 800 18px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; padding: 12px 22px; border-color: transparent; }
.primary:hover, .primary:focus-visible { background: #ffd36f; }
.primary:disabled { opacity: 0.45; cursor: default; }
.secondary { background: rgba(244, 237, 218, 0.06); color: var(--cream); font: 700 15px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; padding: 12px 18px; }
.secondary:hover, .secondary:focus-visible { background: rgba(244, 237, 218, 0.14); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Shell */
.game-shell { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; }
.game-canvas { position: absolute; inset: 0; display: grid; place-items: center; background: var(--ink); }
.game-canvas canvas { display: block; }
body[data-screen='hub'] .game-canvas, body[data-screen='briefing'] .game-canvas, body[data-screen='boot'] .game-canvas { visibility: hidden; }

/* Hub */
.hub { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.hub-art { position: absolute; inset: 0; background: url('./assets/art/hub.webp') center / cover no-repeat; z-index: 0; }
.hub-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 21, 29, 0.42), rgba(7, 21, 29, 0.78) 60%, rgba(7, 21, 29, 0.94)); }
.hub-top, .hub-panel, .hub-foot { position: relative; z-index: 1; }
.hub-top { display: flex; align-items: center; gap: 18px; padding: 14px 20px 8px; flex-wrap: wrap; }
.wordmark { font: 800 34px/1 var(--font-display); letter-spacing: 0.08em; color: var(--cream); }
.wordmark span { color: var(--cyan); }
.hub-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { background: rgba(7, 21, 29, 0.6); color: var(--cream-dim); font: 700 14px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; padding: 10px 14px; }
.tab.is-active { background: var(--cyan); color: var(--ink); border-color: transparent; }
.hub-stats { margin-left: auto; display: flex; gap: 14px; font: 700 13px/1.3 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--cream-dim); }
.hub-stats b { color: var(--amber); font-size: 18px; display: block; }
.hub-panel { overflow: auto; padding: 8px 20px 16px; min-height: 0; }
.hub-panel[data-panel='board'] { display: grid; grid-template-columns: 300px 1fr; gap: 16px; }
.clients { display: grid; gap: 10px; align-content: start; }
.client { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px; padding: 8px; }
.client .portrait { width: 64px; height: 96px; border-radius: 8px; background: url('./assets/art/clients.webp') no-repeat; background-size: 192px 96px; }
.client[data-client='voss'] .portrait { background-position: 0 0; }
.client[data-client='tiberiu'] .portrait { background-position: -64px 0; }
.client[data-client='harbourmaster'] .portrait { background-position: -128px 0; }
.client strong { display: block; font: 800 17px/1.1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; }
.client small { display: block; color: var(--cream-dim); font-size: 12px; line-height: 1.35; }
.client .rep { margin-top: 4px; font: 700 12px/1 var(--font-display); letter-spacing: 0.1em; color: var(--amber); }
.district { margin: 6px 0 10px; }
.district h3 { font-size: 15px; letter-spacing: 0.16em; color: var(--cream-dim); margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; }
.district h3 small { font-size: 12px; letter-spacing: 0.08em; color: var(--cyan); }
.job-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.job-card { text-align: left; background: var(--panel); color: var(--cream); padding: 12px 14px; display: grid; gap: 6px; }
.job-card:hover, .job-card:focus-visible { border-color: var(--cyan); }
.job-card .num { font: 800 12px/1 var(--font-display); letter-spacing: 0.16em; color: var(--cyan); }
.job-card .title { font: 800 20px/1 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; }
.job-card .strap { color: var(--cream-dim); font-size: 13px; line-height: 1.4; }
.job-card .meta { display: flex; gap: 8px; flex-wrap: wrap; font: 700 12px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--cream-dim); }
.job-card .medals { display: flex; gap: 4px; }
.job-card .medal { width: 22px; height: 22px; border-radius: 50%; background: url('./assets/art/sprites.webp') no-repeat; opacity: 0.28; }
.job-card .medal.is-on { opacity: 1; }
.job-card.is-locked { opacity: 0.55; }
.job-card.is-locked .title::after { content: ' · LOCKED'; color: var(--coral); font-size: 12px; letter-spacing: 0.12em; }
.job-card .lock { color: var(--coral); font-size: 12px; }
.job-card.is-done .num::after { content: '  CLEARED'; color: var(--amber); }
.shop-intro { margin-bottom: 12px; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.shop-card { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: 56px 1fr; gap: 10px; }
.shop-card .icon { width: 56px; height: 56px; background: url('./assets/art/sprites.webp') no-repeat; }
.shop-card strong { font: 800 18px/1 var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; display: block; }
.shop-card p { margin: 4px 0 8px; font-size: 13px; line-height: 1.4; color: var(--cream-dim); }
.shop-card .price { font: 800 13px/1 var(--font-display); color: var(--amber); letter-spacing: 0.1em; }
.shop-card button { font: 700 13px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; background: rgba(244, 237, 218, 0.08); color: var(--cream); padding: 10px 12px; margin-right: 6px; }
.shop-card button.is-on { background: var(--cyan); color: var(--ink); }
.docket { display: grid; gap: 10px; max-width: 760px; }
.docket .docket-head { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 12px; padding: 14px 16px; }
.docket .docket-head h2 { font-size: 24px; }
.docket .docket-jobs { display: grid; gap: 8px; }
.docket .docket-job { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.docket .docket-job span { color: var(--cream-dim); font-size: 13px; }
.docket button { background: var(--amber); color: var(--ink); font: 800 15px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; padding: 12px 18px; border-color: transparent; width: fit-content; }
.settings-panel { display: grid; gap: 18px; max-width: 900px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.settings-grid label, .settings-audio label, .pause-settings label { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 10px 12px; min-height: 44px; font-size: 14px; }
.settings-grid input[type='checkbox'], .pause-settings input[type='checkbox'] { width: 22px; height: 22px; accent-color: var(--amber); }
.settings-grid select { flex: 1; min-height: 36px; background: rgba(7, 21, 29, 0.8); color: var(--cream); border: 1px solid var(--panel-line); border-radius: 8px; padding: 6px 10px; font: inherit; }
.settings-audio { display: grid; gap: 8px; }
.settings-audio input[type='range'] { flex: 1; accent-color: var(--amber); height: 44px; margin: 0; }
.settings-audio .audio-row { display: grid; grid-template-columns: 120px 1fr 48px; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 2px 12px; }
.settings-audio .audio-row span:last-child { text-align: right; color: var(--cream-dim); font-size: 13px; }
.difficulty-row { display: flex; gap: 8px; flex-wrap: wrap; }
.difficulty-row button { background: var(--panel); color: var(--cream); border: 1px solid var(--panel-line); border-radius: 10px; padding: 10px 14px; font: 700 14px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; min-height: 44px; }
.difficulty-row button.is-on { background: var(--cyan); color: var(--ink); }
.settings-controls h3 { font-size: 15px; letter-spacing: 0.16em; color: var(--cream-dim); margin-bottom: 8px; }
.binding-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.binding-row { display: grid; grid-template-columns: 1fr 110px; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.binding-row button { background: rgba(244, 237, 218, 0.08); color: var(--cream); border: 1px solid var(--panel-line); border-radius: 8px; min-height: 36px; font: 700 13px/1 var(--font-display); letter-spacing: 0.08em; }
.hub-foot { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 8px 20px 10px; font-size: 12px; color: var(--cream-dim); }
/* Footer links keep a 44 px hit area without growing the footer. */
.hub-foot .save-notice { color: var(--amber, #f0b24a); text-align: center; flex: 1; padding: 0 12px; }
.settings-grid .save-notice { grid-column: 1 / -1; margin: 6px 0 0; color: var(--amber, #f0b24a); font-size: 13px; }
.hub-foot a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid rgba(97, 217, 208, 0.45); display: inline-block; padding: 14px 8px; margin: -14px -8px; }
.hub-foot a:hover, .hub-foot a:focus-visible { color: var(--cream); border-bottom-color: var(--cream); }

/* Briefing */
.briefing { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(13, 32, 41, 0.9), rgba(7, 21, 29, 0.98)); overflow: auto; }
.briefing-card { width: min(720px, 100%); background: var(--panel); border: 1px solid var(--panel-line); border-radius: 18px; padding: 22px 24px 20px; display: grid; gap: 12px; }
.briefing-card h2 { font-size: clamp(26px, 4.4vw, 40px); line-height: 1; white-space: normal; }
.briefing-copy { margin: 0; line-height: 1.5; color: var(--cream-dim); font-size: 15px; }
.briefing-controls { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--cream-dim); border-top: 1px solid var(--panel-line); padding-top: 8px; }
body.large-text .briefing-controls { font-size: 16px; }
.manifest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.manifest-grid article { background: rgba(244, 237, 218, 0.05); border: 1px solid var(--panel-line); border-radius: 10px; padding: 8px 10px; }
.manifest-grid article span { display: block; font: 700 12px/1 var(--font-display); letter-spacing: 0.16em; color: var(--cyan); margin-bottom: 4px; }
.manifest-grid article strong { display: block; font: 800 18px/1.1 var(--font-display); }
.manifest-grid article small { display: block; color: var(--cream-dim); font-size: 12px; margin-top: 3px; line-height: 1.3; }
.loadout-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--cream-dim); }
.loadout-row .chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(97, 217, 208, 0.12); border: 1px solid var(--panel-line); border-radius: 999px; padding: 4px 10px 4px 4px; color: var(--cream); font: 700 12px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.loadout-row .chip i { width: 26px; height: 26px; background: url('./assets/art/sprites.webp') no-repeat; display: inline-block; }
.briefing-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; padding-bottom: 4px; }
/* The shared demo bar sits bottom-left; keep every primary action clear of it. */
body:has(.sbg-demo-bar) .briefing-card { margin-bottom: 72px; }
body:has(.sbg-demo-bar) .hud-bottom { bottom: 76px; }

/* HUD: cards hug the top corners and never cover the middle of the scene. */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud-left, .hud-right { position: absolute; top: 10px; display: grid; gap: 6px; width: min(300px, 34vw); }
.hud-left { left: 10px; }
.hud-right { right: 10px; justify-items: end; }
.card { background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 7px 10px; backdrop-filter: blur(6px); pointer-events: auto; }
.card span { display: block; font: 700 12px/1 var(--font-display); letter-spacing: 0.18em; color: var(--cyan); margin-bottom: 3px; }
.card strong { display: block; font: 800 18px/1.05 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; }
.card small { display: block; color: var(--cream-dim); font-size: 12px; line-height: 1.3; margin-top: 2px; }
.objective-card { width: 100%; }
.suspicion-card { width: 100%; }
.suspicion-row { display: flex; justify-content: space-between; align-items: baseline; }
.meter { height: 7px; border-radius: 4px; background: rgba(244, 237, 218, 0.12); overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--amber) 55%, var(--alarm)); transition: width 120ms linear; }
.suspicion-card.alert { border-color: var(--alarm); box-shadow: 0 0 18px rgba(255, 79, 95, 0.35); }
.suspicion-card.alert strong { color: var(--alarm); }
.clock-card { min-width: 120px; text-align: right; }
.clock-card small.is-urgent { color: var(--amber); font-weight: 700; }
.clock-card strong { font-variant-numeric: tabular-nums; font-size: 22px; }
.tool-card { min-width: 180px; }
.tool-slots { display: flex; gap: 6px; }
.tool-slot { width: 44px; height: 44px; padding: 0; border-radius: 8px; border: 1px solid var(--panel-line); background: rgba(244, 237, 218, 0.06) url('./assets/art/sprites.webp') no-repeat; position: relative; color: inherit; touch-action: manipulation; }
.tool-slot:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.tool-slot.is-selected { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(255, 196, 77, 0.35) inset; }
.tool-slot.is-spent { opacity: 0.3; }
.tool-slot b { position: absolute; right: 2px; bottom: 1px; font: 800 12px/1 var(--font-display); color: var(--amber); }
.tool-slot u { position: absolute; left: 3px; top: 1px; font: 700 12px/1 var(--font-display); color: var(--cream-dim); text-decoration: none; }
.tool-slot.is-empty { border-style: dashed; }
.hud-bottom { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 8px; }
.hud-button { pointer-events: auto; background: var(--panel); color: var(--cream); border: 1px solid var(--panel-line); border-radius: 10px; min-height: 44px; min-width: 44px; padding: 8px 14px; font: 700 13px/1 var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; }
.toast { position: absolute; left: 50%; bottom: 72px; transform: translate(-50%, 12px); background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px; padding: 10px 16px; font-size: 15px; max-width: min(560px, 92vw); text-align: center; opacity: 0; transition: opacity 160ms, transform 160ms; pointer-events: none; z-index: 6; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.event-banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(255, 196, 77, 0.92); color: var(--ink); border-radius: 10px; padding: 8px 16px; font: 800 15px/1.2 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; max-width: min(520px, 60vw); text-align: center; z-index: 6; }
.event-banner.is-alarm { background: rgba(255, 79, 95, 0.92); color: #fff; }

/* Overlays */
/* `safe center`: when the pause menu and its settings are taller than a landscape phone, the top (Resume) stays reachable
   by scrolling instead of being centred off the top edge. */
.overlay { position: absolute; inset: 0; display: grid; place-content: center; align-content: safe center; gap: 10px; text-align: center; padding: 20px; background: rgba(7, 21, 29, 0.82); z-index: 8; overflow: auto; }
.overlay strong { font: 800 clamp(28px, 5vw, 44px)/1 var(--font-display); letter-spacing: 0.04em; color: var(--alarm); }
.overlay span { color: var(--cream-dim); font-size: 15px; max-width: 480px; }
.pause h2 { font-size: 34px; }
.pause-actions { display: grid; gap: 8px; width: min(360px, 90vw); margin: 10px auto 0; }
.pause-settings { width: min(640px, 92vw); margin: 10px auto 0; display: grid; gap: 8px; text-align: left; }
.result .result-card { width: min(640px, 94vw); background: var(--panel); border: 1px solid var(--panel-line); border-radius: 18px; padding: 24px; display: grid; gap: 12px; text-align: left; margin: auto; }
.result h2 { font-size: clamp(30px, 5vw, 46px); line-height: 1; }
.result .result-medals { display: flex; gap: 8px; flex-wrap: wrap; }
.result .medal-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(244, 237, 218, 0.06); border: 1px solid var(--panel-line); border-radius: 999px; padding: 4px 12px 4px 4px; font: 700 13px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; }
.result .medal-chip i { width: 32px; height: 32px; background: url('./assets/art/sprites.webp') no-repeat; }
.result .medal-chip.is-off { opacity: 0.4; }
.result dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.result dl div { background: rgba(244, 237, 218, 0.05); border-radius: 10px; padding: 8px 10px; }
.result dt { font: 700 12px/1 var(--font-display); letter-spacing: 0.16em; color: var(--cyan); }
.result dd { margin: 4px 0 0; font: 800 20px/1 var(--font-display); }
.result .result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.result .result-tip { color: var(--cream-dim); font-size: 14px; line-height: 1.45; margin: 0; }
.ending .ending-card { width: min(640px, 94vw); background: var(--panel); border: 1px solid var(--panel-line); border-radius: 18px; padding: 28px; display: grid; gap: 12px; text-align: left; }
.ending h2 { font-size: 40px; color: var(--amber); }
.ending p { line-height: 1.55; margin: 0; }

/* Narrow portrait phones: the job needs the wide view, so ask for landscape and hold the clock. */
.rotate-prompt { display: none; position: absolute; inset: 0; z-index: 40; place-content: center; text-align: center; padding: 24px; background: var(--ink); color: var(--cream); font: 800 24px/1.3 var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; }
.rotate-prompt small { display: block; margin-top: 10px; font: 400 14px/1.4 var(--font-body); color: var(--cream-dim); text-transform: none; letter-spacing: 0; }
@media (orientation: portrait) and (max-width: 720px) {
  body[data-screen='job'] .rotate-prompt { display: grid; }
}

/* Touch controls */
.touch-controls { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.touch-stick { position: absolute; left: 24px; bottom: 24px; width: 136px; height: 136px; border-radius: 50%; background: rgba(7, 21, 29, 0.5); border: 1px solid var(--panel-line); pointer-events: auto; touch-action: none; }
.touch-stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: rgba(244, 237, 218, 0.25); border: 2px solid var(--cream-dim); }
.touch-buttons { position: absolute; right: 18px; bottom: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; pointer-events: auto; }
.touch-buttons button { width: 72px; height: 60px; border-radius: 14px; background: rgba(7, 21, 29, 0.62); color: var(--cream); border: 1px solid var(--panel-line); font: 800 13px/1 var(--font-display); letter-spacing: 0.1em; touch-action: none; }
.touch-buttons button.is-on { background: var(--cyan); color: var(--ink); }
body[data-touch-layout='left'] .touch-stick { left: auto; right: 24px; }
body[data-touch-layout='left'] .touch-buttons { right: auto; left: 18px; }
body[data-touch-mode='1'] .hud-bottom { bottom: 170px; }
/* The shared demo bar sits bottom-left, which is where the virtual stick is. On a touch screen 600 px wide or more the bar moves into the
   strip between the stick and the buttons; on a narrower screen the stick and the buttons lift above it (the bar keeps its corner).
   Removing the bar (its x) puts everything back. */
body[data-screen='job'][data-touch-mode='1'] .sbg-demo-bar[data-game='dockside'] { --bar-left: 172px; --bar-right: 184px; left: var(--bar-left); bottom: 12px; max-width: calc(100vw - var(--bar-left) - var(--bar-right)); }
body[data-screen='job'][data-touch-mode='1'][data-touch-layout='left'] .sbg-demo-bar[data-game='dockside'] { --bar-left: 184px; --bar-right: 172px; }
@media (max-height: 460px) {
  body[data-screen='job'][data-touch-mode='1'] .sbg-demo-bar[data-game='dockside'] { --bar-left: 134px; --bar-right: 168px; bottom: 8px; }
  body[data-screen='job'][data-touch-mode='1'][data-touch-layout='left'] .sbg-demo-bar[data-game='dockside'] { --bar-left: 168px; --bar-right: 146px; }
}
@media (max-width: 599px) {
  body[data-screen='job'][data-touch-mode='1'] .sbg-demo-bar[data-game='dockside'] { left: 5px; bottom: 5px; max-width: calc(100vw - 10px); }
  body[data-screen='job'][data-touch-mode='1']:has(.sbg-demo-bar) .touch-stick, body[data-screen='job'][data-touch-mode='1']:has(.sbg-demo-bar) .touch-buttons { bottom: 72px; }
  body[data-screen='job'][data-touch-mode='1']:has(.sbg-demo-bar) .hud-bottom { bottom: 196px; }
}

/* Large text: the whole interface, not just the HUD (hub tabs and stats, job and shop cards, the briefing, settings, results). */
body.large-text { font-size: 18px; }
body.large-text .eyebrow, body.large-text .card span, body.large-text .job-card .num, body.large-text .manifest-grid article span, body.large-text .result dt { font-size: 14px; }
body.large-text .card strong { font-size: 22px; }
body.large-text .card small, body.large-text .client small, body.large-text .job-card .meta, body.large-text .job-card .lock, body.large-text .hub-foot, body.large-text .manifest-grid article small, body.large-text .loadout-row { font-size: 15px; }
body.large-text .wordmark { font-size: 38px; }
body.large-text .tab { font-size: 18px; padding: 12px 16px; min-height: 48px; }
body.large-text .hub-stats { font-size: 16px; }
body.large-text .hub-stats b { font-size: 22px; }
body.large-text .hub-panel[data-panel='board'] { grid-template-columns: 340px 1fr; }
body.large-text .client strong { font-size: 21px; }
body.large-text .client .rep { font-size: 14px; }
body.large-text .district h3 { font-size: 18px; }
body.large-text .district h3 small { font-size: 14px; }
body.large-text .job-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
body.large-text .job-card .title { font-size: 25px; }
body.large-text .job-card .strap, body.large-text .shop-card p, body.large-text .docket .docket-job span { font-size: 16px; }
body.large-text .shop-card strong { font-size: 22px; }
body.large-text .shop-card .price, body.large-text .shop-card button { font-size: 16px; }
body.large-text .docket .docket-head h2 { font-size: 28px; }
body.large-text .docket button, body.large-text .secondary { font-size: 18px; }
body.large-text .primary { font-size: 22px; }
body.large-text .settings-grid label, body.large-text .settings-audio label, body.large-text .pause-settings label, body.large-text .binding-row, body.large-text .settings-grid select { font-size: 17px; }
body.large-text .settings-audio .audio-row span:last-child, body.large-text .binding-row button { font-size: 16px; }
body.large-text .difficulty-row button { font-size: 17px; }
body.large-text .settings-controls h3 { font-size: 18px; }
body.large-text .briefing-copy { font-size: 19px; }
body.large-text .manifest-grid article strong { font-size: 22px; }
body.large-text .loadout-row .chip, body.large-text .result .medal-chip, body.large-text .hud-button { font-size: 16px; }
body.large-text .toast { font-size: 19px; }
body.large-text .event-banner { font-size: 19px; }
body.large-text .result .result-tip { font-size: 18px; }
body.large-text .result dd { font-size: 24px; }
body.large-text .ending p { font-size: 19px; }
body.large-text .overlay span { font-size: 18px; }
body.large-text .touch-buttons button { font-size: 16px; }

/* High contrast: every panel on the board, the briefing, the HUD, results and pause menus becomes solid black with a full
   cream edge and full-strength cream text. */
body.high-contrast { --panel: rgba(0, 0, 0, 0.97); --panel-line: #f4edda; --cream-dim: #f4edda; }
body.high-contrast .card { background: rgba(0, 0, 0, 0.92); border-color: var(--cream); border-width: 2px; }
body.high-contrast .hub-art::after { background: rgba(0, 0, 0, 0.9); }
body.high-contrast .briefing { background: #000; }
body.high-contrast .overlay { background: rgba(0, 0, 0, 0.94); }
body.high-contrast .tab, body.high-contrast .secondary, body.high-contrast .difficulty-row button, body.high-contrast .hud-button { background: #000; color: var(--cream); border: 2px solid var(--cream); }
body.high-contrast .tab.is-active, body.high-contrast .difficulty-row button.is-on, body.high-contrast .shop-card button.is-on { background: var(--amber); color: #000; }
body.high-contrast .job-card, body.high-contrast .shop-card, body.high-contrast .client, body.high-contrast .binding-row, body.high-contrast .settings-grid label, body.high-contrast .pause-settings label, body.high-contrast .manifest-grid article { border-width: 2px; }
body.high-contrast .job-card.is-night { background: #000; border-color: #8fb4ff; }
body.high-contrast .job-card.is-locked { opacity: 0.8; }
body.high-contrast .eyebrow, body.high-contrast .card span, body.high-contrast .job-card .num { color: var(--amber); }
body.high-contrast .toast { background: #000; border: 2px solid var(--cream); }
body.high-contrast .touch-stick, body.high-contrast .touch-buttons button { background: rgba(0, 0, 0, 0.85); border: 2px solid var(--cream); }
body.high-contrast .meter { background: rgba(244, 237, 218, 0.3); }

/* Phone sizes. */
@media (max-width: 720px) {
  /* max-content rows: the client strip scrolls sideways, so as an auto row its minimum is 0 and the long job list
     squeezed it to a sliver on portrait phones. */
  .hub-panel[data-panel='board'] { grid-template-columns: 1fr; grid-auto-rows: max-content; }
  .clients { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
  .client { flex: 0 0 170px; grid-template-columns: 44px 1fr; padding: 6px; min-width: 0; }
  .client .portrait { width: 44px; height: 66px; background-size: 132px 66px; }
  .client[data-client='tiberiu'] .portrait { background-position: -44px 0; }
  .client[data-client='harbourmaster'] .portrait { background-position: -88px 0; }
  .client strong { font-size: 14px; }
  .client small { display: none; }
  .job-grid { grid-template-columns: 1fr; }
  .job-card, .shop-card { min-width: 0; }
  .shop { grid-template-columns: 1fr; }
  .wordmark { font-size: 26px; }
  .hub-stats { gap: 10px; font-size: 12px; }
  .hub-foot .save-notice { flex: 1 1 100%; order: 3; padding: 4px 0 0; }
  .hud-left, .hud-right { width: min(230px, 44vw); top: 6px; }
  .hud-left { left: 6px; }
  .hud-right { right: 6px; }
  .card { padding: 5px 8px; }
  .card strong { font-size: 15px; }
  .tool-card { min-width: 0; }
  .briefing-card { padding: 16px; }
}
@media (max-height: 460px) {
  .hud-left, .hud-right { width: min(220px, 30vw); }
  .card small { display: none; }
  .suspicion-card small { display: block; }
  .touch-stick { width: 110px; height: 110px; left: 14px; bottom: 14px; }
  .touch-buttons button { width: 64px; height: 50px; }
  .briefing { padding: 8px; }
  .briefing-card { padding: 12px 16px; gap: 8px; }
  .briefing-card h2 { font-size: 24px; }
  .briefing-copy { font-size: 13px; }
  .manifest-grid article small { display: none; }
  .manifest-grid article { padding: 5px 10px; }
  .manifest-grid article span { margin-bottom: 1px; }
  .manifest-grid article strong { font-size: 15px; }
  .briefing-card .eyebrow { margin-bottom: 2px; }
  .briefing-controls { font-size: 11px; line-height: 1.3; padding-top: 4px; }
}
/* A landscape phone (short and narrow, 667 x 375): the header takes two slim rows and the client strip drops its portraits, so the
   first job card is on the first screen instead of under the fold (and under the demo bar). */
@media (max-height: 460px) and (max-width: 720px) {
  .hub-top { padding: 6px 14px 2px; gap: 2px 12px; }
  .wordmark { order: 1; font-size: 22px; }
  .hub-stats { order: 2; margin-left: auto; gap: 10px; }
  .hub-stats b { font-size: 15px; display: inline; margin-right: 4px; }
  .hub-tabs { order: 3; flex: 1 0 100%; }
  .hub-panel { padding: 4px 14px 10px; }
  .clients { padding-bottom: 0; }
  .client { flex: 0 0 auto; grid-template-columns: 1fr; padding: 3px 10px; }
  .client .portrait { display: none; }
  .client .rep { margin-top: 1px; }
}
/* Large displays (2560 x 1440 and up): the HUD, the board and the touch-free controls grow with the screen. */
@media (min-width: 1800px) and (min-height: 1000px) {
  .hud-left, .hud-right { width: min(380px, 26vw); top: 16px; }
  .hud-left { left: 16px; }
  .hud-right { right: 16px; }
  .card { padding: 10px 14px; border-radius: 12px; }
  .card span { font-size: 14px; }
  .card strong { font-size: 24px; }
  .card small { font-size: 15px; }
  .clock-card strong { font-size: 30px; }
  .tool-slot { width: 58px; height: 58px; }
  .tool-slot b, .tool-slot u { font-size: 14px; }
  .hud-button { min-height: 56px; min-width: 56px; font-size: 16px; padding: 10px 18px; }
  .hud-bottom { left: 16px; bottom: 16px; }
  .toast { font-size: 19px; bottom: 96px; max-width: min(720px, 60vw); }
  .event-banner { font-size: 20px; top: 18px; max-width: min(720px, 50vw); }
  .wordmark { font-size: 44px; }
  .tab { font-size: 17px; padding: 12px 18px; }
  .hub-top { padding: 22px 36px 12px; }
  .hub-panel { padding: 12px 36px 22px; }
  .hub-panel[data-panel='board'] { grid-template-columns: 360px 1fr; }
  .job-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .job-card .title { font-size: 24px; }
  .job-card .strap, .client small, .shop-card p { font-size: 15px; }
  .briefing-card { width: min(860px, 100%); }
  .briefing-copy { font-size: 18px; }
  .result .result-card, .ending .ending-card { width: min(780px, 94vw); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
/* After Hours cards: the same card, a night-blue edge and kicker. */
.job-card.is-night { border-color: #2f4f7a; background: linear-gradient(180deg, #0b1a2c, var(--panel)); }
.job-card.is-night .num { color: #8fb4ff; }
/* The difficulty buttons take a whole row of the settings grid, so the three never wrap onto two lines. */
.settings-grid .difficulty-row { grid-column: 1 / -1; }
