.tsdp-app {
  --tsdp-blue: #0062ca;
  --tsdp-blue-dark: #004792;
  --tsdp-ink: #09111a;
  --tsdp-ink-soft: #122030;
  --tsdp-line: rgba(0, 98, 202, 0.18);
  --tsdp-panel: #f6f9fc;
  --tsdp-white: #ffffff;
  color: var(--tsdp-ink);
}

.tsdp-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.tsdp-search {
  width: min(440px, 100%);
  border: 1px solid rgba(9, 17, 26, 0.08);
  background: var(--tsdp-white);
  border-radius: 16px;
  padding: 15px 18px;
  font-size: 15px;
  box-shadow: 0 18px 44px rgba(9, 17, 26, 0.06);
}

.tsdp-search:focus {
  outline: none;
  border-color: rgba(0, 98, 202, 0.4);
  box-shadow: 0 0 0 4px rgba(0, 98, 202, 0.12);
}

.tsdp-count {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(9, 17, 26, 0.68);
}

.tsdp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}

.tsdp-card {
  position: relative;
  display: block;
  border: 1px solid rgba(0, 98, 202, 0.08);
  padding: 0;
  text-align: left;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 48px rgba(9, 17, 26, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tsdp-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 98, 202, 0.22);
  box-shadow: 0 28px 56px rgba(9, 17, 26, 0.12);
}

.tsdp-card img,
.tsdp-card-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: linear-gradient(135deg, #09111a 0%, #0062ca 100%);
}

.tsdp-card-body {
  display: block;
  padding: 18px 20px 20px;
}

.tsdp-card-title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}

.tsdp-card-meta {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: rgba(9, 17, 26, 0.66);
}

.tsdp-modal[hidden] {
  display: none;
}

.tsdp-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.tsdp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 12, 0.88);
  backdrop-filter: blur(8px);
}

.tsdp-modal-dialog {
  position: relative;
  width: min(1240px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: 14px auto;
  background: linear-gradient(180deg, #0a121c 0%, #060a10 100%);
  color: var(--tsdp-white);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.42);
}

.tsdp-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 30px 8px;
}

.tsdp-modal-heading {
  min-width: 0;
}

.tsdp-modal-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.tsdp-modal-count {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.tsdp-close,
.tsdp-nav {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--tsdp-white);
  background: rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.tsdp-close:hover,
.tsdp-nav:hover {
  background: rgba(0, 98, 202, 0.7);
  transform: translateY(-1px);
}

.tsdp-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
}

.tsdp-stage-wrap {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  gap: 16px;
  align-items: center;
  padding: 12px 22px 0;
}

.tsdp-stage-frame {
  min-height: min(66vh, 760px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(0, 98, 202, 0.15), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.tsdp-stage-image,
.tsdp-stage-video {
  display: block;
  width: 100%;
  max-height: min(66vh, 760px);
  object-fit: contain;
  background: transparent;
}

.tsdp-stage-video {
  background: #000;
}

.tsdp-stage-empty {
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.74);
}

.tsdp-nav {
  width: 58px;
  height: 58px;
  font-size: 30px;
}

.tsdp-nav[hidden] {
  visibility: hidden;
}

.tsdp-rail-wrap {
  padding: 18px 22px 26px;
}

.tsdp-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(110px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tsdp-thumb {
  position: relative;
  border: 1px solid transparent;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  min-height: 88px;
}

.tsdp-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  filter: saturate(0.95);
}

.tsdp-thumb.is-active {
  border-color: rgba(0, 98, 202, 0.9);
  box-shadow: 0 0 0 3px rgba(0, 98, 202, 0.2);
}

.tsdp-thumb-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(9, 17, 26, 0.9);
  color: var(--tsdp-white);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tsdp-empty {
  padding: 24px;
  border-radius: 20px;
  background: rgba(0, 98, 202, 0.08);
}

@media (max-width: 900px) {
  .tsdp-modal-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 22px;
  }

  .tsdp-stage-wrap {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 10px 12px 0;
  }

  .tsdp-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 46px;
    height: 46px;
  }

  .tsdp-nav-prev {
    left: 18px;
  }

  .tsdp-nav-next {
    right: 18px;
  }

  .tsdp-modal-header {
    padding: 22px 18px 10px;
  }

  .tsdp-rail-wrap {
    padding: 16px 12px 18px;
  }

  .tsdp-strip {
    grid-auto-columns: 88px;
  }
}
