* {
  font-family: "Montserrat", sans-serif;
}

:root {
  --c-bg: #90c7ca;
  --c-panel: #eaeded;
  --c-brand: #76afb0;
  --c-shadow: #6ca4a5;
}

html,
body {
  height: 100%;
}
body {
  margin: 0;
  background-color: var(--c-bg);
  overflow: hidden;
}

main {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #333;
}

#container3D {
  position: relative;
  width: 100%;
  height: 100%;
}

#container3D canvas {
  cursor: grab;
}
#container3D canvas:active {
  cursor: grabbing;
}

/* Balões */
.layer-div {
  position: absolute;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  z-index: 10;
  backdrop-filter: blur(8px);
}

/* Floating Accordion - NÃO bloquear cliques no canvas */
#floatingAccordion {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  gap: 0px;
  max-width: min(360px, 90vw);
  pointer-events: none; /* evita bloquear o canvas */
  z-index: 20;
}

.accordion-item {
  pointer-events: auto;
}

.accordion-button {
  background: var(--c-panel);
  color: var(--c-brand);
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  text-transform: uppercase;
  text-wrap: nowrap;
  padding: 5px 8px;
  cursor: pointer;
  filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
  transition: filter 0.25s ease, transform 0.2s ease;
}
.accordion-button:hover {
  filter: drop-shadow(6px 6px 12px var(--c-shadow));
}
.accordion-button:active {
  transform: translateY(1px);
}
.accordion-button .accordion-icon {
  fill: currentColor;
}
.accordion-title {
  font-size: 14px;
  font-weight: 500;
}

.accordion-content {
  background: linear-gradient(
    to right bottom,
    rgba(144, 199, 202, 0.85),
    rgba(106, 186, 189, 0.85)
  );
  color: var(--c-panel);
  border: 1px solid #d5e5e6;
  border-radius: 12px;
  font-size: 12px;
  padding: 0 14px;
  margin-top: 2px;
  margin-bottom: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}
.accordion-content.show {
  max-height: 240px;
  opacity: 1;
  overflow: auto;
}

/* ===== PRELOADER ===== */
#preloader {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(20, 20, 20, 0.92),
    rgba(0, 0, 0, 0.98)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  z-index: 9999; /* acima de tudo */
  transition: opacity 0.35s ease;
}

#preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

#preloader .loader {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#preloader .progress-text {
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.3px;
}

#preloader .progress-bar {
  width: 240px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

#preloader #preloader-bar {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--c-bg), var(--c-brand));
  transition: width 0.2s ease;
}

#preloader .progress-file {
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
}

/* Mobile */
@media (max-width: 640px) {
  #floatingAccordion {
    top: unset;
    bottom: 8px;
    left: 16px;
    max-width: 92vw;
  }

  .accordion-button svg {
    height: 15px;
    width: 15px;
  }

  .accordion-title {
    font-size: 11px;
  }
}

/* ===== Mobile Controls (duas colunas) ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Desktop: oculto */
.mobile-controls {
  display: none;
}

@media (max-width: 640px) {
  /* Esconde o accordion flutuante no mobile */
  #floatingAccordion {
    display: none;
  }

  .mobile-controls {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 50;
    display: grid;
    background: transparent;
    backdrop-filter: blur(6px);
    border-radius: 12px;
  }

  .mobile-controls .mc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: end; /* alinhado à base */
  }

  .mobile-controls .mc-left select {
    font-size: 14px;
    background: var(--c-panel);
    color: var(--c-brand);
    border: 0;
    border-radius: 8px;
    text-transform: uppercase;
    text-wrap: nowrap;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 8px;
    cursor: pointer;
    width: 100%;
  }

  .mobile-controls .mc-right {
    background: linear-gradient(
      to right bottom,
      rgba(144, 199, 202, 0.85),
      rgba(106, 186, 189, 0.85)
    );
    border: 1px solid #d5e5e6;
    font-size: 12px;
    max-height: 28vh;
    overflow: auto;
    border-radius: 12px;
    line-height: 1.35;
    color: var(--c-panel);
    padding: 0 14px;
    background: linear-gradient(
      to right bottom,
      rgba(144, 199, 202, 0.18),
      rgba(118, 175, 176, 0.18)
    );
  }

  .mobile-controls .mc-right p,
  .mobile-controls .mc-right ul {
    margin: 6px 0;
  }

  .mobile-controls .mc-right ul {
    padding-left: 16px;
    list-style: disc;
  }
}
