/* Computer Organization Lab – the CPU board (static/labkit/cpu-board.js).
   The layout (.dg-modes, .dg-wrap, .dg-side, .dg-board, .dg-bar) is shared with digital-board.css. */
.cp-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cp-pal-card, .cp-card { --c: #475569; border-left: 5px solid var(--c); }
.cp-pal-card { padding: 6px 12px; border-radius: 8px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #fff; font: 700 13px "JetBrains Mono", ui-monospace, monospace; cursor: grab; touch-action: none; user-select: none; }
.cp-pal-card:hover { background: #f8fafc; transform: translateY(-1px); }
.op-MOV, .op-LOAD, .op-STORE { --c: #2563eb; }
.op-ADD, .op-SUB, .op-INC, .op-DEC, .op-CMP { --c: #7c3aed; }
.op-OUT { --c: #16a34a; }
.op-JMP, .op-JZ, .op-JNZ { --c: #ea580c; }
.op-HLT { --c: #dc2626; }
.cp-layout { display: grid; grid-template-columns: minmax(230px, 270px) minmax(0, 1fr); gap: 10px; align-items: start; }
@media (max-width: 1100px) { .cp-layout { grid-template-columns: 1fr; } }
.cp-progwrap { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 8px; }
.cp-proghead { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px 6px; }
.cp-prog { list-style: none; margin: 0; padding: 0; min-height: 120px; display: flex; flex-direction: column; gap: 4px; border-radius: 10px; }
.cp-prog.is-drop { outline: 2px dashed rgb(var(--c-accent-1, 30 74 59)); outline-offset: 2px; }
.cp-empty { padding: 30px 8px; text-align: center; color: var(--muted); font-size: 14px; }
.cp-card { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 8px; background: #f8fafc; border-top: 1px solid var(--line);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font: 13px "JetBrains Mono", ui-monospace, monospace; }
.cp-card b { min-width: 44px; }
.cp-card.is-now { background: #fef3c7; box-shadow: 0 0 0 2px #f59e0b; }
.cp-card.is-before { box-shadow: 0 -3px 0 rgb(var(--c-accent-1, 30 74 59)); }
.cp-card.is-after { box-shadow: 0 3px 0 rgb(var(--c-accent-1, 30 74 59)); }
.cp-card select, .cp-card input { min-width: 0; padding: 1px 3px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
.cp-card input { width: 54px; }
.cp-card select[data-k="j"] { max-width: 120px; }
.cp-grip { cursor: grab; color: #94a3b8; touch-action: none; user-select: none; padding: 0 2px; }
.cp-n { color: #94a3b8; font-size: 11px; min-width: 14px; }
.cp-x { margin-left: auto; color: #94a3b8; padding: 0 4px; }
.cp-x:hover { color: #dc2626; }
.cp-ghost { position: fixed; z-index: 1000; pointer-events: none; opacity: .9; box-shadow: 0 10px 24px rgba(15, 23, 42, .25); transform: rotate(-2deg); }

/* the CPU drawing */
.cp-board { background: #0f172a; font-family: "JetBrains Mono", ui-monospace, monospace; }
.cp-bus { fill: none; stroke: #334155; stroke-width: 3; stroke-linejoin: round; }
.cp-bus.is-addr { stroke: #155e75; }
.cp-bus.is-ins { stroke: #854d0e; }
.cp-bus.is-data { stroke: #1e3a8a; }
.cp-head { fill: #e2e8f0; font: 700 13px Inter, system-ui, sans-serif; letter-spacing: .08em; }
.cp-head-light { fill: #c7d2fe; font: 800 15px Inter, system-ui, sans-serif; letter-spacing: .1em; }
.cp-sub { fill: #64748b; font-size: 9.5px; }
.cp-slot rect, .cp-cell rect { fill: #1e293b; stroke: #334155; }
.cp-cell rect { fill: #1c1917; stroke: #44403c; }
.cp-slot.is-now rect { fill: #78350f; stroke: #fbbf24; }
.cp-cell.is-now rect { fill: #1e3a8a; stroke: #60a5fa; }
.cp-addr { fill: #64748b; font-size: 11px; }
.cp-bytes { fill: #94a3b8; font-size: 11px; }
.cp-ins { fill: #fde68a; font-size: 11px; font-weight: 600; }
.cp-box { fill: #0b1220; stroke: #334155; stroke-width: 2; }
.cp-box.is-pc { stroke: #22d3ee; }
.cp-box.is-ctl { stroke: #a16207; }
.cp-box.is-now { stroke: #fbbf24; filter: drop-shadow(0 0 6px rgba(251, 191, 36, .6)); }
.cp-name { fill: #94a3b8; font-size: 11px; font-weight: 700; }
.cp-val { fill: #f8fafc; font-size: 18px; font-weight: 700; }
.cp-val-s { fill: #f8fafc; font-size: 14px; font-weight: 700; }
.cp-bin { fill: #64748b; font-size: 9.5px; }
.cp-phase { fill: #fbbf24; font-size: 11px; font-weight: 700; }
.cp-ins-big { fill: #fde68a; font-size: 16px; font-weight: 700; }
.cp-alu { fill: #1e1b4b; stroke: #818cf8; stroke-width: 2; }
.cp-alu.is-now { fill: #312e81; filter: drop-shadow(0 0 8px rgba(129, 140, 248, .8)); }
.cp-alu-op { fill: #e0e7ff; font-size: 13px; font-weight: 700; }
.cp-flag { fill: #1f2937; stroke: #4b5563; stroke-width: 2; }
.cp-flag.is-on { fill: #f59e0b; stroke: #fde68a; filter: drop-shadow(0 0 5px #f59e0b); }
.cp-flag-t { fill: #f8fafc; font-size: 12px; font-weight: 700; pointer-events: none; }
.cp-screen { fill: #052e16; stroke: #16a34a; stroke-width: 2; }
.cp-screen-t { fill: #4ade80; font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.cp-screen-v { fill: #86efac; font-size: 22px; font-weight: 700; }

/* packets travelling along the buses */
.cp-packet rect { fill: #fbbf24; stroke: #fff7ed; stroke-width: 1.5; filter: drop-shadow(0 0 6px rgba(251, 191, 36, .9)); }
.cp-packet.is-addr rect { fill: #22d3ee; filter: drop-shadow(0 0 6px rgba(34, 211, 238, .9)); }
.cp-packet.is-res rect { fill: #4ade80; filter: drop-shadow(0 0 6px rgba(74, 222, 128, .9)); }
.cp-packet.is-data rect { fill: #60a5fa; filter: drop-shadow(0 0 6px rgba(96, 165, 250, .9)); }
.cp-packet.is-flag rect { fill: #f59e0b; }
.cp-packet-t { fill: #0f172a; font-size: 11px; font-weight: 800; text-anchor: middle; }
