:root {
  --pad: 16px;
  --safe: env(safe-area-inset-bottom);
  /* desktop: testo allineato ai pulsanti */
  --actions-bottom: calc(var(--pad) + var(--safe));
  --info-bottom: calc(var(--pad) + var(--safe));
  /* quanto “alzo” i pulsanti quando il cassetto è aperto (solo desktop) */
  --lift-when-open: 140px;
  /* regola se serve */
}

/* pulsanti e testo usano le var sopra */
.bottom-actions {
  bottom: var(--actions-bottom);
}

#info {
  bottom: var(--info-bottom);
}

/* Quando il cassetto è aperto: ALZA solo i pulsanti, NON il testo */
body.finishes-open {
  --actions-bottom: calc(var(--pad) + var(--safe) + var(--lift-when-open));
  --info-bottom: calc(var(--pad) + var(--safe));
  /* resta il più in basso possibile */
}


html,
body {
  height: 100%;
  margin: 0;
}

body {
  background-color: #bdbbbb;
  color: #7c7c7c;
  ;
  font-family: Monospace;
  font-size: 13px;
  line-height: 24px;
  overscroll-behavior: none;
}

#container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  /* evita scroll */
  touch-action: none;
  /* gesture affidabili */
}


#loading-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;

  /* transizione fade */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.loading-content {
  text-align: center;
}

.loading-logo {
  max-width: 300px;
  margin-bottom: 50px;
}

.loading-bar {
  width: 60vw;
  height: 3px;
  background: #eee;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-bar__progress {
  width: 0%;
  height: 100%;
  background: #bf9e4f;
  transition: width 0.2s ease;
}



/* Overlay delicato per cambio modello */
#model-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#model-loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* nome classe coerente col tuo HTML */
.model-loading-message {
  font-family: sans-serif;
  font-size: 1.2rem;
  color: #333;
  background: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}







a {
  color: #444;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  text-transform: uppercase;
}

#info {
  position: fixed;
  /* fisso rispetto allo schermo, non assoluto dentro al body */
  left: 0;
  right: 0;
  bottom: var(--info-bottom);
  text-align: center;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.3;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 5;
  /* più basso di .bottom-actions (999) e pannello (30) */
}

a,
button,
input,
select {
  pointer-events: auto;
}



/* cluster bottoni a destra */
.bottom-actions {
  position: fixed;
  right: 16px;
  bottom: var(--actions-bottom);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 999;
}

.bottom-actions .button-root {
  width: 48px;
  height: 48px;
}



/* affianca a sinistra del close */

/* Stile condiviso */
.button-root.actionIcon-root {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: #282828;
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background 0.25s, transform 0.2s;
}

.button-root.actionIcon-root:hover {
  background: rgba(11, 11, 11, 0.95);
  transform: scale(1.05);
}

/* Stato attivo (rotazione abilitata) */
#rotate-btn[aria-pressed="true"] {
  background: rgba(84, 84, 84, 0.85);
}





/* abilita posizionamento relativo al bottone */
.button-root.actionIcon-root {
  position: relative;
}

/* bubble */
.button-root.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 110%;
  /* sopra al bottone */
  right: 50%;
  transform: translateX(50%) translateY(4px);
  padding: 6px 10px;
  font: 600 12px/1 system-ui, sans-serif;
  color: #fff;
  background: rgba(20, 20, 20, .95);
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 1001;
}

/* freccetta */
.button-root.has-tooltip::before {
  content: "";
  position: absolute;
  bottom: 102%;
  right: 50%;
  transform: translateX(50%);
  border: 6px solid transparent;
  border-top-color: rgba(20, 20, 20, .95);
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 1001;
}

/* mostra su hover/focus */
.button-root.has-tooltip:hover::after,
.button-root.has-tooltip:focus-visible::after,
.button-root.has-tooltip:hover::before,
.button-root.has-tooltip:focus-visible::before {
  opacity: 1;
}

.button-root.has-tooltip:hover::after,
.button-root.has-tooltip:focus-visible::after {
  transform: translateX(50%) translateY(0);
}



/*fine contenitore pulsanti in basso a destra */



.lil-gui {
  z-index: 1000 !important;
  /* TODO Solve this in HTML */
}

@media all and (max-width: 640px) {
  .lil-gui.root {
    right: auto;
    top: auto;
    max-height: 50%;
    max-width: 80%;
    bottom: 0;
    left: 0;
  }
}


#brand-logo {
  position: absolute;
  top: 30px;
  right: 50px;
  z-index: 998;
}

#brand-logo img {
  height: 70px;
  /* regola la dimensione */
  width: auto;
  display: block;
}


#brand-logo-mobile {
  display: none;
  z-index: 998;
}

#brand-logo-mobile img {
  height: 80px;
  /* regola la dimensione */
  width: auto;
  display: block;
}

#overlay {
  position: absolute;
  font-size: 16px;
  z-index: 2;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.7);
}

#overlay button {
  background: transparent;
  border: 0;
  border: 1px solid rgb(255, 255, 255);
  border-radius: 4px;
  color: #ffffff;
  padding: 12px 18px;
  text-transform: uppercase;
  cursor: pointer;
}

#notSupported {
  width: 50%;
  margin: auto;
  background-color: #f00;
  margin-top: 20px;
  padding: 10px;
}



/* --- pannello finiture: contenitore fisso --- */

#ui-finishes-panel__wrap {
  left: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 360px;
}

.ui-finishes-panel__glass {
  pointer-events: auto;
  width: auto;
  padding: 14px 14px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  color: #111;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.ui-finishes-panel__title {
  margin: 0 0 6px 0;
  font-size: 18px;
  line-height: 1.2;
  color: #1a1a1a;
  font-weight: 600;
}

.ui-finishes-panel__group {
  margin-top: 10px;
  margin-bottom: 25px;
}

.ui-finishes-panel__group-title {
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #333;
  margin: 6px 0;
}

.ui-finishes-panel__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.ui-swatch-btn {
  position: relative;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08) inset;
  transition: box-shadow .15s ease, border-color .15s ease, transform .06s ease;
}

.ui-swatch-btn__ring {
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.ui-swatch-btn--active {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08) inset, 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.ui-swatch-btn--active .ui-swatch-btn__ring {
  border-color: #3c3c3c;
  box-shadow: 0 0 0 2px rgba(161, 161, 161, 0.2);
}

.ui-swatch-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 112, 243, .35), 0 0 0 1px rgba(17, 17, 17, .4) inset;
}


.ui-swatch-btn__label {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 6px);
  white-space: inherit;
  font-size: 8px;
  color: #292929;
  text-transform: none;
}

.ui-finishes-panel__label {
  margin-top: 10px;
  font-size: 12px;
  color: #222;
  min-height: 16px;
  opacity: .9;
}

/* helper per “mezzaluna” lucida tipo thumb: diagonale */
.ui-swatch-btn::before,
.ui-swatch-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.ui-swatch-btn::after {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 60%);
  mix-blend-mode: screen;
}



/* Tooltip finiture */
#ui-finishes-tooltip {
  position: absolute;
  z-index: 50;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-width: none;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  width: max-content;
}

.ui-finishes-tooltip__label {
  margin-top: 0px;
  font: 400 12px/1.2 system-ui, sans-serif;
  color: #444;
}

/* base freccia */
#ui-finishes-tooltip::after {
  content: "";
  position: absolute;
  top: 14px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* lato destro */
#ui-finishes-tooltip.right::after {
  left: -6px;
  border-right: 6px solid rgba(255, 255, 255, 0.9);
}

/* lato sinistro */
#ui-finishes-tooltip.left::after {
  right: -6px;
  border-left: 6px solid rgba(255, 255, 255, 0.9);
}

.ui-finishes-tooltip__group {
  font: 700 11px/1.1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #333;
}

.ui-finishes-tooltip__name {
  margin-top: 2px;
  font: 700 17px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #111;
  white-space: nowrap;
  /* una riga */
  overflow: visible;
  /* niente taglio */
  text-overflow: clip;
  /* niente … */
}



/* Pannello a cassetto che sale dal basso */
#ui-finishes-panel__wrap {
  --handle-height: 46px;
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 360px;
  z-index: 30;
  transform: translateY(calc(100% - var(--handle-height)));
  transition: transform 220ms ease;
  will-change: transform;


}

/* Aperto */
#ui-finishes-panel__wrap.is-open {
  transform: translateY(0);
}

/* stato aperto: come prima */
#ui-finishes-panel__wrap.is-open .ui-finishes-panel__glass {
  opacity: 1;
  max-height: min(70vh, 640px);
  pointer-events: auto;
  transition: opacity 180ms ease, max-height 220ms ease;
}

/* stato chiuso: niente contenuto visibile o interattivo */
#ui-finishes-panel__wrap:not(.is-open) .ui-finishes-panel__glass {
  opacity: 0;
  max-height: 0;
  /* chiude verticalmente */
  pointer-events: none;
  /* niente click/scroll */
  transition: opacity 120ms ease, max-height 220ms ease;
  border-width: 0;
  /* evita linea visibile se serve */
  padding-top: 0;
  /* opzionale: se hai padding verticali */
  padding-bottom: 0;
  /* opzionale */
}

/* Maniglia pulsante */
#ui-finishes-panel__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--handle-height);
  width: 100%;
  padding: 0 14px;
  border: 0;
  border-radius: 30px;
  background: #282828;
  color: #fff;
  font: 600 14px/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  cursor: pointer;
  transition:
    border-radius 160ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.is-open #ui-finishes-panel__toggle {
  border-radius: 12px 12px 0 0 !important;
}

/* Contenuto vetro: resta al di sopra del bottone */
#ui-finishes-panel__wrap .ui-finishes-panel__glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  max-height: min(70vh, 640px);
  overflow: auto;
}

/* Evita che lo scroll/drag interferisca con l’OrbitControls */
#ui-finishes-panel__wrap * {
  overscroll-behavior: contain;
}


.ui-finishes-panel__disclaimer {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #555;
  opacity: 0.8;
}



/* --- FINE pannello finiture: contenitore fisso --- */





/* Box info modello */
#model-info {
  position: absolute;
  top: 20px;
  left: 20px;
  max-width: 280px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: 10px;
  /*background: rgba(255,255,255,0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);*/
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #2e2e2e;
}

#model-info__name {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 700;
}

#model-info__desc {
  margin: 0 0 8px 0;
  font-size: 13px;
  line-height: 1.35;
  color: #444;
}

#model-info__materials {
  font-size: 13px;
  line-height: 1.4;
}

#model-info__materials strong {
  font-weight: 700;
  color: #2e2e2e;
}

/* Fine box info modello */





#interaction-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 26px;

  /* effetto vetro */
  background: rgba(119, 119, 119, 0.21);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  color: #fff;
  font: 500 14px/1.4 system-ui, sans-serif;
  text-align: center;

  transition: opacity 0.4s ease, transform 0.4s ease;
}

#interaction-hint.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
}

.interaction-hint__icon svg {
  width: 25px;
  height: 25px;
  display: block;

  /* animazione */
  animation: run 1.5s linear infinite;
}

/* animazione destra ↔ sinistra */
@keyframes run {
  0% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(8px);
  }

  100% {
    transform: translateX(0);
  }
}



#change-model-btn {
  margin-top: 26px;
  padding: 10px 20px;
  font: 400 13px system-ui, sans-serif;
  border: none;
  border-radius: 33px 33px 33px 33px;
  background: #282828;
  color: #fff;
  cursor: pointer;
}

#change-model-btn svg {
  vertical-align: bottom;
}

#model-selector {
  position: fixed;
  /* non absolute */
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 1;
  transition: opacity 0.35s ease;
  overflow-y: auto;
  /* così da mobile puoi scrollare */
}

.model-selector__overlay {
  text-align: center;
  width: 90%;
  max-width: 1100px;
  margin: auto;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Logo */
.model-selector__logo img {
  max-height: 80px;
  margin: 0 auto 1rem;
}

/* Titolo e sottotitolo */
.model-selector__header h2 {
  font-size: 3rem;
  margin: 0px 0px 30px;
  font-weight: normal;
  font-family: Montserrat;
  color: #2f2f2f;
}

.model-selector__header p {
  font-size: 1rem;
  color: #262626;
  margin-top: 0.5rem;
  font-family: montserrat;
}

/* Griglia modelli */
.model-selector__grid {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.model-option {
  background: none;
  border: 2px solid transparent;
  padding: 1rem;
  border-radius: 10px;
  color: #323232;
  cursor: pointer;
  transition: 0.3s ease;
  width: 220px;
  margin-top: 20px;
}

.model-option img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.model-option span {
  display: block;
  font-weight: bold;
}

.model-option:hover,
.model-option:focus {
  border-color: #909090;
  background: rgba(0, 0, 0, 0.23);
  color: #fff !important;
}

/* Footer */
.model-selector__footer {
  margin-top: 2rem;
  margin-bottom: 5rem;
}

#cancel-model-btn {
  background: #282828;
  color: #fff;
  border: none;
  padding: 0.8rem 3rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s ease;
}

#cancel-model-btn:hover {
  background: #9b9b9b;
  color: #222;
}

/* Nascosto di default */
#model-selector.is-hidden {
  display: none;
}

.model-option.is-active {
  border-color: #909090;
  background: rgba(0, 0, 0, 0.23);
  color: #fff;
}

@media (max-width: 1200px) {
  #info {
    bottom: 10px;
    line-height: 0;
  }

  #ui-finishes-panel__wrap {
    bottom: 28px;
  }

  .bottom-actions {
    bottom: 28px;
  }

}



@media (max-width: 824px) {
  
  .model-selector__header h2 {
  font-size: 2.5rem;
  margin: 0px 0px 20px;}

  .model-selector__logo img {
  max-height: 60px;}

.model-option img {
  width: 70%;}

  .model-option {
  width: 200px;
  margin-top: 0px;
  }

}


/* --- Mobile largo: bottoni più piccoli e gap minore --- */
@media (max-width: 768px) {
  .bottom-actions {
    gap: 8px;
  }

  .bottom-actions .button-root {
    width: 44px;
    height: 44px;
  }
}

/* --- Mobile stretto: centra il cluster, pannello più stretto --- */
@media (max-width: 480px) {
  .bottom-actions {
    display: grid !important;
  }


}


@media (max-width: 768px) {
  .button-root.actionIcon-root {
    width: 40px;
    height: 40px;
  }

  .button-close {
    right: 16px;
    bottom: 16px;
  }

  .button-rotation {
    right: 68px;
    bottom: 16px;
  }

  .button-snapshot {
    right: 120px;
    bottom: 16px;
  }

  #brand-logo {
    display: none !important;
  }

  #brand-logo-mobile {
    display: block !important;
    position: absolute;
    top: 24px;
    right: 24px;
  }

  #model-info {
    top: 12px;
    left: 12px;
    max-width: min(60vw, 260px);
  }
}

@media (max-width: 480px) {
  .button-root.actionIcon-root {
    width: 36px;
    height: 36px;
  }
  .model-selector__header p {
  font-size: 0.8rem;}

  .model-selector__header h2 {
    font-size: 1.6rem;}

}



/* Mobile: layout “screenshot” — nessun lift, bottoni in colonna a destra */
@media (max-width: 540px) {
  :root {
    --lift-when-open: 0px;
  }

  /* non alzare nulla su mobile */
  body.finishes-open #info {
    bottom: calc(4px + var(--safe));
    /* resta fisso, non si muove */
  }

  .bottom-actions {
    right: 5px;
    bottom: calc(28px + var(--safe));
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .bottom-actions .button-root {
    width: 44px;
    height: 44px;
  }

  #ui-finishes-panel__wrap {
    left: 12px;
    bottom: calc(28px + var(--safe));
    width: min(80vw, 360px);
    transform: translateY(calc(100% - var(--handle-height)));
  }

  #ui-finishes-panel__wrap.is-open {
    transform: translateY(0);
  }

  /* testo sempre più in basso possibile, indipendente */
  #info {
    position: fixed;
    bottom: calc(4px + var(--safe));
    font-size: 11px;
    line-height: 1.2;
    z-index: 5;
    /* più basso dei pulsanti */
  }


  .button-root.has-tooltip::after {
    /* sopra al bottone */
    right: 0%;
  }

  .button-root.has-tooltip:hover::after,
  .button-root.has-tooltip:focus-visible::after {
    transform: translateX(0%) translateY(0%);
  }


  
  .model-selector__header h2 {
  font-size: 2rem;
    margin: 0px 0px 15px;}

  .model-selector__logo img {
  max-height: 45px;
    margin-top: 20px;}

.model-option img {
  width: 60%;}

  .model-option {
  width: 180px;
  margin-top: 0px;
  }
  



}