* {
    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;
}

/* 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 input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    flex: 1;
}

.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;
}

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

/* 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 */
.splash-hero {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 3rem 0;
}

.splash-hero-text {
    flex: 1;
}

.splash-hero-text h1 {
    font-size: 2.4rem;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.splash-tagline {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
}

.splash-ctas {
    display: flex;
    gap: 1rem;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    border-radius: 6px;
}

.splash-hero-graphic {
    flex: 1;
    max-width: 400px;
}

.splash-hero-graphic img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

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

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

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

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

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

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

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

.splash-bottom-cta {
    text-align: center;
    padding: 3rem 0 1rem;
}

.splash-bottom-cta h2 {
    margin-bottom: 1rem;
}

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

.splash-upcoming h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

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

.upcoming-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #333;
}

.upcoming-date {
    color: #3498db;
    font-weight: 600;
    white-space: nowrap;
    min-width: 100px;
}

.upcoming-name {
    font-weight: 500;
}

.upcoming-classes {
    color: #666;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .splash-hero {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
        padding: 2rem 0;
    }

    .splash-ctas {
        justify-content: center;
    }

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

    .splash-hero-text h1 {
        font-size: 1.8rem;
    }

    .upcoming-card {
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
    }
}
