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

:root {
    /* Primary colors - matching app */
    --primary: #1e3a8a;
    --primary-light: #dbeafe;
    --primary-lightest: #f0f9ff;

    /* Status colors */
    --success: #16a34a;
    --success-dark: #047857;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --danger: #dc2626;
    --danger-light: #fef2f2;

    /* Grays - matching app */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Medal colors */
    --gold-bg: #fef3c7;
    --gold-text: #b45309;
    --silver-bg: #e5e7eb;
    --silver-text: #374151;
    --bronze-bg: #fed7aa;
    --bronze-text: #c2410c;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--white);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - matching app style */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    margin: 0 -1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border-radius: 9999px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-400);
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.1); }
}

/* Main content */
main {
    flex: 1;
    padding: 1.5rem 0;
}

.view {
    display: block;
}

.view.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Event list */
.event-list {
    display: grid;
    gap: 1rem;
}

/* Day grouping */
.day-group {
    background: var(--white);
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    background: var(--gray-50);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.day-header:hover {
    background: var(--gray-100);
}

.day-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.day-expand-icon {
    font-size: 0.75rem;
    color: var(--gray-500);
    width: 1rem;
}

.day-label {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.9375rem;
}

.day-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.day-active-badge {
    background: rgba(22, 163, 74, 0.15);
    color: var(--success);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
}

.day-event-count {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.day-content {
    border-top: 1px solid var(--gray-200);
}

/* Status groups within a day */
.status-group {
    padding: 0.75rem 1rem;
}

.status-group:not(:last-child) {
    border-bottom: 1px solid var(--gray-100);
}

.status-group-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.status-group-active .status-group-header {
    color: var(--success);
}

.status-group-pending .status-group-header {
    color: var(--warning-dark);
}

.status-group-completed .status-group-header {
    color: var(--gray-400);
}

.status-group-events {
    display: grid;
    gap: 0.5rem;
}

.event-card {
    background: var(--white);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
}

.event-card:hover {
    border-color: var(--primary);
    background: var(--primary-lightest);
}

.event-card-info h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.event-card-meta {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: rgba(22, 163, 74, 0.15);
    color: var(--success-dark);
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.status-badge.completed {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Disclaimer */
.disclaimer {
    background: var(--warning);
    color: #000;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    text-align: center;
}

/* Event view */
.event-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

.event-meta {
    font-size: 0.875rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.separator {
    color: var(--gray-300);
}

.last-update-inline {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
}

.controls label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-right: 0.5rem;
}

.controls select,
.controls input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: var(--white);
    color: var(--gray-800);
}

.controls select:focus,
.controls input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
}

/* Standalone search container */
.search-container {
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--white);
    color: var(--gray-800);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Recently timed */
.recently-timed {
    margin-bottom: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-lightest) 0%, var(--white) 100%);
    border-radius: 0.5rem;
    border: 1px solid var(--primary-light);
}

.recently-timed.hidden {
    display: none;
}

.recently-timed-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.recently-timed-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.recent-athlete {
    background: var(--white);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.recent-athlete-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-athlete-bib {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.recent-athlete-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-athlete-team {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.recent-athlete-laps {
    border-top: 1px solid var(--gray-100);
    padding-top: 0.5rem;
}

.recent-lap-row {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.75rem;
    color: var(--gray-700);
    padding: 0.125rem 0;
}

/* Time to Target (Podium, Top 10, etc.) */
.recent-time-to-target {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, #e0e7ff 100%);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 0.5rem 0.625rem;
    margin-top: 0.5rem;
}

.time-target-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.time-target-value {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
}

/* Key Insights */
.recent-athlete-insights {
    border-top: 1px solid var(--gray-100);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.insight-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    background: var(--gray-50);
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    color: var(--gray-600);
}

.insight-item:last-child {
    margin-bottom: 0;
}

.insight-item.insight-high {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.insight-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.insight-item.insight-high .insight-icon {
    stroke: var(--primary);
}

/* Team filters */
.team-filters {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--gray-50);
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
}

.team-filters.hidden {
    display: none;
}

.team-filters-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
}

.team-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.team-btn {
    padding: 0.375rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.15s;
}

.team-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lightest);
}

.team-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.team-btn-count {
    font-size: 0.6875rem;
    color: var(--gray-400);
    margin-left: 0.25rem;
}

.team-btn.active .team-btn-count {
    color: rgba(255, 255, 255, 0.7);
}

.team-btn-clear {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--gray-600);
}

.team-btn-clear:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

/* Stats bar */
.stats-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: var(--primary);
    border-radius: 0.5rem;
    color: var(--white);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
}

.stat-label {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Results table */
.results-table-wrapper {
    background: var(--white);
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.results-table th {
    background: var(--gray-50);
    padding: 0.5rem 0.375rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
}

.results-table th.lap-header {
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}

.results-table th.lap-header:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.results-table th.lap-header.active {
    background: var(--primary-light);
    color: var(--primary);
}

.results-table td {
    padding: 0.5rem 0.375rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    vertical-align: middle;
}

.results-table tbody tr:hover {
    background: var(--primary-lightest);
}

.results-table tbody tr.highlight-team {
    background-color: #bfdbfe !important;
}

.results-table tbody tr.highlight-team:hover {
    background-color: #93c5fd !important;
}

.results-table tbody tr.highlight-recent {
    background-color: #bbf7d0 !important;
}

.results-table tbody tr.highlight-recent:hover {
    background-color: #86efac !important;
}

.results-table tbody tr.highlight-athlete {
    background-color: #fde68a !important;
}

.results-table tbody tr.highlight-athlete:hover {
    background-color: #fcd34d !important;
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.results-table tbody tr.highlight {
    background: var(--gold-bg);
    animation: highlight-fade 3s ease-out;
}

@keyframes highlight-fade {
    from { background: var(--gold-bg); }
    to { background: transparent; }
}

/* Column widths - desktop */
.col-pos {
    width: 44px;
    text-align: center;
}

.col-bib {
    width: 50px;
    text-align: center;
}

.col-name {
    width: 100px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-class {
    width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--gray-600);
    font-size: 0.8125rem;
}

.col-team {
    width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-time {
    width: 70px;
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
}

.col-lap {
    width: 65px;
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
}

/* Position badge styling */
.position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--gray-700);
    background: var(--gray-100);
    border-radius: 4px;
    padding: 0 4px;
}

/* Medal positions */
.position-1 {
    background: var(--gold-bg);
    color: var(--gold-text);
}

.position-2 {
    background: var(--silver-bg);
    color: var(--silver-text);
}

.position-3 {
    background: var(--bronze-bg);
    color: var(--bronze-text);
}

.bib-number {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--primary);
}

/* Name cell with optional team subtitle on mobile */
.athlete-name {
    font-weight: 500;
    color: var(--gray-900);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.athlete-team-mobile {
    display: none;
    font-size: 0.6875rem;
    color: var(--gray-500);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.time-behind {
    color: var(--gray-600);
}

.time-behind.leader {
    color: var(--success);
    font-weight: 600;
}

.status-pending {
    color: var(--gray-400);
    font-style: italic;
}

/* =============================================
   MOBILE CARD VIEW
   ============================================= */

.results-cards {
    display: none;
}

.result-card {
    display: flex;
    align-items: stretch;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.result-card:last-child {
    margin-bottom: 0;
}

/* Highlighting for cards */
.result-card.highlight-recent {
    border-color: #22c55e;
    background: linear-gradient(to right, #dcfce7, var(--white) 40%);
}

.result-card.highlight-athlete {
    border-color: #eab308;
    background: linear-gradient(to right, #fef9c3, var(--white) 40%);
}

.result-card.highlight-team {
    border-color: #3b82f6;
    background: linear-gradient(to right, #dbeafe, var(--white) 40%);
}

/* Position column on left */
.card-position {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 12px 8px;
    background: var(--gray-50);
    border-right: 1px solid var(--gray-200);
}

.card-position .position {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--gray-700);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.card-position .position.position-1 {
    background: var(--gold-bg);
    color: var(--gold-text);
}

.card-position .position.position-2 {
    background: var(--silver-bg);
    color: var(--silver-text);
}

.card-position .position.position-3 {
    background: var(--bronze-bg);
    color: var(--bronze-text);
}

/* Main content area */
.card-content {
    flex: 1;
    padding: 10px 12px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-athlete {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.card-name {
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-bib {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.card-team {
    font-size: 0.875rem;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

/* Lap times row */
.card-laps {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.card-lap {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--gray-50);
    border-radius: 6px;
    padding: 5px 10px;
    min-width: 58px;
}

.card-lap-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-lap-time {
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-700);
}

.card-lap-time.leader {
    color: var(--success);
    font-weight: 700;
}

.card-lap-time.pending {
    color: var(--gray-400);
}

.card-lap-pos {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--gray-500);
    font-family: inherit;
}

/* Pending athlete card */
.result-card.pending .card-position {
    background: var(--gray-100);
}

.result-card.pending .card-position .position {
    background: var(--gray-200);
    color: var(--gray-400);
}

/* No results */
.no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
}

.no-results p {
    font-size: 1rem;
}

/* Not found */
.not-found {
    text-align: center;
    padding: 4rem 2rem;
}

.not-found h1 {
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.not-found p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.btn:hover {
    background: #152e6e;
}

/* Footer */
.footer {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.8125rem;
    border-top: 1px solid var(--gray-200);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--gray-500);
}

/* Live indicator for header */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--danger-light);
    color: var(--danger);
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.live-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: live-pulse 1.5s infinite;
}

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

/* Responsive - Tablet */
@media (max-width: 900px) {
    .col-team,
    .col-class {
        display: none;
    }

    .athlete-team-mobile {
        display: block;
    }

    .col-bib {
        width: 40px;
    }

    .col-lap {
        width: 58px;
    }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
    }

    .stats-bar {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .stat {
        flex: 1;
        min-width: 70px;
    }

    .recently-timed-list {
        grid-template-columns: 1fr;
    }

    .recent-athlete {
        padding: 0.625rem;
    }

    .insight-item {
        font-size: 0.75rem;
    }

    /* Table adjustments for tablet */
    .results-table th,
    .results-table td {
        padding: 0.5rem 0.25rem;
    }

    .col-pos {
        width: 38px;
    }

    .col-lap {
        width: 52px;
        font-size: 0.75rem;
    }

    .results-table th {
        font-size: 0.625rem;
    }
}

/* =============================================
   MOBILE BREAKPOINT - Switch to Card View
   ============================================= */
@media (max-width: 600px) {
    /* Hide table, show cards */
    .results-table-wrapper {
        display: none;
    }

    .results-cards {
        display: block;
    }

    /* Smaller stats bar */
    .stats-bar {
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.625rem;
    }

    /* Compact team filters */
    .team-filters {
        padding: 0.5rem 0.75rem;
    }

    .team-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .team-btn-count {
        display: none;
    }

    /* Compact controls */
    .controls {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .controls select,
    .controls input {
        padding: 0.375rem 0.5rem;
        font-size: 0.8125rem;
    }

    .search-box {
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.25rem;
    }

    .header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .event-header {
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .event-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .separator {
        display: none;
    }

    /* Tighter card spacing */
    .result-card {
        margin-bottom: 6px;
    }

    .card-position {
        min-width: 48px;
        padding: 10px 6px;
    }

    .card-position .position {
        font-size: 1.25rem;
        min-width: 36px;
        height: 36px;
    }

    .card-content {
        padding: 8px 10px;
    }

    .card-name {
        font-size: 1rem;
    }

    .card-bib {
        font-size: 0.8125rem;
    }

    .card-team {
        font-size: 0.8125rem;
    }

    .card-lap {
        padding: 4px 8px;
        min-width: 52px;
    }

    .card-lap-time {
        font-size: 0.875rem;
    }

    .card-lap-pos {
        font-size: 0.75rem;
    }
}

@media (max-width: 380px) {
    .card-position {
        min-width: 44px;
    }

    .card-position .position {
        font-size: 1.125rem;
        min-width: 32px;
        height: 32px;
    }

    .card-athlete {
        flex-wrap: wrap;
        gap: 4px;
    }

    .card-name {
        font-size: 0.9375rem;
        width: 100%;
    }

    .card-bib {
        font-size: 0.75rem;
    }

    .card-team {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .card-lap {
        padding: 3px 6px;
        min-width: 48px;
    }

    .card-lap-label {
        font-size: 0.625rem;
    }

    .card-lap-time {
        font-size: 0.8125rem;
    }

    .card-lap-pos {
        font-size: 0.6875rem;
    }
}
