/* Shared mobile chrome for IOM demos */

.demo-touch-mode {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.demo-touch-mode button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 10px 16px;
  min-width: 88px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font: 600 12px/1.2 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.demo-touch-mode button + button {
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.demo-touch-mode button.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.demo-joystick {
  position: fixed;
  left: 18px;
  bottom: 28px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.demo-joystick-base {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(6px);
  position: relative;
  pointer-events: auto;
  touch-action: none;
}

.demo-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  will-change: transform;
}

.demo-joystick-label {
  font: 600 11px/1 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

@media (max-width: 640px) {
  #hint,
  .hint {
    bottom: 64px;
    font-size: 11px;
    white-space: normal;
    max-width: min(92vw, 560px);
  }

  body.has-demo-joystick #hint,
  body.has-demo-joystick .hint {
    bottom: 160px;
  }

  body.has-demo-joystick .demo-attribution {
    bottom: 148px !important;
    max-width: min(12rem, 42vw);
  }

  body.has-demo-touch-mode #hint,
  body.has-demo-touch-mode .hint {
    bottom: 68px;
  }

  .demo-attribution {
    /* Keep credits bottom-left so they don't collide with ← IOM / GUI */
    top: auto !important;
    bottom: 12px !important;
    left: 12px !important;
    max-width: min(16rem, calc(100vw - 24px));
    max-height: 28vh;
    overflow: auto;
    font-size: 11px;
  }

  .demo-attribution-credits {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Soften dense inspector/lil-gui stacks on phones */
  .lil-gui.root {
    max-height: min(42vh, 320px) !important;
    overflow: auto !important;
  }
}

@media (min-width: 641px) {
  .demo-touch-mode,
  .demo-joystick {
    display: none !important;
  }
}
