/* ===== MSTPlay2 · Profile Selector ===== */

:root {
    --prof-max-w: 960px;
}

html,
body {
    height: 100%;
    background: #0a0a0f;
    color: #fff;
    margin: 0;
}

body {
    font-family: var(--font-viata, 'Outfit', sans-serif);
}

/* ── Animated background orbs ── */
.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: #0a0a0f;
    overflow: hidden;
}

.bg-canvas::before,
.bg-canvas::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.35;
    animation: orbFloat 14s ease-in-out infinite alternate;
}

.bg-canvas::before {
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, rgba(118, 43, 222, 0.35), transparent 70%);
    top: -18%;
    right: -12%;
}

.bg-canvas::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(38, 105, 245, 0.25), transparent 70%);
    bottom: -12%;
    left: -8%;
    animation-delay: -7s;
}

@keyframes orbFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, -20px) scale(1.1);
    }
}

/* ── Page wrapper ── */
.profiles-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 28px;
}

/* ── Logo ── */
.brand-logo {
    font-family: var(--font-viata, 'Outfit', sans-serif);
    font-size: 2.8rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -2px;
    text-decoration: none;
    text-align: center;
    display: block;
}

.brand-logo .play {
    font-weight: 300;
}

/* ── Title ── */
.profiles-title {
    font-family: var(--font-viata, 'Outfit', sans-serif);
    font-size: 1.55rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    margin: 0;
}

/* ── Profile grid ── */
.profiles-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
    max-width: var(--prof-max-w);
    width: 100%;
    padding: 12px 0 20px;
}

/* ── Profile card ── */
.profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 130px;
    text-decoration: none;
}

.profile-card:hover {
    transform: scale(1.08);
}

.profile-card:hover .profile-card-avatar {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(118, 43, 222, 0.4), 0 12px 40px rgba(0, 0, 0, 0.6);
}

.profile-card-avatar {
    width: 110px;
    height: 110px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    font-size: 3rem;
    line-height: 1;
    border: 3px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Kids badge */
.profile-card-avatar .kids-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: #22c55e;
    color: #000;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.2;
}

/* Lock icon */
.profile-card-avatar .lock-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.profile-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
}

.profile-card:hover .profile-card-name {
    color: #fff;
}

/* ── Add profile card ── */
.profile-card.add-card .profile-card-avatar {
    background: rgba(255, 255, 255, 0.04);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.15);
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.35);
}

.profile-card.add-card:hover .profile-card-avatar {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.6);
}

/* ── Manage button ── */
.manage-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 32px;
    border-radius: 8px;
    font-family: var(--font-viata, 'Outfit', sans-serif);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 0.3px;
}

.manage-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

/* ===== PIN Modal ===== */
.pin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.pin-card {
    background: rgba(20, 20, 28, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px 36px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    animation: scaleIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0.92);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.pin-avatar {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 2.4rem;
    line-height: 1;
    margin: 0 auto 16px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.pin-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.pin-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 28px;
}

.pin-dots {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 28px;
}

.pin-dot {
    width: 52px;
    height: 56px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font-viata, 'Outfit', sans-serif);
    text-align: center;
    outline: none;
    transition: all 0.2s;
    -webkit-text-security: disc;
}

.pin-dot:focus {
    border-color: #762BDE;
    background: rgba(118, 43, 222, 0.1);
    box-shadow: 0 0 0 3px rgba(118, 43, 222, 0.2);
}

.pin-dot.error {
    border-color: #ef4444;
    animation: shake 0.4s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

.pin-error-msg {
    color: #ef4444;
    font-size: 0.85rem;
    min-height: 20px;
    margin-bottom: 12px;
}

.pin-cancel {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s;
    font-family: var(--font-viata, 'Outfit', sans-serif);
}

.pin-cancel:hover {
    color: #fff;
}

/* ===== Create/Edit Profile Modal ===== */
.edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    animation: fadeIn 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}

.edit-card {
    background: rgba(16, 16, 22, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 36px 32px;
    max-width: 480px;
    width: 100%;
    animation: scaleIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.edit-card::-webkit-scrollbar {
    width: 6px;
}

.edit-card::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
}

.edit-title {
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 28px;
}

/* Avatar preview in edit */
.edit-avatar-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.edit-avatar-circle {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 3rem;
    line-height: 1;
    border: 3px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
}

/* Form sections */
.edit-section {
    margin-bottom: 22px;
}

.edit-section-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-section-label i {
    font-size: 0.85rem;
    opacity: 0.6;
}

.edit-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.edit-input:focus {
    border-color: #762BDE;
}

.edit-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.edit-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 6px;
}

/* Emoji mini-grid in edit */
.edit-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 5px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.edit-emoji-grid::-webkit-scrollbar {
    width: 5px;
}

.edit-emoji-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
}

.edit-emoji-opt {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.edit-emoji-opt:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.12);
}

.edit-emoji-opt.selected {
    border-color: #762BDE;
    background: rgba(118, 43, 222, 0.15);
    box-shadow: 0 0 0 2px rgba(118, 43, 222, 0.3);
}

/* Color mini-grid in edit */
.edit-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.edit-color-opt {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.edit-color-opt:hover {
    transform: scale(1.15);
}

.edit-color-opt.selected {
    outline: 3px solid #fff;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Toggle switch for Kids */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
}

.toggle-label-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ccc;
}

.toggle-label-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 2px;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: #22c55e;
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

/* Action buttons */
.edit-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.btn-save-profile {
    flex: 1;
    height: 48px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #762BDE, #2669F5);
    color: #fff;
    font-family: var(--font-viata, 'Outfit', sans-serif);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(118, 43, 222, 0.3);
    transition: all 0.3s;
}

.btn-save-profile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(118, 43, 222, 0.4);
    filter: brightness(1.1);
}

.btn-save-profile:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-cancel-profile {
    height: 48px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.6);
    font-family: var(--font-viata, 'Outfit', sans-serif);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-profile:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-delete-profile {
    height: 48px;
    padding: 0 24px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 14px;
    color: #ef4444;
    font-family: var(--font-viata, 'Outfit', sans-serif);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-profile:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

/* ── PIN setup input ── */
.pin-setup-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pin-setup-input {
    width: 160px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 8px;
    text-align: center;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.pin-setup-input:focus {
    border-color: #762BDE;
}

.pin-setup-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 4px;
}

.btn-clear-pin {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-clear-pin:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* ── Loading ── */
.profiles-loading {
    text-align: center;
    padding: 40px;
}

.profiles-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: #762BDE;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

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

/* ── Manage mode edit icons ── */
.profile-card.manage-mode .profile-card-avatar::after {
    content: "\f303";
    /* fa-pen */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1.2rem;
    border-radius: 22px;
    opacity: 0;
    transition: opacity 0.2s;
}

.profile-card.manage-mode:hover .profile-card-avatar::after {
    opacity: 1;
}

/* ── Toast ── */
.toast-msg {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    backdrop-filter: blur(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;
    pointer-events: none;
}

.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .brand-logo {
        font-size: 2.2rem;
    }

    .profiles-title {
        font-size: 1.2rem;
    }

    .profiles-grid {
        gap: 20px;
    }

    .profile-card {
        width: 100px;
    }

    .profile-card-avatar {
        width: 85px;
        height: 85px;
        font-size: 2.2rem;
        border-radius: 18px;
    }

    .profile-card-name {
        font-size: 0.85rem;
        max-width: 100px;
    }

    .pin-card {
        padding: 28px 20px;
    }

    .pin-dot {
        width: 44px;
        height: 48px;
        font-size: 1.3rem;
    }

    .pin-dots {
        gap: 10px;
    }

    .edit-card {
        padding: 24px 18px;
    }
}

@media (max-width: 400px) {
    .profiles-grid {
        gap: 14px;
    }

    .profile-card {
        width: 85px;
    }

    .profile-card-avatar {
        width: 72px;
        height: 72px;
        font-size: 1.8rem;
        border-radius: 16px;
    }
}