/* Standalone VM runner (app/views/runner/index.html.erb). Uses the .app-shell
   body archetype + shared toolbar (.nv-header / .nv-brand / .nv-header-actions)
   and .nv-panel surface from application.css; only runner-specific widgets are
   here. The 240x240 display and lit LEDs are dark on purpose: device hardware. */

/* The vm-runner wrapper is the shell's flex column (the editor uses .nv-app's
   grid instead). Its window keydown/keyup handlers reach the controller. */
.nv-runner {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* The editor sizes .nv-header via the .nv-app grid row; the runner has no grid,
   so give the header the shell height itself (its padding is horizontal only). */
.nv-runner .nv-header {
  min-height: var(--nv-header-h);
  flex-shrink: 0;
}

.runner-main {
  flex: 1;
  display: flex;
  gap: 1rem;
  padding: 1rem;
  min-height: 0;
}

.runner-side {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

/* Console: title bar + scrolling output, fills the middle column. */
.runner-console {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--nv-border);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#console-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
  margin: 0;
  font-family: var(--nv-mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  background-color: var(--nv-panel);
  color: var(--nv-text);
}

/* Emulated hardware screen — black is device output, not page chrome. */
.display-container {
  background-color: black;
  border-radius: 4px;
  padding: 10px;
  box-shadow: inset 0 0 20px rgba(var(--bs-black-rgb), 0.5);
}

#display-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.scale-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* GPIO d-pad */
.gpio-row {
  display: flex;
  gap: 0.25rem;
}

.gpio-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--nv-border);
  background-color: var(--nv-bg);
  color: var(--nv-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
  font-size: 1.2rem;
  user-select: none;
}

.gpio-btn:hover {
  border-color: var(--nv-accent);
  background-color: rgba(var(--bs-primary-rgb), 0.1);
}

.gpio-btn:active,
.gpio-btn.pressed {
  background-color: var(--nv-accent);
  border-color: var(--nv-accent);
  color: white;
  transform: scale(0.95);
}

.gpio-btn-center {
  width: 60px;
  height: 60px;
  font-size: 1.4rem;
}

.gpio-spacer {
  width: 50px;
  height: 50px;
}

/* LEDs — grey unlit, green glow lit (device hardware). */
.led-row {
  display: flex;
  gap: 0.5rem;
}

.led {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--bs-gray-500);
  background-color: var(--nv-led-off);
  transition: all 0.1s;
  box-shadow: inset 0 2px 4px rgba(var(--bs-black-rgb), 0.15);
}

.led.on {
  background-color: var(--nv-led-on);
  box-shadow: 0 0 10px var(--nv-led-on), 0 0 20px var(--nv-led-on), inset 0 -2px 4px rgba(var(--bs-black-rgb), 0.3);
  border-color: var(--nv-led-on-border);
}

.led-label {
  font-size: 0.6rem;
  color: var(--nv-muted);
  text-align: center;
  width: 20px;
}

/* File drop zone */
.file-drop-zone {
  border: 2px dashed var(--nv-border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: var(--nv-muted);
  transition: all 0.2s;
  cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: var(--nv-accent);
  background-color: rgba(var(--bs-primary-rgb), 0.06);
}

.file-drop-zone i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* VM state rows (.vm-state-*, not .status-* — that's the editor footer's). */
.vm-stat {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.875rem;
}

.vm-stat-label {
  color: var(--nv-muted);
}

.vm-stat-value {
  font-family: var(--nv-mono);
  color: var(--bs-success);
}

#speed-slider {
  width: 100px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--bs-white-rgb), 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-overlay.hidden {
  display: none;
}
