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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background-color 0.2s;
    min-height: 100vh;
}

#app {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#leaderboard-section, #result-section {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 800px;
    width: 100%;
}

h1 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

#start-btn {
    display: block;
    margin: 0 auto 20px;
    padding: 15px 40px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #4caf50;
    color: white;
    transition: transform 0.1s, background 0.2s;
}

#start-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

#leaderboard {
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.leaderboard-header {
    display: flex;
    padding: 12px 20px;
    background: #333;
    color: white;
    font-weight: bold;
    border-radius: 10px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
    margin-bottom: 8px;
}

.sortable-col {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
}

.sortable-col:hover {
    background: rgba(255,255,255,0.2);
}

.sortable-col.active {
    background: rgba(76, 175, 80, 0.8);
}

.leaderboard-item {
    display: flex;
    padding: 12px 20px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border-radius: 10px;
    align-items: center;
}

.leaderboard-item.rank-1 {
    background: gold;
    color: #333;
}

.leaderboard-item.rank-2 {
    background: silver;
    color: #333;
}

.leaderboard-item.rank-3 {
    background: #cd7f32;
    color: white;
}

.rank-col { 
    width: 60px; 
    text-align: center; 
    font-weight: bold; 
    flex-shrink: 0;
}
.username-col { 
    flex: 1; 
    min-width: 100px;
}
.date-col { 
    width: 100px; 
    text-align: center; 
    flex-shrink: 0;
}
.sortable-col { 
    width: 80px; 
    text-align: center; 
    flex-shrink: 0;
}
.avg-col { 
    width: 80px; 
    text-align: center; 
    flex-shrink: 0;
}
.min-col { 
    width: 80px; 
    text-align: center; 
    flex-shrink: 0;
}
.max-col { 
    width: 80px; 
    text-align: center; 
    flex-shrink: 0;
}

.btn {
    padding: 15px 40px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #4caf50;
    color: white;
    transition: transform 0.1s, background 0.2s;
}

.btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: #757575;
}

.btn-secondary:hover {
    background: #616161;
}

#test-section {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#test-area {
    text-align: center;
    color: white;
    user-select: none;
}

#status-text {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 20px;
}

#round-display {
    font-size: 24px;
    margin-top: 20px;
    opacity: 0.8;
}

#result-details {
    margin-bottom: 30px;
    text-align: left;
}

.result-stat {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

#username-input {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin-bottom: 15px;
    text-align: center;
}

#username-input:focus {
    outline: none;
    border-color: #4caf50;
}

#upload-section {
    margin-bottom: 20px;
    text-align: center;
}

#upload-btn {
    margin-top: 10px;
}

#result-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#result-buttons .btn {
    margin: 0;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    #app {
        padding: 10px;
    }

    #leaderboard-section, #result-section {
        padding: 20px;
        border-radius: 15px;
    }

    h1 {
        font-size: 24px;
    }

    .leaderboard-header, .leaderboard-item {
        font-size: 12px;
        padding: 10px 12px;
    }

    .leaderboard-scroll-wrapper {
        overflow-x: auto;
        margin: 0 -10px;
        padding: 0 10px;
        -webkit-overflow-scrolling: touch;
    }

    .leaderboard-scroll-wrapper::-webkit-scrollbar {
        height: 6px;
    }

    .leaderboard-scroll-wrapper::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 3px;
    }

    .leaderboard-scroll-wrapper p {
        min-width: 500px;
    }

    .date-col {
        display: none;
    }

    .rank-col {
        width: 40px;
        flex-shrink: 0;
    }

    .username-col {
        flex: 1;
        min-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sortable-col, .avg-col, .min-col, .max-col {
        width: 60px;
        flex-shrink: 0;
    }

    #result-details {
        font-size: 14px;
    }

    .result-stat {
        padding: 8px 0;
    }

    #username-input {
        font-size: 16px;
        padding: 12px;
    }

    #result-buttons {
        flex-direction: column;
        gap: 10px;
    }

    #result-buttons .btn {
        width: 100%;
    }

    #status-text {
        font-size: 32px;
    }

    #round-display {
        font-size: 18px;
    }
}