html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#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 1.25rem;
    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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5I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I2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem 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: #1b6ec2;
            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;
}

/* ----- QuickHoop ----- */

.btn-primary {
    background-color: #f97316;
    border-color: #ea6a0a;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: #ea6a0a;
    border-color: #d65f08;
}

/* Login */
.login-wrap {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .06);
}

.login-brand {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}

.login-sub {
    color: #6b7280;
    margin: .25rem 0 1.5rem;
}

/* Games list */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.game-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .12s ease, transform .12s ease;
}

.game-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
    transform: translateY(-1px);
}

.game-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .5rem;
}

.game-card__name {
    font-weight: 600;
    font-size: 1.05rem;
}

.game-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    color: #4b5563;
    font-size: .88rem;
    margin-top: .25rem;
}

.game-card__result {
    margin-top: .6rem;
    padding-top: .6rem;
    border-top: 1px solid #f1f1f1;
    font-weight: 600;
    color: #166534;
}

/* Game detail */
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    text-decoration: none;
    color: #6b7280;
}

.detail-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem 1.5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem;
    margin-top: 1rem;
}

.detail-grid dt {
    color: #6b7280;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: .1rem;
}

.detail-grid dd {
    margin: 0;
    font-weight: 500;
}

.result-box {
    margin-top: 1rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

.result-box__label {
    color: #047857;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.result-box__score {
    font-size: 1.2rem;
    font-weight: 700;
    color: #065f46;
}

.empty {
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    padding: 2.5rem;
    text-align: center;
    color: #6b7280;
}

/* Live (SignalR) indicator + event flash */
.live {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    font-weight: 600;
    padding: .15rem .55rem;
    border-radius: 999px;
}

.live--on {
    color: #166534;
    background: #dcfce7;
}

.live--off {
    color: #6b7280;
    background: #f3f4f6;
}

.live__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.live--on .live__dot {
    animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

.live-flash {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: 8px;
    padding: .5rem .75rem;
    margin-bottom: 1rem;
    font-size: .9rem;
}

.card-actions {
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid #f1f1f1;
}

.form-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 560px;
}

.detail-actions {
    display: flex;
    gap: .5rem;
    margin: .25rem 0 1rem;
}

/* PlayerProfile header with avatar (P5-5). */
.detail-head--with-avatar {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ----- User avatars (P5-5) ----- */
/* Reusable circular-thumbnail component. Three sizes via modifiers so a
   single rule set serves the nav, list cards, profile detail, and the
   own-profile editor. Initials placeholder renders when the user hasn't
   uploaded a real image (HasAvatar=false). */
.profile-avatar {
    position: relative;               /* anchors absolutely-positioned img overlay */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
    font-size: .9rem;
    flex-shrink: 0;
    user-select: none;
}

/* The img overlays the initials. If it loads, you see the photo. If it
   404s (HasAvatar=false / network error), JS sets visibility:hidden in
   the onerror handler and the initials below show through. Avoids
   the SPA needing to roundtrip GetMyProfileAsync just to render the
   top-nav avatar. */
.profile-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: inherit;
}

.profile-avatar--small  { width: 32px;  height: 32px;  font-size: .8rem; }
.profile-avatar--large  { width: 96px;  height: 96px;  font-size: 1.6rem; }
.profile-avatar--xl     { width: 140px; height: 140px; font-size: 2.2rem; }

.profile-avatar__initials {
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}

/* MyProfile header row: avatar | (career stat + actions). Stacks on narrow
   widths so the avatar lands above the meta. */
.profile-header {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.profile-header__meta {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.profile-avatar__actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.result-box--inline {
    display: inline-flex;
    flex-direction: column;
    margin-bottom: 0;
    padding: .5rem .75rem;
}

/* ----- Court filter bar (P5-4 C-C) ----- */
.court-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .75rem;
    align-items: stretch;
}

.court-filter__search { flex: 1 1 240px; min-width: 200px; }
.court-filter__type   { flex: 0 0 auto;   min-width: 140px; max-width: 200px; }
.court-filter__near   { flex: 0 0 auto;   white-space: nowrap; }

.court-attr--dist {
    color: #047857;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* ----- Court map (P5-4 C-B: Leaflet) ----- */
.court-map {
    height: 360px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    z-index: 0;     /* Leaflet pane sometimes leaks over Bootstrap modals; keep it tame */
}

.court-map--picker {
    height: 280px;
    cursor: crosshair;
    margin-bottom: .25rem;
}

/* ----- Courts list cards (P5-4 C-A redesign) ----- */
/* Inherits the responsive auto-fill grid pattern from .game-grid but with
   a slightly larger min so the new attribute row breathes. */
.court-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.court-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    transition: box-shadow .18s ease, transform .18s ease;
    overflow: hidden;       /* clip thumb top corners to the card radius */
}

/* Cover thumbnail (P5-4 C-D). Stretches to card width; aspect-ratio gives
   a consistent letterbox without manually setting heights. */
.court-card__thumb {
    margin: -1rem -1.1rem .25rem;   /* bleed to card edges */
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
    overflow: hidden;
}

.court-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Court form gallery + uploader (P5-4 C-D). */
.court-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.court-gallery__item {
    position: relative;
    width: 120px;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.court-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.court-gallery__delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    line-height: 22px;
    text-align: center;
    border-radius: 999px;
    border: none;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: .9rem;
    cursor: pointer;
}

.court-gallery__delete:hover {
    background: rgba(220, 38, 38, .9);
}

.court-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
    transform: translateY(-1px);
}

.court-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.court-card__name {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 600;
    color: #1f2937;
}

.court-card__head-badges {
    display: flex;
    gap: .35rem;
    flex-shrink: 0;
}

.court-card__row {
    display: flex;
    gap: .4rem;
    align-items: baseline;
    font-size: .9rem;
    color: #4b5563;
}

.court-card__icon {
    flex-shrink: 0;
}

.court-card__attrs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .75rem;
    font-size: .85rem;
    color: #374151;
    padding: .35rem .55rem;
    background: #f9fafb;
    border-radius: 8px;
}

.court-attr {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    white-space: nowrap;
}

.court-attr--coords {
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}

.court-card__desc {
    margin: 0;
    font-size: .85rem;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.court-card__actions {
    display: flex;
    gap: .5rem;
    margin-top: auto;
    padding-top: .6rem;
    border-top: 1px solid #f3f4f6;
}

/* Tournament */
.champion {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
    border-radius: 10px;
    padding: .75rem 1rem;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.tourney-meta { color: #6b7280; font-size: .9rem; }

.standings { background: #fff; }
.standings th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6b7280;
}

.round { margin-bottom: 1rem; }
.round__name { font-weight: 600; color: #374151; margin: .5rem 0 .35rem; }

.match {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 3px solid #d1d5db;
    border-radius: 8px;
    padding: .5rem .75rem;
    margin-bottom: .4rem;
}

.match--ready { border-left-color: #f97316; }
.match--done { border-left-color: #16a34a; }
.match__no { color: #9ca3af; font-size: .8rem; min-width: 2.5rem; }
.match__teams { font-weight: 500; flex: 1; min-width: 180px; }
.match__vs { color: #9ca3af; margin: 0 .4rem; font-weight: 400; }
.match__score { font-weight: 600; color: #166534; }
.match__pending { color: #9ca3af; font-size: .85rem; font-style: italic; }
.match__record { display: flex; align-items: center; gap: .4rem; }
.match__record .score { width: 4.25rem; }

/* Player discovery */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: .75rem;
    margin-bottom: 1rem;
}

.filter-bar .form-control,
.filter-bar .form-select { width: auto; flex: 1 1 130px; min-width: 110px; }

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.pager__info { color: #6b7280; font-size: .9rem; }

/* Dashboard */
.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat {
    flex: 1 1 150px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .12s ease, transform .12s ease;
}
.stat:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }
.stat__num { font-size: 1.9rem; font-weight: 700; line-height: 1; color: #1f2937; }
.stat__label { color: #6b7280; font-size: .85rem; margin-top: .25rem; }
.quick-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0 .5rem; }
/* ----- P6-6B: Pool picker checkbox grid (GameForm) ----- */
/* A simple wrapping grid of clickable rows so a game's allowed pools read
   as one compact list — visually distinct from a select multi but cheaper
   than dragging in a chip / token component. The label is the click
   target; the native checkbox stays visible for accessibility / mobile. */
.pool-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .25rem;
}
.pool-picker__opt {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .65rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background .12s ease, border-color .12s ease;
}
.pool-picker__opt:hover {
    background: #eef2f7;
    border-color: #cbd5e1;
}
.pool-picker__opt input[type="checkbox"] {
    margin: 0;
}

/* ----- P6-6D: auto-job timestamp pills (GameDetail) ----- */
/* Muted informational chips showing what the background jobs did to a
   game. Side-by-side, wraps, doesn't compete visually with the action
   row above. */
.auto-stamps {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}
.auto-stamp {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .55rem;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: .8rem;
    line-height: 1.4;
}
