html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Arial, sans-serif;
  background: transparent;
}

.a-enter-vr,
.a-enter-ar {
  display: none !important;
}

a-scene,
.a-canvas {
  position: fixed !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
}

#estat {
  position: fixed;
  z-index: 2000;
  top: max(14px, env(safe-area-inset-top));
  left: 68px;
  max-width: calc(100% - 300px);
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.76);
  color: white;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

#silenci {
  position: fixed;
  z-index: 2200;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.97);
  font-size: 23px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

#selector-model {
  position: fixed;
  z-index: 2200;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: min(205px, 46vw);
  box-sizing: border-box;
  border: 2px solid #111;
  border-radius: 12px;
  padding: 12px 36px 12px 14px;
  background: rgba(255, 255, 255, 0.97);
  color: #111;
  font-size: 16px;
  font-weight: 700;
}

#activar-so {
  position: fixed;
  z-index: 2400;
  left: 50%;
  bottom: max(205px, calc(env(safe-area-inset-bottom) + 170px));
  transform: translateX(-50%);
  display: none;
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  background: white;
  color: #111;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

/*
  Sempre en una sola fila, centrats i elevats.
  No depèn de si el mòbil està en vertical o horitzontal.
*/
#menu-continguts {
  position: fixed;
  z-index: 2300;
  left: 50%;
  bottom: max(115px, calc(env(safe-area-inset-bottom) + 90px));
  transform: translateX(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
}

#menu-continguts.visible {
  display: flex;
}

.boto-contingut {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border: 3px solid white;
  border-radius: 50%;
  background: rgba(24, 24, 24, 0.95);
  color: white;
  font-size: 25px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.boto-contingut:active {
  transform: scale(0.92);
}

/* El botó seleccionat queda en blau cel. */
.boto-contingut.actiu {
  background: #57c7f2;
  border-color: #d9f6ff;
  box-shadow:
    0 0 0 4px rgba(87, 199, 242, 0.28),
    0 5px 18px rgba(0, 0, 0, 0.38);
}

#finestra {
  position: fixed;
  z-index: 2350;
  top: 82px;
  left: 12px;
  width: min(390px, 58vw);
  max-height: calc(100% - 240px);
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  color: #111;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.38);
}

#finestra header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  background: #151515;
  color: white;
}

#finestra h2 {
  margin: 0;
  font-size: 18px;
}

#tancar-finestra {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: white;
  font-size: 18px;
}

#contingut-finestra {
  max-height: calc(100vh - 300px);
  overflow: auto;
  padding: 16px;
  line-height: 1.45;
}

#contingut-finestra img,
#contingut-finestra video {
  display: block;
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
}

#contingut-finestra audio {
  width: 100%;
}

.accions-musica {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.accions-musica button {
  border: 0;
  border-radius: 10px;
  padding: 11px 13px;
  font-weight: 700;
}

.error {
  padding: 12px;
  border-radius: 10px;
  background: #ffe1e1;
  color: #7a0000;
}

@media (max-width: 430px) {
  #menu-continguts {
    gap: 7px;
    padding: 9px 10px;
  }

  .boto-contingut {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    font-size: 23px;
  }

  #finestra {
    left: 8px;
    width: 68vw;
  }
}
