/**
 * Pixel Gallery - AI Face Search Stylesheet (face-search.css)
 * House Style: Borderless Glassmorphism, Bottom-Underline Tabs, Smooth Transitions, Full Dark Mode
 */

/* =========================================================
   1. Action Bar "ค้นหาด้วยใบหน้า" Icon Button (Clean Minimalist Style)
   ========================================================= */
.action-face-btn:not(.pg-fp-dial-btn),
.pg-face-action-btn {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: inherit;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, color 0.2s ease;
}

.action-face-btn:not(.pg-fp-dial-btn).visible,
.pg-face-action-btn.visible {
    display: inline-flex;
}

@media (hover: hover) and (pointer: fine) {
    .action-face-btn:not(.pg-fp-dial-btn):hover,
    .pg-face-action-btn:hover {
        transform: scale(1.15);
        opacity: 0.85;
    }
}

.action-face-btn:not(.pg-fp-dial-btn).active-filter,
.pg-face-action-btn.active-filter {
    color: #2563eb !important;
}

.action-face-btn:not(.pg-fp-dial-btn).active-filter::after,
.pg-face-action-btn.active-filter::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 0 6px rgba(37, 99, 235, 0.7);
}

/* =========================================================
   2. People in Album Row (Face Clusters Chips)
   ========================================================= */
.pg-people-bar-wrap {
    width: 100%;
    max-width: 1360px;
    margin: 0 auto 20px;
    padding: 0 14px;
    box-sizing: border-box;
    display: none;
}

.pg-people-bar-wrap.visible {
    display: block;
    animation: pgFaceFadeIn 0.3s ease;
}

.pg-people-bar-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.035);
}

.dark-mode .pg-people-bar-header,
[data-theme="dark"] .pg-people-bar-header {
    background: rgba(255, 255, 255, 0.05);
}

.pg-people-bar-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dark-mode .pg-people-bar-title,
[data-theme="dark"] .pg-people-bar-title {
    color: #94a3b8;
}

.pg-people-scroll {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    scrollbar-width: thin;
}

.pg-people-scroll::-webkit-scrollbar {
    height: 4px;
}
.pg-people-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 99px;
}

.pg-person-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    font-family: inherit;
}

@media (hover: hover) and (pointer: fine) {
    .pg-person-chip:hover {
        transform: translateY(-2px);
    }
}

.pg-person-avatar-ring {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    padding: 2px;
    background: rgba(148, 163, 184, 0.25);
    transition: all 0.2s ease;
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
    .pg-person-chip:hover .pg-person-avatar-ring {
        background: #3b82f6;
    }
}

.pg-person-chip.active .pg-person-avatar-ring {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.pg-person-avatar-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    object-fit: cover;
    background: #1e293b;
}

.pg-person-count {
    font-size: 0.68rem;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
}

.pg-person-chip.active .pg-person-count {
    color: #2563eb;
    font-weight: 600;
}

.dark-mode .pg-person-count,
[data-theme="dark"] .pg-person-count {
    color: #94a3b8;
}
.dark-mode .pg-person-chip.active .pg-person-count,
[data-theme="dark"] .pg-person-chip.active .pg-person-count {
    color: #60a5fa;
}

/* =========================================================
   3. Active Face Filter Banner (Minimal Glass & Responsive UX)
   ========================================================= */
.pg-face-banner {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto 22px;
    padding: 0 14px;
    box-sizing: border-box;
    display: none;
}

.pg-face-banner.visible {
    display: block;
    animation: pgFaceFadeIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-face-banner-inner {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 252, 0.90) 100%);
    border-radius: 22px;
    padding: 18px 20px;
    box-shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.03);
    border: 1px solid rgba(15, 23, 42, 0.07);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-sizing: border-box;
}

.dark-mode .pg-face-banner-inner,
[data-theme="dark"] .pg-face-banner-inner {
    background: linear-gradient(145deg, rgba(24, 24, 28, 0.92) 0%, rgba(17, 17, 21, 0.92) 100%);
    border-color: rgba(255, 255, 255, 0.09);
    box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.55);
}

.pg-face-banner-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pg-face-banner-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.pg-face-banner-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pg-face-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
    flex-shrink: 0;
    transition: background-color 0.22s ease, box-shadow 0.22s ease;
}

.pg-face-status-dot[data-tier="weak"] {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.pg-face-status-dot.is-scanning {
    background: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
    animation: pgStatusPulse 1.4s ease-in-out infinite;
}

@keyframes pgStatusPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.25); opacity: 0.7; }
}

.pg-face-banner-title {
    font-size: 0.96rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.dark-mode .pg-face-banner-title,
[data-theme="dark"] .pg-face-banner-title {
    color: #f8fafc;
}

.pg-face-count-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2.5px 9px;
    border-radius: 9999px;
    font-size: 0.73rem;
    font-weight: 600;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dark-mode .pg-face-count-pill,
[data-theme="dark"] .pg-face-count-pill {
    background: rgba(255, 255, 255, 0.11);
    color: #f8fafc;
}

.pg-face-banner-sub {
    font-size: 0.78rem;
    color: #64748b;
    margin: 0;
    line-height: 1.45;
}

.dark-mode .pg-face-banner-sub,
[data-theme="dark"] .pg-face-banner-sub {
    color: #94a3b8;
}

.pg-face-reset-top-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.10);
    color: #dc2626;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.18s ease;
}

.pg-face-reset-top-btn:active {
    transform: scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-reset-top-btn:hover {
        background: rgba(239, 68, 68, 0.16);
        border-color: rgba(239, 68, 68, 0.34);
        color: #b91c1c;
    }
}

.dark-mode .pg-face-reset-top-btn,
[data-theme="dark"] .pg-face-reset-top-btn {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(248, 113, 113, 0.28);
    color: #f87171;
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .pg-face-reset-top-btn:hover,
    [data-theme="dark"] .pg-face-reset-top-btn:hover {
        background: rgba(239, 68, 68, 0.24);
        border-color: rgba(248, 113, 113, 0.42);
        color: #fca5a5;
    }
}

/* Segmented Filter Tabs inside Banner with Smooth Sliding Glider (2 Tabs: รูปของคุณ / อาจเป็นคุณ) */
.pg-face-tier-tabs {
    --tab-gap: 4px;
    --tab-pad: 4px;
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--tab-gap);
    padding: var(--tab-pad);
    border-radius: 13px;
    background: rgba(15, 23, 42, 0.045);
    isolation: isolate;
    --glider-idx: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.dark-mode .pg-face-tier-tabs,
[data-theme="dark"] .pg-face-tier-tabs {
    background: rgba(255, 255, 255, 0.06);
}

.pg-face-tier-glider {
    position: absolute;
    top: var(--tab-pad);
    bottom: var(--tab-pad);
    left: var(--tab-pad);
    width: calc((100% - (var(--tab-pad) * 2) - var(--tab-gap)) / 2);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    pointer-events: none;
    z-index: 1;
    transform: translateX(calc(var(--glider-idx, 0) * (100% + var(--tab-gap))));
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), background 0.24s ease, box-shadow 0.24s ease;
    will-change: transform;
    box-sizing: border-box;
}

.pg-face-tier-tabs[data-active-tier="strong"] .pg-face-tier-glider {
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 100%);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.28), 0 2px 8px rgba(16, 185, 129, 0.12);
}

.pg-face-tier-tabs[data-active-tier="weak"] .pg-face-tier-glider {
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.32), 0 2px 8px rgba(245, 158, 11, 0.12);
}

.dark-mode .pg-face-tier-glider,
[data-theme="dark"] .pg-face-tier-glider {
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.dark-mode .pg-face-tier-tabs[data-active-tier="strong"] .pg-face-tier-glider,
[data-theme="dark"] .pg-face-tier-tabs[data-active-tier="strong"] .pg-face-tier-glider {
    background: rgba(16, 185, 129, 0.2);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.36), 0 2px 10px rgba(0, 0, 0, 0.35);
}

.dark-mode .pg-face-tier-tabs[data-active-tier="weak"] .pg-face-tier-glider,
[data-theme="dark"] .pg-face-tier-tabs[data-active-tier="weak"] .pg-face-tier-glider {
    background: rgba(245, 158, 11, 0.22);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.38), 0 2px 10px rgba(0, 0, 0, 0.35);
}

.pg-face-tier-tab {
    position: relative;
    z-index: 2;
    background: transparent !important;
    box-shadow: none !important;
    border: none;
    border-radius: 10px;
    padding: 6px 3px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    transition: color 0.22s ease, transform 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
    box-sizing: border-box;
}

.pg-tier-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.pg-face-tier-tab[data-tier="strong"] .pg-tier-dot {
    background: #10b981;
}

.pg-face-tier-tab[data-tier="weak"] .pg-tier-dot {
    background: #f59e0b;
}

.pg-face-tier-tab.active .pg-tier-dot {
    opacity: 1;
    transform: scale(1.15);
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-tier-tab:hover {
        color: #334155;
    }
}

.pg-face-tier-tab:active {
    transform: scale(0.97);
}

.pg-face-tier-tab .pg-tier-num {
    font-size: 0.67rem;
    font-weight: 600;
    padding: 0.5px 5px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.06);
    color: inherit;
    font-variant-numeric: tabular-nums;
    min-width: 17px;
    text-align: center;
    line-height: 1.35;
    flex-shrink: 0;
    transition: background 0.22s ease, color 0.22s ease;
}

.pg-face-tier-tab.active {
    color: #0f172a;
    font-weight: 600;
}

.pg-face-tier-tab[data-tier="strong"].active {
    color: #065f46;
}

.pg-face-tier-tab[data-tier="weak"].active {
    color: #92400e;
}

.pg-face-tier-tab[data-tier="strong"].active .pg-tier-num {
    background: #059669;
    color: #ffffff;
}

.pg-face-tier-tab[data-tier="weak"].active .pg-tier-num {
    background: #d97706;
    color: #ffffff;
}

.dark-mode .pg-face-tier-tab,
[data-theme="dark"] .pg-face-tier-tab {
    color: #94a3b8;
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .pg-face-tier-tab:hover,
    [data-theme="dark"] .pg-face-tier-tab:hover {
        color: #cbd5e1;
    }
}

.dark-mode .pg-face-tier-tab .pg-tier-num,
[data-theme="dark"] .pg-face-tier-tab .pg-tier-num {
    background: rgba(255, 255, 255, 0.08);
}

.dark-mode .pg-face-tier-tab[data-tier="strong"].active,
[data-theme="dark"] .pg-face-tier-tab[data-tier="strong"].active {
    color: #6ee7b7;
}

.dark-mode .pg-face-tier-tab[data-tier="weak"].active,
[data-theme="dark"] .pg-face-tier-tab[data-tier="weak"].active {
    color: #fcd34d;
}

.dark-mode .pg-face-tier-tab[data-tier="strong"].active .pg-tier-num,
[data-theme="dark"] .pg-face-tier-tab[data-tier="strong"].active .pg-tier-num {
    background: #10b981;
    color: #052e16;
}

.dark-mode .pg-face-tier-tab[data-tier="weak"].active .pg-tier-num,
[data-theme="dark"] .pg-face-tier-tab[data-tier="weak"].active .pg-tier-num {
    background: #f59e0b;
    color: #451a03;
}

/* Action Toolbar (Desktop Row / Mobile Clean Stack + Grid) */
.pg-face-banner-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.pg-face-secondary-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pg-face-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    box-sizing: border-box;
}

.pg-face-btn:active {
    transform: scale(0.98);
}

.pg-face-btn-primary {
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 6px 16px -4px rgba(15, 23, 42, 0.2);
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-btn-primary:hover {
        background: #1e293b;
        transform: translateY(-1px);
    }
}

.dark-mode .pg-face-btn-primary,
[data-theme="dark"] .pg-face-btn-primary {
    background: #ffffff;
    color: #09090b;
    box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.4);
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .pg-face-btn-primary:hover,
    [data-theme="dark"] .pg-face-btn-primary:hover {
        background: #f1f5f9;
    }
}

.pg-face-btn-soft {
    background: rgba(15, 23, 42, 0.05);
    color: #334155;
    border: 1px solid rgba(15, 23, 42, 0.05);
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-btn-soft:hover {
        background: rgba(15, 23, 42, 0.09);
        color: #0f172a;
    }
}

.dark-mode .pg-face-btn-soft,
[data-theme="dark"] .pg-face-btn-soft {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.08);
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .pg-face-btn-soft:hover,
    [data-theme="dark"] .pg-face-btn-soft:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #ffffff;
    }
}

/* ปุ่ม "สแกนใหม่" ในแบนเนอร์อัลบั้ม ใช้โทนสีฟ้า AI เดียวกับหน้าโปรไฟล์ */
#pgFaceRescanBtn {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.22);
    font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
    #pgFaceRescanBtn:hover {
        background: rgba(37, 99, 235, 0.16);
        border-color: rgba(37, 99, 235, 0.34);
        color: #1e40af;
    }
}

.dark-mode #pgFaceRescanBtn,
[data-theme="dark"] #pgFaceRescanBtn {
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.28);
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode #pgFaceRescanBtn:hover,
    [data-theme="dark"] #pgFaceRescanBtn:hover {
        background: rgba(59, 130, 246, 0.24);
        border-color: rgba(96, 165, 250, 0.42);
        color: #93c5fd;
    }
}

/* Active state & tactile feedback for "แจ้งเตือนรูปใหม่" / "ตั้งเตือนแล้ว" */
.pg-face-btn-notify {
    transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.18s ease;
}

.pg-face-btn-notify:active:not(:disabled) {
    transform: scale(0.96);
}

.pg-face-btn-notify.is-notify-active {
    background: rgba(16, 185, 129, 0.13);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.32);
    font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-btn-notify.is-notify-active:hover:not(:disabled) {
        background: rgba(16, 185, 129, 0.20);
        color: #065f46;
        border-color: rgba(16, 185, 129, 0.45);
    }
}

.dark-mode .pg-face-btn-notify.is-notify-active,
[data-theme="dark"] .pg-face-btn-notify.is-notify-active {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.36);
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .pg-face-btn-notify.is-notify-active:hover:not(:disabled),
    [data-theme="dark"] .pg-face-btn-notify.is-notify-active:hover:not(:disabled) {
        background: rgba(16, 185, 129, 0.26);
        color: #6ee7b7;
        border-color: rgba(16, 185, 129, 0.50);
    }
}

.pg-face-btn-notify.is-notify-loading {
    opacity: 0.72;
    cursor: wait;
}

.pg-face-btn-notify .pg-notify-spin {
    animation: pgNotifySpin 0.7s linear infinite;
}

.pg-face-btn-notify.is-notify-pop {
    animation: pgNotifyPop 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pgNotifySpin {
    to { transform: rotate(360deg); }
}

@keyframes pgNotifyPop {
    0%   { transform: scale(0.94); }
    50%  { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.pg-face-btn-ghost {
    background: transparent;
    color: #ef4444;
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-btn-ghost:hover {
        background: rgba(239, 68, 68, 0.08);
    }
}

.pg-face-scan-progress-track {
    width: 100%;
    height: 4px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.dark-mode .pg-face-scan-progress-track,
[data-theme="dark"] .pg-face-scan-progress-track {
    background: rgba(255, 255, 255, 0.1);
}

.pg-face-scan-progress-bar {
    width: 2%;
    height: 100%;
    border-radius: 9999px;
    background: #2563eb;
    transition: width 0.2s ease;
}

@media (max-width: 680px) {
    .pg-face-banner {
        padding: 0 10px;
        margin-bottom: 16px;
    }

    .pg-face-banner-inner {
        padding: 15px 14px;
        border-radius: 18px;
        gap: 12px;
    }

    .pg-face-banner-title {
        font-size: 0.9rem;
    }

    .pg-face-banner-sub {
        font-size: 0.74rem;
    }

    .pg-face-reset-top-btn {
        padding: 5px 10px;
        font-size: 0.73rem;
    }

    .pg-face-tier-tabs {
        --tab-gap: 3.5px;
        --tab-pad: 3.5px;
        border-radius: 12px;
    }

    .pg-face-tier-glider {
        border-radius: 9px;
    }

    .pg-face-tier-tab {
        padding: 5.5px 2px;
        font-size: 0.72rem;
        gap: 3.5px;
    }

    .pg-tier-dot {
        width: 5.5px;
        height: 5.5px;
    }

    .pg-face-tier-tab .pg-tier-num {
        font-size: 0.65rem;
        padding: 0.5px 4px;
        min-width: 16px;
    }

    .pg-face-banner-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .pg-face-btn-cart-main {
        width: 100%;
        padding: 10.5px 16px;
        font-size: 0.84rem;
    }

    .pg-face-secondary-actions.has-two {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    .pg-face-secondary-actions.has-one {
        display: flex;
        width: 100%;
    }

    .pg-face-secondary-actions .pg-face-btn {
        width: 100%;
        padding: 9px 10px;
        font-size: 0.78rem;
        gap: 6px;
        border-radius: 11px;
    }

    .pg-face-secondary-actions .pg-face-btn svg {
        width: 13px;
        height: 13px;
        flex-shrink: 0;
    }
}

@media (max-width: 380px) {
    .pg-face-tier-tabs {
        --tab-gap: 2.5px;
        --tab-pad: 2.5px;
    }

    .pg-face-tier-tab {
        padding: 5px 1px;
        font-size: 0.68rem;
        gap: 2.5px;
    }

    .pg-tier-dot {
        width: 5px;
        height: 5px;
    }

    .pg-face-tier-tab .pg-tier-num {
        font-size: 0.61rem;
        padding: 0.5px 3px;
        min-width: 15px;
    }
}

/* =========================================================
   4. Matched Gallery Card Badges & "ไม่ใช่ฉัน" Button
   ========================================================= */
.pg-card-face-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.78);
    pointer-events: none;
}

.pg-card-face-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
    flex-shrink: 0;
}

.pg-card-face-badge.weak .pg-card-face-dot {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.8);
}

.pg-card-not-me-btn {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 9999px;
    border: none;
    background: rgba(15, 23, 42, 0.78);
    color: rgba(255, 255, 255, 0.94);
    font-size: 0.68rem;
    line-height: 1.25;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, background-color 0.18s ease, transform 0.15s ease;
}

.profile-fav-thumb-box {
    position: relative;
}

/* ปุ่ม "ใช่ฉัน" บนการ์ดหมวด "อาจเป็นคุณ" (ซ่อนจนกว่าจะ Hover บนเดสก์ท็อป และแสดงบนจอสัมผัส/iPad เหมือนปุ่มอื่น) */
.pg-card-yes-me-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 9999px;
    border: none;
    background: #059669;
    color: #ffffff;
    font-size: 0.68rem;
    line-height: 1.25;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
    transition: opacity 0.18s ease, transform 0.15s ease, background 0.15s ease;
}

.pg-card-not-me-btn:focus-visible,
.pg-card-yes-me-btn:focus-visible {
    opacity: 1;
    pointer-events: auto;
}

@media (hover: hover) and (pointer: fine) {
    .gallery-item:hover .pg-card-not-me-btn,
    .gallery-item:hover .pg-card-yes-me-btn,
    .profile-fav-card:hover .pg-card-not-me-btn,
    .profile-fav-card:hover .pg-card-yes-me-btn {
        opacity: 1;
        pointer-events: auto;
    }

    .pg-card-not-me-btn:hover {
        background: #e11d48;
        color: #ffffff;
        transform: scale(1.04);
    }

    .pg-card-yes-me-btn:hover {
        background: #047857;
        transform: scale(1.05);
    }
}

@media (hover: none), (pointer: coarse) {
    .pg-card-not-me-btn {
        opacity: 0.9;
        pointer-events: auto;
    }

    .pg-card-yes-me-btn {
        opacity: 0.96;
        pointer-events: auto;
    }
}

.pg-card-yes-me-btn:disabled {
    opacity: 0.6;
    cursor: default;
    pointer-events: none;
}

/* บนการ์ดหน้าอัลบั้ม: รวม "ใช่ฉัน" และ "ไม่ใช่ฉัน" ไว้ฝั่งซ้ายล่าง ไม่ทับปุ่มดาวน์โหลด/ตะกร้าฝั่งขวาล่าง */
.pg-card-face-actions {
    position: absolute;
    bottom: 12px;
    left: 10px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 108px);
    flex-wrap: wrap;
    pointer-events: none;
}

.pg-card-face-actions .pg-card-yes-me-btn,
.pg-card-face-actions .pg-card-not-me-btn {
    position: static;
}

.pg-card-face-badge.confirmed .pg-card-face-dot {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

/* แถวยืนยัน "ใช่ฉัน" ทั้งหมดบนแบนเนอร์ */
.pg-face-confirm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.22);
}

.pg-face-confirm-hint {
    font-size: 0.76rem;
    line-height: 1.4;
    color: inherit;
    opacity: 0.85;
    flex: 1 1 220px;
}

.pg-face-btn.pg-face-btn-confirm {
    background: #059669;
    color: #ffffff;
    border: none;
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-btn.pg-face-btn-confirm:hover {
        background: #047857;
    }
}

@media (max-width: 640px) {
    .pg-face-confirm-row .pg-face-btn-confirm {
        width: 100%;
        justify-content: center;
    }
}

/* =========================================================
   5. Selfie Search Modal (True Borderless Glassmorphism + Pill & Underline Tabs)
   ========================================================= */
/* ใช้ CSS filter: blur(14px) บนคอนเทนเนอร์หน้าอัลบั้มโดยตรงแทนการใช้ backdrop-filter บน Overlay
   เพื่อตัดบั๊ก Skia Partial-Damage Tile Clipping ของ Chrome บน macOS ที่ทำให้เกิดกรอบสี่เหลี่ยมเงาดำเมื่อเลื่อนเมาส์หรือเปิดกล้อง */
.pg-album-page-wrap {
    background-color: var(--bg-color, #ffffff);
}

body.pg-face-modal-open .pg-album-page-wrap,
body.pg-face-modal-open > .landing-hero,
body.pg-face-modal-open > .collection-container,
body.pg-face-modal-open > .profile-wrap {
    filter: blur(14px);
    -webkit-filter: blur(14px);
    pointer-events: none !important;
    user-select: none !important;
}

@media (max-width: 768px) {
    body.pg-face-modal-open .pg-album-page-wrap,
    body.pg-face-modal-open > .landing-hero,
    body.pg-face-modal-open > .collection-container,
    body.pg-face-modal-open > .profile-wrap {
        filter: blur(8px);
        -webkit-filter: blur(8px);
    }
}

body.pg-face-modal-open #page-loader {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: none !important;
}

body.pg-face-modal-open .gallery-item {
    animation: none !important;
    background-image: none !important;
}

body.pg-face-modal-open .gallery-item img.pro-image {
    transition: none !important;
}

body.pg-face-modal-open .pg-folder-trigger-btn,
body.pg-face-modal-open .pg-folder-reset-btn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html.pg-face-modal-open,
body.pg-face-modal-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

.pg-face-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100015;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-sizing: border-box;
    overflow: hidden !important;
    overscroll-behavior: none;
    touch-action: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.pg-face-modal-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pg-face-modal-card {
    width: 100%;
    max-width: 440px;
    max-height: calc(100dvh - 28px);
    overflow: hidden !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0%, rgba(244, 247, 252, 0.93) 100%);
    border-radius: 26px;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 24px 56px -12px rgba(15, 23, 42, 0.26), 0 4px 16px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.78);
    position: relative;
    isolation: isolate;
    contain: paint;
    color: #0f172a;
    font-family: 'Prompt', 'Kanit', sans-serif;
    opacity: 0;
    transform: translateY(10px) translateZ(0);
    transition: opacity 0.2s ease-out, transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-face-modal-overlay.open .pg-face-modal-card {
    opacity: 1;
    transform: translateY(0) translateZ(0);
}

.dark-mode .pg-face-modal-card,
[data-theme="dark"] .pg-face-modal-card {
    background: linear-gradient(145deg, rgba(39, 39, 42, 0.94) 0%, rgba(18, 18, 20, 0.96) 100%);
    color: #f4f4f5;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 28px 64px -12px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.pg-face-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.pg-face-modal-head-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.dark-mode .pg-face-modal-head-badge,
[data-theme="dark"] .pg-face-modal-head-badge {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.pg-face-modal-head-text {
    flex: 1;
    min-width: 0;
}

.pg-face-modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-modal-close:hover {
        background: rgba(15, 23, 42, 0.12);
        color: #0f172a;
        transform: scale(1.05);
    }
}

.dark-mode .pg-face-modal-close,
[data-theme="dark"] .pg-face-modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .pg-face-modal-close:hover,
    [data-theme="dark"] .pg-face-modal-close:hover {
        background: rgba(255, 255, 255, 0.18);
        color: #ffffff;
    }
}

.pg-face-modal-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 2px;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.pg-face-modal-subtitle {
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.38;
    margin: 0;
}

.dark-mode .pg-face-modal-subtitle,
[data-theme="dark"] .pg-face-modal-subtitle {
    color: #94a3b8;
}

/* Segmented Glass Tabs inside Modal */
.pg-face-modal-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.055);
    margin-bottom: 12px;
}

.dark-mode .pg-face-modal-tabs,
[data-theme="dark"] .pg-face-modal-tabs {
    background: rgba(255, 255, 255, 0.07);
}

.pg-face-modal-tab {
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-face-modal-tab.active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.dark-mode .pg-face-modal-tab,
[data-theme="dark"] .pg-face-modal-tab {
    color: #94a3b8;
}
.dark-mode .pg-face-modal-tab.active,
[data-theme="dark"] .pg-face-modal-tab.active {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

/* Camera Viewfinder & Oval Guide */
.pg-camera-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: min(44vh, 260px);
    border-radius: 16px;
    overflow: hidden;
    background: #090d16;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
    contain: layout paint;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.pg-camera-cta-wrap {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.pg-camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1) translateZ(0);
    backface-visibility: hidden;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.pg-camera-video.is-playing {
    opacity: 1;
}

.pg-camera-oval-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pg-camera-shutter-flash {
    position: absolute;
    inset: 0;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.pg-camera-shutter-flash.flash {
    opacity: 0.85;
}

.pg-camera-status-pill {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    max-width: calc(100% - 32px);
    padding: 5.5px 13px;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.pg-camera-status-pill::before {
    content: '';
    width: 6.5px;
    height: 6.5px;
    border-radius: 50%;
    background: #60a5fa;
    flex-shrink: 0;
}

.pg-camera-status-pill.good {
    background: rgba(15, 23, 42, 0.86);
    border-color: rgba(16, 185, 129, 0.45);
}

.pg-camera-status-pill.good::before {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.pg-camera-status-pill.warn {
    background: rgba(15, 23, 42, 0.86);
    border-color: rgba(245, 158, 11, 0.42);
}

.pg-camera-status-pill.warn::before {
    background: #f59e0b;
}

.pg-camera-snap-cta {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.25);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
    .pg-camera-snap-cta:hover:not(:disabled) {
        background: #2563eb;
        transform: translateY(-1px);
        box-shadow: 0 14px 28px -6px rgba(37, 99, 235, 0.38);
    }
}

.pg-camera-snap-cta:active:not(:disabled) {
    transform: scale(0.98);
}

.pg-camera-snap-cta:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.pg-camera-snap-cta.is-ready {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 12px 26px -6px rgba(16, 185, 129, 0.42);
}

@media (hover: hover) and (pointer: fine) {
    .pg-camera-snap-cta.is-ready:hover:not(:disabled) {
        background: #059669;
    }
}

.pg-camera-snap-cta.is-loading {
    background: #0f172a !important;
    color: #f1f5f9 !important;
    cursor: wait !important;
    pointer-events: none !important;
    opacity: 0.95 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
    transform: none !important;
}

.pg-face-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: pgFaceSpin 0.75s linear infinite;
    display: inline-block;
    flex-shrink: 0;
    margin-right: 8px;
    vertical-align: -2px;
}

@keyframes pgFaceSpin {
    to { transform: rotate(360deg); }
}

/* Glassmorphism Camera/Upload Stage Loading Overlay */
.pg-face-stage-loading {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border-radius: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-face-stage-loading.active {
    opacity: 1;
    pointer-events: auto;
}

.pg-face-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    max-width: 280px;
}

.pg-face-loading-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: #10b981;
    border-right-color: #38bdf8;
    animation: pgFaceSpin 0.8s linear infinite;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
    margin-bottom: 14px;
    flex-shrink: 0;
}

.pg-face-loading-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.2px;
    margin-bottom: 5px;
    font-family: var(--font-sans, 'Kanit', sans-serif);
}

.pg-face-loading-subtitle {
    font-size: 11.5px;
    color: #94a3b8;
    line-height: 1.45;
    font-family: var(--font-sans, 'Kanit', sans-serif);
}

.dark-mode .pg-camera-snap-cta,
[data-theme="dark"] .pg-camera-snap-cta {
    background: #2563eb;
}

.dark-mode .pg-camera-snap-cta.is-ready,
[data-theme="dark"] .pg-camera-snap-cta.is-ready {
    background: #10b981;
}

/* Upload Dropzone & Multi-Face Picker Canvas */
.pg-upload-zone {
    border: 1.5px dashed rgba(148, 163, 184, 0.45);
    border-radius: 16px;
    padding: 22px 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(148, 163, 184, 0.04);
}

@media (hover: hover) and (pointer: fine) {
    .pg-upload-zone:hover {
        border-color: #3b82f6;
        background: rgba(59, 130, 246, 0.05);
    }
}

.pg-multiface-wrap {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.pg-multiface-wrap.visible {
    display: flex;
}

.pg-multiface-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #0f172a;
    line-height: 0;
}

.pg-multiface-img {
    max-width: 100%;
    max-height: min(38vh, 230px);
    width: auto;
    height: auto;
    display: block;
}

.pg-face-box-btn {
    position: absolute;
    border: 2.5px solid #3b82f6;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.18);
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 0;
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-box-btn:hover {
        border-color: #10b981;
        background: rgba(16, 185, 129, 0.28);
        transform: scale(1.04);
    }
}

/* Quick Re-search Card */
.pg-quick-reuse-card {
    padding: 9px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.045);
    border: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.pg-quick-reuse-text {
    font-size: 0.76rem;
    font-weight: 500;
    color: #334155;
    min-width: 0;
    flex: 1;
}

.pg-quick-reuse-btn {
    padding: 6.5px 12px;
    font-size: 0.75rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.dark-mode .pg-quick-reuse-card,
[data-theme="dark"] .pg-quick-reuse-card {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.09);
}

.dark-mode .pg-quick-reuse-text,
[data-theme="dark"] .pg-quick-reuse-text {
    color: #cbd5e1;
}

/* =========================================================
   6. Lightbox Interactive Face Hotspots
   ========================================================= */
.pg-lightbox-face-overlay {
    position: fixed;
    pointer-events: none;
    z-index: 10002;
}

.pg-lightbox-face-hotspot {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.85), 0 4px 14px rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.15);
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-lightbox-face-hotspot:hover {
        transform: scale(1.05);
        background: rgba(37, 99, 235, 0.32);
    }
}

.pg-lightbox-face-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    white-space: nowrap;
}

@keyframes pgFaceFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Smart Floating Discovery Nudge (Non-intrusive Glassmorphism Pill)
   ========================================================= */
@keyframes pgFacePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.18); color: #7c3aed; }
    100% { transform: scale(1); }
}

.action-face-btn.attention-pulse,
.pg-face-action-btn.attention-pulse {
    animation: pgFacePulse 1.8s ease-in-out infinite;
}

.pg-face-nudge-pill {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9980;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 8px 14px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    color: #1e293b;
    font-family: 'Kanit', sans-serif;
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    user-select: none;
}

.pg-face-nudge-pill.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.pg-face-nudge-pill.fade-out {
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    pointer-events: none;
}

.pg-face-nudge-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.dark-mode .pg-face-nudge-icon {
    background: rgba(167, 139, 250, 0.15);
    color: #c4b5fd;
}

.pg-face-nudge-text {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.2px;
    white-space: nowrap;
    color: #0f172a;
}

body.dark-mode .pg-face-nudge-text {
    color: #f1f5f9;
}

.pg-face-nudge-cta {
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.2s ease, background 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-nudge-cta:hover {
        background: #7c3aed;
        transform: scale(1.04);
    }
}

body.dark-mode .pg-face-nudge-cta {
    background: #7c3aed;
    color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-face-nudge-cta:hover {
        background: #6d28d9;
    }
}

.pg-face-nudge-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin-left: -4px;
    transition: color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-face-nudge-close:hover {
        color: #475569;
        background: rgba(0, 0, 0, 0.05);
    }
}

body.dark-mode .pg-face-nudge-pill {
    background: rgba(18, 20, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 40px -4px rgba(0, 0, 0, 0.5);
    color: #f1f5f9;
}

body.dark-mode .pg-face-nudge-close {
    color: #64748b;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-face-nudge-close:hover {
        color: #cbd5e1;
        background: rgba(255, 255, 255, 0.08);
    }
}

@media (max-width: 640px) {
    .pg-face-nudge-pill {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        left: 14px;
        right: 14px;
        justify-content: space-between;
        padding: 8px 10px 8px 12px;
    }
    .pg-face-nudge-text {
        font-size: 12px;
    }
    .pg-face-nudge-cta {
        padding: 6px 13px;
        font-size: 11.5px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ============================================================================
   Step-0 Explicit Biometric PDPA Consent Gate
   ============================================================================ */
.pg-face-consent-step {
    padding: 4px 0 2px;
}

.pg-face-consent-box {
    background: rgba(15, 23, 42, 0.035);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 14px;
}

html.dark-mode .pg-face-consent-box,
body.dark-mode .pg-face-consent-box,
[data-theme="dark"] .pg-face-consent-box {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.pg-face-consent-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    margin-bottom: 8px;
}

html.dark-mode .pg-face-consent-eyebrow,
body.dark-mode .pg-face-consent-eyebrow,
[data-theme="dark"] .pg-face-consent-eyebrow {
    background: rgba(96, 165, 250, 0.18);
    color: #93c5fd;
}

.pg-face-consent-intro {
    margin: 0 0 12px;
    font-size: 0.84rem;
    line-height: 1.55;
    color: #334155;
}

html.dark-mode .pg-face-consent-intro,
body.dark-mode .pg-face-consent-intro,
[data-theme="dark"] .pg-face-consent-intro {
    color: #cbd5e1;
}

.pg-face-consent-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 0.81rem;
    line-height: 1.48;
    color: #1e293b;
    cursor: pointer;
    margin-bottom: 8px;
}

html.dark-mode .pg-face-consent-check,
body.dark-mode .pg-face-consent-check,
[data-theme="dark"] .pg-face-consent-check {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.pg-face-consent-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: #18181b;
    flex-shrink: 0;
    cursor: pointer;
}

html.dark-mode .pg-face-consent-check input[type="checkbox"],
body.dark-mode .pg-face-consent-check input[type="checkbox"],
[data-theme="dark"] .pg-face-consent-check input[type="checkbox"] {
    accent-color: #60a5fa;
}

.pg-face-consent-footnote {
    font-size: 0.74rem;
    color: #64748b;
    margin-top: 6px;
}

.pg-face-consent-footnote a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pg-face-consent-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.pg-face-consent-actions .pg-face-btn {
    min-height: 40px;
    font-size: 0.84rem;
    padding: 0 16px;
    border-radius: 9999px;
}

.pg-face-btn-ghost {
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    border: none;
    cursor: pointer;
}

html.dark-mode .pg-face-btn-ghost,
body.dark-mode .pg-face-btn-ghost,
[data-theme="dark"] .pg-face-btn-ghost {
    background: rgba(255, 255, 255, 0.09);
    color: #cbd5e1;
}

@media (max-width: 520px) {
    .pg-face-consent-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .pg-face-consent-actions .pg-face-btn {
        width: 100%;
    }
}
