/* Shared scene-world controls. Camera and playback behavior remain in SceneEngine. */
.space-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  font-family: "Sora", -apple-system, sans-serif;
  --scene-header-height: 136px;
  --scene-accent: #a855f7;
  color: #f2f3f8;
}
.space-overlay [hidden] { display: none !important; }
.space-header {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 20px;
  align-items: start;
}
.space-host {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  max-width: 520px;
  pointer-events: auto;
}
.space-overlay button,
.space-overlay input,
.space-overlay .pc-audio-cta { pointer-events: auto; }
.space-overlay button {
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 10px 14px;
  color: #f2f3f8;
  background: rgba(9, 13, 25, .92);
  border: 1px solid rgba(208, 220, 255, .25);
  border-radius: 12px;
  cursor: pointer;
}
.space-overlay button:disabled { opacity: .5; cursor: default; }
.space-overlay button:focus-visible,
.space-overlay input:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.space-overlay .space-avatar {
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  min-height: 0;
  padding: 0;
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid var(--scene-accent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
}
.space-avatar img,
.space-avatar video { width: 100%; height: 100%; object-fit: cover; }
.space-avatar video { position: absolute; inset: 0; }
.space-host-copy { min-width: 0; flex: 1; }
.space-host-name { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
#spaceHostDot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: #34d399; }
.space-host-phase { font-size: 13px; margin: 5px 0 10px; color: var(--scene-accent); }
.space-overlay .pc-audio-cta {
  font-size: 14px;
  line-height: 1.35;
  padding: 12px 18px;
  border-radius: 16px;
  max-width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  background: var(--primary, var(--scene-accent));
  animation: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}
.space-tools { display: flex; gap: 8px; align-items: start; pointer-events: auto; }
.space-overlay .space-tools button { padding: 0; width: 44px; height: 44px; border-radius: 50%; flex: 0 0 44px; }
.space-overlay .space-audio-toggle { font-size: 20px; }
.space-panel {
  position: absolute;
  top: calc(var(--scene-header-height) + 36px);
  bottom: calc(var(--interaction-height, 180px) + 16px);
  right: 20px;
  width: min(320px, calc(100% - 40px));
  box-sizing: border-box;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  background: rgba(9, 13, 25, .96);
  border: 1px solid rgba(208, 220, 255, .22);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
.space-panel h2 { font-size: 20px; line-height: 1.4; margin: 0 44px 16px 0; }
.space-panel p { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; margin: 8px 0; }
.space-overlay .space-panel-close { position: absolute; top: 8px; right: 8px; padding: 0; width: 44px; font-size: 26px; border: 0; background: transparent; }
.space-phase-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.space-options { margin: 20px 0; border: 0; padding: 0; }
.space-options legend { color: #cdd6ec; font-size: 13px; margin-bottom: 6px; }
.space-options label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.space-options input { width: 20px; height: 20px; margin: 0; accent-color: var(--scene-accent); }
.space-motion-note { color: #b5bed5; }
.space-overlay button[aria-pressed="true"] { border-color: var(--scene-accent); }
.space-caption {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--interaction-height, 180px) + 16px);
  width: calc(100% - 48px);
  max-width: 640px;
  text-align: center;
  padding: 10px 16px;
  box-sizing: border-box;
  border-radius: 12px;
  background: rgba(6, 9, 18, .82);
  color: #e2e7f3;
}
.space-caption:has(#spaceSegText:empty) { display: none; }
#spaceSegType { color: var(--scene-accent); font-size: 11px; letter-spacing: .5px; margin-bottom: 4px; }
#spaceSegText { font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
@media (max-width: 719px) {
  .space-header { top: 12px; left: 12px; right: 12px; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
  .space-host { gap: 10px; align-items: start; }
  .space-overlay .space-avatar { width: 72px; height: 72px; flex-basis: 72px; }
  .space-host-name { font-size: 18px; }
  .space-host-phase { font-size: 12px; margin: 3px 0 8px; }
  .space-overlay .pc-audio-cta { font-size: 13px; padding: 10px 12px; border-radius: 12px; }
  .space-panel { top: calc(var(--scene-header-height) + 24px); right: 12px; width: min(320px, calc(100% - 24px)); padding: 18px; bottom: calc(var(--interaction-height, 180px) + 16px); }
  .space-caption { width: calc(100% - 24px); padding: 8px 12px; }
}
@media (max-width: 359px) {
  .space-overlay .space-avatar { width: 64px; height: 64px; flex-basis: 64px; }
  .space-host { gap: 8px; }
  .space-overlay .pc-audio-cta { padding: 10px 8px; }
}
.space-reduced-motion *,
.space-reduced-motion .pc-audio-cta { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .space-overlay *, .space-overlay .pc-audio-cta { animation: none !important; transition: none !important; }
}

.space-panel-open .space-caption { visibility: hidden; }
.scene-active #sceneCanvas { touch-action: none; }

.space-host-role { font-size: 12px; line-height: 1.4; color: #c4cde2; margin-top: 4px; overflow-wrap: anywhere; }
.space-overlay .space-transcript-link { margin-top: 8px; font-size: 13px; background: transparent; }
.space-caption .space-transcript-link { margin-top: 4px; padding: 4px 12px; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.space-transcript-text { white-space: pre-wrap; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.space-sources { margin-top: 20px; padding-top: 12px; border-top: 1px solid rgba(208,220,255,.2); }
.space-sources h3 { font-size: 15px; margin: 0 0 10px; }
.space-source { padding: 8px 0; }
.space-source a { color: #d3caff; text-decoration: underline; text-underline-offset: 3px; }
.space-panel .space-source-date { font-size: 12px; color: #c4cde2; }

.space-panel .space-reply-visibility { font-size: 12px; font-weight: 600; color: #d9d2f6; margin: -8px 0 16px; }
