/* Rough In — work-site look: charcoal chrome, safety-yellow accents. */
:root {
  --char: #1d1f22; --char2: #26292d; --char3: #32363b; --line: #464b52;
  --yellow: #ffc619; --yellow-d: #d9a400; --yellow-ink: #1d1f22;
  --text: #f2f0ea; --muted: #a9adb3; --ok: #3fb950; --bad: #ff5a4f;
  --paper: #f7f1e3; --radius: 12px;
  --font: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--char); color: var(--text); font-family: var(--body); -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { position: fixed; inset: 0; display: flex; justify-content: center; }

/* ---------- work screen ---------- */
#work { width: 100%; max-width: 1280px; height: 100%; display: flex; flex-direction: column; background: var(--char); }
#hud { display: flex; align-items: center; gap: 10px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); background: var(--char2); border-bottom: 3px solid var(--yellow); min-height: 50px; }
.hud-mid { flex: 1; min-width: 0; }
#hudJob { font-family: var(--font); font-weight: 700; font-size: 17px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hudSub { font-size: 12px; color: var(--yellow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--font); font-size: 13px; line-height: 1.25; }
#hudMoney { color: #9be28f; font-weight: 700; }
#hudHours { color: var(--muted); }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--char3); display: grid; place-items: center; font-size: 22px; line-height: 1; padding: 0; }
.icon-btn.small { font-size: 13px; font-family: var(--font); }
.icon-btn:active { transform: translateY(1px); }

.gus { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; background: var(--char); border-bottom: 1px solid var(--char3); }
.gus-face { width: 46px; height: 46px; flex: none; }
.gus-face.big { width: 64px; height: 64px; }
.gus-face svg { width: 100%; height: 100%; display: block; }
.gus-bubble { position: relative; flex: 1; background: var(--paper); color: #222; border-radius: 12px; padding: 7px 10px 6px; font-size: 14px; line-height: 1.35; }
.gus-bubble::before { content: ""; position: absolute; left: -7px; top: 14px; border: 7px solid transparent; border-right-color: var(--paper); border-left: 0; }
.gus-bubble p { margin: 0; max-height: 4.1em; overflow-y: auto; }
#stageChips { position: absolute; left: 8px; top: 8px; display: flex; gap: 6px; z-index: 2; }
.chip { border: 1px solid #c9bfa8; background: #efe6d2; color: #333; border-radius: 999px; padding: 3px 12px; font-size: 13px; min-height: 34px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.chip small { color: #7a6f58; }

#stage { position: relative; flex: 1; min-height: 160px; background: #cfe6f5; overflow: hidden; touch-action: none; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#zoomCtl { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 6px; }
#zoomCtl .icon-btn { background: rgba(29,31,34,.82); color: #fff; }
#legend { position: absolute; left: 8px; bottom: 8px; font-size: 11px; color: #243; background: rgba(255,255,255,.78); border-radius: 8px; padding: 4px 8px; pointer-events: none; max-width: 70%; }
#legend:empty { display: none; }
#toast { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: calc(100% - 80px); background: rgba(29,31,34,.92); color: #fff; border-left: 4px solid var(--yellow); border-radius: 8px; padding: 8px 12px; font-size: 14px; pointer-events: none; }

#opts { display: flex; gap: 10px; padding: 6px 8px; background: var(--char2); overflow-x: auto; scrollbar-width: none; align-items: center; min-height: 48px; }
#opts::-webkit-scrollbar { display: none; }
.opt-row { display: flex; gap: 4px; align-items: center; flex: none; }
.opt-row:empty { display: none; }
.opt-row .lbl { font-size: 11px; color: var(--muted); margin-right: 2px; text-transform: uppercase; letter-spacing: .06em; }
.opt { min-width: 44px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--char3); font-family: var(--font); font-size: 14px; padding: 0 8px; }
.opt.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); font-weight: 700; }

#tools { display: flex; gap: 4px; padding: 6px 6px; background: var(--char2); border-top: 1px solid var(--char3); overflow-x: auto; scrollbar-width: none; }
#tools::-webkit-scrollbar { display: none; }
.tool { flex: 1 0 54px; min-width: 54px; max-width: 96px; height: 58px; border-radius: 10px; border: 1px solid var(--line); background: var(--char3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; padding: 2px; }
.tool svg { width: 26px; height: 26px; }
.tool.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); font-weight: 700; }
.tool:disabled { opacity: .35; }

.btn { display: block; width: 100%; min-height: 48px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--char3); font-family: var(--font); font-size: 17px; font-weight: 700; letter-spacing: .02em; padding: 10px 16px; margin: 8px 0 0; }
.btn.primary { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow-d); }
.btn.big { min-height: 56px; font-size: 19px; }
.btn.ghost { background: transparent; }
.btn:active { transform: translateY(1px); }
#btnTest { margin: 0; border-radius: 0; padding-bottom: max(10px, env(safe-area-inset-bottom)); text-transform: none; }
#btnTest small { display: block; font-size: 11px; font-weight: 400; opacity: .75; }
.link { background: none; border: 0; color: var(--yellow); text-decoration: underline; padding: 8px 4px; font-size: 14px; min-height: 40px; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: var(--char); display: flex; align-items: flex-start; justify-content: center; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); }
.screen.dim { background: rgba(15,16,18,.72); align-items: center; }
.card { width: 100%; max-width: 520px; background: var(--char2); border: 1px solid var(--char3); border-radius: 16px; padding: 18px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.35); margin: auto 0; }
.card.center { text-align: center; }
.card h2 { font-family: var(--font); font-size: 24px; margin: 4px 0 10px; line-height: 1.15; }
.kicker { font-family: var(--font); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--yellow); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.foot { color: var(--muted); font-size: 12px; margin: 14px 0 0; line-height: 1.5; }
.note { background: rgba(255,198,25,.1); border-left: 3px solid var(--yellow); padding: 8px 10px; border-radius: 6px; font-size: 13px; color: #e8e2d2; }

.logo { font-family: var(--font); font-size: 64px; font-weight: 800; letter-spacing: .04em; line-height: .95; margin-top: 18px; }
.logo span { display: block; color: var(--char); background: var(--yellow); width: max-content; margin: 6px auto 0; padding: 0 16px; border-radius: 6px; transform: skew(-8deg); }
.tag { font-size: 17px; margin: 14px 0 6px; }
.pipe-art { height: 70px; margin: 10px auto 14px; max-width: 260px; background:
  linear-gradient(#f4f4ef, #f4f4ef) 20px 8px / 14px 44px no-repeat,
  linear-gradient(#f4f4ef, #f4f4ef) 20px 44px / 180px 14px no-repeat,
  linear-gradient(#f4f4ef, #f4f4ef) 186px 44px / 14px 26px no-repeat,
  linear-gradient(#e0473d, #e0473d) 60px 16px / 150px 8px no-repeat,
  linear-gradient(#3d7de0, #3d7de0) 60px 28px / 150px 8px no-repeat; }

input[type=search] { width: 100%; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--char); color: var(--text); font-size: 17px; padding: 0 14px; margin: 6px 0 10px; }
.state-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.state-btn { text-align: left; min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--char3); padding: 6px 10px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.state-btn small { font-family: var(--font); font-size: 11px; color: var(--yellow); flex: none; }
.state-btn:active, .state-btn:focus-visible { border-color: var(--yellow); }
.state-badge { font-family: var(--font); font-size: 40px; font-weight: 800; color: var(--yellow); }
.big-line { font-size: 18px; line-height: 1.4; margin: 8px 0; }
.big-line b { color: var(--yellow); font-family: var(--font); }

.ticket-head { display: flex; gap: 12px; align-items: center; }
.bubble { background: var(--paper); color: #222; border-radius: 14px; padding: 12px 14px; margin: 12px 0 8px; font-size: 16px; line-height: 1.45; position: relative; }
.bubble p { margin: 0; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.ticket-meta span { font-size: 12px; background: var(--char3); border-radius: 999px; padding: 4px 10px; color: #ddd; }
.ticket-meta span b { color: var(--yellow); }

.checklist { list-style: none; padding: 0; margin: 8px 0; max-height: 46vh; overflow-y: auto; }
.checklist li { display: flex; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--char3); font-size: 14px; line-height: 1.35; align-items: flex-start; }
.checklist li .mk { flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.checklist li.ok .mk { background: rgba(63,185,80,.18); color: var(--ok); }
.checklist li.bad .mk { background: rgba(255,90,79,.18); color: var(--bad); }
.checklist li.bad { cursor: pointer; }
.checklist li strong { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.checklist li.bad strong { color: #ffb3ad; }
.checklist li .show { color: var(--yellow); font-size: 12px; text-decoration: underline; }
.gus-line { display: flex; gap: 10px; align-items: center; text-align: left; background: var(--char3); border-radius: 12px; padding: 8px 10px; margin-top: 8px; }
.gus-line p { margin: 0; font-size: 15px; line-height: 1.4; }
.stamp { display: inline-block; font-family: var(--font); font-size: 34px; font-weight: 800; color: var(--ok); border: 5px solid var(--ok); border-radius: 10px; padding: 2px 16px; transform: rotate(-8deg); margin: 4px 0 6px; animation: stamp .35s ease-out; }
.stamp.red { color: var(--bad); border-color: var(--bad); }
@keyframes stamp { from { transform: rotate(-8deg) scale(2.4); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }

.stars { font-size: 44px; letter-spacing: 6px; color: var(--yellow); margin: 6px 0; }
.stars .off { color: #4b4f55; }
.pay { font-family: var(--font); font-size: 30px; font-weight: 800; color: #9be28f; }

.trade-tile { display: flex; gap: 12px; align-items: center; text-align: left; margin-top: 14px; padding: 12px; border-radius: 12px; border: 1px dashed var(--line); opacity: .6; cursor: not-allowed; }
.tt-icon { font-size: 28px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--char3); border-radius: 10px; }

.career-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.bar { height: 14px; background: var(--char); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.bar-fill { height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--yellow), var(--yellow) 10px, var(--yellow-d) 10px, var(--yellow-d) 20px); transition: width .6s; }
.job-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.job-list button { width: 100%; text-align: left; min-height: 50px; border-radius: 10px; border: 1px solid var(--line); background: var(--char3); padding: 6px 10px; display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; }
.job-list button:disabled { opacity: .45; cursor: not-allowed; }
.job-list .num { font-family: var(--font); font-weight: 800; color: var(--yellow); font-size: 18px; }
.job-list .t { font-size: 15px; }
.job-list .t small { display: block; color: var(--muted); font-size: 12px; }
.job-list .st { color: var(--yellow); letter-spacing: 1px; font-size: 14px; }
.rank-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.rank-tile { text-align: center; border-radius: 10px; border: 1px solid var(--line); padding: 8px 4px; font-family: var(--font); font-size: 14px; color: var(--muted); }
.rank-tile.on { border-color: var(--yellow); color: var(--yellow); }
.rank-tile.locked { opacity: .5; }
.links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; }

.choices { display: grid; gap: 8px; margin: 10px 0; }
.choices button { min-height: 52px; text-align: left; border-radius: 10px; border: 1px solid var(--line); background: var(--char3); padding: 8px 12px; font-size: 16px; }
.choices button.right { border-color: var(--ok); background: rgba(63,185,80,.18); }
.choices button.wrong { border-color: var(--bad); background: rgba(255,90,79,.18); }

.license { margin: 12px auto 4px; max-width: 360px; border-radius: 14px; padding: 14px; text-align: left; color: #1d1f22; background: linear-gradient(135deg, #fff6d6, #ffe07a); border: 3px solid var(--yellow-d); box-shadow: 0 6px 18px rgba(0,0,0,.35); font-family: var(--font); }
.license .l1 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.license .l2 { font-size: 22px; font-weight: 800; margin: 2px 0; }
.license .l3 { font-size: 13px; }
.license .l4 { font-size: 10px; margin-top: 8px; opacity: .7; font-family: var(--body); }

.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet-card { width: 100%; max-width: 560px; background: var(--char2); border-top: 3px solid var(--yellow); border-radius: 16px 16px 0 0; padding: 14px 14px max(14px, env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; }
.sheet-card h3 { font-family: var(--font); margin: 0 0 2px; font-size: 20px; }
.sheet-card p { margin: 0 0 8px; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pick { min-height: 64px; border-radius: 10px; border: 1px solid var(--line); background: var(--char3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; font-size: 13px; text-align: center; }
.pick svg { width: 40px; height: 34px; }
.pick small { color: var(--muted); font-size: 11px; }
.pick.on { border-color: var(--yellow); background: rgba(255,198,25,.14); }

@media (min-width: 900px), (min-height: 820px) {
  .gus-bubble p { max-height: 6.8em; }
}
@media (min-width: 900px) {
  #work { border-left: 1px solid var(--char3); border-right: 1px solid var(--char3); }
  .tool { max-width: 110px; }
}
@media (max-height: 600px) {
  .gus-face { width: 36px; height: 36px; }
  .tool { height: 50px; }
}
