/* Face Swap — integrated UI */
.fs-app.fs-app--page {
    max-width: 100%;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
}

.fs-app {
    --fs-bg: #0f1117;
    --fs-surface: #1a1d27;
    --fs-surface-2: #242836;
    --fs-border: rgba(255, 255, 255, 0.08);
    --fs-text: #f4f6fb;
    --fs-muted: #9aa3b8;
    --fs-accent: #6c5ce7;
    --fs-accent-2: #a29bfe;
    --fs-success: #00cec9;
    --fs-warning: #fdcb6e;
    --fs-danger: #ff7675;
    --fs-radius: 16px;
    --fs-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--fs-text);
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2.5rem;
}

.fs-app * {
    box-sizing: border-box;
}

.fs-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.fs-header h2 {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.fs-header p {
    margin: 0.35rem 0 0;
    color: var(--fs-muted);
    font-size: 0.95rem;
}

.fs-credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.25), rgba(0, 206, 201, 0.15));
    border: 1px solid rgba(108, 92, 231, 0.4);
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
}

.fs-credit-badge .fs-coin {
    font-size: 1.2rem;
}

.fs-credit-badge.fs-low {
    border-color: rgba(255, 118, 117, 0.5);
    background: rgba(255, 118, 117, 0.12);
}

.fs-cost-hint {
    font-size: 0.8rem;
    color: var(--fs-muted);
    font-weight: 400;
}

.fs-guest-banner,
.fs-low-credit-banner {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.fs-guest-banner {
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

.fs-low-credit-banner {
    background: rgba(255, 118, 117, 0.1);
    border: 1px solid rgba(255, 118, 117, 0.35);
}

.fs-guest-banner a,
.fs-low-credit-banner a {
    color: var(--fs-accent-2);
    font-weight: 600;
}

.fs-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .fs-layout {
        grid-template-columns: 1fr;
    }
}

.fs-panel {
    background: var(--fs-surface);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius);
    padding: 1.35rem;
    box-shadow: var(--fs-shadow);
}

.fs-panel-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--fs-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.fs-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.fs-step {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.35rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--fs-muted);
    background: var(--fs-surface-2);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.fs-step.fs-active {
    color: var(--fs-text);
    border-color: var(--fs-accent);
    background: rgba(108, 92, 231, 0.15);
}

.fs-dropzone {
    position: relative;
    border: 2px dashed rgba(162, 155, 254, 0.45);
    border-radius: 14px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--fs-surface-2);
    margin-bottom: 1rem;
}

.fs-dropzone:hover,
.fs-dropzone.fs-dragover {
    border-color: var(--fs-accent-2);
    background: rgba(108, 92, 231, 0.08);
}

.fs-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.fs-dropzone-icon {
    font-size: 2rem;
    margin-bottom: 0.35rem;
}

.fs-dropzone-label {
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.fs-dropzone-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--fs-muted);
}

.fs-preview {
    display: none;
    margin-top: 0.75rem;
    border-radius: 12px;
    overflow: hidden;
    max-height: 140px;
}

.fs-preview img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.fs-demo-section label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--fs-muted);
    margin-bottom: 0.65rem;
}

.fs-demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 1rem;
}

.fs-demo-grid::-webkit-scrollbar {
    width: 6px;
}

.fs-demo-grid::-webkit-scrollbar-thumb {
    background: var(--fs-surface-2);
    border-radius: 3px;
}

.fs-demo-thumb {
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
}

.fs-demo-thumb:hover {
    transform: scale(1.04);
}

.fs-demo-thumb.fs-selected {
    border-color: var(--fs-accent-2);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.4);
}

.fs-submit {
    width: 100%;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--fs-accent), #5f4fd1);
    transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.35);
}

.fs-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(108, 92, 231, 0.45);
}

.fs-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.fs-terms-consent {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.fs-terms-consent__label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--fs-muted, #a8b0c3);
}

.fs-terms-consent__input {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    margin: 0.15rem 0 0;
    accent-color: var(--fs-accent, #6c5ce7);
    cursor: pointer;
}

.fs-terms-consent__input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.fs-terms-consent__text a {
    color: var(--fs-accent-2, #a29bfe);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.fs-terms-consent__text a:hover {
    color: #c4bcff;
}

.fs-result-panel {
    min-height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.fs-result-placeholder {
    color: var(--fs-muted);
}

.fs-result-placeholder .fs-placeholder-icon {
    font-size: 3rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}

.fs-result-image-wrap {
    position: relative;
    width: 100%;
    cursor: zoom-in;
    border-radius: 12px;
    overflow: hidden;
}

.fs-result-image-wrap img {
    width: 100%;
    display: block;
    border-radius: 12px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.fs-result-image-wrap:hover img {
    transform: scale(1.02);
    opacity: 0.92;
}

.fs-result-zoom-hint {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    pointer-events: none;
}

/* Lightbox modal */
.fs-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    box-sizing: border-box;
}

.fs-lightbox[hidden] {
    display: none !important;
}

.fs-lightbox-open {
    display: flex !important;
}

body.fs-lightbox-active {
    overflow: hidden;
}

.fs-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: zoom-out;
}

.fs-lightbox-dialog {
    position: relative;
    z-index: 2;
    max-width: min(96vw, 900px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.fs-lightbox-dialog img {
    max-width: 100%;
    max-height: calc(92vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.fs-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    transition: background 0.2s;
}

.fs-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.fs-lightbox-actions {
    display: flex;
    justify-content: center;
}

.fs-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding: 0.65rem 1.2rem;
    background: var(--fs-surface-2);
    border: 1px solid var(--fs-border);
    border-radius: 10px;
    color: var(--fs-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.fs-download-btn:hover {
    background: rgba(108, 92, 231, 0.2);
    color: var(--fs-text);
}

/* Thanh tiến trình khi chờ kết quả */
.fs-progress {
    display: none;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(36, 40, 54, 0.95) 0%, rgba(26, 29, 39, 0.98) 100%);
    border: 1px solid rgba(108, 92, 231, 0.35);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.fs-progress.fs-visible {
    display: flex;
}

.fs-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.fs-progress-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f4f6fb;
}

.fs-progress-pct {
    font-size: 0.88rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #a29bfe;
    min-width: 2.75rem;
    text-align: right;
}

.fs-progress-track {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

.fs-progress-bar {
    position: relative;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6c5ce7 0%, #a29bfe 45%, #00cec9 100%);
    background-size: 200% 100%;
    animation: fs-progress-shine 1.8s ease-in-out infinite;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(108, 92, 231, 0.55);
}

.fs-progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 100%
    );
    animation: fs-progress-sweep 1.4s ease-in-out infinite;
}

@keyframes fs-progress-shine {
    0%,
    100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes fs-progress-sweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(200%);
    }
}

.fs-progress-hint {
    margin: 0;
    font-size: 0.78rem;
    color: #9aa3b8;
    line-height: 1.4;
}

.fs-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--fs-surface-2);
    border-top-color: var(--fs-accent-2);
    border-radius: 50%;
    animation: fs-spin 0.8s linear infinite;
}

@keyframes fs-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ─── Classic form: trái = mặt + mẫu, phải = ảnh tải lên ─── */
.fs-app--classic .fs-layout--classic,
#face-swap-container.fs-layout--classic {
    display: block;
    width: 100%;
}

#face-swap-container .fs-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#face-swap-container.fs-layout--classic {
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
}

#face-swap-container .fs-panel--source,
#face-swap-container .fs-panel--target {
    height: 100%;
    min-height: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

#face-swap-container .fs-panel--target .fs-upload-card-frame {
    min-height: 200px;
}

#face-swap-container .fs-panel--target .fs-demo-section {
    margin-top: 0.85rem;
    min-width: 0;
    max-width: 100%;
}

#face-swap-container .fs-panel--target .fs-demo-section .fs-field-label {
    margin-bottom: 0.45rem;
}

#face-swap-container .fs-panel--target .demo-images-container {
    margin-bottom: 0;
    min-width: 0;
    max-width: 100%;
}

#face-swap-container .fs-form-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.25rem;
}

#face-swap-container .fs-form-actions .fs-progress {
    margin: 0.15rem 0;
}

#face-swap-container .fs-form-actions .fs-terms-consent {
    margin: 0.1rem 0 0.15rem;
}

@media (max-width: 768px) {
    #face-swap-container .fs-form-grid {
        grid-template-columns: 1fr;
    }

    #face-swap-container .fs-panel--target .fs-upload-card-frame {
        min-height: 168px;
    }
}

.fs-field-label {
    display: block;
    font-weight: 600;
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
}

/* Upload card — thay input file mặc định */
.fs-field--upload {
    margin-bottom: 1rem;
}

.fs-field--upload .fs-field-label {
    display: block;
    margin-bottom: 0.45rem;
}

.fs-upload-card {
    position: relative;
    display: block;
    cursor: pointer;
}

.fs-upload-card .fs-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* Khung viền đứt nét — preview nằm bên trong */
.fs-upload-card-frame {
    position: relative;
    min-height: 168px;
    border: 2px dashed rgba(162, 155, 254, 0.38);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(36, 40, 54, 0.95) 0%, rgba(26, 29, 39, 0.98) 100%);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.fs-upload-card:hover .fs-upload-card-frame,
.fs-upload-card.fs-dragover .fs-upload-card-frame,
.fs-upload-card.fs-has-file .fs-upload-card-frame {
    border-color: rgba(162, 155, 254, 0.75);
    box-shadow: 0 0 0 1px rgba(108, 92, 231, 0.15);
}

.fs-upload-card.fs-dragover .fs-upload-card-frame {
    background: rgba(108, 92, 231, 0.1);
}

.fs-upload-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-height: 168px;
    padding: 1.1rem 1rem;
    text-align: center;
    border: none;
    background: transparent;
}

.fs-upload-card.fs-has-file .fs-upload-card-inner {
    display: none;
}

.fs-upload-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 0.35rem;
    border-radius: 12px;
    background: rgba(108, 92, 231, 0.18);
    color: #a29bfe;
}

.fs-upload-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: #f4f6fb;
}

.fs-upload-sub {
    font-size: 0.82rem;
    color: #9aa3b8;
}

.fs-upload-link {
    color: #a29bfe;
    font-weight: 600;
}

.fs-upload-hint {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #6b7289;
    line-height: 1.35;
}

/* Preview trong khung — full ảnh (contain) */
.fs-upload-preview {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    background: #1a1d27;
    z-index: 1;
}

.fs-upload-preview:not([hidden]) {
    display: flex;
}

.fs-upload-preview-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0.5rem 0.5rem 0.25rem;
    box-sizing: border-box;
}

.fs-upload-preview-media img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
}

.fs-upload-preview .fs-upload-filename {
    flex-shrink: 0;
    display: block;
    padding: 0.35rem 0.65rem;
    font-size: 0.72rem;
    color: #9aa3b8;
    background: rgba(36, 40, 54, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.fs-upload-card .fs-preview-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(8, 10, 16, 0.75);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    transition: background 0.15s;
}

.fs-upload-card .fs-preview-clear:hover {
    background: rgba(255, 71, 87, 0.9);
}

.demo-images-container {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 112px;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.demo-images-viewport {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(108, 92, 231, 0.45) transparent;
    border-radius: 10px;
}

.demo-images-viewport::-webkit-scrollbar {
    height: 6px;
}

.demo-images-viewport::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.45);
    border-radius: 3px;
}

.demo-images-slider {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
    padding: 6px 2px;
    box-sizing: border-box;
}

.demo-image {
    width: 88px;
    height: 88px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    flex: 0 0 88px;
    display: block;
}

.demo-image.selected {
    border-color: var(--fs-accent-2, #a29bfe);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.4);
}

.slider-arrow {
    flex: 0 0 auto;
    position: static;
    transform: none;
    background-color: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    padding: 0;
    cursor: pointer;
    z-index: 2;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.slider-arrow:hover:not(:disabled) {
    background-color: rgba(108, 92, 231, 0.85);
}

.slider-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Shared buttons (page + embed) */
.fs-btn:disabled,
.fs-wizard-prev:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.fs-credit-value {
    font-variant-numeric: tabular-nums;
}

/* Credits row + Nạp credit */
.fs-credits-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 1rem;
}

.fs-credits-line-text {
    font-size: 0.95rem;
    font-weight: 600;
}

.fs-topup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.32rem 0.95rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
    color: #3d2e00;
    background: linear-gradient(145deg, #fff4c4 0%, #ffd54f 35%, #f5b800 70%, #e6a800 100%);
    border: 1px solid rgba(255, 220, 100, 0.9);
    border-radius: 999px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55) inset,
        0 -1px 0 rgba(180, 120, 0, 0.35) inset,
        0 2px 8px rgba(245, 184, 0, 0.35);
    cursor: pointer;
    transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.fs-topup-btn:hover {
    color: #2a2000;
    filter: brightness(1.06);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.65) inset,
        0 -1px 0 rgba(180, 120, 0, 0.4) inset,
        0 4px 14px rgba(245, 184, 0, 0.45);
    transform: translateY(-1px);
}

.fs-topup-btn:active {
    transform: translateY(0);
    filter: brightness(0.98);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.4) inset,
        0 2px 4px rgba(245, 184, 0, 0.3);
}

a.fs-topup-btn--login {
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, var(--fs-accent, #6c5ce7), #5f4fd1);
    border-color: rgba(162, 155, 254, 0.5);
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.35);
    text-shadow: none;
}

a.fs-topup-btn--login:hover {
    color: #fff;
    filter: brightness(1.08);
}

/* Top-up modal */
.fs-topup-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    box-sizing: border-box;
}

.fs-topup-modal[hidden] {
    display: none !important;
}

.fs-topup-open {
    display: flex !important;
}

body.fs-topup-active {
    overflow: hidden;
}

.fs-topup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

.fs-topup-dialog {
    position: relative;
    z-index: 2;
    width: min(96vw, 640px);
    max-height: 88vh;
    overflow: auto;
    background: var(--fs-surface, #1a1d27);
    border: 1px solid var(--fs-border, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 1.5rem 1.35rem 1.35rem;
    box-shadow: var(--fs-shadow, 0 24px 48px rgba(0, 0, 0, 0.45));
}

.fs-topup-close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.fs-topup-title {
    margin: 0 0 0.35rem;
    padding-right: 2rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

.fs-topup-desc {
    margin: 0 0 1.15rem;
    font-size: 0.88rem;
    color: #c5cdd9;
    line-height: 1.45;
}

.fs-topup-packages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.85rem;
}

.fs-topup-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--fs-border, rgba(255, 255, 255, 0.1));
    background: var(--fs-surface-2, #242836);
    overflow: hidden;
}

.fs-topup-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: block;
    padding: 0.28rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(90deg, #ff4757, #ff6b81);
}

.fs-topup-card.has-badge {
    padding-top: 2.1rem;
}

.fs-topup-card.is-highlight {
    border-color: var(--fs-accent, #6c5ce7);
    box-shadow: 0 0 0 1px rgba(108, 92, 231, 0.35);
}

.fs-topup-name {
    margin: 0;
    font-size: 1rem;
}

.fs-topup-credits {
    font-size: 0.88rem;
    color: var(--fs-muted, #9aa3b8);
}

.fs-topup-credits strong {
    color: var(--fs-text, #f4f6fb);
    font-weight: 700;
}

.fs-topup-extra {
    display: block;
    color: var(--fs-success, #00cec9);
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.fs-topup-price {
    font-size: 1.15rem;
    font-weight: 800;
    margin-top: auto;
    color: #ff3344;
}

.fs-topup-price .woocommerce-Price-amount,
.fs-topup-price .woocommerce-Price-currencySymbol,
.fs-topup-price bdi,
.fs-topup-price span {
    color: #ff3344 !important;
}

.fs-topup-buy {
    margin-top: 0.35rem;
    text-align: center;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

.fs-topup-empty {
    margin: 0;
    text-align: center;
    color: var(--fs-muted, #9aa3b8);
    font-size: 0.9rem;
}

/* ─── Lịch sử kết quả ─── */
.fs-history {
    width: 100%;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--fs-border, rgba(255, 255, 255, 0.08));
}

.fs-history-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fs-history-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.fs-history-count {
    font-size: 0.85rem;
    color: var(--fs-muted, #9aa3b8);
}

.fs-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.fs-history-grid.fs-history-loading {
    opacity: 0.55;
    pointer-events: none;
}

.fs-history-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1.25rem;
    text-align: center;
    color: var(--fs-muted, #9aa3b8);
    background: var(--fs-surface-2, #242836);
    border-radius: 10px;
}

.fs-history-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--fs-surface-2, #242836);
    border: 1px solid var(--fs-border, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    padding: 0.5rem;
}

.fs-history-thumb {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: zoom-in;
    aspect-ratio: 1;
}

.fs-history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.fs-history-thumb:hover img {
    transform: scale(1.03);
}

.fs-history-date {
    font-size: 0.72rem;
    color: var(--fs-muted, #9aa3b8);
    padding: 0 0.15rem;
}

.fs-history-download {
    justify-content: center;
    width: 100%;
    gap: 0.35rem;
}

.fs-history-pagination {
    margin-top: 1.25rem;
}

.fs-history-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.fs-history-page-btn,
.fs-history-page-current {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fs-history-page-btn {
    border: 1px solid var(--fs-border, rgba(255, 255, 255, 0.12));
    background: var(--fs-surface-2, #242836);
    color: var(--fs-text, #f4f6fb);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.fs-history-page-btn:hover {
    border-color: var(--fs-accent-2, #a29bfe);
    background: rgba(108, 92, 231, 0.2);
}

.fs-history-page-current {
    background: var(--fs-accent, #6c5ce7);
    color: #fff;
    font-weight: 600;
}

.fs-history-ellipsis {
    color: var(--fs-muted, #9aa3b8);
    padding: 0 0.25rem;
}
