.back-link {
    display: block;
    width: fit-content;
    margin-bottom: 16px;
    text-decoration: none;
}

.closet-intro {
    max-width: 640px;
}

/* Stage + tag layout */
.closet {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr);
    grid-template-areas:
        "stage tag"
        "rail rail";
    gap: 32px;
    align-items: center;
    max-width: 1200px;
    margin: 24px auto 0;
}

.stage {
    grid-area: stage;
    position: relative;
    height: min(78vh, 760px);
    min-height: 420px;
    border-radius: 24px;
    overflow: hidden;
    background:
        radial-gradient(ellipse 55% 45% at 50% 38%, rgba(255, 105, 180, 0.28), transparent 70%),
        radial-gradient(ellipse 80% 30% at 50% 100%, rgba(255, 105, 180, 0.18), transparent 70%),
        #0b0508;
    border: 2px solid rgba(255, 105, 180, 0.35);
}

.stage canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    /* let vertical swipes scroll the page, horizontal swipes spin the form */
    touch-action: pan-y;
    outline: none;
}

.stage.dragging canvas {
    cursor: grabbing;
}

.stage canvas:focus-visible {
    box-shadow: inset 0 0 0 3px #ffff00;
}

.stage-hint,
.stage-status {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    pointer-events: none;
    white-space: nowrap;
}

.stage-hint {
    bottom: 18px;
    color: rgba(255, 105, 180, 0.8);
    transition: opacity 0.6s ease;
}

.stage-hint.hidden {
    opacity: 0;
}

.stage-status {
    top: 50%;
    color: #ffff00;
}

.twirl-button {
    position: absolute;
    top: 16px;
    right: 16px;
    font-family: 'WebsiteFont', Arial, sans-serif;
    font-size: 1rem;
    color: #000;
    background: #ffff00;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(255, 255, 0, 0.35);
    transition: transform 0.15s ease;
}

.twirl-button:hover {
    transform: rotate(-6deg) scale(1.06);
}

.twirl-button:active {
    transform: rotate(10deg) scale(0.96);
}

/* Clothing tag */
.tag {
    grid-area: tag;
    position: relative;
    background: #ff69b4;
    color: #000;
    padding: 48px 24px 24px;
    border-radius: 6px 6px 18px 18px;
    clip-path: polygon(22% 0, 78% 0, 100% 9%, 100% 100%, 0 100%, 0 9%);
    transform: rotate(2deg);
    min-height: 220px;
}

.tag::before {
    /* the punched hole */
    content: '';
    position: absolute;
    top: 18px;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    background: #000;
}

.tag h2 {
    margin: 0 0 8px;
}

.tag-details {
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.75;
}

/* Clothing rail */
.rail-wrap {
    grid-area: rail;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 12px;
}

.rail {
    position: relative;
    display: flex;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0 24px;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}

.rail::before {
    /* the pole */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 6px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(#f4f4f4, #8a8a8a 60%, #4a4a4a);
}

.hanger {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #ff69b4;
    font-family: 'WebsiteFont', Arial, sans-serif;
    font-size: 0.85rem;
    transform-origin: 50% 0;
    transition: transform 0.25s ease;
}

.hanger:hover,
.hanger:focus-visible {
    transform: rotate(-4deg);
    outline: none;
}

.hanger[aria-pressed="true"] {
    color: #ffff00;
}

.hanger-hook {
    width: 100px;
    height: auto;
}

.silhouette {
    width: 84px;
    height: 96px;
    margin-top: -8px;
    background-size: 28px;
    background-position: center;
}

.silhouette.skirt {
    clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%);
}

.silhouette.dress {
    clip-path: polygon(34% 0, 40% 0, 44% 10%, 56% 10%, 60% 0, 66% 0, 66% 42%, 100% 100%, 0 100%, 34% 42%);
}

.silhouette.photo {
    background-size: contain;
    background-repeat: no-repeat;
}

.hanger[aria-pressed="true"] .silhouette {
    filter: drop-shadow(0 0 10px rgba(255, 255, 0, 0.6));
}

.hanger-label {
    margin-top: 8px;
    text-align: center;
}

@media (max-width: 768px) {
    .closet {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "stage"
            "rail"
            "tag";
        gap: 20px;
    }

    .stage {
        height: 70vh;
    }

    .tag {
        transform: none;
        min-height: 0;
    }
}
