.ttd{
    /* Colors Paletta */
    --accent:   #93a68b;  /* Accent color */
    --bg-start: #e7e3e1;  /* Start color */
    --bg-end:   #c7b9b5;  /* End color */
    --text:     #342c2a;  /* Text color */

    /* Components (derived) */
    --muted:    #6b625f;  /* muted text (softer shade of text) */
    --shadow:   0 20px 40px rgba(52,44,42,.25); /* warm shadow adjusted to the palette */

    /* component "background" and base typography – only within .ttd */
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans",
    "Apple Color Emoji", "Segoe UI Emoji";);
    /* background: radial-gradient(1200px 600px at 20% 0%, var(--bg-start) 0, var(--bg-end) 100%); */
}

/* wrap only exists within the component */
.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; } }

/* ===== frame (chrome) ===== */
.ttd .chrome{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 456px;     /* desktop layout */
    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);
}

/* Mobile: max width 90% */
@media (max-width: 768px){
    .ttd .chrome{
        width: 90vw;
        max-width: 90vw;
    }
}

/* ===== overlay ===== */
.ttd .overlay{
    position: absolute;
    inset: 0;
    z-index: 2;          /* iframe above, header/footer (z-index:3) below */
    cursor: pointer;
    background: #000;    /* prevent flickering during loading */
}
.ttd .overlay-img{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* play icon */
.ttd .overlay-play{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: .85;
    transition: opacity .2s ease;
}
.ttd .overlay:hover .overlay-play{ opacity: 1; }
.ttd .overlay-play svg{ width:64px; height:64px; }

/* ===== 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 / 16;
    height: auto;
    max-height: 80vh;
    user-select: none;
    perspective: 1200px;
}
@supports (height: 100svh){ .ttd .deck{ max-height: 80svh; } }
@supports (height: 100dvh){ .ttd .deck{ max-height: 80dvh; } }

.ttd .card{
    position: absolute; inset: 0;
    border-radius: 18px; /* fixed instead of variable here to avoid blurriness on iOS */
    background: var(--bg-start);
    box-shadow: var(--shadow);
    overflow: hidden;
    touch-action: pan-y;
    will-change: transform;
    transform-origin: 50% 100%;
}
.ttd .card::before{
    content:""; position:absolute; inset:0; border-radius: inherit;
    outline:1px solid rgba(52,44,42,.08);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.15);
    pointer-events:none;
}

.ttd .header, .ttd .footer{
    position: absolute; left: 0; right: 0; z-index: 3;
    padding: 14px 16px; display: flex; align-items: center; gap: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.ttd .header{ top: 0; }
/* keep dark on video for subtitle readability */
.ttd .footer{
    bottom: 0;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.20), rgba(0,0,0,.35));
}
.ttd .caption{ font-size: 15px; color: #ffffff; text-wrap: balance; }

.ttd .media{
    position: absolute; inset: 0; z-index: 1;
    display: grid; place-items: center; background: var(--bg-end);
}
.ttd .media iframe, .ttd .media video{
    width: 100%; height: 100%; border: 0; display: block; object-fit: cover; background: #000;
}

.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%;
}

/* very narrow display: slightly more compact typography */
@media (max-width: 380px){
    .ttd .caption{ font-size: 14px; }
    .ttd .btn{ padding: 10px 12px; }
}
