:root {
  color-scheme: dark;
  --bg: #171e2a;
  --panel: #1d2634;
  --surface: #242f40;
  --inset: #192230;
  --border: #394559;
  --line: #303c4f;
  --text: #f4eee3;
  --muted: #a7b1c4;
  --soft: #8c9ab0;
  --yellow: #f3cf79;
  --mint: #83d9b6;
  --red: #ff9c89;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 280px;
  color: var(--text);
  background: radial-gradient(ellipse at 23% 0, #282e3e, transparent 64%),
    repeating-linear-gradient(0deg, transparent 0 3px, #12182426 3px 4px), var(--bg);
  font: 14px/1.5 var(--body);
}
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.shell { max-width: 1280px; margin: auto; padding: 26px 28px 12px; }
.masthead, .brand, .header-actions, .panel-head { display: flex; align-items: center; }
.masthead { justify-content: space-between; gap: 14px; margin-bottom: 21px; }
.brand { gap: 16px; }
.brand-mark {
  width: 54px; height: 54px; display: grid; place-items: center; flex-shrink: 0;
  border: 2px solid var(--yellow); background: #363141; box-shadow: 4px 4px #101620;
  color: var(--yellow);
}
.brand-mark svg { width: 32px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.eyebrow { color: var(--yellow); font: 700 10px/1.4 var(--mono); letter-spacing: .15em; }
.eyebrow > span { color: var(--soft); }
h1 { font-size: clamp(27px, 4vw, 39px); font-weight: 900; line-height: 1.22; letter-spacing: .045em; }
h1 > span { color: var(--yellow); margin-left: 3px; }
.header-actions { gap: 10px; }
.company, .icon-button, .count, .status {
  border: 1px solid var(--border); background: #222d3d; color: var(--muted); font: 700 12px var(--mono);
}
.company { padding: 9px 12px; white-space: nowrap; color: var(--yellow); }
.icon-button { width: 35px; height: 35px; font-size: 17px; }
.icon-button:hover { border-color: var(--yellow); color: var(--yellow); }
.sound-toggle[aria-pressed="true"] { color: var(--yellow); border-color: #9e8054; background: #393341; }
.dialog-note a { color: var(--yellow); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 15px; }
.metric { min-width: 0; display: block; text-align: left; border: 1px solid var(--border); background: var(--panel); padding: 10px 13px 12px; }
.metric-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 700; font-size: 12px; white-space: nowrap; }
.metric-label kbd { margin-left: auto; }
[data-icon] { display: inline-flex; align-items: center; flex-shrink: 0; color: var(--yellow); }
[data-icon] svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.metric-value { font: 800 clamp(22px, 3.5vw, 29px)/1.1 var(--mono); margin: 6px 0; letter-spacing: -.04em; white-space: nowrap; }
.clock-metric .metric-value { color: var(--yellow); }
.metric-value small { color: var(--muted); font: 700 11px var(--body); letter-spacing: 0; }
.metric-note { color: var(--muted); font: 11px/1.2 var(--mono); }
.meter { height: 5px; background: #141e2b; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--mint); transition: width .16s linear; }
.clock-meter i { background: var(--yellow); }
.crunch { background: #282a39; }
.crunch .metric-value, .crunch .metric-icon { color: #e6b4e3; }
.crunch-meter i { background: #bd83bb; }
.crunch.charged, .crunch.active { border-color: var(--yellow); background: #3b3340; }
.crunch.charged .metric-value, .crunch.active .metric-value { color: var(--yellow); }
.crunch.charged:hover { box-shadow: inset 0 0 0 1px var(--yellow); }
.danger { color: var(--red) !important; }

.workbench { display: grid; grid-template-columns: minmax(0, 2.24fr) minmax(300px, 1fr); gap: 13px; align-items: stretch; }
.panel { background: var(--panel); border: 1px solid var(--border); box-shadow: 0 3px #111822; min-width: 0; }
.panel-head { justify-content: space-between; gap: 8px; padding: 10px 13px 9px; }
.panel-head .eyebrow { margin-bottom: 2px; }
.panel-head .index { color: var(--yellow); margin-right: 4px; }
h2 { font-size: 21px; line-height: 1.25; letter-spacing: .05em; }
.status, .count { padding: 5px 8px; white-space: nowrap; }
.status i { display: inline-block; width: 6px; height: 6px; background: var(--yellow); margin: 0 3px 1px 0; }
.status.live { color: var(--mint); }
.status.live i { background: var(--mint); box-shadow: 0 0 8px #83d9b65c; }
.studio { position: relative; align-self: stretch; display: flex; flex-direction: column; }
.scene { position: relative; margin: 0 9px; border: 1px solid #151a28; background: #3a3548; flex: 1; align-content: center; }
.scene canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.scene-top { position: absolute; inset: 7px 7px auto; display: flex; justify-content: space-between; pointer-events: none; color: #f0dbc9; font: 700 10px var(--mono); letter-spacing: .12em; }
.scene-top span { background: #201e2bc9; padding: 4px 5px; }
.scene-controls { position: absolute; bottom: 12px; right: 12px; }
.primary {
  background: var(--yellow); color: #272230; font-weight: 900; border: 1px solid #ffe3a2;
  padding: 9px 14px; min-height: 40px; box-shadow: 3px 3px #141724;
}
.primary:hover { background: #ffe4a1; }
.primary:disabled { opacity: .5; }
.primary span { margin-left: 8px; font-family: var(--mono); font-size: 12px; }
.primary.quiet { min-height: 33px; padding: 5px 9px; color: var(--text); background: #282538; border-color: #8c768c; }
.primary.quiet span { margin: 0 4px 0 0; }
.hotspot { position: absolute; border: 1px solid transparent; background: transparent; }
.hotspot:enabled:hover, .hotspot.selected { border: 1px dashed #f3cf79aa; background: #f3cf7916; }
.ticker { display: flex; gap: 9px; align-items: center; min-height: 36px; padding: 7px 11px; color: #c2c9d4; font-size: 12px; }
.ticker-label { flex-shrink: 0; color: var(--yellow); background: #333143; padding: 2px 6px; font-weight: 700; font-size: 10px; }

.projects { display: flex; flex-direction: column; }
.jobs { flex: 1; display: grid; grid-template-rows: repeat(4, minmax(64px, 1fr)); gap: 5px; padding: 0 9px; }
.job {
  --type: var(--muted);
  text-align: left; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px;
  padding: 6px 7px; border: 1px solid var(--line); background: var(--inset); align-content: center;
}
.job:enabled:hover, .employee:hover { border-color: #788399; background: var(--surface); }
.job.selected, .employee.selected { border-color: var(--yellow); background: #333344; box-shadow: inset 0 0 0 1px #f3cf7960; }
.job.incident { border-color: var(--red); }
.job.vacant { border-style: dashed; background: #1c2634; color: var(--soft); }
.job-number { align-self: start; display: grid; place-items: center; height: 25px; color: var(--type); background: #2a3548; font: 700 11px var(--mono); }
.vacant .job-number { background: #242f40; color: var(--soft); }
.job-content { min-width: 0; }
.job-row, .job-meta, .job-detail, .job-progress { display: flex; align-items: center; gap: 6px; }
.job-row, .job-meta { justify-content: space-between; }
.job-row strong { font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.job-detail, .job-meta { font-size: 10px; color: var(--muted); }
.job-detail { margin-top: 1px; }
.job-detail > :last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-type { flex-shrink: 0; color: var(--type); font-weight: 700; }
.job-progress { color: var(--type); font: 700 9px var(--mono); margin-top: 3px; }
.job-progress .meter { flex: 1; background: #2c3749; height: 4px; }
.job-progress .meter i { background: var(--type); }
.job-meta > :last-child { font-family: var(--mono); font-weight: 700; }
.queue-hint { display: flex; align-items: center; gap: 5px; min-height: 36px; padding: 7px 10px; color: var(--muted); font-size: 11px; }
.queue-hint svg { width: 13px; height: 13px; }
kbd { color: var(--muted); background: #2b3648; border: 1px solid #414d60; padding: 1px 4px; font: 700 10px/1.1 var(--mono); }

.team { margin-top: 14px; }
.team-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.team-label b { color: var(--mint); font-family: var(--mono); }
.team-separator { color: #7f8a9d; }
.roster { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 0 9px 9px; }
.employee { text-align: left; min-width: 0; background: var(--inset); border: 1px solid var(--line); padding: 7px; }
.employee.recommended { border-color: var(--mint); }
.employee.selected { border-color: var(--yellow); }
.employee-top { display: flex; align-items: center; gap: 6px; }
.employee canvas { width: 41px; height: 42px; flex: 0 0 41px; display: block; image-rendering: pixelated; border: 1px solid #435068; }
.employee-info { flex: 1; min-width: 0; }
.employee-info strong { font-size: 15px; }
.employee-info span { display: block; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.employee-top kbd { align-self: start; }
.skills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; margin-top: 6px; }
.skills span { text-align: center; display: grid; gap: 1px; min-width: 0; background: #293548; padding: 3px 0 4px; }
.skills small { font-size: 9px; color: var(--muted); white-space: nowrap; }
.skills b { font: 700 12px var(--mono); color: #e8e9ea; }
.energy-label { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin: 5px 0 2px; }
.energy-label b { font: 700 10px var(--mono); color: var(--mint); }
.busy .employee-info span { color: var(--yellow); }
.tired .energy-label b { color: var(--red); }
.tired .meter i { background: var(--red); }
.rest { border: 1px solid #917851; background: #342e3e; color: var(--yellow); font-size: 11px; padding: 3px 6px; }
.rest:hover { border-color: var(--yellow); }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; color: var(--soft); font-size: 10px; }
.footer b { color: var(--yellow); margin: 0 3px; }
.footer kbd { margin: 0 2px 0 7px; }

.event-card { position: fixed; z-index: 20; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(450px, calc(100vw - 24px)); padding: 14px 16px; border: 2px solid var(--red); background: #252638; box-shadow: 0 9px 30px #0f111bcc; }
.event-label { display: flex; justify-content: space-between; align-items: center; color: var(--red); font: 700 13px var(--mono); letter-spacing: .07em; }
.event-label b { font-size: 17px; }
.event-card > strong { display: block; margin: 4px 0 2px; font-size: 22px; }
.event-card p { color: var(--text); font-size: 14px; margin: 0 0 10px; }
.event-card .event-project { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.event-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.event-actions button { flex: 1 1 auto; min-height: 40px; padding: 7px 9px; background: #393245; color: var(--text); border: 1px solid #7d657b; font-size: 13px; }
.event-actions button:hover { border-color: var(--red); }
.event-actions button:disabled { opacity: .5; }
dialog { width: min(450px, calc(100vw - 24px)); background: #242e3f; color: var(--text); padding: 22px; border: 2px solid var(--yellow); box-shadow: 7px 7px #101620; }
dialog::backdrop { background: #111723be; }
dialog h2 { margin: 5px 0 8px; font-size: 25px; }
dialog h2 small { color: var(--yellow); font: 700 13px var(--mono); }
dialog p { color: var(--muted); font-size: 13px; }
dialog .eyebrow { color: var(--yellow); font: 700 10px var(--mono); }
.dialog-close { position: absolute; right: 8px; top: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 700 17px var(--mono); width: 30px; height: 30px; }
.help-list { padding-left: 22px; color: var(--muted); }
.help-list li { margin: 7px 0; }
.help-list b { color: var(--text); }
.perk { margin: 10px 0; background: var(--inset); padding: 8px 10px; border-left: 2px solid var(--yellow); }
.dialog-note { margin: 9px 0; }
.receipt { margin: 12px 0; background: var(--inset); padding: 8px 11px; }
.receipt div { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.receipt dd { font: 700 13px var(--mono); color: var(--text); margin: 0; }
.receipt .receipt-total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 7px; color: var(--yellow); }
.receipt-total dd { color: var(--yellow); }

@media (max-width: 1000px) {
  .shell { padding: 20px 15px 8px; }
  .workbench { grid-template-columns: minmax(0, 1.75fr) minmax(285px, 1fr); gap: 8px; }
  .employee-top kbd { display: none; }
  .scene { flex: initial; }
  .studio .ticker { flex: 1; align-items: flex-start; }
}
@media (max-width: 760px) {
  .workbench { grid-template-columns: 1fr; }
  .metrics { gap: 6px; }
  .metric { padding: 8px; }
  .jobs { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(2, minmax(66px, 1fr)); }
  .roster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .studio .ticker { align-items: center; }
}
@media (max-width: 500px) {
  .shell { padding: 13px 9px 7px; }
  .masthead { margin-bottom: 12px; }
  .brand { gap: 9px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-mark svg { width: 24px; }
  .brand .eyebrow { font-size: 8px; letter-spacing: .07em; }
  .header-actions { gap: 4px; }
  .company { padding: 6px 4px; font-size: 9px; }
  .icon-button { width: 27px; height: 27px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 9px; }
  .metric-value { font-size: 22px; }
  .panel-head { padding: 8px 9px; }
  .panel-head h2 { font-size: 18px; }
  .scene-controls { right: 5px; bottom: 5px; }
  .primary { min-height: 34px; padding: 5px 8px; font-size: 13px; }
  .scene-top { font-size: 8px; inset: 3px 3px auto; }
  .jobs { padding-inline: 6px; }
  .job { grid-template-columns: 18px minmax(0, 1fr); padding: 5px 4px; gap: 4px; }
  .job-number { height: 19px; }
  .job-row strong { font-size: 11px; }
  .job-row kbd, .team-legend, .team-separator, .footer span:last-child { display: none; }
  .roster { padding-inline: 6px; }
  .employee { padding: 5px; }
  .employee canvas { width: 32px; height: 34px; flex-basis: 32px; }
  .employee-info strong { font-size: 13px; }
  .employee-info span { font-size: 9px; }
}
@media (max-width: 340px) {
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

.job.awaiting-payment { border-color: #ad8c56; background: #352f38; }
.job.awaiting-payment:hover, .job.awaiting-payment:focus-visible { border-color: var(--yellow); background: #453b41; }
.awaiting-payment .job-meta { color: var(--yellow); font-weight: 700; }
.hotspot.awaiting-payment { border: 1px dashed #f3cf79aa; background: #f3cf7914; }
.job.payment-received .job-meta { color: var(--mint); }
.checkout-options { padding: 0; margin: 13px 0; border: 0; }
.checkout-options legend { padding: 0; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.checkout-options > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.checkout-options label { display: flex; align-items: flex-start; gap: 6px; padding: 7px 6px; background: var(--inset); border: 1px solid var(--border); cursor: pointer; }
.checkout-options label:has(input:checked) { background: #393341; border-color: #9e8054; }
.checkout-options input { accent-color: var(--yellow); margin: 3px 0 0; }
.checkout-options b, .checkout-options small { display: block; font-size: 12px; }
.checkout-options small { color: var(--muted); font-size: 11px; }
.checkout-total { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding: 9px 0; font-size: 12px; }
.checkout-total output { font: 800 21px var(--mono); color: var(--yellow); }
#checkout-form > .primary { width: 100%; }
.job { position: relative; }
.payout-burst, .payout-card-pop { position: absolute; pointer-events: none; z-index: 2; }
.payout-burst b { position: absolute; left: 0; top: 8px; color: #ffe4a1; font: 800 16px var(--mono); white-space: nowrap; text-shadow: 2px 2px #3d2d34; animation: payout-number 1.3s ease-out both; }
.payout-card-pop { top: 73%; left: 15px; }
.payout-card-pop .payout-coin { --coin-x: 0px; }
.payout-coin { position: absolute; top: 0; left: 0; width: 14px; height: 14px; background: #ffc966; box-shadow: inset 3px 2px #ffe9a1, inset -3px -2px #b87a3d; clip-path: polygon(25% 0, 75% 0, 75% 10%, 90% 10%, 90% 25%, 100% 25%, 100% 75%, 90% 75%, 90% 90%, 75% 90%, 75% 100%, 25% 100%, 25% 90%, 10% 90%, 10% 75%, 0 75%, 0 25%, 10% 25%, 10% 10%, 25% 10%); animation: payout-coin .7s ease-out both; }
.payout-coin:nth-child(1) { --coin-x: -23px; }
.payout-coin:nth-child(2) { --coin-x: 0px; animation-delay: .06s; }
.payout-coin:nth-child(3) { --coin-x: 22px; animation-delay: .13s; }
@keyframes payout-coin {
  0% { transform: translate(-50%, 0) scale(.5); opacity: 0; }
  18% { opacity: 1; }
  48% { transform: translate(calc(-50% + var(--coin-x)), -21px) scale(1.12); }
  100% { transform: translate(calc(-50% + var(--coin-x)), 6px) scale(.6); opacity: 0; }
}
@keyframes payout-number {
  0% { transform: translate(-50%, -10px); opacity: 0; }
  19%, 65% { opacity: 1; }
  100% { transform: translate(-50%, -27px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .payout-coin, .payout-burst b { animation: none; transform: translate(-50%, -12px); }
  .payout-burst .payout-coin { display: none; }
}
