* {
    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;
    padding: 20px;
}

.game-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    text-align: center;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.leaderboard-banner-container {
    margin-bottom: 20px;
}

.leaderboard-banner {
    background: #667eea;
    padding: 10px 20px;
    border-radius: 10px;
    height: 60px;
    position: relative;
    overflow: hidden;
    max-width: 300px;
    margin: 0 auto;
}

.score-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.leaderboard-rolling {
    height: 40px;
    overflow: hidden;
    position: relative;
}

.leaderboard-track {
    display: flex;
    flex-direction: column;
    animation: roll 20s linear infinite;
    white-space: nowrap;
}

.leaderboard-track:hover {
    animation-play-state: paused;
}

.leaderboard-item-small {
    color: white;
    font-size: 0.9em;
    font-weight: bold;
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item-small .rank {
    color: rgba(255, 255, 255, 0.8);
    margin-right: 5px;
}

.leaderboard-item-small .name {
    margin-right: 5px;
}

.leaderboard-item-small .score {
    color: #ffd700;
}

@keyframes roll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-50%);
    }
}

.setup-section {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: bold;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.start-btn, .reset-btn {
    padding: 15px 30px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
}

.start-btn:hover, .reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.start-btn:active, .reset-btn:active {
    transform: translateY(0);
}

.ladder-section {
    margin-top: 30px;
}

.ladder-section.hidden {
    display: none;
}

.canvas-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

#ladder-canvas {
    border: 3px solid #333;
    border-radius: 10px;
    background: white;
    max-width: 100%;
    display: block;
}

.curtain {
    position: absolute;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.98) 0%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(8px);
    border-radius: 0 0 10px 10px;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 10;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.curtain.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.participant-selection {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.participant-selection h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.participant-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.participant-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.participant-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.participant-btn:active {
    transform: translateY(0);
}

.participant-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.reveal-btn {
    padding: 12px 24px;
    background: linear-gradient(45deg, #27ae60, #229954);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.reveal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}


.result-display {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.result-display.hidden {
    display: none;
}

.result-display h2 {
    color: #333;
    margin-bottom: 15px;
}

.result-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.result-item {
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #ddd;
    transition: all 0.3s;
}

.result-item.highlight {
    background: #d4edda;
    border-color: #28a745;
    transform: scale(1.05);
}

.result-item .participant {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.result-item .result {
    font-size: 1.2em;
    color: #667eea;
    font-weight: bold;
}

@media (max-width: 600px) {
    h1 {
        font-size: 2em;
    }

    .game-container {
        padding: 20px;
    }

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

/* 순위 스타일 */
.leaderboard-section {
    margin-top: 20px;
}

.leaderboard-btn {
    padding: 12px 30px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.leaderboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.leaderboard-modal.hidden {
    display: none;
}

.leaderboard-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.leaderboard-content h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}

.player-name-input {
    margin: 20px 0;
    display: flex;
    gap: 10px;
}

#player-name {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.save-btn {
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.save-btn:hover {
    background: #229954;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.leaderboard-item.rank-1 {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.leaderboard-item.rank-2 {
    background: #e2e3e5;
    border-left-color: #6c757d;
}

.leaderboard-item.rank-3 {
    background: #f8d7da;
    border-left-color: #dc3545;
}

.leaderboard-rank {
    font-weight: bold;
    color: #667eea;
    min-width: 30px;
}

.leaderboard-name {
    flex: 1;
    margin-left: 10px;
    color: #333;
}

.leaderboard-score {
    font-weight: bold;
    color: #333;
    min-width: 60px;
    text-align: right;
}

.close-btn {
    width: 100%;
    padding: 12px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.3s;
}

.close-btn:hover {
    background: #7f8c8d;
}