#space6-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  overflow: hidden;
  background: #050a1a;
  color: #e0f2fe;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#space6-view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#space6-view:active { cursor: grabbing; }

#space6-hint {
  position: absolute;
  left: max(34px, env(safe-area-inset-left, 0px) + 30px);
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  max-width: calc(100vw - 230px);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(186, 230, 253, 0.7);
  pointer-events: none;
}
#space6-drop {
  position: absolute;
  inset: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
  display: none;
  place-items: center;
  padding: 16px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #e0f2fe;
  background: rgba(5, 10, 26, 0.8);
  border: 2px dashed #38bdf8;
  border-radius: 20px;
  pointer-events: none;
  z-index: 3;
}
#space6-stage.drag #space6-drop { display: grid; }
#space6-toast {
  position: absolute;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  translate: -50% 0;
  max-width: calc(100vw - 80px);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #fde047;
  background: rgba(7, 25, 54, 0.88);
  border: 1px solid #38bdf8;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 3;
}
#space6-toast.on { opacity: 1; }

#space6-dock {
  position: absolute;
  left: max(40px, env(safe-area-inset-left, 0px) + 36px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  width: max-content;
  max-width: min(680px, calc(100vw - 340px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(7, 25, 54, 0.62);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 16px;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  z-index: 2;
}
#space6-dock [hidden] { display: none !important; }
#space6-dock.min .s6-fold { display: none; }
.s6-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.s6-grow { flex: 1 1 auto; }

.s6-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 700 13px/1 inherit;
  font-family: inherit;
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s;
}
.s6-btn[aria-pressed="true"] {
  color: #fff;
  background: rgba(56, 189, 248, 0.38);
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}
.s6-main { color: #fde047; border-color: rgba(250, 204, 21, 0.6); background: rgba(250, 204, 21, 0.12); }
.s6-icon { padding: 0; font-size: 16px; }
.s6-btn:focus-visible, .s6-range:focus-visible { outline: 2px solid #fde047; outline-offset: 2px; }
@media (hover: hover) {
  .s6-btn:hover { background: rgba(56, 189, 248, 0.28); box-shadow: 0 0 10px rgba(56, 189, 248, 0.4); }
}
.s6-tone { padding: 0; width: 44px; }
.s6-sw {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.s6-lbl { font-size: 12px; font-weight: 700; color: #bae6fd; white-space: nowrap; }
.s6-val { min-width: 3ch; font-size: 13px; font-weight: 700; color: #fde047; text-align: right; }
.s6-range {
  flex: 1 1 140px;
  min-width: 120px;
  height: 44px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  touch-action: pan-x;
  cursor: pointer;
}
.s6-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: rgba(56, 189, 248, 0.45); }
.s6-range::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(56, 189, 248, 0.45); }
.s6-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border-radius: 50%;
  background: #fde047;
  border: 2px solid #0c4a6e;
  box-shadow: 0 0 8px rgba(253, 224, 71, 0.6);
}
.s6-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fde047;
  border: 2px solid #0c4a6e;
}

@media (max-width: 768px) {
  #space6-hint { font-size: 10.5px; max-width: calc(100vw - 200px); }
  #space6-dock {
    left: max(34px, env(safe-area-inset-left, 0px) + 30px);
    right: max(34px, env(safe-area-inset-right, 0px) + 30px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 140px);
    width: auto;
    max-width: none;
    padding: 8px 10px;
  }
  .s6-btn { padding: 0 10px; font-size: 12px; }
  .s6-main { flex: 2 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .s6-btn, #space6-toast { transition: none; }
}
