.ttd{
    /* Colors Paletta */
    --accent:   #93a68b;
    --bg-start: #e7e3e1;
    --bg-end:   #c7b9b5;
    --text:     #342c2a;
    --muted:    #6b625f;
    --shadow:   0 20px 40px rgba(52,44,42,.25);

    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ttd .wrap{
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(12px, 2.8vw, 24px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(12px, 2.8vw, 24px));
}
@supports (height: 100svh){ .ttd .wrap{ min-height: 100svh; } }
@supports (height: 100dvh){ .ttd .wrap{ min-height: 100dvh; } }

.ttd .chrome{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 456px;
    max-width: 100%;
    padding: 18px;
    border-radius: 24px;
    background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
    box-shadow: 0 14px 40px rgba(52,44,42,.25), inset 0 1px 0 rgba(255,255,255,.35);
    margin-inline: auto;
    border: 1px solid rgba(52,44,42,.08);
}
@media (max-width: 768px){
    .ttd .chrome{ width: 90vw; max-width: 90vw; }
}

/* ===== topbar ===== */
.ttd .topbar{
    width: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    row-gap: 6px; color: var(--muted); margin-bottom: 2px; opacity: .95;
    font-size: clamp(12px, 1.8vw, 14px); user-select: none;
}
.ttd .topbar b{ color: var(--text); }
.ttd .badge{
    font-size:12px; padding:6px 10px; border-radius:999px;
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    color: var(--text);
    border:1px solid color-mix(in srgb, var(--accent) 40%, #ffffff 0%);
    backdrop-filter: blur(8px);
}
.ttd .age{ color:var(--muted); font-size:12px; margin-left:auto; }

/* ===== cards ===== */
.ttd .deck{
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 24;
    height: auto;
    max-height: 90vh;
    user-select: none;
    perspective: 1200px;
}
@supports (height: 100svh){ .ttd .deck{ max-height: 90svh; } }
@supports (height: 100dvh){ .ttd .deck{ max-height: 90dvh; } }

.ttd .card{
    position: absolute; inset: 0;
    border-radius: 18px;
    background: #ffffff; /* The TikTok iframe is white, so it fits perfectly */
    box-shadow: var(--shadow);
    overflow: hidden;
    touch-action: pan-y;
    will-change: transform;
    transform-origin: 50% 100%;
    display: flex;
    flex-direction: column;
}

.ttd .media {
    position: relative;
    flex: 1;
    width: 100%;
    z-index: 1;
    background: #000; /* Black background is better for videos */
    overflow: hidden; /* This cuts off the overflowing part */
}

.ttd .media iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    overflow: hidden; /* This hides the scrollbar as well */
}

/* Handle for swiping (at the bottom of the card) */
.ttd .swipe-handle {
    height: 40px;
    border-top: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    cursor: grab;
    z-index: 10;
    user-select: none;
}
.ttd .swipe-handle:active {
    cursor: grabbing;
}

.ttd .ghost{ opacity: .65; pointer-events: none; }

/* ===== controls ===== */
.ttd .controls{
    width: 100%; display: flex; justify-content: center; gap: 16px; margin-top: 2px; user-select: none;
}
.ttd .btn{
    appearance: none; border: 0; border-radius: 14px; padding: 12px 16px;
    color: var(--text); background: var(--accent); cursor: pointer; font-weight: 600;
    box-shadow: 0 10px 24px rgba(52,44,42,.2), inset 0 1px 0 rgba(255,255,255,.25);
    transition: transform .08s ease, filter .12s ease; margin-top: 16px;
}
.ttd .btn:hover{ filter: brightness(1.03); }
.ttd .btn:active{ transform: translateY(1px); }

.ttd .hint{ text-align: center; color: var(--muted); margin-top: 2px; font-size: 13px; width: 100%; }

@media (max-width: 380px){
    .ttd .btn{ padding: 10px 12px; }
}

@media (max-width: 768px) {
    .ttd .controls,
    .ttd .hint {
        display: none !important;
    }
}

.ttd .media::before,
.ttd .media::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 15%;
    z-index: 5;
    cursor: grab;
}
.ttd .media::before { left: 0; }
.ttd .media::after { right: 0; }

.ttd .card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 80px;
    z-index: 10;
    cursor: grab;
}

.ttd .card::before:active,
.ttd .media::before:active,
.ttd .media::after:active {
    cursor: grabbing;
}
