.td-tiktok-block {
    width: 100%;
    container-type: inline-size;
}

.td-tiktok-title {
    position: relative;
    margin: 0 0 30px;
    padding: 0 0 18px;
    font-size: clamp(26px, 3vw, 38px);
    line-height: 1.05;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .01em;
}

.td-tiktok-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 210px;
    max-width: 42%;
    height: 6px;
    background: currentColor;
}

.td-tiktok-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
    gap: 20px;
    align-items: start;
}

.td-tiktok-item,
.td-tiktok-card {
    min-width: 0;
}

.td-tiktok-player-trigger {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: inherit;
}

.td-tiktok-thumb-wrap,
.td-tiktok-inline-player {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #111;
}

.td-tiktok-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.td-tiktok-thumb-placeholder {
    background: linear-gradient(145deg, #161616, #303030);
}

.td-tiktok-play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    padding-left: 4px;
    transition: transform .18s ease, background .18s ease;
}

.td-tiktok-player-trigger:hover .td-tiktok-play {
    transform: translate(-50%, -50%) scale(1.08);
    background: rgba(0, 0, 0, .86);
}

.td-tiktok-inline-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.td-tiktok-meta {
    display: grid;
    gap: 5px;
    padding: 10px 2px 0;
    font-size: 13px;
    line-height: 1.35;
}

.td-tiktok-meta strong {
    font-size: 14px;
}

.td-tiktok-meta span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.td-tiktok-meta a {
    color: inherit;
    text-decoration: none;
    opacity: .65;
}

.td-tiktok-meta a:hover {
    opacity: 1;
}

.td-tiktok-empty,
.td-tiktok-admin-notice {
    padding: 14px;
    border: 1px dashed currentColor;
}

.td-tiktok-admin-notice {
    margin: 0 0 16px;
    font-size: 13px;
    opacity: .8;
}

.td-tiktok-cta-wrap {
    margin-top: 24px;
}

.td-tiktok-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid currentColor;
    color: inherit;
    text-decoration: none;
    font-size: 13px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: .04em;
}

.td-tiktok-cta:hover {
    opacity: .72;
}

@container (max-width: 560px) {
    .td-tiktok-grid {
        grid-template-columns: 1fr;
    }

    .td-tiktok-title {
        margin-bottom: 22px;
        padding-bottom: 14px;
    }

    .td-tiktok-title::after {
        height: 5px;
        width: 140px;
    }
}

/* Edge fallback: use TikTok's official embed instead of player/v1 iframe. */
.td-tiktok-official-embed {
    width: 100%;
    min-height: 520px;
    overflow: hidden;
}

.td-tiktok-official-embed .tiktok-embed {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}

@container (max-width: 560px) {
    .td-tiktok-official-embed {
        min-height: 460px;
    }
}


/* v0.5.3: pre-render TikTok's official embed so Edge does not depend on
   dynamically inserting a fresh blockquote after the user clicks Play. */
.td-tiktok-edge-embed-preload {
    position: absolute;
    left: -100000px;
    top: 0;
    width: min(100%, 605px);
    max-height: 1px;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
}

.td-tiktok-edge-embed-preload.is-visible {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    max-height: none;
    overflow: visible;
    visibility: visible;
    pointer-events: auto;
}

.td-tiktok-edge-embed-preload.is-visible .tiktok-embed,
.td-tiktok-edge-embed-preload.is-visible iframe {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}

.td-tiktok-player-trigger[hidden] {
    display: none !important;
}

/* v0.5.4: graceful fallback when Edge Tracking Prevention blocks TikTok. */
.td-tiktok-card.is-loading .td-tiktok-player-trigger {
    opacity: .58;
    pointer-events: none;
}

.td-tiktok-card.is-loading .td-tiktok-play::after {
    content: "";
    position: absolute;
    inset: -8px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: td-tiktok-spin .8s linear infinite;
}

@keyframes td-tiktok-spin {
    to { transform: rotate(360deg); }
}

.td-tiktok-browser-note {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px dashed currentColor;
    font-size: 12px;
    line-height: 1.4;
    opacity: .72;
}

.td-tiktok-browser-note[hidden] {
    display: none !important;
}
