#thv-root{
  --thv-bg:url("https://таблички-стенды.рф/images/holst/fon.jpg");

  /* Координаты центра красного креста на фоновой сцене.
     Значение рассчитано относительно предоставленного
     изображения. Сам крест кодом НЕ рисуется. */
  --thv-center-x:40%;
  --thv-center-y:30%;

  width:100%;
  max-width:100%;
  margin:0;
  padding:0;

  position:relative;
  isolation:isolate;

  overflow:hidden;

  /* Пропорции задаются JS по реальному fon.jpg */
  aspect-ratio:1181 / 1408;

  container-type:inline-size;

  font-family:Arial,Helvetica,sans-serif;
  line-height:normal;
}

#thv-root *,
#thv-root *::before,
#thv-root *::after{
  box-sizing:border-box;
}

#thv-root button,
#thv-root input{
  font:inherit;
}

#thv-root img{
  max-width:none;
}

/* ---------------------------------------------------------
   Фоновая фотография. Размер блока подстраивается под
   реальные размеры fon.jpg, поэтому iframe не искажает фон.
--------------------------------------------------------- */
#thv-root .thv-bg{
  position:absolute;
  inset:0;
  z-index:0;
  width:100%;
  height:100%;
  display:block;
  max-width:none;
  object-fit:fill;
  pointer-events:none;
  user-select:none;
}

/* ---------------------------------------------------------
   Сцена
--------------------------------------------------------- */

#thv-root .thv-scene{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}

/* ---------------------------------------------------------
   Холст
--------------------------------------------------------- */

#thv-root .thv-canvas-wrap{
  position:absolute;

  /*
     Центр холста всегда остаётся в одной точке.
     Ширина/высота самого холста меняются относительно неё.
  */
  left:var(--thv-center-x);
  top:var(--thv-center-y);

  width:0;
  height:0;

  
  align-items:center;
  justify-content:center;

  pointer-events:none;
  z-index:4;
}

#thv-root .thv-canvas{
  --thv-w:50;
  --thv-h:50;

  position:absolute;

  /* Размер задаётся JavaScript в пикселях.
     Это намеренно: так визуализатор не зависит
     от поддержки CSS-умножения calc() и от CSS сайта. */
  width:var(--thv-px-w,200px);
  height:var(--thv-px-h,200px);

  min-width:4px;
  min-height:4px;

  transform:translate(-50%,-50%);

  transform-style:preserve-3d;

  /*
     Более заметная тень. Она смещена вправо-вниз,
     чтобы визуально свет шёл сверху-слева.
  */
filter: drop-shadow( -7px 10px 5px rgba(45,31,21,.27) ) drop-shadow( -2px 4px 5px rgba(45,31,21,.18) );

  transition:
    width .12s linear,
    height .12s linear;
}

/* Лицевая поверхность всегда белая */
#thv-root .thv-face{
  position:absolute;
  inset:0;
  overflow:hidden;
  background:#F7F7F7; !important;

  border:0;

  box-shadow:
    inset 0 0 0 1px rgba(65,49,34,.13),
    inset 2px 2px 6px rgba(255,255,255,.8),
    inset -3px -3px 7px rgba(40,28,18,.11);
}

/* Пользовательское фото.
   contain = фото полностью помещается в холст,
   белое поле появляется там, где пропорции отличаются. */
#thv-root .thv-photo{
  position:absolute;
  inset:0;

  width:100%;
  height:100%;

  display:block;

  object-fit:contain;
  object-position:center center;

  background:#DBDBDB;

  opacity:0;

  transition:opacity .16s ease;
}

#thv-root .thv-canvas.thv-has-photo .thv-photo{
  opacity:1;
}

/* ---------------------------------------------------------
   Скосы
--------------------------------------------------------- */

#thv-root .thv-bevel{
  position:absolute;
  z-index:3;
  pointer-events:none;
}

#thv-root .thv-bevel-top{
  left:0;
  bottom:0;
  width:100%;
  height:3px;

  background:linear-gradient(
    to bottom,
    rgba(70,50,30,.03),
    rgba(55,40,25,.24)
  );
}

#thv-root .thv-bevel-left{
  left:0;
  bottom:0;
  width:3px;
  height:100%;

  background:linear-gradient(
    to bottom,
    rgba(70,50,30,.03),
    rgba(55,40,25,.24)
  );
}

#thv-root .thv-bevel-right{
  left:0;
  bottom:0;
  width:3px;
  height:100%;

  background:linear-gradient(
    to bottom,
    rgba(70,50,30,.03),
    rgba(55,40,25,.24)
  );
}

#thv-root .thv-bevel-bottom{
  left:0;
  bottom:0;
  width:100%;
  height:3px;

  background:linear-gradient(
    to bottom,
    rgba(70,50,30,.03),
    rgba(55,40,25,.24)
  );
}


/* ---------------------------------------------------------
   Панель справа снизу
--------------------------------------------------------- */

#thv-root .thv-panel{
  position:absolute;
  z-index:10;

  right:0.2%;
  bottom:0.5%;

  width:min(45%);

  padding:
    clamp(8px,2.0cqw,18px)
    clamp(10px,2.2cqw,22px);

  border-radius:
    clamp(10px,1.8cqw,18px);

  background:rgba(255,255,255,.88);

  box-shadow:
    0 5px 18px rgba(45,35,25,.12);

  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
}

#thv-root .thv-row{
  display:grid;

  grid-template-columns:
    auto
    minmax(30px,auto)
    auto
    minmax(80px,1fr);

  align-items:center;

  gap:
    clamp(5px,1cqw,10px);

  margin-bottom:
    clamp(5px,1cqw,9px);
}

#thv-root .thv-label{
  color:#77674f;

  font-size:
    clamp(10px,1.7cqw,17px);

  font-weight:700;

  white-space:nowrap;
}

#thv-root .thv-value{
  min-width:
    clamp(34px,5.2cqw,54px);

  height:
    clamp(25px,4.2cqw,43px);

  display:flex;
  align-items:center;
  justify-content:center;

  padding:0 5px;

  border:1px solid #9e907b;
  border-radius:
    clamp(5px,1cqw,9px);

  background:#fff;

  color:#665640;

  font-size:
    clamp(11px,1.8cqw,18px);

  font-weight:700;
}

#thv-root .thv-unit{
  color:#8a7a64;

  font-size:
    clamp(9px,1.4cqw,14px);
}

#thv-root .thv-range{
  width:100%;

  height:
    clamp(20px,3.1cqw,30px);

  margin:0;

  appearance:none;
  -webkit-appearance:none;

  background:transparent;

  cursor:pointer;
}

#thv-root .thv-range::-webkit-slider-runnable-track{
  height:
    clamp(4px,0.7cqw,7px);

  border-radius:20px;

  background:#b2a38f;
}

#thv-root .thv-range::-webkit-slider-thumb{
  appearance:none;
  -webkit-appearance:none;

  width:
    clamp(14px,2.5cqw,24px);

  height:
    clamp(14px,2.5cqw,24px);

  margin-top:
    calc(
      (
        clamp(4px,0.7cqw,7px) -
        clamp(14px,2.5cqw,24px)
      ) / 2
    );

  border:2px solid #806f55;
  border-radius:50%;

  background:#fff;

  box-shadow:0 1px 3px rgba(40,30,20,.25);
}

#thv-root .thv-range::-moz-range-track{
  height:
    clamp(4px,0.7cqw,7px);

  border-radius:20px;

  background:#b2a38f;
}

#thv-root .thv-range::-moz-range-thumb{
  width:
    clamp(14px,2.5cqw,24px);

  height:
    clamp(14px,2.5cqw,24px);

  border:2px solid #806f55;
  border-radius:50%;

  background:#fff;
}

/* Нижняя строка */
#thv-root .thv-bottom{
  display:grid;

  grid-template-columns:1fr auto;

  gap:
    clamp(5px,1cqw,9px);

  margin-top:
    clamp(5px,1cqw,9px);
}

#thv-root .thv-upload{
  position:relative;
  overflow:hidden;
  appearance:none;
  -webkit-appearance:none;
  font-family:Arial,Helvetica,sans-serif;
  line-height:1;
  margin:0;

  min-height:
    clamp(28px,4.8cqw,48px);

  display:flex;
  align-items:center;
  justify-content:center;

  padding:
    0 clamp(8px,1.5cqw,15px);

  border:1px solid #9e907b;
  border-radius:
    clamp(6px,1cqw,10px);

  background:#fff;

  color:#75644c;

  font-size:
    clamp(10px,1.55cqw,16px);

  font-weight:700;

  cursor:pointer;

  white-space:nowrap;
}

#thv-root .thv-file{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
  opacity:0 !important;
  pointer-events:none !important;
}

#thv-root .thv-lock{
  min-height:
    clamp(28px,4.8cqw,48px);

  padding:
    0 clamp(7px,1.2cqw,12px);

  border:1px solid #9e907b;
  border-radius:
    clamp(6px,1cqw,10px);

  background:#fff;

  color:#75644c;

  cursor:pointer;

  font-size:
    clamp(9px,1.35cqw,14px);

  font-weight:700;
  display:none;
}

#thv-root .thv-lock[aria-pressed="true"]{
  background:#7b6a54;
  color:#fff;
}

#thv-root .thv-lock-icon{
  margin-right:3px;
}

/* =========================================================
   АДАПТАЦИЯ ПОД УЗКУЮ МОБИЛЬНУЮ ШИРИНУ
   Ничего не меняем глобально на сайте.
========================================================= */

@container (max-width:767px){
  #thv-root .thv-panel{
    right:2%;
    bottom:2%;

    width:min(70%);
    padding:7px 9px;
    border-radius:11px;
  }

  #thv-root .thv-row{
    grid-template-columns:auto 38px auto 1fr;
    gap:5px;
    margin-bottom:5px;
  }

  #thv-root .thv-label{
    font-size:clamp(9px,2.5cqw,12px);
  }

  #thv-root .thv-value{
    min-width:38px;
    height:25px;
    font-size:11px;
    border-radius:6px;
  }

  #thv-root .thv-unit{
    font-size:9px;
  }

  #thv-root .thv-range{
    height:22px;
  }

  #thv-root .thv-range::-webkit-slider-runnable-track{
    height:4px;
  }

  #thv-root .thv-range::-webkit-slider-thumb{
    width:15px;
    height:15px;
    margin-top:calc((4px - 15px) / 2);
  }

  #thv-root .thv-range::-moz-range-track{
    height:4px;
  }

  #thv-root .thv-range::-moz-range-thumb{
    width:15px;
    height:15px;
  }

  #thv-root .thv-bottom{
    grid-template-columns:1fr auto;
    gap:5px;
    margin-top:5px;
  }

  #thv-root .thv-upload,
  #thv-root .thv-lock{
    min-height:27px;
    font-size:10px;
    border-radius:6px;
    padding:0 7px;
  }

  #thv-root .thv-lock{
    width:auto;
  }

  #thv-root .thv-lock-text{
    display:none;
  }

  #thv-root .thv-lock-icon{
    margin:0;
  }
}

@container (max-width:340px){
  #thv-root .thv-panel{
    width:min(62%,220px);
    padding:6px 8px;
  }

  #thv-root .thv-row{
    grid-template-columns:auto 34px auto 1fr;
  }

  #thv-root .thv-upload{
    font-size:9px;
  }
}

/* =========================================================
   Если скрипт ещё не успел заменить исходную картинку
========================================================= */
#thv-root.thv-loading{
  visibility:hidden;
}
/* ===== МОБИЛЬНАЯ ВЕРСИЯ — ПАНЕЛЬ ПОД ФОТО ===== */

@media screen and (max-width: 767px) {

  /* Разрешаем панели выйти ниже изображения */
  #thv-root {
    overflow: visible !important;

    /* резервируем место под панель,
       чтобы следующий контент не налезал на неё */
    margin-bottom: 125px !important;
  }

  /* Саму сцену НЕ трогаем —
     фотография и холст остаются как сейчас */
  #thv-root .thv-panel {
    position: absolute !important;

    /* отправляем панель сразу под нижний край фотографии */
    top: calc(100% + 12px) !important;

    bottom: auto !important;
    right: 15% !important;
    left: auto !important;
  }
}