:root {
    --ink: #16233b;
    --board: #edf0f3;
    --tile: #ffffff;
    --graphite: #2b3340;
    --pencil: #5d6877;
    --line: #cbd2db;
    --amber: #f2a900;
    --joined: #1e7f4f;
    --left: #b3372c;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--board);
    color: var(--graphite);
    font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.45;
}

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

button {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--amber);
    outline-offset: 2px;
}

h2 {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
    font-stretch: condensed;
    font-weight: 700;
    line-height: 1.15;
}

h3 {
    margin: 1.5rem 0 0.5rem;
    font-size: 1rem;
    font-stretch: semi-condensed;
    font-weight: 700;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.wordmark {
    margin: 0;
    font-size: 1.75rem;
    font-stretch: condensed;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1;
}

.masthead {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0 2rem;
    padding: 0 1.25rem;
    background: var(--ink);
    color: #ffffff;
}

.masthead .wordmark {
    align-self: center;
    padding: 0.9rem 0;
}

.masthead nav {
    display: flex;
}

.sport-tabs {
    display: flex;
}

.sport-tabs button {
    height: 100%;
    min-height: 3.5rem;
    padding: 0 1.1rem;
    border: 0;
    border-bottom: 4px solid transparent;
    background: none;
    color: #c5cedc;
    font-size: 1.125rem;
    font-stretch: condensed;
    font-weight: 600;
}

.sport-tabs button:hover {
    color: #ffffff;
}

.sport-tabs button[aria-pressed="true"] {
    border-bottom-color: var(--amber);
    color: #ffffff;
}

.account {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    font-size: 0.875rem;
}

.account button {
    padding: 0.3rem 0.7rem;
    border: 1px solid #5a6a85;
    border-radius: 3px;
    background: none;
    color: #ffffff;
}

.workspace {
    padding: 1rem 1.25rem 2rem;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.view-tabs {
    display: flex;
    border: 1px solid var(--ink);
    border-radius: 3px;
    overflow: hidden;
}

.view-tabs button {
    padding: 0.4rem 0.9rem;
    border: 0;
    background: var(--tile);
    font-weight: 600;
}

.view-tabs button[aria-pressed="true"] {
    background: var(--ink);
    color: #ffffff;
}

.league-toggles {
    display: flex;
    flex: 1 1 16rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.chip {
    padding: 0.3rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--tile);
    font-size: 0.875rem;
    font-stretch: semi-condensed;
    font-weight: 600;
}

.chip[aria-pressed="true"] {
    border-color: var(--amber);
    background: var(--amber);
    color: var(--ink);
}

.chip-back {
    border-style: dashed;
}

.search {
    position: relative;
    flex: 0 1 16rem;
}

.search input {
    width: 100%;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--tile);
}

.search-results {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 1200;
    max-height: 22rem;
    overflow-y: auto;
    border: 1px solid var(--ink);
    background: var(--tile);
}

.search-results button {
    display: block;
    width: 100%;
    padding: 0.45rem 0.7rem;
    border: 0;
    border-bottom: 1px solid var(--board);
    background: none;
    text-align: left;
}

.search-results button:hover {
    background: var(--board);
}

.search-results .empty {
    padding: 0.6rem 0.7rem;
}

.sync-line {
    margin: 0.6rem 0 0.9rem;
    color: var(--pencil);
    font-size: 0.875rem;
}

#map {
    height: calc(100vh - 13.5rem);
    min-height: 26rem;
    border: 1px solid var(--line);
    background: #dfe5ea;
}

.map-note {
    margin: 0.5rem 0 0;
    color: var(--pencil);
    font-size: 0.875rem;
}

.pin-set {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-row {
    display: flex;
    gap: 2px;
}

.pin {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--tile);
    box-shadow: 0 1px 3px rgba(22, 35, 59, 0.45);
    cursor: pointer;
}

.marker-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--amber);
    border-radius: 50%;
    background: var(--ink);
    color: #ffffff;
    font-weight: 700;
}

.logo {
    flex: none;
    object-fit: contain;
}

.logo-pin {
    width: 24px;
    height: 24px;
}

.logo-row {
    width: 1.75rem;
    height: 1.75rem;
}

.logo-card {
    width: 3.5rem;
    height: 3.5rem;
}

.logo-head {
    width: 4.5rem;
    height: 4.5rem;
}

.logo-blank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--board);
    color: var(--pencil);
    font-size: 0.6875rem;
    font-weight: 700;
}

.team-grid,
.league-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: 0.75rem;
}

.cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.cols-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cols-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.conferences {
    display: grid;
    gap: 1.5rem;
}

.conferences-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.conference-name {
    margin: 0 0 0.25rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--ink);
    font-size: 1.25rem;
    font-stretch: condensed;
}

.division-name {
    margin: 0.75rem 0 0.4rem;
    color: var(--pencil);
    font-size: 0.875rem;
}

.conference .team-card {
    min-height: 11.5rem;
    padding: 0.7rem;
}

.team-card,
.league-card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    width: 100%;
    height: 100%;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--tile);
    text-align: left;
}

.team-card:hover,
.league-card:hover {
    border-color: var(--ink);
}

.team-name,
.league-top {
    font-stretch: semi-condensed;
    font-weight: 700;
    line-height: 1.2;
}

.team-card .team-name {
    margin-top: 0.5rem;
}

.team-city {
    font-size: 0.875rem;
}

.team-meta,
.team-count {
    color: var(--pencil);
    font-size: 0.8125rem;
}

.team-count {
    margin-top: auto;
    padding-top: 0.4rem;
}

.league-country {
    font-size: 1.25rem;
    font-stretch: condensed;
    font-weight: 700;
}

.moves {
    max-width: 56rem;
    border-top: 1px solid var(--line);
}

.move {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--line);
    border-left: 4px solid var(--line);
    background: var(--tile);
}

.move-moved {
    border-left-color: var(--amber);
}

.move-joined {
    border-left-color: var(--joined);
}

.move-left {
    border-left-color: var(--left);
}

.move-status {
    border-left-color: var(--ink);
}

.move time,
.since,
.num {
    color: var(--pencil);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.move-text {
    flex: 1;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
}

button.move-text:hover,
.link:hover {
    text-decoration: underline;
}

.link {
    padding: 0;
    border: 0;
    background: none;
    color: #1b4f9c;
    text-align: left;
}

.empty,
.fine {
    color: var(--pencil);
    font-size: 0.875rem;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
    width: 36rem;
    max-width: 100%;
    padding: 1rem 1.25rem 2rem;
    overflow-y: auto;
    border-left: 4px solid var(--amber);
    background: var(--tile);
    box-shadow: -6px 0 24px rgba(22, 35, 59, 0.25);
}

.drawer-close {
    float: right;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--tile);
}

.drawer-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
}

.drawer-head h2 {
    margin: 0;
}

.drawer-head p {
    margin: 0.2rem 0 0;
}

.headshot {
    width: 5.5rem;
    height: 5.5rem;
    border-radius: 4px;
    background: var(--board);
    object-fit: cover;
}

.family ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    font-size: 0.875rem;
}

.family h3 {
    margin-top: 0;
}

.drawer-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.25rem;
    margin: 1rem 0;
    padding: 0.6rem 0.75rem;
    background: var(--board);
    font-size: 0.875rem;
}

.drawer-controls input[type="date"] {
    padding: 0.15rem 0.3rem;
    border: 1px solid var(--line);
    background: var(--tile);
}

.level {
    padding-top: 0.75rem;
    border-top: 2px solid var(--ink);
}

.roster {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.roster th {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid var(--ink);
    color: var(--pencil);
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
}

.roster td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid var(--board);
    vertical-align: top;
}

.status {
    font-stretch: semi-condensed;
    font-weight: 600;
}

.note {
    display: block;
    color: var(--pencil);
    font-size: 0.8125rem;
}

h4 {
    margin: 0.9rem 0 0.3rem;
    font-size: 0.875rem;
    font-weight: 700;
}

.scroll {
    overflow-x: auto;
}

.stat-table td,
.stat-table th {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.reserve {
    max-width: 56rem;
    margin-bottom: 0.4rem;
    border: 1px solid var(--line);
    background: var(--tile);
}

.reserve summary {
    padding: 0.5rem 0.75rem;
    font-stretch: semi-condensed;
    font-weight: 700;
    cursor: pointer;
}

.reserve .roster {
    margin: 0 0.75rem 0.75rem;
    width: calc(100% - 1.5rem);
}

.facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem 0.75rem;
    margin: 0.4rem 0 0;
    font-size: 0.875rem;
}

.facts dt {
    color: var(--pencil);
}

.facts dd {
    margin: 0;
}

.stints li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--board);
    font-size: 0.875rem;
}

.stints .since {
    margin-left: auto;
}

.gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: var(--ink);
}

.gate-panel {
    width: 100%;
    max-width: 24rem;
    padding: 2rem;
    border-top: 6px solid var(--amber);
    background: var(--tile);
}

.gate-panel .wordmark {
    color: var(--ink);
    font-size: 2.75rem;
}

.gate-lede {
    margin: 0.75rem 0 1.5rem;
    color: var(--pencil);
}

.gate-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gate-form label {
    font-size: 0.875rem;
    font-weight: 600;
}

.gate-form input[type="text"],
.gate-form input[type="password"] {
    margin-bottom: 0.5rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 3px;
}

.mode-switch {
    display: flex;
    gap: 1.25rem;
    margin: 0 0 0.75rem;
    padding: 0;
    border: 0;
}

.gate-form button {
    margin-top: 0.5rem;
    padding: 0.65rem;
    border: 0;
    border-radius: 3px;
    background: var(--ink);
    color: #ffffff;
    font-weight: 700;
}

.notice {
    margin: 0 0 1rem;
    padding: 0.6rem 0.75rem;
    border-left: 4px solid var(--left);
    background: #f8e9e7;
    font-size: 0.875rem;
}

@media (max-width: 64rem) {
    .conferences-pair {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 40rem) {
    .masthead {
        padding: 0 0.75rem;
    }

    .sport-tabs {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .sport-tabs button {
        min-height: 2.75rem;
        padding: 0 0.75rem;
        font-size: 1rem;
    }

    .workspace {
        padding: 0.75rem;
    }

    .search {
        flex-basis: 100%;
    }

    .team-grid,
    .cols-4,
    .cols-5,
    .cols-6,
    .cols-7,
    .cols-8 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #map {
        height: 60vh;
    }
}
