/* The computer page. It uses the tokens and the device panel styles of ../editor/style.css. */
body { grid-template-columns: 300px 1fr; grid-template-rows: auto 1fr; }
#top .sep { width: 12px; }
#top label { display: inline-flex; gap: 4px; align-items: center; }
a.btnlink { display: inline-block; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); text-decoration: none; background: var(--panel); }
a.btnlink:hover { border-color: var(--accent); }

#panel { border-right: 1px solid var(--line); }
#panel section { margin-bottom: 10px; }
.leds, .switches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 6px 0; }
.leds span { display: block; height: 18px; border-radius: 50%; background: var(--led-off); border: 1px solid var(--stroke); position: relative; }
.leds span.on { background: var(--led-on); box-shadow: 0 0 8px var(--led-on); }
.leds span.x { background: none; border-style: dashed; }
.leds span::after, .switches button::after { content: attr(data-n); position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.leds { margin-bottom: 16px; }
.switches button { position: relative; height: 30px; padding: 0; background: var(--v0); border-color: var(--stroke); }
.switches button.on { background: var(--v1); }
.switches button::before { content: ''; position: absolute; left: 3px; right: 3px; height: 10px; background: #fff; border-radius: 2px; bottom: 3px; transition: bottom .1s; }
.switches button.on::before { bottom: 15px; }
.switches { margin-bottom: 18px; }
#btn-irq.held { background: var(--accent); color: #fff; }

table.regs { width: 100%; border-collapse: collapse; font-size: 12px; }
table.regs td { padding: 1px 4px; border-bottom: 1px solid var(--line); }
table.regs td.n { color: var(--muted); width: 56px; white-space: nowrap; }
table.regs td.chg { color: var(--accent); font-weight: 600; }
.flags { display: flex; gap: 8px; margin: 6px 0; font-size: 12px; }
.flags span { padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); }
.flags span.on { color: #fff; background: var(--accent); border-color: var(--accent); }
ol.code { list-style: none; margin: 0; padding: 0; font-size: 12px; }
ol.code li { display: grid; grid-template-columns: 52px 1fr; gap: 6px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
ol.code li.pc { background: color-mix(in srgb, var(--accent) 22%, var(--panel)); }
ol.code li .lbl { color: var(--accent); }
ol.code li .a { color: var(--muted); }

#machine { position: relative; overflow: auto; padding: 10px; background: var(--bg); }
#machine #devpanel { position: static; width: auto; max-width: 900px; margin: 0 auto; box-shadow: none; }

/* Workbench: a panel that floats over the right side. It does not change the layout. */
#workbench { position: fixed; top: 44px; right: 8px; bottom: 8px; width: min(760px, calc(100vw - 330px)); z-index: 5; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgb(0 0 0 / .35); padding: 8px 10px; gap: 6px; }
#workbench[hidden] { display: none; }
#workbench header { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#workbench .ed { flex: 1; min-height: 120px; display: grid; grid-template-columns: auto 1fr; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg); }
#workbench .gutter { margin: 0; padding: 6px 6px 6px 8px; text-align: right; color: var(--muted); font: 12px/18px ui-monospace, Consolas, monospace; overflow: hidden; user-select: none; background: var(--panel); border-right: 1px solid var(--line); min-width: 40px; }
#workbench .gutter .bad { color: #fff; background: var(--err); }
#workbench textarea { border: 0; resize: none; padding: 6px 8px; font: 12px/18px ui-monospace, Consolas, monospace; background: var(--bg); color: var(--ink); white-space: pre; overflow: auto; tab-size: 8; outline: none; }
#workbench .out { max-height: 34%; overflow: auto; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-size: 12px; }
#workbench .out pre { margin: 0; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre; }
#workbench .out li[data-line] { cursor: pointer; color: var(--err); }
#workbench .files { width: 100%; border-collapse: collapse; font-size: 12px; }
#workbench .files td, #workbench .files th { border-bottom: 1px solid var(--line); padding: 2px 4px; text-align: left; }
#workbench .tabs { display: flex; gap: 2px; }
#workbench .tabs button.active { background: var(--bg); font-weight: 600; }

#toast { bottom: 24px; }

@media (max-width: 760px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; overflow: auto; height: auto; }
  #workbench { left: 8px; width: auto; }
}
