/*
Purpose:
    Style FlipOut DTSP public login and signup pages.

Inputs:
    Account form content rendered through the normal site shell.

Outputs:
    Mobile-friendly authentication forms and status messages.

Requirements:
    site.css and components.css loaded first.

Goal:
    Keep normal-user authentication visually consistent with FlipOut DTSP.

Section:
    Public account styling.
*/

.account-card {
    max-width: 620px;
    margin: 22px auto 0;
    padding: 20px;
    border:
        1px solid var(--border);
    border-radius: 18px;
    background:
        rgba(25,25,30,.95);
}

.account-card h1 {
    margin: 5px 0 10px;
    font-size:
        clamp(
            2.5rem,
            9vw,
            4rem
        );
}

.account-card p {
    color: var(--muted);
    line-height: 1.5;
}

.account-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.account-form label > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.account-form input {
    width: 100%;
    min-height: 50px;
    padding: 11px 13px;
    border:
        1px solid var(--border);
    border-radius: 11px;
    outline: none;
    background: var(--panel2);
    color: var(--text);
    font: inherit;
}

.account-form input:focus {
    border-color:
        rgba(224,170,68,.7);
}

.account-button {
    min-height: 50px;
    padding: 11px 16px;
    border:
        1px solid rgba(214,58,58,.55);
    border-radius: 11px;
    background:
        linear-gradient(
            135deg,
            var(--red),
            var(--red-dark)
        );
    color: var(--text);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.account-message {
    margin: 14px 0;
    padding: 12px 14px;
    border:
        1px solid var(--border);
    border-radius: 11px;
}

.account-message.error {
    border-color:
        rgba(214,58,58,.45);
    color: #efaaaa;
}

.account-message.success {
    border-color:
        rgba(83,182,109,.45);
    color: #a9dfb6;
}

.account-link {
    color: var(--gold);
    font-weight: 850;
}

/*
Section:
    User profile and personal game statistics.
*/

.user-page .user-profile-card {
    max-width: 760px;
}

.user-page .account-form input[readonly] {
    color: var(--muted);
    cursor: default;
}

.user-stats-section {
    width: 100%;
}

.user-stats-grid {
    display: grid;
    grid-template-columns:
        repeat(
            4,
            minmax(
                0,
                1fr
            )
        );
    gap: 10px;
}

.user-stat-card {
    display: grid;
    gap: 6px;
    padding: 16px;
    border:
        1px solid var(--border);
    border-radius: 14px;
    background: var(--panel2);
    text-align: center;
}

.user-stat-card span {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.user-stat-card strong {
    color: var(--text);
    font-size:
        clamp(
            1.8rem,
            7vw,
            2.7rem
        );
    line-height: 1;
}

.user-game-stats {
    margin-top: 26px;
}

.user-game-card-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.user-game-card {
    overflow: hidden;
    border:
        1px solid var(--border);
    border-radius: 14px;
    background: var(--panel2);
}

.user-game-card-name {
    margin: 0;
    padding: 14px 16px;
    border-bottom:
        1px solid var(--border);
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 900;
}

.user-game-card-stats {
    display: grid;
    grid-template-columns:
        repeat(
            4,
            minmax(
                0,
                1fr
            )
        );
}

.user-game-card-stat {
    display: grid;
    gap: 4px;
    padding: 13px 10px;
    border-right:
        1px solid var(--border);
    text-align: center;
}

.user-game-card-stat:last-child {
    border-right: 0;
}

.user-game-card-stat span {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.user-game-card-stat strong {
    color: var(--text);
    font-size: 1.15rem;
    line-height: 1;
}

.user-game-table th {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.user-game-table tbody tr:last-child td {
    border-bottom: 0;
}

.user-game-table td:first-child {
    color: var(--text);
    font-weight: 850;
}

.user-stats-empty {
    margin-top: 12px;
    color: var(--muted);
}

@media (max-width: 700px) {
    .user-stats-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(
                    0,
                    1fr
                )
            );
    }

    .user-game-card-stats {
        grid-template-columns:
            repeat(
                2,
                minmax(
                    0,
                    1fr
                )
            );
    }

    .user-game-card-stat {
        border-right:
            1px solid var(--border);
        border-bottom:
            1px solid var(--border);
    }

    .user-game-card-stat:nth-child(2n) {
        border-right: 0;
    }

    .user-game-card-stat:nth-last-child(-n + 2) {
        border-bottom: 0;
    }
}


/*
Section:
    User win-only game table.
*/

.user-win-only-stats {
    margin-top: 26px;
}

.user-win-only-table-wrap {
    overflow: hidden;
    margin-top: 12px;
    border:
        1px solid var(--border);
    border-radius: 14px;
    background: var(--panel2);
}

.user-win-only-table {
    width: 100%;
    border-collapse: collapse;
}

.user-win-only-table th,
.user-win-only-table td {
    padding: 12px 16px;
    border-bottom:
        1px solid var(--border);
    text-align: left;
}

.user-win-only-table th:last-child,
.user-win-only-table td:last-child {
    width: 82px;
    text-align: center;
}

.user-win-only-table tbody tr:last-child td {
    border-bottom: 0;
}

.user-win-only-table td:last-child {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 900;
}

/*
Section:
    User Stats visibility preference.
*/

.user-profile-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.user-profile-heading-row .section-label {
    margin: 0;
}

.user-stats-preference-form {
    margin: 0;
    flex: 0 0 auto;
}

.user-stats-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
}

.user-stats-toggle input {
    width: 24px;
    height: 24px;
    margin: 0;
    accent-color: var(--gold);
    cursor: pointer;
}

.user-stats-toggle input:disabled {
    cursor: wait;
}

/*
Section:
    User profile photo.
*/

.user-profile-heading-row {
    display: grid;
    grid-template-columns: 112px minmax(0,1fr);
    align-items: start;
    gap: 18px;
}

.user-profile-heading-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-profile-heading-content h1 {
    width: 100%;
    margin: 18px 0 0;
    text-align: right;
}

.user-profile-avatar-button {
    width: 112px;
    height: 112px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.user-profile-avatar-image,
.user-profile-avatar-placeholder {
    display: flex;
    width: 112px;
    height: 112px;
    border: 2px solid var(--border);
    border-radius: 50%;
}

.user-profile-avatar-image {
    object-fit: cover;
}

.user-profile-avatar-placeholder {
    align-items: center;
    justify-content: center;
    background: var(--panel2);
    color: var(--gold);
    font-size: 2.6rem;
    font-weight: 900;
}

.user-profile-avatar-button:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 4px;
}

.profile-photo-dialog[hidden] {
    display: none;
}

.profile-photo-dialog {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(0,0,0,.72);
}

.profile-photo-dialog-panel {
    position: relative;
    width: min(430px,100%);
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(0,0,0,.55);
}

.profile-photo-dialog-panel h2 {
    margin: 0 42px 18px 0;
}

.profile-photo-dialog-close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 2rem;
    cursor: pointer;
}

.profile-photo-dialog-upload label > span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.profile-photo-dialog-upload input[type="file"] {
    width: 100%;
    margin-bottom: 14px;
    color: var(--text);
}

.profile-photo-dialog-delete {
    margin-top: 10px;
}

.profile-photo-delete-button {
    border-color: var(--scarlet);
}

.profile-photo-dialog-help {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: .82rem;
}

body.profile-photo-dialog-open {
    overflow: hidden;
}

@media (max-width: 620px) {
    .user-profile-heading-row {
        grid-template-columns: 104px minmax(0,1fr);
        gap: 14px;
    }

    .user-profile-avatar-button,
    .user-profile-avatar-image,
    .user-profile-avatar-placeholder {
        width: 104px;
        height: 104px;
    }

    .user-profile-heading-content h1 {
        font-size: clamp(2rem,10vw,3rem);
    }
}
