.tplModal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: none;
}

.tplModal.show {
  display: block;
}

.tplModal__bg {
  position: absolute;
  inset: 0;
  background: rgba(16, 16, 18, .56);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tplModal__dialog {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: 250px auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.88));
  border: 1px solid rgba(32, 32, 32, .08);
  box-shadow:
    0 30px 80px rgba(0,0,0,.20),
    0 10px 24px rgba(0,0,0,.08);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.tplModal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(32, 32, 32, .07);
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,0));
}

.tplModal__headMeta {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.tplModal__eyebrow {
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #a12828a5;
}

.tplModal__title {
  font-size: clamp(22px, 2.8vw, 34px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -.04em;
  color: #202020;
}

.tplModal__close {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid rgba(32,32,32,.08);
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  color: #202020;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.tplModal__close:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 24px rgba(0,0,0,.08);
}

.tplModal__content {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(320px, .78fr);
}

.tplModal__stageWrap {
  min-width: 0;
  min-height: 0;
  padding: 20px;
  border-right: 1px solid rgba(32, 32, 32, .07);
  background:
    radial-gradient(circle at top left, rgba(255,77,77,.08), transparent 28%),
    linear-gradient(180deg, rgba(250,250,250,.7), rgba(244,244,244,.45));
}

.tplModal__stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(245,245,245,.92));
  border: 1px solid rgba(32,32,32,.07);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    0 16px 34px rgba(0,0,0,.06);
  aspect-ratio: var(--stage-ar, 16/10);
}

.tplModal__stage.checker {
  background-image:
    linear-gradient(45deg, rgba(32,32,32,.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(32,32,32,.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(32,32,32,.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(32,32,32,.04) 75%),
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(245,245,245,.92));
  background-size: 24px 24px, 24px 24px, 24px 24px, 24px 24px, auto;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0, 0 0;
}

.tplModal__stage.isTall {
  min-height: 520px;
}

.tplModal__stage.isWide {
  min-height: auto;
}

#tplModalImg,
#tplModalVideo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.tplModal__side {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.52), rgba(255,255,255,.24));
}

.tplModal__badgeRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tplModal__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,77,77,.14);
  background: rgba(255,77,77,.10);
  color: #a12828;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.tplModal__badgeDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff4d4d;
  box-shadow: 0 0 0 6px rgba(255,77,77,.10);
}

.tplModal__desc {
  font-size: 15px;
  line-height: 1.75;
  color: #4f4f4f;
  white-space: pre-line;
}

.tplModal__panel {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(32,32,32,.07);
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}

.tplModal__panelTitle {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 800;
  color: #202020;
}

.tplModal__actions {
  display: grid;
  gap: 10px;
}

.tplModalBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid rgba(32,32,32,.1);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease, background .16s ease, border-color .16s ease;
  appearance: none;
  -webkit-appearance: none;
}

.tplModalBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(0,0,0,.06);
}

.tplModalBtn--primary {
  background: #ff4d4d;
  color: #fff;
  border-color: transparent;
}

.tplModalBtn--primary:hover {
  background: #f53f3f;
}

.tplModalBtn--ghost {
  background: #fff;
  color: #202020;
}

.tplModalBtn--ghost:hover {
  background: #fff7f7;
  border-color: rgba(255,77,77,.18);
}

.tplModalBtn[data-disabled="1"],
.tplModalBtn.is-disabled {
  opacity: .56;
  pointer-events: none;
  box-shadow: none;
}

.tplModal__hint {
  font-size: 13px;
  line-height: 1.7;
  color: #6c6c6c;
  padding-bottom: 2px;
}

.tplModal__hint b {
  color: #202020;
}

.iviNoScroll {
  overflow: hidden !important;
}

@media (max-width: 1100px) {
  .tplModal__content {
    grid-template-columns: 1fr;
  }

  .tplModal__stageWrap {
    border-right: 0;
    border-bottom: 1px solid rgba(32,32,32,.07);
  }

  .tplModal__stage {
    min-height: 340px;
  }
}

@media (max-width: 720px) {
  .tplModal__dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .tplModal__head {
    padding: 12px 14px 10px;
  }

  .tplModal__content {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .tplModal__stageWrap {
    padding: 10px 12px 6px;
    border-bottom: 0;
  }

  .tplModal__stage {
    min-height: 0;
    height: auto;
    max-height: 34dvh;
    border-radius: 20px;
    aspect-ratio: var(--stage-ar, 16/11);
  }

  .tplModal__stage.isTall {
    max-height: 38dvh;
  }

  .tplModal__stage.isWide {
    max-height: 28dvh;
  }

  .tplModal__side {
    padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-content: start;
  }

  .tplModal__title {
    font-size: 18px;
    line-height: 1.1;
  }

  .tplModal__eyebrow {
    font-size: 11px;
  }

  .tplModal__close {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    font-size: 24px;
  }

  .tplModal__badge {
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .tplModal__desc {
    font-size: 14px;
    line-height: 1.58;
  }

  .tplModal__panel {
    padding: 12px;
    border-radius: 18px;
  }

  .tplModal__panelTitle {
    margin-bottom: 10px;
    font-size: 13px;
  }

  .tplModal__actions {
    gap: 8px;
  }

  .tplModalBtn {
    min-height: 42px;
    font-size: 14px;
  }

  .tplModal__hint {
    font-size: 12px;
    line-height: 1.5;
    padding-bottom: 0;
  }
}