/**
 * Whole-page chrome shared by every machine: a control bar that's a
 * hamburger-triggered dropdown on narrow screens (it would eat too much
 * vertical space as a permanent top bar on a phone) and a permanent
 * left-side sidebar once there's enough width to spare (every machine's
 * display is closer to square than widescreen, so a top bar wastes width
 * that would otherwise go to the screen). Each shell's index.html just
 * needs: <body class="mx-app">, a hamburger button, #toolbar, and a
 * .mx-main > .mx-canvas-wrap > canvas structure — see machines/cpc/index.html.
 */
html, body.mx-app {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #111;
}
body.mx-app {
  display: flex;
  flex-direction: column;
  font-family: monospace;
}

.mx-hamburger {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 30;
  width: 40px;
  height: 40px;
  font-size: 18px;
  background: #262842;
  color: #edebf5;
  border: 1px solid #565a82;
  border-radius: 4px;
  cursor: pointer;
}

.mx-toolbar {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  padding: 56px 16px 16px;
  background: #1a1b2e;
  border-bottom: 2px solid #43456a;
  font-family: monospace;
  font-size: 14px;
  color: #edebf5;
  max-height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}
.mx-toolbar.mx-open {
  display: flex;
}
.mx-toolbar .mx-field {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mx-toolbar select,
.mx-toolbar button,
.mx-toolbar .mx-home {
  font-family: monospace;
  font-size: 13px;
  background: #262842;
  color: #edebf5;
  border: 1px solid #565a82;
  padding: 6px 8px;
  cursor: pointer;
}
.mx-toolbar .mx-home {
  display: block;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}
.mx-toolbar .mx-volume {
  width: 90px;
}
.mx-toolbar .mx-status {
  color: #8a8;
  font-size: 12px;
  margin-top: auto;
}

.mx-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mx-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mx-canvas-wrap canvas {
  display: block;
  image-rendering: pixelated;
}

@media (min-width: 700px) {
  body.mx-app {
    flex-direction: row;
  }
  .mx-hamburger {
    display: none;
  }
  .mx-toolbar {
    display: flex !important;
    position: static;
    inset: auto;
    order: 1;
    width: 220px;
    flex-shrink: 0;
    height: 100%;
    padding: 16px;
    border-bottom: none;
    border-right: 2px solid #43456a;
  }
  .mx-main {
    order: 2;
  }
}
