/* ================= VIDEO GRID ================= */
.pstiktokvideo-front {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
.pstiktokvideo-front__item {
  width: 100%;
}
.pstiktokvideo-front__title {
  margin-top: 10px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  color: #111;
}

@media (min-width: 992px) {
  .pstiktokvideo-front {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* 🔥 1 FILM → NA ŚRODKU */
  .js-pstiktokvideo-count-1 .pstiktokvideo-front__item:nth-child(1) {
    grid-column: 2 / 3;
  }

  /* 🔥 2 FILMY → OD LEWEJ (bez zmian layoutu) */
  .js-pstiktokvideo-count-2 .pstiktokvideo-front__item:nth-child(1) {
    grid-column: 1 / 2;
  }

  .js-pstiktokvideo-count-2 .pstiktokvideo-front__item:nth-child(2) {
    grid-column: 2 / 3;
  }
}

/* ================= BUTTONS ================= */
.pstiktokvideo-buttons-wrapper {
  max-width: 100%;
  margin-top: 18px;
}
.pstiktokvideo-buttons-wrapper--gallery {
  margin-bottom: 10px;
}
.pstiktokvideo-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 760px;
  margin: 0 auto;
}

/* 1 film */
.pstiktokvideo-buttons > .pstiktokvideo-button:only-child {
  grid-column: 1 / -1;
}

/* ostatni przy nieparzystej liczbie */
.pstiktokvideo-buttons > .pstiktokvideo-button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* ================= BUTTON STYLE ================= */
.pstiktokvideo-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid #ddd;
  border-radius: 0px;
  background: #fff;
  color: #111;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pstiktokvideo-button:hover {
  background: #111;
  color: #fff;
  border-color: #111;
  transform: translateY(-1px);
}

.pstiktokvideo-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

/* ================= ICON ================= */
.pstiktokvideo-button__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.pstiktokvideo-button__icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.pstiktokvideo-button__text {
  display: flex;
  align-items: center;
  line-height: 1;
}

/* TikTok efekt */
.tiktok-icon-main {
  fill: #111;
  transition: fill 0.2s ease, filter 0.2s ease;
}

.pstiktokvideo-button:hover .tiktok-icon-main {
  fill: #fff;
  filter:
    drop-shadow(-1px -1px 0 #00f2ea)
    drop-shadow(1px 1px 0 #ff0050);
}

/* ================= MODAL ================= */
.pstiktokvideo-lock {
  overflow: hidden;
}

.pstiktokvideo-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.pstiktokvideo-modal.is-open {
  display: block;
}

.pstiktokvideo-modal__dialog {
  width: min(90vw, 380px);
  margin: 3vh auto;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* header */
.pstiktokvideo-modal__header {
  display: flex;
  justify-content: center;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #ececec;
  background: linear-gradient(180deg, #fff, #fafafa);
}

.pstiktokvideo-modal__title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #111;
}

/* video */
.pstiktokvideo-modal__ratio {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
}

.pstiktokvideo-modal__ratio iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* END BUTTON */
.pstiktokvideo-modal__end {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, #e1062c, #c40024);
  color: #fff;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pstiktokvideo-modal__end:hover {
  background: linear-gradient(135deg, #c40024, #a8001f);
  transform: translateY(-1px);
}

/* ================= MOBILE ================= */
@media (max-width: 575px) {
  .pstiktokvideo-buttons {
    grid-template-columns: 1fr;
  }

  .pstiktokvideo-button {
    min-height: 42px;
    font-size: 14px;
    padding: 10px 12px;
  }

  .pstiktokvideo-button__icon {
    width: 18px;
    height: 18px;
  }

  .pstiktokvideo-button__icon svg {
    width: 18px;
    height: 18px;
  }

  .pstiktokvideo-modal__dialog {
    width: 96vw;
    margin: 2vh auto;
  }

  .pstiktokvideo-modal__title {
    font-size: 17px;
  }
}