.apg-wrap {
    width: 100%;
    margin: 0 auto;
    color: #0b1736;
}

.apg-heading h2 {
    margin: 0 0 20px;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.apg-toolbar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 26px;
}

.apg-search-wrap {
    position: relative;
}

.apg-search {
    width: 100%;
    min-height: 54px;
    border: 1px solid rgba(11, 23, 54, 0.12);
    border-radius: 18px;
    padding: 0 18px;
    font-size: 15px;
    outline: none;
    background: #fff;
    box-shadow: 0 10px 30px rgba(13, 31, 76, 0.06);
}

.apg-search:focus {
    border-color: rgba(11, 23, 54, 0.42);
}

.apg-cats {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.apg-cat {
    border: 1px solid rgba(11, 23, 54, 0.12);
    background: #fff;
    color: #0b1736;
    border-radius: 999px;
    padding: 10px 15px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 800;
    transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}

.apg-cat.is-active,
.apg-cat:hover {
    background: #0b1736;
    color: #fff;
    border-color: #0b1736;
}

.apg-cat:hover {
    transform: translateY(-1px);
}

.apg-grid {
    display: grid;
    gap: 22px;
}

.apg-cols-1 { grid-template-columns: 1fr; }
.apg-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.apg-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.apg-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.apg-card {
    position: relative;
    border-radius: 26px;
    overflow: hidden;
    background: #101827;
    box-shadow: 0 18px 45px rgba(13, 31, 76, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.16);
    transform: translateZ(0);
}

.apg-thumb {
    position: relative;
    aspect-ratio: 1 / 1.12;
    overflow: hidden;
    background: #101827;
}

.apg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.01);
    transition: transform 0.38s ease;
}

.apg-card:hover .apg-thumb img {
    transform: scale(1.06);
}

.apg-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0,0,0,.46) 0%, rgba(0,0,0,.06) 36%, rgba(0,0,0,.88) 100%),
        radial-gradient(circle at 50% 82%, rgba(0,0,0,.56) 0%, rgba(0,0,0,0) 52%);
    pointer-events: none;
    z-index: 1;
}

.apg-card-hit {
    position: absolute;
    inset: 0;
    z-index: 2;
    text-decoration: none !important;
}

.apg-topline {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    z-index: 4;
    pointer-events: none;
}

.apg-top-badges {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    min-width: 0;
}

.apg-badge,
.apg-code-badge,
.apg-code-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    border-radius: 999px;
    background: rgba(255,255,255,.90);
    color: #0b1736;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .10em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.apg-code-badge {
    letter-spacing: .02em;
}

.apg-badge-soft {
    background: rgba(11, 23, 54, .72);
    color: #fff;
}

.apg-like {
    pointer-events: auto;
    border: 0;
    min-height: 28px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: background .2s ease, transform .2s ease;
}

.apg-like:hover,
.apg-like.is-liked {
    background: rgba(255, 255, 255, .34);
    transform: translateY(-1px);
}

.apg-heart {
    font-size: 17px;
    line-height: 1;
}

.apg-card-content {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 16px;
    z-index: 4;
    color: #fff;
    pointer-events: none;
}

.apg-card-content p {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.48;
    font-weight: 700;
    color: rgba(255,255,255,.94);
    text-shadow: 0 2px 14px rgba(0,0,0,.62);
}

.apg-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.apg-copy,
.apg-load-more {
    border: 0;
    cursor: pointer;
    border-radius: 999px;
    min-height: 38px;
    padding: 0 15px;
    font-size: 13px;
    font-weight: 900;
}

.apg-copy {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: transform .2s ease, background .2s ease, color .2s ease;
}

.apg-copy:hover {
    transform: translateY(-1px);
}

.apg-copy-glass {
    background: rgba(255,255,255,.22);
    color: #fff;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.apg-copy-glass:hover {
    background: rgba(255,255,255,.34);
    color: #fff;
}

.apg-copy-icon {
    font-size: 14px;
    line-height: 1;
}

.apg-copy-dark {
    background: #0b1736;
    color: #fff;
    min-height: 44px;
    padding: 0 20px;
}

.apg-copy-dark:hover {
    opacity: .86;
}

.apg-by {
    pointer-events: none;
    color: rgba(255,255,255,.86);
    font-size: 12px;
    font-weight: 800;
    text-align: right;
    text-shadow: 0 2px 12px rgba(0,0,0,.6);
    max-width: 48%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.apg-actions {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.apg-load-more {
    min-height: 48px;
    padding: 0 24px;
    background: #eef2f7;
    color: #0b1736;
}

.apg-load-more:hover {
    background: #0b1736;
    color: #fff;
}

.apg-empty {
    grid-column: 1 / -1;
    padding: 28px;
    border: 1px solid rgba(11, 23, 54, 0.10);
    border-radius: 20px;
    background: #fff;
    text-align: center;
    color: rgba(11, 23, 54, 0.72);
}

.apg-placeholder,
.apg-single-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    color: rgba(255,255,255,.7);
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.apg-single {
    width: min(1180px, 100%);
    margin: 0 auto;
    color: #0b1736;
}

.apg-back {
    display: inline-flex;
    margin-bottom: 24px;
    color: #44516c;
    text-decoration: none !important;
    font-weight: 700;
}

.apg-single-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, .72fr);
    gap: 48px;
    align-items: start;
}

.apg-single-image {
    overflow: hidden;
    border-radius: 28px;
    background: #101827;
    box-shadow: 0 24px 70px rgba(13, 31, 76, 0.18);
}

.apg-single-image img {
    width: 100%;
    height: auto;
    display: block;
}

.apg-single-kicker,
.apg-box-label {
    display: inline-flex;
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #0b1736;
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.apg-single-info h1 {
    margin: 0 0 12px;
    font-size: clamp(34px, 4vw, 58px);
    line-height: .98;
    letter-spacing: -0.055em;
    color: #0b1736;
}

.apg-single-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.apg-single-badges .apg-code-pill {
    background: #eef2f7;
}

.apg-like-single {
    background: #eef2f7;
    color: #0b1736;
}

.apg-like-single:hover,
.apg-like-single.is-liked {
    background: #0b1736;
    color: #fff;
}

.apg-single-summary {
    margin: 18px 0 22px;
    color: #5d6a82;
    line-height: 1.65;
}

.apg-prompt-box,
.apg-meta-panel {
    border: 1px solid rgba(11, 23, 54, 0.10);
    background: #fff;
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 18px 45px rgba(13, 31, 76, 0.07);
    margin-top: 18px;
}

.apg-prompt-box-light {
    background: #f8fafc;
}

.apg-prompt-box pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 18px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.7;
    color: #20304d;
}

.apg-meta-panel {
    display: grid;
    gap: 16px;
}

.apg-meta-panel div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.apg-meta-panel strong {
    font-size: 11px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: #98a2b3;
}

.apg-meta-panel span {
    color: #0b1736;
    font-weight: 700;
}

@media (max-width: 980px) {
    .apg-cols-3,
    .apg-cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .apg-single-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 640px) {
    .apg-cols-2,
    .apg-cols-3,
    .apg-cols-4 {
        grid-template-columns: 1fr;
    }

    .apg-thumb {
        aspect-ratio: 1 / 1.05;
    }

    .apg-card-content {
        left: 16px;
        right: 16px;
    }

    .apg-by {
        max-width: 44%;
    }
}

/* v1.4 - página individual com prompt rolável, observação e ações */
.apg-note-box {
    border: 1px solid rgba(11, 23, 54, 0.10);
    background: #fff7ed;
    border-radius: 24px;
    padding: 20px 22px;
    box-shadow: 0 18px 45px rgba(13, 31, 76, 0.06);
    margin-top: 18px;
}

.apg-note-box .apg-note-label {
    background: #f59e0b;
    color: #111827;
}

.apg-note-box p {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #3f2d12;
    font-weight: 700;
}

.apg-prompt-scroll {
    max-height: 292px;
    overflow-y: auto;
    padding: 0 14px 0 0;
    margin: 0 0 18px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 23, 54, 0.38) rgba(11, 23, 54, 0.08);
}

.apg-prompt-scroll:focus {
    outline: 2px solid rgba(11, 23, 54, 0.18);
    outline-offset: 4px;
    border-radius: 12px;
}

.apg-prompt-scroll::-webkit-scrollbar {
    width: 8px;
}

.apg-prompt-scroll::-webkit-scrollbar-track {
    background: rgba(11, 23, 54, 0.08);
    border-radius: 999px;
}

.apg-prompt-scroll::-webkit-scrollbar-thumb {
    background: rgba(11, 23, 54, 0.38);
    border-radius: 999px;
}

.apg-prompt-scroll pre {
    margin: 0;
}

.apg-single-action-panel {
    border: 1px solid rgba(11, 23, 54, 0.10);
    background: #fff;
    border-radius: 24px;
    padding: 16px 18px;
    box-shadow: 0 18px 45px rgba(13, 31, 76, 0.07);
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.apg-save {
    border: 0;
    min-height: 36px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease, color .2s ease;
}

.apg-save:hover,
.apg-save.is-saved {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, .34);
}

.apg-save-panel,
.apg-like-panel {
    background: #f4f7fb;
    color: #0b1736;
    min-height: 38px;
    padding: 0 14px;
}

.apg-save-panel:hover,
.apg-save-panel.is-saved,
.apg-like-panel:hover,
.apg-like-panel.is-liked {
    background: #0b1736;
    color: #fff;
}

.apg-save-icon {
    font-size: 17px;
    line-height: 1;
}

.apg-save-count {
    min-width: 1ch;
}

@media (max-width: 640px) {
    .apg-prompt-scroll {
        max-height: 245px;
    }

    .apg-single-action-panel {
        padding: 14px;
    }
}

/* v1.5 - página interna limpa: curtida na imagem, categoria no bloco e sem painel de ações */
body.single-apg_prompt .entry-title,
body.single-apg_prompt .page-title {
    display: none;
}

body.single-apg_prompt .apg-single-info h1 {
    display: block;
}

.apg-single-image {
    position: relative;
}

.apg-like-image {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    min-height: 34px;
    padding: 0 11px;
    background: rgba(11, 23, 54, .48);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}

.apg-like-image:hover,
.apg-like-image.is-liked {
    background: rgba(11, 23, 54, .78);
    color: #fff;
}

.apg-prompt-head {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.apg-prompt-head .apg-box-label,
.apg-prompt-head .apg-code-pill {
    margin-bottom: 0;
}

.apg-prompt-head .apg-code-pill {
    background: #eef2f7;
    color: #0b1736;
    min-height: 28px;
}

.apg-single-action-panel {
    display: none;
}

@media (max-width: 640px) {
    .apg-like-image {
        top: 13px;
        right: 13px;
    }
}
