/* Ore Else — shared look for splash, TV and phones. Asteroid mining at the
   cheap end: hazard yellow on rock, printed-circuit green, warning red. */
:root {
  --bg: #16181a; --panel: #212527; --panel2: #2b3033; --ink: #e6e3d8; --dim: #8e968f;
  --gold: #d9b64a; --amber: #e0863f; --rust: #a8482f; --circuit: #6fbf8e; --ice: #62a8c4;
  --ore: #cf9b52; --metal: #b9c4cc; --night: #3a4a63; --day: #d9b64a;
  --ok: #6fbf8e; --bad: #c4553f;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Oswald", Impact, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: 1px; }
h1 { color: var(--gold); font-size: 44px; line-height: 1; text-transform: uppercase; }
h2 { color: var(--circuit); font-size: 24px; text-transform: uppercase; }
button { background: var(--panel2); border: 1px solid #3b4245; color: var(--ink); padding: 10px 14px;
  border-radius: 8px; font: inherit; font-size: 15px; cursor: pointer; }
button.primary { background: var(--gold); border-color: var(--gold); color: #201a06; font-weight: 700; }
button.go { background: var(--circuit); border-color: var(--circuit); color: #0c1f16; font-weight: 700; }
button:disabled { opacity: .3; cursor: default; }
button.sel { outline: 2px solid var(--gold); outline-offset: 2px; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--panel2); color: var(--ink); border: 1px solid #3b4245; }
.muted { color: var(--dim); }
.tagg { color: var(--dim); font-size: 13px; margin-left: 6px; }
.ore { color: var(--ore); } .metal { color: var(--metal); } .pts { color: var(--gold); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(140px); background: var(--gold);
  color: #201a06; padding: 10px 18px; border-radius: 8px; transition: transform .25s; z-index: 50; max-width: 92vw; font-weight: 600; }
#toast.show { transform: translateX(-50%) translateY(0); }
#conn { position: fixed; top: 8px; right: 8px; background: var(--rust); color: #fff; padding: 4px 10px; border-radius: 8px;
  font-size: 13px; display: none; z-index: 60; }
#conn.show { display: block; }

/* ---- the firmware grid ----------------------------------------------------
   A card is a rounded tile with its exits drawn as labelled arrows on the
   correct edges. Exits are never colour alone — every arrow carries its
   label, because YES and NO on the same card decide the whole program. */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap, 6px); }
.cell { position: relative; aspect-ratio: 1 / 1.12; border-radius: 8px; background: #1b1f21;
  border: 1px dashed #333a3c; display: flex; align-items: center; justify-content: center; }
.cell.empty::after { content: attr(data-slot); color: #3b4245; font-family: var(--mono); font-size: .8em; }
.card { position: absolute; inset: 0; border-radius: 8px; background: var(--panel2); border: 1px solid #454d50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12% 8%;
  text-align: center; overflow: hidden; }
.card .nm { font-family: var(--display); font-size: .82em; line-height: 1; text-transform: uppercase; letter-spacing: .5px; }
.card .sub { font-family: var(--mono); font-size: .62em; color: var(--dim); }
.card.process { border-left: 3px solid var(--circuit); }
.card.sensor  { border-left: 3px solid var(--ice); }
.card.counter { border-left: 3px solid var(--amber); }
.card.module  { border-left: 3px solid var(--gold); background: #2f2a1c; }
.card.boot    { border-left: 3px solid var(--dim); }
.card.bugged  { outline: 2px solid var(--bad); outline-offset: -2px; }
.card.bugged::before { content: "BUG"; position: absolute; top: 2px; right: 3px; font-family: var(--mono);
  font-size: .55em; color: var(--bad); font-weight: 700; }
.card.ghostbp { background: repeating-linear-gradient(45deg, #24282a, #24282a 6px, #1e2224 6px, #1e2224 12px); border-style: dashed; }
.pips { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.pip { width: .34em; height: .34em; border-radius: 50%; background: var(--ore); }
.pip.off { background: #3b4245; }
/* exit arrows, one per edge */
.ex { position: absolute; font-family: var(--mono); font-size: .55em; font-weight: 700; color: var(--circuit); line-height: 1; }
.ex.E { right: 1px; top: 50%; transform: translateY(-50%); }
.ex.W { left: 1px; top: 50%; transform: translateY(-50%); }
.ex.N { top: 0; left: 50%; transform: translateX(-50%); }
.ex.S { bottom: 0; left: 50%; transform: translateX(-50%); }
.ex.no { color: var(--rust); } .ex.yes { color: var(--circuit); } .ex.done { color: var(--amber); }
.pawn { position: absolute; left: 3px; top: 3px; width: 1.1em; height: 1.1em; border-radius: 50%;
  background: var(--gold); color: #201a06; font-size: .6em; display: flex; align-items: center;
  justify-content: center; font-weight: 700; box-shadow: 0 0 0 2px #16181a; z-index: 3; }
.cell.ghost { box-shadow: inset 0 0 0 2px var(--ice); }
.cell.ghost::before { content: attr(data-ghost); position: absolute; right: 2px; bottom: 1px; z-index: 4;
  font-family: var(--mono); font-size: .6em; color: var(--ice); }
.cell.ping { animation: ping 1.2s ease-out 2; }
@keyframes ping { 0%,100% { box-shadow: none } 50% { box-shadow: 0 0 0 3px var(--gold) } }
.bar { height: 10px; border-radius: 5px; background: #2b3033; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); }
.vein { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #2b3033; }
.vein span { display: block; }
.clockrow { display: flex; gap: 4px; align-items: stretch; flex-wrap: wrap; }
.ev { border-radius: 6px; padding: 4px 6px; background: var(--panel2); font-family: var(--mono); font-size: .72em;
  min-width: 2.2em; text-align: center; border-top: 3px solid var(--dim); }
.ev.day { border-top-color: var(--day); } .ev.night { border-top-color: var(--night); }
.ev.hazard { box-shadow: inset 0 0 0 1px var(--bad); }
.ev.back { color: #4c5456; }
.ev.now { background: var(--gold); color: #201a06; font-weight: 700; }
