/* AI Prompt Gallery — Frontend Styles */
.aipg-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px 60px;
    color: #0f172a;
    background: #eaf1fb;
}
.aipg-wrapper * { box-sizing: border-box; }
.aipg-wrapper svg { display: block; }

/* ---------- Tabs ---------- */
.aipg-tabs-container { display: flex; justify-content: center; margin-bottom: 28px; }
.aipg-pill-bar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 6px;
    display: inline-flex;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.aipg-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 24px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.aipg-tab-btn.active { background: #0f172a; color: #ffffff; }
.aipg-icon { width: 18px; height: 18px; }

/* ---------- Category chip strip (swipeable) + filter ---------- */
.aipg-catbar-wrap { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.aipg-catbar {
    display: flex; gap: 8px; overflow-x: auto; scroll-behavior: smooth; flex: 1;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 2px 6px;
}
.aipg-catbar::-webkit-scrollbar { display: none; }
.aipg-chip {
    flex: 0 0 auto; background: #ffffff; border: 1px solid #e2e8f0; color: #334155;
    font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 9999px; cursor: pointer;
    white-space: nowrap; transition: all 0.15s ease;
}
.aipg-chip em { font-style: normal; color: #94a3b8; font-weight: 600; }
.aipg-chip.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.aipg-chip.active em { color: #ddd6fe; }
.aipg-filter-btn {
    flex: 0 0 auto; display: flex; align-items: center; gap: 6px; background: #0f172a; color: #fff;
    border: none; padding: 10px 16px; border-radius: 9999px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.aipg-filter-btn svg { width: 15px; height: 15px; }
.aipg-filter-panel {
    position: absolute; top: 100%; right: 0; margin-top: 8px; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 14px; box-shadow: 0 10px 30px -6px rgba(15,23,42,0.18); padding: 10px; width: 260px;
    max-height: 340px; overflow-y: auto; z-index: 20;
}
.aipg-filter-panel-title { font-size: 12px; font-weight: 800; color: #94a3b8; padding: 4px 8px 8px; letter-spacing: 0.4px; }
.aipg-filter-panel-list { display: flex; flex-direction: column; gap: 2px; }
.aipg-filter-item {
    display: flex; justify-content: space-between; align-items: center; background: none; border: none;
    text-align: left; padding: 9px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #334155;
    cursor: pointer;
}
.aipg-filter-item span { color: #94a3b8; font-weight: 700; font-size: 12px; }
.aipg-filter-item:hover { background: #f8fafc; }
.aipg-filter-item.active { background: #f5f3ff; color: #7c3aed; }
.aipg-filter-item.active span { color: #7c3aed; }

/* ---------- Grid & cards ---------- */
/* Mobile-first: 2 columns by default, growing on larger screens */
.aipg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
@media (min-width: 640px) { .aipg-grid { gap: 20px; } }
@media (min-width: 900px) { .aipg-wrapper { max-width: 1280px; } .aipg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .aipg-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.aipg-grid-empty { text-align: center; padding: 60px 20px; color: #94a3b8; font-weight: 600; }

/* Simple card: home / listing grid — image only, click opens the detail page */
.aipg-simple-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #f1f5f9;
    aspect-ratio: 4/5;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    transition: transform 0.2s, box-shadow 0.2s;
}
.aipg-simple-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px -3px rgba(0,0,0,0.1); }
.aipg-simple-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Rich card: used only in the "You might also like" section */
.aipg-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}
.aipg-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px -3px rgba(0,0,0,0.08); }
.aipg-card-img-wrap { position: relative; width: 100%; aspect-ratio: 4/5; background: #f1f5f9; overflow: hidden; cursor: pointer; }
.aipg-card-img { width: 100%; height: 100%; object-fit: cover; }
.aipg-card-badges {
    position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: flex-start;
    gap: 6px; pointer-events: none;
}
/* small icon + text, transparent background (no pill) */
.aipg-wrapper .aipg-badge-pill {
    display: inline-flex; align-items: center; gap: 4px; background: transparent !important; padding: 0 !important; border: none !important;
    border-radius: 0 !important; backdrop-filter: none; color: #ffffff !important; font-size: 11px; font-weight: 700; line-height: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,0.75), 0 0 2px rgba(0,0,0,0.5);
}
.aipg-wrapper .aipg-badge-pill svg { width: 14px !important; height: 14px !important; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7)); }
.aipg-badge-pill.photos { margin-left: auto; }
.aipg-focus-hidden { display: none !important; }
.aipg-card-body { padding: 14px; display: flex; flex-direction: column; flex: 1; }
.aipg-card-cat { font-size: 11px; font-weight: 800; color: #7c3aed; margin-bottom: 4px; }
.aipg-card-title { font-size: 14px; font-weight: 800; color: #0f172a; margin: 0 0 6px; line-height: 1.3; cursor: pointer; }
.aipg-card-prompt { font-size: 12px; color: #64748b; line-height: 1.5; margin-bottom: 12px; flex: 1; }
.aipg-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid #f1f5f9; gap: 8px; }
.aipg-card-rating { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #64748b; }
.aipg-card-rating .aipg-star { width: 12px; height: 12px; fill: #e2e8f0; }
.aipg-card-rating .aipg-star.filled { fill: #f59e0b; }
.aipg-card-stats-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.aipg-card-stats-row .aipg-stat-item { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #64748b; }
.aipg-card-stats-row .aipg-stat-item svg { width: 13px; height: 13px; stroke: #94a3b8; fill: none; }
.aipg-copy-btn-block { flex: 1; width: 100%; text-align: center; }
.aipg-copy-btn {
    background: #7c3aed; color: #ffffff; border: none; padding: 7px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.2s; white-space: nowrap;
}
.aipg-copy-btn:hover { background: #6d28d9; }
.aipg-copy-btn.copied { background: #059669; }

.aipg-loadmore-wrap { text-align: center; margin: 40px 0; }
.aipg-wrapper .aipg-loadmore-btn {
    display: inline-block !important; background: #0f172a !important; color: #ffffff !important; font-size: 15px !important;
    font-weight: 800 !important; padding: 14px 40px !important; border: none !important; border-radius: 9999px !important;
    cursor: pointer; box-shadow: 0 10px 20px -3px rgba(15, 23, 42, 0.25); transition: all 0.2s ease; opacity: 1 !important;
}
.aipg-wrapper .aipg-loadmore-btn:hover { background: #1e293b !important; }
.aipg-loadmore-count { margin-top: 10px; font-size: 12px; color: #94a3b8; }

/* ---------- Sort bar (shared: Browse by Style + Libraries page) ---------- */
.aipg-sort-bar {
    display: inline-flex; background: #fff; border: 1px solid #e2e8f0; border-radius: 9999px;
    padding: 4px; gap: 4px; flex: 0 0 auto;
}
.aipg-sort-btn {
    border: none; background: transparent; padding: 8px 16px; border-radius: 9999px; font-size: 12px;
    font-weight: 800; color: #64748b; cursor: pointer; transition: all 0.15s ease;
}
.aipg-sort-btn.active { background: #0f172a; color: #fff; }

/* ---------- Category avatar (shared) ---------- */
.aipg-cat-avatar {
    width: 52px; height: 52px; border-radius: 15px; flex: 0 0 auto;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 900; font-size: 20px;
    box-shadow: 0 6px 14px -4px rgba(37,99,235,0.5);
}

/* ---------- Browse by Style ---------- */
.aipg-style-section { margin-top: 48px; }
.aipg-style-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.aipg-style-title { font-size: 24px; font-weight: 900; color: #0f172a; margin: 0 0 4px; }
.aipg-style-sub { font-size: 13px; color: #64748b; margin: 0; }
.aipg-style-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
}
@media (min-width: 640px) { .aipg-style-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 900px) { .aipg-style-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.aipg-style-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 22px 14px;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
    cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; font-family: inherit;
}
.aipg-style-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -6px rgba(15,23,42,0.12); }
.aipg-style-card-name { font-size: 14px; font-weight: 800; color: #0f172a; line-height: 1.3; }
.aipg-style-card-count { font-size: 12px; font-weight: 600; color: #94a3b8; }
.aipg-style-footer { text-align: center; margin-top: 26px; }
.aipg-viewall-btn {
    display: inline-block; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
    font-size: 14px; font-weight: 800; padding: 13px 32px; border-radius: 9999px; text-decoration: none;
    box-shadow: 0 10px 20px -6px rgba(37,99,235,0.4);
}
.aipg-viewall-btn:hover { opacity: 0.92; }

/* ================================================================
   LIBRARIES FULL VIEW (opened in a new tab via ?aipg_view=libraries)
================================================================ */
.aipg-library-view { max-width: 1100px; margin: 0 auto; }
.aipg-lib-title { font-size: 30px; font-weight: 900; color: #0f172a; margin: 8px 0 14px; line-height: 1.25; }
.aipg-lib-title span { background: linear-gradient(135deg, #2563eb, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.aipg-lib-desc { font-size: 15px; color: #475569; line-height: 1.6; margin: 0 0 22px; max-width: 720px; }
.aipg-lib-desc strong { color: #0f172a; }
.aipg-lib-search-wrap {
    position: relative; margin-bottom: 14px; max-width: 480px;
}
.aipg-lib-search-wrap svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; stroke: #94a3b8; }
.aipg-lib-search {
    width: 100%; padding: 13px 16px 13px 44px; border-radius: 9999px; border: 1px solid #e2e8f0;
    background: #fff; font-size: 14px; color: #0f172a;
}
.aipg-lib-search:focus { outline: none; border-color: #7c3aed; }
#aipg-lib-sort { margin-bottom: 26px; }
.aipg-lib-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .aipg-lib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .aipg-lib-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.aipg-lib-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 20px; cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.aipg-lib-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px -6px rgba(15,23,42,0.12); }
.aipg-lib-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.aipg-lib-card-count { font-size: 12px; font-weight: 800; color: #64748b; background: #f1f5f9; padding: 5px 12px; border-radius: 9999px; }
.aipg-lib-card-name { font-size: 17px; font-weight: 800; color: #0f172a; margin-bottom: 6px; }
.aipg-lib-card-desc { font-size: 13px; color: #64748b; line-height: 1.5; margin: 0 0 12px; }
.aipg-lib-card-link { font-size: 13px; font-weight: 700; color: #2563eb; }

/* ================================================================
   SINGLE CATEGORY PAGE (opened whenever a category is clicked)
================================================================ */
.aipg-category-view { max-width: 1100px; margin: 0 auto; }
.aipg-crumb-current-pill {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 9999px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aipg-cat-title { font-size: 30px; font-weight: 900; color: #0f172a; margin: 8px 0 14px; line-height: 1.25; }
.aipg-cat-title span { background: linear-gradient(135deg, #2563eb, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.aipg-cat-desc { font-size: 15px; color: #475569; line-height: 1.6; margin: 0 0 26px; max-width: 720px; }
.aipg-cat-desc strong { color: #0f172a; }
#aipg-cat-tabs { margin-bottom: 6px; }

/* ================================================================
   DETAIL VIEW
================================================================ */
.aipg-detail-view { max-width: 1000px; margin: 0 auto; }
.aipg-detail-main { max-width: 760px; margin: 0 auto; }
.aipg-detail-loading { text-align: center; padding: 80px 20px; color: #94a3b8; font-weight: 600; }

.aipg-breadcrumb {
    display: flex; align-items: center; gap: 8px; font-size: 13px; color: #64748b;
    margin-bottom: 18px; flex-wrap: wrap;
}
.aipg-crumb-home { display: inline-flex; color: #7c3aed; }
.aipg-crumb-home svg { width: 16px; height: 16px; }
.aipg-crumb-cat { color: #7c3aed; font-weight: 700; text-decoration: none; }
.aipg-crumb-cat:hover { text-decoration: underline; }
.aipg-crumb-sep { color: #cbd5e1; }
.aipg-crumb-current { color: #0f172a; font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Media / gallery */
.aipg-media-block {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 20px; padding: 12px;
    margin-bottom: 22px; box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.aipg-media-badge {
    display: inline-block; background: #0f172a; color: #fff; font-size: 11px; font-weight: 800;
    padding: 4px 12px; border-radius: 9999px; margin-bottom: 10px;
}
/* The frame always takes the photo's own shape (portrait / landscape / square): JS sets --aipg-r = width / height */
.aipg-media-main {
    position: relative; box-sizing: border-box; margin: 0 auto;
    width: min(100%, calc(80vh * var(--aipg-r, 0.8))); aspect-ratio: var(--aipg-r, 0.8);
    border-radius: 16px; overflow: hidden; background: #f1f5f9; border: 3px solid #0f172a;
    box-shadow: 0 10px 28px rgba(15,23,42,0.18);
}
.aipg-media-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aipg-wrapper .aipg-media-nav {
    position: absolute !important; top: 50% !important; transform: translateY(-50%) !important;
    width: 46px !important; height: 46px !important; min-width: 46px !important; padding: 0 !important; margin: 0 !important;
    border-radius: 50% !important; border: 2px solid #0f172a !important;
    background: #ffffff !important; color: #0f172a !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    cursor: pointer; z-index: 5; opacity: 1 !important; line-height: 1 !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.45) !important;
    transition: transform 0.15s ease, background 0.15s ease;
}
.aipg-wrapper .aipg-media-nav:hover { background: #7c3aed !important; border-color: #7c3aed !important; color: #ffffff !important; transform: translateY(-50%) scale(1.08) !important; }
.aipg-wrapper .aipg-media-nav svg {
    display: block !important; width: 24px !important; height: 24px !important; fill: none !important;
    stroke: currentColor !important; stroke-width: 3 !important; stroke-linecap: round; stroke-linejoin: round;
}
.aipg-media-nav.prev { left: 12px !important; }
.aipg-media-nav.next { right: 12px !important; }
.aipg-media-counter {
    position: absolute; bottom: 14px; right: 14px; background: rgba(15,23,42,0.8); color: #fff;
    font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: 9999px; z-index: 4;
}
.aipg-media-actions { position: absolute; bottom: 14px; left: 14px; display: flex; gap: 10px; z-index: 5; }
.aipg-wrapper .aipg-media-action-btn {
    background: #ffffff !important; color: #0f172a !important; border: 2px solid #0f172a !important;
    width: 42px !important; height: 42px !important; min-width: 42px !important; padding: 0 !important; margin: 0 !important;
    border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important;
    cursor: pointer; text-decoration: none !important; opacity: 1 !important; line-height: 1 !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.45) !important;
}
.aipg-wrapper .aipg-media-action-btn:hover { background: #7c3aed !important; border-color: #7c3aed !important; color: #ffffff !important; }
.aipg-wrapper .aipg-media-action-btn svg {
    display: block !important; width: 22px !important; height: 22px !important; fill: none !important;
    stroke: currentColor !important; stroke-width: 2.4 !important; stroke-linecap: round; stroke-linejoin: round;
}
.aipg-media-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.aipg-thumb-item {
    width: 64px; height: 64px; border-radius: 10px; overflow: hidden; flex: 0 0 auto; cursor: pointer;
    border: 2px solid transparent; opacity: 0.6;
}
.aipg-thumb-item.active { border-color: #7c3aed; opacity: 1; }
.aipg-thumb-item img { width: 100%; height: 100%; object-fit: cover; }

/* Title block */
.aipg-detail-heading { margin-bottom: 20px; }
.aipg-eyebrow-badge {
    display: inline-block; background: #0f172a; color: #fff; font-size: 11px; font-weight: 800;
    letter-spacing: 0.5px; padding: 4px 12px; border-radius: 8px; margin-bottom: 12px;
}
.aipg-detail-title { font-size: 28px; font-weight: 900; line-height: 1.25; margin: 0 0 8px; color: #0f172a; }
.aipg-detail-meta { font-size: 13px; color: #64748b; }
.aipg-detail-meta { pointer-events: none; cursor: default; user-select: text; }
.aipg-author-name { color: #7c3aed; font-weight: 700; text-decoration: none; cursor: default; pointer-events: none; }
.aipg-detail-date { cursor: default; pointer-events: none; }

/* Shared panel */
.aipg-panel {
    background: #ffffff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 20px;
    margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.aipg-panel-title { font-size: 13px; font-weight: 800; color: #0f172a; margin-bottom: 14px; letter-spacing: 0.2px; }

/* Prompt panel */
.aipg-prompt-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.aipg-prompt-icon {
    width: 34px; height: 34px; border-radius: 10px; background: #f5f3ff; color: #7c3aed;
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.aipg-prompt-icon svg { width: 18px; height: 18px; }
.aipg-prompt-label { font-size: 13px; font-weight: 900; color: #0f172a; }
.aipg-prompt-sub { font-size: 11px; color: #94a3b8; font-weight: 600; }
.aipg-prompt-text {
    font-size: 14px; line-height: 1.7; color: #334155; background: #f8fafc; border-radius: 12px; padding: 14px; margin: 0 0 16px;
    white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%;
    max-height: 220px; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.aipg-prompt-text::-webkit-scrollbar { width: 6px; }
.aipg-prompt-text::-webkit-scrollbar-track { background: transparent; }
.aipg-prompt-text::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
.aipg-prompt-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.aipg-btn-lg {
    display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800;
    padding: 11px 22px; border-radius: 9999px; border: none; cursor: pointer; transition: all 0.2s;
}
.aipg-btn-lg svg { width: 16px; height: 16px; }
.aipg-btn-copy-lg { background: #ea580c; color: #fff; flex: 1; justify-content: center; }
.aipg-btn-copy-lg:hover { background: #c2410c; }
.aipg-btn-copy-lg.copied { background: #059669; }
.aipg-btn-like-lg { background: #eff6ff; color: #2563eb; }
.aipg-btn-like-lg.liked { background: #2563eb; color: #fff; }
.aipg-btn-like-lg svg { fill: none; }
.aipg-btn-like-lg.liked svg { fill: #fff; }

/* Share panel */
.aipg-share-icons { display: flex; gap: 10px; flex-wrap: wrap; padding: 2px 0; }
.aipg-wrapper .aipg-share-btn {
    width: 44px !important; height: 44px !important; min-width: 44px !important; padding: 0 !important; margin: 0 !important;
    border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important;
    color: #ffffff !important; text-decoration: none !important; border: none !important; cursor: pointer;
    opacity: 1 !important; line-height: 1 !important; box-shadow: 0 3px 8px rgba(15,23,42,0.25);
    transition: transform 0.15s ease;
}
.aipg-wrapper .aipg-share-btn:hover { transform: translateY(-2px) scale(1.06); color: #ffffff !important; }
.aipg-wrapper .aipg-share-btn svg { display: block !important; width: 21px !important; height: 21px !important; fill: currentColor; stroke: none; }
.aipg-wrapper .aipg-share-btn.copylink svg { fill: none !important; stroke: currentColor !important; stroke-width: 2.2 !important; stroke-linecap: round; }
.aipg-wrapper .aipg-share-btn.fb { background: #1877f2 !important; }
.aipg-wrapper .aipg-share-btn.tw { background: #000000 !important; }
.aipg-wrapper .aipg-share-btn.ig { background: radial-gradient(circle at 30% 110%, #fdf497, #fd5949 45%, #d6249f 60%, #285AEB 90%) !important; }
.aipg-wrapper .aipg-share-btn.th { background: #101010 !important; }
.aipg-wrapper .aipg-share-btn.pin { background: #e60023 !important; }
.aipg-wrapper .aipg-share-btn.wa { background: #25D366 !important; }
.aipg-wrapper .aipg-share-btn.copylink { background: #64748b !important; }

/* Community rating panel */
.aipg-rating-summary { text-align: center; margin-bottom: 18px; }
.aipg-rating-big { font-size: 40px; font-weight: 900; color: #0f172a; line-height: 1; }
.aipg-rating-stars-row { display: flex; justify-content: center; gap: 4px; margin: 8px 0; }
.aipg-rating-stars-row .aipg-star { fill: #e2e8f0; }
.aipg-rating-stars-row .aipg-star.filled { fill: #f59e0b; }
.aipg-rating-count { font-size: 12px; font-weight: 800; color: #94a3b8; letter-spacing: 0.5px; }
.aipg-dist-wrap { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.aipg-dist-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #64748b; }
.aipg-dist-star { width: 10px; text-align: right; font-weight: 700; }
.aipg-dist-track { flex: 1; height: 8px; background: #f1f5f9; border-radius: 9999px; overflow: hidden; }
.aipg-dist-fill { height: 100%; background: #f59e0b; border-radius: 9999px; }
.aipg-dist-count { width: 24px; text-align: right; }
.aipg-rate-cta { text-align: center; border-top: 1px solid #f1f5f9; padding-top: 18px; }
.aipg-rate-cta-label { font-size: 11px; font-weight: 800; color: #94a3b8; letter-spacing: 0.5px; margin-bottom: 10px; }
.aipg-rate-stars { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.aipg-rate-star { background: none; border: none; cursor: pointer; padding: 2px; }
.aipg-rate-star svg { width: 26px; height: 26px; fill: #e2e8f0; transition: fill 0.15s; }
.aipg-rate-star:disabled { cursor: default; }
.aipg-rate-star.hover-fill svg { fill: #f59e0b; }
.aipg-rate-star.filled svg { fill: #f59e0b; }
.aipg-rate-hint { min-height: 18px; font-size: 13px; font-weight: 800; color: #d97706; margin: 0 0 14px; text-align: center; }
.aipg-btn-outline-sm {
    background: #f5f3ff; color: #7c3aed; border: none; font-size: 12px; font-weight: 800;
    padding: 10px 20px; border-radius: 9999px; cursor: pointer;
}

/* Model chip */
.aipg-model-chip {
    display: inline-block; background: #f1f5f9; color: #334155; font-size: 13px; font-weight: 700;
    padding: 6px 16px; border-radius: 9999px;
}

/* Tags panel */
.aipg-tags-list { display: flex; flex-wrap: wrap; gap: 8px; }
.aipg-tag-chip {
    background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 700; padding: 6px 12px;
    border-radius: 9999px; border: none;
}
.aipg-tag-more { background: #ede9fe; color: #7c3aed; cursor: pointer; }

/* Related ("You might also like") — uses the same rich .aipg-card markup as before */
.aipg-related-block { margin-top: 30px; }
.aipg-related-title { font-size: 20px; font-weight: 900; color: #0f172a; margin-bottom: 16px; }
.aipg-related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .aipg-related-grid { gap: 16px; } }
@media (min-width: 900px) { .aipg-related-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.aipg-related-grid .aipg-card-body { padding: 10px; }
.aipg-related-grid .aipg-card-title { font-size: 13px; }
.aipg-related-grid .aipg-card-stats-row { gap: 8px; margin-bottom: 10px; }
.aipg-related-grid .aipg-card-prompt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.aipg-related-grid .aipg-copy-btn { padding: 6px 10px; font-size: 11px; }

/* ---------- Small-screen fit & polish ---------- */
@media (max-width: 480px) {
    .aipg-wrapper { padding: 16px 10px 40px; }
    .aipg-panel { padding: 14px; border-radius: 14px; }
    .aipg-detail-title { font-size: 22px; }
    .aipg-media-badge { font-size: 10px; padding: 3px 10px; }
    .aipg-rating-big { font-size: 32px; }
    .aipg-share-icons { gap: 8px; }
    .aipg-prompt-text { font-size: 13px; padding: 12px; }
    .aipg-btn-lg { padding: 10px 16px; font-size: 13px; }
    .aipg-filter-panel { width: calc(100vw - 52px); right: -6px; }
    .aipg-style-title { font-size: 20px; }
    .aipg-lib-title { font-size: 24px; }
}

/* ---------- Skeleton (direct-link open, no text) ---------- */
.aipg-detail-skeleton { max-width: 760px; margin: 0 auto; padding: 10px 0; }
.aipg-sk-bar { height: 18px; width: 50%; background: #e2e8f0; border-radius: 8px; margin: 10px 0 16px; }
.aipg-sk-bar.short { width: 70%; height: 26px; margin-top: 18px; }
.aipg-sk-img { width: 100%; height: 420px; max-height: 60vh; background: #e2e8f0; border-radius: 16px; }

/* ---------- Preview lightbox (opens in the same tab) ---------- */
html.aipg-lb-open, html.aipg-lb-open body { overflow: hidden !important; }
.aipg-lightbox {
    position: fixed !important; inset: 0 !important; z-index: 2147483000 !important; background: rgba(2,6,23,0.92) !important;
    display: flex !important; align-items: center !important; justify-content: center !important; padding: 16px; box-sizing: border-box;
}
.aipg-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; border: 3px solid #ffffff; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.aipg-lightbox .aipg-lb-btn {
    position: absolute !important; width: 48px !important; height: 48px !important; padding: 0 !important; border-radius: 50% !important;
    background: #ffffff !important; color: #0f172a !important; border: 2px solid #0f172a !important; font-size: 26px !important; font-weight: 800 !important;
    line-height: 1 !important; cursor: pointer; display: flex !important; align-items: center; justify-content: center; opacity: 1 !important;
}
.aipg-lightbox .aipg-lb-close { top: 16px; right: 16px; font-size: 20px !important; }
.aipg-lightbox .aipg-lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.aipg-lightbox .aipg-lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.aipg-lightbox .aipg-lb-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(15,23,42,0.8); padding: 5px 14px; border-radius: 9999px; font-size: 12px; font-weight: 800; }

/* ---------- Masonry: each card keeps its photo's own shape (no fixed 4:5 crop, no blank space) ---------- */
.aipg-wrapper .aipg-masonry { grid-auto-rows: 4px; row-gap: 0 !important; align-items: start; }
.aipg-masonry > * { align-self: start; }
.aipg-masonry .aipg-simple-card.aipg-img-ready { aspect-ratio: auto; }
.aipg-masonry .aipg-simple-card.aipg-img-ready .aipg-simple-card-img { height: auto; }
.aipg-masonry .aipg-card-img-wrap { aspect-ratio: 4/5; }
.aipg-masonry .aipg-card-img-wrap.aipg-img-ready { aspect-ratio: auto; }
.aipg-masonry .aipg-card-img-wrap.aipg-img-ready .aipg-card-img { height: auto; display: block; }

/* ---------- Additive Anchor Link Styles for Crawlable URLs ---------- */
a.aipg-simple-card { display: block; text-decoration: none; color: inherit; }
a.aipg-card-img-wrap { display: block; text-decoration: none; color: inherit; }
a.aipg-card-cat { text-decoration: none; }
a.aipg-card-cat:hover { text-decoration: underline; }
.aipg-card-title a { color: inherit; text-decoration: none; }
.aipg-card-title a:hover { color: #7c3aed; }
a.aipg-style-card { text-decoration: none; color: inherit; }
a.aipg-lib-card { text-decoration: none; color: inherit; }
a.aipg-crumb-home { text-decoration: none; }

