* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: #0b1020; color: #e5e7eb; font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; overflow: auto; }

.app { height: 100dvh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(180deg, #111831 0%, #0f172a 100%);
  border-bottom: 1px solid #1f2b46;
}
.title { font-size: 15px; font-weight: 700; }
.subtitle { font-size: 12px; opacity: 0.7; margin-top: 2px; }
.status { font-size: 12px; padding: 5px 8px; border-radius: 999px; background: #24314f; }
.status.ok { background: #124f31; }
.status.bad { background: #5f1d1d; }

.stage-wrap { position: relative; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.screen {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #020617;
  touch-action: pan-x pan-y pinch-zoom;
  overflow: auto;
}
.screen canvas {
  border-radius: 0;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  background: rgba(2, 6, 23, 0.74);
  backdrop-filter: blur(2px);
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: .2px;
}

.toolbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #0f172a;
  border-top: 1px solid #1f2b46;
}
.btn {
  appearance: none;
  border: 1px solid #26324e;
  border-radius: 12px;
  background: #131d32;
  color: #dbe3f0;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 8px;
}
.btn.primary { background: #1d4ed8; border-color: #3b82f6; color: white; }
.btn.active { background: #0b5; border-color: #19d89f; color: #042e22; }
.btn:active { transform: scale(0.98); }

@media (min-width: 900px) {
  .app { max-width: 1200px; margin: 0 auto; border-left: 1px solid #1f2b46; border-right: 1px solid #1f2b46; }
  .title { font-size: 16px; }
  .toolbar {
  position: sticky;
  bottom: 0;
  z-index: 20; grid-template-columns: repeat(10, minmax(0, 120px)); justify-content: center; }
}
