html, body {
    font-family: 'Roboto', sans-serif;
}

/* Brand logo in app bar — smaller on mobile so full text fits */
.brand-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .brand-text {
        font-size: 1rem;
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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,...) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #FF6B00;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.game-card {
    transition: transform 0.2s;
}

.game-card:hover {
    transform: translateY(-4px);
}

/* === Zone Color Palette === */
:root {
    --zone-color-0: #1976D2;
    --zone-color-1: #388E3C;
    --zone-color-2: #F57C00;
    --zone-color-3: #7B1FA2;
    --zone-color-4: #00838F;
    --zone-color-5: #C2185B;
    --zone-color-6: #F9A825;
    --zone-color-7: #303F9F;
    --zone-tint-0: #E3F2FD;
    --zone-tint-1: #E8F5E9;
    --zone-tint-2: #FFF3E0;
    --zone-tint-3: #F3E5F5;
    --zone-tint-4: #E0F7FA;
    --zone-tint-5: #FCE4EC;
    --zone-tint-6: #FFFDE7;
    --zone-tint-7: #E8EAF6;
}

/* === Booking Calendar === */
.cal-grid {
    display: grid;
    gap: 1px;
    background: #e0e0e0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}
.cal-header {
    background: var(--mud-palette-primary, #1976D2);
    color: white;
    padding: 8px 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 2;
}
.cal-time-label {
    background: #f5f5f5;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #666;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: sticky;
    left: 0;
    z-index: 1;
}
.cal-slot {
    padding: 2px 4px;
    font-size: 11px;
    min-height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.15s;
    user-select: none;
}
.cal-slot:hover {
    filter: brightness(0.9);
}
.cal-available { background: #E8F5E9; color: #2E7D32; }
.cal-selected { background: #BBDEFB; color: #1565C0; border: 2px solid #1976D2; font-weight: 600; }
.cal-booked-customer { background: #EEEEEE; color: #757575; cursor: default; }
.cal-closed { background: #9E9E9E; color: #fff; cursor: default; }
.cal-past { background: #FAFAFA; color: #BDBDBD; cursor: default; }
.cal-check { font-size: 14px; font-weight: bold; }
.cal-slot-half { min-height: 22px; font-size: 10px; padding: 1px 3px; }
.cal-month-day {
    background: white;
    padding: 8px;
    min-height: 80px;
    cursor: pointer;
    transition: background 0.15s;
}
.cal-month-day:hover {
    background: #F5F5F5;
}
.cal-month-day.outside {
    background: #FAFAFA;
    color: #BDBDBD;
}
.cal-month-day.today {
    background: #E3F2FD;
}
.cal-month-header {
    background: #FAFAFA;
    padding: 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: #666;
}
.cal-scroll-container {
    max-height: 600px;
    overflow-y: auto;
}

/* Zone-colored header accents */
.cal-header-zone-0 { border-top: 3px solid var(--zone-color-0); }
.cal-header-zone-1 { border-top: 3px solid var(--zone-color-1); }
.cal-header-zone-2 { border-top: 3px solid var(--zone-color-2); }
.cal-header-zone-3 { border-top: 3px solid var(--zone-color-3); }
.cal-header-zone-4 { border-top: 3px solid var(--zone-color-4); }
.cal-header-zone-5 { border-top: 3px solid var(--zone-color-5); }
.cal-header-zone-6 { border-top: 3px solid var(--zone-color-6); }
.cal-header-zone-7 { border-top: 3px solid var(--zone-color-7); }

/* Zone-tinted selected slots */
.cal-selected-zone-0 { background: var(--zone-tint-0); color: var(--zone-color-0); border: 2px solid var(--zone-color-0); font-weight: 600; }
.cal-selected-zone-1 { background: var(--zone-tint-1); color: var(--zone-color-1); border: 2px solid var(--zone-color-1); font-weight: 600; }
.cal-selected-zone-2 { background: var(--zone-tint-2); color: var(--zone-color-2); border: 2px solid var(--zone-color-2); font-weight: 600; }
.cal-selected-zone-3 { background: var(--zone-tint-3); color: var(--zone-color-3); border: 2px solid var(--zone-color-3); font-weight: 600; }
.cal-selected-zone-4 { background: var(--zone-tint-4); color: var(--zone-color-4); border: 2px solid var(--zone-color-4); font-weight: 600; }
.cal-selected-zone-5 { background: var(--zone-tint-5); color: var(--zone-color-5); border: 2px solid var(--zone-color-5); font-weight: 600; }
.cal-selected-zone-6 { background: var(--zone-tint-6); color: var(--zone-color-6); border: 2px solid var(--zone-color-6); font-weight: 600; }
.cal-selected-zone-7 { background: var(--zone-tint-7); color: var(--zone-color-7); border: 2px solid var(--zone-color-7); font-weight: 600; }

/* Row select button in time label */
.cal-row-select {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #ccc;
    background: white;
    cursor: pointer;
    font-size: 10px;
    margin-right: 4px;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.cal-row-select:hover {
    background: #E3F2FD;
    border-color: #1976D2;
}
.cal-row-select.all-selected {
    background: #BBDEFB;
    border-color: #1976D2;
    color: #1565C0;
}

/* Zone color legend strip */
.cal-zone-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 6px 0;
    align-items: center;
}
.cal-zone-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #555;
}
.cal-zone-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Checkout bar zone group */
.checkout-zone-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.checkout-zone-group {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    white-space: nowrap;
}
.checkout-zone-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.checkout-zone-divider {
    color: #ccc;
    margin: 0 2px;
}

/* Mobile: responsive calendar */
@media (max-width: 600px) {
    .cal-slot {
        min-height: 28px;
        font-size: 10px;
    }
    .cal-header {
        font-size: 10px;
        padding: 4px 2px;
    }
    .cal-time-label {
        font-size: 10px;
        padding: 2px 4px;
    }
    .cal-month-day {
        min-height: 60px;
        padding: 4px;
    }
    .cal-row-select {
        width: 18px;
        height: 18px;
        margin-right: 2px;
    }
    .checkout-zone-groups {
        display: none;
    }
    .checkout-mobile-summary {
        display: flex !important;
    }
    .cal-zone-legend {
        gap: 8px;
    }
    .cal-zone-legend-item {
        font-size: 11px;
    }
}
@media (min-width: 601px) {
    .checkout-mobile-summary {
        display: none !important;
    }
}

/* === Tournament Bracket === */
.bracket-container {
    display: flex;
    overflow-x: auto;
    padding: 16px 0;
    align-items: stretch;
    -webkit-overflow-scrolling: touch;
}

.bracket-round {
    min-width: 200px;
    flex-shrink: 0;
}

.bracket-matches {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: space-around;
    min-height: 100%;
}

.bracket-match {
    border: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.12));
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s;
    background: var(--mud-palette-surface);
    position: relative;
}

.bracket-match:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bracket-match.completed {
    border-color: rgba(76, 175, 80, 0.3);
}

.bracket-match.in-progress {
    border-color: rgba(33, 150, 243, 0.5);
    border-width: 2px;
}

.bracket-match.bye {
    opacity: 0.5;
}

.bracket-team {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 8px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.08));
}

.bracket-team:last-child {
    border-bottom: none;
}

.bracket-team.winner {
    font-weight: bold;
    background: rgba(76, 175, 80, 0.1);
}

.bracket-seed {
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
    min-width: 18px;
    text-align: center;
}

.bracket-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bracket-score {
    font-weight: bold;
    min-width: 20px;
    text-align: right;
}

.bracket-time {
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
    text-align: center;
    padding: 2px 6px;
    border-top: 1px solid var(--mud-palette-lines-default, rgba(0,0,0,0.08));
}

/* === Bracket Connectors === */
.bracket-connectors {
    display: flex;
    flex-direction: column;
    width: 40px;
    flex-shrink: 0;
    padding-top: 28px;
}

.bracket-connector-group {
    flex: 1;
    position: relative;
}

.bracket-connector-group.merge::before {
    content: '';
    position: absolute;
    top: 25%;
    bottom: 25%;
    left: 0;
    width: 50%;
    border-top: 2px solid var(--mud-palette-lines-default, rgba(0,0,0,0.2));
    border-bottom: 2px solid var(--mud-palette-lines-default, rgba(0,0,0,0.2));
    border-right: 2px solid var(--mud-palette-lines-default, rgba(0,0,0,0.2));
}

.bracket-connector-group.merge::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    right: 0;
    height: 2px;
    background: var(--mud-palette-lines-default, rgba(0,0,0,0.2));
    transform: translateY(-50%);
}

.bracket-connector-group.straight::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--mud-palette-lines-default, rgba(0,0,0,0.2));
    transform: translateY(-50%);
}

/* === Leaderboard === */
.leaderboard-hero-card {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 24px 16px 16px;
}
.hero-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}
.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.hero-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
}
.hero-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hero-initials {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}
.hero-stat-value {
    font-weight: 800;
    line-height: 1.1;
    color: #1a1a2e !important;
}
.hero-stat-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
}
.hero-content .mud-typography-subtitle1 {
    color: #1a1a2e !important;
}
.hero-content .mud-typography-body2 {
    color: #666 !important;
}

/* Player card (mobile) */
.leaderboard-player-card {
    border-radius: 8px;
    overflow: hidden;
}
.lpc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}
.lpc-rank {
    font-weight: 800;
    font-size: 1rem;
    min-width: 28px;
    color: #555;
}
.lpc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    overflow: hidden;
}
.lpc-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.lpc-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.65rem;
    flex-shrink: 0;
}
.lpc-info {
    flex: 1;
    min-width: 0;
}
.lpc-info .mud-typography-subtitle2 {
    color: #1a1a2e !important;
}
.lpc-jersey {
    font-weight: 600;
    color: #999;
    font-size: 0.85rem;
}
.lpc-stats {
    display: flex;
    justify-content: space-around;
    padding: 6px 12px;
    background: rgba(0,0,0,0.02);
}
.lpc-stat-cell {
    text-align: center;
    min-width: 40px;
}
.lpc-stat-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a1a2e;
}
.lpc-stat-value.highlighted {
    color: #FF6B00;
}
.lpc-stat-label {
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
}
.lpc-expanded {
    padding: 0 12px 4px;
}
.lpc-totals {
    padding: 4px 0;
}
.lpc-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.lpc-toggle:hover {
    background: rgba(0,0,0,0.04);
}

/* Desktop table */
.leaderboard-table-wrapper {
    overflow-x: auto;
}
.leaderboard-table-wrapper td,
.leaderboard-table-wrapper th {
    color: #1a1a2e !important;
}
.sorted-col {
    background: rgba(255, 107, 0, 0.08);
    font-weight: 600;
}

@media (max-width: 600px) {
    .leaderboard-hero-card {
        padding: 16px 12px 12px;
    }
    .hero-avatar {
        width: 44px;
        height: 44px;
    }
    .lpc-stats {
        padding: 4px 8px;
    }
    .lpc-stat-cell {
        min-width: 32px;
    }
}
