/* ===== Designed-card renderer (shared: preview + topic carousel) ===== */
.designed-card {
    position: relative;
    width: 100%;
    max-width: 360px;
    aspect-ratio: var(--dc-aspect, 620 / 880);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
    perspective: 1600px;
    margin: 0 auto;
}

.dcr-faces {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .6s;
}
.designed-card.flipped .dcr-faces { transform: rotateY(180deg); }

.dcr-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    border-radius: 14px;
}
.dcr-face-back { transform: rotateY(180deg); }

/* Reliably hide the inactive face. Iframes (e.g. YouTube) break the 3D
   rendering context so backface-visibility alone lets the back bleed over
   the front — so we also toggle visibility + z-index, switching at mid-flip
   (0.3s of the 0.6s animation) so the flip still looks right. */
.dcr-face-front { z-index: 2; }
.dcr-face-back {
    z-index: 1;
    visibility: hidden;
    transition: visibility 0s linear .3s;
}
.designed-card.flipped .dcr-face-front {
    z-index: 1;
    visibility: hidden;
    transition: visibility 0s linear .3s;
}
.designed-card.flipped .dcr-face-back {
    z-index: 2;
    visibility: visible;
}

.dcr-band {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4px 10px;
    font-weight: 600;
    overflow: hidden;
}

.dcr-body {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
}

/* positioned elements */
.dcr-el { position: absolute; box-sizing: border-box; overflow: hidden; }
.dcr-el img,
.dcr-el video,
.dcr-el iframe { width: 100%; height: 100%; display: block; border: 0; }
.dcr-text {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 4px;
    white-space: pre-wrap;   /* honour line breaks from the designer */
    word-break: break-word;
    line-height: 1.2;
}
.dcr-audio {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 6px; padding: 6px; background: rgba(0,0,0,.04);
}
.dcr-audio audio { width: 100%; }
.dcr-audio-title { font-weight: 600; text-align: center; }

/* link / button element */
.dcr-link-btn {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    padding: 4px 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    word-break: break-word;
}
.dcr-link-btn:hover { filter: brightness(1.08); color: inherit; }

/* ---- Designed cards inside the staff-deck UI ---- */
/* Builder thumbnails (search results / working set / current deck) */
.deck-designed-thumb .designed-card {
    width: auto;
    height: 100%;
    max-width: 100%;
    box-shadow: none;
    border-radius: 10px;
}
/* Deck show carousel */
.carousel-card .designed-card {
    width: auto;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
}
/* Builder fullscreen enlarge */
.dcr-fullscreen .designed-card {
    max-width: none;
    width: auto;
    height: 90vh;
}

/* corner buttons */
.dcr-corner-btn {
    position: absolute;
    z-index: 100;
    width: 38px; height: 38px;
    border: none; border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    transition: background .2s, transform .2s;
}
.dcr-corner-btn:hover { background: rgba(0, 0, 0, .8); transform: scale(1.08); }
.corner-top-left { top: 10px; left: 10px; }
.corner-top-right { top: 10px; right: 10px; }
.corner-bottom-left { bottom: 10px; left: 10px; }
.corner-bottom-right { bottom: 10px; right: 10px; }

/* enlarge overlay */
.dcr-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, .85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.dcr-overlay .designed-card {
    max-width: min(90vw, 620px);
    height: min(90vh, 880px);
    width: auto;
    aspect-ratio: var(--dc-aspect, 620 / 880);
}
.dcr-overlay-close {
    position: fixed;
    top: 18px; right: 22px;
    z-index: 2100;
    width: 46px; height: 46px;
    border: none; border-radius: 50%;
    background: #fff; color: #222;
    font-size: 20px; cursor: pointer;
}
