/* ==========================================================================
   Golf Stats — stylesheet
   Tokens → layout → chrome → components → charts → responsive → print
   ========================================================================== */

/* --------------------------------------------------------------- tokens -- */

:root {
    color-scheme: light;

    /* Surfaces and ink */
    --bg:            #f4f6f4;
    --bg-accent:     #eaefe9;
    --surface:       #ffffff;
    --surface-2:     #f5f8f5;
    --surface-3:     #eef2ee;
    --border:        rgba(11, 26, 18, 0.10);
    --border-strong: rgba(11, 26, 18, 0.18);
    --ink:           #0d1512;
    --ink-2:         #4c5a53;
    --ink-3:         #7b8a82;

    /* Brand */
    --brand:        #0f7a4d;
    --brand-strong: #0a5c39;
    --brand-ink:    #0a5c39;
    --brand-soft:   #e6f4ec;

    /* Ordinal ramp: beginner (light) → tour (dark). Validated light→dark,
       single hue, monotone lightness, light end clears 2:1 on the surface. */
    --t1: #5fbf93;
    --t2: #2da073;
    --t3: #178055;
    --t4: #0d6040;
    --t5: #07422c;

    /* Text-safe versions of the ramp, for numbers inside tables */
    --t1-text: #157a52;
    --t2-text: #146a48;
    --t3-text: #12583c;
    --t4-text: #0d4530;
    --t5-text: #073725;

    /* Fixed status palette — never themed, always paired with an icon/label */
    --sev-best:     #0d6040;
    --sev-good:     #2da073;
    --sev-warn:     #fab219;
    --sev-bad:      #d03b3b;
    --sev-good-c:   #0ca30c;
    --sev-warning:  #fab219;
    --sev-serious:  #ec835a;
    --sev-critical: #d03b3b;

    --shadow-sm: 0 1px 2px rgba(11, 26, 18, .06), 0 1px 1px rgba(11, 26, 18, .04);
    --shadow-md: 0 4px 6px -2px rgba(11, 26, 18, .05), 0 12px 24px -8px rgba(11, 26, 18, .10);
    --shadow-lg: 0 24px 60px -18px rgba(11, 26, 18, .28);

    --radius:    14px;
    --radius-lg: 22px;
    --maxw:      1180px;
    --nav-h:     60px;

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Dark values are a deliberate re-step for the dark surface, not a flip:
   the ordinal ramp reverses so the strongest tier stays the brightest mark. */
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) {
        color-scheme: dark;
        --bg:            #0b0e10;
        --bg-accent:     #10151a;
        --surface:       #12161b;
        --surface-2:     #171d23;
        --surface-3:     #1e252c;
        --border:        rgba(255, 255, 255, 0.10);
        --border-strong: rgba(255, 255, 255, 0.20);
        --ink:           #f1f5f2;
        --ink-2:         #a9b6b0;
        --ink-3:         #7d8c85;

        --brand:        #34c98c;
        --brand-strong: #5fcf9b;
        --brand-ink:    #5fcf9b;
        --brand-soft:   rgba(52, 201, 140, .13);

        --t1: #0f6b4a;
        --t2: #1a8a61;
        --t3: #2eae7c;
        --t4: #5fcf9b;
        --t5: #9ae7c0;

        --t1-text: #34c98c;
        --t2-text: #47ce95;
        --t3-text: #5fcf9b;
        --t4-text: #82dcb0;
        --t5-text: #9ae7c0;

        --sev-best: #9ae7c0;
        --sev-good: #2eae7c;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
        --shadow-md: 0 12px 28px -12px rgba(0, 0, 0, .7);
        --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg:            #0b0e10;
    --bg-accent:     #10151a;
    --surface:       #12161b;
    --surface-2:     #171d23;
    --surface-3:     #1e252c;
    --border:        rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.20);
    --ink:           #f1f5f2;
    --ink-2:         #a9b6b0;
    --ink-3:         #7d8c85;

    --brand:        #34c98c;
    --brand-strong: #5fcf9b;
    --brand-ink:    #5fcf9b;
    --brand-soft:   rgba(52, 201, 140, .13);

    --t1: #0f6b4a;
    --t2: #1a8a61;
    --t3: #2eae7c;
    --t4: #5fcf9b;
    --t5: #9ae7c0;

    --t1-text: #34c98c;
    --t2-text: #47ce95;
    --t3-text: #5fcf9b;
    --t4-text: #82dcb0;
    --t5-text: #9ae7c0;

    --sev-best: #9ae7c0;
    --sev-good: #2eae7c;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md: 0 12px 28px -12px rgba(0, 0, 0, .7);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
}

/* ---------------------------------------------------------------- base -- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 20px);
    -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--brand-ink); text-underline-offset: 3px; }

button { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 6px;
}

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

.skip-link {
    position: absolute;
    left: 12px; top: -60px;
    z-index: 100;
    background: var(--brand);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: top .2s;
}
.skip-link:focus { top: 12px; }

.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- top nav -- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: var(--maxw);
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    letter-spacing: -.02em;
    text-decoration: none;
    color: var(--ink);
    flex-shrink: 0;
    font-size: .98rem;
}

.brand-mark {
    width: 26px; height: 26px;
    flex-shrink: 0;
    color: var(--brand);
}

.brand span small {
    display: block;
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
    line-height: 1;
    margin-top: 1px;
}

.nav {
    display: flex;
    gap: 2px;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
    display: block;
    padding: 7px 11px;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--ink-2);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-3); color: var(--ink); }
.nav a[aria-current="true"] {
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-weight: 650;
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Segmented toggle, used for units. Distinct from .seg (stacked-bar segment). */
.segmented {
    display: inline-flex;
    flex-shrink: 0;
    background: var(--surface-3);
    border-radius: 999px;
    padding: 3px;
    position: relative;
}

.segmented button {
    position: relative;
    z-index: 1;
    border: 0;
    background: none;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--ink-3);
    transition: color .2s;
}
.segmented button[aria-pressed="true"], .segmented button[aria-checked="true"] { color: #fff; }
:root[data-theme="dark"] .segmented button[aria-pressed="true"],
:root[data-theme="dark"] .segmented button[aria-checked="true"] { color: #06120c; }
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .segmented button[aria-pressed="true"],
    :root:where(:not([data-theme="light"])) .segmented button[aria-checked="true"] { color: #06120c; }
}

.seg-thumb {
    position: absolute;
    top: 3px; left: 3px;
    height: calc(100% - 6px);
    background: var(--brand);
    border-radius: 999px;
    transition: transform .24s cubic-bezier(.4, 0, .2, 1), width .24s cubic-bezier(.4, 0, .2, 1);
    z-index: 0;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); border-color: var(--border-strong); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .icon-moon { display: none; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: block; }
:root[data-theme="dark"] .icon-btn .icon-sun  { display: none; }
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .icon-btn .icon-moon { display: block; }
    :root:where(:not([data-theme="light"])) .icon-btn .icon-sun  { display: none; }
}

/* ---------------------------------------------------------------- hero -- */

.hero {
    max-width: var(--maxw);
    margin: 24px auto 0;
    padding: 0 20px;
}

.hero-banner {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface-2);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.hero-banner img {
    width: 100%;
    height: auto;
    aspect-ratio: 1866 / 582;
    object-fit: cover;
    object-position: center;
}

.hero-copy {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 28px;
    align-items: end;
    margin: 26px 0 4px;
}

.hero-copy h1 {
    font-size: clamp(1.75rem, 1.1rem + 2.2vw, 2.6rem);
    line-height: 1.1;
    letter-spacing: -.035em;
    font-weight: 800;
}

.hero-copy p {
    color: var(--ink-2);
    margin-top: 12px;
    font-size: 1.02rem;
    max-width: 60ch;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: .76rem;
    font-weight: 600;
    color: var(--ink-2);
    box-shadow: var(--shadow-sm);
}
.badge::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--brand);
}

/* --------------------------------------------------------------- layout -- */

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px 40px;
}

.section {
    scroll-margin-top: calc(var(--nav-h) + 20px);
    padding-top: 54px;
}
.section:focus { outline: none; }

.section-head { margin-bottom: 18px; }

.eyebrow {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--brand-ink);
    margin-bottom: 6px;
}

.section-head h2 {
    font-size: clamp(1.3rem, 1.05rem + .8vw, 1.65rem);
    letter-spacing: -.025em;
    font-weight: 750;
    line-height: 1.2;
}

.lead {
    color: var(--ink-2);
    margin-top: 8px;
    max-width: 72ch;
    font-size: .95rem;
}

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- card -- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card h3 {
    font-size: .93rem;
    font-weight: 680;
    letter-spacing: -.01em;
    line-height: 1.3;
}

.card-sub {
    font-size: .78rem;
    color: var(--ink-3);
    margin-top: 3px;
    font-weight: 450;
}

.card-note {
    margin-top: auto;
    padding-top: 14px;
    font-size: .78rem;
    color: var(--ink-3);
    line-height: 1.5;
}
.card-note strong { color: var(--ink-2); font-weight: 600; }

/* --------------------------------------------------------------- tiles -- */

.tiles {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-sm);
}

.tile-value {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--brand-ink);
}

.tile-label {
    font-size: .82rem;
    font-weight: 600;
    margin-top: 9px;
    line-height: 1.3;
}

.tile-note {
    font-size: .74rem;
    color: var(--ink-3);
    margin-top: 3px;
}

/* ---------------------------------------------------------------- bars -- */

.bars { list-style: none; padding: 0; display: grid; gap: 13px; }

.bar-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 5px;
}

.bar-label { font-size: .83rem; color: var(--ink-2); }

.bar-value {
    font-size: .83rem;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.track {
    height: 8px;
    background: var(--surface-3);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.fill {
    position: absolute;
    inset-block: 0;
    left: var(--x, 0);
    width: var(--w);
    border-radius: 0 4px 4px 0;
    background: var(--t3);
    transform-origin: left;
    animation: grow .7s cubic-bezier(.22, 1, .36, 1) both;
}

.bars--range .fill { border-radius: 4px; }

@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.bar-note {
    font-size: .75rem;
    color: var(--ink-3);
    margin-top: 4px;
}

.fill.tier-1 { background: var(--t1); }
.fill.tier-2 { background: var(--t2); }
.fill.tier-3 { background: var(--t3); }
.fill.tier-4 { background: var(--t4); }
.fill.tier-5 { background: var(--t5); }

/* --------------------------------------------------------- stat lists -- */

.stat-list { display: grid; }

.stat-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.stat-line:last-child { border-bottom: 0; padding-bottom: 0; }
.stat-line:first-child { padding-top: 0; }

.stat-line dt { font-size: .83rem; color: var(--ink-2); }

.stat-line dd {
    font-size: .87rem;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.tone-good { color: var(--t2-text); }
.tone-warn { color: #a06a00; }
.tone-bad  { color: var(--sev-critical); }
:root[data-theme="dark"] .tone-warn { color: var(--sev-warning); }
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .tone-warn { color: var(--sev-warning); }
}

/* --------------------------------------------------------- stacked bar -- */

.legend {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 16px;
}

.legend li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .78rem;
    color: var(--ink-2);
}

.swatch {
    width: 11px; height: 11px;
    border-radius: 3px;
    flex-shrink: 0;
}

.sev-best  { background: var(--sev-best); }
.sev-good  { background: var(--sev-good); }
.sev-warn  { background: var(--sev-warn); }
.sev-bad   { background: var(--sev-bad); }

.stacks { display: grid; gap: 12px; }

.stack-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.stack-label {
    font-size: .8rem;
    color: var(--ink-2);
    font-weight: 550;
}

.stack {
    display: flex;
    height: 26px;
    border-radius: 5px;
    overflow: hidden;
    gap: 2px;                 /* the surface gap does the separating */
    background: var(--surface);
}

.stack .seg {
    width: var(--w);
    display: grid;
    place-items: center;
    min-width: 0;
    transition: filter .15s;
}
.stack .seg:first-child { border-radius: 5px 0 0 5px; }
.stack .seg:last-child  { border-radius: 0 5px 5px 0; }
.stack .seg:hover { filter: brightness(1.08); }

.seg-label {
    font-size: .7rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.stack .seg.sev-warn .seg-label { color: #3d2a00; }
.stack .seg.sev-best .seg-label { color: #fff; }
:root[data-theme="dark"] .stack .seg.sev-best .seg-label,
:root[data-theme="dark"] .stack .seg.sev-good .seg-label { color: #06120c; }
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .stack .seg.sev-best .seg-label,
    :root:where(:not([data-theme="light"])) .stack .seg.sev-good .seg-label { color: #06120c; }
}
/* A label that cannot fit is dropped rather than clipped. */
.stack .seg[style*="--w:1%"] .seg-label,
.stack .seg[style*="--w:2%"] .seg-label,
.stack .seg[style*="--w:3%"] .seg-label,
.stack .seg[style*="--w:4%"] .seg-label,
.stack .seg[style*="--w:5%"] .seg-label,
.stack .seg[style*="--w:6%"] .seg-label,
.stack .seg[style*="--w:7%"] .seg-label { display: none; }

/* -------------------------------------------------------------- tables -- */

.table-scroll {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
    scrollbar-width: thin;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    min-width: 520px;
}

.data-table th,
.data-table td {
    text-align: right;
    padding: 9px 10px;
    font-size: .84rem;
    white-space: nowrap;
}

.data-table thead th {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
    border-bottom: 1px solid var(--border-strong);
    padding-bottom: 10px;
    position: sticky;
    top: 0;
    background: var(--surface);
}

.data-table thead th:first-child,
.data-table tbody th { text-align: left; }

.data-table tbody th {
    font-weight: 550;
    color: var(--ink-2);
    position: sticky;
    left: 0;
    background: var(--surface);
    padding-left: 0;
}

.data-table tbody td {
    border-bottom: 1px solid var(--border);
    font-weight: 650;
    color: var(--ink);
}
.data-table tbody th { border-bottom: 1px solid var(--border); }
.data-table tbody tr:last-child td,
.data-table tbody tr:last-child th { border-bottom: 0; }

.data-table tbody tr:hover td,
.data-table tbody tr:hover th { background: var(--surface-2); }

.col-chip {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: 1px;
}
.col-chip.tier-1 { background: var(--t1); }
.col-chip.tier-2 { background: var(--t2); }
.col-chip.tier-3 { background: var(--t3); }
.col-chip.tier-4 { background: var(--t4); }
.col-chip.tier-5 { background: var(--t5); }

.group-row th {
    text-align: left !important;
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--brand-ink);
    background: var(--surface-2) !important;
    padding: 8px 10px 8px 0;
    position: static !important;
    border-bottom: 1px solid var(--border);
}

.tier-1-text { color: var(--t1-text); }
.tier-2-text { color: var(--t2-text); }
.tier-3-text { color: var(--t3-text); }
.tier-4-text { color: var(--t4-text); }
.tier-5-text { color: var(--t5-text); }

/* Heat wash: magnitude carried by a single-hue background, value always in ink */
.data-table--heat td.heat {
    position: relative;
    border-radius: 5px;
}
.data-table--heat td.heat::before {
    content: "";
    position: absolute;
    inset: 3px 2px;
    border-radius: 5px;
    background: var(--brand);
    opacity: calc(var(--t) * .22 + .03);
    z-index: 0;
}
.data-table--heat td.heat > * { position: relative; z-index: 1; }
.data-table--heat td.heat { z-index: 0; }

.unit {
    font-size: .72em;
    font-weight: 500;
    color: var(--ink-3);
    margin-left: 2px;
}

/* -------------------------------------------------------- line chart -- */

.chart {
    position: relative;
    width: 100%;
}

.chart svg { width: 100%; height: auto; overflow: visible; }

.grid-line { stroke: var(--border); stroke-width: 1; }
.axis-line { stroke: var(--border-strong); stroke-width: 1; }

.axis-text {
    fill: var(--ink-3);
    font-size: 10.5px;
    font-family: var(--font);
    font-variant-numeric: tabular-nums;
}

.series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-a { stroke: var(--series-a); }
.series-b { stroke: var(--series-b); }

.series-dot { r: 4.5; stroke: var(--surface); stroke-width: 2; }
.dot-a { fill: var(--series-a); }
.dot-b { fill: var(--series-b); }

.series-area { fill: var(--series-a); opacity: .1; }

:root {
    --series-a: #2a78d6;
    --series-b: #1baf7a;
}
:root[data-theme="dark"] { --series-a: #3987e5; --series-b: #199e70; }
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) { --series-a: #3987e5; --series-b: #199e70; }
}

.legend .swatch.key-a { background: var(--series-a); }
.legend .swatch.key-b { background: var(--series-b); }

.hit { fill: transparent; cursor: crosshair; }

.tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--ink);
    color: var(--bg);
    border-radius: 8px;
    padding: 8px 11px;
    font-size: .76rem;
    line-height: 1.45;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translate(-50%, -120%);
    transition: opacity .12s;
    z-index: 5;
}
.tooltip[data-show="true"] { opacity: 1; }
.tooltip b { font-variant-numeric: tabular-nums; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.tooltip .tt-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }

/* SVG elements do not pick up the HTML [hidden] UA rule — state it explicitly. */
.crosshair-layer[hidden] { display: none; }

/* --------------------------------------------------------------- pills -- */

.rarity { list-style: none; padding: 0; display: grid; gap: 2px; }

.rarity li {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.rarity li:last-child { border-bottom: 0; }

.rarity-icon {
    width: 38px; height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--surface-3);
    font-size: 1.15rem;
}

.rarity-name { display: block; font-size: .87rem; font-weight: 650; }
.rarity-detail { display: block; font-size: .77rem; color: var(--ink-3); margin-top: 1px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--ink-2);
    white-space: nowrap;
}
.pill::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--dot, var(--ink-3));
    flex-shrink: 0;
}
.pill-good     { --dot: var(--sev-good-c); }
.pill-warning  { --dot: var(--sev-warning); }
.pill-serious  { --dot: var(--sev-serious); }
.pill-critical { --dot: var(--sev-critical); }

/* ---------------------------------------------------------- calculator -- */

.tool {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.field label {
    display: block;
    font-size: .74rem;
    font-weight: 650;
    color: var(--ink-2);
    margin-bottom: 5px;
}

.field input[type="number"],
.field select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: .88rem;
    font-variant-numeric: tabular-nums;
}

.field input[type="range"] {
    width: 100%;
    accent-color: var(--brand);
    margin-top: 6px;
}

.field .field-val {
    font-size: .88rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--brand-ink);
}

.readout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.readout-item .readout-value {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.05;
    color: var(--brand-ink);
}
.readout-item .readout-label {
    font-size: .76rem;
    color: var(--ink-3);
    margin-top: 3px;
}

.verdict {
    margin-top: 16px;
    padding: 13px 15px;
    border-radius: 11px;
    background: var(--brand-soft);
    border-left: 3px solid var(--brand);
    font-size: .87rem;
    color: var(--ink);
    line-height: 1.5;
}
.verdict strong { font-weight: 700; }

/* ------------------------------------------------------------- chooser -- */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 999px;
    padding: 6px 13px;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: var(--surface-3); color: var(--ink); }
.chip[aria-pressed="true"] {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
:root[data-theme="dark"] .chip[aria-pressed="true"] { color: #06120c; }
@media (prefers-color-scheme: dark) {
    :root:where(:not([data-theme="light"])) .chip[aria-pressed="true"] { color: #06120c; }
}

/* ---------------------------------------------------------------- myth -- */

.myths { list-style: none; padding: 0; display: grid; gap: 12px; }

.myth {
    padding: 15px 17px;
    border-radius: 12px;
    background: var(--surface-2);
    border-left: 3px solid var(--sev-warning);
}

.myth-claim {
    font-size: .85rem;
    font-weight: 650;
    color: var(--ink-3);
    text-decoration: line-through;
    text-decoration-color: var(--sev-critical);
    text-decoration-thickness: 1.5px;
}

.myth-truth {
    font-size: .87rem;
    color: var(--ink);
    margin-top: 6px;
    line-height: 1.55;
}

/* -------------------------------------------------------------- footer -- */

.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    margin-top: 60px;
}

.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 34px 20px;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.footer h2 {
    font-size: .92rem;
    font-weight: 700;
    margin-bottom: 7px;
}

.footer p {
    font-size: .81rem;
    color: var(--ink-3);
    line-height: 1.6;
    max-width: 62ch;
}

.footer-meta {
    text-align: right;
    font-size: .8rem;
    color: var(--ink-3);
}
.footer-meta strong { color: var(--ink-2); font-weight: 650; }

.back-to-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--brand-ink);
    text-decoration: none;
}
.back-to-top:hover { text-decoration: underline; }

/* ---------------------------------------------------------- responsive -- */

@media (max-width: 1040px) {
    .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .g-2-1, .g-1-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Below the desktop breakpoint the nav wraps to its own scrollable row rather
   than disappearing — this page is long enough that jumping matters most here. */
@media (max-width: 860px) {
    :root { --nav-h: 102px; }

    .topbar { height: auto; }
    .topbar-inner {
        height: auto;
        flex-wrap: wrap;
        padding-top: 10px;
        gap: 10px 12px;
    }
    .nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        padding-bottom: 8px;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .nav a { padding: 6px 10px; font-size: .8rem; }

    .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-copy { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .hero-badges { justify-content: flex-start; }
}

@media (max-width: 640px) {
    body { font-size: 14.5px; }
    .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tiles .tile:last-child { grid-column: 1 / -1; }
    .section { padding-top: 42px; }
    .card { padding: 17px; }
    .footer-inner { grid-template-columns: minmax(0, 1fr); }
    .footer-meta { text-align: left; }
    .stack-row { grid-template-columns: 62px minmax(0, 1fr); }
    .hero { padding: 0 14px; }
    .wrap { padding: 0 14px 30px; }
    .topbar-inner { padding: 0 14px; gap: 12px; }
    .brand span small { display: none; }
}

/* ------------------------------------------------------------- print -- */

@media print {
    :root { --bg: #fff; --surface: #fff; --shadow-sm: none; --shadow-md: none; --shadow-lg: none; }
    .topbar, .skip-link, .back-to-top, .tool, .chips { display: none !important; }
    .card, .tile { border: 1px solid #ccc; break-inside: avoid; }
    .section { break-inside: avoid-page; padding-top: 24px; }
    .fill { animation: none; }
}
