:root {
    --green: #3db54a;
    --light-green: #5ec96e;
    --bg: #f0f4f2;
    --card-bg: #ffffff;
    --text: #1a2533;
    --subtle: #5a6a78;
    --border: #ccd5de;
    --error: #c0392b;
    --success: #27ae60;
    --radius: 12px;
    --strength-weak: #e74c3c;
    --strength-fair: #f39c12;
    --strength-strong: #27ae60;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}

.page {
    width: 100%;
    max-width: 420px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin: auto;
}

.hero-banner {
    width: 100%;
    background: linear-gradient(150deg, #111b27 0%, #1a2b3c 55%, #1e3449 100%);
    border-radius: var(--radius);
    padding: 12px 20px 10px;
    text-align: center;
    color: #fff;
    box-shadow: 0 4px 24px rgba(26, 43, 60, 0.35);
}

.hero-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 3px;
    border-radius: 14px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}

.hero-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.hero-tagline {
    color: rgba(255,255,255,0.75);
    margin-top: 2px;
    font-size: 0.78rem;
    font-weight: 400;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 28px 24px;
    width: 100%;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--subtle);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    min-height: 44px;
    touch-action: manipulation;
}

.tab.active {
    color: var(--green);
    border-bottom-color: var(--green);
}

@media (hover: hover) {
    .tab:hover:not(.active) {
        color: var(--text);
    }
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.field input {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.field input:focus {
    border-color: var(--light-green);
}

.password-wrapper {
    position: relative;
    display: flex;
}

.password-wrapper input {
    padding-right: 44px;
    flex: 1;
}

.btn-eye {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 44px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.strength-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}

.strength-fill.weak   { width: 33%; background: var(--strength-weak); }
.strength-fill.fair   { width: 66%; background: var(--strength-fair); }
.strength-fill.strong { width: 100%; background: var(--strength-strong); }

.strength-label {
    font-size: 0.75rem;
    color: var(--subtle);
    margin-top: 2px;
}

.btn-primary {
    background: var(--green);
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 4px;
    width: 100%;
    min-height: 44px;
    touch-action: manipulation;
}

@media (hover: hover) {
    .btn-primary:hover {
        background: #339b3f;
    }
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: none;
    color: var(--subtle);
    border: 1px solid var(--border);
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
    width: 100%;
    min-height: 44px;
    touch-action: manipulation;
}

@media (hover: hover) {
    .btn-secondary:hover {
        background: var(--bg);
    }
}

.btn-danger {
    background: none;
    color: var(--error);
    border: 1px solid var(--error);
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 8px;
    width: 100%;
    min-height: 44px;
    touch-action: manipulation;
}

@media (hover: hover) {
    .btn-danger:hover {
        background: #fef2f2;
    }
}

.error {
    color: var(--error);
    font-size: 0.85rem;
    min-height: 1.1em;
}

.success {
    color: var(--success);
    font-size: 0.85rem;
    min-height: 1.1em;
}

.hidden {
    display: none !important;
}

#welcome-card {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 20px;
}

#welcome-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--green);
    margin: 0;
}

.btn-start-round {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: linear-gradient(135deg, #3db54a 0%, #5ec96e 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(61, 181, 74, 0.30);
    transition: box-shadow 0.15s, transform 0.1s;
    min-height: 52px;
    touch-action: manipulation;
    font-family: inherit;
}

.btn-start-icon {
    font-size: 0.85rem;
    opacity: 0.9;
}

@media (hover: hover) {
    .btn-start-round:hover {
        box-shadow: 0 5px 18px rgba(61, 181, 74, 0.40);
        transform: translateY(-1px);
    }
}

.btn-start-round:active {
    transform: translateY(0);
}

.subtle {
    color: var(--subtle);
    font-size: 0.9rem;
}

/* 3-column tile grid */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    width: 100%;
    list-style: none;
    padding: 0;
}

.menu-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 14px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    min-height: 76px;
    touch-action: manipulation;
}

.menu-tile-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.menu-tile-label {
    font-size: 0.78rem;
    color: var(--subtle);
    text-align: center;
    line-height: 1.25;
}

@media (hover: hover) {
    .menu-tile:hover {
        background: #e8f5ea;
        border-color: var(--light-green);
        box-shadow: 0 2px 8px rgba(61,181,74,0.10);
    }
}

/* Secondary actions row */
.menu-secondary {
    display: flex;
    gap: 10px;
    width: 100%;
}

.menu-secondary .btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
    margin-top: 0;
    padding: 10px 8px;
}

/* Sign out link */
.btn-signout {
    background: none;
    border: none;
    color: var(--subtle);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
    touch-action: manipulation;
    font-family: inherit;
}

@media (hover: hover) {
    .btn-signout:hover {
        color: var(--error);
    }
}

.menu-footer-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* ── Desktop (≥ 640px) ─────────────────────────────────────────── */
@media (min-width: 640px) {
    .page {
        max-width: 480px;
        padding: 48px 24px;
    }

    .hero-logo {
        width: 80px;
        height: 80px;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .card {
        padding: 36px 32px;
    }
}

/* ── Landscape / short screens ─────────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .page {
        gap: 12px;
        padding: 12px 16px;
    }

    .hero-logo {
        width: 48px;
        height: 48px;
        margin-bottom: 4px;
    }

    .hero-title {
        font-size: 1.6rem;
    }

    .hero-tagline {
        display: none;
    }
}

/* ── Course creation page ───────────────────────────────────────── */
.page-wide {
    max-width: 100%;
    align-items: stretch;
}

.page-wide form,
.page-wide #success-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding-bottom: 4px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--green);
}

.btn-back {
    color: var(--subtle);
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    padding: 6px 0;
    transition: color 0.15s;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    touch-action: manipulation;
}

@media (hover: hover) {
    .btn-back:hover { color: var(--text); }
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--green);
    margin-bottom: 16px;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--subtle);
    margin-bottom: 8px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hole-count-select {
    background: none;
    border: 1px solid var(--border);
    color: var(--subtle);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: background 0.15s, color 0.15s;
}

@media (hover: hover) {
    .hole-count-select:hover { background: var(--bg); color: var(--text); }
}

.section-header .section-title {
    margin-bottom: 0;
}

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

.btn-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--subtle);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    touch-action: manipulation;
}

@media (hover: hover) {
    .btn-toggle:hover { background: var(--bg); color: var(--text); }
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
}

.holes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.holes-table th {
    text-align: left;
    padding: 6px 8px;
    color: var(--subtle);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.holes-table td {
    padding: 4px 4px;
    vertical-align: middle;
}

.hole-num {
    font-weight: 600;
    color: var(--subtle);
    text-align: center;
    padding: 4px 8px;
    width: 28px;
}

.hole-input {
    width: 100%;
    min-width: 58px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.hole-input:focus { border-color: var(--light-green); }

.holes-table .hole-par  { min-width: 52px; }
.holes-table .hole-si   { min-width: 52px; }
.holes-table .hole-length { min-width: 72px; }
.holes-table .hole-slat,
.holes-table .hole-slon,
.holes-table .hole-glat,
.holes-table .hole-glon { min-width: 88px; }

.holes-summary {
    display: flex;
    gap: 24px;
    margin-top: 14px;
    font-size: 0.875rem;
    color: var(--subtle);
}

.holes-summary strong { color: var(--text); }

.success-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 8px;
}

#success-card {
    text-align: center;
    align-items: center;
}

#success-card h2 {
    font-size: 1.4rem;
    color: var(--green);
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 8px;
}

a.btn-primary,
a.btn-secondary {
    display: block;
    text-align: center;
    text-decoration: none;
}

.btn-block {
    display: block;
    text-align: center;
    text-decoration: none;
}

@media (min-width: 640px) {
    .page-wide {
        max-width: 760px;
        padding: 32px 24px;
    }

    .btn-group {
        flex-direction: row;
        justify-content: center;
    }

    .btn-group .btn-primary,
    .btn-group .btn-secondary {
        width: auto;
        min-width: 160px;
    }
}

/* ── Course picker ──────────────────────────────────────────────── */

.picker-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-back-plain {
    background: none;
    border: none;
    color: var(--subtle);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 0;
    transition: color 0.15s;
    touch-action: manipulation;
}

@media (hover: hover) {
    .btn-back-plain:hover { color: var(--text); }
}

.picker-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green);
}

#course-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.course-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s;
}

.course-item.expanded {
    border-color: var(--light-green);
}

.course-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    min-height: 44px;
}

.course-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.course-item-flag {
    font-size: 0.8rem;
    color: var(--subtle);
}

.course-item-body {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border);
    cursor: default;
}

.tee-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 12px;
}

.tee-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
    min-height: 40px;
    touch-action: manipulation;
}

.tee-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--green);
    flex-shrink: 0;
    cursor: pointer;
}

.tee-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tee-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.tee-meta {
    font-size: 0.78rem;
    color: var(--subtle);
}

/* ── Play page ──────────────────────────────────────────────────── */

.play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 4px;
}

.play-score {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--green);
}

.play-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hole-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 24px;
}

.hole-info {
    text-align: center;
    flex: 1;
}

.hole-number {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--green);
}

.hole-detail {
    display: block;
    font-size: 0.85rem;
    color: var(--subtle);
    margin-top: 2px;
}

.btn-nav {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    flex-shrink: 0;
}

.btn-nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.hole-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.score-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    flex-shrink: 0;
    line-height: 1;
}

.score-btn.small {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
}

@media (hover: hover) {
    .score-btn:hover { background: var(--border); }
}

.score-display {
    text-align: center;
    min-width: 60px;
}

#strokes-value {
    display: block;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.score-vs-par {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 4px;
}

.score-vs-par.even   { color: var(--subtle); }
.score-vs-par.birdie { color: #2196f3; }
.score-vs-par.eagle  { color: #9c27b0; }
.score-vs-par.bogey  { color: #e67e22; }
.score-vs-par.double { color: var(--error); }

.stats-row {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    touch-action: manipulation;
}

.stat-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
    cursor: pointer;
}

.putt-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

#putts-value {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.stat-label {
    color: var(--subtle);
    font-size: 0.85rem;
}

/* Scorecard */

.scorecard {
    margin-top: 16px;
    overflow-x: auto;
}

.sc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.sc-table th,
.sc-table td {
    text-align: center;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}

.sc-table th {
    font-weight: 600;
    color: var(--subtle);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.sc-table tfoot td {
    font-weight: 700;
    border-top: 2px solid var(--border);
    border-bottom: none;
}

.sc-diff.even   { color: var(--subtle); }
.sc-diff.birdie { color: #2196f3; font-weight: 700; }
.sc-diff.eagle  { color: #9c27b0; font-weight: 700; }
.sc-diff.bogey  { color: #e67e22; }
.sc-diff.double { color: var(--error); }

/* ── Shot-by-shot tracking ──────────────────────────────────────── */

.field select {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.field select:focus { border-color: var(--light-green); }

.shot-context {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.shot-context-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--subtle);
    margin-bottom: 3px;
}

.shot-context-state {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.shot-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.shot-history {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 16px;
}

.shot-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.shot-row:last-child { border-bottom: none; }

.shot-row-editable {
    cursor: pointer;
}
.shot-row-editable:active {
    background: var(--surface-hover, rgba(0,0,0,0.05));
}

.shot-edit-icon {
    font-size: 0.78rem;
    color: var(--subtle);
    flex-shrink: 0;
    margin-left: 2px;
}

.shot-num {
    font-weight: 700;
    color: var(--subtle);
    min-width: 16px;
    flex-shrink: 0;
}

.shot-info {
    flex: 1;
    color: var(--text);
    font-size: 0.82rem;
}

.shot-sg {
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 38px;
    text-align: right;
    flex-shrink: 0;
}

.shot-sg.positive { color: #2196f3; }
.shot-sg.negative { color: var(--error); }
.shot-sg.neutral  { color: var(--subtle); }

.hole-summary { margin-bottom: 16px; }

.hole-summary-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.hole-summary-score {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

/* ── Live scorecard button ──────────────────────────────────────── */

.btn-scorecard-live {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    flex-shrink: 0;
    transition: background 0.15s;
}

@media (hover: hover) {
    .btn-scorecard-live:hover { background: var(--bg); }
}

/* ── Scorecard modal ────────────────────────────────────────────── */

.sc-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.sc-modal-inner {
    background: var(--card-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 640px;
    max-height: 85dvh;
    overflow-y: auto;
    padding: 20px 16px 32px;
}

.sc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sc-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green);
}

.sc-modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--subtle);
    padding: 4px 8px;
    touch-action: manipulation;
}

.sc-modal-inner--doc {
    max-height: 80vh;
    overflow-y: auto;
    border-radius: var(--radius);
    max-width: 600px;
    width: 100%;
    margin: auto;
}

.legal-doc {
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text);
}

.legal-doc h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--green);
    margin: 16px 0 4px;
}

.legal-doc h3:first-of-type { margin-top: 8px; }

.legal-doc p,
.legal-doc ul { margin: 0 0 8px; }

.legal-doc ul {
    padding-left: 18px;
}

.legal-doc a {
    color: var(--green);
    text-decoration: underline;
}

.legal-updated {
    font-size: 0.8rem;
    color: var(--subtle);
    margin-bottom: 12px !important;
}

/* ── SGF-style scorecard ────────────────────────────────────────── */

.sgf-scorecard {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sgf-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
}

.sgf-table {
    border-collapse: collapse;
    font-size: 0.78rem;
    min-width: 100%;
    table-layout: auto;
}

.sgf-table th,
.sgf-table td {
    text-align: center;
    padding: 5px 4px;
    border: 1px solid var(--border);
    white-space: nowrap;
    min-width: 26px;
}

.sgf-table thead th {
    background: var(--green);
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
}

.sgf-label {
    text-align: left !important;
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--subtle);
    padding-left: 6px !important;
    background: var(--bg);
    min-width: 40px !important;
}

@media (max-width: 480px) {
    #scorecard-card {
        padding: 20px 8px;
    }

    #scorecard-card .sgf-section {
        margin-left: -4px;
        margin-right: -4px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .sgf-table {
        font-size: 0.7rem;
    }

    .sgf-table thead th {
        font-size: 0.7rem;
    }

    .sgf-table th,
    .sgf-table td {
        padding: 4px 2px;
        min-width: 22px;
    }

    .sgf-label {
        font-size: 0.65rem;
        padding-left: 4px !important;
        min-width: 32px !important;
    }

    .sgf-dim {
        font-size: 0.65rem;
    }
}

.sgf-dim {
    color: var(--subtle);
    font-size: 0.72rem;
}

.sgf-total {
    font-weight: 700;
    background: #f5f9f6;
}

.sgf-score-row td { font-weight: 600; }

/* ── Rounds list page ───────────────────────────────────────────── */

#rounds-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.round-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    cursor: pointer;
    border: 1px solid var(--border);
    transition: border-color 0.15s, box-shadow 0.15s;
    touch-action: manipulation;
}

@media (hover: hover) {
    .round-card:hover {
        border-color: var(--light-green);
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    }
}

.round-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.round-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.round-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 6px;
    padding: 4px 6px;
    background: var(--bg);
    border-radius: 6px;
}

.round-card-stats > span {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

.round-stat-label {
    font-size: 0.65rem;
    color: var(--subtle);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.round-stat-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.btn-round-action {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-round-action:hover {
    background: var(--light-green);
    border-color: var(--light-green);
    color: #fff;
}

.btn-delete:hover {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.round-card-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.round-course {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.round-meta {
    font-size: 0.82rem;
    color: var(--subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Insights page ─────────────────────────────────────────────── */

.insights-page {
    gap: 16px;
}

.insights-filter-card {
    padding: 16px 20px;
}

.insights-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.insights-filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.insights-hcp-input {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    width: 90px;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s;
}

.insights-hcp-input:focus {
    border-color: var(--light-green);
}

.insights-reload-btn {
    margin-top: 0;
    width: auto;
    padding: 9px 18px;
    font-size: 0.9rem;
}

.btn-group-sel {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: center;
}

.btn-group-sel:hover {
    border-color: var(--light-green);
}

.btn-group-sel.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

/* ── Benchmark YOU vs THEM ──────────────────────────────────────────────── */

.bench-compare-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.bench-compare-row:last-child {
    border-bottom: none;
}

.bench-compare-worst {
    background: rgba(220, 50, 50, 0.04);
    border-radius: 6px;
    padding: 8px 6px;
    margin: 0 -6px;
}

.bench-compare-cat {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 90px;
    color: var(--text);
}

.bench-compare-vals {
    display: flex;
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 0.85rem;
}

.bench-you {
    font-weight: 600;
}

.bench-them {
    color: var(--subtle);
}

.bench-gap {
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

.bench-bucket-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.83rem;
    gap: 8px;
}

.bench-bucket-range {
    color: var(--text);
}

.bench-bucket-gap {
    font-weight: 600;
    white-space: nowrap;
}

.bench-tips-list {
    margin: 6px 0 0 0;
    padding-left: 18px;
    font-size: 0.83rem;
    color: var(--subtle);
    line-height: 1.6;
}

.bench-tips-list li {
    margin-bottom: 2px;
}


.insight-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 10px;
}

.insight-subsection {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

.insight-summary-text {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text);
}

/* SG bar component */
.sg-bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.2fr) 2fr auto;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-radius: 6px;
}

.sg-bar-row.sg-bar-worst {
    background: rgba(192, 57, 43, 0.06);
    padding: 5px 8px;
    margin: 0 -8px;
}

.sg-bar-row.sg-bar-best {
    background: rgba(39, 174, 96, 0.07);
    padding: 5px 8px;
    margin: 0 -8px;
}

.sg-bar-label {
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.sg-bar-zero {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--subtle);
    opacity: 0.4;
    transform: translateX(-50%);
}

.sg-bar-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sg-bar-value {
    font-size: 0.82rem;
    font-weight: 600;
    text-align: right;
    min-width: 44px;
}

.sg-good    { color: var(--success); }
.sg-bad     { color: var(--error); }
.sg-neutral { color: var(--subtle); }

/* Trend table */
.trend-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 12px;
}

.insights-trend-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.insights-trend-table th {
    text-align: right;
    padding: 5px 6px;
    color: var(--subtle);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

.insights-trend-table th:first-child { text-align: left; }

.insights-trend-table td {
    text-align: right;
    padding: 5px 6px;
    border-bottom: 1px solid var(--bg);
    font-variant-numeric: tabular-nums;
}

.insights-trend-table td:first-child {
    text-align: left;
    color: var(--subtle);
}

.insights-trend-table tbody tr:hover {
    background: var(--card-hover, rgba(0,0,0,0.05));
}

/* ── Bag Analysis page ─────────────────────────────────────────── */

.bag-flag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 7px 10px;
    border-radius: 8px;
}

.bag-flag-good {
    background: rgba(39, 174, 96, 0.08);
    color: var(--text);
}

.bag-flag-warn {
    background: rgba(192, 57, 43, 0.07);
    color: var(--text);
}

/* Dispersion rows */
.bag-disp-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--bg);
}

.bag-disp-row:last-child {
    border-bottom: none;
}

.bag-disp-row.bag-disp-high {
    background: rgba(192, 57, 43, 0.04);
    padding: 10px 8px;
    border-radius: 8px;
    margin: 0 -8px;
}

.bag-disp-row.bag-disp-low {
    background: rgba(39, 174, 96, 0.06);
    padding: 10px 8px;
    border-radius: 8px;
    margin: 0 -8px;
}

.bag-disp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.bag-disp-club {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.bag-disp-rating {
    font-size: 0.8rem;
    font-weight: 600;
}

.bag-disp-bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bag-disp-bar-row {
    display: grid;
    grid-template-columns: 36px 1fr 36px;
    align-items: center;
    gap: 8px;
}

.bag-disp-bar-label {
    font-size: 0.75rem;
    color: var(--subtle);
    text-align: right;
}

.bag-disp-track {
    height: 7px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.bag-disp-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.bag-disp-fill-good { background: var(--light-green); }
.bag-disp-fill-med  { background: #f39c12; }
.bag-disp-fill-bad  { background: var(--error); }

.bag-disp-pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
}

/* Gapping rows */
.bag-gap-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg);
}

.bag-gap-row:last-child {
    border-bottom: none;
}

.bag-gap-row.bag-gap-warn {
    background: rgba(192, 57, 43, 0.05);
    padding: 8px;
    border-radius: 8px;
    margin: 2px -8px;
}

.bag-gap-clubs {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
}

.bag-gap-dist {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 36px;
    text-align: right;
}

.bag-gap-note {
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 90px;
    text-align: right;
}

/* Club cards */
.bag-club-card {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.bag-club-card:last-child {
    margin-bottom: 0;
}

.bag-club-problem {
    background: rgba(192, 57, 43, 0.07);
    border-left: 3px solid var(--error);
}

.bag-club-best {
    background: rgba(39, 174, 96, 0.08);
    border-left: 3px solid var(--light-green);
}

.bag-club-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.bag-club-reason {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--subtle);
    margin-bottom: 2px;
}

.bag-club-detail {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.5;
}

/* Stat grid */
.insights-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.insights-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg);
    border-radius: 8px;
    padding: 10px 8px;
    gap: 4px;
}

.insights-stat-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.insights-stat-lbl {
    font-size: 0.72rem;
    color: var(--subtle);
    text-align: center;
    line-height: 1.3;
}

@media (min-width: 640px) {
    .insights-stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
    font-size: 0.8rem;
    color: var(--subtle);
}

.round-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.round-score {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.round-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-complete {
    background: #e8f5e9;
    color: var(--green);
}

.badge-ongoing {
    background: #fff8e1;
    color: #e67e22;
}

.hcp-category-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: #e8f5e9;
    color: var(--green);
    letter-spacing: 0.3px;
    vertical-align: middle;
}

/* ── Settings logo ──────────────────────────────────────────────── */

.logo {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: contain;
}

/* ── Settings page layout ───────────────────────────────────────── */

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.settings-section:first-child {
    margin-top: 8px;
}

.settings-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--subtle);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.settings-danger-zone { margin-top: 28px; }

.settings-danger-zone .settings-section-title {
    color: #dc2626;
    border-bottom-color: #fca5a5;
}

.btn-delete-account {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.875rem;
    cursor: pointer;
    width: 100%;
    text-align: center;
}

@media (hover: hover) {
    .btn-delete-account:hover { background: #fef2f2; }
}

.btn-delete-confirm {
    flex: 1;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-delete-confirm:disabled { opacity: 0.6; cursor: not-allowed; }

.input-compact {
    max-width: 160px;
}

.score-under { color: #2196f3; }
.score-over  { color: var(--error); }
.score-even  { color: var(--subtle); }

.disp-left   { color: #e67e22; }
.disp-center { color: var(--green); }
.disp-right  { color: #e67e22; }

.disp-sg {
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.85;
}

.disp-sg.sg-pos { color: var(--green); }
.disp-sg.sg-neg { color: var(--error); }

/* ── Round detail page ──────────────────────────────────────────── */

.round-detail-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-bottom: 12px;
}

.round-stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    text-align: center;
}

.stat-box {
    background: var(--bg);
    border-radius: 6px;
    padding: 5px 2px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.stat-lbl {
    font-size: 0.6rem;
    color: var(--subtle);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-box--wide {
    grid-column: span 2;
}

.stat-row-paired {
    grid-column: 1 / -1;
    background: var(--bg);
    border-radius: 8px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
}

.stat-paired-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.stat-paired-item .stat-lbl {
    font-size: 0.65rem;
}

.stat-paired-item .stat-val {
    font-size: 0.85rem;
    font-weight: 700;
}

.stat-paired-sep {
    width: 1px;
    height: 16px;
    background: var(--border);
    margin: 0 10px;
    flex-shrink: 0;
}


.definitions-card {
    margin-top: 0;
    padding: 0;
}

.definitions-summary {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

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

.definitions-summary::after {
    content: '›';
    margin-left: auto;
    font-size: 1.1rem;
    color: var(--subtle);
    transition: transform 0.2s;
}

details.definitions-card[open] .definitions-summary::after {
    transform: rotate(90deg);
}

.definitions-body {
    padding: 0 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.def-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.def-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.def-desc {
    font-size: 0.8rem;
    color: var(--subtle);
    line-height: 1.5;
}

.def-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    margin-top: 4px;
}

.def-table th {
    text-align: left;
    padding: 5px 8px;
    font-weight: 600;
    color: var(--subtle);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
}

.def-table td {
    padding: 5px 8px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.def-table tr:last-child td { border-bottom: none; }

.sc-eagle  { background: #f3e5f5; color: #9c27b0; font-weight: 700; border-radius: 4px; }
.sc-birdie { background: #e3f2fd; color: #2196f3; font-weight: 700; border-radius: 4px; }
.sc-par    { color: var(--text); }
.sc-bogey  { color: #e67e22; }
.sc-double { color: var(--error); font-weight: 700; }
.sgf-score {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 700;
}

.sgf-score.eagle  { background: #9c27b0; color: #fff; border-radius: 50%; }
.sgf-score.birdie { background: #2196f3; color: #fff; border-radius: 50%; }
.sgf-score.even   { color: var(--text); }
.sgf-score.bogey  { border: 1px solid #e67e22; color: #e67e22; }
.sgf-score.double { border: 2px solid var(--error); color: var(--error); }

.sgf-sg-row td { font-size: 0.72rem; }

.pts-cell   { font-size: 0.78rem; font-weight: 700; }
.pts-zero   { color: var(--error); }
.pts-one    { color: #e67e22; }
.pts-two    { color: var(--subtle); }
.pts-three  { color: var(--success); }

.sgf-score-summary { font-size: 0.85rem; font-weight: 700; }

.sgf-sg { font-weight: 600; }
.sg-pos     { color: #2196f3; }
.sg-neg     { color: var(--error); }
.sg-neutral { color: var(--subtle); }

.sgf-totals .sgf-table td {
    font-weight: 700;
    font-size: 0.82rem;
    padding: 7px 8px;
}

.sgf-hcp-sup {
    font-size: 0.65em;
    vertical-align: super;
    color: var(--green);
    font-weight: 700;
}

.sgf-info-inline {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--subtle);
    white-space: nowrap;
}

.sgf-scorecard-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 2px 6px;
}

/* ── My Bag modal ───────────────────────────────────────────────── */

.bag-club-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.bag-club-row:last-child {
    border-bottom: none;
}

.bag-club-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    min-width: 72px;
    flex: 1;
}

.bag-dist-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bag-dist-input {
    width: 72px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    text-align: right;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.bag-dist-input:focus {
    border-color: var(--light-green);
}

.bag-dist-unit {
    font-size: 0.85rem;
    color: var(--subtle);
    min-width: 14px;
}

.bag-remove-btn {
    background: none;
    border: none;
    color: var(--subtle);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    margin-left: 4px;
    transition: color 0.15s, background 0.15s;
    touch-action: manipulation;
    min-height: 36px;
    min-width: 36px;
}

@media (hover: hover) {
    .bag-remove-btn:hover {
        color: var(--error);
        background: #fdecea;
    }
}

.bag-add-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--green);
    background: var(--bg);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.bag-club-name-input {
    flex: 1;
    min-width: 72px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
    outline: none;
    margin-right: 6px;
}

.bag-club-name-input:focus {
    border-color: var(--light-green);
}

.bag-cat-select {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text);
    background: var(--bg);
    margin-right: 6px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.bag-cat-select:focus {
    border-color: var(--light-green);
}

.bag-add-custom-btn {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--green);
    background: transparent;
    cursor: pointer;
    outline: none;
    touch-action: manipulation;
}

@media (hover: hover) {
    .bag-add-custom-btn:hover {
        background: var(--bg);
        border-color: var(--light-green);
    }
}

.app-version-footer {
    width: 100%;
    text-align: center;
    padding: 8px 0 16px;
    font-size: 0.7rem;
    color: var(--subtle);
    opacity: 0.6;
}

/* ── Hole result overlay ─────────────────────────────────────────── */

@keyframes hole-result-card-in {
    from { opacity: 0; transform: scale(0.8) translateY(24px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

@keyframes hole-result-card-out {
    from { opacity: 1; transform: scale(1)    translateY(0); }
    to   { opacity: 0; transform: scale(0.88) translateY(-16px); }
}

@keyframes hole-result-bg-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes hole-result-bg-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.hole-result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: hole-result-bg-in 0.2s ease-out forwards;
    cursor: pointer;
}

.hole-result-overlay.exiting {
    animation: hole-result-bg-out 0.28s ease-in forwards;
}

.hole-result-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 36px 48px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
    animation: hole-result-card-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    min-width: 220px;
    pointer-events: none;
}

.hole-result-overlay.exiting .hole-result-card {
    animation: hole-result-card-out 0.25s ease-in forwards;
}

.hole-result-hole-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--subtle);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.hole-result-score-num {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    margin-bottom: 6px;
}

.hole-result-vs-par {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.hole-result-vs-par.eagle  { color: #9c27b0; }
.hole-result-vs-par.birdie { color: #2196f3; }
.hole-result-vs-par.even   { color: var(--subtle); }
.hole-result-vs-par.bogey  { color: #e67e22; }
.hole-result-vs-par.double { color: var(--error); }

.hole-result-sg {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.hole-result-sg.positive { color: var(--success); }
.hole-result-sg.negative { color: var(--error); }
.hole-result-sg.neutral  { color: var(--subtle); }

.hole-result-hint {
    font-size: 0.75rem;
    color: var(--subtle);
    opacity: 0.7;
    letter-spacing: 0.04em;
}

/* ── Coaching page ──────────────────────────────────────────────── */

.coaching-ol,
.coaching-ul {
    margin: 0;
    padding-left: 1.4rem;
}

.coaching-ol li,
.coaching-ul li {
    margin-bottom: 6px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.coaching-focus-item {
    font-weight: 600;
    color: var(--text);
}

.coaching-drill {
    border-left: 3px solid var(--accent);
    padding: 10px 12px;
    margin-bottom: 14px;
    background: var(--card-alt, rgba(0,0,0,0.03));
    border-radius: 0 6px 6px 0;
}

.coaching-drill-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.coaching-drill-goal {
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.coaching-drill-steps {
    margin-top: 4px;
}

/* ── Safari data-detector link override ────────────────────────── */

a[x-apple-data-detectors],
a[x-apple-data-detectors-type],
.x-apple-data-detectors,
.x-apple-data-detectors-type {
    color: inherit !important;
    text-decoration: none !important;
    font-size: inherit !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
}

/* GPS distance measurement button (Play page) */
.distance-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.distance-input-row > input {
    flex: 1;
    min-width: 0;
}

.btn-gps {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 44px;
    padding: 0 10px;
    font-size: 1.15rem;
    cursor: pointer;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    flex-shrink: 0;
    line-height: 1;
}

.btn-gps:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-gps-inline {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    font-size: 1rem;
    margin-left: 6px;
    vertical-align: middle;
}

@media (hover: hover) {
    .btn-gps:hover:not(:disabled) { background: var(--border); }
}

/* ── Shared statistics filter ─────────────────────────────────── */

.stats-filter-card {
    padding: 12px 14px;
}

.stats-filter-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.stats-filter-row .stats-filter-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 7px 8px;
    font-size: 0.78rem;
}

.stats-filter-course {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.stats-filter-course:focus {
    border-color: var(--light-green);
}

.stats-filter-course:disabled {
    color: var(--subtle);
    background: var(--bg);
}
.turnstile-wrapper { margin: 12px 0; }

.tos-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tos-label {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

.tos-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--green);
    cursor: pointer;
}

.tos-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 26px;
    border-left: 2px solid var(--border);
}

.tos-link {
    font-size: 0.8rem;
    color: var(--green);
    text-decoration: underline;
}

/* ── Cookie consent banner ──────────────────────────────────────── */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
}

.cookie-banner strong {
    font-size: 0.9rem;
    color: var(--text);
}

.cookie-banner p {
    font-size: 0.8rem;
    color: var(--subtle);
    margin: 4px 0 0;
    line-height: 1.4;
}

.cookie-banner-actions {
    display: flex;
    gap: 8px;
}

.btn-cookie-accept {
    flex: 1;
    padding: 10px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-cookie-reject {
    flex: 1;
    padding: 10px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-cookie-manage {
    width: 100%;
    padding: 8px;
    background: none;
    border: none;
    color: var(--subtle);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
}

.cookie-prefs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 1001;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
}

.cookie-prefs-title {
    font-size: 0.9rem;
    color: var(--text);
}

.cookie-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}

.cookie-pref-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cookie-pref-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.cookie-pref-desc {
    font-size: 0.775rem;
    color: var(--subtle);
    line-height: 1.3;
}

.cookie-always-on {
    font-size: 0.75rem;
    color: var(--green);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: var(--green);
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
    transform: translateX(20px);
}
