:root {
    --app-bg: linear-gradient(180deg, #f8fafc 0%, #eef2ff 52%, #f8fafc 100%);
    --app-surface: rgba(255, 255, 255, 0.82);
    --app-surface-strong: #ffffff;
    --app-surface-muted: #eff6ff;
    --app-border: rgba(148, 163, 184, 0.24);
    --app-border-strong: rgba(37, 99, 235, 0.22);
    --app-text: #0f172a;
    --app-text-muted: #64748b;
    --app-primary: #2563eb;
    --app-primary-strong: #1d4ed8;
    --app-primary-soft: #dbeafe;
    --app-success: #0f9f6e;
    --app-success-soft: #dcfce7;
    --app-warning: #d97706;
    --app-warning-soft: #ffedd5;
    --app-danger: #dc2626;
    --app-danger-soft: #fee2e2;
    --app-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    --app-shadow-strong: 0 24px 60px rgba(37, 99, 235, 0.16);
    --app-radius-xl: 1.5rem;
    --app-radius-lg: 1rem;
    --app-radius-md: 0.85rem;
    --app-radius-sm: 0.7rem;
}

html,
body {
    min-height: 100%;
    font-family: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
    background: var(--app-bg);
    color: var(--app-text);
}

body {
    margin: 0;
}

#app {
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    color: var(--app-text);
    font-weight: 800;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2rem, 7vw, 3.25rem);
    line-height: 1;
}

h2 {
    font-size: clamp(1.1rem, 4vw, 1.55rem);
}

p {
    margin: 0;
}

a,
.btn-link {
    color: var(--app-primary);
}

a {
    text-decoration: none;
}

a:hover {
    color: var(--app-primary-strong);
}

h1:focus {
    outline: none;
}

.btn,
.form-control,
.form-select,
.form-check-input {
    border-radius: 0.9rem;
}

.btn-primary {
    color: #eff6ff;
    background: linear-gradient(135deg, var(--app-primary), #4f46e5);
    border-color: transparent;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
    color: #eff6ff;
    background: linear-gradient(135deg, var(--app-primary-strong), #4338ca);
    border-color: transparent;
}

.btn-success {
    color: #ecfdf5;
    background: linear-gradient(135deg, #059669, #0f766e);
    border-color: transparent;
    box-shadow: 0 16px 32px rgba(5, 150, 105, 0.2);
}

.btn-success:hover,
.btn-success:focus {
    color: #ecfdf5;
    background: linear-gradient(135deg, #047857, #115e59);
    border-color: transparent;
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(255, 255, 255, 0.82);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    color: #eff6ff;
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-outline-secondary {
    color: #475569;
    border-color: rgba(148, 163, 184, 0.36);
    background: rgba(255, 255, 255, 0.82);
}

.btn-outline-danger {
    color: var(--app-danger);
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(255, 255, 255, 0.82);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    color: #fef2f2;
    background: var(--app-danger);
    border-color: var(--app-danger);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.form-control:focus-visible,
.form-select:focus-visible,
.btn:focus-visible,
a:focus-visible {
    box-shadow: 0 0 0 0.18rem rgba(255, 255, 255, 0.95), 0 0 0 0.35rem rgba(37, 99, 235, 0.28);
}

.form-control,
.form-select {
    min-height: 3rem;
    border-color: rgba(148, 163, 184, 0.32);
    background: rgba(255, 255, 255, 0.88);
    color: var(--app-text);
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-label {
    margin-bottom: 0.45rem;
    color: var(--app-text);
    font-size: 0.95rem;
    font-weight: 700;
}

.content {
    padding-top: 1.1rem;
}

.page-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.page-hero,
.section-card,
.loading-card,
.empty-state,
.auth-card,
.history-card,
.round-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-xl);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(14px);
}

.page-hero {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.08)), var(--app-surface);
}

.page-hero-compact {
    gap: 0.85rem;
}

.page-eyebrow,
.section-kicker {
    color: var(--app-primary);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.page-lede,
.section-copy,
.section-note,
.round-player-label,
.round-hole-label,
.round-score-title,
.round-score-meta,
.round-section-subtitle,
.history-card-copy {
    color: var(--app-text-muted);
    line-height: 1.5;
}

.hero-metrics,
.history-grid {
    display: grid;
    gap: 0.75rem;
}

.hero-metrics {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.metric-card,
.stat-pill,
.round-meta-pill {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.78);
}

.metric-card {
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.metric-card strong {
    font-size: 1.35rem;
    line-height: 1.1;
}

.metric-label {
    color: var(--app-text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.status-banner {
    padding: 0.95rem 1rem;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 1rem;
    background: var(--app-primary-soft);
    color: #1e3a8a;
    font-weight: 600;
}

.loading-card,
.empty-state,
.auth-card,
.section-card {
    padding: 1.25rem;
}

.empty-state,
.auth-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.empty-state-inline {
    border-style: dashed;
    box-shadow: none;
    background: rgba(248, 250, 252, 0.78);
}

.auth-card {
    align-items: flex-start;
}

.section-header,
.section-heading {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.field-stack,
.round-config-section,
.round-config-block,
.round-participant-score-list,
.participant-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chip-list,
.round-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stat-pill,
.round-meta-pill {
    padding: 0.45rem 0.8rem;
    color: #334155;
    font-size: 0.88rem;
    font-weight: 600;
}

.participant-card,
.search-result,
.contact-link {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.82);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.participant-card {
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.participant-meta {
    min-width: 0;
}

.inline-input-action {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
}

.section-note {
    font-size: 0.92rem;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.search-result {
    padding: 0.95rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    color: inherit;
    text-align: left;
}

.search-result:hover,
.search-result:focus-visible,
.contact-link:hover,
.contact-link:focus-visible {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: 0 18px 34px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.search-result-text {
    font-weight: 700;
}

.search-result-action {
    color: var(--app-primary);
    font-size: 0.9rem;
    font-weight: 700;
}

.app-primary-button {
    min-height: 3.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    text-align: center;
}

.history-grid {
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.history-card {
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.history-card-title {
    font-size: 1.2rem;
}

.history-card-actions {
    display: flex;
    justify-content: flex-end;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
}

.score-badge-under {
    background: var(--app-success-soft);
    color: #166534;
}

.score-badge-even {
    background: rgba(226, 232, 240, 0.9);
    color: #334155;
}

.score-badge-over {
    background: var(--app-warning-soft);
    color: #9a3412;
}

.contact-card {
    display: grid;
    gap: 0.85rem;
}

.contact-link {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: inherit;
}

.contact-link strong {
    font-size: 1.05rem;
}

.round-shell {
    width: 100%;
    max-width: 58rem;
    margin: 0 auto;
}

.round-card {
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.round-card-elevated {
    box-shadow: var(--app-shadow-strong);
}

.round-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.round-header-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.round-action-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.round-header-button {
    min-height: 2.75rem;
    font-weight: 700;
}

.round-player-name,
.round-course-name,
.round-slider-hole {
    font-weight: 800;
    color: var(--app-text);
}

.round-course-name {
    font-size: 1.15rem;
}

.round-score-display {
    padding: 1rem;
    border-radius: 1.25rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.round-score-value {
    font-size: clamp(2rem, 9vw, 2.8rem);
    font-weight: 900;
    line-height: 1;
}

.round-score-absolute {
    color: var(--app-text-muted);
    font-size: 0.92rem;
    font-weight: 700;
    margin-left: 0.35rem;
}

.round-adjustments {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.round-adjust-button {
    min-height: 4.25rem;
    font-size: 1.6rem;
    font-weight: 800;
}

.round-slider {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.45rem;
}

.round-slider-button {
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.88);
    min-height: 4.1rem;
    padding: 0.65rem 0.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 0;
    color: inherit;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.round-slider-button.visited {
    background: rgba(219, 234, 254, 0.86);
    border-color: rgba(59, 130, 246, 0.22);
}

.round-slider-button.active {
    background: linear-gradient(135deg, var(--app-primary), #4f46e5);
    border-color: transparent;
    color: #eff6ff;
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.22);
}

.round-slider-score {
    color: var(--app-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.round-slider-button.active .round-slider-score {
    color: rgba(239, 246, 255, 0.86);
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #16a34a;
}

.invalid {
    outline: 1px solid var(--app-danger);
}

.validation-message {
    color: var(--app-danger);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwv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DcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    color: white;
    padding: 1rem 1rem 1rem 3.7rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--app-primary);
    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: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

@media (min-width: 640px) {
    .page-stack {
        gap: 1.25rem;
    }

    .page-hero,
    .section-card,
    .loading-card,
    .empty-state,
    .auth-card,
    .round-card {
        padding: 1.5rem;
    }

    .inline-input-action {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .history-card {
        padding: 1.3rem;
    }
}

@media (min-width: 768px) {
    .page-hero {
        padding: 1.75rem;
    }

    .section-header,
    .section-heading,
    .round-card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .round-header-actions {
        align-items: flex-end;
    }

    .round-participant-score-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    }

    .round-slider {
        grid-template-columns: repeat(9, minmax(0, 1fr));
        gap: 0.55rem;
    }

    .round-slider-button {
        min-height: 4.5rem;
        padding: 0.8rem 0.35rem;
    }

    .round-slider-score {
        font-size: 0.78rem;
    }
}
