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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
}

header {
    background: #2c3e50;
    padding: 1rem 2rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    color: white;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-user {
    color: #ecf0f1;
    font-weight: 500;
}

.btn-nav {
    background: rgba(255,255,255,0.15);
    color: white;
}

.btn-nav:hover {
    background: rgba(255,255,255,0.25);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #666;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin-bottom: 1rem;
}

h1 {
    color: #2c3e50;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #ecf0f1;
    color: #333;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    background: #bdc3c7;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* Messages */
.messages {
    margin-bottom: 1rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.message.success {
    background: #d4edda;
    color: #155724;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
}

/* Forms */
.form {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 500px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.form-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.inline-form.inline-form-stacked {
    flex-direction: column;
}

.inline-form-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.inline-form > input,
.inline-form-row > input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    flex: 1;
    min-width: 0;
}

.inline {
    display: inline;
}

/* Race list */
.race-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.race-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.race-card h2 {
    margin-bottom: 0.5rem;
}

.race-card h2 a {
    color: #2c3e50;
    text-decoration: none;
}

.race-card h2 a:hover {
    color: #3498db;
}

.race-card-flyer {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #3498db;
    text-decoration: none;
    margin-top: 0.5rem;
}

.race-card-flyer:hover {
    text-decoration: underline;
}

/* Field info section */
.field-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
}

.field-info-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.field-info-item svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: #6c757d;
}

.field-info-item p {
    margin: 0.2rem 0 0 0;
    font-size: 0.9rem;
    color: #555;
}

.field-info-item strong {
    font-size: 0.9rem;
}

.field-info-item a {
    font-size: 0.9rem;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.field-info-item a:hover {
    text-decoration: underline;
}

.badge {
    display: inline-block;
    background: #27ae60;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.team-badge {
    font-size: 0.75em;
    color: #7f8c8d;
    font-weight: 600;
}

/* Page header with inline action */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Race detail */
.race-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Breadcrumb navigation */
.breadcrumb {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2c3e50;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb-sep {
    margin: 0 0.5rem;
    color: #999;
}

.breadcrumb-current {
    color: #2c3e50;
}

.breadcrumb-select {
    font-size: inherit;
    font-weight: inherit;
    color: #2c3e50;
    background: transparent;
    border: none;
    border-bottom: 2px solid #3498db;
    padding: 0 1.5rem 0.1rem 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233498db' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
}

.breadcrumb-select:focus {
    outline: none;
    border-bottom-color: #2980b9;
}

.breadcrumb-select-public {
    color: white;
    border-bottom-color: rgba(255,255,255,0.6);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E");
}

.breadcrumb-select-public:focus {
    border-bottom-color: white;
}

.race-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.race-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section h2 {
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* Racer list */
.racer-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.racer-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ecf0f1;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.racer-name-text {
    font-weight: 500;
    min-width: 100px;
}

.email-edit-form {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.email-edit-form input[type="email"] {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 180px;
}

.email-edit-form input[type="tel"] {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 140px;
}

.send-email-form {
    margin-top: 1rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f5f5f5;
    font-weight: 600;
}

tr:hover {
    background: #f9f9f9;
}

.racer-name {
    background: #3498db;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Round sections */
.round {
    margin-bottom: 1.5rem;
}

.round h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

/* Results table */
.results-table {
    max-width: 400px;
}

.results-table select {
    padding: 0.5rem;
    font-size: 1rem;
}

/* Empty states */
.empty-state {
    color: #666;
    padding: 2rem;
    text-align: center;
}

.empty-state a {
    color: #3498db;
}

.info {
    color: #666;
    font-style: italic;
}

/* Detailed results */
.points-info {
    font-size: 0.8rem;
    font-weight: normal;
    color: #666;
}

.heat-results {
    margin-bottom: 1rem;
    margin-left: 1rem;
}

.heat-results h4 {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.results-table-small {
    max-width: 350px;
    font-size: 0.9rem;
}

.results-table-small th,
.results-table-small td {
    padding: 0.4rem 0.6rem;
}

.results-table-small th:first-child,
.results-table-small td:first-child {
    width: 50px;
}

.results-table-small th:last-child,
.results-table-small td:last-child {
    width: 60px;
    text-align: center;
}

/* Legal pages */
.legal-page {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 800px;
}

.legal-page h2 {
    margin-top: 1.5rem;
}

.legal-page p,
.legal-page ul {
    margin-bottom: 0.75rem;
}

.legal-page ul {
    padding-left: 1.5rem;
}

.legal-page li {
    margin-bottom: 0.25rem;
}

.legal-updated {
    color: #666;
    font-style: italic;
}

/* Consent checkbox */
.consent-group {
    margin-top: 0.5rem;
}

.form-group .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #555;
}

.form-group .checkbox-label span {
    flex: 1;
    min-width: 0;
}

.form-group .checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.form-group .checkbox-label a {
    color: #3498db;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

/* Splash page */

/* Entrance animation */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-animate {
    animation: fadeSlideUp 0.5s ease-out both;
}

/* Splash-scoped typography */
.splash h1 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.splash h2 {
    font-weight: 700;
    letter-spacing: -0.01em;
    font-size: 1.15rem;
}

.splash h3 {
    font-weight: 600;
}

/* Hero */
.splash-hero {
    padding: 3rem;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff 0%, #eef4fb 100%);
    box-shadow: 0 8px 24px rgba(44, 62, 80, 0.08);
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.splash-hero-centered {
    text-align: left;
}

.splash-hero-centered h1 {
    font-size: 2.4rem;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    color: #2c3e50;
    max-width: 16ch;
}

.splash-kicker {
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(52, 152, 219, 0.12);
    color: #1f5f8b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.splash-subheadline {
    font-size: 1.1rem;
    color: #666;
    max-width: 500px;
    margin: 0 auto 1.5rem;
    line-height: 1.5;
}

.splash-cta-row {
    display: flex;
    justify-content: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.splash-btn-primary {
    background: #e7a921;
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.splash-btn-primary:hover {
    background: #d4991e;
}

.splash-btn-secondary {
    background: transparent;
    color: #2c3e50;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    border: 2px solid #2c3e50;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}

.splash-btn-secondary:hover {
    background: #2c3e50;
    color: white;
}

/* Hero image */
.splash-hero-centered .splash-hero-graphic {
    max-width: 640px;
    margin: 0 auto;
}

.splash-hero-image-wrap {
    background: radial-gradient(ellipse at center, rgba(44, 62, 80, 0.08) 0%, transparent 70%);
    padding: 1rem;
    border-radius: 16px;
}

.splash-hero-image-wrap img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.1);
}

.photo-credit {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.5rem;
    text-align: right;
}

.photo-credit a {
    color: #999;
    text-decoration: underline;
}

/* Race classes strip on splash */
.race-classes-strip {
    margin: 0 -2rem;
    padding: 2.5rem 2rem;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
}

.race-classes-strip h2 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 1.25rem;
}

.race-classes-row {
    display: flex;
    justify-content: center;
    gap: 0;
    max-width: 900px;
    margin: 0 auto;
}

.race-class-item {
    flex: 1;
    padding: 0 1.5rem;
    border-right: 1px solid #dee2e6;
    position: relative;
}

.race-class-item:last-child {
    border-right: none;
}

.race-class-name {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.race-class-desc {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.3;
}

.race-class-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-top: 0.4rem;
}

.race-class-tag.new {
    background: #e7a921;
    color: white;
}

.race-rules-link {
    margin-top: 1.5rem;
}

.race-rules-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #3498db;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
}

.race-rules-link a:hover {
    text-decoration: underline;
}

/* Admin rules section */
.rules-admin-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.rules-admin-section h2 {
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
}

.rules-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.rules-filename {
    font-size: 0.9rem;
    color: #6c757d;
}

.rules-upload-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Splash features */
.splash-features-band {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    margin: 0 -2rem;
    padding: 3.5rem 2rem;
}

.splash-section-intro {
    max-width: 760px;
    margin: 0 auto 1.5rem;
    text-align: center;
}

.splash-section-intro h2 {
    margin-bottom: 0.35rem;
    color: #2c3e50;
}

.splash-section-intro p {
    color: #5f6f7f;
}

.splash-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.splash-feature {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e8edf3;
    box-shadow: 0 2px 10px rgba(44, 62, 80, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.splash-feature:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(44, 62, 80, 0.12);
}

.splash-feature-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.splash-feature h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.splash-feature p {
    color: #666;
    font-size: 0.95rem;
}

/* Upcoming races on splash */
.splash-upcoming {
    padding: 3.5rem 0;
}

.splash-directions {
    max-width: 760px;
    margin: 3rem auto 0;
    background: #fff;
    border: 1px solid #e6edf5;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 3px 12px rgba(44, 62, 80, 0.08);
}

.splash-directions h2 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.splash-directions p {
    color: #5f6f7f;
}

.splash-host-club {
    margin-top: 0.75rem;
}

.splash-upcoming h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: #2c3e50;
}

.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 600px;
    margin: 0 auto;
}

.upcoming-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    background: white;
    padding: 1rem 1.15rem;
    border-radius: 10px;
    border: 1px solid #e6edf5;
    box-shadow: 0 3px 12px rgba(44, 62, 80, 0.08);
    color: #333;
}

.upcoming-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upcoming-bottom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.upcoming-date {
    background: #3498db;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    text-align: center;
    line-height: 1.3;
}

.upcoming-date-year {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.85;
}

.upcoming-name {
    font-weight: 600;
    font-size: 1rem;
}

.upcoming-classes {
    color: #666;
    font-size: 0.85rem;
    flex: 1;
}

/* Flyer upload */
.flyer-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.flyer-filename {
    font-weight: 500;
    color: #555;
}

.flyer-upload-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upcoming-flyer {
    margin-left: auto;
    color: #3498db;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.upcoming-flyer:hover {
    text-decoration: underline;
}

.empty-upcoming {
    max-width: 700px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .splash-hero {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 2rem 1.25rem;
    }

    .splash-hero-centered h1 {
        font-size: 1.8rem;
        max-width: 18ch;
        margin-left: auto;
        margin-right: auto;
    }

    .splash-subheadline {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .splash-cta-row .splash-btn-primary,
    .splash-cta-row .splash-btn-secondary {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        display: inline-flex;
        align-items: center;
    }

    .splash-cta-row {
        justify-content: center;
    }

    .splash-hero-centered {
        text-align: center;
    }

    .splash-hero-centered .splash-hero-graphic {
        max-width: 340px;
    }

    .race-classes-strip {
        margin: 0 -1rem;
        padding: 2rem 1rem;
    }

    .race-classes-row {
        flex-direction: column;
        gap: 0;
    }

    .race-class-item {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        padding: 0.75rem 0;
    }

    .race-class-item:last-child {
        border-bottom: none;
    }

    .splash-features-band {
        padding: 2.5rem 1rem;
    }

    .splash-feature {
        padding: 1.25rem;
    }

    .upcoming-card {
        padding: 1.25rem;
        gap: 0.75rem;
    }

    .upcoming-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }

    .upcoming-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .upcoming-flyer {
        margin-left: 0;
    }
}
