:root {
    --bg: #f4f6fa;
    --ink: #06162f;
    --muted: #637086;
    --line: #d8e0ec;
    --panel: #ffffff;
    --navy: #061b3a;
    --blue: #0b376f;
    --red: #bf1235;
    --gold: #d5ae52;
    --green: #157a52;
    --shadow: 0 14px 32px rgba(6, 22, 47, .12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }

.topbar {
    align-items: center;
    background: linear-gradient(100deg, var(--navy), #092b59 68%, var(--red));
    border-bottom: 4px solid var(--gold);
    color: white;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    min-height: 64px;
    padding: 10px 14px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    display: inline-flex;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
}

.brand-mark {
    background: white;
    border-radius: 6px;
    height: 42px;
    object-fit: contain;
    padding: 2px;
    width: 42px;
}

.brand span {
    color: white;
    font-size: 18px;
    font-weight: 950;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.topbar-right {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

nav {
    display: flex;
    gap: 12px;
}

nav a {
    color: #f7f9ff;
    font-size: 14px;
    font-weight: 850;
    text-decoration: none;
}

.user-menu { position: relative; }

.user-menu summary {
    align-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    font-size: 14px;
    font-weight: 850;
    gap: 8px;
    list-style: none;
    min-height: 36px;
    padding: 7px 12px;
}

.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::after { color: var(--gold); content: "v"; font-size: 11px; }

.user-menu-panel {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: var(--ink);
    display: grid;
    min-width: 170px;
    padding: 8px;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
}

.user-menu-panel a {
    border-radius: 6px;
    font-weight: 800;
    padding: 10px;
    text-decoration: none;
}

.user-menu-panel a:hover { background: #eef3fb; }

.shell {
    margin: 0 auto;
    max-width: 760px;
    padding: 14px;
}

.hero {
    background: linear-gradient(145deg, var(--navy), #0b376f 62%, var(--red));
    color: white;
    display: grid;
    gap: 18px;
    margin: -14px -14px 18px;
    padding: 30px 14px;
}

.hero h1 {
    font-size: 40px;
    line-height: 1;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.hero p {
    color: #f3f7ff;
    font-size: 16px;
    line-height: 1.48;
    margin: 0;
}

.login-panel,
.settings-panel,
.player-card,
.team-block {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-panel,
.settings-panel {
    color: var(--ink);
    padding: 18px;
}

.login-panel h2,
.settings-panel h2 {
    color: var(--navy);
    margin: 0 0 8px;
}

.login-panel p,
.settings-panel p {
    color: var(--muted);
}

.button,
button {
    align-items: center;
    background: var(--red);
    border: 1px solid var(--red);
    border-radius: 7px;
    color: white;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 900;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    text-decoration: none;
}

.button.secondary,
button.secondary {
    background: white;
    color: var(--navy);
}

button.active.good,
.button.good { background: var(--green); border-color: var(--green); }
button.active.bad,
.button.bad { background: var(--red); border-color: var(--red); }

button:disabled {
    cursor: wait;
    opacity: .65;
}

.section-head {
    display: grid;
    gap: 10px;
    margin: 18px 0 14px;
}

.section-head h1,
.section-head h2 { margin: 0; }
.section-head h1 { font-size: 30px; text-transform: uppercase; }
.section-head p { color: var(--muted); margin: 4px 0 0; }

.player-search {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 850;
    gap: 6px;
    width: min(100%, 360px);
}

.player-search-row {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
}

.player-search input {
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    padding: 12px 14px;
    width: 100%;
}

.player-search button {
    min-height: 46px;
}

.player-search input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(22, 70, 132, .14);
    outline: none;
}

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

.player-card {
    --jumper-bg: var(--navy);
    --jumper-border: var(--gold);
    --jumper-fg: white;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
}

.player-card.pinned { border-top: 4px solid var(--green); }
.player-card.dismissed { border-top: 4px solid var(--red); opacity: .86; }

.player-main {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: auto auto 1fr;
}

.jumper-badge {
    align-items: center;
    background: var(--jumper-bg);
    border: 2px solid var(--jumper-border);
    border-radius: 8px;
    color: var(--jumper-fg);
    display: inline-flex;
    font-size: 18px;
    font-weight: 950;
    justify-content: center;
    min-height: 46px;
    min-width: 50px;
    padding: 6px 8px;
    text-shadow:
        -1px -1px 0 var(--jumper-outline, rgba(0, 0, 0, .9)),
        1px -1px 0 var(--jumper-outline, rgba(0, 0, 0, .9)),
        -1px 1px 0 var(--jumper-outline, rgba(0, 0, 0, .9)),
        1px 1px 0 var(--jumper-outline, rgba(0, 0, 0, .9)),
        0 0 5px var(--jumper-glow, rgba(0, 0, 0, .55));
    -webkit-text-stroke: 1px var(--jumper-outline, rgba(0, 0, 0, .9));
}

.team-adelaide {
    --jumper-bg: linear-gradient(90deg, #002b5c 0 34%, #ffd200 34% 66%, #c8102e 66%);
    --jumper-border: #c8102e;
    --jumper-fg: white;
}

.team-brisbane-lions {
    --jumper-bg: linear-gradient(90deg, #6a0032 0 56%, #f7c600 56% 76%, #0054a6 76%);
    --jumper-border: #f7c600;
    --jumper-fg: white;
}

.team-carlton {
    --jumper-bg: #031a40;
    --jumper-border: #cfd8e6;
    --jumper-fg: white;
}

.team-collingwood {
    --jumper-bg: repeating-linear-gradient(90deg, #050505 0 10px, #ffffff 10px 20px);
    --jumper-border: #050505;
    --jumper-fg: white;
    --jumper-outline: #050505;
    --jumper-glow: rgba(255, 255, 255, .9);
}

.team-essendon {
    --jumper-bg: linear-gradient(135deg, #111111 0 42%, #d50032 42% 58%, #111111 58%);
    --jumper-border: #d50032;
    --jumper-fg: white;
}

.team-fremantle {
    --jumper-bg: #2a0a58;
    --jumper-border: #ffffff;
    --jumper-fg: white;
}

.team-geelong {
    --jumper-bg: repeating-linear-gradient(180deg, #ffffff 0 9px, #002b5c 9px 17px);
    --jumper-border: #002b5c;
    --jumper-fg: white;
    --jumper-outline: #002b5c;
    --jumper-glow: rgba(255, 255, 255, .85);
}

.team-gold-coast {
    --jumper-bg: linear-gradient(90deg, #e31b23 0 62%, #ffd200 62% 82%, #005baa 82%);
    --jumper-border: #ffd200;
    --jumper-fg: white;
}

.team-greater-western-sydney {
    --jumper-bg: linear-gradient(90deg, #f15a24 0 58%, #3a3a3a 58% 78%, #ffffff 78%);
    --jumper-border: #f15a24;
    --jumper-fg: white;
}

.team-hawthorn {
    --jumper-bg: repeating-linear-gradient(90deg, #4b2e1f 0 12px, #f5c400 12px 24px);
    --jumper-border: #4b2e1f;
    --jumper-fg: white;
}

.team-melbourne {
    --jumper-bg: linear-gradient(180deg, #001f4e 0 60%, #c8102e 60%);
    --jumper-border: #c8102e;
    --jumper-fg: white;
}

.team-north-melbourne {
    --jumper-bg: repeating-linear-gradient(90deg, #ffffff 0 12px, #0057b8 12px 24px);
    --jumper-border: #0057b8;
    --jumper-fg: white;
    --jumper-outline: #003f8f;
    --jumper-glow: rgba(255, 255, 255, .85);
}

.team-port-adelaide {
    --jumper-bg: linear-gradient(90deg, #111111 0 52%, #00a3ad 52% 76%, #ffffff 76%);
    --jumper-border: #00a3ad;
    --jumper-fg: white;
}

.team-richmond {
    --jumper-bg: linear-gradient(135deg, #111111 0 42%, #ffd200 42% 58%, #111111 58%);
    --jumper-border: #ffd200;
    --jumper-fg: white;
}

.team-st-kilda {
    --jumper-bg: linear-gradient(90deg, #111111 0 33%, #ffffff 33% 66%, #ed1b2f 66%);
    --jumper-border: #111111;
    --jumper-fg: white;
}

.team-sydney {
    --jumper-bg: linear-gradient(180deg, #ffffff 0 54%, #e1251b 54%);
    --jumper-border: #e1251b;
    --jumper-fg: white;
    --jumper-outline: #c8102e;
    --jumper-glow: rgba(255, 255, 255, .85);
}

.team-west-coast {
    --jumper-bg: linear-gradient(90deg, #003087 0 62%, #f2c300 62%);
    --jumper-border: #f2c300;
    --jumper-fg: white;
}

.team-western-bulldogs {
    --jumper-bg: linear-gradient(180deg, #0057b8 0 45%, #ffffff 45% 62%, #ed1b2f 62%);
    --jumper-border: #0057b8;
    --jumper-fg: white;
}

.avatar-wrap {
    display: inline-grid;
    height: 52px;
    width: 52px;
}

.avatar {
    background: #e8eef7;
    border: 2px solid #d2dceb;
    border-radius: 50%;
    display: grid;
    flex: 0 0 52px;
    height: 52px;
    object-fit: cover;
    place-items: center;
    width: 52px;
}

.avatar-fallback {
    color: var(--blue);
    font-weight: 950;
}

.player-kicker {
    color: var(--red);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

h3 {
    font-size: 19px;
    line-height: 1.15;
    margin: 3px 0 0;
}

.stat-groups {
    display: grid;
    gap: 12px;
}

.stat-group {
    display: grid;
    gap: 8px;
}

.stat-group h4 {
    color: var(--navy);
    font-size: 13px;
    font-weight: 950;
    margin: 0;
    text-transform: uppercase;
}

.stats-row {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, 1fr);
}

.stat {
    background: #eef3fb;
    border-radius: 7px;
    color: var(--muted);
    display: grid;
    font-size: 12px;
    min-height: 48px;
    padding: 7px;
}

.stat strong {
    color: var(--navy);
    font-size: 17px;
}

.actions {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, 1fr);
}

.actions button:not(.active) {
    background: white;
    color: var(--ink);
}

.note-form,
.auth-form,
.auth-options {
    display: grid;
    gap: 10px;
}

.auth-form { gap: 12px; }

.auth-form label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 850;
    gap: 6px;
}

.auth-switch { margin-bottom: 0; }
.auth-switch a { font-weight: 950; }

textarea,
input {
    border: 1px solid var(--line);
    border-radius: 7px;
    font: inherit;
    min-height: 44px;
    padding: 10px;
    width: 100%;
}

textarea:focus,
input:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(11, 55, 111, .16);
}

.form-error,
.form-success,
.empty {
    border-radius: 8px;
    padding: 14px;
}

.form-error { background: #fff0f2; border: 1px solid #e2a4ae; color: #8d1025; }
.form-success { background: #ebfff5; border: 1px solid #99d8b7; color: #12643f; }
.empty { background: #fff8e6; border: 1px solid #ead493; color: #6a4c0b; }

.team-accordion {
    display: grid;
    gap: 12px;
}

.team-block {
    overflow: hidden;
}

.team-block summary {
    align-items: center;
    background: linear-gradient(90deg, var(--navy), var(--blue));
    border-left: 8px solid var(--jumper-border, var(--gold));
    color: white;
    cursor: pointer;
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto;
    list-style: none;
    padding: 15px;
    position: relative;
}

.team-block summary::-webkit-details-marker { display: none; }

.team-block summary .team-title {
    align-items: center;
    display: inline-flex;
    font-size: 18px;
    font-weight: 950;
    gap: 10px;
    text-transform: uppercase;
}

.team-colour-mark {
    background: var(--jumper-bg, var(--gold));
    border: 2px solid rgba(255, 255, 255, .62);
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .24);
    display: inline-block;
    flex: 0 0 auto;
    height: 24px;
    width: 38px;
}

.team-block summary small {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 999px;
    padding: 5px 9px;
}

.team-summary-stats {
    display: grid;
    gap: 7px;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    text-shadow: none;
}

.team-summary-stats span {
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 7px;
    color: rgba(255, 255, 255, .86);
    display: grid;
    font-size: 11px;
    font-weight: 850;
    gap: 1px;
    min-height: 42px;
    padding: 6px 8px;
    text-transform: uppercase;
}

.team-summary-stats strong {
    color: white;
    font-size: 16px;
    line-height: 1;
}

.team-block summary::after {
    color: #ffe7a0;
    content: "Open";
    font-size: 12px;
    font-weight: 950;
    grid-column: 1 / -1;
    text-transform: uppercase;
}

.team-block[open] summary::after { content: "Close"; }
.team-grid { padding: 12px; }
.player-search-item { min-width: 0; }
.search-empty { margin-top: 12px; }

@media (min-width: 720px) {
    .topbar {
        min-height: 72px;
        padding: 10px 28px;
    }

    .brand-mark {
        height: 48px;
        width: 48px;
    }

    .brand span { font-size: 22px; }

    .topbar-right {
        align-items: center;
        flex-direction: row;
        gap: 22px;
    }

    nav { gap: 18px; }

    .shell {
        max-width: 1120px;
        padding: 24px;
    }

    .hero {
        align-items: end;
        gap: 28px;
        grid-template-columns: 1.2fr .8fr;
        margin: -24px -24px 24px;
        min-height: 320px;
        padding: 44px 30px;
    }

    .hero h1 { font-size: 58px; }
    .login-panel, .settings-panel { padding: 24px; }
    .section-head { align-items: end; display: flex; justify-content: space-between; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
    .stats-row { grid-template-columns: repeat(5, 1fr); }
    .team-grid { padding: 16px; }
    .team-summary-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
