:root {
  --bg0: #050009;
  --bg1: #12001e;
  --violet: #7d4dff;
  --violet2: #b263ff;
  --cyan: #48fff1;
  --red: #ff3159;
  --amber: #ffcf66;
  --glass: rgba(26, 7, 44, 0.88);
}
* { box-sizing: border-box; }
html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
  color: #efe9ff;
  background: #000;
  font-family: Consolas, "Courier New", monospace;
}
.page {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  display: block;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #000;
}
.cabinet {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  display: block;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
  overflow: hidden;
}
.bezel-top {
  display: none !important;
}
.brand {
  font-weight: 900;
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255,207,102,.45);
}
.brand::before { content: "SPI02"; }
.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #36ff8f;
  box-shadow: 0 0 13px #36ff8f;
}
.status {
  margin-left: auto;
  color: #8fffea;
  font-size: 12px;
  opacity: .9;
}
.status::before { content: attr(data-status); }
.screen-wrap {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  aspect-ratio: auto;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: #000;
  border: 0;
  box-shadow: none;
}
canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  image-rendering: auto;
  background: #000;
  cursor: crosshair;
  outline: none;
  touch-action: none;
}
#helpOverlay[hidden], #helpOverlay.is-hidden { display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
.help-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 28px;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, .68);
  text-shadow: 0 0 10px rgba(92, 255, 230, .8);
  pointer-events: none;
}
.help-overlay h1 { margin: 0 0 8px; font-size: clamp(30px, 7vw, 76px); color: var(--amber); }
.help-overlay p { margin: 3px 0; font-size: clamp(12px, 1.9vw, 19px); }
.touch-panel {
  position: absolute;
  z-index: 6;
  left: max(10px, env(safe-area-inset-left, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: max(10px, env(safe-area-inset-bottom, 0px));
  display: none;
  grid-template-columns: 1fr 1fr 1.25fr 1fr 1fr 1fr 1fr;
  gap: 10px;
  pointer-events: none;
}
.touch-panel button {
  min-height: 52px;
  border: 1px solid rgba(154, 96, 255, .55);
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(180deg, rgba(92, 42, 150, .72), rgba(22, 4, 39, .84));
  font: 800 16px Consolas, "Courier New", monospace;
  letter-spacing: .08em;
  box-shadow: inset 0 0 12px rgba(255,255,255,.05), 0 0 12px rgba(74, 20, 130, .32);
  pointer-events: auto;
}
.touch-panel button::before { content: attr(data-label); }
.touch-panel button:active { transform: translateY(1px); color: var(--amber); }
@media (hover: none), (max-height: 760px) {
  body { overflow: hidden; }
  .touch-panel {
    position: fixed;
    left: max(8px, env(safe-area-inset-left, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    z-index: 6;
    display: grid;
    pointer-events: none;
  }
  .touch-panel button { pointer-events: auto; }
}
@media (max-width: 600px) {
  .status { display: none; }
  .touch-panel { grid-template-columns: repeat(4, 1fr); }
  .touch-panel button { min-height: 48px; font-size: 13px; }
}
