* {
    box-sizing: border-box;
}

:root {
    --bg: #08090d;
    --panel: rgba(18, 20, 27, 0.92);
    --panel-soft: rgba(26, 29, 38, 0.9);
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(236, 35, 48, 0.5);
    --text: #f5f6f8;
    --muted: #9da3af;
    --red: #ec2330;
    --red-dark: #a80f1a;
    --green: #39d98a;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: "Oswald", sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

.page-background,
.page-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.page-background {
    background:
        radial-gradient(circle at 15% 10%, rgba(236, 35, 48, 0.18), transparent 32%),
        radial-gradient(circle at 85% 20%, rgba(124, 26, 34, 0.14), transparent 30%),
        linear-gradient(135deg, #07080b 0%, #0d1017 50%, #08090d 100%);
}

.page-overlay {
    opacity: 0.24;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, #000 0%, transparent 86%);
}

.profile-header {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid var(--border);
    background: rgba(7, 8, 12, 0.86);
    backdrop-filter: blur(16px);
}

.profile-header-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 74px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
}

.brand-link img {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.profile-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-right: auto;
}

.profile-nav a {
    position: relative;
    color: #d7d9de;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.profile-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 100%;
    bottom: -8px;
    height: 2px;
    background: var(--red);
    transition: right 0.2s ease;
}

.profile-nav a:hover {
    color: #fff;
}

.profile-nav a:hover::after {
    right: 0;
}

.logout-button,
#saveButton,
.open-card-link {
    border: 0;
    cursor: pointer;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.logout-button {
    min-height: 42px;
    padding: 0 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.logout-button:hover {
    border-color: rgba(236, 35, 48, 0.7);
    background: rgba(236, 35, 48, 0.12);
}

.profile-main {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0 80px;
}

.state-card {
    min-height: 280px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 16px;
    padding: 40px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.state-card p {
    margin: 0;
    color: var(--muted);
    font-size: 18px;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: profile-spin 0.85s linear infinite;
}

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

.error-state ion-icon {
    color: var(--red);
    font-size: 54px;
}

.error-state h1 {
    margin: 0;
    font-family: "Anton", sans-serif;
    font-size: clamp(30px, 5vw, 52px);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.error-state a {
    color: #fff;
    text-underline-offset: 4px;
}

.profile-shell {
    display: grid;
    gap: 24px;
}

.profile-hero {
    position: relative;
    overflow: hidden;
    min-height: 220px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
    padding: 34px;
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    background:
        linear-gradient(115deg, rgba(236, 35, 48, 0.18), transparent 42%),
        rgba(16, 18, 25, 0.94);
    box-shadow: var(--shadow);
}

.profile-hero::before {
    content: "";
    position: absolute;
    width: 330px;
    height: 330px;
    right: -130px;
    top: -180px;
    border-radius: 50%;
    background: rgba(236, 35, 48, 0.16);
    filter: blur(12px);
}

.profile-picture-wrap {
    position: relative;
    z-index: 1;
    width: 150px;
    height: 150px;
    flex: 0 0 auto;
}

.profile-picture-wrap > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center top;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    background: #11131a;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
}

.picture-upload-button {
    position: absolute;
    right: -9px;
    bottom: -9px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    cursor: pointer;
    border: 3px solid #101219;
    border-radius: 50%;
    color: #fff;
    background: var(--red);
    box-shadow: 0 10px 24px rgba(236, 35, 48, 0.32);
    transition: transform 0.2s ease, background 0.2s ease;
}

.picture-upload-button:hover {
    transform: translateY(-2px);
    background: #ff3341;
}

.picture-upload-button.uploading {
    pointer-events: none;
    opacity: 0.65;
}

.profile-identity {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.profile-kicker,
.panel-heading > div > span,
.player-card-panel > div > span {
    display: block;
    margin-bottom: 7px;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 12px;
    font-weight: 700;
}

.profile-identity h1 {
    overflow-wrap: anywhere;
    margin: 0;
    font-family: "Anton", sans-serif;
    font-size: clamp(42px, 7vw, 76px);
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: 0.015em;
    text-transform: uppercase;
}

.profile-identity p {
    margin: 13px 0 0;
    color: #c7cad2;
    font-size: 19px;
    font-weight: 400;
}

.profile-status {
    position: relative;
    z-index: 1;
    align-self: start;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    border: 1px solid rgba(57, 217, 138, 0.25);
    border-radius: 999px;
    color: #dff9ec;
    background: rgba(57, 217, 138, 0.08);
    white-space: nowrap;
    font-size: 14px;
}

.online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 14px rgba(57, 217, 138, 0.8);
}

.profile-form {
    display: grid;
    gap: 20px;
}

.form-panel {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 14px 42px rgba(0, 0, 0, 0.22);
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.panel-heading h2,
.player-card-panel h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    text-transform: uppercase;
}

.panel-heading p,
.player-card-panel p {
    max-width: 520px;
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.55;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.form-grid label,
.full-field {
    display: grid;
    gap: 9px;
    min-width: 0;
}

.form-grid label > span,
.full-field > span {
    color: #e7e9ed;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 13px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    outline: none;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    background: rgba(7, 8, 12, 0.72);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input,
select {
    min-height: 48px;
    padding: 0 14px;
}

textarea {
    min-height: 148px;
    resize: vertical;
    padding: 14px;
    line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
    color: #656b76;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(236, 35, 48, 0.8);
    background: rgba(12, 14, 20, 0.95);
    box-shadow: 0 0 0 3px rgba(236, 35, 48, 0.1);
}

select option {
    color: #fff;
    background: #151821;
}

.full-field small {
    justify-self: end;
    color: var(--muted);
}

.privacy-field {
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 74px;
    padding: 13px 15px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.privacy-field > span {
    align-self: end;
}

.privacy-field input {
    appearance: none;
    position: relative;
    width: 48px;
    min-height: 26px;
    height: 26px;
    padding: 0;
    cursor: pointer;
    border: 0;
    border-radius: 999px;
    background: #3a3f49;
}

.privacy-field input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.privacy-field input:checked {
    background: var(--red);
}

.privacy-field input:checked::after {
    transform: translateX(22px);
}

.privacy-field small {
    grid-column: 1 / -1;
    color: var(--muted);
    line-height: 1.4;
}

.player-card-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    border-color: rgba(236, 35, 48, 0.38);
    background:
        linear-gradient(110deg, rgba(236, 35, 48, 0.12), transparent 48%),
        var(--panel-soft);
}

.open-card-link {
    min-height: 48px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #fff;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    box-shadow: 0 10px 28px rgba(236, 35, 48, 0.22);
    white-space: nowrap;
}

.open-card-link:hover ion-icon {
    transform: translateX(3px);
}

.open-card-link ion-icon {
    transition: transform 0.2s ease;
}

.form-actions {
    position: sticky;
    z-index: 10;
    bottom: 14px;
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    padding: 13px 15px 13px 22px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 13px;
    background: rgba(10, 11, 16, 0.9);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(14px);
}

.save-message {
    margin-right: auto;
    color: var(--muted);
    font-size: 15px;
}

.save-message.success {
    color: var(--green);
}

.save-message.error {
    color: #ff7b84;
}

#saveButton {
    min-width: 190px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: #fff;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--red), var(--red-dark));
    box-shadow: 0 10px 28px rgba(236, 35, 48, 0.24);
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

#saveButton:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

#saveButton:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

@media (max-width: 820px) {
    .profile-header-inner {
        gap: 16px;
    }

    .profile-nav {
        gap: 14px;
    }

    .profile-hero {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .profile-status {
        grid-column: 1 / -1;
        justify-self: start;
        align-self: auto;
    }

    .panel-heading,
    .player-card-panel {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 660px) {
    .profile-header-inner {
        width: min(100% - 22px, 1180px);
        min-height: 66px;
    }

    .brand-link img {
        width: 44px;
        height: 44px;
    }

    .profile-nav {
        display: none;
    }

    .logout-button {
        margin-left: auto;
    }

    .profile-main {
        width: min(100% - 22px, 1180px);
        padding-top: 26px;
    }

    .profile-hero {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 20px;
        padding: 26px 20px;
        text-align: center;
    }

    .profile-picture-wrap {
        width: 132px;
        height: 132px;
    }

    .profile-status {
        grid-column: auto;
        justify-self: center;
    }

    .form-panel {
        padding: 21px 17px;
    }

    .panel-heading {
        gap: 12px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .player-card-panel {
        text-align: left;
    }

    .open-card-link {
        width: 100%;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column;
        bottom: 8px;
        padding: 13px;
    }

    .save-message {
        width: 100%;
        min-height: 21px;
        margin: 0;
        text-align: center;
    }

    #saveButton {
        width: 100%;
    }
}
