:root {
    --bg: #0b1220;
    --bg-soft: #111b2e;
    --panel: #162238;
    --panel-alt: #1c2b45;
    --ink: #eef4ff;
    --muted: #a9b8d0;
    --line: #2b3c5a;
    --accent: #f2b134;
    --accent-ink: #1f1604;
    --positive: #52d68a;
    --negative: #ff7b7b;
    --info: #7cc4ff;
    --radius: 12px;
    --shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
    --focus: 0 0 0 3px rgba(124, 196, 255, 0.65);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at 8% 0%, rgba(242, 177, 52, 0.12), transparent 34rem),
        radial-gradient(circle at 92% 8%, rgba(124, 196, 255, 0.10), transparent 30rem),
        var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--info);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-radius: 6px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 0.6rem 1rem;
    z-index: 100;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
}

.site-header {
    border-bottom: 1px solid var(--line);
    background: rgba(11, 18, 32, 0.9);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--ink);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: linear-gradient(145deg, var(--accent), #c47f1b);
    display: grid;
    place-items: center;
    color: #1d1505;
    font-weight: 900;
}

.nav {
    display: flex;
    gap: 0.15rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav a {
    color: var(--muted);
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}

.nav a:hover,
.nav a[aria-current="page"] {
    background: var(--panel);
    color: var(--ink);
    text-decoration: none;
}

.nav-spacer {
    flex: 1;
}

.user-chip {
    color: var(--muted);
    font-size: 0.85rem;
    border: 1px solid var(--line);
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
}

.main {
    max-width: 1380px;
    margin: 0 auto;
    padding: 1.4rem 1.2rem 4rem;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

h1,
h2,
h3 {
    margin: 0 0 0.35rem;
    line-height: 1.2;
}

h1 {
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
}

h2 {
    font-size: 1.2rem;
}

h3 {
    font-size: 1rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 800;
}

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

.small {
    font-size: 0.82rem;
}

.tiny {
    font-size: 0.74rem;
}

.mono {
    font-family: "Cascadia Code", Consolas, monospace;
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

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

.card {
    background: linear-gradient(180deg, rgba(28, 43, 69, 0.7), rgba(22, 34, 56, 0.92));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.card.flush {
    padding: 0;
    overflow: hidden;
}

.card > h2,
.card > h3 {
    margin-bottom: 0.65rem;
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.stat {
    border: 1px solid var(--line);
    background: rgba(11, 18, 32, 0.45);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
}

.stat .label {
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat .value {
    font-size: 1.4rem;
    font-weight: 800;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th,
td {
    text-align: left;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid rgba(43, 60, 90, 0.75);
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    position: sticky;
    top: 0;
    background: var(--panel-alt);
    z-index: 1;
}

tbody tr:hover {
    background: rgba(124, 196, 255, 0.06);
}

.table-wrap {
    overflow: auto;
    max-height: 65vh;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.table-compact th,
.table-compact td {
    padding: 0.42rem 0.55rem;
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
}

.crest {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 4px;
    display: grid;
    place-items: center;
    font-size: 0.58rem;
    font-weight: 900;
    color: #fff;
    flex: 0 0 auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.16rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    background: rgba(11, 18, 32, 0.45);
    white-space: nowrap;
}

.badge.accent {
    color: var(--accent);
    border-color: rgba(242, 177, 52, 0.45);
    background: rgba(242, 177, 52, 0.10);
}

.badge.good {
    color: var(--positive);
    border-color: rgba(82, 214, 138, 0.45);
    background: rgba(82, 214, 138, 0.10);
}

.badge.bad {
    color: var(--negative);
    border-color: rgba(255, 123, 123, 0.45);
    background: rgba(255, 123, 123, 0.10);
}

.badge.info {
    color: var(--info);
    border-color: rgba(124, 196, 255, 0.45);
    background: rgba(124, 196, 255, 0.10);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid var(--line);
    background: var(--panel-alt);
    color: var(--ink);
    border-radius: 9px;
    padding: 0.5rem 0.8rem;
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    font-family: inherit;
}

.btn:hover {
    background: #263a5a;
    text-decoration: none;
}

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

.btn.primary:hover {
    background: #ffc44f;
}

.btn.danger {
    background: rgba(255, 123, 123, 0.12);
    border-color: rgba(255, 123, 123, 0.5);
    color: #ffd0d0;
}

.btn.ghost {
    background: transparent;
}

.btn.small {
    padding: 0.3rem 0.55rem;
    font-size: 0.76rem;
}

.btn-row {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    align-items: center;
}

form {
    margin: 0;
}

label {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 0.25rem;
}

input,
select,
textarea {
    width: 100%;
    background: #0c1526;
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    font-family: inherit;
    font-size: 0.9rem;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: var(--accent);
}

textarea {
    min-height: 5rem;
    resize: vertical;
}

.field {
    margin-bottom: 0.8rem;
}

.inline {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.inline > .field {
    margin-bottom: 0;
}

.flash {
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid var(--line);
    background: var(--panel);
}

.flash.success {
    border-color: rgba(82, 214, 138, 0.5);
    background: rgba(82, 214, 138, 0.08);
}

.flash.error {
    border-color: rgba(255, 123, 123, 0.5);
    background: rgba(255, 123, 123, 0.08);
}

.list {
    display: grid;
    gap: 0.55rem;
}

.list-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
    background: rgba(11, 18, 32, 0.35);
}

.list-item h3 {
    margin-bottom: 0.15rem;
}

.pill-row {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tabs a {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.tabs a.active,
.tabs a:hover {
    background: var(--panel-alt);
    color: var(--ink);
    text-decoration: none;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 1rem;
}

.hero {
    background: linear-gradient(120deg, rgba(242, 177, 52, 0.14), rgba(124, 196, 255, 0.08));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.2rem;
}

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

.scoreline {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.4rem;
    padding: 0.7rem 0;
}

.scoreline .score {
    font-size: clamp(2rem, 5vw, 3.6rem);
    font-weight: 900;
    line-height: 1;
}

.scoreline .at {
    color: var(--muted);
    font-weight: 700;
}

.timeline {
    display: grid;
    gap: 0.55rem;
    max-height: 70vh;
    overflow: auto;
    padding-right: 0.2rem;
}

.event {
    display: grid;
    grid-template-columns: 4.6rem 1fr;
    gap: 0.6rem;
    border-left: 3px solid var(--line);
    padding: 0.35rem 0 0.35rem 0.7rem;
}

.event.scoring {
    border-left-color: var(--accent);
}

.event.turnover {
    border-left-color: var(--negative);
}

.event .clock {
    color: var(--muted);
    font-size: 0.75rem;
    font-family: "Cascadia Code", Consolas, monospace;
}

.drive {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.65rem;
    background: rgba(11, 18, 32, 0.35);
}

.rating-bar {
    height: 0.42rem;
    border-radius: 999px;
    background: #0c1526;
    overflow: hidden;
    min-width: 4rem;
}

.rating-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #d18d15, var(--accent));
}

.depth-group {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.depth-row {
    display: grid;
    grid-template-columns: 2.2rem minmax(0, 1fr) 7rem;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.35rem;
    max-height: 24rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.6rem;
    background: rgba(11, 18, 32, 0.35);
}

.check-grid label {
    display: flex;
    gap: 0.45rem;
    align-items: flex-start;
    color: var(--ink);
    font-weight: 500;
    font-size: 0.82rem;
    margin: 0;
}

.stack {
    display: grid;
    gap: 0.8rem;
}

.empty {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
    color: var(--muted);
}

.pagination {
    margin-top: 1rem;
}

.pagination nav > div:first-child {
    display: none;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-right: 0.25rem;
    color: var(--muted);
}

.pagination .active span {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: var(--accent);
}

.footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.78rem;
    padding: 1rem 1.2rem 2rem;
    text-align: center;
}

.reduced-motion * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

@media (max-width: 1000px) {
    .grid.four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 760px) {
    .grid.two,
    .grid.three,
    .grid.four {
        grid-template-columns: minmax(0, 1fr);
    }

    .header-inner {
        align-items: flex-start;
    }

    .nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .nav a {
        white-space: nowrap;
    }

    .depth-row {
        grid-template-columns: 2rem minmax(0, 1fr);
    }

    .depth-row .rating-bar-wrap {
        grid-column: 2;
    }

    th,
    td {
        padding: 0.45rem;
    }
}

.view-options {
    position: relative;
}

.view-options summary {
    list-style: none;
    cursor: pointer;
}

.view-options summary::-webkit-details-marker {
    display: none;
}

.view-options-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    min-width: 13rem;
    background: var(--panel-alt);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.65rem;
    box-shadow: var(--shadow);
    z-index: 60;
    display: grid;
    gap: 0.45rem;
}

.view-options-panel label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    color: var(--ink);
    font-weight: 600;
}

html[data-contrast="high"] {
    --bg: #000000;
    --bg-soft: #050505;
    --panel: #0b0b0b;
    --panel-alt: #141414;
    --ink: #ffffff;
    --muted: #e0e0e0;
    --line: #ffffff;
    --accent: #ffd400;
    --accent-ink: #000000;
    --positive: #5dff9f;
    --negative: #ff9c9c;
    --info: #9ddcff;
    --shadow: none;
}

html[data-density="compact"] th,
html[data-density="compact"] td {
    padding: 0.3rem 0.42rem;
    font-size: 0.8rem;
}

html[data-density="compact"] .card {
    padding: 0.75rem;
}
