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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    width: 800px;
    height: 600px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    color: white;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
}

.game-area {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #333;
}

.note-tracks {
    display: flex;
    width: 100%;
    height: 100%;
}

.track {
    flex: 1;
    position: relative;
    border-right: 2px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.1) 0%, 
        rgba(0, 0, 0, 0.05) 50%, 
        rgba(0, 0, 0, 0.1) 100%);
}

.track:last-child {
    border-right: none;
}

.target-zone {
    position: absolute;
    bottom: 20px;
    left: 5px;
    right: 5px;
    height: 60px;
    background: radial-gradient(circle, #4a90e2 0%, #2c5aa0 100%);
    border-radius: 50%;
    border: 3px solid #ffffff;
    opacity: 0.8;
    transition: all 0.1s ease;
}

.target-zone.active {
    transform: scale(1.1);
    background: radial-gradient(circle, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.6);
    opacity: 1;
}

.notes-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
}

.note {
    position: absolute;
    left: 50%;
    top: -40px;
    width: 40px;
    height: 40px;
    transform: translateX(-50%);
    background: radial-gradient(circle, #ffffff 0%, #e0e0e0 100%);
    border-radius: 50%;
    border: 2px solid #333333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    animation: fall linear;
}

.note.perfect {
    background: radial-gradient(circle, #feca57 0%, #ff9ff3 100%);
    box-shadow: 0 0 15px rgba(254, 202, 87, 0.8);
}

.note.good {
    background: radial-gradient(circle, #48dbfb 0%, #0abde3 100%);
    box-shadow: 0 0 15px rgba(72, 219, 251, 0.8);
}

.note.miss {
    background: radial-gradient(circle, #ff6b6b 0%, #ee5a52 100%);
    opacity: 0.3;
}

@keyframes fall {
    from {
        top: -40px;
    }
    to {
        top: 100%;
    }
}

.controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.key-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.key {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #4a90e2 0%, #2c5aa0 100%);
    border: 3px solid #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    transition: all 0.1s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.key.active {
    transform: scale(0.95);
    background: radial-gradient(circle, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.6);
    filter: brightness(1.2);
}

.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.judgment {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 100;
    animation: judgmentPop 0.8s ease-out forwards;
}

@keyframes judgmentPop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.judgment.perfect {
    color: #feca57;
    text-shadow: 0 0 10px rgba(254, 202, 87, 0.8);
}

.judgment.good {
    color: #48dbfb;
    text-shadow: 0 0 10px rgba(72, 219, 251, 0.8);
}

.judgment.ok {
    color: #ff9ff3;
    text-shadow: 0 0 10px rgba(255, 159, 243, 0.8);
}

.judgment.miss {
    color: #ff6b6b;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
}

.uprate-display {
    color: #feca57;
    font-weight: bold;
}

.control-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.judge-selector, .difficulty-selector, .uprate-selector {
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.judge-selector select, .difficulty-selector select, .uprate-selector select {
    margin-left: 5px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

.judge-selector select option, .difficulty-selector select option, .uprate-selector select option {
    background: #764ba2;
    color: white;
}

.song-selector {
    margin: 10px 0;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

#upload-song-btn {
    padding: 8px 16px;
    font-size: 14px;
}

.online-users-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 200px;
    max-height: 300px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    padding: 15px;
    color: white;
    overflow-y: auto;
    z-index: 1000;
}

.online-users-panel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #667eea;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    padding-left: 5px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-status {
    font-size: 8px;
    background: #48dbfb;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.user-status.playing {
    background: #ff6b6b;
}

.user-status.spectating {
    background: #feca57;
}

.chat-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    height: 350px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    padding: 15px;
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.chat-panel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #667eea;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 5px;
}

.chat-message {
    margin-bottom: 8px;
    padding: 5px 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    word-wrap: break-word;
}

.chat-message .username {
    font-weight: bold;
    color: #48dbfb;
}

.chat-message .timestamp {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 5px;
}

.chat-input {
    display: flex;
    gap: 5px;
}

#chat-input {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#send-chat {
    padding: 8px 16px;
    font-size: 14px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    color: white;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: white;
}

.close:hover {
    opacity: 0.7;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.form-group select option {
    background: #764ba2;
    color: white;
}

#upload-form button[type="submit"] {
    width: 100%;
    margin-top: 10px;
}

.spectating-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: white;
    z-index: 100;
}

.spectating-info {
    text-align: center;
    margin-bottom: 20px;
}

.spectating-info h2 {
    color: #feca57;
    margin-bottom: 10px;
}

.leaderboard-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    padding: 15px;
    color: white;
    z-index: 1000;
    border: 2px solid #667eea;
}

.leaderboard-panel h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #feca57;
    text-align: center;
}

.leaderboard-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.leaderboard-filter select {
    flex: 1;
    padding: 5px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 12px;
}

.leaderboard-filter select option {
    background: #764ba2;
    color: white;
}

#leaderboard-list {
    max-height: 350px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

.leaderboard-entry:nth-child(1) {
    border-left-color: #feca57;
    background: rgba(254, 202, 87, 0.1);
}

.leaderboard-entry:nth-child(2) {
    border-left-color: #c7c7c7;
    background: rgba(199, 199, 199, 0.1);
}

.leaderboard-entry:nth-child(3) {
    border-left-color: #cd7f32;
    background: rgba(205, 127, 50, 0.1);
}

.rank {
    font-weight: bold;
    font-size: 16px;
    min-width: 30px;
}

.score-info {
    flex: 1;
}

.username {
    font-weight: bold;
    color: #48dbfb;
    font-size: 14px;
}

.score-details {
    display: flex;
    gap: 8px;
    font-size: 12px;
    margin: 2px 0;
}

.score {
    color: #feca57;
    font-weight: bold;
}

.accuracy {
    color: #48dbfb;
}

.difficulty {
    color: #ff6b6b;
}

.uprate {
    color: #ff9ff3;
}

.song-title {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-scores {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    padding: 20px;
}