:root {
    color-scheme: light dark;
    --bg: #ffffff;
    --fg: #1a1a1a;
    --muted: #5c5c5c;
    --accent: #1b6ac9;
    --border: #e0e0e0;
    --surface: #f7f7f7;
    --surface-2: #ffffff;
    --danger: #b51218;
    --report-green: #0b6b3a;
    --report-red: #e21b23;
    --report-ink: #0a0a0a;
    --report-ink-fg: #f2f2f2;
    --rate-tint: #ececec;
    --rate-fg: #4a4a4a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181c;
        --fg: #e8e8e8;
        --muted: #a0a0a0;
        --accent: #6aa9f0;
        --border: #2c2f36;
        --surface: #1c1f25;
        --surface-2: #22262d;
        --danger: #f2656b;
        --report-green: #12945a;
        --report-red: #f0464d;
        --report-ink: #0a0a0a;
        --report-ink-fg: #f2f2f2;
        --rate-tint: #2a2e35;
        --rate-fg: #c6c6c6;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.5;
}

header {
    border-bottom: 1px solid var(--border);
}

header nav {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    color: var(--fg);
    font-weight: 600;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

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

main {
    max-width: 72rem;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

main.wide {
    max-width: 84rem;
}

a {
    color: var(--accent);
}

code {
    background: color-mix(in srgb, var(--fg) 8%, transparent);
    border-radius: 3px;
    padding: 0.1em 0.35em;
}

/* ---------------------------------------------------------------- forms */

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-heading .actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-block: 1.5rem;
}

.form.narrow {
    max-width: 34rem;
}

.form label {
    font-weight: 600;
    margin-top: 0.75rem;
}

.form label.checkbox {
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

input,
select,
textarea {
    font: inherit;
    color: var(--fg);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
}

input[type="checkbox"] {
    width: auto;
}

button,
.button {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.45rem 0.9rem;
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
    display: inline-block;
    margin-top: 1rem;
}

.row-actions button,
.share button {
    margin-top: 0;
}

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

button.link-button {
    background: none;
    border: none;
    color: var(--accent);
    padding: 0;
    margin: 0;
    font-weight: 400;
    text-decoration: underline;
}

.muted {
    color: var(--muted);
}

.field-error {
    color: var(--danger);
    font-size: 0.875rem;
}

.errors {
    color: var(--danger);
    border: 1px solid currentcolor;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-block: 1rem;
}

.errors:empty {
    display: none;
}

.errors ul {
    margin: 0.5rem 0 0;
}

.notice {
    border-left: 4px solid var(--report-green);
    background: var(--surface);
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
}

.empty {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    color: var(--muted);
    max-width: 40rem;
}

.logo-preview {
    max-height: 5rem;
    align-self: flex-start;
}

.sr-heading {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--muted);
}

/* ------------------------------------------------------------- listings */

table.list {
    width: 100%;
    border-collapse: collapse;
    margin-block: 1.5rem;
}

table.list th,
table.list td {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table.list thead th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

table.list .description {
    color: var(--muted);
    max-width: 22rem;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.share {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-block: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.share p {
    margin: 0;
}

/* --------------------------------------------------------------- report */

.report {
    margin-block: 1.5rem;
}

.report-cover {
    background: var(--report-ink);
    color: var(--report-ink-fg);
    border-radius: 10px;
    padding: 1.5rem;
    border-top: 5px solid var(--report-green);
}

.report-cover h1 {
    margin: 0.2rem 0 0;
    font-size: 1.8rem;
    letter-spacing: -0.02em;
}

.eyebrow {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9a9a9a;
}

.matchup {
    margin: 0.4rem 0 0;
    color: #c8c8c8;
}

.report-lockup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    margin-block: 1.5rem;
}

.report-lockup .crest {
    text-align: center;
}

.report-lockup img {
    height: 6rem;
    max-width: 8rem;
    object-fit: contain;
}

.crest-name {
    margin: 0.4rem 0 0;
    font-weight: 700;
}

.score {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid #2b2b2b;
}

.report-meta dt {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9a9a9a;
}

.report-meta dd {
    margin: 0.2rem 0 0;
    font-weight: 700;
}

.report-description {
    margin: 1rem 0 0;
    color: #c8c8c8;
    max-width: 55rem;
}

.period {
    margin-top: 2.5rem;
}

.period h2 {
    font-size: 1.4rem;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}

.kpi {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.75rem;
}

.kpi li {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-top: 3px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.kpi li.kpi-green {
    border-top-color: var(--report-green);
}

.kpi li.kpi-red {
    border-top-color: var(--report-red);
}

.kpi li.kpi-ink {
    border-top-color: var(--fg);
}

.kpi-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.kpi-value {
    font-size: 1.2rem;
    font-weight: 700;
}

.kpi-note {
    font-size: 0.7rem;
    color: var(--muted);
}

.table-scroll {
    overflow-x: auto;
}

table.players {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    background: var(--surface-2);
    border-radius: 8px;
    overflow: hidden;
}

table.players thead tr.groups th {
    background: var(--report-ink);
    color: var(--report-ink-fg);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
}

table.players thead th {
    background: #171717;
    color: #ffffff;
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    padding: 0.4rem 0.5rem;
    text-align: center;
    white-space: nowrap;
}

table.players tbody th {
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

table.players td,
table.players tbody th {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

table.players tbody tr:nth-child(even) td,
table.players tbody tr:nth-child(even) th {
    background: color-mix(in srgb, var(--fg) 3%, transparent);
}

table.players .rate {
    background: var(--rate-tint);
    color: var(--rate-fg);
}

table.players thead th.rate {
    background: #262626;
    color: #ffffff;
}

.report-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 2rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.8rem;
}
