:root {
  --bs-bg: #0B0C0D;
  --bs-dot: #EDE6DA;
  --bs-accent: #F28C28;
  --bs-accent-glow: rgba(242, 140, 40, 0.4);
  --bs-panel-bg: rgba(11, 12, 13, 0.72);
  --bs-panel-border: rgba(237, 230, 218, 0.12);
  --bs-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bs-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.bs-stage-root {
  position: relative;
  width: 100%;
  height: 88vh;
  min-height: 560px;
  max-height: 940px;
  background-color: var(--bs-bg);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--bs-font-sans);
  color: var(--bs-dot);
  display: flex;
  flex-direction: column;
}

.bs-canvas-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
  cursor: grab;
  z-index: 1;
}

.bs-canvas-layer:active {
  cursor: grabbing;
}

.bs-vignette-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 45%, color-mix(in srgb, var(--bs-bg) 80%, transparent) 100%);
  z-index: 2;
}

/* Corner HUD: Live Machine Caption */
.bs-hud-overlay {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 5;
  pointer-events: none;
  max-width: min(90vw, 460px);
}

.bs-hud-card {
  background: var(--bs-panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bs-panel-border);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.bs-hud-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.bs-hud-beacon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--bs-accent);
  box-shadow: 0 0 10px var(--bs-accent);
  display: inline-block;
  animation: bs-pulse 2.2s infinite ease-in-out;
}

@keyframes bs-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

.bs-hud-sector {
  font-family: var(--bs-font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bs-accent);
}

.bs-hud-name {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--bs-dot);
  margin: 0;
}

.bs-hud-phrase {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: rgba(237, 230, 218, 0.82);
  font-weight: 400;
  max-width: 380px;
  display: none;
  border-top: 1px solid rgba(237, 230, 218, 0.1);
  padding-top: 8px;
  animation: bs-fade-in 0.35s ease-out;
}

.bs-autopilot-tags {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-family: var(--bs-font-mono);
  font-size: 12px;
  color: var(--bs-accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  animation: bs-fade-in 0.35s ease-out;
}

.bs-tag-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0.65;
  transition: opacity 0.25s, color 0.25s, transform 0.25s;
}

.bs-tag-step.bs-active-tag {
  opacity: 1;
  color: var(--bs-dot);
  transform: translateY(-1px);
}

.bs-tag-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.bs-tag-step.bs-active-tag .bs-tag-dot {
  background: var(--bs-accent);
  box-shadow: 0 0 8px var(--bs-accent);
}

.bs-tag-sep {
  opacity: 0.35;
}

@keyframes bs-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Autopilot Notification Toast */
.bs-autopilot-toast {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 5;
  pointer-events: none;
  background: rgba(11, 12, 13, 0.85);
  border: 1px solid var(--bs-accent);
  border-radius: 100px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px var(--bs-accent-glow);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.bs-autopilot-toast.bs-visible {
  opacity: 1;
  transform: translateY(0);
}

.bs-toast-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bs-accent);
  box-shadow: 0 0 8px var(--bs-accent);
}

.bs-toast-text {
  font-family: var(--bs-font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--bs-dot);
  letter-spacing: 0.04em;
}

/* Bottom Controls Deck */
.bs-controls-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bs-panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bs-panel-border);
  border-radius: 100px;
  padding: 6px 10px;
  max-width: min(95vw, 1080px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.bs-machine-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.bs-machine-tabs::-webkit-scrollbar {
  display: none;
}

.bs-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(237, 230, 218, 0.7);
  font-family: var(--bs-font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 13px;
  border-radius: 100px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bs-tab-btn:hover {
  color: var(--bs-dot);
  background: rgba(237, 230, 218, 0.08);
}

.bs-tab-btn.bs-active {
  color: var(--bs-dot);
  background: rgba(242, 140, 40, 0.15);
  border-color: rgba(242, 140, 40, 0.6);
  box-shadow: 0 0 12px rgba(242, 140, 40, 0.25);
  font-weight: 600;
}

.bs-tab-btn:focus-visible {
  outline: 2px solid var(--bs-accent);
  outline-offset: 2px;
}

.bs-controls-divider {
  width: 1px;
  height: 22px;
  background: var(--bs-panel-border);
  flex-shrink: 0;
}

.bs-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.bs-action-btn {
  background: rgba(237, 230, 218, 0.06);
  border: 1px solid var(--bs-panel-border);
  color: var(--bs-dot);
  font-family: var(--bs-font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 100px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bs-action-btn:hover {
  background: rgba(237, 230, 218, 0.12);
  border-color: rgba(237, 230, 218, 0.25);
}

.bs-action-btn:focus-visible {
  outline: 2px solid var(--bs-accent);
  outline-offset: 2px;
}

.bs-btn-scatter.bs-active {
  background: rgba(242, 140, 40, 0.2);
  border-color: var(--bs-accent);
  color: #FFF;
  box-shadow: 0 0 14px var(--bs-accent-glow);
}

.bs-btn-autopilot {
  background: rgba(242, 140, 40, 0.15);
  border-color: rgba(242, 140, 40, 0.5);
}

.bs-btn-autopilot:hover {
  background: rgba(242, 140, 40, 0.28);
  border-color: var(--bs-accent);
  box-shadow: 0 0 14px var(--bs-accent-glow);
}

.bs-btn-view {
  background: rgba(237, 230, 218, 0.08);
  border-color: rgba(237, 230, 218, 0.22);
}

.bs-btn-view:hover {
  background: rgba(237, 230, 218, 0.16);
  border-color: rgba(237, 230, 218, 0.35);
}

.bs-btn-view.bs-active {
  background: rgba(242, 140, 40, 0.2);
  border-color: var(--bs-accent);
  color: #FFF;
  box-shadow: 0 0 14px var(--bs-accent-glow);
}

/* Small Footnote */
.bs-footnote-tag {
  position: absolute;
  bottom: 8px;
  right: 18px;
  z-index: 4;
  font-family: var(--bs-font-mono);
  font-size: 12px;
  color: rgba(237, 230, 218, 0.4);
  pointer-events: none;
  letter-spacing: 0.04em;
}

/* Drag Interaction Hint */
.bs-hint-pill {
  position: absolute;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
  font-family: var(--bs-font-mono);
  font-size: 12px;
  color: rgba(237, 230, 218, 0.5);
  background: rgba(11, 12, 13, 0.5);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid rgba(237, 230, 218, 0.06);
  opacity: 0.85;
  transition: opacity 0.5s ease;
}

.bs-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Mobile & Tablet Adjustments */
@media (max-width: 768px) {
  .bs-stage-root {
    height: 78vh;
    min-height: 480px;
  }
  .bs-hud-overlay {
    top: 14px;
    left: 14px;
  }
  .bs-hud-card {
    padding: 10px 14px;
  }
  .bs-hud-name {
    font-size: 16px;
  }
  .bs-autopilot-toast {
    top: 14px;
    right: 14px;
    padding: 6px 12px;
  }
  .bs-controls-bar {
    bottom: 14px;
    padding: 4px 8px;
    gap: 6px;
    border-radius: 18px;
  }
  .bs-tab-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .bs-action-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .bs-footnote-tag {
    display: none;
  }
  .bs-hint-pill {
    bottom: 64px;
    font-size: 12px;
  }
}
