*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    padding: 40px 20px;
    text-align: center;
}

header h1 {
    margin: 0 0 8px;
    font-size: 2rem;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.85;
    margin: 0;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px 24px;
    text-align: center;
    min-width: 140px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-detail {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
}

.results-section {
    margin-top: 24px;
}

.results-section h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #1a1a2e;
}

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-select {
    background: #fff;
    border: 2px solid #1a1a2e;
    color: #1a1a2e;
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    appearance: auto;
}

.filter-select:focus {
    outline: none;
    border-color: #4a6fa5;
}

.filter-btn {
    background: #fff;
    border: 2px solid #d4a017;
    color: #d4a017;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #fef9e7;
}

.filter-btn.active {
    background: #d4a017;
    color: #fff;
}

.table-wrapper {
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: #1a1a2e;
    color: #fff;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
}

tbody tr:hover {
    background: #f0f4ff;
}

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

.col-num {
    width: 50px;
    text-align: center;
    color: #888;
}

.col-date {
    white-space: nowrap;
}

.col-time {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    font-weight: 600;
}

.col-rank {
    text-align: right;
}

.best-time {
    color: #16a34a;
    font-weight: 700;
}

.sub3-time {
    color: #d4a017;
    font-weight: 700;
}

.star {
    color: #d4a017;
    margin-right: 4px;
}

footer {
    text-align: center;
    padding: 24px;
    color: #888;
    font-size: 0.8rem;
}

footer a {
    color: #555;
}

/* PB row glow */
@keyframes pb-shimmer {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(22, 163, 74, 0.08); }
}

tbody tr.pb-row {
    animation: pb-shimmer 3s ease-in-out infinite;
}

tbody tr.pb-row td:first-child {
    box-shadow: inset 3px 0 0 #16a34a;
}

tbody tr.pb-row:hover {
    background: rgba(22, 163, 74, 0.12);
}

/* DNF row */
tbody tr.dnf-row {
    opacity: 0.55;
}

/* Country flags */
.country-flag {
    margin-right: 6px;
}

/* Achievements */
.achievements {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 0;
}

.achievements-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 10px;
    padding: 14px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 220px;
}

.badge-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.badge-icon.gold { background: linear-gradient(135deg, #d4a017, #f0c75e); color: #fff; }
.badge-icon.blue { background: linear-gradient(135deg, #1a1a2e, #2d4a7a); color: #fff; }
.badge-icon.green { background: linear-gradient(135deg, #16a34a, #4ade80); color: #fff; }
.badge-icon.purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff; }

.badge-content {
    display: flex;
    flex-direction: column;
}

.badge-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1a1a2e;
}

.badge-detail {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .stats {
        gap: 16px;
    }

    .stat-card {
        min-width: 120px;
        padding: 12px 16px;
    }

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

    th, td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .achievements-grid {
        gap: 10px;
    }

    .badge {
        min-width: 100%;
        padding: 10px 14px;
    }
}
