:root {
    --bg: #060c18;
    --surface: rgba(10, 18, 38, 0.50);
    --surface-2: rgba(15, 26, 52, 0.44);
    --border: rgba(255, 255, 255, 0.10);
    --border-solid: #1e3455;
    --text: #e8eef7;
    --muted: #8aa0bd;
    --primary: #38bdf8;
    --primary-ink: #06283d;
    --success: #34d399;
    --danger: #f87171;
    --warn: #fbbf24;
    --radius: 14px;
    --radius-sm: 10px;
    --header-h: 56px;
    --nav-h: 60px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.60);
    --glass-blur: blur(24px);
    --glass-border: 1px solid rgba(255, 255, 255, 0.11);
    --glass-shine: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.20);
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
    background: var(--bg);
}

body {
    margin: 0;
    padding: 0;
    background: transparent;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── Dynamic background ───────────────────────────────────── */
.bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(ellipse 110% 55% at 50% -5%, #0d1f3c 0%, transparent 70%),
        #060c18;
}

/* Slow-drifting grid mesh for depth */
.bg-mesh {
    position: absolute;
    inset: -6%;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.032) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.032) 1px, transparent 1px);
    background-size: 54px 54px;
    animation: mesh-drift 45s linear infinite;
    mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 10%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 85% 85% at 50% 50%, black 10%, transparent 75%);
}

@keyframes mesh-drift {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(54px, 54px);
    }
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0;
    will-change: transform;
    animation: orb-fade-in 2.5s ease-out forwards, float-orb var(--dur, 22s) ease-in-out var(--delay, 0s) infinite;
}

.orb-1 {
    --dur: 22s;
    --delay: 0s;
    width: 560px;
    height: 560px;
    top: -160px;
    left: -130px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.55) 0%, transparent 65%);
}

.orb-2 {
    --dur: 28s;
    --delay: -10s;
    width: 480px;
    height: 480px;
    bottom: -40px;
    right: -100px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.50) 0%, transparent 65%);
    animation-name: orb-fade-in, float-orb-b;
}

.orb-3 {
    --dur: 34s;
    --delay: -18s;
    width: 380px;
    height: 380px;
    top: 42%;
    left: 28%;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.35) 0%, transparent 65%);
}

.orb-4 {
    --dur: 20s;
    --delay: -7s;
    width: 300px;
    height: 300px;
    top: 12%;
    right: 8%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.30) 0%, transparent 65%);
    animation-name: orb-fade-in, float-orb-b;
}

.orb-5 {
    --dur: 30s;
    --delay: -15s;
    width: 360px;
    height: 360px;
    bottom: 10%;
    left: 1%;
    background: radial-gradient(circle, rgba(232, 121, 249, 0.32) 0%, transparent 65%);
}

.orb-6 {
    --dur: 40s;
    --delay: -24s;
    width: 260px;
    height: 260px;
    top: 55%;
    right: 1%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 65%);
    animation-name: orb-fade-in, float-orb-b;
}

@keyframes orb-fade-in {
    to {
        opacity: 1;
    }
}

@keyframes float-orb {
    0% {
        transform: translate(0, 0) scale(1);
    }

    20% {
        transform: translate(30px, -48px) scale(1.06);
    }

    40% {
        transform: translate(-22px, 36px) scale(0.94);
    }

    60% {
        transform: translate(45px, 20px) scale(1.05);
    }

    80% {
        transform: translate(-28px, -22px) scale(0.97);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes float-orb-b {
    0% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(-42px, 28px) scale(1.08);
    }

    50% {
        transform: translate(32px, -42px) scale(0.92);
    }

    75% {
        transform: translate(-16px, 46px) scale(1.04);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

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

/* ── Layout shell ─────────────────────────────────────────── */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    padding-top: env(safe-area-inset-top);
    background: rgba(6, 12, 24, 0.72);
    backdrop-filter: saturate(160%) var(--glass-blur);
    -webkit-backdrop-filter: saturate(160%) var(--glass-blur);
    border-bottom: var(--glass-border);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.topbar .brand img {
    width: 26px;
    height: 26px;
}

.topbar .spacer {
    flex: 1;
}

.club-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 55%;
    padding: 6px 10px;
    background: rgba(15, 28, 52, 0.45);
    border: var(--glass-border);
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: saturate(150%) blur(16px);
    -webkit-backdrop-filter: saturate(150%) blur(16px);
}

.club-picker .club-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.club-picker .chev {
    color: var(--muted);
}

.page {
    flex: 1;
    padding: 14px;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

/* ── Bottom nav ───────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    background: rgba(6, 12, 24, 0.78);
    backdrop-filter: saturate(160%) var(--glass-blur);
    -webkit-backdrop-filter: saturate(160%) var(--glass-blur);
    border-top: var(--glass-border);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.04), 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.bottom-nav button {
    flex: 1;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
}

.bottom-nav button .ic {
    font-size: 19px;
    line-height: 1;
}

.bottom-nav button.active {
    color: var(--primary);
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, transparent 55%),
        var(--surface);
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    backdrop-filter: saturate(150%) var(--glass-blur);
    -webkit-backdrop-filter: saturate(150%) var(--glass-blur);
    box-shadow: var(--shadow), var(--glass-shine);
    position: relative;
}

.card.tight {
    padding: 12px;
}

h1,
h2,
h3 {
    margin: 0 0 10px;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 16px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.row.wrap {
    flex-wrap: wrap;
}

.between {
    justify-content: space-between;
}

.spread {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: filter 0.15s, transform 0.05s;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn.primary {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: transparent;
}

.btn.success {
    background: var(--success);
    color: #06281c;
    border-color: transparent;
}

.btn.danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn.ghost {
    background: transparent;
}

.btn.block {
    width: 100%;
}

.btn.sm {
    padding: 7px 10px;
    font-size: 13px;
}

.btn.icon {
    padding: 7px 9px;
}

/* ── Badges & chips ───────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
}

.badge.primary {
    color: var(--primary);
    border-color: var(--primary);
}

.badge.success {
    color: var(--success);
    border-color: var(--success);
}

.badge.warn {
    color: var(--warn);
    border-color: var(--warn);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.chip.selected {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: transparent;
}

.chip .lv {
    font-size: 11px;
    opacity: 0.8;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ── Forms ────────────────────────────────────────────────── */
label.field {
    display: block;
    margin-bottom: 12px;
}

label.field>span {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 5px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    /* prevents iOS zoom */
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

.seg {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.seg button {
    flex: 1;
    min-width: 84px;
    padding: 9px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.seg button.active {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: transparent;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-row input[type="range"] {
    flex: 1;
}

.range-val {
    min-width: 26px;
    text-align: center;
    font-weight: 700;
}

/* ── Lists ────────────────────────────────────────────────── */
.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item .grow {
    flex: 1;
    min-width: 0;
}

.list-item .name {
    font-weight: 600;
}

.list-item.inactive {
    opacity: 0.5;
}

/* ── Play / court board ───────────────────────────────────── */
.round {
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        var(--surface);
    border: var(--glass-border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    overflow: hidden;
    backdrop-filter: saturate(150%) var(--glass-blur);
    -webkit-backdrop-filter: saturate(150%) var(--glass-blur);
    box-shadow: var(--shadow), var(--glass-shine);
}

.round-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    cursor: pointer;
}

.round-head .grow {
    flex: 1;
}

.round-body {
    padding: 0 14px 14px;
}

.court-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.court {
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, transparent 50%),
        var(--surface-2);
    padding: 12px;
    backdrop-filter: saturate(140%) blur(18px);
    -webkit-backdrop-filter: saturate(140%) blur(18px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), var(--glass-shine);
}

.court.playing {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.2), 0 4px 16px rgba(251, 191, 36, 0.1);
}

.court.finished {
    border-color: rgba(52, 211, 153, 0.5);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2), 0 4px 16px rgba(52, 211, 153, 0.1);
}

.court-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.court-head .grow {
    flex: 1;
}

.teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.team {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team.win .player {
    border-color: var(--success);
}

.team .player {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.vs {
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
}

.court-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.court-actions .btn {
    flex: 1;
}

.court-actions .btn.icon {
    flex: 0 0 auto;
}

.court-actions .btn.success.icon {
    flex: 0 0 auto;
    min-width: 48px;
    justify-content: center;
}

.court-actions .btn.block {
    flex: 1 1 100%;
}

/* Per-court editing */
.court-type {
    margin-bottom: 10px;
    padding: 8px 10px;
    font-size: 14px;
}

.court-type-label {
    margin-bottom: 10px;
    font-weight: 600;
}

.teams-edit {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.team-box {
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 8px;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.05) 0%, transparent 55%),
        var(--surface);
    backdrop-filter: saturate(140%) blur(16px);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
}

.team-box.win {
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.07);
}

.team-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    height: 38px;
    box-sizing: border-box;
}

.slot.filled {
    border-style: solid;
    background: var(--surface-2);
}

.slot.empty {
    color: var(--muted);
    cursor: pointer;
    justify-content: center;
    padding: 8px 10px;
}

.slot .slot-name {
    flex: 1;
    cursor: pointer;
    color: #F1C942;
}

.slot-x {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1;
}

.slot-x:hover {
    color: var(--danger);
}

/* Finish-match radio options */
.finish-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.finish-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
}

.finish-opt.selected {
    border-color: var(--primary);
    background: var(--surface-2);
}

.finish-opt input {
    width: auto;
    flex: 0 0 auto;
}

.waiting-box {
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    margin-bottom: 12px;
}

/* ── Stats table ──────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.stats {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.stats th,
table.stats td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.stats th {
    color: var(--muted);
    font-weight: 600;
}

table.stats td.name,
table.stats th.name {
    text-align: left;
}

.pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.pill {
    flex: 1;
    min-width: 90px;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.07) 0%, transparent 55%),
        var(--surface);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    backdrop-filter: saturate(150%) blur(18px);
    -webkit-backdrop-filter: saturate(150%) blur(18px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), var(--glass-shine);
}

.pill .num {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
}

.pill .lbl {
    font-size: 12px;
    color: var(--muted);
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.card.modal {
    width: 100%;
    max-width: 440px;
    max-height: 86vh;
    overflow-y: auto;
    margin: 0;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        rgba(8, 16, 36, 0.78);
    backdrop-filter: saturate(170%) blur(32px);
    -webkit-backdrop-filter: saturate(170%) blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.70),
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 0 0 1px rgba(255, 255, 255, 0.04);
    position: relative;
}

.card.modal h3 {
    padding-right: 36px;
}

.modal-x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    z-index: 2;
}

.modal-x:hover {
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.modal-actions .btn {
    min-width: 92px;
}

/* ── Popover (club picker) ────────────────────────────────── */
.popover {
    position: fixed;
    top: calc(var(--header-h) + 6px);
    right: 12px;
    z-index: 90;
    width: min(280px, 90vw);
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.08) 0%, transparent 55%),
        rgba(8, 16, 36, 0.80);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius);
    backdrop-filter: saturate(170%) blur(32px);
    -webkit-backdrop-filter: saturate(170%) blur(32px);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.60),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.04);
    padding: 8px;
}

.popover .po-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.popover .po-item:hover {
    background: var(--surface-2);
}

.popover .po-item.active {
    color: var(--primary);
}

.popover hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 6px 0;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-h) + 20px);
    transform: translateX(-50%) translateY(20px);
    background: rgba(8, 16, 36, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--text);
    padding: 11px 16px;
    border-radius: 999px;
    font-size: 14px;
    backdrop-filter: saturate(160%) blur(24px);
    -webkit-backdrop-filter: saturate(160%) blur(24px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.50), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 200;
    max-width: 90vw;
}

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

.toast.success {
    border-color: rgba(52, 211, 153, 0.5);
}

.toast.error {
    border-color: rgba(248, 113, 113, 0.5);
}

/* ── Auth ─────────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
}

.auth-card .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 18px;
}

.auth-card .brand img {
    width: 40px;
    height: 40px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 30px 16px;
}

.gender-icon {
    font-size: 13px;
}

.gender-icon.male {
    color: #60a5fa;
}

.gender-icon.female {
    color: #f472b6;
}

/* Offline Indicator Dot */
.offline-dot {
    width: 8px;
    height: 8px;
    background-color: #f87171; /* soft red */
    border-radius: 50%;
    margin-left: 6px;
    display: inline-block;
    align-self: center;
    box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

/* ── Stepper ──────────────────────────────────────────────── */
.stepper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.step .dot {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.step.done .dot {
    background: var(--success);
    color: #06281c;
    border-color: transparent;
}

.step.current .dot {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: transparent;
}

@media (min-width: 560px) {
    .court-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Settings row ─────────────────────────────────────────── */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* ── Toggle switch ────────────────────────────────────────── */
.toggle-switch {
    flex-shrink: 0;
    position: relative;
    display: inline-block;
    cursor: pointer;
}

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

.toggle-track {
    display: flex;
    align-items: center;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: var(--border-solid);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s, border-color 0.2s;
    padding: 2px;
}

.toggle-switch input:checked+.toggle-track {
    background: var(--primary);
    border-color: transparent;
}

.toggle-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.toggle-switch input:checked+.toggle-track .toggle-thumb {
    transform: translateX(20px);
}

/* ── Background Modes ─────────────────────────────────────── */
body.bg-none .orb,
body.bg-none .bg-mesh {
    display: none !important;
}
body.bg-none .bg-canvas {
    background: var(--bg) !important;
}

body.bg-static .bg-mesh,
body.bg-static .orb {
    animation: none !important;
    animation-name: none !important;
    animation-duration: 0s !important;
    transition: none !important;
    opacity: 1 !important;
}

body.no-glassy .card,
body.no-glassy .round,
body.no-glassy .pill {
    background: #0d182d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.no-glassy .court {
    background: #14233c;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}

body.no-glassy .team-box {
    background: #0d182d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.no-glassy .topbar {
    background: #07101f;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.no-glassy .bottom-nav {
    background: #07101f;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.no-glassy .modal-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.no-glassy .card.modal {
    background: #0d182d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.no-glassy .popover {
    background: #0d182d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.no-glassy .toast {
    background: #0d182d;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.no-glassy .club-picker {
    background: #14233c;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* ── Glassy Players Modal ────────────────────────────────────── */
.players-modal {
    border-radius: 20px !important;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.05) 0%, transparent 60%), rgba(10, 20, 42, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    padding: 24px !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

/* Glassy close button */
.players-modal .modal-x {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.6) !important;
    transition: all 0.2s ease;
}

.players-modal .modal-x:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Pill buttons for All/None */
.btn-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn-pill:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Glassy player chip */
.players-modal .chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 14px;
    border-radius: 999px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
    gap: 0;
}

.players-modal .chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.players-modal .chip.selected {
    background: rgba(168, 85, 247, 0.18) !important;
    border-color: rgba(168, 85, 247, 0.50) !important;
    color: #ffffff !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.20);
}

/* Hand Level Badge */
.lv-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    min-width: 25px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* Level 1: BG */
.lv-1 {
    background: rgba(138, 160, 189, 0.15) !important;
    color: #8aa0bd !important;
    border: 1px solid rgba(138, 160, 189, 0.3) !important;
}
/* Level 2, 3: N-, N */
.lv-2, .lv-3 {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
}
/* Level 4, 5: S-, S */
.lv-4, .lv-5 {
    background: rgba(52, 211, 153, 0.15) !important;
    color: #34d399 !important;
    border: 1px solid rgba(52, 211, 153, 0.3) !important;
}
/* Level 6, 7: P-, P */
.lv-6, .lv-7 {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(251, 191, 36, 0.3) !important;
}
/* Level 8: P+ */
.lv-8 {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
}
/* Level 9, 10: B, A */
.lv-9, .lv-10 {
    background: rgba(236, 72, 153, 0.15) !important;
    color: #ec4899 !important;
    border: 1px solid rgba(236, 72, 153, 0.3) !important;
}

/* no-glassy fallbacks */
body.no-glassy .players-modal {
    background: #0d182d !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

body.no-glassy .players-modal .chip {
    background: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
}

body.no-glassy .players-modal .chip.selected {
    background: rgba(168, 85, 247, 0.35) !important;
    border: 1px solid rgba(168, 85, 247, 0.60) !important;
    color: #ffffff !important;
}

/* ── Monochrome SVG Icons (via CSS Masks) ──────────────────── */
.ic-mono {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.15em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.ic-racket {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="9" r="6"/><path d="M13.2 13.2L20 20"/><path d="M6 6l6 6"/><path d="M6 12l6-6"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="9" r="6"/><path d="M13.2 13.2L20 20"/><path d="M6 6l6 6"/><path d="M6 12l6-6"/></svg>');
}

.ic-group {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M23 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>');
}

.ic-clock {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>');
}

.ic-chart {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>');
}

.ic-gear {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>');
}

.ic-edit {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>');
}

.ic-trash {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>');
}

.ic-play {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21"/></svg>');
}

.ic-refresh {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.67"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.5 2v6h-6M21.34 15.57a10 10 0 1 1-.57-8.38l5.67-5.67"/></svg>');
}

.ic-plus {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>');
    width: 0.9em;
    height: 0.9em;
}

.ic-chevron {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
}

.ic-flag {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" y1="22" x2="4" y2="15"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" y1="22" x2="4" y2="15"/></svg>');
}

.ic-check {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>');
    width: 0.9em;
    height: 0.9em;
}

/* data-toggle buttons styling to make them stand out */
.round-head [data-toggle],
.card [data-toggle] {
    color: var(--primary) !important;
    background: rgba(45, 212, 191, 0.08) !important;
    border: 1px solid rgba(45, 212, 191, 0.2) !important;
    border-radius: 6px !important;
    padding: 5px 7px !important;
    opacity: 0.9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease !important;
    box-shadow: 0 0 6px rgba(45, 212, 191, 0.1);
}
.round-head [data-toggle]:hover,
.card [data-toggle]:hover {
    color: var(--primary) !important;
    background: transparent !important;
    border-color: rgba(45, 212, 191, 0.4) !important;
    opacity: 1;
    transform: scale(1.15);
    box-shadow: none;
}