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

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    padding: 10px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
}

.main-title {
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    margin: 20px 0;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.filter-container {
    max-width: 800px;
    margin: 15px auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.filter-label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    font-size: 16px;
}

.filter-input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 18px;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
}

.filter-input:focus {
    border-color: #ADD8E6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(173, 216, 230, 0.2);
}

.jump-section {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 15px;
}

.jump-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.jump-input {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 18px;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}

.jump-input:focus {
    border-color: #4CAF50;
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.jump-button {
    padding: 12px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
}

.jump-button:hover {
    background: #45a049;
}

.jump-button:active {
    background: #3d8b40;
}

.clear-button {
    padding: 12px 24px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    width: 100%;
}

.clear-button:hover {
    background: #d32f2f;
}

.clear-button:active {
    background: #c62828;
}

.results-summary {
    text-align: center;
    margin: 15px 0;
    font-size: 16px;
    color: #666;
}

.no-matches {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 18px;
}

.error-view {
    background: #ffebee;
    border: 3px solid #f44336;
    border-radius: 8px;
    padding: 40px 20px;
    margin: 40px auto;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.error-icon {
    font-size: 48px;
    color: #f44336;
    margin-bottom: 20px;
    display: block;
}

.error-message {
    font-size: 20px;
    color: #d32f2f;
    font-weight: bold;
    line-height: 1.4;
}

.race-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.race-table th,
.race-table td {
    border: 2px solid black;
    padding: 8px;
    text-align: center;
    font-size: 16px;
}

.race-header {
    background: #ADD8E6;
    font-weight: bold;
    font-size: 18px;
}

.race-title {
    background: white;
    font-weight: bold;
    font-size: 18px;
}

.color-indicator {
    background: #ADD8E6;
    font-weight: bold;
    font-size: 18px;
    width: 60px;
}

.subheader {
    background: white;
    font-weight: bold;
    font-size: 14px;
}

.lane-col {
    width: 60px;
}

.place-col {
    width: 80px;
}

.team-col {
    text-align: left;
    padding-left: 12px;
}

.time-col {
    width: 100px;
}

.advancement-row {
    background: white;
    text-align: center;
    font-size: 14px;
}

.advancement-row td {
    padding: 12px;
}

.penalty-row {
    text-align: center;
    font-size: 14px;
}

.penalty-row td {
    padding: 12px;
}

.updated-time-row {
    background: #e6ffe6;
    color: #006600;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
}

.updated-time-row td,
.results-pending-row td {
    padding: 8px;
}

.results-pending-row {
    background: #ffe5e5;
    color: #cc0000;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
}

.race-number-cell {
    background: #ADD8E6;
    font-weight: bold;
    width: 60px;
}

@media (max-width: 700px) {
    .filter-container {
        margin: 10px auto;
        padding: 15px;
    }

    .filter-row {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .jump-section {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .jump-group {
        margin-bottom: 10px;
    }

    .main-title {
        font-size: 24px;
        margin: 15px 0;
    }

    .error-view {
        margin: 20px 10px;
        padding: 30px 15px;
    }

    .error-icon {
        font-size: 36px;
    }

    .error-message {
        font-size: 16px;
    }

    .race-table th,
    .race-table td {
        font-size: 12px;
        padding: 4px 2px;
    }

    .race-header,
    .race-title {
        font-size: 14px;
    }

    .team-col {
        padding-left: 6px;
    }

    .lane-col,
    .place-col,
    .time-col {
        width: auto;
    }
}

/* ═══════════════════════════════════════════════
   EVENT INFO BAR
═══════════════════════════════════════════════ */
.event-info {
    max-width: 800px;
    margin: 0 auto 20px auto;
    padding: 32px 20px 8px;
}

.event-info__top-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.event-info__icon {
    width: auto;
    max-width: 300px;
    height: auto;
    flex-shrink: 0;
}

.event-info__text-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.event-info__date {
    font-size: 22px;
    font-weight: 700;
    color: #222;
}

.event-info__location {
    font-size: 18px;
    font-weight: 600;
    color: #444;
}

/* ═══════════════════════════════════════════════
   SECTION HEADINGS
═══════════════════════════════════════════════ */
.section-heading {
    max-width: 800px;
    margin: 0 auto 12px auto;
    padding: 0 20px; /* matches filter-container padding so text aligns */
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.section-divider {
    max-width: 800px;
    margin: 20px auto 28px auto;  /* top | sides | bottom */
    border-bottom: 2px solid #ddd;
}

/* ═══════════════════════════════════════════════
   MARSHALLING SECTION (top of page, always visible)
═══════════════════════════════════════════════ */
.marshalling-panel {
    max-width: 800px;
    margin: 0 auto 28px auto;
    /* No side padding — marshal cards use margin: auto and align with
       filter-container / race-table which also use margin: auto */
}

.marshal-cards-row {
    display: flex;
    gap: 16px;
    margin: 0 20px 8px 20px; /* 20px sides matches filter-container padding */
}

.marshal-card {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px 16px;
    text-align: center;
    border: 2px solid #ddd;
}

.marshal-card--current {
    border-color: #ADD8E6;
    background: #f0f9ff;
}

.marshal-card__label {
    font-size: 14px;
    font-weight: bold;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-family: Arial, sans-serif;
}

.marshal-card--current .marshal-card__label {
    color: #2a7da8;
}

.marshal-card__num {
    font-size: 64px;
    font-weight: bold;
    color: #333;
    line-height: 1;
    font-family: Arial, sans-serif;
}

.marshal-card--current .marshal-card__num {
    font-size: 80px;
    color: #1a6a9a;
}

.marshal-updated {
    text-align: center;
    font-size: 13px;
    color: #999;
    font-family: Arial, sans-serif;
}

/* Inline loading/error states for marshalling — compact, not full-page */
.marshalling-loading-inline {
    text-align: center;
    padding: 16px 20px;
    color: #666;
    font-size: 15px;
}

.marshalling-error-inline {
    background: #ffebee;
    border: 2px solid #f44336;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    font-size: 15px;
    font-weight: bold;
    color: #d32f2f;
    margin: 0 20px; /* matches marshal-cards-row side inset */
}

.marshalling-not-started {
    background: #fff8e1;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 0 20px; /* matches marshal-cards-row side inset */
    display: flex;
    align-items: center;
    gap: 10px;
}

.marshalling-not-started__icon {
    font-size: 20px;
}

.marshalling-not-started__text {
    font-size: 15px;
    font-weight: bold;
    color: #7a5800;
}

.marshalling-retry-btn {
    padding: 10px 24px;
    background: #1a6a9a;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    width: auto;
    -webkit-tap-highlight-color: transparent;
}

.marshalling-retry-btn:active {
    opacity: 0.85;
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════
   MOBILE — marshalling
═══════════════════════════════════════════════ */
@media (max-width: 700px) {
    .event-info {
        padding: 24px 15px 6px;
    }

    .event-info__top-row {
        gap: 12px;
    }

    .event-info__icon {
        max-width: 200px;
    }

    .event-info__date {
        font-size: 18px;
        font-weight: 700;
    }

    .event-info__location {
        font-size: 15px;
        font-weight: 600;
    }

    .marshal-cards-row {
        gap: 12px;
        margin-left: 15px;
        margin-right: 15px;
    }

    .marshalling-error-inline,
    .marshalling-not-started {
        margin: 0 15px;
    }

    .marshal-card {
        padding: 16px 10px;
    }

    .marshal-card__label {
        font-size: 12px;
    }

    .marshal-card__num {
        font-size: 48px;
    }

    .marshal-card--current .marshal-card__num {
        font-size: 64px;
    }
}