.hkg-grid {
    display: grid;
    grid-template-columns: repeat(var(--hkg-columns, 3), minmax(0, 1fr));
    gap: var(--hkg-gap, 13px);
    width: 100%;
}

.hkg-card {
    position: relative;
    display: grid;
    justify-items: center;
    align-items: end;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--hkg-radius, 20px);
    color: #fff;
    text-decoration: none !important;
    isolation: isolate;
    background: transparent;
    transform: translateZ(0);
}

.hkg-image {
    position: absolute;
    inset: 0;
    z-index: -3;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .72;
    transition: transform .45s ease, filter .45s ease;
}

.hkg-card.has-image {
    box-shadow: 0 8px 22px rgba(70, 57, 95, .09);
}

.hkg-card.no-image {
    background: rgba(128, 128, 128, .58);
}

.hkg-label {
    display: block;
    box-sizing: border-box;
    max-width: 88%;
    padding: .58em .78em;
    border: 1px solid rgba(255, 255, 255, .30);
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    box-shadow: 0 8px 24px rgba(46, 37, 66, .12);
    color: rgba(255, 255, 255, .92);
    overflow: hidden;
    font-size: var(--hkg-font-size, 16px);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    text-overflow: ellipsis;
    text-shadow: 0 2px 12px rgba(35, 25, 50, .42);
    white-space: nowrap;
    margin-bottom: 12%;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* 편집기에서는 미리보기 전체를 하나의 선택 영역으로 사용합니다. */
.editor-styles-wrapper .hkg-editor-shell {
    position: relative;
    width: 100%;
    min-height: 32px;
    cursor: pointer;
}

.editor-styles-wrapper .hkg-editor-shell * {
    pointer-events: none;
}

.hkg-card:hover .hkg-image,
.hkg-card:focus-visible .hkg-image {
    transform: scale(1.045);
    filter: saturate(1.06);
}

.hkg-card:focus-visible {
    outline: 3px solid #7758c7;
    outline-offset: 4px;
}

.hkg-empty {
    padding: 24px;
    border-radius: 18px;
    background: rgba(220, 210, 255, .24);
    text-align: center;
}

.hkg-more {
    display: block;
    min-width: 112px;
    margin: 22px auto 0;
    padding: 10px 22px;
    border: 1px solid rgba(90, 90, 90, .24);
    border-radius: 999px;
    background: rgba(255, 255, 255, .58);
    color: inherit;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.hkg-more:hover,
.hkg-more:focus-visible {
    background: rgba(255, 255, 255, .82);
}

.hkg-more:disabled {
    cursor: wait;
    opacity: .65;
}

.hkg-youcerti-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--hkg-gap, 18px);
}

.hkg-youcerti-card {
    display: grid;
    grid-template-rows: 50% 50% !important;
    box-sizing: border-box;
    aspect-ratio: 1 / 1.08;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--hkg-radius, 18px);
    background: var(--hkg-youcerti-bg, rgba(5, 5, 5, .85)) !important;
    color: var(--hkg-youcerti-text, #fff) !important;
    text-decoration: none !important;
}

.hkg-youcerti-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    padding: 5% 8% 2%;
}

.hkg-youcerti-brand {
    margin-bottom: 6%;
    font-size: clamp(9px, .9vw, 12px);
    font-weight: 700;
    line-height: 1;
}

.hkg-youcerti-title {
    display: block;
    min-width: 0;
    margin-bottom: 7%;
    font-size: var(--hkg-font-size, 22px);
    font-weight: 400 !important;
    line-height: 1.32;
}

.hkg-youcerti-title > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hkg-youcerti-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: rgba(128, 128, 128, .18);
    box-sizing: border-box;
    width: auto;
    height: auto;
    margin: 0 8% 8%;
}

.hkg-youcerti-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    opacity: var(--hkg-youcerti-opacity, .85) !important;
    transition: transform .35s ease;
}

.hkg-youcerti-card:hover .hkg-youcerti-media img,
.hkg-youcerti-card:focus-visible .hkg-youcerti-media img {
    transform: scale(1.025);
}

@media (max-width: 700px) {
    .hkg-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hkg-label {
        max-width: 88%;
        padding: .58em .72em;
        font-size: calc(var(--hkg-font-size, 16px) * .8);
    }

    .hkg-youcerti-title {
        font-size: calc(var(--hkg-font-size, 22px) * .72);
    }

    .hkg-youcerti-brand {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hkg-image {
        transition: none;
    }
}
