/* Algo Tycoon — Swiss / Teenage Engineering instrument layout.
   Paper #F4F4F0, ink #141414, mechanical orange #FF5200, 1px #C9C9C2. */

:root {
  --paper: #F4F4F0;
  --panel: #ECECE6;
  --panel2: #FFFFFF;
  --ink: #141414;
  --line: #C9C9C2;
  --muted: #8B8B85;
  --orange: #FF5200;
  --ok: #1E7A3C;
  --warn: #B04000;
  --font: -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--paper); color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }

/* header */
.bar {
  display: flex; gap: 14px; align-items: center;
  background: var(--panel2); border-bottom: 1px solid var(--line);
  padding: 10px 16px; position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.brand .mark { width: 20px; height: 20px; background: var(--orange); position: relative; border: 1px solid var(--ink); }
.brand .mark::after { content: ""; position: absolute; left: 5px; top: 5px; width: 8px; height: 8px; background: var(--ink); border-radius: 50%; }
.hud { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.gauge {
  font-family: var(--mono); font-size: 11px; border: 1px solid var(--line);
  background: var(--panel); padding: 4px 9px; border-radius: 3px;
}
.gauge b { color: var(--orange); }
.chip { margin-left: 8px; padding: 4px 10px; border: 1px solid var(--ink); background: var(--paper); border-radius: 3px; font-weight: 700; }
.chip-pro { background: var(--orange); }

/* layout grid */
.desk { display: grid; grid-template-columns: 250px 1fr 280px; gap: 14px; padding: 16px; max-width: 1280px; margin: 0 auto; }
@media (max-width: 1020px) { .desk { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 12px; }

.panel {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 12px;
  position: relative;
}
.panel h3 { margin: 0 0 9px; font: 700 11px/1 var(--mono); letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }

/* job list */
.act-head { font-size: 10px; letter-spacing: 0.12em; color: var(--muted); margin: 10px 0 6px; }
.act-head:first-child { margin-top: 0; }
.job {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid var(--line); background: var(--paper); border-radius: 4px;
  padding: 8px 10px; margin-bottom: 6px; text-align: left;
}
.job:hover { border-color: var(--ink); }
.job.sel { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.job.locked { opacity: 0.45; cursor: not-allowed; }
.job.solved { background: var(--panel); }
.job .jpay { font-weight: 700; color: var(--orange); min-width: 64px; }
.job .jtitle { flex: 1; font-size: 12.5px; }
.job .jmark { color: var(--ok); font-weight: 700; font-size: 10px; }

/* stream + pipeline */
.stream { display: flex; flex-wrap: wrap; gap: 5px; }
.val {
  font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--line);
  border-radius: 3px; padding: 3px 6px; background: var(--paper);
}
.val.pos { background: #E5F0E7; }
.val.neg { background: #F7E7DD; }
.target { font-family: var(--mono); font-size: 15px; font-weight: 700; margin-top: 8px; }
#job-title { font-size: 16px; font-weight: 750; margin-bottom: 2px; }
#job-brief { color: #3a3a35; margin: 6px 0 10px; max-width: 74ch; }

.pipeline { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.slot {
  min-width: 76px; min-height: 44px; border: 1px dashed var(--line); border-radius: 5px;
  background: var(--paper); font-family: var(--mono); font-size: 10.5px; color: var(--muted);
}
.slot.filled { border: 1px solid var(--ink); background: var(--orange); color: var(--ink); font-weight: 700; }
.library { display: flex; flex-wrap: wrap; gap: 6px; }
.card {
  border: 1px solid var(--ink); background: var(--panel); border-radius: 4px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  padding: 7px 9px; font-weight: 700;
}
.card:hover { background: var(--orange); }
.actions { display: flex; gap: 8px; margin-top: 12px; }
.btn {
  border: 1px solid var(--ink); background: var(--panel); border-radius: 4px;
  font: 700 11px/1 var(--mono); letter-spacing: 0.1em; padding: 10px 14px;
}
.btn:hover { background: var(--orange); }
.btn.primary { background: var(--orange); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; }
.verdict { min-height: 18px; margin-top: 10px; font-size: 11.5px; }
.verdict.ok { color: var(--ok); font-weight: 700; }
.verdict.warn { color: var(--warn); font-weight: 700; }

/* research */
.rnode {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--line); background: var(--paper); border-radius: 4px;
  padding: 8px 10px; margin-bottom: 6px;
}
.rnode:hover { border-color: var(--ink); }
.rnode.owned { background: var(--panel); opacity: 0.75; }
.rnode .rlabel { display: block; font: 700 11px var(--mono); letter-spacing: 0.08em; }
.rnode .rdesc { display: block; font-size: 11px; color: #3a3a35; margin: 2px 0; }
.rnode .rcost { color: var(--orange); font-weight: 700; }

/* pro-only panels hidden until unlocked */
body:not(.pro) .pro-only { display: none; }

/* ticker */
.ticker {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px;
  background: var(--panel2); white-space: nowrap; overflow: hidden;
}

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(20,20,20,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-box { width: 380px; background: var(--paper); border: 1px solid var(--ink); border-radius: 6px; padding: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head b { font: 700 12px var(--mono); letter-spacing: 0.12em; }
.modal .x { background: none; border: none; font-size: 18px; }
.pay { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 8px; font-family: var(--mono); font-size: 10.5px; margin: 10px 0; }
.pay code { background: var(--paper); border: 1px solid var(--line); border-radius: 2px; padding: 1px 4px; }
input#tx-in, input#key-in, input#sb-seed, input#sb-n, input#sb-ops {
  width: 100%; border: 1px solid var(--ink); border-radius: 4px; padding: 8px; font: 11px var(--mono); background: var(--panel2);
}
.pro-status { min-height: 16px; color: var(--muted); font-size: 10.5px; }
.fine { color: var(--muted); font-size: 10.5px; }

/* sandbox & editor */
.sbx { display: grid; gap: 8px; }
.sbx label { font: 700 10px var(--mono); letter-spacing: 0.08em; color: var(--muted); }
.out-block { font-family: var(--mono); font-size: 11px; min-height: 22px; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }

/* tests (only ?test=1) */
#tests { display: none; max-width: 900px; margin: 10px auto 40px; padding: 0 16px; }
body.testing #tests { display: block; }
#tests .panel { border-color: var(--ink); }
.t-sum { font-family: var(--mono); font-size: 13px; margin-bottom: 10px; }
.t-sum.fail { color: var(--warn); }
.t-sum.pass { color: var(--ok); }
.case { font-family: var(--mono); font-size: 10.5px; padding: 3px 0; border-bottom: 1px dashed var(--panel); }
.case.pass::before { content: "PASS "; color: var(--ok); font-weight: 700; }
.case.fail::before { content: "FAIL "; color: var(--warn); font-weight: 700; }

.foot { border-top: 1px solid var(--line); background: var(--panel); padding: 12px 16px; font: 10.5px var(--mono); color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
