:root {
    /* Leather & forest */
    --rf-brand-dark: #17352a;
    --rf-brand: #2f5d3f;
    --rf-brand-strong: #1f4230;
    --rf-accent: #2f5d3f;

    /* Gold foil / brass */
    --rf-gold: #b08a3c;
    --rf-gold-strong: #96712a;
    --rf-gold-soft: #d8bd7e;

    /* Parchment surfaces */
    --rf-page: #ece0c8;
    --rf-panel: #fbf5e7;
    --rf-panel-2: #f6eeda;
    --rf-panel-border: #e0d0ac;
    --rf-rule: #d9c7a0;
    --rf-panel-shadow: 0 14px 34px rgba(60, 46, 20, 0.14);
    --rf-radius: 0.85rem;
    --rf-radius-sm: 0.6rem;

    /* Ink text */
    --rf-text: #2c2517;
    --rf-text-muted: #6a5b3f;
    --rf-text-faint: #8a795a;

    /* Feedback */
    --rf-danger: #9c2a1e;
    --rf-warning: #a5761a;

    /* Typography */
    --rf-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
    --rf-sans: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

    /* Layout */
    --rf-bottom-nav-height: 3.55rem;
    /* First-paint fallback only: roundForgeTopbar measures the real bar and overwrites this on
       the root element as soon as the layout renders. */
    --rf-topbar-height: 3.4rem;
}

@media (max-width: 1399.98px) {
    :root {
        --rf-topbar-height: 3rem;
    }
}

html, body {
    font-family: var(--rf-sans);
    /* Subtle parchment grain built from layered warm gradients (no external assets). */
    background-color: var(--rf-page);
    background-image:
        radial-gradient(circle at 18% 12%, rgba(255, 251, 238, 0.55), transparent 42%),
        radial-gradient(circle at 84% 82%, rgba(146, 116, 58, 0.10), transparent 46%),
        linear-gradient(180deg, #efe4cd 0%, #e7d9bc 100%);
    color: var(--rf-text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-height: 100vh;
}

h1, h2, h3, .brand, .hero h1 {
    font-family: var(--rf-serif);
    letter-spacing: 0.01em;
}

a, .btn-link {
    color: var(--rf-brand);
    text-decoration: none;
}

a:hover, .btn-link:hover {
    color: var(--rf-brand-strong);
}

h1:focus {
    outline: none;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

ul {
    padding-left: 1.25rem;
    margin-bottom: 0;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #ffe7c2;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #d4d9e2;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #0b6b55;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 700;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

.btn-primary {
    color: #fff;
    background-color: var(--rf-brand);
    border-color: var(--rf-brand);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--rf-brand-strong);
    border-color: var(--rf-brand-strong);
}

.btn-outline-primary {
    color: var(--rf-brand);
    border-color: var(--rf-brand);
}

.btn-outline-primary:hover {
    background-color: var(--rf-brand);
    border-color: var(--rf-brand);
    color: #fff;
}

.btn {
    font-weight: 600;
    border-radius: 0.6rem;
}

.btn-outline-light {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.55);
}

.btn:focus, .btn:active:focus, .btn-link:focus, .form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 0.18rem rgba(11, 107, 85, 0.2);
}

.form-control, .form-select {
    border-radius: 0.6rem;
    border-color: #cdd9d1;
}

.app-shell {
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #0b3b2e, #0b6b55);
    color: #fff;
    flex-wrap: wrap;
}

.brand-block {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 800;
}

.brand-tag {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.topbar-nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.topbar-nav a {
    color: rgba(233, 219, 185, 0.9);
    font-weight: 600;
}

.topbar-nav a:hover {
    color: #f7edd2;
}

.topbar-nav a.active {
    color: #f7edd2;
    text-decoration: underline;
    text-decoration-color: var(--rf-gold);
    text-underline-offset: 0.3rem;
    text-decoration-thickness: 2px;
}

.topbar-user {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.app-main {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 1rem;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel {
    position: relative;
    background: var(--rf-panel);
    background-image: linear-gradient(180deg, #fdf8ec 0%, #f7efdb 100%);
    border: 1px solid var(--rf-panel-border);
    border-radius: var(--rf-radius);
    padding: 1.25rem;
    box-shadow: var(--rf-panel-shadow);
}

/* A fine inner keyline gives each page the feel of a ruled journal leaf. */
.panel::before {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(176, 138, 60, 0.22);
    border-radius: calc(var(--rf-radius) - 4px);
    pointer-events: none;
}

.panel > * {
    position: relative;
}

.danger-zone {
    border: 1px solid rgba(176, 0, 32, 0.35);
    border-left: 4px solid #b00020;
}

.danger-zone h2 {
    color: #b00020;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.pager-status {
    font-size: 0.9rem;
    color: #4a5568;
}

.reference-hcp-field {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.reference-hcp-field > .checkbox {
    flex: 0 0 auto;
    white-space: nowrap;
}

.reference-hcp-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 20rem;
}

.reference-hcp-control input[type="range"] {
    flex: 1 1 auto;
    min-width: 12rem;
}

.reference-hcp-control strong {
    flex: 0 0 auto;
    min-width: 4.5rem;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.hero {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero.panel {
    background:
        radial-gradient(circle at 20% 0%, rgba(216, 189, 126, 0.18), transparent 55%),
        linear-gradient(135deg, var(--rf-brand-dark), var(--rf-brand));
    border: 1px solid #12291f;
    color: #f6efdd;
    box-shadow: 0 16px 38px rgba(18, 41, 31, 0.32);
}

/* Gold embossed keyline frame, like a tooled leather cover. */
.hero.panel::before {
    inset: 7px;
    border: 1px solid rgba(216, 189, 126, 0.55);
    border-radius: calc(var(--rf-radius) - 5px);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.hero.panel h1 {
    color: #fdf6e4;
    margin-bottom: 0.25rem;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.hero.panel p {
    color: rgba(246, 239, 221, 0.82);
    margin: 0;
    font-family: var(--rf-serif);
    font-style: italic;
}

.hero.panel a {
    color: var(--rf-gold-soft);
    text-decoration: underline;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
}

.hero.panel .hero-stat span {
    color: var(--rf-gold-soft);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
}

.hero-stat strong {
    font-family: var(--rf-serif);
    font-size: 2.4rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: #fdf6e4;
}

.page-header, .section-header, .hole-header, .shot-card-header, .history-card-header, .round-card-footer {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.section-header h2, .page-header h1, .hole-header h2, .auth-card h1 {
    margin-bottom: 0.2rem;
}

/* Section headings carry a fine gold rule below, echoing a ruled ledger. */
.section-header {
    padding-bottom: 0.6rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--rf-rule);
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--rf-brand-dark);
}

.section-header p, .page-header p {
    color: var(--rf-text-muted);
    font-family: var(--rf-serif);
    font-style: italic;
}

.page-header h1, .hole-header h2 {
    color: var(--rf-brand-dark);
}

.shot-entry-header {
    align-items: center;
}

.shot-entry-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-grid, .field-grid, .history-grid, .hole-metrics {
    display: grid;
    gap: 0.75rem;
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.summary-card, .history-card, .round-card, .shot-card {
    border: 1px solid #e3e8f0;
    border-radius: 0.9rem;
    padding: 0.9rem;
    background: #fff;
}

.summary-card {
    border-color: var(--rf-panel-border);
    background: linear-gradient(180deg, #fdf8ec, #f5ecd6);
    border-top: 2px solid var(--rf-gold-soft);
}

.summary-card strong {
    display: block;
    font-family: var(--rf-serif);
    font-size: 1.85rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin: 0.15rem 0;
    color: var(--rf-brand-dark);
}

.summary-card small {
    color: var(--rf-text-faint);
    font-size: 0.78rem;
    font-style: italic;
}

.summary-label {
    color: var(--rf-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.field-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-hole-grid,
.admin-yardage-grid,
.tee-rating-grid {
    display: grid;
    gap: 0.75rem;
}

.admin-hole-grid,
.admin-yardage-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.tee-rating-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.tee-rating-header {
    align-items: center;
}

.tee-rating-card {
    display: grid;
    gap: 0.65rem;
    padding: 0.9rem;
    border: 1px solid #dbe4ea;
    border-radius: 0.75rem;
    background: #fff;
}

.admin-hole-card {
    display: grid;
    gap: 0.4rem;
    padding: 0.75rem;
    border: 1px solid #d9e2ec;
    border-radius: 0.75rem;
    background: #f8fafc;
}

.admin-yardage-grid label {
    display: grid;
    gap: 0.25rem;
}

.hole-metrics {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.hole-metrics div {
    padding: 0.8rem;
    border-radius: 0.6rem;
    background: linear-gradient(180deg, #fdf8ec, #f5ecd6);
    border: 1px solid var(--rf-panel-border);
    display: flex;
    flex-direction: column;
}

.hole-metrics div > strong {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--rf-text-muted);
}

.hole-metrics div > span {
    font-family: var(--rf-serif);
    font-size: 1.4rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--rf-brand-dark);
    margin-top: 0.1rem;
}

.inline-form-body, .form-actions, .badge-row, .mini-stats, .flag-row, .history-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.inline-form label {
    margin: 0;
    white-space: nowrap;
    font-weight: 500;
}

.inline-form .inline-form-body {
    flex: 1 1 auto;
    flex-wrap: nowrap;
}

.inline-form .inline-form-body input {
    flex: 1 1 auto;
    min-width: 0;
}

.expected-score {
    color: #9aa4b2;
    font-weight: 500;
}

.toggle-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.toggle-grid label {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
    font-weight: 500;
}

.outcome-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.outcome-fieldset > legend {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #52675e;
    margin-bottom: 0.5rem;
}

.outcome-buttons {
    display: grid;
    gap: 0.35rem;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.outcome-button {
    padding: 0.35rem 0.5rem;
    border: 1px solid #cdddd3;
    border-radius: 0.55rem;
    background: #fff;
    color: #29483b;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.outcome-button:hover {
    border-color: #9cbcac;
}

.outcome-button.active {
    background: #0b6b55;
    border-color: #0b6b55;
    color: #fff;
    box-shadow: 0 2px 8px rgba(11, 107, 85, 0.25);
}

.outcome-button.outcome-success.active {
    background: #1c8a4e;
    border-color: #1c8a4e;
}

.outcome-button.outcome-warning.active {
    background: #b9791b;
    border-color: #b9791b;
}

.readout-cards {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.readout-card {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.55rem;
    background: linear-gradient(180deg, #fdf8ec, #f5ecd6);
}

.readout-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--rf-text-muted);
}

.readout-value {
    font-family: var(--rf-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--rf-brand-dark);
    font-variant-numeric: tabular-nums;
}

.shot-entry-form {
    gap: 0.85rem;
}

.shot-entry-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    align-items: start;
}

.shot-entry-graphic,
.shot-entry-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

@media (min-width: 900px) {
    .shot-entry-grid {
        grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
        gap: 1.5rem;
    }

    /* Pin the shot canvas so it stays in view while the outcome controls scroll beside it.
       Offset clears the sticky topbar; the round's core USP is reading the plotted shot
       and live strokes gained while entering the rest of the detail. */
    .shot-entry-graphic {
        position: sticky;
        top: 4.5rem;
        align-self: start;
    }
}

.readout-cards.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
}

.readout-cards.compact .readout-card {
    padding: 0.4rem 0.5rem;
    border-radius: 0.55rem;
}

.readout-cards.compact .readout-label {
    font-size: 0.62rem;
    letter-spacing: 0.02em;
}

.readout-cards.compact .readout-value {
    font-size: 1.05rem;
}

.graphic-stage {
    position: relative;
}

.graphic-readout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem 0.9rem;
    margin-top: 0.4rem;
    padding: 0 0.25rem;
}

.graphic-readout-item {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.graphic-readout-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #52675e;
}

.graphic-readout-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0b6b55;
}

.shot-preview-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.9rem;
}

.shot-preview-info .preview-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.shot-preview-info .preview-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #52675e;
}

.shot-preview-info .preview-value {
    font-size: 1rem;
    font-weight: 700;
    color: #0b6b55;
}

.shot-preview-info .preview-lie {
    font-size: 0.85rem;
    color: #52675e;
}

/* Scrolled into view after finishing a hole or changing hole; leave room for the fixed top bar. */
#shotEntrySection {
    scroll-margin-top: calc(var(--rf-topbar-height, 3.4rem) + 0.6rem);
}

/* Consolidated shot header: "Hole X · Shot Y" with the From / Exp / SG summary on the same line. */
.shot-entry-heading {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.7rem;
    row-gap: 0.1rem;
    min-width: 0;
    flex: 1 1 auto;
}

.shot-entry-heading h2 {
    margin: 0;
    white-space: nowrap;
}

.from-distance-edit {
    margin: 0;
    padding: 0 0 1px;
    border: 0;
    border-bottom: 1px dashed rgba(176, 138, 60, 0.75);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.from-distance-input {
    width: 4.75rem;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.4rem;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.from-distance-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    padding: 0;
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.4rem;
    background: #fff;
    line-height: 1;
    cursor: pointer;
}

.from-distance-btn.save {
    color: #0f6c41;
}

.from-distance-btn.cancel {
    color: #9c2a1e;
}

.shot-entry-heading .preview-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
}

.shot-entry-heading .preview-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rf-text-muted);
}

.shot-entry-heading .preview-value {
    font-weight: 700;
    color: var(--rf-brand-dark);
    font-variant-numeric: tabular-nums;
}

.shot-entry-heading .preview-lie {
    color: var(--rf-text-muted);
    font-style: italic;
}

/* Expected score and strokes gained are server-computed, so out of coverage the readout is showing the
   last numbers the server sent. Dimming them alone would be a colour-only signal, so the note below spells
   it out and the dotted underline gives a second, non-colour cue. */
.shot-entry-heading .preview-item-stale .preview-value,
.shot-entry-heading .preview-item-stale .sg-badge {
    opacity: 0.6;
    text-decoration: underline dotted;
    text-underline-offset: 0.2rem;
}

.shot-entry-heading .preview-offline-note {
    flex-basis: 100%;
    font-size: 0.72rem;
    font-style: italic;
    line-height: 1.25;
    color: var(--rf-text-muted);
}

/* Phone-first density: keep the canvas, readout, ending lie and action buttons on one screen. */
@media (max-width: 767.98px) {
    .shot-entry-form {
        gap: 0.55rem;
    }

    .shot-entry-grid {
        gap: 0.6rem;
    }

    .shot-entry-controls {
        gap: 0.5rem;
    }

    .graphic-readout {
        gap: 0.1rem 0.6rem;
        margin-top: 0.3rem;
    }

    /* Record Shot header + Previous / Finish / Next on a tight row so they stay in view. */
    .shot-entry-header {
        gap: 0.4rem 0.6rem;
        padding-bottom: 0.5rem;
        margin-bottom: 0.6rem;
    }

    .shot-entry-header h2 {
        font-size: 1.05rem;
    }

    .shot-entry-header-actions {
        gap: 0.3rem;
    }

    .shot-entry-header-actions .btn {
        padding: 0.35rem 0.55rem;
        font-size: 0.82rem;
    }

    .radio-fieldset > legend,
    .distance-fieldset > legend,
    .outcome-fieldset > legend {
        margin-bottom: 0.3rem;
    }
}

.distance-row {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.distance-row label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.shot-result-fieldset.compact .direction-diamond {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: min(100%, 20rem);
    min-height: 0;
    margin: 0;
}

.shot-result-fieldset.compact .direction-group {
    grid-area: auto;
    display: grid;
    grid-template: none;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.shot-result-fieldset.compact .direction-group .direction-toggle {
    grid-area: auto;
    justify-self: stretch;
    align-self: stretch;
    gap: 0.3rem;
    min-width: 0;
    min-height: 2.1rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
}

.direction-arrow {
    font-size: 1.05em;
    line-height: 1;
    opacity: 0.85;
}

.shape-option-grid,
.shape-option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.shape-option-row {
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
}

.distance-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.distance-fieldset > legend {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #52675e;
    margin-bottom: 0.5rem;
}

.shape-details {
    border: 1px solid #dbe6df;
    border-radius: 0.6rem;
    padding: 0.5rem 0.65rem;
    background: #fbfdfc;
}

.shape-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    list-style: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #52675e;
}

.shape-details > summary::-webkit-details-marker {
    display: none;
}

.shape-details > summary::after {
    content: "▾";
    margin-left: auto;
    font-size: 0.8rem;
    color: #52675e;
    transition: transform 0.15s;
}

.shape-details:not([open]) > summary::after {
    transform: rotate(-90deg);
}

.shape-summary-value {
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    color: #0b6b55;
}

.shape-details > .shape-option-row {
    margin-top: 0.55rem;
}

.shape-option-row .shape-option {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    padding: 0.35rem 0.15rem;
    gap: 0.05rem;
}

.shape-option-row .shape-icon {
    width: 1.3rem;
    height: 1.65rem;
}

.shape-option-row .shape-name {
    font-size: 0.6rem;
}

.shape-option {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    width: 4.1rem;
    padding: 0.4rem 0.3rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.7rem;
    background: #fff;
    color: #29483b;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.shape-option:hover {
    border-color: #0b6b55;
    background: #f1f9f6;
}

.shape-option:focus-visible {
    outline: none;
    border-color: #0b6b55;
    box-shadow: 0 0 0 0.18rem rgba(11, 107, 85, 0.2);
}

.shape-option.active {
    border-color: #0b6b55;
    background: #e7f4ee;
    box-shadow: inset 0 0 0 1px #0b6b55;
}

.shape-icon {
    width: 1.6rem;
    height: 2rem;
    fill: none;
    stroke: #29483b;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.shape-option.active .shape-icon {
    stroke: #0b6b55;
}

.shape-name {
    font-size: 0.68rem;
    font-weight: 600;
    color: #29483b;
    text-align: center;
}

.radio-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.radio-fieldset > legend {
    float: none;
    width: auto;
    margin-bottom: 0.4rem;
    font-size: 1rem;
    font-weight: 600;
}

.radio-option-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.drop-lie-fieldset {
    padding: 0.6rem 0.7rem 0.5rem;
    border: 1px dashed #f0b37e;
    border-radius: 0.7rem;
    background: #fff8f1;
}

.drop-lie-fieldset > legend {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.drop-lie-legend-text {
    font-weight: 600;
}

.drop-penalty-note {
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: #e8632a;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.drop-lie-segment {
    display: flex;
    gap: 0.25rem;
    padding: 0.2rem;
    border: 1px solid #e6d5c2;
    border-radius: 0.7rem;
    background: #fdece0;
}

.drop-lie-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex: 1 1 0;
    min-width: 0;
    min-height: 2.5rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.55rem;
    background: transparent;
    color: #6b4a2f;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.drop-lie-option:hover {
    background: #fff;
    border-color: #eabf95;
}

.drop-lie-option:focus-visible {
    outline: none;
    border-color: #e8632a;
    box-shadow: 0 0 0 0.18rem rgba(232, 99, 42, 0.22);
}

.drop-lie-option.active {
    background: #fff;
    border-color: #e8632a;
    color: #7a3d18;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(200, 90, 40, 0.2);
}

.drop-lie-swatch {
    flex: 0 0 auto;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    border: 1px solid rgba(35, 60, 30, 0.35);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.drop-lie-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drop-lie-hint {
    margin: 0.4rem 0 0;
    color: #9a6b47;
    font-size: 0.78rem;
}

@media (max-width: 30rem) {
    .drop-lie-segment {
        flex-wrap: wrap;
    }

    .drop-lie-option {
        flex: 1 1 40%;
    }
}

.radio-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.7rem;
    background: #fff;
    font-weight: 500;
    cursor: pointer;
}

.radio-option:hover {
    border-color: #0b6b55;
    background: #f1f9f6;
}

.radio-option:focus-within {
    border-color: #0b6b55;
    box-shadow: 0 0 0 0.18rem rgba(11, 107, 85, 0.2);
}

.radio-option input {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: #0b6b55;
}

.lie-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.7rem;
    background: #fff;
    color: #29483b;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.lie-toggle:hover {
    border-color: #0b6b55;
    background: #f1f9f6;
}

.lie-toggle:focus-visible {
    outline: none;
    border-color: #0b6b55;
    box-shadow: 0 0 0 0.18rem rgba(11, 107, 85, 0.2);
}

.lie-toggle.active {
    background: #0b6b55;
    border-color: #0b6b55;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(11, 107, 85, 0.25);
}

.shot-result-fieldset > .helper-text {
    margin-bottom: 0.75rem;
}

.direction-diamond {
    display: grid;
    width: min(100%, 28rem);
    min-height: 15rem;
    margin: 0 auto;
}

.direction-group {
    grid-area: 1 / 1;
    display: grid;
    grid-template: repeat(3, minmax(4.5rem, 1fr)) / repeat(3, minmax(5.5rem, 1fr));
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    pointer-events: none;
}

.direction-group .radio-option,
.direction-group .direction-toggle {
    align-self: center;
    justify-self: center;
    min-width: 5.5rem;
    pointer-events: auto;
}

.direction-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.7rem;
    background: #fff;
    color: #29483b;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}

.direction-toggle:hover {
    border-color: #0b6b55;
    background: #f1f9f6;
}

.direction-toggle:focus-visible {
    outline: none;
    border-color: #0b6b55;
    box-shadow: 0 0 0 0.18rem rgba(11, 107, 85, 0.2);
}

.direction-toggle.active {
    background: #0b6b55;
    border-color: #0b6b55;
    color: #fff;
    box-shadow: 0 2px 8px rgba(11, 107, 85, 0.25);
}

.direction-left {
    grid-area: 2 / 1;
}

.direction-right {
    grid-area: 2 / 3;
}

.direction-long {
    grid-area: 1 / 2;
}

.direction-short {
    grid-area: 3 / 2;
}

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: #607085;
}

.empty-state.compact {
    padding: 1rem 0.5rem;
}

.status-chip, .flag-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: #efe4ca;
    color: #6a5b3f;
    border: 1px solid rgba(176, 138, 60, 0.3);
}

.status-chip.done, .flag-chip.success {
    background: #e6f6ee;
    color: #0f6c41;
}

.status-chip.warning, .flag-chip.warning {
    background: #fff4dd;
    color: #916400;
}

.status-chip.danger, .flag-chip.danger {
    background: #fbe4e4;
    color: #a11212;
}

.hole-overview-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rf-rule);
}

/* Shot history: map and the list of shots sit side by side on wider viewports,
   with the map pinned and the list scrolling independently when it grows long. */
.shot-history-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

.shot-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* A shot saved on this device but not yet acknowledged by the server. Gold rather than red: recording
   shots out of coverage is what the app is for, and the shot is not at risk. The word "Pending sync"
   carries the meaning, so nothing here depends on the colour being seen. */
.shot-pending-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.2rem;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--rf-gold-soft);
    border-radius: 999px;
    background: #f7efdb;
    color: var(--rf-gold-strong);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.shot-pending-dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: currentColor;
}

@media (min-width: 820px) {
    .shot-history-layout {
        grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
        align-items: start;
    }

    .shot-history-layout .hole-overview-wrap {
        position: sticky;
        top: 4.75rem;
        margin: 0;
        padding: 0;
        border-bottom: 0;
    }

    .shot-history-layout .shot-list {
        max-height: 34rem;
        overflow-y: auto;
        padding-right: 0.4rem;
        scrollbar-width: thin;
        scrollbar-color: var(--rf-gold-soft) transparent;
    }

    .shot-history-layout .shot-list::-webkit-scrollbar {
        width: 0.55rem;
    }

    .shot-history-layout .shot-list::-webkit-scrollbar-thumb {
        background: var(--rf-gold-soft);
        border-radius: 999px;
    }
}

.hole-nav-layout {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
}

.hole-nav-groups {
    display: grid;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}

.hole-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 0.45rem;
}

.hole-nav-total {
    border: 1px solid #cdd7e4;
    border-radius: 0.8rem;
    background: #f4f7fb;
    padding: 0.55rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}

.hole-nav-total-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.hole-nav-total-gross {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    color: #1f2937;
}

.hole-nav-total-relative {
    font-size: 0.9rem;
    font-weight: 800;
}

.hole-nav-total-relative.relative-under {
    color: #d21f3c;
}

.hole-nav-total-relative.relative-over {
    color: #1d4ed8;
}

.hole-nav-total-relative.relative-even {
    color: #1f2937;
}

.hole-nav-total-relative.relative-pending {
    color: #94a3b8;
}

.hole-nav-grand-total {
    flex: 0 0 auto;
    align-self: stretch;
    min-width: 110px;
    background: #eef2f8;
    padding: 0.55rem 0.9rem;
}

.hole-nav-grand-total .hole-nav-total-gross {
    font-size: 1.5rem;
}

@media (max-width: 640px) {
    .hole-nav-layout {
        flex-direction: column;
    }

    .hole-nav-grand-total {
        flex-direction: row;
        align-items: baseline;
        justify-content: center;
        gap: 0.75rem;
    }
}

.hole-pill {
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.6rem;
    background: linear-gradient(180deg, #fdf8ec, #f6eed9);
    padding: 0.65rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.05s;
}

.hole-pill:hover {
    border-color: var(--rf-gold);
}

.hole-pill:active {
    transform: translateY(1px);
}

.hole-pill.active {
    border-color: var(--rf-gold);
    background: #f2e6c6;
    box-shadow: 0 0 0 1px var(--rf-gold);
}

.hole-pill.done {
    color: #0f6c41;
}

.round-card-footer, .history-grid {
    font-size: 0.92rem;
    color: #516173;
}

.quick-resume-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.auth-shell {
    display: flex;
    justify-content: center;
    padding: 1.25rem 0;
}

.auth-card {
    width: min(460px, 100%);
}

.helper-text {
    margin: 0;
    color: #607085;
}

.back-link {
    font-weight: 700;
}

.info-banner {
    border-left: 4px solid var(--rf-gold);
    background: #f7edd2;
    padding: 0.85rem 1rem;
    border-radius: 0.55rem;
}

.info-banner.warning {
    border-left-color: var(--rf-warning);
    background: #fbeecb;
}

.compact-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

@media (max-width: 640px) {
    .app-main {
        padding: 0.75rem;
    }

    .panel {
        padding: 0.85rem;
    }

    .compact-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .direction-diamond {
        min-height: 13.5rem;
    }

    .direction-group {
        grid-template: repeat(3, minmax(4rem, 1fr)) / repeat(3, minmax(4.5rem, 1fr));
    }

    .direction-group .radio-option,
    .direction-group .direction-toggle {
        min-width: 0;
        padding-inline: 0.5rem;
    }
}

/* Strokes gained */
.sg-positive {
    color: #1a7a45;
}

.sg-negative {
    color: #7a1030;
}

.sg-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.sg-badge.sg-positive {
    background: #e6f6ee;
    color: #1a7a45;
}

.sg-badge.sg-negative {
    background: #f7e4ea;
    color: #7a1030;
}

.sg-total {
    font-weight: 700;
}

.sg-note {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: #5a6473;
}

.sg-subheading {
    margin: 1.25rem 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #2f5a34;
}

.sg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.sg-table th,
.sg-table td {
    padding: 0.4rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #e4e9f1;
}

.sg-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #5a6473;
}

.sg-table .numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sg-table tbody th {
    font-weight: 600;
}

.sg-table .sg-empty-row {
    color: #9aa4b2;
}

.sg-table .sg-empty-row th {
    font-weight: 500;
}

/* Hole-by-hole scorecard: one grid per nine, aggregate in the last column. */
.scorecard {
    display: grid;
    gap: 0.75rem;
}

/* Ten columns will not fit every phone. The card scrolls sideways inside its own box rather than
   shrinking to unreadable, and the row labels stay pinned so a scrolled card still says what it is. */
.scorecard-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 0.55rem;
    border: 1px solid #e3e8f0;
    border-radius: 0.9rem;
    background: #fff;
}

.scorecard-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.scorecard-table th,
.scorecard-table td {
    padding: 0.3rem 0.15rem;
    min-width: 2.15rem;
    border-bottom: 1px solid #e4e9f1;
    font-weight: 600;
}

.scorecard-table tbody tr:last-child th,
.scorecard-table tbody tr:last-child td {
    border-bottom: none;
}

.scorecard-table thead th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5a6473;
    border-bottom: 2px solid var(--rf-gold-soft);
}

.scorecard-row-label {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 3.1rem;
    padding-right: 0.4rem;
    background: #fff;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5a6473;
}

.scorecard-par-row td,
.scorecard-putts-row td {
    color: var(--rf-text-muted);
}

.scorecard-score-row td {
    padding: 0.2rem 0.1rem;
}

/* The whole cell is the tap target for reviewing the hole, not just the digit inside it. */
.scorecard-hole-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.2rem;
    border-radius: 0.4rem;
    text-decoration: none;
}

.scorecard-hole-link:hover,
.scorecard-hole-link:focus-visible {
    background: #f2ece0;
}

/* Out / In column: separated from the holes by a rule, the way a printed card does it. */
.scorecard-agg {
    border-left: 2px solid var(--rf-gold-soft);
    min-width: 3.2rem;
    padding-left: 0.4rem;
    color: var(--rf-brand);
}

.scorecard-agg-value {
    font-size: 1.05rem;
    font-weight: 700;
}

.scorecard-agg-partial {
    color: var(--rf-text-muted);
}

.scorecard-agg-topar {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--rf-text-muted);
}

.scorecard-total {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #e3e8f0;
    border-top: 2px solid var(--rf-gold-soft);
    border-radius: 0.9rem;
    background: #fff;
}

.scorecard-total-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #5a6473;
}

.scorecard-total-item {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.scorecard-total-item > span:first-child {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rf-text-muted);
}

.scorecard-total-item strong {
    font-size: 1.15rem;
    color: var(--rf-brand);
}

/* Badges shrink to scorecard scale so nine holes plus the aggregate fit across a phone. */
.scorecard-table .score-badge {
    min-width: 1.85rem;
    height: 1.85rem;
    padding: 0 0.2rem;
    font-size: 0.92rem;
}

.scorecard-table .score-badge.score-ace,
.scorecard-table .score-badge.score-albatross {
    min-width: 2rem;
    height: 2rem;
    padding: 0.5rem 0 0;
}

/* The double ring marking an eagle or a double bogey needs 4px of clear space on every side, which
   a nine-across grid does not have. Inside the card a heavier border draws the same distinction. */
.scorecard-table .score-badge.score-eagle,
.scorecard-table .score-badge.score-double,
.scorecard-table .score-badge.score-triple {
    box-shadow: none;
    border-width: 3px;
}

/* Phone: squeeze the ten columns onto the screen so the nine reads without sideways scrolling.
   Narrower than this and .scorecard-scroll takes over. */
@media (max-width: 640px) {
    .scorecard-scroll {
        padding: 0.35rem;
    }

    .scorecard-table th,
    .scorecard-table td {
        min-width: 1.7rem;
        padding: 0.25rem 0.05rem;
    }

    .scorecard-row-label {
        min-width: 2.3rem;
        padding-right: 0.2rem;
        font-size: 0.62rem;
        letter-spacing: 0;
    }

    .scorecard-agg {
        min-width: 2.8rem;
        padding-left: 0.25rem;
    }

    .scorecard-table .score-badge {
        min-width: 1.55rem;
        height: 1.55rem;
        font-size: 0.85rem;
    }

    .scorecard-hole-link {
        min-height: 1.75rem;
    }
}

/* Score to par (scorecard convention: circles under par, squares over par) */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    border: 2px solid transparent;
    background: #fff;
}

/* Under par: red family, circular */
.score-badge.score-birdie,
.score-badge.score-eagle {
    border-radius: 999px;
}

.score-badge.score-birdie {
    color: #e5352b;
    border-color: #e5352b;
}

.score-badge.score-eagle {
    color: #a86f00;
    border-color: #e0a400;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #e0a400;
}

/* Ace / albatross: green triangle */
.score-badge.score-albatross,
.score-badge.score-ace {
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0.55rem 0 0;
    color: #fff;
    background: #1a7a45;
    border-color: transparent;
    clip-path: polygon(50% 6%, 6% 94%, 94% 94%);
}

/* Par: neutral, no shape */
.score-badge.score-par {
    color: #5a6473;
    border-color: transparent;
}

/* Over par: blue family, square */
.score-badge.score-bogey,
.score-badge.score-double,
.score-badge.score-triple {
    border-radius: 0.25rem;
}

.score-badge.score-bogey {
    color: #2f6fb0;
    border-color: #2f6fb0;
}

.score-badge.score-double {
    color: #1a3a63;
    border-color: #1a3a63;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a3a63;
}

/* Triple bogey or worse: solid fill so it reads clearly worse than a double. */
.score-badge.score-triple {
    color: #fff;
    background: #1a3a63;
    border-color: #1a3a63;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a3a63;
}

.score-badge.score-pickup,
.score-badge.score-pending {
    color: #6b7686;
    border-color: #d7dfeb;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* Insights / analytics */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.filter-toggle {
    margin-top: 0.75rem;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    color: #36517a;
}

.checkbox input {
    width: 1.1rem;
    height: 1.1rem;
}

.round-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.round-card-main {
    min-width: 0;
}

.round-card-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.round-card-heading h3 {
    margin: 0;
}

.round-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 3.6rem;
    padding: 0.35rem 0.65rem;
    border-radius: 0.75rem;
    background: #eef3fb;
    text-align: center;
    line-height: 1;
}

.round-score-value {
    font-size: 2rem;
    font-weight: 800;
    color: #24303f;
}

.round-score-topar {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #516173;
}

/* Round total to-par colours follow the scorecard convention used by the per-hole badges:
   red under par, blue over par, and green at even par. */
.round-score.under {
    background: #fdecec;
}

.round-score.under .round-score-topar {
    color: #c0261e;
}

.round-score.over {
    background: #eaf1fb;
}

.round-score.over .round-score-topar {
    color: #1a3a63;
}

.round-score.level {
    background: #e6f6ee;
}

.round-score.level .round-score-topar {
    color: #0f6c41;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.chart-card {
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.6rem;
    padding: 0.75rem 0.9rem 0.9rem;
    background: linear-gradient(180deg, #fdf8ec, #f6eed9);
}

.chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.chart-head h3 {
    margin: 0;
    font-size: 0.95rem;
}

.chart-subtitle {
    font-size: 0.75rem;
    color: #7a8494;
}

.chart-plot {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}

.chart-yaxis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    /* Align the labels with the plotted min/max, matching the SVG's inner top/bottom padding
       (PadTop 14 and PadBottom 20 of the 180-unit viewBox scaled to the 150px render height). */
    padding: 12px 0 17px;
    font-size: 0.72rem;
    color: #7a8494;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    line-height: 1;
}

.chart-yaxis span:last-child {
    /* Pin the min label flush to the plot floor so it lines up with the lowest point. */
    margin-bottom: -0.36rem;
}

.chart-svg {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: 150px;
    display: block;
}

.chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-dot {
    stroke: #fff;
    stroke-width: 1;
}

.chart-zero {
    stroke: #c7d0dd;
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

.chart-empty {
    padding: 1rem;
    text-align: center;
    color: #9aa4b2;
    font-size: 0.85rem;
}

.sg-bars {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sg-bar-row {
    display: grid;
    grid-template-columns: 120px 1fr 64px;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.sg-bar-label {
    color: #48515f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sg-bar-track {
    position: relative;
    height: 16px;
    background: #f3f6fa;
    border-radius: 4px;
}

.sg-bar-center {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #c7d0dd;
}

.sg-bar-fill {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    min-width: 2px;
}

.sg-bar-positive {
    background: #1a7a45;
}

.sg-bar-negative {
    background: #7a1030;
}

.sg-bar-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.insight-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.insight-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.insight-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.insight-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.insight-strong {
    background: #1a7a45;
}

.insight-weak {
    background: #7a1030;
}

.insight-label {
    color: #48515f;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.metric-tile {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem;
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.5rem;
    background: linear-gradient(180deg, #fdf8ec, #f5ecd6);
}

.metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--rf-text-muted);
}

.metric-value {
    font-family: var(--rf-serif);
    font-size: 1.4rem;
    color: var(--rf-brand-dark);
    font-variant-numeric: tabular-nums;
}

.metric-sub {
    font-size: 0.78rem;
    color: #8a94a3;
    font-variant-numeric: tabular-nums;
}

.dispersion-map-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
    margin-bottom: 1rem;
}

.dispersion-card {
    min-width: 0;
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.5rem;
    background: #fbf5e7;
    overflow: hidden;
}

.dispersion-card-head {
    min-height: 4.5rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.8rem 0.6rem;
    border-bottom: 1px solid var(--rf-rule);
}

.dispersion-card-head h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--rf-brand-dark);
}

.dispersion-card-head span {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.74rem;
    color: var(--rf-text-muted);
}

.dispersion-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.9rem;
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--rf-rule);
    background: #f6ecd4;
}

.dispersion-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #625943;
    font-size: 0.72rem;
    font-weight: 700;
}

.dispersion-legend-dot {
    width: 0.7rem;
    height: 0.7rem;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 250, 240, 0.9);
    border-radius: 999px;
}

.dispersion-control-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.dispersion-controls {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 1px;
    padding: 2px;
    border: 1px solid #d8c79e;
    border-radius: 0.35rem;
    background: #eee3ca;
}

.dispersion-controls button {
    min-height: 1.8rem;
    padding: 0.2rem 0.45rem;
    border: 0;
    border-radius: 0.25rem;
    background: transparent;
    color: #655a43;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}

.dispersion-controls button:hover {
    background: rgba(255, 255, 255, 0.55);
}

.dispersion-controls button.active {
    background: #fffaf0;
    color: var(--rf-brand-dark);
    box-shadow: 0 1px 3px rgba(49, 39, 18, 0.18);
}

.dispersion-controls button:focus-visible {
    outline: 2px solid var(--rf-gold);
    outline-offset: 1px;
}

.dispersion-svg {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 360px;
    background: #f7eed8;
}

.tee-dispersion-svg {
    max-height: 560px;
}

.target-dispersion-svg {
    width: min(100%, 780px);
    min-height: 0;
    margin: 0 auto;
    aspect-ratio: 1;
}

.tee-rough {
    fill: #9ab775;
}

.tee-fairway {
    fill: #c8d99a;
}

.tee-zone-guide {
    stroke: rgba(42, 71, 45, 0.32);
    stroke-width: 1;
}

.dispersion-guide,
.dispersion-axis,
.dispersion-ring {
    fill: none;
    stroke: rgba(55, 74, 47, 0.34);
    stroke-width: 1;
    stroke-dasharray: 5 4;
}

.dispersion-guide-label,
.dispersion-axis-label,
.tee-zone-label {
    fill: #5e674f;
    font-family: var(--rf-sans);
    font-size: 11px;
}

.tee-zone-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.dispersion-point {
    stroke: #fffaf0;
    stroke-width: 1.5;
    opacity: 0.9;
    cursor: pointer;
}

/* Points are selectable, so they have to look it before anyone tries. */
.dispersion-point:hover,
.dispersion-point:focus-visible {
    opacity: 1;
    stroke-width: 2.5;
    outline: none;
}

.dispersion-point.is-selected {
    opacity: 1;
    stroke: var(--rf-brand-dark);
    stroke-width: 3;
}

/* The selected shot's round, hole and strokes gained. Reserves its height with the hint text it
   replaces, so selecting a point does not shunt the maps below it down the page. */
.dispersion-detail,
.dispersion-detail-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.7rem;
    min-height: 2.6rem;
    margin: 0.6rem 0 0;
    padding: 0.5rem 0.7rem;
    border-radius: 0.6rem;
    font-size: 0.82rem;
}

.dispersion-detail {
    border: 1px solid var(--rf-panel-border);
    background: #fff;
}

.dispersion-detail-hint {
    color: var(--rf-text-faint);
    font-style: italic;
}

.dispersion-detail-main {
    font-weight: 600;
    color: var(--rf-text);
}

.dispersion-detail-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.55rem;
    color: var(--rf-text-muted);
}

.dispersion-detail-course {
    font-weight: 600;
    color: var(--rf-brand);
}

.dispersion-detail-link {
    margin-left: auto;
    font-weight: 600;
    white-space: nowrap;
}

.dispersion-band {
    stroke: none;
}

.dispersion-band-6 {
    fill: #7fa35f;
}

.dispersion-band-5 {
    fill: #94b66d;
}

.dispersion-band-4 {
    fill: #a9c77d;
}

.dispersion-band-3 {
    fill: #bdd78e;
}

.dispersion-band-2 {
    fill: #d0e5a3;
}

.dispersion-band-1 {
    fill: #e2efbc;
}

.tee-origin {
    fill: #fffaf0;
    stroke: #173f32;
    stroke-width: 2;
}

.dispersion-category-fairway {
    fill: #17613f;
    background: #17613f;
}

.dispersion-category-green,
.dispersion-category-madeputt {
    fill: #13805a;
    background: #13805a;
}

.dispersion-category-madeputt {
    fill: #173f70;
    background: #173f70;
}

.dispersion-category-fringe {
    fill: #69a83b;
    background: #69a83b;
}

.dispersion-category-rough {
    fill: #71813b;
    background: #71813b;
}

.dispersion-category-deeproughrecovery {
    fill: #493f27;
    background: #493f27;
}

.dispersion-category-bunker {
    fill: #d2972f;
    background: #d2972f;
}

.dispersion-category-hazard {
    fill: #2675a8;
    background: #2675a8;
}

.dispersion-category-outofbounds {
    fill: #20242a;
    background: #20242a;
}

.dispersion-category-twoputt {
    fill: #d6871f;
    background: #d6871f;
}

.dispersion-category-threeplusputt {
    fill: #b53c32;
    background: #b53c32;
}

.dispersion-category-unclassified {
    fill: #78818a;
    background: #78818a;
}

.dispersion-pin line {
    stroke: #173f32;
    stroke-width: 2;
}

.dispersion-pin path {
    fill: #b2392f;
}

.dispersion-pin circle {
    fill: #fffaf0;
    stroke: #173f32;
    stroke-width: 1.5;
}

@media (max-width: 767.98px) {
    .dispersion-card-head {
        flex-direction: column;
    }

    .dispersion-control-stack,
    .dispersion-controls {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .dispersion-svg {
        min-height: 280px;
    }

    .target-dispersion-svg {
        min-height: 0;
    }
}

.distribution-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 0.6rem;
}

.distribution-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.6rem 0.4rem;
    border: 1px solid var(--rf-panel-border);
    border-radius: 0.5rem;
    background: linear-gradient(180deg, #fdf8ec, #f6eed9);
}

.distribution-count {
    font-family: var(--rf-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--rf-brand-dark);
    font-variant-numeric: tabular-nums;
}

.distribution-label {
    font-size: 0.78rem;
    color: #48515f;
}

.distribution-pct {
    font-size: 0.72rem;
    color: #9aa4b2;
    font-variant-numeric: tabular-nums;
}
