:root {
  color-scheme: dark;
  --bg: #0c0d14;
  --panel: rgba(18, 20, 32, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8e9ef;
  --muted: #8b8fa3;
  --accent: #ff6b1a;
  --accent-hover: #ff8137;
  --accent-soft: rgba(255, 107, 26, 0.16);
  --accent-soft-hover: rgba(255, 107, 26, 0.28);
  --accent-border: rgba(255, 107, 26, 0.35);
  --danger: #f07178;
  --ok: #7ee787;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

body.app {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
}

.desktop-back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.desktop-back-link:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}

.desktop-back-link[hidden] {
  display: none !important;
}

body[data-desktop-demo] aside.panel {
  top: 52px;
}

aside.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  /* Above mobile-touch-layer (50) so panel buttons remain tappable on phones. */
  z-index: 60;
  width: 188px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-family: "Segoe UI", system-ui, sans-serif;
}

@media (max-width: 640px) {
  aside.panel {
    top: 10px;
    left: 10px;
    width: 168px;
    padding: 10px;
  }
}

/* Scene loader: covers the canvas until the splat is fully ready.
   z-index sits above chrome (40) and below the side panel (60)
   so loading is just a percentage over the world, while panel actions stay usable. */
.scene-loader {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #0a0a0a;
  color: rgba(255, 255, 255, 0.65);
  font-family: "Segoe UI", system-ui, sans-serif;
  transition: opacity 0.85s ease, visibility 0s linear 0s, background 0.6s ease;
}

.scene-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 1.1s ease, visibility 0s linear 1.1s, background 0.6s ease;
}

/* Peel the solid veil so the SDK point→splat radial reveal is visible. */
.scene-loader.is-cinematic {
  background:
    radial-gradient(ellipse 70% 55% at 50% 48%, rgba(8, 8, 12, 0.18) 0%, rgba(8, 8, 12, 0.55) 55%, rgba(6, 6, 10, 0.82) 100%);
  pointer-events: none;
}

.scene-loader.is-cinematic .scene-loader-spinner {
  opacity: 0.55;
}

.scene-loader.is-cinematic .scene-loader-pct {
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.85);
}

.scene-loader-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255, 107, 26, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: scene-loader-spin 0.9s linear infinite;
}

@keyframes scene-loader-spin { to { transform: rotate(360deg); } }

.scene-loader-text {
  display: none;
}

.scene-loader-pct {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.88);
  font-variant-numeric: tabular-nums;
  min-height: 1em;
}

body[data-launcher-active] .scene-loader { display: none; }
body[data-launcher-active] .vinvr-chrome { display: none; }

/* Phone-only "Move / Look" onboarding hint — shows for 5s on first Ready. */
.touch-onboard {
  position: absolute;
  inset: 0;
  z-index: 55; /* below panel (60), above touch zones (50) */
  display: none;
  pointer-events: none; /* let movement / look touches pass through */
  font-family: "Segoe UI", system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  user-select: none;
  -webkit-user-select: none;
}

.touch-onboard.is-visible {
  display: flex;
  animation: touch-onboard-fade-in 0.35s ease-out, touch-onboard-fade-out 0.6s ease-in 4.4s forwards;
}

@keyframes touch-onboard-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes touch-onboard-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.touch-onboard-half {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 18px;
  text-align: center;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.touch-onboard-half--move {
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.touch-onboard-icon {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  animation: touch-onboard-pulse 1.6s ease-in-out infinite;
}

.touch-onboard-half--look .touch-onboard-icon {
  animation-delay: 0.4s;
}

@keyframes touch-onboard-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 107, 26, 0)); }
  50%      { transform: scale(1.08); filter: drop-shadow(0 0 12px rgba(255, 107, 26, 0.5)); }
}

.touch-onboard-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.touch-onboard-sub {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.72);
  max-width: 14ch;
  line-height: 1.35;
}

body[data-launcher-active] .touch-onboard { display: none !important; }

/* Segmented quality switcher (replaces stacked radio-col) */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.seg-item {
  position: relative;
  margin: 0;
  padding: 0.4rem 0.25rem;
  border-radius: 6px;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seg-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-item span {
  display: block;
  white-space: nowrap;
}

.seg-item:hover:not(:has(input:checked)) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.seg-item:has(input:checked) {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
  font-weight: 600;
}

.seg-item input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

button.ghost.compact {
  padding: 0.45rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 6px;
  text-align: center;
  width: 100%;
}

/* On-brand "Choose world" CTA */
.brand-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: #ffd9bf;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.brand-cta:hover {
  background: var(--accent-soft-hover);
  border-color: rgba(255, 107, 26, 0.6);
  color: #fff;
}

.brand-cta:active { transform: translateY(1px); }
.brand-cta svg { flex-shrink: 0; }

h1 {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
  line-height: 1.45;
}

.sub a {
  color: var(--accent);
}

label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0.75rem 0 0.35rem;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.85rem;
}

textarea {
  min-height: 3.25rem;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}

button.primary {
  flex: 1;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(180deg, #5b8fd9, #447bca);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

button.primary:hover {
  filter: brightness(1.05);
}

button.ghost {
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

button.ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

button.ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.ghost:disabled:hover {
  color: var(--muted);
  border-color: var(--border);
}

button.ghost.is-on {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.status {
  margin-top: 0;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--muted);
}

.status.ok {
  display: none;
}

/* Multiplayer panel */
.mp-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
}

.mp-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.mp-idle-ui,
.mp-live-ui {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mp-idle-ui[hidden],
.mp-live-ui[hidden] {
  display: none;
}

.mp-row {
  display: flex;
  gap: 4px;
}

.mp-row input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  text-transform: uppercase;
}

.mp-row button.ghost.compact {
  width: auto;
  flex: 0 0 auto;
}

.mp-live-ui .mp-row button.ghost.compact {
  flex: 1;
}

.mp-status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text);
}

.mp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e0a13f;
  flex: 0 0 auto;
}

.mp-dot[data-state="connected"] {
  background: var(--ok, #53b96d);
}

.mp-dot[data-state="reconnecting"] {
  background: var(--danger, #e05d5d);
}

.status .state {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status strong {
  color: var(--text);
}

.status.ok .state {
  color: var(--ok);
}

.status.err .state {
  color: var(--danger);
}

#viewport {
  position: absolute;
  inset: 0;
  min-height: 320px;
}

#viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
  position: relative;
  z-index: 0;
}

.overlay-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
}

.launcher {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(72px, 14vh, 120px) 24px clamp(48px, 8vh, 80px);
  overflow: auto;
  background: var(--bg);
  color: var(--text);
}

.launcher-head {
  width: 100%;
  max-width: 880px;
  margin: 0 0 20px;
}

.launcher h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.launcher ul {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 880px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.launcher button.world {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.launcher button.world:hover,
.launcher button.world:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-border);
  outline: none;
}

.launcher .thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #12131c;
  overflow: hidden;
}

.launcher .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.launcher .thumb.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.launcher .name {
  padding: 10px 12px 12px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

@media (max-width: 640px) {
  .launcher ul {
    grid-template-columns: 1fr;
  }
}

.launcher .err {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 16px 0 0;
}

.launcher-powered {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #8d8d8d;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.launcher-powered:hover,
.launcher-powered:focus-visible {
  color: #5c5c5c;
  background: #fff;
  outline: none;
}

.launcher-powered .powered {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.65rem;
  color: #9a9a9a;
}

.launcher-powered .brand {
  color: #6a6a6a;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.launcher-powered img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.launcher-footer {
  position: absolute;
  left: 50%;
  bottom: clamp(20px, 4vh, 32px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.launcher-footer:hover,
.launcher-footer:focus-visible {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

.launcher-footer .powered {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.65rem;
}

.launcher-footer .brand {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.launcher-footer img {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.panel-section {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 1.25rem 0 0.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.muted-inline {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 2.5rem;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.measure-readout {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.panel-details {
  margin-top: 0.65rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.panel-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.panel-details summary::-webkit-details-marker {
  display: none;
}

.panel-details summary::before {
  content: "▸";
  font-size: 0.65rem;
  color: var(--muted);
  transition: transform 0.12s ease;
}

.panel-details[open] summary::before {
  transform: rotate(90deg);
}

.panel-details .sub {
  margin-bottom: 0.5rem;
}

.labelish {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0.65rem 0 0.35rem;
}

.radio-col {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.radio-col label {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.8rem;
  cursor: pointer;
}

.radio-col input {
  margin-top: 0.2rem;
}

select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.85rem;
}

.guide-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.55;
}

.guide-list strong {
  color: var(--text);
}

input[type="number"] {
  font-family: ui-monospace, monospace;
}

body[data-fake-fs] aside.panel,
body[data-launcher-active] aside.panel {
  display: none;
}

body[data-fake-fs] aside.panel {
  display: none;
}

body[data-fake-fs] #viewport {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
}

.dev-overlay {
  position: fixed;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 10000;
  display: none;
  min-width: 240px;
  max-width: 320px;
  max-height: min(92vh, 720px);
  overflow-y: auto;
  padding: 0.55rem 0.7rem 0.65rem;
  background: rgba(8, 9, 14, 0.82);
  border: 1px solid rgba(110, 168, 255, 0.35);
  border-radius: 6px;
  color: #d8dbe6;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.dev-overlay.active {
  display: block;
  /* Capture input while open, otherwise dragging the panel's own scrollbar falls
     through to the canvas and turns into look-around. */
  pointer-events: auto;
}

.dev-overlay-title {
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.dev-overlay-keys {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.55rem;
  row-gap: 0.18rem;
}

.dev-overlay-keys li {
  display: contents;
}

.dev-overlay-keys kbd {
  font-family: inherit;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  padding: 0 0.32rem;
  color: #e8e9ef;
  white-space: nowrap;
}

.dev-overlay-keys span {
  color: var(--muted);
}

.dev-overlay-control {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  /* Overlay root has pointer-events: none so the world stays clickable; slider must capture input. */
  pointer-events: auto;
}
.dev-overlay-control * {
  pointer-events: auto;
}
.dev-overlay-control-label {
  font-size: 0.66rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dev-overlay-control-value {
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.dev-overlay-control-range {
  width: 100%;
  accent-color: #4da3ff;
}

.dev-overlay-save {
  margin-top: 0.35rem;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: #ffd9bf;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.dev-overlay-save:hover {
  background: var(--accent-soft-hover);
  color: #fff;
}

.dev-overlay-toggle {
  margin-top: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: auto;
}

.dev-overlay-toggle-label {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dev-overlay-toggle-btn {
  min-width: 3.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #c8cad4;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}

.dev-overlay-toggle-btn.is-on {
  border-color: rgba(77, 163, 255, 0.55);
  background: rgba(77, 163, 255, 0.22);
  color: #d6ebff;
}

.dev-overlay-force-follow {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: auto;
}

.dev-overlay-force-follow-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.dev-overlay-force-follow-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  color: #d8dbe6;
}

.dev-overlay-force-follow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dev-overlay-force-follow-check {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}

.dev-overlay-note {
  margin-top: 0.45rem;
  font-size: 0.62rem;
  color: var(--muted);
  opacity: 0.7;
  font-style: italic;
}

.dev-overlay-status {
  margin-top: 0.45rem;
  min-height: 1em;
  font-size: 0.7rem;
  color: var(--muted);
}

.dev-overlay-status.ok {
  color: var(--ok);
}

.dev-overlay-status.err {
  color: var(--danger);
}

.dev-boundary-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dev-boundary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.dev-boundary-actions button {
  font: inherit;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
}

.dev-boundary-name {
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font-size: 12px;
}

.dev-boundary-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
  font-size: 11px;
}

.dev-boundary-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dev-boundary-list button {
  border: none;
  background: transparent;
  color: #f88;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.dev-boundary-meta {
  margin-top: 6px;
}

.dev-boundary-show {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.dev-boundary-show input {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

/* —— Phone: half-screen move + drag-look overlay —— */
.mobile-touch-layer {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  display: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-touch-layer.mobile-touch-layer--visible {
  display: block;
}

.touch-zone {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
}

.touch-zone--move {
  left: 0;
  width: 50%;
}

.touch-zone--look {
  left: 50%;
  width: 50%;
}

/* —— VinVR chrome: top-right CTA + bottom-right Live Demo card (always visible) —— */
.vinvr-chrome {
  --vinvr-accent: #ff6b1a;
  --vinvr-accent-hover: #ff8137;
  --vinvr-panel: rgba(10, 10, 10, 0.78);
  --vinvr-panel-border: rgba(255, 255, 255, 0.08);
  --vinvr-text: #f5f5f5;
  --vinvr-muted: #b8b8b8;
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.vinvr-cta-row {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.vinvr-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.05s ease;
  font-family: inherit;
}
.vinvr-btn:active { transform: translateY(1px); }

.vinvr-btn-primary {
  background: var(--vinvr-accent);
  color: #0a0a0a;
}
.vinvr-btn-primary:hover { background: var(--vinvr-accent-hover); }

.vinvr-btn-ghost {
  background: var(--vinvr-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--vinvr-text);
  border-color: var(--vinvr-panel-border);
}
.vinvr-btn-ghost:hover { border-color: rgba(255, 255, 255, 0.22); }

.vinvr-card {
  position: absolute;
  right: 16px;
  bottom: 16px;
  max-width: 420px;
  background: var(--vinvr-panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--vinvr-panel-border);
  border-radius: 14px;
  padding: 20px 22px 18px;
  pointer-events: auto;
  color: var(--vinvr-text);
  z-index: 2;
}

body.is-phone .seg,
body.is-phone .guest-hud__quality,
body.is-phone #btnGuestFullscreen {
  display: none;
}

body.is-phone .vinvr-card {
  display: none !important;
}

body.is-phone aside.panel,
body.is-phone #btnFullscreen,
body.is-phone .mp-panel,
body.is-phone #btnLauncher {
  display: none !important;
}
.vinvr-sdk-logo-cover {
  display: none;
}
.vinvr-card-eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--vinvr-accent);
  font-weight: 700;
  margin-bottom: 8px;
}
.vinvr-card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 6px;
  padding-right: 28px;
}
.vinvr-card-sub {
  font-size: 13px;
  color: var(--vinvr-muted);
  line-height: 1.5;
  margin: 0 0 10px;
}
.vinvr-controls-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 11px;
  color: var(--vinvr-muted);
  letter-spacing: 0.04em;
}
.vinvr-controls-hint > span { display: inline-flex; align-items: center; gap: 3px; }
.vinvr-kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  color: var(--vinvr-text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
}

/* Phone / short viewports — hide the top CTA, shrink the card so it doesn't dominate the touch zones */
@media (max-width: 640px), (max-height: 500px) {
  .vinvr-cta-row { display: none; }
  .vinvr-card {
    right: 12px;
    bottom: 12px;
    max-width: 240px;
    padding: 14px 16px 12px;
  }
  .vinvr-card-title { font-size: 13px; }
  .vinvr-card-sub { font-size: 11px; margin-bottom: 8px; }
  .vinvr-controls-hint { display: none; }
}

/* ---- Guest multiplayer join (same as Robot Path) ---- */
body.guest-join aside.panel,
body.guest-join .desktop-back-link,
body.guest-join .vinvr-chrome,
body.guest-join #worldObjectKitRoot,
body.guest-join #setBuilderKitRoot {
  display: none !important;
}

body.guest-join.app {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body.guest-join #viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
}

body.guest-join #viewport canvas {
  width: 100% !important;
  height: 100% !important;
}

.mp-join-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.mp-join-menu.is-hidden {
  display: none;
}

.mp-join-menu__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 20%, rgba(255, 107, 26, 0.18), transparent 55%),
    radial-gradient(ellipse 80% 60% at 80% 90%, rgba(40, 80, 160, 0.22), transparent 50%),
    linear-gradient(160deg, #07080f 0%, #12131c 45%, #0a0b12 100%);
}

.mp-join-menu__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.72) 100%);
  pointer-events: none;
}

.mp-join-menu__panel {
  position: relative;
  width: min(420px, 100%);
  padding: 36px 32px 28px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: mp-join-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes mp-join-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.mp-join-menu__eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #ff6b1a;
  font-weight: 700;
}

.mp-join-menu__title {
  margin: 0 0 10px;
  font-family: "Segoe UI Semibold", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #fff;
}

.mp-join-menu__lead {
  margin: 0 0 22px;
  color: rgba(232, 233, 239, 0.65);
  font-size: 14px;
  line-height: 1.45;
}

.mp-join-menu__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  margin-bottom: 16px;
}

.mp-join-menu__label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(232, 233, 239, 0.5);
}

.mp-join-menu__field input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
}

.mp-join-menu__field input:focus {
  border-color: rgba(255, 107, 26, 0.65);
  box-shadow: 0 0 0 3px rgba(255, 107, 26, 0.18);
}

.mp-join-menu__enter {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff6b1a, #ff8a3d);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.mp-join-menu__enter:hover {
  filter: brightness(1.06);
}

.mp-join-menu__enter:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mp-join-menu__hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: rgba(232, 233, 239, 0.4);
}

.guest-hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.guest-hud.is-hidden {
  display: none;
}

.guest-hud > * {
  pointer-events: auto;
}

.guest-hud__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(10px);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.guest-hud__cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-left: auto;
  justify-content: flex-end;
}

.guest-hud__primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.guest-hud__secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.72;
}

.guest-hud__btn,
.guest-hud__quality {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(10px);
  color: #e8e9ef;
  font-size: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.guest-hud__quality {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: default;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
}

.guest-hud__quality span {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(232, 233, 239, 0.7);
}

.guest-hud__quality select {
  background: transparent;
  color: inherit;
  border: 0;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.guest-hud__btn--follow {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-color: rgba(255, 107, 26, 0.65);
  color: #ffb08a;
  background: rgba(255, 107, 26, 0.14);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
}

.guest-hud__btn--follow:hover {
  border-color: rgba(255, 107, 26, 0.9);
  background: rgba(255, 107, 26, 0.22);
  color: #ffd0b5;
}

.guest-hud__btn--quiet {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(232, 233, 239, 0.78);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(10, 12, 20, 0.55);
}

.guest-hud__btn--quiet:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.guest-hud__btn--follow.is-on,
.guest-hud__btn.is-on {
  border-color: rgba(255, 107, 26, 0.95);
  color: #fff;
  background: rgba(255, 107, 26, 0.38);
  box-shadow: 0 0 0 1px rgba(255, 107, 26, 0.35), 0 6px 20px rgba(255, 107, 26, 0.2);
}

.guest-hud__status {
  position: absolute;
  top: 56px;
  left: 0;
  max-width: min(420px, 70vw);
  font-size: 12px;
  color: rgba(232, 233, 239, 0.7);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

@media (max-width: 640px) {
  .guest-hud__cluster {
    max-width: calc(100% - 56px);
  }
  .guest-hud__secondary {
    width: 100%;
    justify-content: flex-end;
    opacity: 0.55;
  }
  .guest-hud__primary {
    margin-left: auto;
  }
}

.pcvr-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 9, 16, 0.55);
  pointer-events: auto;
}

.pcvr-overlay[hidden] {
  display: none !important;
}

.pcvr-overlay-card {
  width: min(420px, calc(100% - 32px));
  padding: 22px 22px 18px;
  border-radius: 12px;
  background: rgba(18, 20, 32, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.pcvr-overlay-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pcvr-overlay-title {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 650;
}

.pcvr-overlay-detail,
.pcvr-overlay-hint {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  user-select: text;
}

.pcvr-overlay-enter {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent);
  color: #1a0d06;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pcvr-overlay-quiet {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}


