/* Public dashboard presentation shared by the Cloudflare-hosted site. */
:root {
    color-scheme: light;
    --ink: #142534;
    --muted: #617180;
    --line: #ccd6de;
    --surface: #ffffff;
    --canvas: #eef3f6;
    --primary: #2377ad;
    --primary-dark: #155277;
    --opponent: #d85b13;
    --equal: #777d82;
    --lime: #d8ff42;
    --lime-dark: #a9cd18;
    --shadow: 0 18px 48px rgba(20, 37, 52, 0.12);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

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

body {
    min-width: 320px;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(216, 255, 66, 0.18), transparent 28rem),
        linear-gradient(180deg, #e9f0f4 0, var(--canvas) 34rem);
}

button,
select,
input {
    font: inherit;
}

.hero {
    position: relative;
    overflow: hidden;
    color: white;
    background: #102534;
    border-bottom: 5px solid var(--lime);
}

.hero::after {
    position: absolute;
    right: -8rem;
    bottom: -17rem;
    width: 34rem;
    height: 34rem;
    content: "";
    border: 3rem solid rgba(216, 255, 66, 0.09);
    border-radius: 50%;
}

.hero__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 44px 0 38px;
    gap: 32px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--lime);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(2.2rem, 6vw, 4.9rem);
    line-height: 0.94;
    letter-spacing: -0.055em;
}

.hero__summary {
    max-width: 630px;
    margin: 18px 0 0;
    color: #c7d3db;
    font-size: 1.05rem;
}

.publish-state {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-bottom: 4px;
    padding: 10px 14px;
    color: #dce6eb;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
    gap: 8px;
}

.publish-state__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 0 4px rgba(216, 255, 66, 0.12);
}

.page-shell {
    width: min(1220px, calc(100% - 32px));
    margin: 28px auto 0;
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    background: var(--surface);
    gap: 14px;
}

.filters label {
    display: grid;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    gap: 6px;
}

.filters .custom-date[hidden] {
    display: none;
}

.filters select,
.filters input,
.compact-select {
    width: 100%;
    min-height: 42px;
    padding: 8px 10px;
    color: var(--ink);
    border: 1px solid #aebdc7;
    border-radius: 7px;
    background: #fbfdfe;
}

.filters select:focus,
.filters input:focus,
.compact-select:focus,
.view-tabs button:focus-visible,
.toggle button:focus-visible {
    outline: 3px solid rgba(35, 119, 173, 0.25);
    outline-offset: 2px;
}

.chart-key {
    display: flex;
    flex-wrap: wrap;
    padding: 11px 18px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-top: 0;
    background: #f9fbfc;
    font-size: 0.76rem;
    gap: 10px 24px;
}

.chart-key span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.swatch--primary,
.bar--primary {
    background: var(--primary);
}

.swatch--opponent,
.bar--opponent {
    background: var(--opponent);
}

.swatch--equal,
.bar--equal {
    background: var(--equal);
}

.view-tabs {
    display: flex;
    margin-top: 18px;
    padding: 7px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
    gap: 5px;
}

.view-tabs__hint {
    display: none;
}

.view-tabs button,
.toggle button {
    padding: 10px 16px;
    white-space: nowrap;
    color: var(--muted);
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-weight: 750;
    cursor: pointer;
}

.view-tabs button[aria-current="page"],
.toggle button[aria-pressed="true"] {
    color: white;
    background: var(--primary);
}

.stats-content {
    min-height: 420px;
    padding: 26px 0 54px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.8rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.section-heading p {
    margin: 7px 0 0;
    color: var(--muted);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 20px;
    gap: 10px;
}

.metric-card {
    min-width: 0;
    padding: 14px 14px 15px;
    border: 1px solid #24333e;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 5px 16px rgba(20, 37, 52, 0.05);
}

.metric-card__label {
    display: block;
    margin-bottom: 15px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.73rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric-card__value {
    display: block;
    overflow: hidden;
    font-size: clamp(0.78rem, 1.35vw, 1.1rem);
    font-weight: 850;
    letter-spacing: -0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    gap: 14px;
}

.panel__header h3 {
    margin: 0;
    font-size: 1rem;
}

.panel__header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.outcome-stack {
    display: flex;
    height: 28px;
    margin: 22px 18px 8px;
    overflow: hidden;
    border-radius: 5px;
    background: #d9e1e6;
}

.outcome-stack span {
    display: grid;
    min-width: 0;
    place-items: center;
    color: white;
    font-size: 0.72rem;
    font-weight: 800;
}

.outcome-key {
    display: flex;
    flex-wrap: wrap;
    padding: 0 18px 18px;
    color: var(--muted);
    font-size: 0.76rem;
    gap: 12px 20px;
}

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

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

th,
td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e1e7eb;
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: #f6f9fa;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.result--win {
    color: var(--primary-dark);
    font-weight: 800;
}

.result--loss {
    color: #aa3f0c;
    font-weight: 800;
}

.result--draw {
    color: var(--equal);
    font-weight: 800;
}

.timeline-canvas {
    display: block;
    width: 100%;
    height: 340px;
    padding: 14px;
}

.holes-grid,
.breakdown-grid,
.special-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.hole-card,
.breakdown-card,
.special-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
}

.hole-card__top,
.breakdown-card__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

.hole-card h3,
.breakdown-card h3,
.special-card h3 {
    margin: 0;
    font-size: 1rem;
}

.mini-stack {
    display: flex;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #dfe6ea;
}

.mini-stack span {
    min-width: 0;
}

.compact-stats {
    display: flex;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.72rem;
    gap: 14px;
}

.toggle {
    display: inline-flex;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
}

.empty-state,
.error-card,
.loading-card {
    display: grid;
    min-height: 320px;
    padding: 40px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    place-content: center;
    box-shadow: var(--shadow);
}

.empty-state h2,
.error-card h2 {
    margin: 0 0 8px;
}

.empty-state p,
.error-card p,
.loading-card p {
    max-width: 540px;
    margin: 0;
    color: var(--muted);
}

.loading-card__ball {
    width: 32px;
    height: 32px;
    margin: 0 auto 18px;
    border: 5px solid #dfe7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

footer {
    padding: 28px 16px 42px;
    color: var(--muted);
    text-align: center;
    font-size: 0.78rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .hero__inner {
        align-items: flex-start;
        flex-direction: column;
    }

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

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

@media (max-width: 640px) {
    .hero__inner {
        padding: 32px 0 28px;
    }

    .page-shell,
    .hero__inner {
        width: min(100% - 20px, 1220px);
    }

    .filters,
    .metric-grid,
    .holes-grid,
    .breakdown-grid,
    .special-grid {
        grid-template-columns: 1fr;
    }

    .chart-key {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-card__value {
        font-size: 1rem;
    }

    .view-tabs__hint {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        margin: 5px 8px 0;
        color: var(--muted);
        font-size: 0.76rem;
        font-weight: 750;
        gap: 5px;
    }

    .view-tabs__hint span {
        color: var(--primary);
        font-size: 1rem;
    }
}
