:root {
    --app-bg: #efedf3;
    --app-bg-soft: #f7f5f9;
    --surface: #ffffff;
    --surface-alt: #f5f0fa;
    --surface-deep: #6c4baa;
    --surface-deep-2: #8f4fb2;
    --text-main: #2d2440;
    --text-muted: #8c849c;
    --accent: #a04dac;
    --accent-2: #5f4fb2;
    --accent-soft: #f0e2fb;
    --gold: #f8b31c;
    --gold-deep: #ef8e19;
    --success: #2ea86f;
    --danger: #d4536b;
    --warning: #f0aa1f;
    --border-soft: rgba(108, 75, 170, 0.12);
    --shadow-raised: 0 18px 36px rgba(98, 79, 138, 0.12);
    --shadow-card: 0 24px 40px rgba(93, 73, 132, 0.16);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    --radius-xl: 36px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

html,
body {
    font-family: "Aptos", "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 32%),
        radial-gradient(circle at right 18%, rgba(241, 207, 110, 0.18) 0%, rgba(241, 207, 110, 0) 20%),
        radial-gradient(circle at 80% 80%, rgba(171, 125, 214, 0.14) 0%, rgba(171, 125, 214, 0) 24%),
        linear-gradient(180deg, var(--app-bg-soft) 0%, var(--app-bg) 100%);
    color: var(--text-main);
    min-height: 100%;
}

body {
    min-height: 100vh;
}

a,
.btn-link {
    color: var(--accent);
    text-decoration: none;
}

a:hover,
.btn-link:hover {
    color: var(--accent-2);
}

.page-shell {
    min-height: 100vh;
    position: relative;
}

.page-shell::before,
.page-shell::after {
    content: "";
    position: fixed;
    z-index: 0;
    border-radius: 999px;
    filter: blur(12px);
    pointer-events: none;
}

.page-shell::before {
    width: 24rem;
    height: 24rem;
    top: -6rem;
    right: -6rem;
    background: rgba(160, 77, 172, 0.16);
}

.page-shell::after {
    width: 20rem;
    height: 20rem;
    left: -5rem;
    bottom: 2rem;
    background: rgba(248, 179, 28, 0.12);
}

.page-shell > * {
    position: relative;
    z-index: 1;
}

.content-shell {
    padding: clamp(1.2rem, 1rem + 1vw, 2rem);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 242, 250, 0.96)),
        linear-gradient(145deg, rgba(160, 77, 172, 0.04), rgba(248, 179, 28, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow-card);
}

.app-navbar {
    background: transparent;
    padding: 1.2rem 0 0;
}

.app-navbar-inner {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-xl);
    background:
        linear-gradient(110deg, rgba(162, 77, 173, 0.96) 0%, rgba(101, 84, 178, 0.96) 56%, rgba(243, 176, 29, 0.96) 100%);
    box-shadow: 0 20px 36px rgba(122, 89, 171, 0.24);
}

.app-brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    color: #fff;
}

.app-brand-mark {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.app-brand-subtitle {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.72);
}

.app-nav-links .nav-link {
    padding: 0.7rem 1rem;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.82);
    font-weight: 600;
    transition: 180ms ease;
}

.app-nav-links .nav-link:hover,
.app-nav-links .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.app-user-name {
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
}

.avatar-sm {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 10px 18px rgba(54, 34, 93, 0.22);
}

.profile-avatar {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-card);
}

.container h1,
.container .h1 {
    font-size: clamp(2.2rem, 2rem + 1vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1.75rem;
    color: var(--text-main);
}

.container h2,
.container .h2,
.container .h4,
.container .h5 {
    color: var(--text-main);
    font-weight: 700;
}

.card {
    border: 0;
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 243, 251, 0.95)),
        linear-gradient(145deg, rgba(160, 77, 172, 0.05), rgba(248, 179, 28, 0.03));
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card .card-body {
    padding: 1.5rem;
}

.card::before {
    content: "";
    display: block;
    height: 8px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 45%, var(--gold) 100%);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 0;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
    padding-top: 0.95rem;
    padding-bottom: 0.95rem;
}

.table thead th:first-child {
    border-top-left-radius: 12px;
}

.table thead th:last-child {
    border-top-right-radius: 12px;
}

.table tbody td {
    border-color: rgba(160, 77, 172, 0.08);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.68);
}

.table tbody tr:nth-child(even) td {
    background: rgba(245, 235, 250, 0.62);
}

.form-control,
.form-select,
.form-check-input,
.input-group-text {
    border: 1px solid rgba(160, 77, 172, 0.1);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #ffffff, #f7f1fb);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
    color: var(--text-main);
}

.form-control::placeholder,
.form-select,
.form-text,
.text-muted {
    color: var(--text-muted) !important;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: rgba(160, 77, 172, 0.28);
    box-shadow:
        0 0 0 0.25rem rgba(160, 77, 172, 0.12);
}

.form-label {
    margin-bottom: 0.55rem;
    color: var(--text-main);
    font-weight: 700;
}

.btn {
    border-radius: 999px;
    border: 0;
    padding: 0.72rem 1.25rem;
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary,
.btn-success {
    color: #fff;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
    box-shadow: 0 12px 22px rgba(239, 142, 25, 0.26);
}

.btn-success {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
    box-shadow: 0 12px 22px rgba(239, 142, 25, 0.26);
}

.btn-outline-secondary {
    color: var(--text-main);
    background: linear-gradient(180deg, #fff, #f5effa);
    border: 1px solid rgba(160, 77, 172, 0.12);
    box-shadow: var(--shadow-raised);
}

.alert {
    border: 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-raised);
}

.alert-danger {
    color: #8e2f3e;
    background: linear-gradient(145deg, #fdecef, #f7dfe3);
}

.alert-success {
    color: #0f6c49;
    background: linear-gradient(145deg, #e4f8f0, #d5f0e6);
}

.alert-light {
    color: var(--text-main);
    background: linear-gradient(145deg, #fff, #f4edf8);
}

.stat-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    font-weight: 700;
    box-shadow: var(--shadow-raised);
}

.stat-pill span {
    font-size: 1.5rem;
}

.stat-pill.win {
    background: linear-gradient(145deg, #eefbf4, #dcf2e6);
    color: var(--success);
}

.stat-pill.lose {
    background: linear-gradient(145deg, #fff2f4, #f8dfe5);
    color: var(--danger);
}

.stat-pill.draw {
    background: linear-gradient(145deg, #fff6e6, #f8ebcc);
    color: var(--warning);
}

.validation-message {
    color: var(--danger);
}

.match-divider {
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 48%, var(--gold) 100%);
    box-shadow: 0 10px 16px rgba(120, 85, 170, 0.16);
}

.match-centre-card {
    padding: 1.5rem;
    border-radius: 28px;
    background:
        linear-gradient(135deg, rgba(120, 16, 21, 0.94), rgba(160, 35, 36, 0.9)),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.15), transparent 40%);
    color: #fff;
    box-shadow: 0 24px 36px rgba(120, 35, 40, 0.22);
}

.match-centre-heading {
    text-align: center;
    text-transform: uppercase;
    font-size: 1.65rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.match-centre-subheading {
    margin-top: 0.35rem;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.84);
}

.headtohead-match-date {
    margin-top: 0.4rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
    font-weight: 600;
}

.headtohead-view-select {
    min-width: 9rem;
}

.headtohead-match-centre-card {
    margin-bottom: 1rem;
}

.match-centre-body {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.match-team-panel {
    min-height: 12rem;
    padding: 1rem;
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.match-team-panel.team-a {
    box-shadow: inset 0 0 0 2px rgba(248, 179, 28, 0.4);
}

.match-team-panel.team-b {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.match-team-label {
    margin-bottom: 0.85rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.76);
}

.match-team-players {
    display: grid;
    gap: 0.9rem;
}

.match-team-player {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.match-team-avatar {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

.match-team-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(145deg, #c896de, #8b63bc);
    color: #fff;
}

.match-team-name {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.15;
    text-transform: uppercase;
}

.match-team-empty {
    color: rgba(255, 255, 255, 0.62);
    font-weight: 600;
}

.match-centre-scoreboard {
    min-width: 10rem;
    padding: 1rem 0.85rem;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.35);
    text-align: center;
}

.match-centre-result {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.82);
}

.match-centre-score {
    margin-top: 0.55rem;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1;
}

.match-centre-score span {
    margin: 0 0.35rem;
    color: rgba(255, 255, 255, 0.72);
}

.match-centre-shuttle {
    margin-top: 0.7rem;
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(248, 179, 28, 0.18);
    color: #ffd778;
    font-size: 0.85rem;
    font-weight: 800;
}

.selected-player-card {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #fff, #f3ecf8);
    border: 1px solid rgba(160, 77, 172, 0.12);
    box-shadow: var(--shadow-raised);
}

.selected-player-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    object-fit: cover;
    box-shadow: 0 8px 16px rgba(97, 74, 140, 0.18);
}

.selected-player-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #c896de, #8b63bc);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.selected-player-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.history-edit-panel {
    background: linear-gradient(145deg, #fff, #f4eef9);
    border: 0;
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-card);
}

.audit-list {
    display: grid;
    gap: 0.75rem;
}

.audit-item {
    border: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(145deg, #fff, #f5effa);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-raised);
}

.audit-item-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 700;
}

.audit-item-body {
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.spinner-border {
    color: var(--gold) !important;
}

.list-group-item {
    border: 0;
    border-radius: 16px !important;
    margin-bottom: 0.65rem;
    background: linear-gradient(180deg, #fff, #f5eef9);
    color: var(--text-main);
    box-shadow: var(--shadow-raised);
}

.list-group-item.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 60%, var(--gold) 100%);
    color: #fff;
}

.form-check-input:checked {
    background-color: var(--gold);
    border-color: var(--gold);
}

.user-profile-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
}

.user-profile-link:hover {
    color: var(--accent-2);
}

.profile-title-link {
    font-weight: 800;
}

.profile-trait-panel {
    padding: 1.15rem;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 236, 249, 0.92));
    box-shadow: var(--shadow-raised);
}

.profile-trait-panel-title,
.user-profile-modal-section-title {
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-2);
}

.profile-trait-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
}

.profile-trait-grid-item {
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, #f5eef9);
    border: 1px solid rgba(160, 77, 172, 0.14);
    box-shadow: var(--shadow-raised);
    font-weight: 700;
    text-align: center;
}

.profile-trait-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.profile-trait-option {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f5eef9);
    border: 1px solid rgba(160, 77, 172, 0.14);
    box-shadow: var(--shadow-raised);
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.profile-trait-option:hover {
    transform: translateY(-1px);
}

.profile-trait-option.selected {
    border-color: rgba(248, 179, 28, 0.65);
    box-shadow: 0 14px 24px rgba(239, 142, 25, 0.18);
}

.profile-trait-option input {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--gold);
}

.profile-trait-option span {
    font-weight: 700;
    line-height: 1.2;
}

.user-profile-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(54, 35, 83, 0.42);
    backdrop-filter: blur(10px);
}

.user-profile-modal-card {
    position: relative;
    width: min(42rem, 100%);
    max-height: min(88vh, 56rem);
    padding: 1.5rem;
    border-radius: 32px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 239, 251, 0.97));
    box-shadow: 0 28px 52px rgba(77, 51, 120, 0.28);
    overflow: auto;
}

.user-profile-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(145deg, #fff, #f1e8f7);
    box-shadow: var(--shadow-raised);
    font-weight: 800;
    color: var(--text-main);
}

.user-profile-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.user-profile-modal-avatar {
    width: 88px;
    height: 88px;
    border-radius: 26px;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-card);
}

.user-profile-modal-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #c896de, #8b63bc);
    color: #fff;
    font-size: 1.65rem;
    font-weight: 800;
}

.user-profile-modal-title {
    font-size: 1.55rem;
    font-weight: 900;
    color: var(--text-main);
}

.user-profile-modal-subtitle {
    margin-top: 0.15rem;
    color: var(--accent);
    font-weight: 700;
}

.user-profile-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.user-profile-modal-meta span,
.profile-trait-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #fff, #f3ecf8);
    border: 1px solid rgba(160, 77, 172, 0.12);
    box-shadow: var(--shadow-raised);
    font-weight: 700;
}

.user-profile-modal-section + .user-profile-modal-section {
    margin-top: 1.15rem;
}

.profile-trait-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.user-profile-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.user-profile-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.user-profile-summary-card {
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f5eef9);
    border: 1px solid rgba(160, 77, 172, 0.14);
    box-shadow: var(--shadow-raised);
}

.user-profile-summary-value {
    font-size: 1.45rem;
    font-weight: 900;
    color: var(--text-main);
}

.user-profile-groups-scroll {
    display: grid;
    gap: 1rem;
    max-height: 26rem;
    overflow: auto;
    padding-right: 0.2rem;
}

.user-profile-group-block {
    padding: 1rem;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 236, 249, 0.92));
    border: 1px solid rgba(160, 77, 172, 0.12);
    box-shadow: var(--shadow-raised);
}

.user-profile-group-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--accent-2);
}

.user-profile-group-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    font-weight: 700;
}

.user-profile-table-scroll {
    overflow: auto;
}

.user-profile-table-scroll table {
    min-width: 38rem;
}

.user-profile-modal-label {
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
}

.user-profile-modal-value {
    font-weight: 700;
    word-break: break-word;
}

code {
    color: var(--accent-2);
}

hr {
    border-color: rgba(160, 77, 172, 0.1);
}

@media (max-width: 991.98px) {
    .content-shell {
        border-radius: 24px;
        padding: 1rem;
    }

    .app-navbar-inner {
        border-radius: 24px;
    }

    .match-centre-body {
        grid-template-columns: 1fr;
    }

    .match-centre-scoreboard {
        order: -1;
    }

    .profile-trait-grid,
    .profile-trait-selector,
    .user-profile-modal-grid,
    .user-profile-summary-grid {
        grid-template-columns: 1fr;
    }

    .user-profile-modal-header {
        align-items: flex-start;
    }
}
