/* Template Detail — clean product page */

.td-top {
  gap: 0.75rem;
}

.td-search-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.td-back {
  flex: 0 0 auto;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--sc-purple, #6d28d9);
  white-space: nowrap;
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  margin-right: 0.15rem;
}

.td-back:hover {
  background: var(--sc-soft, #efe8ff);
}

.td-search-wrap input,
.sc-search.td-search-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.85rem;
  max-width: none;
  padding: 0.2rem 0;
  border-radius: 0;
}

/* Inside showcase layout — full width content */
.sc-content.td-page,
.td-page {
  padding: 0.85rem 1.1rem 2.5rem !important;
  max-width: none;
  width: 100%;
}

.td-sc-top .sc-top-copy h1 {
  font-size: 1.2rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.td-loading {
  padding: 2.5rem 0;
  color: var(--dash-muted);
  font-size: 0.9rem;
}

/* ===== Hero: preview + sticky details ===== */
.td-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 380px);
  gap: 1.15rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.td-preview-card {
  background: #fff;
  border: 1px solid var(--dash-line);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 10px 32px rgba(40, 20, 70, 0.06);
}

.td-preview-main {
  --poster-ratio: 4 / 5;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  max-height: min(72vh, 640px);
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.55), transparent 50%),
    linear-gradient(160deg, #ebe4dc 0%, #d9cfc3 55%, #f0ebe4 100%);
  padding: 1.25rem;
}

.td-mini-host {
  position: relative !important;
  inset: auto !important;
  width: min(100%, calc(min(72vh, 640px) * 0.72));
  max-height: 100%;
  aspect-ratio: var(--poster-ratio);
  height: auto !important;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.06),
    0 18px 40px rgba(40, 20, 30, 0.18);
  background: #fff;
  container-type: inline-size;
}

.td-mini-host .mini-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: unset !important;
  overflow: hidden;
}

.td-preview-main .mini-layer.mini-background {
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.td-preview-main .mini-layer.mini-background img {
  object-fit: cover !important;
  object-position: center !important;
}

.td-preview-main .mini-layer {
  position: absolute;
  box-sizing: border-box;
  overflow: hidden;
  transform-origin: center center;
}

.td-preview-main .mini-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.td-preview-main .mini-text {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  font-weight: 700;
  white-space: pre-wrap;
  word-break: break-word;
}

.td-composite {
  width: min(100%, calc(min(72vh, 640px) * 0.72));
  max-height: 100%;
  height: auto;
  aspect-ratio: var(--poster-ratio);
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(40, 20, 30, 0.18);
  background: #f6f3ee;
}

.td-mine-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  border-radius: 999px;
  background: rgba(20, 12, 36, 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.28rem 0.65rem;
  backdrop-filter: blur(6px);
}

.td-mine-badge a {
  color: #fde68a;
  text-decoration: underline;
}

.td-hint-split {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--dash-muted, #6b6280);
}

.td-preview-main .emoji-xl {
  font-size: 3.5rem;
}

.td-preview-nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.65rem;
  pointer-events: none;
}

.td-preview-nav button {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: #3b2f4a;
}

.td-thumbs {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.75rem;
  overflow-x: auto;
}

.td-thumbs button {
  flex: 0 0 56px;
  width: 56px;
  height: 70px;
  border-radius: 10px;
  border: 2px solid transparent;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: #f0ebe4;
}

.td-thumbs button.active {
  border-color: #7c3aed;
}

.td-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===== Sticky info panel ===== */
.td-info {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  min-width: 0;
}

.td-info-card {
  background: #fff;
  border: 1px solid var(--dash-line);
  border-radius: 20px;
  padding: 1.25rem 1.2rem 1.3rem;
  box-shadow: 0 10px 32px rgba(40, 20, 70, 0.06);
}

.td-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.td-price-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: #7c3aed;
  color: #fff;
  box-shadow: 0 4px 10px rgba(91, 33, 182, 0.25);
}

.td-price-pill.is-premium {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 55%, #f59e0b 100%);
  color: #fff;
  text-shadow: 0 1px 0 rgba(120, 53, 15, 0.2);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.td-ver {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dash-muted);
}

.td-title {
  margin: 0 0 0.45rem;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.td-desc {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--dash-muted);
}

.td-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.td-spec-grid > div {
  background: #faf8f5;
  border: 1px solid rgba(60, 40, 90, 0.06);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
}

.td-spec-grid em {
  display: block;
  font-style: normal;
  font-size: 0.68rem;
  color: var(--dash-muted);
  margin-bottom: 0.15rem;
}

.td-spec-grid strong {
  font-size: 0.82rem;
  font-weight: 750;
  word-break: break-word;
}

.td-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

.td-tags i {
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 650;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #f5f0ff;
  color: #6d28d9;
}

.td-creator {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.6rem;
  border-radius: 12px;
  background: #faf8ff;
  font-size: 0.82rem;
}

.td-creator .avatar {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
}

.td-verified {
  font-size: 0.7rem;
  color: var(--dash-muted);
  font-weight: 600;
}

.td-cta-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  align-items: stretch;
}

.td-cta-row .td-btn-primary,
.td-cta-row .td-btn-ghost {
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.td-btn-primary {
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 750;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(91, 33, 182, 0.28);
}

.td-btn-primary:hover {
  filter: brightness(1.05);
}

.td-btn-ghost {
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  background: #fff;
  color: #4b4458;
  cursor: pointer;
}

.td-ai-box {
  padding: 0.75rem;
  border-radius: 14px;
  background: linear-gradient(160deg, #faf6f0, #f7f3ff);
  border: 1px solid rgba(60, 40, 90, 0.08);
}

.td-ai-box strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
}

.td-ai-row {
  display: flex;
  gap: 0.4rem;
}

.td-ai-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  background: #fff;
}

.td-ai-row button {
  border: 0;
  border-radius: 10px;
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  background: #1f1830;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

/* Tabs */
.td-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  border-bottom: 1px solid var(--dash-line);
  margin-bottom: 1rem;
}

.td-tabs button {
  border: 0;
  background: transparent;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  color: var(--dash-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.td-tabs button.active {
  color: #5b21b6;
  border-bottom-color: #7c3aed;
}

.td-panel { display: none; }
.td-panel.active { display: block; }

.td-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.td-card {
  background: #fff;
  border: 1px solid var(--dash-line);
  border-radius: 16px;
  padding: 1rem 1.05rem;
}

.td-card h3 {
  margin: 0 0 0.7rem;
  font-family: var(--display);
  font-size: 0.95rem;
}

.td-feat-grid {
  display: grid;
  gap: 0.5rem;
}

.td-feat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  line-height: 1.35;
}

.td-feat span {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #047857;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 0.75rem;
}

.td-layer-list {
  display: grid;
  gap: 0.4rem;
  max-height: 260px;
  overflow-y: auto;
}

.td-layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: #faf8f5;
  font-size: 0.8rem;
}

.td-layer-item i {
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 750;
  color: #6d28d9;
  background: #efe8ff;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.td-check-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  font-size: 0.82rem;
}

.td-check-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  list-style: none;
  line-height: 1.4;
}

.td-check-list li::before {
  content: '✓';
  color: #16a34a;
  font-weight: 800;
}

.td-faq {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--dash-ink);
}

.td-faq:last-child { margin-bottom: 0; }

.td-section {
  margin-top: 1.35rem;
}

.td-section h3 {
  margin: 0 0 0.65rem;
  font-family: var(--display);
  font-size: 1.05rem;
}

.td-similar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.td-sim-card,
.td-similar a {
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--dash-line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  display: grid;
  grid-template-rows: 150px auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.td-sim-card:hover,
.td-similar a:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(40, 20, 70, 0.1);
}

.td-similar .thumb {
  position: relative;
  background: linear-gradient(155deg, #ebe4dc, #f5f0ea);
  overflow: hidden;
}

.td-similar .thumb img,
.td-similar .thumb .tpl-cover-hero,
.td-similar .thumb .tpl-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.td-similar .thumb .tpl-cover {
  position: absolute;
  inset: 0;
}

.td-similar .meta {
  padding: 0.6rem 0.7rem 0.75rem;
}

.td-similar .meta strong {
  display: block;
  font-size: 0.82rem;
  font-family: var(--display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.td-similar .meta em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--dash-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(30, 20, 50, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal-backdrop[hidden] { display: none !important; }

.modal-card {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.modal-card .hint {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--dash-muted);
}

.modal-card .field {
  margin-bottom: 0.55rem;
}

.modal-card .field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 650;
  margin-bottom: 0.25rem;
}

.modal-card .field input,
.modal-card .field select {
  width: 100%;
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  box-sizing: border-box;
}

.use-checks {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--dash-accent-2, #6d28d9);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

@media (max-width: 1180px) {
  .td-hero {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  }
}

@media (max-width: 920px) {
  .td-hero {
    grid-template-columns: 1fr;
  }

  .td-info {
    position: static;
  }

  .td-overview-grid {
    grid-template-columns: 1fr;
  }

  .td-similar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .td-preview-main {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .td-similar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .td-cta-row {
    grid-template-columns: 1fr;
  }

  .td-page {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}
